From patchwork Sat Jan 13 23:00:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124428 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp230242lje; Sat, 13 Jan 2018 15:01:07 -0800 (PST) X-Google-Smtp-Source: ACJfBotf/fhcCc+IG8rYVcntMZkmlta+hK6CLuPkVJp5wqHgKGzyzqm7stoLhgnfcef/5o8ydiWP X-Received: by 10.200.53.209 with SMTP id l17mr671642qtb.273.1515884467728; Sat, 13 Jan 2018 15:01:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515884467; cv=none; d=google.com; s=arc-20160816; b=cHIi+4OJ99477TIcl6Z1hXNVZGHh5D4iv6kXP+jEMdZd+wYTrPxKWeC5RHt9yT4qpa q+kODtACDRTfVpa38rFGAZ9Z2Y526enuWdFgWuT8iYZnTxJgm5mrLzkq0cLtReH/fvNP 6scQMOQomvLoaWJRre5jv0fDbll7FbeHYti6vM6wTrnvS1Ewn8HvhFvHZUVcIPs4KwRG OrMtwSpYfT5qjr1g4gLbhBdeIyO/bCrX6JVNYH3Z+XT1B4OlytUu5IPILvo+qKPyvTu2 CbOhTV3L2f4rOap9/zvPerr3kLlfpJYSk8u57E3EUqdvRskz8z+JG8QB1jcBi3dqQF0k HBwQ== 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=hx54WPEhgYBiEQFrMWJTxWskEOllmMC6sXSp8iSopTs=; b=VUb6eqMYdUJRhFGe2mTEowtZgZXwoTxDy9XXKPWLjZR5cbWfeTOCBDmiUA4SaRgxXG SqDd6PMRZc9OBLtF5yiPHUb8JuNIB9tIVvBGjTlJ5lUL4HBqayShqvQ7dwlbjNXeUntv DqXSIKaGeeejzOzfffyxbP1eYcY6059m3uM5K6R2WazCbBUlpO2AuL4LRv5Qz/js51Eq VAjvHDjvnQWImWCmjm6ej+7C+fh6Zzld1p+BxvjYu5n7G8D+cEEnbKwVtbja9kLjwfWq apkAlJcs8uIhi57rqPepz2aNadKrq8jmjUNud60ExmKtBWCntQH5sFkxPBuB4LBS+BDd JsfA== 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 c27si1123494qte.160.2018.01.13.15.01.07; Sat, 13 Jan 2018 15:01:07 -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 67A4561758; Sat, 13 Jan 2018 23:01:07 +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, RCVD_IN_MSPIKE_H2 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 DA3526151F; Sat, 13 Jan 2018 23:00:27 +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 5FE8F61736; Sat, 13 Jan 2018 23:00:21 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id B4F30608E8 for ; Sat, 13 Jan 2018 23:00:17 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward105p.mail.yandex.net (Yandex) with ESMTP id DFED74081F43 for ; Sun, 14 Jan 2018 02:00:15 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DfZZnUXce7-0FtuSxIq; Sun, 14 Jan 2018 02:00:15 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OeJ5YhkKll-0Fxuo5bA; Sun, 14 Jan 2018 02:00:15 +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: Sun, 14 Jan 2018 02:00:07 +0300 Message-Id: <1515884413-15125-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> References: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 389 Subject: [lng-odp] [PATCH v3][WIP 1/7] validation: ipsec: fix packet checksums 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 Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 389 (lumag:parse-checksums) ** https://github.com/Linaro/odp/pull/389 ** Patch: https://github.com/Linaro/odp/pull/389.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: e6a448356c90f142122e5b5d4796bdf19e04e8c6 **/ test/validation/api/ipsec/ipsec.c | 1 + test/validation/api/ipsec/test_vectors.h | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index ea3cff052..322b03ad2 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -905,6 +905,7 @@ int ipsec_config(odp_instance_t ODP_UNUSED inst) ipsec_config.outbound_mode = suite_context.outbound_op_mode; ipsec_config.inbound.default_queue = suite_context.queue; ipsec_config.inbound.parse_level = ODP_PROTO_LAYER_ALL; + ipsec_config.inbound.chksums.all_chksum = ~0; if (ODP_IPSEC_OK != odp_ipsec_config(&ipsec_config)) return -1; diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec/test_vectors.h index a6b8616b6..0a46ec758 100644 --- a/test/validation/api/ipsec/test_vectors.h +++ b/test/validation/api/ipsec/test_vectors.h @@ -264,7 +264,7 @@ static const ODP_UNUSED ipsec_test_packet pkt_ipv4_icmp_0_ah_sha256_1_bad1 = { /* IP */ 0x45, 0x00, 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x33, 0xab, 0xd9, 0xc0, 0xa8, 0x6f, 0x02, + 0x40, 0x33, 0xab, 0xdb, 0xc0, 0xa8, 0x6f, 0x02, 0xc0, 0xa8, 0xde, 0x02, /* AH */ @@ -664,7 +664,7 @@ static const ODP_UNUSED ipsec_test_packet pkt_ipv4_icmp_0_esp_aes_cbc_null_1 = { /* IP */ 0x45, 0x00, 0x00, 0x9c, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x32, 0xab, 0xca, 0xc0, 0xa8, 0x6f, 0x02, + 0x40, 0x32, 0xab, 0xda, 0xc0, 0xa8, 0x6f, 0x02, 0xc0, 0xa8, 0xde, 0x02, /* ESP */ @@ -1494,7 +1494,7 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_2_esp = { /* IP - not a part of RFC, added for simplicity */ 0x45, 0x00, 0x00, 0x74, 0x69, 0x8f, 0x00, 0x00, - 0x80, 0x32, 0x4d, 0x76, 0xc0, 0xa8, 0x01, 0x02, + 0x80, 0x32, 0x4d, 0x75, 0xc0, 0xa8, 0x01, 0x02, 0xc0, 0xa8, 0x01, 0x01, /* ESP */ @@ -1552,7 +1552,7 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_3_esp = { /* IP - not a part of RFC, added for simplicity */ 0x45, 0x00, 0x00, 0x68, 0x69, 0x8f, 0x00, 0x00, - 0x80, 0x32, 0x4d, 0x82, 0xc0, 0xa8, 0x01, 0x02, + 0x80, 0x32, 0x4d, 0x81, 0xc0, 0xa8, 0x01, 0x02, 0xc0, 0xa8, 0x01, 0x01, /* ESP */ @@ -1610,7 +1610,7 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_4_esp = { /* IP - not a part of RFC, added for simplicity */ 0x45, 0x00, 0x00, 0x74, 0x69, 0x8f, 0x00, 0x00, - 0x80, 0x32, 0x4d, 0x76, 0xc0, 0xa8, 0x01, 0x02, + 0x80, 0x32, 0x4d, 0x75, 0xc0, 0xa8, 0x01, 0x02, 0xc0, 0xa8, 0x01, 0x01, /* ESP */ @@ -1708,7 +1708,7 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_15_esp = { /* IP - not a part of RFC, added for simplicity */ 0x45, 0x00, 0x00, 0x68, 0x69, 0x8f, 0x00, 0x00, - 0x80, 0x32, 0x4d, 0xb2, 0xc0, 0xa8, 0x01, 0x02, + 0x80, 0x32, 0x4d, 0x81, 0xc0, 0xa8, 0x01, 0x02, 0xc0, 0xa8, 0x01, 0x01, /* ESP */ @@ -1752,7 +1752,7 @@ static const ODP_UNUSED ipsec_test_packet 0x11, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, /* UDP encap */ - 0x11, 0x94, 0x11, 0x94, 0x00, 0x90, 0x00, 0x00, + 0x11, 0x94, 0x11, 0x94, 0x00, 0x90, 0x51, 0x33, /* ESP */ 0x00, 0x00, 0x00, 0x7b, 0x00, 0x00, 0x00, 0x01, From patchwork Sat Jan 13 23:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124430 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp230502lje; Sat, 13 Jan 2018 15:02:20 -0800 (PST) X-Google-Smtp-Source: ACJfBosSTgI4X0P+E382Tx+/bPS3vZozFqaOFHd3E2qXK9ovgDsMrVt4vtKkZikT9GXIcfwwbq6S X-Received: by 10.237.55.71 with SMTP id i65mr17077005qtb.224.1515884540781; Sat, 13 Jan 2018 15:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515884540; cv=none; d=google.com; s=arc-20160816; b=LpE7A7TXTLgAvIY2QlVG3YfnqRC4Ws3Jw6qS9Cp8vQvRBEOVgWPztrtquZgLXDZD15 GF34zbmKS0io0u5xCKnXHtpuiU61jyCy3KOgFL2YtyPz0y93GYaxHF2Y3jNliWQ7kh59 l80AKyFFqxTaDLDHX+DYacyeNAxkgt2BgvLbJ5x8vK/OsfPxuC+69hE6sCq0TtzfSTue jK5xwXeAvBX9iuStx59wa4P9mg+/EQhatlnOjkYNF6VLEj0GdM2cL8oCgCGcGPulvrEq KdUa/KoLC1vu4+WdL1b5NXHo+m+f98LMMmoiR3phOwmPe2/ikkxKspFhDG1NpB8/7w2H 2UcQ== 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=PRWp+MVMvnS4Rr5PCOVhrik//bNo1Kmp00Wj82SJgmo=; b=oHFxbxaZYo6YxnfRgzLoyhoh+OtmaeN88fK38800zwe1kyflvVRVmzFbN4/g0jfYVc QaPK+KqPqNuBTh9+aNp+uvDV/ADD6tXGb2F/TdeKm+jVGV/hsh4/mN3WoQrdlSrrcwsz uUNW0PIaBMtzhrZ7/NOfJMOz0npWnYUsHBdrINkHsDJVhfYF+3XCiUqcFsdzlwJlVrMn 9EfdvMBpEuVSKdQBJyslzPVkfnPmiKNpo5nzaVCKU0t/1fnWfRc9I6ULHmNtYK5+ICjB Gi4H/TP3q5NzhiNN1DaswiFowpUOIHvHsJ1V/gsSa2QQj7UqaydTvVyCPffU3Byijci/ RqEw== 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 m2si3437662qkf.457.2018.01.13.15.02.20; Sat, 13 Jan 2018 15:02:20 -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 6F0046173A; Sat, 13 Jan 2018 23:02:20 +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, RCVD_IN_MSPIKE_H2 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 7653061744; Sat, 13 Jan 2018 23:00:34 +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 2F72760997; Sat, 13 Jan 2018 23:00:23 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 17B6760975 for ; Sat, 13 Jan 2018 23:00:18 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 9D8B651039E2 for ; Sun, 14 Jan 2018 02:00:16 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id HE8HvSKPuq-0GTqFDZi; Sun, 14 Jan 2018 02:00:16 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OeJ5YhkKll-0FxOsMPp; Sun, 14 Jan 2018 02:00:15 +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: Sun, 14 Jan 2018 02:00:08 +0300 Message-Id: <1515884413-15125-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> References: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 389 Subject: [lng-odp] [PATCH v3][WIP 2/7] linux-gen: packet: drop unused function 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 Drop unused packet_parse_l3_l4() function Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 389 (lumag:parse-checksums) ** https://github.com/Linaro/odp/pull/389 ** Patch: https://github.com/Linaro/odp/pull/389.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: e6a448356c90f142122e5b5d4796bdf19e04e8c6 **/ platform/linux-generic/include/odp_packet_internal.h | 6 ------ platform/linux-generic/odp_packet.c | 16 ---------------- 2 files changed, 22 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 62888f8a5..43c8da5cb 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -298,12 +298,6 @@ int packet_alloc_multi(odp_pool_t pool_hdl, uint32_t len, int packet_parse_layer(odp_packet_hdr_t *pkt_hdr, odp_proto_layer_t layer); -/* Perform L3 and L4 parsing up to a given protocol layer */ -int packet_parse_l3_l4(odp_packet_hdr_t *pkt_hdr, - odp_proto_layer_t layer, - uint32_t l3_offset, - uint16_t ethtype); - /* Reset parser metadata for a new parse */ void packet_parse_reset(odp_packet_hdr_t *pkt_hdr); diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 83a880947..a0bc8911a 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2312,22 +2312,6 @@ int packet_parse_layer(odp_packet_hdr_t *pkt_hdr, seg_len, layer); } -int packet_parse_l3_l4(odp_packet_hdr_t *pkt_hdr, - odp_proto_layer_t layer, - uint32_t l3_offset, - uint16_t ethtype) -{ - uint32_t seg_len = 0; - void *base = packet_map(pkt_hdr, l3_offset, &seg_len, NULL); - - if (seg_len == 0) - return -1; - - return packet_parse_common_l3_l4(&pkt_hdr->p, base, l3_offset, - pkt_hdr->frame_len, seg_len, - layer, ethtype); -} - int odp_packet_parse(odp_packet_t pkt, uint32_t offset, const odp_packet_parse_param_t *param) { From patchwork Sat Jan 13 23:00:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124429 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp230383lje; Sat, 13 Jan 2018 15:01:43 -0800 (PST) X-Google-Smtp-Source: ACJfBoue4vZ5YcymTxj1vLRJg+0c61QKYabAnN0dTthe/lh0/BR3JkLxC9XAKgNf6+O9s2oKcUe+ X-Received: by 10.55.79.83 with SMTP id d80mr1922343qkb.328.1515884503064; Sat, 13 Jan 2018 15:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515884503; cv=none; d=google.com; s=arc-20160816; b=Tl/Yy8uxosGzjKRQcOwIuW1pRKVC2+kelBev2GHueMuWaBedbfxvk7IyPJ4ETFzpi5 OlqytHbpsTFRfW6X3r7b7F2VuOkEhar0Zwiabuj5olG86ic1DPq3h3ohKDN5tmNxjkTd a1KNYA5kWhp0to0SxxJOz6qxr/s4u4pOa9xj+I+dwjrhNgpEbMLlEG3cU5PkDbX10wni QWT5dplE6EbNRlIdLy5b1QAI1hYgaeF4S2CQzU3kIT1vMR9vse6TOvUjaOrSnTs+g+OP 7mdjo8ALMTlpkm4VAHc7Ta6VVa5smgfMtLZjeMwsgPb4QzovhagsiV2vJhaExBd1x/MP eEBw== 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=+zTAn7UXRfjvDg90fy8qELexTs0lQCImaKt7/JXkhVo=; b=razWV9jrDhZWLNKaAbrJTdYYgjUpVY0K+9E7LSkjU1sq0j0ZQvQ4IijJ0PUn9OSyhw QFruNVN6HaoudVBKGhVZvd9KSBXsEGzOgaIaBCnoQmbCP1l7GdVqyi1ZxYnZwHqXnDlX vofseK1jJe+RQqB88DppS0SH+zbfwcr/Fk1YEln5JBYa38DtABL7sscHIzTYRdtt+O/Q BwxfwBBe6z2VpyCYTzkRCLNuRgxtMqgDbGPjXW4JgRRaxtc0KqLDc9uq568hqXGalCBQ Dydsms4zLHrtxyxXvoGmMX/2vrmx+DGchmSVfW8aXMhL1bMqkZOKm1Nn7kbEzEc+/w/N /RXw== 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 w1si448732qte.433.2018.01.13.15.01.42; Sat, 13 Jan 2018 15:01: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 B4004609BB; Sat, 13 Jan 2018 23:01:42 +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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 3424C6173A; Sat, 13 Jan 2018 23:00:31 +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 A5A4160997; Sat, 13 Jan 2018 23:00:22 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 097BD60997 for ; Sat, 13 Jan 2018 23:00:19 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 5F3571242E25 for ; Sun, 14 Jan 2018 02:00:17 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id J7AzMmybxB-0HPqd1gc; Sun, 14 Jan 2018 02:00:17 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OeJ5YhkKll-0GxWjk9p; Sun, 14 Jan 2018 02:00:16 +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: Sun, 14 Jan 2018 02:00:09 +0300 Message-Id: <1515884413-15125-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> References: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 389 Subject: [lng-odp] [PATCH v3][WIP 3/7] linux-gen: pktio: introduce checksum settings 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 Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 389 (lumag:parse-checksums) ** https://github.com/Linaro/odp/pull/389 ** Patch: https://github.com/Linaro/odp/pull/389.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: e6a448356c90f142122e5b5d4796bdf19e04e8c6 **/ platform/linux-generic/include/odp_packet_io_internal.h | 1 + platform/linux-generic/odp_packet_io.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 25e037182..851515810 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -151,6 +151,7 @@ struct pktio_entry { odp_pktio_config_t config; /**< Device configuration */ classifier_t cls; /**< classifier linked with this pktio*/ odp_pktio_stats_t stats; /**< statistic counters for pktio */ + odp_proto_chksums_t in_chksums; /**< Checksums validation settings */ enum { STATS_SYSFS = 0, STATS_ETHTOOL, diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index ffbc73b26..1f1d46423 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -432,6 +432,12 @@ int odp_pktio_config(odp_pktio_t hdl, const odp_pktio_config_t *config) entry->s.config = *config; + entry->s.in_chksums.all_chksum = 0; + entry->s.in_chksums.chksum.ipv4 = config->pktin.bit.ipv4_chksum; + entry->s.in_chksums.chksum.tcp = config->pktin.bit.tcp_chksum; + entry->s.in_chksums.chksum.udp = config->pktin.bit.udp_chksum; + entry->s.in_chksums.chksum.sctp = config->pktin.bit.sctp_chksum; + if (entry->s.ops->config) res = entry->s.ops->config(entry, config); From patchwork Sat Jan 13 23:00:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124432 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp230700lje; Sat, 13 Jan 2018 15:03:19 -0800 (PST) X-Google-Smtp-Source: ACJfBovvF9uxRawaQfEWtWFMvarSum7SZSbBaazp53uonT4tknXHLcz4dx2tkc2L4zYpawufa50J X-Received: by 10.237.53.201 with SMTP id d9mr40887300qte.138.1515884599136; Sat, 13 Jan 2018 15:03:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515884599; cv=none; d=google.com; s=arc-20160816; b=GomE3eO5X09gisoq1LKVx7kQIIMxhDkzDpKvnmoszP4aXFgJtEiCbv7aWzXhXE1b49 Cfi31LcMyVDo8uQkVtf5PMUdjM2za6TLmyCv+0Vpgcl0Jd61/zYWNxPfD9O3aPtEPk7w xjg5MnyffRf2N8C1nIRBF8kkpMMmUal6SQuJNfnYUqQGKUbWZFbQ17MNaCmDkHfSjtCx mkyo02jI2unnzQVr+Dxp9Pz9EPLGNlBfXAaNjVAklMRMLsQZu3wQmdQmmnlSY2lE77ZV ZKsHsaaa3JLDmkFinTYU2WpQ7KDY2xOJMX3PrkHxJvzcz3l29cOSFj26VrbwdJS0vYtK 5lyA== 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=CBNIsWxSmw1dD/OQ5fARUQ5ReHX1jvatg2cEEjvNHv8=; b=Cf0Hlj+Yos7tswTlCfdZB/gTtE3VCGtrn96Xt8KX80fEsa32mlvsLnxy5nCB4Nb/vI ikgVHL/tjId5BL3Hige1ovvItHWKyV5dhq7vpb8/tNTg4I2SK2TzXQ0FUIvE5NlLSp0D rbsmc2sloZED2mt9MGOcRFyTenTrkV29ikbzRw53NUNgOuUJiqqtyE3rQrfbqC5pNW7N 6t1lkkVmmRfu8FqhRQqkCLfL9sZRqPamsfuejtuUfa0zoG2c5yxuMmoX7BGTcbWYXd6t bDbCgUmEs6yETUoLHTBMnjOlC3N1JRUL9SYlfg/2Qq6R9BVvl8mGG+oG0snhQd4yq/aY FO0A== 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 b42si10255840qta.393.2018.01.13.15.03.18; Sat, 13 Jan 2018 15:03:19 -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 CB64B61745; Sat, 13 Jan 2018 23:03:18 +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, RCVD_IN_MSPIKE_H2 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 2E65261757; Sat, 13 Jan 2018 23:00:43 +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 E416860975; Sat, 13 Jan 2018 23:00:24 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id 743EB609BB for ; Sat, 13 Jan 2018 23:00:19 +0000 (UTC) Received: from mxback5j.mail.yandex.net (mxback5j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10e]) by forward102o.mail.yandex.net (Yandex) with ESMTP id 15EAB5A03709 for ; Sun, 14 Jan 2018 02:00:18 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback5j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dET97X5GVm-0IRqE1IJ; Sun, 14 Jan 2018 02:00:18 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OeJ5YhkKll-0HxKdHGt; Sun, 14 Jan 2018 02:00:17 +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: Sun, 14 Jan 2018 02:00:10 +0300 Message-Id: <1515884413-15125-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> References: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 389 Subject: [lng-odp] [PATCH v3][WIP 4/7] linux-gen: packet: add IPv4 checksum validation 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 If configured, check IPv4 header checksum. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 389 (lumag:parse-checksums) ** https://github.com/Linaro/odp/pull/389 ** Patch: https://github.com/Linaro/odp/pull/389.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: e6a448356c90f142122e5b5d4796bdf19e04e8c6 **/ .../linux-generic/include/odp_packet_internal.h | 6 ++-- platform/linux-generic/odp_classification.c | 3 +- platform/linux-generic/odp_packet.c | 32 ++++++++++++++++------ platform/linux-generic/pktio/loop.c | 3 +- platform/linux-generic/pktio/pcap.c | 3 +- platform/linux-generic/pktio/socket.c | 3 +- platform/linux-generic/pktio/socket_mmap.c | 3 +- platform/linux-generic/pktio/tap.c | 3 +- 8 files changed, 39 insertions(+), 17 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 43c8da5cb..86f0d80a5 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -296,7 +296,8 @@ int packet_alloc_multi(odp_pool_t pool_hdl, uint32_t len, /* Perform packet parse up to a given protocol layer */ int packet_parse_layer(odp_packet_hdr_t *pkt_hdr, - odp_proto_layer_t layer); + odp_proto_layer_t layer, + odp_proto_chksums_t chksums); /* Reset parser metadata for a new parse */ void packet_parse_reset(odp_packet_hdr_t *pkt_hdr); @@ -333,7 +334,8 @@ static inline void packet_set_ts(odp_packet_hdr_t *pkt_hdr, odp_time_t *ts) } int packet_parse_common(packet_parser_t *pkt_hdr, const uint8_t *ptr, - uint32_t pkt_len, uint32_t seg_len, int layer); + uint32_t pkt_len, uint32_t seg_len, int layer, + odp_proto_chksums_t chksums); int _odp_cls_parse(odp_packet_hdr_t *pkt_hdr, const uint8_t *parseptr); diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 276430923..4d3df49e2 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -973,7 +973,8 @@ int cls_classify_packet(pktio_entry_t *entry, const uint8_t *base, packet_set_len(pkt_hdr, pkt_len); packet_parse_common(&pkt_hdr->p, base, pkt_len, seg_len, - ODP_PROTO_LAYER_ALL); + ODP_PROTO_LAYER_ALL, + entry->s.in_chksums); cos = cls_select_cos(entry, base, pkt_hdr); if (cos == NULL) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index a0bc8911a..d3c608ab0 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2024,7 +2024,8 @@ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, * Parser helper function for IPv4 */ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, - uint32_t *offset, uint32_t frame_len) + uint32_t *offset, uint32_t frame_len, + odp_proto_chksums_t chksums) { const _odp_ipv4hdr_t *ipv4 = (const _odp_ipv4hdr_t *)*parseptr; uint8_t ver = _ODP_IPV4HDR_VER(ipv4->ver_ihl); @@ -2040,6 +2041,14 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, return 0; } + if (chksums.chksum.ipv4) { + prs->input_flags.l3_chksum_done = 1; + if (odp_chksum_ones_comp16(ipv4, ihl * 4) != 0xffff) { + prs->error_flags.l3_chksum = 1; + return 0; + } + } + *offset += ihl * 4; *parseptr += ihl * 4; @@ -2175,7 +2184,8 @@ static inline int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, uint32_t offset, uint32_t frame_len, uint32_t seg_len, - int layer, uint16_t ethtype) + int layer, uint16_t ethtype, + odp_proto_chksums_t chksums) { uint8_t ip_proto; @@ -2191,7 +2201,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, switch (ethtype) { case _ODP_ETHTYPE_IPV4: prs->input_flags.ipv4 = 1; - ip_proto = parse_ipv4(prs, &parseptr, &offset, frame_len); + ip_proto = parse_ipv4(prs, &parseptr, &offset, frame_len, chksums); prs->l4_offset = offset; break; @@ -2275,7 +2285,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, */ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, uint32_t frame_len, uint32_t seg_len, - int layer) + int layer, odp_proto_chksums_t chksums) { uint32_t offset; uint16_t ethtype; @@ -2296,20 +2306,21 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, ethtype = parse_eth(prs, &parseptr, &offset, frame_len); return packet_parse_common_l3_l4(prs, parseptr, offset, frame_len, - seg_len, layer, ethtype); + seg_len, layer, ethtype, chksums); } /** * Simple packet parser */ int packet_parse_layer(odp_packet_hdr_t *pkt_hdr, - odp_proto_layer_t layer) + odp_proto_layer_t layer, + odp_proto_chksums_t chksums) { uint32_t seg_len = packet_first_seg_len(pkt_hdr); void *base = packet_data(pkt_hdr); return packet_parse_common(&pkt_hdr->p, base, pkt_hdr->frame_len, - seg_len, layer); + seg_len, layer, chksums); } int odp_packet_parse(odp_packet_t pkt, uint32_t offset, @@ -2336,7 +2347,8 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, if (proto == ODP_PROTO_ETH) { ret = packet_parse_common(&pkt_hdr->p, data, packet_len, - seg_len, layer); + seg_len, layer, + param->chksums); if (ret) return -1; @@ -2348,7 +2360,9 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, ret = packet_parse_common_l3_l4(&pkt_hdr->p, data, offset, packet_len, seg_len, - layer, ethtype); + layer, ethtype, + param->chksums); + if (ret) return -1; diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index ad2cb39f8..bf6365e94 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -146,7 +146,8 @@ static int loopback_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, } } else { packet_parse_layer(pkt_hdr, - pktio_entry->s.config.parser.layer); + pktio_entry->s.config.parser.layer, + pktio_entry->s.in_chksums); } packet_set_ts(pkt_hdr, ts); diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 596bf6f28..573c31744 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -255,7 +255,8 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED, } packet_parse_layer(pkt_hdr, - pktio_entry->s.config.parser.layer); + pktio_entry->s.config.parser.layer, + pktio_entry->s.in_chksums); pktio_entry->s.stats.in_octets += pkt_hdr->frame_len; packet_set_ts(pkt_hdr, ts); diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 0a80035f5..d0a55effe 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -676,7 +676,8 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, if (!pktio_cls_enabled(pktio_entry)) packet_parse_layer(pkt_hdr, - pktio_entry->s.config.parser.layer); + pktio_entry->s.config.parser.layer, + pktio_entry->s.in_chksums); pkt_hdr->input = pktio_entry->s.handle; packet_set_ts(pkt_hdr, ts); diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index c63a25398..f31d34dca 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -234,7 +234,8 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, copy_packet_cls_metadata(&parsed_hdr, hdr); else packet_parse_layer(hdr, - pktio_entry->s.config.parser.layer); + pktio_entry->s.config.parser.layer, + pktio_entry->s.in_chksums); packet_set_ts(hdr, ts); diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index d8b78f3f8..da7a7b3a2 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -285,7 +285,8 @@ static odp_packet_t pack_odp_pkt(pktio_entry_t *pktio_entry, const void *data, copy_packet_cls_metadata(&parsed_hdr, pkt_hdr); else packet_parse_layer(pkt_hdr, - pktio_entry->s.config.parser.layer); + pktio_entry->s.config.parser.layer, + pktio_entry->s.in_chksums); packet_set_ts(pkt_hdr, ts); pkt_hdr->input = pktio_entry->s.handle; From patchwork Sat Jan 13 23:00:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124431 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp230538lje; Sat, 13 Jan 2018 15:02:30 -0800 (PST) X-Google-Smtp-Source: ACJfBos/81DWkgZ/+KEOxUQQGUPnAx7wK4jvgKV6XNbcwVmACq91/CmtIlzqWMCuxBgtpCiYQ+B7 X-Received: by 10.55.217.90 with SMTP id u87mr39645769qki.343.1515884549986; Sat, 13 Jan 2018 15:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515884549; cv=none; d=google.com; s=arc-20160816; b=yDAhbymUxOU2zwAQIJgNt3aJJKD6iSwKxukDym0B9V3rB8mwl1Hdw8O6oeOYi2B8IO eB8PkTkkPC31M93cHTtquWLzEb8n2ZxxEkDTzaVN8gYzit6ZaZn9ZyfiCaRnJ46n2KdH rT0erTR/ULbJxvfdlW6zF2asqK5wxtcCk2Gse5aSiJ/35ykg/qN6r1i1Fq35yqchYkKX hmcEj++Jg0/8X02Q0m1UuEbKrPCOcE0xA7nnqZXNWgGpFKoPHGPvXIa9LKO/3OGGohPu Bs4GbH/bbThLfW2SaPCYJkbncdjv1Evei/20GQlZIuI5QiOWTVCHDuxOob8bUYu0aQFI 0R9w== 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=fGQmC4Ftj5hCtUryoydJIIDOX1CbzMWRj52+Kg+7D/8=; b=h3rjo+eCn5qrGJW6RukcMvDQFWOwpIhkL62cLKV/6XuRgygFUfaKp0qRDsTVqbJPv1 J5EzFI2Yw3PHxcKelUBKPnxapyX43DGceWdJ+lkjpyuXJ/o1D/1L6rM1hM0zHvLIXVGh SY4u0BfR6IiVEF7FQLOeHw+2wjeJNtmLsZoyV7rMA9yjQ5PX07yCJrJgyLDBin4znmj1 3/4RYSSsw++sBNCeputlVaYkRrdKim9hgWTWk7uL0RjAQSDtdzAdnf8jNaSvohVPPBfy 2ExZmz11S7QeTxJfi3Trf/CNWd4CkN9Jd1pA3pKEzKOIza2i7Z3KHBEQhQut7/4/+B/O VQtA== 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 j14si637881qkh.244.2018.01.13.15.02.29; Sat, 13 Jan 2018 15:02:29 -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 9F27E6173A; Sat, 13 Jan 2018 23:02:29 +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, RCVD_IN_MSPIKE_H2 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 D3A6661748; Sat, 13 Jan 2018 23:00:37 +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 C701260975; Sat, 13 Jan 2018 23:00:23 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id CF2FB6151F for ; Sat, 13 Jan 2018 23:00:19 +0000 (UTC) Received: from mxback9g.mail.yandex.net (mxback9g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:170]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 8CE162181E40 for ; Sun, 14 Jan 2018 02:00:18 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback9g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id r3HWIvO9kl-0Im4G8Rl; Sun, 14 Jan 2018 02:00:18 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OeJ5YhkKll-0Ixu9fln; Sun, 14 Jan 2018 02:00:18 +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: Sun, 14 Jan 2018 02:00:11 +0300 Message-Id: <1515884413-15125-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> References: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 389 Subject: [lng-odp] [PATCH v3][WIP 5/7] linux-gen: chksum: separate checksumming function 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 main checksumming code, it will be used for packet checksum validation. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 389 (lumag:parse-checksums) ** https://github.com/Linaro/odp/pull/389 ** Patch: https://github.com/Linaro/odp/pull/389.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: e6a448356c90f142122e5b5d4796bdf19e04e8c6 **/ platform/linux-generic/Makefile.am | 1 + .../linux-generic/include/odp_chksum_internal.h | 59 ++++++++++++++++++++++ platform/linux-generic/odp_chksum.c | 18 ++----- 3 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 platform/linux-generic/include/odp_chksum_internal.h diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 7e40448bd..9c7563fb1 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -134,6 +134,7 @@ noinst_HEADERS = \ include/odp_bitmap_internal.h \ include/odp_bitset.h \ include/odp_buffer_internal.h \ + include/odp_chksum_internal.h \ include/odp_classification_datamodel.h \ include/odp_classification_inlines.h \ include/odp_classification_internal.h \ diff --git a/platform/linux-generic/include/odp_chksum_internal.h b/platform/linux-generic/include/odp_chksum_internal.h new file mode 100644 index 000000000..779598bbf --- /dev/null +++ b/platform/linux-generic/include/odp_chksum_internal.h @@ -0,0 +1,59 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP checksum - implementation internal + */ + +#ifndef ODP_CHKSUM_INTERNAL_H_ +#define ODP_CHKSUM_INTERNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Simple implementation of ones complement sum. + * Based on RFC1071 and its errata. + */ +static uint32_t _odp_chksum_ones_comp16_32(const void *p, uint32_t len, + odp_bool_t odd_offset) + +{ + uint32_t sum = 0; + const uint16_t *data = p; + + if (odd_offset) { + uint16_t left_over = 0; + + *(uint8_t *)&left_over = *(const uint8_t *)data; + sum = left_over; + data++; + len--; + } + + while (len > 1) { + sum += *data++; + len -= 2; + } + + /* Add left-over byte, if any */ + if (len > 0) { + uint16_t left_over = 0; + + *(uint8_t *)&left_over = *(const uint8_t *)data; + sum += left_over; + } + + return sum; +} + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/platform/linux-generic/odp_chksum.c b/platform/linux-generic/odp_chksum.c index a792971ef..484b2b0ae 100644 --- a/platform/linux-generic/odp_chksum.c +++ b/platform/linux-generic/odp_chksum.c @@ -7,26 +7,14 @@ #include #include +#include + /* Simple implementation of ones complement sum. * Based on RFC1071 and its errata. */ uint16_t odp_chksum_ones_comp16(const void *p, uint32_t len) { - uint32_t sum = 0; - const uint16_t *data = p; - - while (len > 1) { - sum += *data++; - len -= 2; - } - - /* Add left-over byte, if any */ - if (len > 0) { - uint16_t left_over = 0; - - *(uint8_t *)&left_over = *(const uint8_t *)data; - sum += left_over; - } + uint32_t sum = _odp_chksum_ones_comp16_32(p, len, false); /* Fold 32-bit sum to 16 bits */ while (sum >> 16) From patchwork Sat Jan 13 23:00:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124434 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp231141lje; Sat, 13 Jan 2018 15:05:12 -0800 (PST) X-Google-Smtp-Source: ACJfBotzfQT3Rgpfwy3lEym2tgNFhC2UchxH1r6RQ76zOCTxi4DH8y9aSwglvZ4f2wPPTIrWWt/D X-Received: by 10.200.16.13 with SMTP id z13mr40751800qti.111.1515884711998; Sat, 13 Jan 2018 15:05:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515884711; cv=none; d=google.com; s=arc-20160816; b=PGlIiE5fMOSWLntl1gkYRsa2hHZgAVTzX94/jm96RomfEIz062h+4W2S547/WUmcaO 5WNKi/jMuAh5XGhrOTDShZtpByVL8dYBF1beBe4s3MSF28puLaZPD8fRH0SFcaAIsxTq trC8ERoPspmCuZZ0wBZY6IWJZmHoLZbJpQysh3+BUvLjvVYfd8yPLM1/KTHx0/nS5Ka8 1H7/d3I+dDWkYanpBLSxKXdneZsVgVwbpyHthOtABQvcSvjBENggS0LPTwZoGrCMv1YA zXV5/K5/L4M3Yk3Ob4NY1ncRdWboyerNWUP5hD7dm2s23swimT9R+PNNBJPJj2knAzHq 6miQ== 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=bp1vflRIt9lCPt2bFC/czGiGEdv5EWW3ZR6KNqXtIZY=; b=LzhwPK24WggZLPgWBqAofC/32PxIXv+Lvw+tGj9GkbqFfL/LDrPxRUTUHN3+oOWe5T 4HysZHPCN4wmMYjUz0Ax5LpJrOy4NPRcdb9hO06EZ2heQzs4Rna9NoZvj6j9n8z/T2OF 3TYkMkqapNT6eLHhpnHd6p9+KMXVMNfstrsCGZZ6ijoRwqXhKbhxX9vqgOndPpNKjjhV GvdZ3CGjF/qWT2RHzzacwtHI/gu6eP2w0vs8FiYmsxSSvAsB2vwvbwEHn+vhMmcktiqH POo9oMzcBMAxL5uXwsTLWNJTGTsxWPLVK8tkZGf3qmDdbUg1BB81BDEFeauO6EOSwxRW 7Z5w== 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 d66si235820qkf.148.2018.01.13.15.05.11; Sat, 13 Jan 2018 15:05: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 AA8C561742; Sat, 13 Jan 2018 23:05:11 +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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 C6A2B6175E; Sat, 13 Jan 2018 23:00:50 +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 8C64860975; Sat, 13 Jan 2018 23:00:25 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id 985DA60721 for ; Sat, 13 Jan 2018 23:00:20 +0000 (UTC) Received: from mxback14g.mail.yandex.net (mxback14g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:93]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 2FEB9182E91 for ; Sun, 14 Jan 2018 02:00:19 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback14g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 5jEYibpREv-0J08YQuG; Sun, 14 Jan 2018 02:00:19 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OeJ5YhkKll-0IxKpjH1; Sun, 14 Jan 2018 02:00:18 +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: Sun, 14 Jan 2018 02:00:12 +0300 Message-Id: <1515884413-15125-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> References: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 389 Subject: [lng-odp] [PATCH v3][WIP 6/7] linux-gen: packet: check UDP checksums 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 Add code to enable checking of UDP checksums. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 389 (lumag:parse-checksums) ** https://github.com/Linaro/odp/pull/389 ** Patch: https://github.com/Linaro/odp/pull/389.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: e6a448356c90f142122e5b5d4796bdf19e04e8c6 **/ .../linux-generic/include/odp_packet_internal.h | 6 + platform/linux-generic/odp_packet.c | 134 +++++++++++++++++++-- 2 files changed, 132 insertions(+), 8 deletions(-) diff --git a/platform/linux-generic/include/odp_packet_internal.h b/platform/linux-generic/include/odp_packet_internal.h index 86f0d80a5..f8b698335 100644 --- a/platform/linux-generic/include/odp_packet_internal.h +++ b/platform/linux-generic/include/odp_packet_internal.h @@ -100,6 +100,12 @@ typedef struct { /* offset to L4 hdr (TCP, UDP, SCTP, also ICMP) */ uint16_t l4_offset; + + /* Partial sum for L4 checksumming */ + uint32_t l4_part_sum; + + /* L4 checksum */ + uint32_t l4_sum; } packet_parser_t; /* Packet extra data length */ diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index d3c608ab0..98ecf714e 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -1948,6 +1949,35 @@ int _odp_packet_copy_md_to_packet(odp_packet_t srcpkt, odp_packet_t dstpkt) return dst_uarea_size < src_uarea_size; } +static uint16_t packet_sum_ones_comp16(odp_packet_hdr_t *pkt_hdr, + uint32_t offset, + uint32_t len) +{ + uint32_t sum = pkt_hdr->p.l4_part_sum; + odp_bool_t odd_offset = false; + + if (offset + len > pkt_hdr->frame_len) + return 0; + + while (len > 0) { + uint32_t seglen = 0; /* GCC */ + void *mapaddr = packet_map(pkt_hdr, offset, &seglen, NULL); + + if (seglen < len) + seglen = len; + + len -= seglen; + sum += _odp_chksum_ones_comp16_32(mapaddr, seglen, odd_offset); + odd_offset ^= (seglen % 2); + } + + /* Not more than two additions */ + sum = (sum & 0xffff) + (sum >> 16); + sum = (sum & 0xffff) + (sum >> 16); + + return ~sum; +} + /** Parser helper function for Ethernet packets */ static inline uint16_t parse_eth(packet_parser_t *prs, const uint8_t **parseptr, uint32_t *offset, uint32_t frame_len) @@ -2033,6 +2063,7 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, uint16_t frag_offset; uint32_t dstaddr = odp_be_to_cpu_32(ipv4->dst_addr); uint32_t l3_len = odp_be_to_cpu_16(ipv4->tot_len); + uint32_t l4_part_sum = 0; if (odp_unlikely(ihl < _ODP_IPV4HDR_IHL_MIN) || odp_unlikely(ver != 4) || @@ -2052,6 +2083,18 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, *offset += ihl * 4; *parseptr += ihl * 4; + if (chksums.chksum.udp || chksums.chksum.tcp) { + l4_part_sum = _odp_chksum_ones_comp16_32( + (const uint16_t *)&ipv4->src_addr, + 2 * _ODP_IPV4ADDR_LEN, false); +#if ODP_BYTE_ORDER == ODP_BIG_ENDIAN + l4_part_sum += ipv4->proto; +#else + l4_part_sum += ((uint16_t)ipv4->proto) << 8; +#endif + prs->l4_part_sum = l4_part_sum; + } + if (odp_unlikely(ihl > _ODP_IPV4HDR_IHL_MIN)) prs->input_flags.ipopt = 1; @@ -2076,13 +2119,15 @@ static inline uint8_t parse_ipv4(packet_parser_t *prs, const uint8_t **parseptr, */ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, uint32_t *offset, uint32_t frame_len, - uint32_t seg_len) + uint32_t seg_len, + odp_proto_chksums_t chksums) { const _odp_ipv6hdr_t *ipv6 = (const _odp_ipv6hdr_t *)*parseptr; const _odp_ipv6hdr_ext_t *ipv6ext; uint32_t dstaddr0 = odp_be_to_cpu_32(ipv6->dst_addr.u8[0]); uint32_t l3_len = odp_be_to_cpu_16(ipv6->payload_len) + _ODP_IPV6HDR_LEN; + uint32_t l4_part_sum = 0; /* Basic sanity checks on IPv6 header */ if ((odp_be_to_cpu_32(ipv6->ver_tc_flow) >> 28) != 6 || @@ -2099,6 +2144,18 @@ static inline uint8_t parse_ipv6(packet_parser_t *prs, const uint8_t **parseptr, *offset += sizeof(_odp_ipv6hdr_t); *parseptr += sizeof(_odp_ipv6hdr_t); + if (chksums.chksum.udp || chksums.chksum.tcp) { + l4_part_sum = _odp_chksum_ones_comp16_32( + (const uint16_t *)(uintptr_t)&ipv6->src_addr, + 2 * _ODP_IPV6ADDR_LEN, false); +#if ODP_BYTE_ORDER == ODP_BIG_ENDIAN + l4_part_sum += ipv6->next_hdr; +#else + l4_part_sum += ((uint16_t)ipv6->next_hdr) << 8; +#endif + prs->l4_part_sum = l4_part_sum; + } + /* Skip past any IPv6 extension headers */ if (ipv6->next_hdr == _ODP_IPPROTO_HOPOPTS || ipv6->next_hdr == _ODP_IPPROTO_ROUTE) { @@ -2155,14 +2212,35 @@ static inline void parse_tcp(packet_parser_t *prs, /** * Parser helper function for UDP */ -static inline void parse_udp(packet_parser_t *prs, - const uint8_t **parseptr, uint32_t *offset) +static inline void parse_udp(packet_parser_t *prs, const uint8_t **parseptr, + uint32_t *offset, odp_proto_chksums_t chksums) { const _odp_udphdr_t *udp = (const _odp_udphdr_t *)*parseptr; uint32_t udplen = odp_be_to_cpu_16(udp->length); - if (odp_unlikely(udplen < sizeof(_odp_udphdr_t))) + if (odp_unlikely(udplen < sizeof(_odp_udphdr_t))) { prs->error_flags.udp_err = 1; + return; + } + + if (chksums.chksum.udp && + !prs->input_flags.ipfrag) { + if (udp->chksum == 0) { + prs->input_flags.l4_chksum_done = + (prs->input_flags.ipv4 != 1); + prs->error_flags.l4_chksum = + (prs->input_flags.ipv4 != 1); + } else { + prs->input_flags.l4_chksum_done = 1; + prs->l4_part_sum += udp->length; + /* Do not include checksum into partial sum */ + prs->l4_part_sum += _odp_chksum_ones_comp16_32( + (const void *)udp, + _ODP_UDPHDR_LEN - 2, + false); + } + prs->l4_sum = udp->chksum; + } if (odp_cpu_to_be_16(_ODP_UDP_IPSEC_PORT) == udp->dst_port && udplen > 4) { @@ -2208,7 +2286,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, case _ODP_ETHTYPE_IPV6: prs->input_flags.ipv6 = 1; ip_proto = parse_ipv6(prs, &parseptr, &offset, frame_len, - seg_len); + seg_len, chksums); prs->l4_offset = offset; break; @@ -2252,7 +2330,7 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, if (odp_unlikely(offset + _ODP_UDPHDR_LEN > seg_len)) return -1; prs->input_flags.udp = 1; - parse_udp(prs, &parseptr, NULL); + parse_udp(prs, &parseptr, NULL, chksums); break; case _ODP_IPPROTO_AH: @@ -2309,6 +2387,35 @@ int packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, seg_len, layer, ethtype, chksums); } +static int packet_l4_chksum(odp_packet_hdr_t *pkt_hdr, + odp_proto_chksums_t chksums) +{ + /* UDP chksum == 0 case is covered in parse_udp() */ + if (chksums.chksum.udp && + pkt_hdr->p.input_flags.udp && + !pkt_hdr->p.input_flags.ipfrag && + pkt_hdr->p.l4_sum != 0) { + uint16_t sum = packet_sum_ones_comp16(pkt_hdr, + pkt_hdr->p.l4_offset + + _ODP_UDPHDR_LEN, + pkt_hdr->frame_len - + pkt_hdr->p.l4_offset - + _ODP_UDPHDR_LEN); + + if (sum == 0) + sum = 0xffff; + + if (sum != pkt_hdr->p.l4_sum) { + pkt_hdr->p.error_flags.l4_chksum = 1; + ODP_DBG("UDP chksum fail (%x)!\n", sum); + } else { + ODP_DBG("UDP chksum OK!\n"); + } + } + + return pkt_hdr->p.error_flags.all != 0; +} + /** * Simple packet parser */ @@ -2318,9 +2425,15 @@ int packet_parse_layer(odp_packet_hdr_t *pkt_hdr, { uint32_t seg_len = packet_first_seg_len(pkt_hdr); void *base = packet_data(pkt_hdr); + int rc; + + rc = packet_parse_common(&pkt_hdr->p, base, pkt_hdr->frame_len, + seg_len, layer, chksums); - return packet_parse_common(&pkt_hdr->p, base, pkt_hdr->frame_len, - seg_len, layer, chksums); + if (rc != 0) + return rc; + + return packet_l4_chksum(pkt_hdr, chksums); } int odp_packet_parse(odp_packet_t pkt, uint32_t offset, @@ -2363,7 +2476,12 @@ int odp_packet_parse(odp_packet_t pkt, uint32_t offset, layer, ethtype, param->chksums); + if (ret) + return -1; + } + if (layer == ODP_PROTO_LAYER_L4) { + ret = packet_l4_chksum(pkt_hdr, param->chksums); if (ret) return -1; } From patchwork Sat Jan 13 23:00:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 124433 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp230846lje; Sat, 13 Jan 2018 15:04:02 -0800 (PST) X-Google-Smtp-Source: ACJfBotjXdk5UKm49jXM6rVvBtHCZY1neAAj81zRVrtnWKL/I3CsiC67Jf0S6PaSyFI47IRyy5iK X-Received: by 10.55.163.150 with SMTP id m144mr13029376qke.256.1515884642645; Sat, 13 Jan 2018 15:04:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515884642; cv=none; d=google.com; s=arc-20160816; b=aRhy5NMj1Q5TF1tNMuPHSqB+UNeJve1suBUgoOxV/8VKJZvZqknca478aOlSz8vA0e USLtmw+o9ohGS2iT97fJ+3vFSUcwkgFVucf5b0UFBw0uFlvUTm63u4wRpMwpYXZAySAu 6leTquKI4LKcgHCjSG/xY2XCJan/rTYQLCey8awEr6vmj+Fba2Fh3Lk1hcDJrkNVLtlN zLrxkximJY7/v8qYAzPEwAY8Imb1+nxI112XBy6zQBssaO9Cxmm/6tLrhWBrzz2b7/e1 suCW8WOPWpT39gjha2B6VRvas6ZbnbJ1TTZ/fzsw8CAhoxMXD63sSysaLPCC1+OSKEac c/qw== 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=GX+ElqDo3A7mYMuGmkbhrfj5k81iJaUwE99KBLeyCEc=; b=jMpDyj/ry8Fl4iHll2kPXG2e72Cvvc0iOXSne5ZOq5WMwatx6IAXjYI46wC5cbULg3 f5I47oS2f3slo7syqQoMofsevxrOAbuy1kAPqnMnNopmHpv+u8548i5Y7hjRaBDtUreX XWaHMDsn2ZprLBkyeiGrlCDcGlbfmhVZMVJFNzJjb1r/t76130sF/hSgBIve2aczR0Yz uCsIRmNPjZzpalpk19TqKYHXC26YCqrq5V+4soMGyB9CSZX4wtzB+AVEnpb/Doz3QwmS Ae1iPW2Hz0h6gcyOaJ+ZgHKdSZ/fiM1pEVDfC+XldU/palYVNI/2QYsoYE4NOxqZuWfb 1VEw== 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 k188si180397qkf.323.2018.01.13.15.04.02; Sat, 13 Jan 2018 15:04:02 -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 58C4661748; Sat, 13 Jan 2018 23:04:02 +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, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL 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 734E761753; Sat, 13 Jan 2018 23:00:46 +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 33AA160975; Sat, 13 Jan 2018 23:00:25 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 02E1F61726 for ; Sat, 13 Jan 2018 23:00:20 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward102j.mail.yandex.net (Yandex) with ESMTP id B09F05601A1F for ; Sun, 14 Jan 2018 02:00:19 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id RUaUI7cNRT-0JVCIBtV; Sun, 14 Jan 2018 02:00:19 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id OeJ5YhkKll-0JxiHM4w; Sun, 14 Jan 2018 02:00:19 +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: Sun, 14 Jan 2018 02:00:13 +0300 Message-Id: <1515884413-15125-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> References: <1515884413-15125-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 389 Subject: [lng-odp] [PATCH v3][WIP 7/7] linux-gen: pktio: loop: support checksum parsing 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 Add capability bits referencing support for IPv4 and UDP checksum validation for loop pktio device. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 389 (lumag:parse-checksums) ** https://github.com/Linaro/odp/pull/389 ** Patch: https://github.com/Linaro/odp/pull/389.patch ** Base sha: 49ebafae0edebbc750742d8874ad0a7588286dea ** Merge commit sha: e6a448356c90f142122e5b5d4796bdf19e04e8c6 **/ platform/linux-generic/pktio/loop.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index bf6365e94..9b470c083 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -250,6 +250,8 @@ static int loopback_capability(pktio_entry_t *pktio_entry ODP_UNUSED, odp_pktio_config_init(&capa->config); capa->config.pktin.bit.ts_all = 1; capa->config.pktin.bit.ts_ptp = 1; + capa->config.pktin.bit.ipv4_chksum = 1; + capa->config.pktin.bit.udp_chksum = 1; capa->config.inbound_ipsec = 1; capa->config.outbound_ipsec = 1;