From patchwork Mon Dec 11 11: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: 121366 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp2641372qgn; Mon, 11 Dec 2017 03:01:36 -0800 (PST) X-Google-Smtp-Source: AGs4zMb2FvacXR0Vlv1mDrg9w7AWAxJ2OpeYlFX9pMmlGxvOa4j2UXLWcw33xf0M8WrJGjqOKdkk X-Received: by 10.237.59.183 with SMTP id r52mr26614435qte.121.1512990096787; Mon, 11 Dec 2017 03:01:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512990096; cv=none; d=google.com; s=arc-20160816; b=sjPVcx9njM8j1WFVI6xobpznzJdiW1l8CsPJ8Exgq7pSu06cf/aQBWmeEUVRLyOqT2 JvsASLLs+K3bCUmr2ozKeVvCMpDMV8PAH/+ZKdBGocIWAHWL+Ly2O2j1/15DQEsgIR9R 3jMy9BsdJgZwfDoJ1iX2i4gDOQFfR7n27PgtIH0V07RtQS66gkpkS1TXfv80U2d0/2qY y4AwO6k3cxCiXOR98YrsAoBneQLNWcqdGlre0CwnqgqN9J53sasCwAnHV1KNIecYB9tX /A/c90ctusVCXGqZSD4/vm6/YDHZRYxvRd9RGcC36kT1YDjNpj4pfumKhVdUuOnU9ISm kToA== 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=Vz2/9N3czm1Qng3CpOhZc+KgYkgz+BPTeuQXFDP3qos=; b=ujRP15+FVOOdtoeCZmBsrjPvAaFEmC/HKECA/tG0HrG3ADj95AiLkC5ke9iIZs4Ovk CNaVCnGrC9MwBlkaX7MkJ/62Xx/Vg87RtVUqUYpvJxyYoY4Ej6uoShB4ztCRFl4pRC1q iP7WKg0yTbdMnuBVQQNFrGvMAYuysXTb4BYmXGONNK9fQ/e6nn/pc72dEUeZnk+VlWxJ EGXiW7Qq+E5GINaY5FteG6ZAIv9n2rYECpjyM8HQ0NECbJpvf9e4cC+jwQyiVphnEuiC VrOFX3JaFsey0YDXpbpFCfqNUIY67wXbxIRLN2HFFHvOhKx5WxANtru7yvHwO2D3mvKB YQYA== 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 b6si3723040qkd.105.2017.12.11.03.01.36; Mon, 11 Dec 2017 03:01: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 7FE2E60646; Mon, 11 Dec 2017 11:01: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=-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 B7B92608CC; Mon, 11 Dec 2017 11:00:48 +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 088D26038C; Mon, 11 Dec 2017 11:00:41 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 4080B60609 for ; Mon, 11 Dec 2017 11:00:34 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward101p.mail.yandex.net (Yandex) with ESMTP id C6A266A823D5 for ; Mon, 11 Dec 2017 14:00:32 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id mgKRhoXWvW-0W6mu2cA; Mon, 11 Dec 2017 14:00:32 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id CDuRN6UJGT-0P1SQeBN; Mon, 11 Dec 2017 14:00:25 +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 14:00:17 +0300 Message-Id: <1512990018-18045-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512990018-18045-1-git-send-email-odpbot@yandex.ru> References: <1512990018-18045-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 314 Subject: [lng-odp] [PATCH API-NEXT v7 1/2] api: packet: separate checksum check 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: Dmitry Eremin-Solenikov Separate union controlling different checksum checks. It will be used by IPsec API. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 314 (lumag:ipsec-chksum) ** https://github.com/Linaro/odp/pull/314 ** Patch: https://github.com/Linaro/odp/pull/314.patch ** Base sha: 0980001e33b4190133d478a0aa2e718fd1e3c164 ** Merge commit sha: c57270d671524b7c4bcf5999fcd48eb7cf104551 **/ include/odp/api/spec/packet.h | 46 +++++++++++++++++++++---------------- test/validation/api/packet/packet.c | 10 ++++---- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index b897c9d3c..02c770f21 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -1178,6 +1178,31 @@ int odp_packet_move_data(odp_packet_t pkt, uint32_t dst_offset, * */ +/** + * Flags to control packet data checksum checking + */ +typedef union odp_proto_chksums_t { + /** Individual checksum bits. */ + struct { + /** IPv4 header checksum */ + uint32_t ipv4 : 1; + + /** UDP checksum */ + uint32_t udp : 1; + + /** TCP checksum */ + uint32_t tcp : 1; + + /** SCTP checksum */ + uint32_t sctp : 1; + + } chksum; + + /** All checksum bits. This can be used to set/clear all flags. */ + uint32_t all_chksum; + +} odp_proto_chksums_t; + /** * Packet parse parameters */ @@ -1194,26 +1219,7 @@ typedef struct odp_packet_parse_param_t { * layer. Checksum checking status can be queried for each packet with * odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status(). */ - union { - /** Individual check bits. */ - struct { - /** Check IPv4 header checksum */ - uint32_t ipv4_chksum : 1; - - /** Check UDP checksum */ - uint32_t udp_chksum : 1; - - /** Check TCP checksum */ - uint32_t tcp_chksum : 1; - - /** Check SCTP checksum */ - uint32_t sctp_chksum : 1; - - } check; - - /** All check bits. This can be used to set/clear all flags. */ - uint32_t all_check; - }; + odp_proto_chksums_t check; } odp_packet_parse_param_t; diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ce4d66c0b..bc0cf54c9 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2451,7 +2451,7 @@ void packet_test_parse(void) parse.proto = ODP_PROTO_ETH; parse.layer = ODP_PROTO_LAYER_ALL; - parse.all_check = 0; + parse.check.all_chksum = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], @@ -2482,7 +2482,7 @@ void packet_test_parse(void) parse.proto = ODP_PROTO_IPV4; parse.layer = ODP_PROTO_LAYER_L4; - parse.all_check = 0; + parse.check.all_chksum = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], @@ -2512,7 +2512,7 @@ void packet_test_parse(void) parse.proto = ODP_PROTO_ETH; parse.layer = ODP_PROTO_LAYER_L4; - parse.all_check = 0; + parse.check.all_chksum = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], @@ -2542,7 +2542,7 @@ void packet_test_parse(void) parse.proto = ODP_PROTO_ETH; parse.layer = ODP_PROTO_LAYER_L4; - parse.all_check = 0; + parse.check.all_chksum = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1], @@ -2573,7 +2573,7 @@ void packet_test_parse(void) parse.proto = ODP_PROTO_ETH; parse.layer = ODP_PROTO_LAYER_ALL; - parse.all_check = 0; + parse.check.all_chksum = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],