From patchwork Fri Dec 8 14:00:03 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: 121160 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp692358qgn; Fri, 8 Dec 2017 06:00:27 -0800 (PST) X-Google-Smtp-Source: AGs4zMaevRXlxmzDxp06DTTyiL3oK0JdPV2uLYuvNhSuqZWuTfOXyeSpHJZBcYNUsjiD6BEZcMor X-Received: by 10.55.17.150 with SMTP id 22mr35530842qkr.208.1512741627390; Fri, 08 Dec 2017 06:00:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512741627; cv=none; d=google.com; s=arc-20160816; b=GaFIOil/Xo2qOKrOhGbQymT4GwCgkm77hqsEIUFsZ5BSPEU85e6VDVOGG6aa/NbPKr ei6FO1ABMd8NX9qsUa2eZvP94UrNieCWG36tVYr9f69bvaNX46xD/vKj+AtmR/Zbugh7 Yt0tFS1nwhpk8YSes9PhfM+eOrocsUg0lGjQjEVuZm+xsb7dpGbOLFrbRV5xb0FojrkK rRzWcnophjZcnIdVQnjNzbcxDoWUAqt3SCZjuu9L6IT48Of9xCU3bvqQnoGS28EAr/Nn Q4v8ha5Rs2qi1Xkq+xrI330b1EEDYPbY/1FZ18oQ+ZKOGEKf9Iu8gktqkgnL81Z14sWn AxsQ== 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=8REF6al3KEaOi7qBdrqW0P1GhPydwp7lk7JBZcW/zqM=; b=eiwNMrWjPzakDebZgbznqRpV3r6bhO+MuEtFeKZIz0LR9BKhzgcxGcdZ2LbEVYhIGt g8uGVk/KP6jW90Rzhx3KA2PXOHvB4z6ZrZDtnegNsgcd361K2ySCByqBDJpNrpi0xebU djUy9D7imNSimSvdiqCv3Y8H92ED4ISnZcRlT+ZkL+C2VVrcUj1XdUguTVd4cOIv01h6 s+7R+RIu1Nwqre3e1pUlxAcrnn2QIeLTLnNulrzGkS+5PR8VFPYPPccyORttOL3BNmP+ ORt6VPjgp2s8MsnU73hWrw6kP/oo7zr1DJ8UEvts3RaO96a7ts3FbtVub5dNcHZJ4xGd 89MQ== 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 w10si4785237qti.366.2017.12.08.06.00.26; Fri, 08 Dec 2017 06:00:27 -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 77A9F609AB; Fri, 8 Dec 2017 14:00:26 +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,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 11C3D6097C; Fri, 8 Dec 2017 14:00:20 +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 2B6EC6097C; Fri, 8 Dec 2017 14:00:13 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 7084960957 for ; Fri, 8 Dec 2017 14:00:11 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward101o.mail.yandex.net (Yandex) with ESMTP id CD1751344D65 for ; Fri, 8 Dec 2017 17:00:09 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id S30xuaaq8T-09DC8500; Fri, 08 Dec 2017 17:00:09 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bhVzcDRW4Y-09dGrE1Z; 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:03 +0300 Message-Id: <1512741607-12425-2-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 1/5] api: packet: refine layer offset specification 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 Offset functions just point to the start of an layer. Offsets may be set also when a layer does not have a known header or a known header has an error. For example, L4 offset may be set always after a successful parse of L3 (IP) layer. There are other API calls to check if L4 is a known protocol (e.g. packet_has_l4, packet_has_udp), or if it contain errors (e.g. packet_has_l4_error). 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.h | 81 ++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b897c9d3c..149ba4970 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1347,15 +1347,16 @@ uint32_t odp_packet_user_area_size(odp_packet_t pkt); /** * Layer 2 start pointer * - * Returns pointer to the start of the layer 2 header. Optionally, outputs - * number of data bytes in the segment following the pointer. + * Returns pointer to the start of the layer 2. Optionally, outputs + * number of data bytes in the segment following the pointer. The pointer value + * is generated from the current layer 2 offset. * * @param pkt Packet handle * @param[out] len Number of data bytes remaining in the segment (output). * Ignored when NULL. * - * @return Layer 2 start pointer - * @retval NULL packet does not contain a valid L2 header + * @return Layer 2 start pointer + * @retval NULL Layer 2 offset has not been set * * @see odp_packet_l2_offset(), odp_packet_l2_offset_set(), odp_packet_has_l2() */ @@ -1364,16 +1365,16 @@ void *odp_packet_l2_ptr(odp_packet_t pkt, uint32_t *len); /** * Layer 2 start offset * - * Returns offset to the start of the layer 2 header. The offset is calculated - * from the current odp_packet_data() position in bytes. - * - * User is responsible to update the offset when modifying the packet data - * pointer position. + * Returns offset to the start of the layer 2. The offset is calculated + * from the current odp_packet_data() position in bytes. Packet parsing sets + * the offset according to parse configuration and layers recognized in the + * packet. Data start position updating functions (e.g. odp_packet_push_head()) + * do not modify the offset, but user sets a new value when needed. * * @param pkt Packet handle * - * @return Layer 2 start offset - * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L2 header + * @return Layer 2 start offset + * @retval ODP_PACKET_OFFSET_INVALID Layer 2 offset has not been set * * @see odp_packet_l2_offset_set(), odp_packet_has_l2() */ @@ -1382,9 +1383,9 @@ uint32_t odp_packet_l2_offset(odp_packet_t pkt); /** * Set layer 2 start offset * - * Set offset to the start of the layer 2 header. The offset is calculated from + * Set offset to the start of the layer 2. The offset is calculated from * the current odp_packet_data() position in bytes. Offset must not exceed - * packet data length. Packet is not modified on an error. + * packet data length. Offset is not modified on an error. * * @param pkt Packet handle * @param offset Layer 2 start offset (0 ... odp_packet_len()-1) @@ -1397,15 +1398,16 @@ int odp_packet_l2_offset_set(odp_packet_t pkt, uint32_t offset); /** * Layer 3 start pointer * - * Returns pointer to the start of the layer 3 header. Optionally, outputs - * number of data bytes in the segment following the pointer. + * Returns pointer to the start of the layer 3. Optionally, outputs + * number of data bytes in the segment following the pointer. The pointer value + * is generated from the current layer 3 offset. * * @param pkt Packet handle * @param[out] len Number of data bytes remaining in the segment (output). * Ignored when NULL. * - * @return Layer 3 start pointer - * @retval NULL packet does not contain a valid L3 header + * @return Layer 3 start pointer + * @retval NULL Layer 3 offset has not been set * * @see odp_packet_l3_offset(), odp_packet_l3_offset_set(), odp_packet_has_l3() */ @@ -1414,16 +1416,16 @@ void *odp_packet_l3_ptr(odp_packet_t pkt, uint32_t *len); /** * Layer 3 start offset * - * Returns offset to the start of the layer 3 header. The offset is calculated - * from the current odp_packet_data() position in bytes. - * - * User is responsible to update the offset when modifying the packet data - * pointer position. + * Returns offset to the start of the layer 3. The offset is calculated + * from the current odp_packet_data() position in bytes. Packet parsing sets + * the offset according to parse configuration and layers recognized in the + * packet. Data start position updating functions (e.g. odp_packet_push_head()) + * do not modify the offset, but user sets a new value when needed. * * @param pkt Packet handle * - * @return Layer 3 start offset, or ODP_PACKET_OFFSET_INVALID when packet does - * not contain a valid L3 header. + * @return Layer 3 start offset + * @retval ODP_PACKET_OFFSET_INVALID Layer 3 offset has not been set * * @see odp_packet_l3_offset_set(), odp_packet_has_l3() */ @@ -1432,9 +1434,9 @@ uint32_t odp_packet_l3_offset(odp_packet_t pkt); /** * Set layer 3 start offset * - * Set offset to the start of the layer 3 header. The offset is calculated from + * Set offset to the start of the layer 3. The offset is calculated from * the current odp_packet_data() position in bytes. Offset must not exceed - * packet data length. Packet is not modified on an error. + * packet data length. Offset is not modified on an error. * * @param pkt Packet handle * @param offset Layer 3 start offset (0 ... odp_packet_len()-1) @@ -1447,15 +1449,16 @@ int odp_packet_l3_offset_set(odp_packet_t pkt, uint32_t offset); /** * Layer 4 start pointer * - * Returns pointer to the start of the layer 4 header. Optionally, outputs - * number of data bytes in the segment following the pointer. + * Returns pointer to the start of the layer 4. Optionally, outputs + * number of data bytes in the segment following the pointer. The pointer value + * is generated from the current layer 4 offset. * * @param pkt Packet handle * @param[out] len Number of data bytes remaining in the segment (output). * Ignored when NULL. * - * @return Layer 4 start pointer - * @retval NULL packet does not contain a valid L4 header + * @return Layer 4 start pointer + * @retval NULL Layer 4 offset has not been set * * @see odp_packet_l4_offset(), odp_packet_l4_offset_set(), odp_packet_has_l4() */ @@ -1464,16 +1467,16 @@ void *odp_packet_l4_ptr(odp_packet_t pkt, uint32_t *len); /** * Layer 4 start offset * - * Returns offset to the start of the layer 4 header. The offset is calculated - * from the current odp_packet_data() position in bytes. - * - * User is responsible to update the offset when modifying the packet data - * pointer position. + * Returns offset to the start of the layer 4. The offset is calculated + * from the current odp_packet_data() position in bytes. Packet parsing sets + * the offset according to parse configuration and layers recognized in the + * packet. Data start position updating functions (e.g. odp_packet_push_head()) + * do not modify the offset, but user sets a new value when needed. * * @param pkt Packet handle * - * @return Layer 4 start offset - * @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L4 header + * @return Layer 4 start offset + * @retval ODP_PACKET_OFFSET_INVALID Layer 4 offset has not been set * * @see odp_packet_l4_offset_set(), odp_packet_has_l4() */ @@ -1482,9 +1485,9 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); /** * Set layer 4 start offset * - * Set offset to the start of the layer 4 header. The offset is calculated from + * Set offset to the start of the layer 4. The offset is calculated from * the current odp_packet_data() position in bytes. Offset must not exceed - * packet data length. Packet is not modified on an error. + * packet data length. Offset is not modified on an error. * * @param pkt Packet handle * @param offset Layer 4 start offset (0 ... odp_packet_len()-1) 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); From patchwork Fri Dec 8 14: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: 121161 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp694218qgn; Fri, 8 Dec 2017 06:01:33 -0800 (PST) X-Google-Smtp-Source: AGs4zMZGklT31Kbq6c97ZSKVrZTD2fENF7gK3hnky/qWmm+Z/aS8lv+Z0NEVn5cgxOS5eEoHcWdr X-Received: by 10.36.157.129 with SMTP id f123mr6301847itd.39.1512741693480; Fri, 08 Dec 2017 06:01:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512741693; cv=none; d=google.com; s=arc-20160816; b=F0g2XCBuYhEFDGB7GEmeJH4wol4qYcz9IbKbA7AVLi4pORMttINEw8SbLnG7MgeGF9 2amEJ/RPz5cGcYrqdqjbv6HDg8vYq8AUeYR6sEM70yUDb57se8FJyKhDHy/J7eU+1uoD WmEv5UcbobdztFltJwQc4d7vBeyhBc5kkIhhNWi2jxijQ9c6TGHVoImoceB8Drr9r8LT ENwHs7XD2UmQ+cqecjL9DyGSge5psXMxClZU9bLSRm4VPnTdNhzYmsViwuEtOG4mTHg7 4M2ZIRWizp8W2vp2u3vSWzewStsED+gDB3po30rCG3fFN/h14c5dWeLkjBuiRRZTFm0q Vffg== 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=Ti/hcOh3c2ssgyYEVco4swcXDsynxphE17WB8ZcTkro=; b=fobvhYDLyK7Q5dd618dXMwom1MPEWt3zfjRsxCXY2XDkq2ReaQy7qXOtB4MCUPezr/ G2QJffIwPk4QJsAtNDyhrA3efOBUqFDLw6HfH+1fW4jOeBaB/cfKD0VIN5E0fDgGSpo+ OyvM1VW4HrMF75LCFG/AD58T7WZ8tZEQnqSqP5oQwFJGNS30b5NmVBRLKL2uFH68TQVd SC3SP5xSsGILwczqHnck+ZY0uNeReErfMi56Gi1g1XMtsK2ZftXseGbCciK7MRjkXryl HUX+nJE8tx5mDXwKWviaCvmymnB1ALThw9U5DrWj3Xk2EdFguR/bCkjLG3PMFLKc1nMQ otwg== 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 90si5117307iom.1.2017.12.08.06.01.28; Fri, 08 Dec 2017 06:01:33 -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 DE34E60A06; Fri, 8 Dec 2017 14:01:27 +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 726FA60978; Fri, 8 Dec 2017 14:00:25 +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 554B860996; Fri, 8 Dec 2017 14:00:16 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 2E5E060957 for ; Fri, 8 Dec 2017 14:00:13 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 574554443643 for ; Fri, 8 Dec 2017 17:00:11 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 2GyVXR6gEx-0BdOTjZx; Fri, 08 Dec 2017 17:00:11 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bhVzcDRW4Y-0Adm4n4v; Fri, 08 Dec 2017 17:00:10 +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:05 +0300 Message-Id: <1512741607-12425-4-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 3/5] api: packet_flags: adjust white spaces 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 Improve header file readability by aligning param and retval documentation with spaces. 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 | 132 ++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 57 deletions(-) diff --git a/include/odp/api/spec/packet_flags.h b/include/odp/api/spec/packet_flags.h index a4afc10f9..683733e32 100644 --- a/include/odp/api/spec/packet_flags.h +++ b/include/odp/api/spec/packet_flags.h @@ -140,9 +140,10 @@ int odp_packet_has_eth(odp_packet_t pkt); * ODP recognizes the destination MAC address FF:FF:FF:FF:FF:FF as * a broadcast address. All others are considered non-broadcast. * - * @param pkt Packet handle - * @retval non-zero if Ethernet destination address is the broadcast address - * @retval 0 if Ethernet destination address is not the broadcast address + * @param pkt Packet handle + * + * @retval non-zero Ethernet destination address is the broadcast address + * @retval 0 Ethernet destination address is not the broadcast address */ int odp_packet_has_eth_bcast(odp_packet_t pkt); @@ -151,63 +152,70 @@ int odp_packet_has_eth_bcast(odp_packet_t pkt); * * ODP recognizes the destination MAC address as multicast if bit 7 is 1. * - * @param pkt Packet handle - * @retval non-zero if Ethernet destination address is a multicast address - * @retval 0 if Ethernet destination address is not a multicast address + * @param pkt Packet handle + * + * @retval non-zero Ethernet destination address is a multicast address + * @retval 0 Ethernet destination address is not a multicast address */ int odp_packet_has_eth_mcast(odp_packet_t pkt); /** * Check for jumbo frame * - * @param pkt Packet handle - * @retval non-zero if packet contains a jumbo frame - * @retval 0 if packet does not contain a jumbo frame + * @param pkt Packet handle + * + * @retval non-zero Packet is a jumbo frame + * @retval 0 Packet is not a jumbo frame */ int odp_packet_has_jumbo(odp_packet_t pkt); /** * Check for VLAN * - * @param pkt Packet handle - * @retval non-zero if packet contains a VLAN header - * @retval 0 if packet does not contain a VLAN header + * @param pkt Packet handle + * + * @retval non-zero Packet contains a VLAN header + * @retval 0 Packet does not contain a VLAN header */ int odp_packet_has_vlan(odp_packet_t pkt); /** * Check for VLAN QinQ (stacked VLAN) * - * @param pkt Packet handle - * @retval non-zero if packet contains a VLAN QinQ header - * @retval 0 if packet does not contain a VLAN QinQ header + * @param pkt Packet handle + * + * @retval non-zero Packet contains a VLAN QinQ header + * @retval 0 Packet does not contain a VLAN QinQ header */ int odp_packet_has_vlan_qinq(odp_packet_t pkt); /** * Check for ARP * - * @param pkt Packet handle - * @retval non-zero if packet contains an ARP message - * @retval 0 if packet does not contain an ARP message + * @param pkt Packet handle + * + * @retval non-zero Packet contains an ARP message + * @retval 0 Packet does not contain an ARP message */ int odp_packet_has_arp(odp_packet_t pkt); /** * Check for IPv4 * - * @param pkt Packet handle - * @retval non-zero if packet contains an IPv4 header - * @retval 0 if packet does not contain an IPv4 header + * @param pkt Packet handle + * + * @retval non-zero Packet contains an IPv4 header + * @retval 0 Packet does not contain an IPv4 header */ int odp_packet_has_ipv4(odp_packet_t pkt); /** * Check for IPv6 * - * @param pkt Packet handle - * @retval non-zero if packet contains an IPv6 header - * @retval 0 if packet does not contain an IPv6 header + * @param pkt Packet handle + * + * @retval non-zero Packet contains an IPv6 header + * @retval 0 Packet does not contain an IPv6 header */ int odp_packet_has_ipv6(odp_packet_t pkt); @@ -219,9 +227,10 @@ int odp_packet_has_ipv6(odp_packet_t pkt); * * For IPv6, no destination addresses are recognized as broadcast addresses. * - * @param pkt Packet handle - * @retval non-zero if IP destination address is a broadcast address - * @retval 0 if IP destination address is not a broadcast address + * @param pkt Packet handle + * + * @retval non-zero IP destination address is a broadcast address + * @retval 0 IP destination address is not a broadcast address */ int odp_packet_has_ip_bcast(odp_packet_t pkt); @@ -234,91 +243,100 @@ int odp_packet_has_ip_bcast(odp_packet_t pkt); * For IPv6 ODP recognizes destination IP addresses with prefixes FF00:: * through FFFF:: as multicast addresses. * - * @param pkt Packet handle - * @retval non-zero if IP destination address is a multicast address - * @retval 0 if IP destination address is not a multicast address + * @param pkt Packet handle + * + * @retval non-zero IP destination address is a multicast address + * @retval 0 IP destination address is not a multicast address */ int odp_packet_has_ip_mcast(odp_packet_t pkt); /** * Check for IP fragment * - * @param pkt Packet handle - * @retval non-zero if packet is an IP fragment - * @retval 0 if packet is not an IP fragment + * @param pkt Packet handle + * + * @retval non-zero Packet is an IP fragment + * @retval 0 Packet is not an IP fragment */ int odp_packet_has_ipfrag(odp_packet_t pkt); /** * Check for IP options * - * @param pkt Packet handle - * @retval non-zero if packet contains IP options - * @retval 0 if packet does not contain IP options + * @param pkt Packet handle + * + * @retval non-zero Packet contains IP options + * @retval 0 Packet does not contain IP options */ int odp_packet_has_ipopt(odp_packet_t pkt); /** * Check for IPSec * - * @param pkt Packet handle - * @retval non-zero if packet requires IPSec processing - * @retval 0 if packet does not require IPSec processing + * @param pkt Packet handle + * + * @retval non-zero Packet requires IPSec processing + * @retval 0 Packet does not require IPSec processing */ int odp_packet_has_ipsec(odp_packet_t pkt); /** * Check for UDP * - * @param pkt Packet handle - * @retval non-zero if packet contains a UDP header - * @retval 0 if packet does not contain a UDP header + * @param pkt Packet handle + * + * @retval non-zero Packet contains a UDP header + * @retval 0 Packet does not contain a UDP header */ int odp_packet_has_udp(odp_packet_t pkt); /** * Check for TCP * - * @param pkt Packet handle - * @retval non-zero if packet contains a TCP header - * @retval 0 if packet does not contain a TCP header + * @param pkt Packet handle + * + * @retval non-zero Packet contains a TCP header + * @retval 0 Packet does not contain a TCP header */ int odp_packet_has_tcp(odp_packet_t pkt); /** * Check for SCTP * - * @param pkt Packet handle - * @retval non-zero if packet contains a SCTP header - * @retval 0 if packet does not contain a SCTP header + * @param pkt Packet handle + * + * @retval non-zero Packet contains a SCTP header + * @retval 0 Packet does not contain a SCTP header */ int odp_packet_has_sctp(odp_packet_t pkt); /** * Check for ICMP * - * @param pkt Packet handle - * @retval non-zero if packet contains an ICMP header - * @retval 0 if packet does not contain an ICMP header + * @param pkt Packet handle + * + * @retval non-zero Packet contains an ICMP header + * @retval 0 Packet does not contain an ICMP header */ int odp_packet_has_icmp(odp_packet_t pkt); /** * Check for packet flow hash * - * @param pkt Packet handle - * @retval non-zero if packet contains a hash value - * @retval 0 if packet does not contain a hash value + * @param pkt Packet handle + * + * @retval non-zero Packet contains a hash value + * @retval 0 Packet does not contain a hash value */ int odp_packet_has_flow_hash(odp_packet_t pkt); /** * Check for packet timestamp * - * @param pkt Packet handle + * @param pkt Packet handle * - * @retval non-zero if packet contains a timestamp value - * @retval 0 if packet does not contain a timestamp value + * @retval non-zero Packet contains a timestamp value + * @retval 0 Packet does not contain a timestamp value * * @see odp_packet_has_ts_clr() */ From patchwork Fri Dec 8 14:00:06 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: 121165 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp699095qgn; Fri, 8 Dec 2017 06:04:42 -0800 (PST) X-Google-Smtp-Source: AGs4zMbY2oyuHakvzeEFyIDCW6CebjlhdFysXG1srVLyT5Md9WGanHUGHrk/eKkr07odSHQbe2+M X-Received: by 10.36.70.195 with SMTP id j186mr5759207itb.32.1512741882025; Fri, 08 Dec 2017 06:04:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512741882; cv=none; d=google.com; s=arc-20160816; b=DPRmCRoZrmVfLg3P7vpsf/qkN/ZZu/ar+2cTHr6Pcv07oXWGWIUbzD3cyLHQRxd4SN Kzru1Lof4Zg4fVZeV8GxY3sRPBwS8cxpdmyUz1uXWLCT5PDWV+H1K51RhLVElMUc4x46 mENdlEa3yHUUcEl+z4zZr1ebqlQiX2njZjvVBLebwYynnfYCND5+mJrkTorJjrmm5SJZ Xbra/ViTwr9/DxKjTAdNTKSYX7D21G2eVK+7xn1llqI57C77IMQQoNH68PvPfnN95+69 avYJzrPQ8doMSeqasBbwftO30ZtIedXSktB/lsdZ4wq+ZQbRBKkasYd2I71WWZ1+x7Qg 2SXg== 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=7jxaU9GOUwsGhh+5xTTGRTmch7yDtcvanSKfDLIhk0o=; b=aUnZV/UXWoubNVeGR6hHqWvSFcbXpxO1Wg1zkm8CAJDoc/agv68MhdYDBL9JoU3nbS +SE9yMkTkcqBzxISN6aoAEhVWneFMzfQ2tyhxUeJJDGrMwczBS7OvN2UcM38f2ptoL0V pJgC2sSkhAAMXmeUMhz3GK+aYXXPUfDbGs6TJia+KkNqL2NlJt2DgRvESSJiv4rLuKLd zp70vl3oX1NU+vF14f72Uz87batS5EexNwWXMvNyuN6xgJtKzvO4Kk0gZINLW/HKWtzI HhCW/Kj1c0+AD4hYpcIxzMFh1Umvju0JzptYNdxiKZctSbJ6lcx/n0gGYdTZ/VwvpOvi 0Dpg== 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 m63si1218960ite.48.2017.12.08.06.04.41; Fri, 08 Dec 2017 06:04:42 -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 8FD8C60A0B; Fri, 8 Dec 2017 14:04:41 +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,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 D9BAD609F5; Fri, 8 Dec 2017 14:00:55 +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 26FA760978; Fri, 8 Dec 2017 14:00:21 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 8C6DC60978 for ; Fri, 8 Dec 2017 14:00:13 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward103j.mail.yandex.net (Yandex) with ESMTP id EFAEB34C45DF for ; Fri, 8 Dec 2017 17:00:11 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Hk3FEadFEe-0BfO46iu; Fri, 08 Dec 2017 17:00:11 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bhVzcDRW4Y-0Bd4NlNI; Fri, 08 Dec 2017 17: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: Fri, 8 Dec 2017 17:00:06 +0300 Message-Id: <1512741607-12425-5-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 4/5] api: parse: set next layer offset 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 Explicitly require that implementation sets the next layer offset after user defined last parse layer. Next layer offset can be set without checking the layer itself. For example: l4_offset = l3_offset + l3_hdr_len Also renamed packet_parse_param 'layer' to 'last_layer' since it's documenting the usage better: parse.proto = ODP_PROTO_IPV4; parse.last_layer = ODP_PROTO_LAYER_L4; 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/ipsec.h | 13 +++++++++---- include/odp/api/spec/packet.h | 32 +++++++++++++++++--------------- include/odp/api/spec/packet_io.h | 9 +++++++-- platform/linux-generic/odp_packet.c | 2 +- test/validation/api/packet/packet.c | 10 +++++----- 5 files changed, 39 insertions(+), 27 deletions(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index d57815ed2..8a52c9ff6 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -148,10 +148,15 @@ typedef struct odp_ipsec_inbound_config_t { /** Parse packet headers after IPSEC transformation * * Select header parsing level after inbound processing. Headers of the - * resulting packet must be parsed (at least) up to this level. Parsing - * starts from IP (layer 3). Each successfully transformed packet has - * a valid value for L3 offset regardless of the parse configuration. - * Default value is ODP_IPSEC_LAYER_NONE. + * resulting packet must be checked (at least) up to this level. + * Parsing starts from IP (layer 3). Packet metadata from IP to this + * layer is set. In addition, offset (and pointer) to the next layer + * is set. Other layer/protocol specific metadata have undefined + * values. + * + * Each successfully transformed packet has a valid value for L3 offset + * regardless of the parse configuration. Default value is + * ODP_IPSEC_LAYER_NONE. ODP_IPSEC_LAYER_L2 is not a valid value. */ odp_ipsec_proto_layer_t parse; diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 149ba4970..134a5f01c 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1188,7 +1188,7 @@ typedef struct odp_packet_parse_param_t { /** Continue parsing until this layer. Must be the same or higher * layer than the layer of 'proto'. */ - odp_proto_layer_t layer; + odp_proto_layer_t last_layer; /** Flags to control payload data checks up to the selected parse * layer. Checksum checking status can be queried for each packet with @@ -1220,19 +1220,21 @@ typedef struct odp_packet_parse_param_t { /** * Parse packet * - * Parse protocol headers in packet data. Parsing starts at 'offset', which - * is the first header byte of protocol 'param.proto'. Parameter 'param.layer' - * defines the last layer application is interested about. - * Use ODP_PROTO_LAYER_ALL for all layers. A successful operation sets or resets - * packet metadata for all layers from the layer of 'param.proto' to the - * application defined last layer. Metadata of other layers have undefined - * values. When operation fails, metadata of all protocol layers have undefined - * values. + * Parse protocol headers in packet data and update layer/protocol specific + * metadata (e.g. offsets, errors, protocols, checksum statuses, etc). Parsing + * starts at 'offset', which is the first header byte of protocol 'param.proto'. + * Parameter 'param.last_layer' defines the last layer application requests + * to check. Use ODP_PROTO_LAYER_ALL for all layers. A successful operation + * sets (or resets) packet metadata for all layers from the layer of + * 'param.proto' to the application defined last layer. In addition, offset + * (and pointer) to the next layer is set. Other layer/protocol specific + * metadata have undefined values. When operation fails, all layer/protocol + * specific metadata have undefined values. * * @param pkt Packet handle * @param offset Byte offset into the packet - * @param param Parse parameters. Proto and layer fields must be set. Clear - * all check bits that are not used. + * @param param Parse parameters. Proto and last_layer fields must be set. + * Clear all check bits that are not used. * * @retval 0 on success * @retval <0 on failure @@ -1244,14 +1246,14 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, * Parse multiple packets * * Otherwise like odp_packet_parse(), but parses multiple packets. Packets may - * have unique offsets, but must start with the same protocol. Also, packets are - * parsed up to the same protocol layer. + * have unique offsets, but must start with the same protocol. The same + * parse parameters are applied to all packets. * * @param pkt Packet handle array * @param offset Byte offsets into the packets * @param num Number of packets and offsets - * @param param Parse parameters. Proto and layer fields must be set. Clear - * all check bits that are not used. + * @param param Parse parameters. Proto and last_layer fields must be set. + * Clear all check bits that are not used. * * @return Number of packets parsed successfully (0 ... num) * @retval <0 on failure diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h index 60d13043d..9f7305c2c 100644 --- a/include/odp/api/spec/packet_io.h +++ b/include/odp/api/spec/packet_io.h @@ -404,8 +404,13 @@ typedef enum odp_pktio_parser_layer_t { typedef struct odp_pktio_parser_config_t { /** Protocol parsing level in packet input * - * Parse protocol layers in minimum up to this level during packet - * input. The default value is ODP_PKTIO_PARSER_LAYER_ALL. */ + * Application requires that protocol headers in a packet are checked + * up to this layer during packet input. Use ODP_PROTO_LAYER_ALL for + * all layers. Packet metadata for this and all preceding layers are + * set. In addition, offset (and pointer) to the next layer is set. + * Other layer/protocol specific metadata have undefined values. + * + * The default value is ODP_PKTIO_PARSER_LAYER_ALL. */ odp_pktio_parser_layer_t layer; } odp_pktio_parser_config_t; diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index bdcb482fa..55f59178b 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2311,7 +2311,7 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, uint32_t seg_len; uint32_t packet_len = pkt_hdr->frame_len; odp_proto_t proto = param->proto; - odp_proto_layer_t layer = param->layer; + odp_proto_layer_t layer = param->last_layer; int ret; uint16_t ethtype; diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ce4d66c0b..210ce9059 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2450,7 +2450,7 @@ void packet_test_parse(void) } parse.proto = ODP_PROTO_ETH; - parse.layer = ODP_PROTO_LAYER_ALL; + parse.last_layer = ODP_PROTO_LAYER_ALL; parse.all_check = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); @@ -2481,7 +2481,7 @@ void packet_test_parse(void) } parse.proto = ODP_PROTO_IPV4; - parse.layer = ODP_PROTO_LAYER_L4; + parse.last_layer = ODP_PROTO_LAYER_L4; parse.all_check = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); @@ -2511,7 +2511,7 @@ void packet_test_parse(void) } parse.proto = ODP_PROTO_ETH; - parse.layer = ODP_PROTO_LAYER_L4; + parse.last_layer = ODP_PROTO_LAYER_L4; parse.all_check = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); @@ -2541,7 +2541,7 @@ void packet_test_parse(void) } parse.proto = ODP_PROTO_ETH; - parse.layer = ODP_PROTO_LAYER_L4; + parse.last_layer = ODP_PROTO_LAYER_L4; parse.all_check = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); @@ -2572,7 +2572,7 @@ void packet_test_parse(void) } parse.proto = ODP_PROTO_ETH; - parse.layer = ODP_PROTO_LAYER_ALL; + parse.last_layer = ODP_PROTO_LAYER_ALL; parse.all_check = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); From patchwork Fri Dec 8 14:00:07 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: 121164 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp697882qgn; Fri, 8 Dec 2017 06:03:55 -0800 (PST) X-Google-Smtp-Source: AGs4zMa0UsZxMEgLk9QNF+NYVFl6Na7K3BUkOEqpOCQFNXXC4wFTQE1inCzArLXU1Ew0RmNvyEli X-Received: by 10.55.157.66 with SMTP id g63mr12746991qke.59.1512741835749; Fri, 08 Dec 2017 06:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512741835; cv=none; d=google.com; s=arc-20160816; b=qA8zB5eGU8bj37zglJ3v2GhfN9zXI5Y+ed/UaWt91Cv9a+7VqHMafn/r5WlZM4+naq 7x/I9pJfxeAVZBMvnH18Pbl6FfAQzRQfBZ+28K7IuQyGiaYmJGkUOEzxztTn7hhiUPai 3XkGbcjBfyFBIFD3p6H5y2wLb+fpliWxtsJtHarsadgG51cjkZ5MNPHtOFdnv4kxwKTD VGZN33R5onZ7sXfr3XpeFJcWNQpnpmpvrFTIfqd9q1F9LOfe/EDq80Yn/PRS+PTnQkMm QyM5RxmgZjBGpsWEij8c8DWe+r3G4fGQJd3fDMcKMg9oc1KzKLqdM+WgZ54AfktJyma+ OP8w== 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=lQ36G62o0kx0AB+CYcCe6F7M2JKTAPUIBHzgfnH1nqU=; b=ChPf9gY8fPDQaxK/V/vc1HRofRfgYUMMnqIZeVN3BWa2WGHEXjsOF3DB6d9q6VKFUb o2ojEyw46VoSKbFzTQ74EqDyjzq86Igdn3GS+6jS9N0fLSBl20r4/aEHEQdOepnyl06v oy/kTb5CVr4K7JAHCE/iQae3ppEOaOSSsCJaebmdKupc/icmal5Rs4CDFCfKzc7RjmVt N5wE/5ejmLETgGarTjJ5Q0q81QyouBZgoyvpeQIX3ybW9Lh1esYQW0eR9WwnUK0ARnFB PgSWtT9pkSUokvgoj69GuXyTygrvYSVeNyAXbKoDa3ujucOa4PbPyEFfsMcto1qFtrwV U/iw== 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 u78si5958948qkl.203.2017.12.08.06.03.55; Fri, 08 Dec 2017 06:03:55 -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 5EE73609C9; Fri, 8 Dec 2017 14:03:55 +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,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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 8F5E1609DA; Fri, 8 Dec 2017 14:00:47 +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 088E760973; Fri, 8 Dec 2017 14:00:20 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id DCD376097C for ; Fri, 8 Dec 2017 14:00:13 +0000 (UTC) Received: from mxback1j.mail.yandex.net (mxback1j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10a]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 7709C182B16 for ; Fri, 8 Dec 2017 17:00:12 +0300 (MSK) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:6]) by mxback1j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id KnqavtXaxk-0C7mtHAS; Fri, 08 Dec 2017 17:00:12 +0300 Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bhVzcDRW4Y-0CdSdIjI; Fri, 08 Dec 2017 17:00:12 +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:07 +0300 Message-Id: <1512741607-12425-6-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 5/5] linux-gen: packet: set next layer offsets allways 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 Update implementation to follow API change of layer offsets. Set L3 offset always after successful L2 parse. Set L4 offset always after successful L3 parse. 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 **/ platform/linux-generic/odp_packet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 55f59178b..14d0ab63e 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2154,11 +2154,12 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, { uint8_t ip_proto; + prs->l3_offset = offset; + if (layer <= ODP_PKTIO_PARSER_LAYER_L2) return prs->error_flags.all != 0; - /* Set l3_offset+flag only for known ethtypes */ - prs->l3_offset = offset; + /* Set l3 flag only for known ethtypes */ prs->input_flags.l3 = 1; /* Parse Layer 3 headers */ @@ -2166,12 +2167,14 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, case _ODP_ETHTYPE_IPV4: prs->input_flags.ipv4 = 1; ip_proto = parse_ipv4(prs, &parseptr, &offset, frame_len); + prs->l4_offset = offset; break; case _ODP_ETHTYPE_IPV6: prs->input_flags.ipv6 = 1; ip_proto = parse_ipv6(prs, &parseptr, &offset, frame_len, seg_len); + prs->l4_offset = offset; break; case _ODP_ETHTYPE_ARP: @@ -2181,15 +2184,13 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, default: prs->input_flags.l3 = 0; - prs->l3_offset = ODP_PACKET_OFFSET_INVALID; ip_proto = 255; /* Reserved invalid by IANA */ } if (layer == ODP_PKTIO_PARSER_LAYER_L3) return prs->error_flags.all != 0; - /* Set l4_offset+flag only for known ip_proto */ - prs->l4_offset = offset; + /* Set l4 flag only for known ip_proto */ prs->input_flags.l4 = 1; /* Parse Layer 4 headers */ @@ -2235,7 +2236,6 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, default: prs->input_flags.l4 = 0; - prs->l4_offset = ODP_PACKET_OFFSET_INVALID; break; }