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);