From patchwork Mon Dec 11 12: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: 121377 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2700514qgn; Mon, 11 Dec 2017 04:03:30 -0800 (PST) X-Google-Smtp-Source: ACJfBotH3k8nD7RrXy8EEpg3GnWtLGBAgR+Y83QfiseLRjbU9vRR62Zf/vhBvI888Ptw4tE90EYp X-Received: by 10.55.43.156 with SMTP id r28mr205286qkr.316.1512993810659; Mon, 11 Dec 2017 04:03:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512993810; cv=none; d=google.com; s=arc-20160816; b=y+dYzqw/xCmleKKlIbuadDc/WvSnDdCgCp4mWAugeEkHeXaunUPv0einVusYXJO0qN GlB+RNIZTaJ/dV6DsOQF4X5U9hwqsODxpr2j2k08+8NXkai+w5HaWVDEYIPYt4vhUAwt JmzUx/DL02TLvU6ubA2chYI32V2aegk1klbwxmZ5TbMg7A++SmT5AaUcoFfcvQFRdSpj 1cnivXbO0kcVqcueBsAzNUItsWTnxaJ6OB/00wQRhlfLC3wwzsdFxol8OB4YWhvC05OF TkeFgpjLzsjgPPU1Mlx5azdlp/pb2R2A0AK8FyiWs/e/IO/rgeVwvj1eg1wBVvNBaW8X uw+A== 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=NFjL9WKRqmuIxrihJYCRyUdDTDYY9UIPmBJlIQWG7xY=; b=NlfUpKQcmMn+xL1tOifr1h7DDS3Sswoqoljn5Kmj/tmrqrUbZcYxrXxIy9tjcWHX22 HElJbgSJyN24SKGG0832Ev4C4bVpk0nFmcsf/VqpRbgDv5wleqO9bufFRLzJ5OB30G1+ KgNd5mdQX/+X4LDhLoIfIo3AkDl7AMM8PMX22GRfFgMpml100mppShPmiju/mSMBPasZ 4iI8H6rFB657ZsyvoVFTe6tRsEQBmt/0a/00v85ZThBbR3O1z/o1ICXqjf8Mzsv+YsXa eFkCnEQ9EpvcsWUEA7LG0Hnt2btffqMgt3xV1NDtWbmCzyqyi415sc6PwBXAuYhBfqDr pewg== 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 131si2165039qkh.455.2017.12.11.04.03.30; Mon, 11 Dec 2017 04:03:30 -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 566AB60880; Mon, 11 Dec 2017 12:03:30 +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 51AA9608DF; Mon, 11 Dec 2017 12:01:56 +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 E2FC2608F2; Mon, 11 Dec 2017 12:01:41 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id D92C060907 for ; Mon, 11 Dec 2017 12:00:12 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward106p.mail.yandex.net (Yandex) with ESMTP id F40DD2D829BC for ; Mon, 11 Dec 2017 15:00:10 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 615nBQL5wC-0A6GYlAH; Mon, 11 Dec 2017 15:00:10 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 05zxW8uoau-09keVt2g; Mon, 11 Dec 2017 15: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: Mon, 11 Dec 2017 15:00:04 +0300 Message-Id: <1512993608-19038-2-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 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: 821e53e2ab0847f73ddb171a65e3e4fc5d28e64f **/ include/odp/api/spec/packet.h | 87 ++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 42 deletions(-) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b897c9d3c..d444c317a 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 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 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 - * the current odp_packet_data() position in bytes. Offset must not exceed - * packet data length. Packet is not modified on an error. + * Set offset to the start of layer 2. The offset is calculated from the current + * odp_packet_data() position in bytes. Offset must not exceed 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 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 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 - * the current odp_packet_data() position in bytes. Offset must not exceed - * packet data length. Packet is not modified on an error. + * Set offset to the start of layer 3. The offset is calculated from the current + * odp_packet_data() position in bytes. Offset must not exceed 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 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 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 - * the current odp_packet_data() position in bytes. Offset must not exceed - * packet data length. Packet is not modified on an error. + * Set offset to the start of layer 4. The offset is calculated from the current + * odp_packet_data() position in bytes. Offset must not exceed 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 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); From patchwork Mon Dec 11 12: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: 121381 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2703641qgn; Mon, 11 Dec 2017 04:05:55 -0800 (PST) X-Google-Smtp-Source: ACJfBotRzmAwA4ujwVHQeReIiksFJgvArbW0xTwAwfSuJi0CRWIGWbrVWqzwvVxhW7TnVaG5R2a4 X-Received: by 10.55.203.156 with SMTP id u28mr174053qkl.353.1512993955379; Mon, 11 Dec 2017 04:05:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512993955; cv=none; d=google.com; s=arc-20160816; b=af++l0yTIBd4hYZ2E+PlHth9n/n4PLtIlpVP/h7gUDxGmKWTNuBSSbTJCo4EHSEqzI OjzXn8oLAaD5/DAgliQ6tDI3II/KfK0CUvKrdLRGEbgJKOa9+pNwFYLBlSfmn2hAA/sJ mvA5r8TU8c0rEblWflYmFs+zJMS1AbLZtIV3tE/u1vYol49f/5jgopjRyt5s10wMmnut GNtT0NodsUM+XUI8CBZIkKWK0jRSBPLEaoIsnICnb+mj0WzXod0RkD3bcRuNB+p0dlt8 W3j3fLDyWgJtPJWiF3PVcUSdwqIWxx87zHVxMVjpRGSz5mDgMufoevw1qgs9yjpzkSbz UyMw== 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=tZoUSNxBJdmMD8yao8EvGRW61pi0msPEivRLC1IS9NU=; b=0Fa5QiJzgRflcu34l7KvXq/Ctvm3IMxD1X+TwtwG5bL5+cY+rkgdxVIRF3B/r8W8AF QxCX6YWC9y9s8WCp3tl5DhktkG6S+hrNgmbJvUxSwal0BicZ7nRTDb83yFIiudH+hWuM hoypLATtNo7mxm6yac02a3OhEZIuvqZObngxpMKHOkgIyC0rWEtPGppUFfq0rfV7qpik BVoUHjo+zi69I75iPZu+n5+tA5a5DLHJN3x+/CoccVDi73mN+fDL3sQfI5VoHu5fj1nB E3mQRbykNgakJEtAuESpPY1IbQ4LDX/rgNkT0AeGcrPE/4OV+BZBI97BvQ1BzcNfxrCP Dzfg== 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 e30si6195330qtc.128.2017.12.11.04.05.54; Mon, 11 Dec 2017 04:05: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 E08F160902; Mon, 11 Dec 2017 12:05:54 +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 0E1BB60922; Mon, 11 Dec 2017 12:02:10 +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 6408E608F2; Mon, 11 Dec 2017 12:01:44 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 8B70960916 for ; Mon, 11 Dec 2017 12:00:13 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 864872D82A8C for ; Mon, 11 Dec 2017 15:00:12 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id i5icYp5FoR-0CSSrNvq; Mon, 11 Dec 2017 15:00:12 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 05zxW8uoau-0BkmVslX; 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:06 +0300 Message-Id: <1512993608-19038-4-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 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: 821e53e2ab0847f73ddb171a65e3e4fc5d28e64f **/ 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 e940f00f4..dfbed4bb7 100644 --- a/include/odp/api/spec/packet_flags.h +++ b/include/odp/api/spec/packet_flags.h @@ -137,9 +137,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); @@ -148,63 +149,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); @@ -216,9 +224,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); @@ -231,91 +240,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 Mon Dec 11 12: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: 121378 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2702036qgn; Mon, 11 Dec 2017 04:04:39 -0800 (PST) X-Google-Smtp-Source: ACJfBosqz2HnAb9lvcgylr4g07xGvLTB1P739xEPm7XHElHUthlApNFJGrv4fz6EPz8hJf9c/Yzd X-Received: by 10.55.82.84 with SMTP id g81mr173610qkb.263.1512993878936; Mon, 11 Dec 2017 04:04:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512993878; cv=none; d=google.com; s=arc-20160816; b=sa/jmpwIRDPowpbeU8/7PO8jIst39O5hPa/TalpLAET/8nFKSdJUBEiAM+PfLdnAws yVMAoxGTeiPjtFzEYMimXl8If4U2h4OiuOWpOKBz9+3TazLd4fHLeyuAOeTOI1zTzDFh qDXO+RbL1Q2gPQKMwAjnM4GgjohoNGNDPHHmgHuk1kjhJ2j6ZujNHsuaZG85AjZXkaYv 09zsrjJtrEoViLarmFFXOdqy9jktOzCezCYbN3NBgRdhr8uDUzj5N0bOkQtqUqIg61SO lFKIHxoMPRFc8QF5bx8vW4sJE756M6bciPhSu4zYbnmM+xh308cxMB469I6yJiK718A7 exIQ== 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=9P+pyddPfIqRByxqAjvPUolXP9FqGin6EwKdEBEbCtw=; b=lb6Yso/8z/56qmkVapcm++7zqQOYXHoI4+rdBjewzTajgiU6rzyhZ88Nezw5/8DoTj hOeQSrCkTfi26fawL5scu12YMHfP6OpTaiB3aGf5Ca3a6tRYMfQpCFyk6qO98whiFUfM zNsElQ0YC8g+pJKB6BNWB4smg2dMQZ+g5R6JYK5Yp2e7hppmyJjrlSpSUiwWPS6Z11D9 Zeci7k7EYa8HrxviU4AchRQnjMlQ/zr9AmYADau6vmH2fiHxQB8HRk2wuesKJiY/XeLV zQJWqGL6G7859/kmOwz0eRjxZ0f4br8O3B6/+Jg26ZeqVJsrzomif8l/5W/xyG2Cvzmm UtLg== 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 g4si9210233qkb.226.2017.12.11.04.04.38; Mon, 11 Dec 2017 04:04:38 -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 A25C1608FC; Mon, 11 Dec 2017 12:04:38 +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 B356E608FF; Mon, 11 Dec 2017 12:02:04 +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 7BF61608F2; Mon, 11 Dec 2017 12:01:43 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 67B8560927 for ; Mon, 11 Dec 2017 12:00:14 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 62FD32D829F1 for ; Mon, 11 Dec 2017 15:00:13 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 412MRA0mmb-0DfOtUNB; Mon, 11 Dec 2017 15:00:13 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 05zxW8uoau-0CkeutXB; Mon, 11 Dec 2017 15: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: Mon, 11 Dec 2017 15:00:07 +0300 Message-Id: <1512993608-19038-5-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 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: 821e53e2ab0847f73ddb171a65e3e4fc5d28e64f **/ 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 d444c317a..ec8dca673 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 Mon Dec 11 12:00:08 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: 121380 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2703534qgn; Mon, 11 Dec 2017 04:05:50 -0800 (PST) X-Google-Smtp-Source: ACJfBosbaYUgEqrE/PINXl3L8JlPjPqVPAyUaFT+ZNlvUrVX06U/TeOC7BixccQwiuekyZzbtwxG X-Received: by 10.237.57.202 with SMTP id m68mr173642qte.185.1512993950467; Mon, 11 Dec 2017 04:05:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512993950; cv=none; d=google.com; s=arc-20160816; b=RD16CFhJFLYoKeDN92tkiy+2ChlVpvTS9xAbXYc4r2awRXY0OrHF89t20t+TVuoOAP zQjBaTtzyuUQFTC4FcYji6kVoGB+qHzEaQXyriOGliNjQGyp+1o4gIEceubOHH4115EI +Ptu8O5a111OAYVOHttHyzvlU6LL5/8D00xjSXuQ02wHxrskjKmDdunPXLFVj/twOAjq t0wZKEif10Bw3kqPr6jpFqpqWIbnx8FcuNoe7G4IJwtE6F4g1DetAPi3aF3aOONcrp5B ENOwjkbF4qBJ9Q8TH4eEaemuYWVjwEqroEWBoKBe7wUnYW+QK/zhKi8S5VRxSatM1vxe g1kw== 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=GrpW6AKRJhFMq1DNcxQUzsdQgm0ZIxMyBlCpJRpv+qE=; b=bzF4Tpw9uTVbNCBn9w/n2FEop7O5hLWjMqQLA+FgProNzYPbzlODxdYfuAc4B/na0b QmgCXyIAlmAIPj2M1tzOOSD1UGhuRIHLqjRloa3YXR9LBLyuENR0cyvagRzG0M8Gpti7 jrP/Tk1iFGD54Zu4FLSmt0oa5Ip7CQN8MVa3PK5yRs7Um3VnwtKr1hltVQs4sRAdC7oL 2OrNuJoWwEws7jgZSK38N/h1aU7HQGIlkimefaPv9Rxk0+9jyVZXZ9RpoV+oDZ3qCUWI LXLiRTQxrOcdQzpuJ3imD+YwKdI98514hTWmHionCg6GGpsEPn6xZlt/gEE2xy5Pv1V+ g2Yg== 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 z130si4410639qka.432.2017.12.11.04.05.50; Mon, 11 Dec 2017 04:05:50 -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 0C892608FF; Mon, 11 Dec 2017 12:05:50 +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 305D960902; Mon, 11 Dec 2017 12:02:13 +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 D0DFC608F2; Mon, 11 Dec 2017 12:01:45 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id AA54360840 for ; Mon, 11 Dec 2017 12:00:16 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 04E334441B76 for ; Mon, 11 Dec 2017 15:00:14 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id FLz0vMaTAS-0DQelPMl; Mon, 11 Dec 2017 15:00:13 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 05zxW8uoau-0DkSMKvE; Mon, 11 Dec 2017 15:00:13 +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:08 +0300 Message-Id: <1512993608-19038-6-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 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: 821e53e2ab0847f73ddb171a65e3e4fc5d28e64f **/ 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; }