From patchwork Fri Dec 8 14:00:04 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: 121163 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp696494qgn; Fri, 8 Dec 2017 06:03:00 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ09GEtfRumAZl2jnQLGEXslMEBeqxKKmxJ8uj1RJEmN99ixIB4xwjT00AsJ+SI8SvRKCDz X-Received: by 10.200.54.198 with SMTP id b6mr15128496qtc.48.1512741780837; Fri, 08 Dec 2017 06:03:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512741780; cv=none; d=google.com; s=arc-20160816; b=FenyRndcj1fBbBTHGOvVqIMXBjalBF6vjrR/6jWDML+AwlViqubhvPRlBsCQvLqKQK zvwxv6KjBJr6wrWXXws0RNR/VoEXlfcY3DeeME2VRYjX22kxK9T2WuwPwiYCjNVNrscU KyWFPe/h64nWU1R5THV1RPaCFhYRU6lWbkmqzveSL7sULarMrnW+lQ9Dh7ExbisCKA9h 5924HMNZ7gymz9UJtCi6h7POitdgXX+hrA1m+SXfFqc4u6tNmWVuKwP5NVmUXMQpw+8r oyWlYW1sPbUybn2hTqnfXMSZ/0PsL7e0RDsp54PhehEU9uCahywXw77H1j/NdumTmp0y dfzA== 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=udI8BjJeD3eyuD6GPVW0cEJj1TPkvUfnYqx1sWZ30sQ=; b=V+QRtbjBSLVPvIBKR17IKso+T6/fDniVAT47Aj7Dw9iw1HCJZ0fzQJ7N/TYCA0/m3p sDxx+T/dWSvKv70+Ybruix82b5ejmFUOAlWIa/cWRKBEljgNNKIpGaZC2i8e/dkPKBtW u+vgwMIF8RP6f0g934KBwdIO16xTx7d0VV2UM7cMdNSqtbgLByZ4Hmewsau3qOgoK2QC jpktNnp1M7yhqbQq5yV94899eLp0igzdSjhXlKk1C2C/KgCk+Z0HYPUvNF89MSQj+4Gn djMbbQoLJOkkCXFV61GRCUfENj8SE0HYKZnPArLg4sSe1OnXXFBX6RSzdh+KfYu+ChO6 NLWQ== 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 k68si5992907qkb.483.2017.12.08.06.03.00; Fri, 08 Dec 2017 06:03:00 -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 7CDEE60A31; Fri, 8 Dec 2017 14:03:00 +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=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, 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 2B264609C3; Fri, 8 Dec 2017 14:00:43 +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 89F3C60991; Fri, 8 Dec 2017 14:00:19 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id 1773660973 for ; Fri, 8 Dec 2017 14:00:12 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward105p.mail.yandex.net (Yandex) with ESMTP id 58A8D408185E for ; Fri, 8 Dec 2017 17:00:10 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iT2ricVvfH-0A504o7S; Fri, 08 Dec 2017 17:00:10 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bhVzcDRW4Y-09dqH2Pv; Fri, 08 Dec 2017 17:00:09 +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: Fri, 8 Dec 2017 17:00:04 +0300 Message-Id: <1512741607-12425-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512741607-12425-1-git-send-email-odpbot@yandex.ru> References: <1512741607-12425-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 332 Subject: [lng-odp] [PATCH API-NEXT v1 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: cd9b8173d9b3bfc056941b52dd6bb50af9c698b9 **/ include/odp/api/spec/packet_flags.h | 107 ++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 40 deletions(-) diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h index 377b75ba0..a4afc10f9 100644 --- a/include/odp/api/spec/packet_flags.h +++ b/include/odp/api/spec/packet_flags.h @@ -23,87 +23,114 @@ 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 have found any errors in the packet. The level of + * error checking depends on 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 + * Check if packet parsing have found any errors in layer 2 of the packet. + * Make sure that the layer is included into parse configuration. * - * @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 + * Check if packet parsing have found any errors in layer 3 of the packet. + * Make sure that the layer is included into parse configuration. + * + * @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 + * Check if packet parsing have found any errors in layer 4 of the packet. + * Make sure that the layer is included into parse configuration. * - * @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 + * Check if packet parsing have found and checked a layer 2 protocol + * (e.g. Ethernet) in the packet. Make sure that the layer is included into + * parse configuration. + * + * @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 + * Check if packet parsing have found and checked a layer 3 protocol + * (e.g. IPv4, IPv6) in the packet. Make sure that the layer is included into + * parse configuration. * - * @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 + * Check if packet parsing have found and checked a layer 4 protocol + * (e.g. UDP, TCP, SCTP) in the packet. Make sure that the layer is included + * into parse configuration. + * + * @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);