From patchwork Mon Dec 11 12:00:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 121376 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2699492qgn; Mon, 11 Dec 2017 04:02:43 -0800 (PST) X-Google-Smtp-Source: ACJfBotWFqaDc0qOgTlZNrdH42daNzfr1wS8eQTV1/Djl3ocIETibXdUrwCB9e6jIPNzFh4eFr2e X-Received: by 10.200.36.22 with SMTP id c22mr159730qtc.207.1512993763885; Mon, 11 Dec 2017 04:02:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512993763; cv=none; d=google.com; s=arc-20160816; b=y4cQqSHGTpePu1a9UswUaseWwanDsv0S7rqB/kq7ZtWv9et3Mbi25Bm+77Xx/I8xyK Sxv7VGUnwT8u3HrNyAOa0ySopBBCZV6wlBE4tklNNN1dp1HpWZFGtkdSB6mj5GAhf+6o Jc5hoZqp2lp7Wbw2zAKmraHrEu6ROaO53UFkH0pilZRYSFnK/nOyDRGIbRJTpXEtdrJ0 138Ehjw1aZf6yDdc6SGJtpPaKKWIzwBGuUzzgkmZuc8+8zKYIVc0UPWyeS+1D0xr2CI+ du4vfD8I4A9aGWAwoaNd4vXr+hgEvbSDNvNXvMfIu7ikDcolEVGiJ4kZzGd+u+R+zMbN SU0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=yYK3t5jpowmV1rPo+KAyJa2iFOi6iLkBKlNnKAoxtdw=; b=WrCqoRVr4CeOtNRYqYzEoKsAtQkoaFm1BMkYArTFSQerIPjqK47o0LTQIMH4Qch8aZ LWhH6eUBHD+TTOVpkz0Y3zd+5NMJA47iDElKxc6o+b6+jO2AErxacFrI61BKe89ZMAgW utBru0nHJnDkt2q2euqrjh8aF1EHaY0V0OZgYSk9viOizv03hkDYp7Y+7sRfD0Kn7TSN betRzgZnGbPUt7eNphhtY6ZMaaiqDNIL3S8PfNDxmkY68xNlrYZ70ZicsWDJ8WBt+4eq 6PuHMoLxHGXqomaQySJ9h7KBkVKkd0M0XIs8JTABOXdaFGoruXxt4xE94pf+fMABNX48 7z8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id h19si1074747qth.440.2017.12.11.04.02.43; Mon, 11 Dec 2017 04:02:43 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 82A7360880; Mon, 11 Dec 2017 12:02:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id DB254608EE; Mon, 11 Dec 2017 12:01:49 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id CDED5608F2; Mon, 11 Dec 2017 12:01:40 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 2A81560925 for ; Mon, 11 Dec 2017 12:00:13 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward104o.mail.yandex.net (Yandex) with ESMTP id A5F1F701F77 for ; Mon, 11 Dec 2017 15:00:11 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Icw3Qbx9LQ-0BU8dCbg; Mon, 11 Dec 2017 15:00:11 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 05zxW8uoau-0BkSM8Rj; Mon, 11 Dec 2017 15:00:11 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Mon, 11 Dec 2017 15:00:05 +0300 Message-Id: <1512993608-19038-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512993608-19038-1-git-send-email-odpbot@yandex.ru> References: <1512993608-19038-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 332 Subject: [lng-odp] [PATCH API-NEXT v2 2/5] api: packet_flags: refine error and layer flags X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Error flag functions (packet_has_error, packet_has_l4_error) indicate if an error was found. Layer flag functions (packet_has_l4) tell if parser did found and checked a protocol (header) of a layer. Both are controlled by parser configuration. Signed-off-by: Petri Savolainen --- /** Email created from pull request 332 (psavol:next-l4-offset) ** https://github.com/Linaro/odp/pull/332 ** Patch: https://github.com/Linaro/odp/pull/332.patch ** Base sha: 0980001e33b4190133d478a0aa2e718fd1e3c164 ** Merge commit sha: 821e53e2ab0847f73ddb171a65e3e4fc5d28e64f **/ include/odp/api/spec/packet_flags.h | 104 ++++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 40 deletions(-) diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h index 377b75ba0..e940f00f4 100644 --- a/include/odp/api/spec/packet_flags.h +++ b/include/odp/api/spec/packet_flags.h @@ -23,87 +23,111 @@ extern "C" { #include /** @addtogroup odp_packet - * Boolean operations on a packet. + * Operations on packet metadata flags. * @{ */ /** - * Check for packet errors + * Check for all errors in packet * - * Checks all error flags at once. + * Check if packet parsing has found any errors in the packet. The level of + * error checking depends on the parse configuration (e.g. included layers and + * checksums). Protocol layer functions (e.g. odp_packet_has_l3()) indicate + * which layers have been checked, and layer error functions + * (e.g. odp_packet_has_l3_error()) which layers have errors. * - * @param pkt Packet handle - * @retval non-zero packet has errors - * @retval 0 packet has no errors + * @param pkt Packet handle + * + * @retval non-zero Packet has errors + * @retval 0 No errors were found */ int odp_packet_has_error(odp_packet_t pkt); /** - * Check for packet L2 errors + * Check for errors in layer 2 * - * check for all L2 errors + * When layer 2 is included in the parse configuration, check if any errors were + * found in layer 2 of the packet. * - * @param pkt Packet handle - * @retval non-zero packet has L2 errors - * @retval 0 packet has no L2 error + * @param pkt Packet handle + * + * @retval non-zero Packet has errors in layer 2 + * @retval 0 No errors were found in layer 2 */ int odp_packet_has_l2_error(odp_packet_t pkt); /** - * Check for L2 header, e.g. ethernet + * Check for errors in layer 3 * - * @param pkt Packet handle - * @retval non-zero if packet contains a valid & known L2 header - * @retval 0 if packet does not contain a valid & known L2 header + * When layer 3 is included in the parse configuration, check if any errors were + * found in layer 3 of the packet. + * + * @param pkt Packet handle + * + * @retval non-zero Packet has errors in layer 3 + * @retval 0 No errors found in layer 3 */ -int odp_packet_has_l2(odp_packet_t pkt); +int odp_packet_has_l3_error(odp_packet_t pkt); /** - * Check for packet L3 errors + * Check for errors in layer 4 * - * check for all L3 errors + * When layer 4 is included in the parse configuration, check if any errors were + * found in layer 4 of the packet. * - * @param pkt Packet handle - * @retval non-zero packet has L3 errors - * @retval 0 packet has no L3 error + * @param pkt Packet handle + * + * @retval non-zero Packet has errors in layer 4 + * @retval 0 No errors were found in layer 4 */ -int odp_packet_has_l3_error(odp_packet_t pkt); +int odp_packet_has_l4_error(odp_packet_t pkt); /** - * Check for L3 header, e.g. IPv4, IPv6 + * Check for layer 2 protocols * - * @param pkt Packet handle - * @retval non-zero if packet contains a valid & known L3 header - * @retval 0 if packet does not contain a valid & known L3 header + * When layer 2 is included in the parse configuration, check if packet parsing + * has found and checked a layer 2 protocol (e.g. Ethernet) in the packet. + * + * @param pkt Packet handle + * + * @retval non-zero A layer 2 protocol header was found and checked + * @retval 0 No layer 2 protocol was found */ -int odp_packet_has_l3(odp_packet_t pkt); +int odp_packet_has_l2(odp_packet_t pkt); /** - * Check for packet L4 errors + * Check for layer 3 protocols * - * check for all L4 errors + * When layer 3 is included in the parse configuration, check if packet parsing + * has found and checked a layer 3 protocol (e.g. IPv4, IPv6) in the packet. * - * @param pkt Packet handle - * @retval non-zero packet has L4 errors - * @retval 0 packet has no L4 error + * @param pkt Packet handle + * + * @retval non-zero A layer 3 protocol header was found and checked + * @retval 0 No layer 3 protocol was found */ -int odp_packet_has_l4_error(odp_packet_t pkt); +int odp_packet_has_l3(odp_packet_t pkt); /** - * Check for L4 header, e.g. UDP, TCP, SCTP (also ICMP) + * Check for layer 4 protocols * - * @param pkt Packet handle - * @retval non-zero if packet contains a valid & known L4 header - * @retval 0 if packet does not contain a valid & known L4 header + * When layer 4 is included in the parse configuration, check if packet parsing + * has found and checked a layer 4 protocol (e.g. UDP, TCP, SCTP) in the packet. + * + * @param pkt Packet handle + * + * @retval non-zero A layer 4 protocol header was found and checked + * @retval 0 No layer 4 protocol was found */ int odp_packet_has_l4(odp_packet_t pkt); /** * Check for Ethernet header * - * @param pkt Packet handle - * @retval non-zero if packet contains a valid eth header - * @retval 0 if packet does not contain a valid eth header + * @param pkt Packet handle + * + * @retval non-zero Packet contains an Ethernet header + * @retval 0 Packet does not contain an Ethernet header */ int odp_packet_has_eth(odp_packet_t pkt);