From patchwork Thu Nov 9 09:00:14 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: 118401 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6333568qgn; Thu, 9 Nov 2017 01:03:36 -0800 (PST) X-Google-Smtp-Source: ABhQp+RUE3mWySua4Jp/woXHaIq6bcbhFWsqb/3Ft1oTvX6JrToGtDaRTL1Sg+Wp48kttzue3gry X-Received: by 10.200.23.153 with SMTP id o25mr5375672qtj.119.1510218216515; Thu, 09 Nov 2017 01:03:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510218216; cv=none; d=google.com; s=arc-20160816; b=L1l6eF+6+TQiWTLz3rWEl1IX6XIwRrauorBM2HYtYvRSE9ow65nyO4C/MtI/axPgyN 6wiTWS2S9O8GBXN7WlfnBr3HJWA86EA7GUSxoR5AeW62mc7464ypLDQHpuMK0FBVCG8V st+AMONm1z6lTKVLD3Hl3GNOk5slSHD4ej3aOL4u4s4esRb7QPCSXi6OWrQOvxKoyFDI spLosy2B8stdiu/3fY2aqdjwHQQRasBwNrSMnDJI6OMNM9DRwqtfZUURq3wPW9Qs4oP0 OJHm+EyNr+u05uGNAPPz6Z/YWZgiPmR6h0VExxZPfdzq1szg3JkoeNvuMWIC68TIypXL HTZw== 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=izg6+LsSj2B0uTYwxq3AclEWQmUG0T4NG47uIYu34jM=; b=NtaiOygusJ1BndN4f6t7NI7/RpUIiI+p1OvZFG2oOMX417aotMdythV1Ht7nJ1mmb8 HcKzf8Y8mW9UylKWPw+1wupOxf7jDkW0osfoPCpPMflNEgxSPRXlVreMseYak0Ub74r8 q7EQGejfd8OSJaDhclibOa04jn8jg6dARNghExtsYgFMYRIBMRwP4+WIao4wstrTGRmF gyEhqol0jLWhDIVOSd8a9G97Qs/LpNlOK/5XL1HWN6Em2nnSFPYyZiGNxaOnAWH2L3EO b9/rVhq8kjuun9GU9TnEtAjpVTxODbzdXjILGNRr1P57ahhCqgNKDRdJ4kg0DXIc/SUN imIg== 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 w49si3766100qtw.419.2017.11.09.01.03.36; Thu, 09 Nov 2017 01:03:36 -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 2FB3C60C25; Thu, 9 Nov 2017 09:03:36 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 6700660C5C; Thu, 9 Nov 2017 09:00:57 +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 2985360593; Thu, 9 Nov 2017 09:00:41 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id A03A060593 for ; Thu, 9 Nov 2017 09:00:34 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward100j.mail.yandex.net (Yandex) with ESMTP id B0DB45D825D4 for ; Thu, 9 Nov 2017 12:00:21 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id BDWAHjCJdv-0LdGD9Sd; Thu, 09 Nov 2017 12:00:21 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AXFYGb2yvs-0Ktqsok5; Thu, 09 Nov 2017 12:00:20 +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: Thu, 9 Nov 2017 12:00:14 +0300 Message-Id: <1510218017-21165-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> References: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 269 Subject: [lng-odp] [PATCH API-NEXT v2 1/4] linux-gen: packet: add L3/L4 checksum validation 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: Bogdan Pricope Add L3/L4 checksum validation flags to signal if operation was performed by the platform and its result. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 269 (bogdanPricope:api_next_csum_status_pr) ** https://github.com/Linaro/odp/pull/269 ** Patch: https://github.com/Linaro/odp/pull/269.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 31b12178be4753494e806513020d7706600c8382 **/ platform/linux-generic/include/odp/api/plat/packet_types.h | 3 +++ platform/linux-generic/include/odp_packet_internal.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/platform/linux-generic/include/odp/api/plat/packet_types.h b/platform/linux-generic/include/odp/api/plat/packet_types.h index 68c66312b..050f69dc5 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_types.h @@ -150,6 +150,9 @@ typedef union { uint64_t color:2; /**< Packet color for traffic mgmt */ uint64_t nodrop:1; /**< Drop eligibility status */ + + uint64_t l3_chksum_done:1; /**< L3 checksum validation done */ + uint64_t l4_chksum_done:1; /**< L4 checksum validation done */ }; } _odp_packet_input_flags_t; diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index fed562aa3..950e1bb5c 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -51,8 +51,10 @@ typedef union { uint32_t snap_len:1; /**< Snap length error */ uint32_t l2_chksum:1; /**< L2 checksum error, checks TBD */ uint32_t ip_err:1; /**< IP error, checks TBD */ + uint32_t l3_chksum:1; /**< L3 checksum error */ uint32_t tcp_err:1; /**< TCP error, checks TBD */ uint32_t udp_err:1; /**< UDP error, checks TBD */ + uint32_t l4_chksum:1; /**< L4 checksum error */ }; } error_flags_t; From patchwork Thu Nov 9 09:00:15 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: 118400 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6332020qgn; Thu, 9 Nov 2017 01:02:13 -0800 (PST) X-Google-Smtp-Source: AGs4zMa75N64xgyduksB0rcXZ3LdCcyKs++L5Z6vBCwjM/Fi+V4eO7AcGMFrb4d2UV9+ywPvj9be X-Received: by 10.107.21.131 with SMTP id 125mr4312426iov.295.1510218132869; Thu, 09 Nov 2017 01:02:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510218132; cv=none; d=google.com; s=arc-20160816; b=zY1sSHgmpoo11t5rfGwiUebAchSJJUrn8vKfd+LJEozJ91ipu6eABjotM8WsxEFOA3 +BMjdgNztgeeF1taCUvCpdSxz8xntogFJk4Qx94E+/jwhMCcJY/tjq4sGKR38RxnEnTJ aE5lzLZL1PZ8WyrH+574wOrWcBugMW2kZmp0oFyNBsWvQT+YPggix0qM9/BNq3oVpxMF bhOS/EO0U2fo8XELepYv06QhfO6M9i+YLAQg4eSMmr1v8Z+GAKm8/6PnZHW/+ybHfEJg yglGaypw91bzdd4Kbsq7qvfLn1eYk5HEcnPHdV02/TFTVi9R8cg11qkE6mi9bTOqVteC g0Sw== 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=Tcjo9KxigGl9FcyXDCitw+barLEdiX5VwWPNtHT9xWY=; b=gUuuvgPF0l4dtOwDSTmU18/7AEcNQ/BwaFOuhpx4F1paFvs1wnzM5aNcl2Vq0LYXG1 mvAiCNgdcregtl1mciJrzS7POAE70FUn4y61QPuNOut46N5At1nJ4veY4pfH7wWyh4b5 hIaSANHDjtUIQGY9fUIkK1Y4g8Jv9QvogVS85YdsOUBigWS3gNsbqQyUDqnPOFihdDVu yu0RQDR8WmRUP3taEKrbtTDvsAVQpZH4c2ykE0+z2w4XF6D0dhu2S0F77NXkTHQ2H79Y w9MaLNERruBNZsW4N/vs8vKsW46MaOOfhXp65hNzYMVcJ4KiqBJhuIqjGkA2jSmiF9eC Sf9Q== 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 93si5563683iok.82.2017.11.09.01.02.12; Thu, 09 Nov 2017 01:02:12 -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 26FCC607B2; Thu, 9 Nov 2017 09:02:12 +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 C0CC860C1D; Thu, 9 Nov 2017 09:00:53 +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 6D4E460594; Thu, 9 Nov 2017 09:00:31 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 5167B60593 for ; Thu, 9 Nov 2017 09:00:25 +0000 (UTC) Received: from mxback16j.mail.yandex.net (mxback16j.mail.yandex.net [IPv6:2a02:6b8:0:1619::92]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 77A0956043B9 for ; Thu, 9 Nov 2017 12:00:23 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback16j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id u5TfvGFI1V-0MYOkBHq; Thu, 09 Nov 2017 12:00:23 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AXFYGb2yvs-0LtWmjqP; Thu, 09 Nov 2017 12:00:21 +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: Thu, 9 Nov 2017 12:00:15 +0300 Message-Id: <1510218017-21165-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> References: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 269 Subject: [lng-odp] [PATCH API-NEXT v2 2/4] linux-gen: packet: implement checksum validation status functions 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: Bogdan Pricope Checksum validation status functions return the status of the latest checksum check done for the packet based on packet input flags and packet error flags. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 269 (bogdanPricope:api_next_csum_status_pr) ** https://github.com/Linaro/odp/pull/269 ** Patch: https://github.com/Linaro/odp/pull/269.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 31b12178be4753494e806513020d7706600c8382 **/ platform/linux-generic/odp_packet.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 3b2fac212..59b943637 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -1284,6 +1284,32 @@ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset) return 0; } +odp_packet_chksum_status_t odp_packet_l3_chksum_status(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (!pkt_hdr->p.input_flags.l3_chksum_done) + return ODP_PACKET_CHKSUM_UNKNOWN; + + if (pkt_hdr->p.error_flags.l3_chksum) + return ODP_PACKET_CHKSUM_BAD; + + return ODP_PACKET_CHKSUM_OK; +} + +odp_packet_chksum_status_t odp_packet_l4_chksum_status(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (!pkt_hdr->p.input_flags.l4_chksum_done) + return ODP_PACKET_CHKSUM_UNKNOWN; + + if (pkt_hdr->p.error_flags.l4_chksum) + return ODP_PACKET_CHKSUM_BAD; + + return ODP_PACKET_CHKSUM_OK; +} + void odp_packet_flow_hash_set(odp_packet_t pkt, uint32_t flow_hash) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); From patchwork Thu Nov 9 09:00:16 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: 118402 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6334250qgn; Thu, 9 Nov 2017 01:04:11 -0800 (PST) X-Google-Smtp-Source: ABhQp+Q220J2gUr1SBA+FRFWLxJPLG/T/HmDZ3TetbHyjcr3J8ATrkaszQMa+PyBSb0Tt+ER7fJO X-Received: by 10.237.49.162 with SMTP id 31mr5036834qth.240.1510218251126; Thu, 09 Nov 2017 01:04:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510218251; cv=none; d=google.com; s=arc-20160816; b=ZscfEFQM3PDIoxVNC0WlQtII75Yvt+WocLpv8tHOx9mB3CGkwD3f1KlAMmklSRenap 58yYK1xqRLoU1Fg3SzTxxzmqhgoNJiVJy2E2Lu3MkJ1eAHPn0YWk4R3640rRykep7jKa 8iZIcEFvBvhAfWZxoxL7NMoFd/Mr3ajZyaqL+4eFfIYeF85TvAUoVfNqs60a8AEpgDOq ooHb/7sQPpOMgBsWiwlkkupuuYOaGXBxiQplOvjh74wgYD1Mfs7p0fyRMdEGBepflpZD 97TiOvQEWNxZBKkFg34/YvgUqRicc1XYjdH9fo+NC0y8tsfnVZAlgfofvfTYm7P1V7v8 R9BQ== 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=gzeR+yRYi9JWtZ/3paGkofeufx9Zs9tFV8kqcDneGMo=; b=LEDJsaLHQtoR/E9tSNtVN1Cp94pSZ5uGR7gkXmOolNZReFf86PCzFCfXmMzGh8sQfG MMJoUafNSeTXnZP3X9rSnWkRk31MqLHnBpzPI4oqpT6xCbaYdokHB46Vno7DsFHP3Aqu rLgT79Frv4ZXl6Y28DvxYLXedvwxowbYAKLn5pr95qI15W7eiPSsT/4Sp9jXqqgbZyYb pQypBLg3N03k9vunfcoLwRdYYWIcdHC+1v3J7vZyerx1+gfhXxVNJlUh1zmhu+LQWbPC E3Klu9KoeenXPQMN3RNQl6iS3rWmR2CVjCRM2EGFXFPyHAkJ+YxGIApL8P5zQDLr4lcU P5sg== 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 b37si5751925qtk.315.2017.11.09.01.04.10; Thu, 09 Nov 2017 01:04:11 -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 9C87E60C51; Thu, 9 Nov 2017 09:04:10 +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 D5AFA607BA; Thu, 9 Nov 2017 09:01:38 +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 E0C3D607B2; Thu, 9 Nov 2017 09:01:29 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 95FE360594 for ; Thu, 9 Nov 2017 09:00:38 +0000 (UTC) Received: from mxback2j.mail.yandex.net (mxback2j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10b]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 58C1B5D82A99 for ; Thu, 9 Nov 2017 12:00:24 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback2j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Xc5ijIpHfi-0OK0cXC9; Thu, 09 Nov 2017 12:00:24 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AXFYGb2yvs-0NtW2Ef3; Thu, 09 Nov 2017 12:00:23 +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: Thu, 9 Nov 2017 12:00:16 +0300 Message-Id: <1510218017-21165-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> References: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 269 Subject: [lng-odp] [PATCH API-NEXT v2 3/4] linux-gen: pktio: dpdk: set L3/L4 checksum validation 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: Bogdan Pricope L3/L4 checksum validation flags are used to report L3/L4 checksum check status for the incoming packets. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 269 (bogdanPricope:api_next_csum_status_pr) ** https://github.com/Linaro/odp/pull/269 ** Patch: https://github.com/Linaro/odp/pull/269.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 31b12178be4753494e806513020d7706600c8382 **/ platform/linux-generic/pktio/dpdk.c | 57 ++++++++++++++++++++++++++----------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 9782d60c4..764ed37d4 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -337,9 +337,9 @@ static struct rte_mempool_ops ops_stack = { MEMPOOL_REGISTER_OPS(ops_stack); -#define HAS_IP4_CSUM_FLAG(m, f) ((m->ol_flags & PKT_RX_IP_CKSUM_MASK) == f) +#define IP4_CSUM_RESULT(m) (m->ol_flags & PKT_RX_IP_CKSUM_MASK) +#define L4_CSUM_RESULT(m) (m->ol_flags & PKT_RX_L4_CKSUM_MASK) #define HAS_L4_PROTO(m, proto) ((m->packet_type & RTE_PTYPE_L4_MASK) == proto) -#define HAS_L4_CSUM_FLAG(m, f) ((m->ol_flags & PKT_RX_L4_CKSUM_MASK) == f) #define PKTIN_CSUM_BITS 0x1C @@ -347,29 +347,52 @@ static inline int pkt_set_ol_rx(odp_pktin_config_opt_t *pktin_cfg, odp_packet_hdr_t *pkt_hdr, struct rte_mbuf *mbuf) { + uint64_t packet_csum_result; + if (pktin_cfg->bit.ipv4_chksum && - RTE_ETH_IS_IPV4_HDR(mbuf->packet_type) && - HAS_IP4_CSUM_FLAG(mbuf, PKT_RX_IP_CKSUM_BAD)) { - if (pktin_cfg->bit.drop_ipv4_err) - return -1; + RTE_ETH_IS_IPV4_HDR(mbuf->packet_type)) { + packet_csum_result = IP4_CSUM_RESULT(mbuf); + + if (packet_csum_result == PKT_RX_IP_CKSUM_GOOD) { + pkt_hdr->p.input_flags.l3_chksum_done = 1; + } else if (packet_csum_result != PKT_RX_IP_CKSUM_UNKNOWN) { + if (pktin_cfg->bit.drop_ipv4_err) + return -1; - pkt_hdr->p.error_flags.ip_err = 1; + pkt_hdr->p.input_flags.l3_chksum_done = 1; + pkt_hdr->p.error_flags.ip_err = 1; + pkt_hdr->p.error_flags.l3_chksum = 1; + } } if (pktin_cfg->bit.udp_chksum && - HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_UDP) && - HAS_L4_CSUM_FLAG(mbuf, PKT_RX_L4_CKSUM_BAD)) { - if (pktin_cfg->bit.drop_udp_err) - return -1; + HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_UDP)) { + packet_csum_result = L4_CSUM_RESULT(mbuf); - pkt_hdr->p.error_flags.udp_err = 1; + if (packet_csum_result == PKT_RX_L4_CKSUM_GOOD) { + pkt_hdr->p.input_flags.l4_chksum_done = 1; + } else if (packet_csum_result != PKT_RX_L4_CKSUM_UNKNOWN) { + if (pktin_cfg->bit.drop_udp_err) + return -1; + + pkt_hdr->p.input_flags.l4_chksum_done = 1; + pkt_hdr->p.error_flags.udp_err = 1; + pkt_hdr->p.error_flags.l4_chksum = 1; + } } else if (pktin_cfg->bit.tcp_chksum && - HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_TCP) && - HAS_L4_CSUM_FLAG(mbuf, PKT_RX_L4_CKSUM_BAD)) { - if (pktin_cfg->bit.drop_tcp_err) - return -1; + HAS_L4_PROTO(mbuf, RTE_PTYPE_L4_TCP)) { + packet_csum_result = L4_CSUM_RESULT(mbuf); - pkt_hdr->p.error_flags.tcp_err = 1; + if (packet_csum_result == PKT_RX_L4_CKSUM_GOOD) { + pkt_hdr->p.input_flags.l4_chksum_done = 1; + } else if (packet_csum_result != PKT_RX_L4_CKSUM_UNKNOWN) { + if (pktin_cfg->bit.drop_tcp_err) + return -1; + + pkt_hdr->p.input_flags.l4_chksum_done = 1; + pkt_hdr->p.error_flags.tcp_err = 1; + pkt_hdr->p.error_flags.l4_chksum = 1; + } } return 0; From patchwork Thu Nov 9 09:00:17 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: 118399 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6331303qgn; Thu, 9 Nov 2017 01:01:32 -0800 (PST) X-Google-Smtp-Source: ABhQp+QMYYG/aDMGkhcKU1Zbt/mufGMPzgR/Ti/k/WZrkWF0pOgcau7DkBXoZJ7KSEgDYKwP8ZLn X-Received: by 10.107.160.148 with SMTP id j142mr4006113ioe.236.1510218092003; Thu, 09 Nov 2017 01:01:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510218091; cv=none; d=google.com; s=arc-20160816; b=EfiMteoD/34QvMW3IGm9V8abNTfdfsZg7CcJ6ugWBaLNBeDBYwyb6UKQH8ciF6vXla 8HE088hwofqrGAebAqviWveYDjsnmwxFzvw6EZVTAWCIihletmIuEu85eYf5w9I/oHXb HpgEz0gtNkHfjpW3Xj3HZTRscXYLcWCuHlfNfll0eH+uknIhcvYMBUoWEjmNqSyd1TKF rj5WiuKdcKvRsBG8cxzLmHl/QAOD8Ff1wLc2oOorDsSt6kkQKoIvWtvOMLYcbBIMDKlz 8ci9T8dCpkoMXd8jvckC6lB+mM+JOT8+Y9qTCB/7vFyCRSvb1k58hoIr3fLcI6KYH/co /raA== 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=iL20DVgFzb2YlayTqpuiTJTtZAG1rrQXW4s92YKKWug=; b=dsyXKmi45r0cl5LhIuvpwJC9VQNfGvU/S5IzMXzxS6qhtxcfhP/ZMAzFxfX6K2Rnqt fmMV7UcPp5VuTV6DTRJfz+SVEHbPKH24jWbvyV3Qcqsliy6MIVAJQlWpotI3+VP+I839 QlbDs5EisfjFD089u4+oKWSZS+Hd62u2ez+qS14pe1yHI/bc9vdyqG9khrfAR1DR7FQA MPvwpfNO5d+GWkrcHoXa4tI+qACJossCmGr2XybG7CvwMsGpjcVzsZKciimc3MfwtasV vKYurogSuX6DQg+jvcE23XDMETAADeWeTdaDkqGudVbVz24D//aw6cloD5xBuoW7JxNy aA/w== 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 x187si5875961itb.32.2017.11.09.01.01.31; Thu, 09 Nov 2017 01:01:31 -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 74376607BA; Thu, 9 Nov 2017 09:01:31 +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 594FC607F6; Thu, 9 Nov 2017 09:00:41 +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 21ABE60630; Thu, 9 Nov 2017 09:00:31 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id A38B360594 for ; Thu, 9 Nov 2017 09:00:26 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward101p.mail.yandex.net (Yandex) with ESMTP id 1F8166A8424E for ; Thu, 9 Nov 2017 12:00:25 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SjWKs6nQWt-0O54emcu; Thu, 09 Nov 2017 12:00:24 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id AXFYGb2yvs-0Ot4UPrY; Thu, 09 Nov 2017 12:00:24 +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: Thu, 9 Nov 2017 12:00:17 +0300 Message-Id: <1510218017-21165-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> References: <1510218017-21165-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 269 Subject: [lng-odp] [PATCH API-NEXT v2 4/4] example: generator: use L3/L4 checksum validation status functions 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: Bogdan Pricope Update odp_generator example application to use L3/L4 checksum validation status functions. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 269 (bogdanPricope:api_next_csum_status_pr) ** https://github.com/Linaro/odp/pull/269 ** Patch: https://github.com/Linaro/odp/pull/269.patch ** Base sha: d22c949cc466bf28de559855a1cb525740578137 ** Merge commit sha: 31b12178be4753494e806513020d7706600c8382 **/ example/generator/odp_generator.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 771bd1a2e..912fe7e9e 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -784,15 +784,13 @@ static void print_pkts(int thr, odp_packet_t pkt_tbl[], unsigned len) static int gen_recv_thread(void *arg) { int thr; - thread_args_t *thr_args; odp_packet_t pkts[MAX_RX_BURST], pkt; odp_event_t events[MAX_RX_BURST]; int pkt_cnt, ev_cnt, i; - interface_t *itfs, *itf; + odp_packet_chksum_status_t csum_status; + (void)arg; thr = odp_thread_id(); - thr_args = (thread_args_t *)arg; - itfs = thr_args->rx.ifs; printf(" [%02i] created mode: RECEIVE\n", thr); odp_barrier_wait(&barrier); @@ -811,21 +809,14 @@ static int gen_recv_thread(void *arg) continue; for (i = 0, pkt_cnt = 0; i < ev_cnt; i++) { pkt = odp_packet_from_event(events[i]); - itf = &itfs[odp_pktio_index(odp_packet_input(pkt))]; - if (odp_packet_has_ipv4(pkt)) { - if (itf->config.pktin.bit.ipv4_chksum) { - if (odp_packet_has_l3_error(pkt)) - printf("HW detected L3 error\n"); - } - } + csum_status = odp_packet_l3_chksum_status(pkt); + if (csum_status == ODP_PACKET_CHKSUM_BAD) + printf("L3 checksum error detected.\n"); - if (odp_packet_has_udp(pkt)) { - if (itf->config.pktin.bit.udp_chksum) { - if (odp_packet_has_l4_error(pkt)) - printf("HW detected L4 error\n"); - } - } + csum_status = odp_packet_l4_chksum_status(pkt); + if (csum_status == ODP_PACKET_CHKSUM_BAD) + printf("L4 checksum error detected.\n"); /* Drop packets with errors */ if (odp_unlikely(odp_packet_has_error(pkt))) {