From patchwork Thu Nov 30 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: 120151 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp576308qgn; Thu, 30 Nov 2017 04:04:52 -0800 (PST) X-Google-Smtp-Source: AGs4zMZNOnd/+IFDeP78/IZbVXwn5JGDzIvzExoq00s0lJMO1KV/dVMRltR8wJKh4TpzDdtsItpK X-Received: by 10.55.166.82 with SMTP id p79mr2308959qke.302.1512043492175; Thu, 30 Nov 2017 04:04:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512043492; cv=none; d=google.com; s=arc-20160816; b=SLty/f1ccz4rOCi8T76cKwlK0FvL/UUM/yTs9D19qpIKSye5trZcuujkFgLmTsWIMH 1abmzEj5wjmEmvzgoq5TEU/+TxUEf6XvW2gvQelogI4tiTOf2G5TRRci8GGXEt/71Jbm /eux6lo18urTwYXK+p1XWKxy7G7de4+Upx0qvSznfe6a0b34TUXH/5JEPXoBjvh3bVEb 8qSBwJwM/t5b7eogk1b3dAMJkPkQrcGCVvvcE3iFHstyI52du5ibmafLYYVVvWdiYPvQ 0/qEI2YmF/xNIA75wmcrSX6zXxNYncywHo9uCtlmJhvZ8nbVA2216zJRaenkG7v4/5eb 7vxA== 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=bVhEfp3GhJOCKC6NZ7mJQEGBqHK3bqPEW8ez7Qhv5no=; b=TeoZRfsB1+7eaPsdninJAiEVdHf7j95wjUbrj7QcAVtln2Apq4XH1+BbjOJzUjSLdx qBPwxZ2h+No2ocS+lVdxyJQb/APWqBoMyek+xztooMOIzBJzMnzx+CIRFCGig3StArGK Zi6NUas/Ff1QKWAX/A0VyT5maR6ZKIyIA8Rc9Tr1rWHAccWTTWA7iuqcCrPIq/pjAPje 9GEOAzrj4NpuuuQtKY1jUknsrsqrld8NAU5Pg34xT7iiE+26O9FejMtWw7U2VkS7aJ+3 Ray0SJKaearlOGhbA7n/T9LyjgDWfCvj1WRQyEbA6C+jtEapZKTlcyl+Qtvf2kIuqGrR 7sQQ== 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 31si4120637qtv.152.2017.11.30.04.04.51; Thu, 30 Nov 2017 04:04:52 -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 D467360956; Thu, 30 Nov 2017 12:04:51 +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 A6F2260905; Thu, 30 Nov 2017 12:02: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 9D41F60948; Thu, 30 Nov 2017 12:02:03 +0000 (UTC) Received: from forward101p.mail.yandex.net (forward101p.mail.yandex.net [77.88.28.101]) by lists.linaro.org (Postfix) with ESMTPS id 562CA607EC for ; Thu, 30 Nov 2017 12:00:12 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward101p.mail.yandex.net (Yandex) with ESMTP id CA19E6A82320 for ; Thu, 30 Nov 2017 15:00:09 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id NmXLKGQUGV-091q401j; Thu, 30 Nov 2017 15:00:09 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id TZRVxJjGds-082GKbpY; Thu, 30 Nov 2017 15:00:08 +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, 30 Nov 2017 15:00:06 +0300 Message-Id: <1512043207-8703-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512043207-8703-1-git-send-email-odpbot@yandex.ru> References: <1512043207-8703-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 314 Subject: [lng-odp] [PATCH API-NEXT v4 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: 4cb02e1caccb9179575e95448fd46979e17d0905 ** Merge commit sha: 6673dcd62b3b19902e452decdd5206958db67c58 **/ 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..2917ebde0 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_packet_parse_chksum_t { + /** 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_packet_parse_chksum_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_packet_parse_chksum_t chksum; } odp_packet_parse_param_t; diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index ce4d66c0b..3f0f957f2 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.chksum.all_check = 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.chksum.all_check = 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.chksum.all_check = 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.chksum.all_check = 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.chksum.all_check = 0; CU_ASSERT(odp_packet_parse(pkt[0], offset[0], &parse) == 0); CU_ASSERT(odp_packet_parse_multi(&pkt[1], &offset[1],