From patchwork Thu Mar 1 16:59:57 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: 130340 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3043133edc; Thu, 1 Mar 2018 09:01:23 -0800 (PST) X-Google-Smtp-Source: AG47ELsiy5tqahVhhf+HCT548ExBTeof6NSJKo5Q58OnqoVIApyMwJZuSmV9dPfiX86RTCRxCizx X-Received: by 10.13.202.150 with SMTP id m144mr1742103ywd.70.1519923683183; Thu, 01 Mar 2018 09:01:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923683; cv=none; d=google.com; s=arc-20160816; b=N3uWq6wII2w8FCs6El3iVI7ECeMD4kZXOKsMigZV4/7EBk+HuvWqJMm1pOC2AN/8n1 6BCC2F0ie+pvIgmWd4rP0faQBc7O76BClHTKxR9HL1KgAOR9Eb9/XukliAa+qvGJ509+ odNtQBEswI05O1aVjynXXxgj2yCwdHzQToApAMsoRTznD0RBhSGf+VHTsu95aaN8y1Wl QGD9fvrTDVdqJz8WSTzZO2JeaBMDcfwVwJWOI9jG0+gVyii1W+W1qcDYw40FQielVSWz pOsfw7aNZV7QloBH2oZNYKBqrSP15SxDAzVFIaidaDTRUIiBEFoSQq3BH7r3ER6+2vmJ yWtA== 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=PIOVquqqkKSpJv2SoQL2mlCrXfBLLUX+lcotKl+Hm7o=; b=Yo84cnHR8lu+BkGM5plFWWOn94kZ83eZql15GeQbS2D+rs5Ha9NHBifNvmgklJ1UJB j0prQ1asR9GihdrVJUvtCojJ2PLqqI9GDlmM5Kel49+UvTC/VCfU7CWoJaZ4naHmbxRo 0+wd6zzjBzYJdcz2565beGJYwgnERfvsHK9vTWcf2K+NYoIpxGUMy4zDGJSJ2XAQFi7g LmBQpiuoa6UwPz4Yb4g+OBl6jIDq7lNvTeqrWNoMndkP9mdM0cqmaalLK1Uc6jkP3yj9 DjUP5jCw/G/XMAcs6YEcDxNOoco20gVUPQILb64Ym1tC3OooMlPtLPqlZPTV4zu37DQz 54QQ== 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 n189si485358qkc.479.2018.03.01.09.01.22; Thu, 01 Mar 2018 09:01:23 -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 BF28A617E4; Thu, 1 Mar 2018 17:01:22 +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 7791860632; Thu, 1 Mar 2018 17:00:33 +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 5FEF26178A; Thu, 1 Mar 2018 17:00:19 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 79489616FC for ; Thu, 1 Mar 2018 17:00:14 +0000 (UTC) Received: from mxback2o.mail.yandex.net (mxback2o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1c]) by forward105o.mail.yandex.net (Yandex) with ESMTP id E45774444E80 for ; Thu, 1 Mar 2018 20:00:12 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id FPP9dysXrY-0ClmKHTK; Thu, 01 Mar 2018 20:00:12 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0BC4m4fb; Thu, 01 Mar 2018 20:00:11 +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, 1 Mar 2018 19:59:57 +0300 Message-Id: <1519923609-31634-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 1/13] linux-gen: packet: implement packet l3/l4 proto types 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 Reviewed-by: Petri Savolainen Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ platform/linux-generic/odp_packet.c | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index e24aa0c7a..8a5833ded 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2485,3 +2485,41 @@ int odp_packet_has_ref(odp_packet_t pkt) return 0; } + +odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (pkt_hdr->p.input_flags.ipv4) + return ODP_PROTO_L3_TYPE_IPV4; + else if (pkt_hdr->p.input_flags.ipv6) + return ODP_PROTO_L3_TYPE_IPV6; + else if (pkt_hdr->p.input_flags.arp) + return ODP_PROTO_L3_TYPE_ARP; + + return ODP_PROTO_L3_TYPE_NONE; +} + +odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (pkt_hdr->p.input_flags.tcp) + return ODP_PROTO_L4_TYPE_TCP; + else if (pkt_hdr->p.input_flags.udp) + return ODP_PROTO_L4_TYPE_UDP; + else if (pkt_hdr->p.input_flags.sctp) + return ODP_PROTO_L4_TYPE_SCTP; + else if (pkt_hdr->p.input_flags.ipsec_ah) + return ODP_PROTO_L4_TYPE_AH; + else if (pkt_hdr->p.input_flags.ipsec_esp) + return ODP_PROTO_L4_TYPE_ESP; + else if (pkt_hdr->p.input_flags.icmp && + pkt_hdr->p.input_flags.ipv4) + return ODP_PROTO_L4_TYPE_ICMPV4; + else if (pkt_hdr->p.input_flags.icmp && + pkt_hdr->p.input_flags.ipv6) + return ODP_PROTO_L4_TYPE_ICMPV6; + + return ODP_PROTO_L4_TYPE_NONE; +} From patchwork Thu Mar 1 16:59:58 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: 130341 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3043955edc; Thu, 1 Mar 2018 09:01:56 -0800 (PST) X-Google-Smtp-Source: AG47ELtgbxF6A7+fXCmR0BWc0Lbkkxc7H18cXj4hcpDTyOHlMeHFtk83fHUC6Iqtds8HAZrw6Jhx X-Received: by 10.55.36.132 with SMTP id k4mr3719483qkk.68.1519923716108; Thu, 01 Mar 2018 09:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923716; cv=none; d=google.com; s=arc-20160816; b=XJJJVNHYdvn3HFxQ0CM9nZ+VHmdJWRUoZWV03Md9Vk6e4nzu6olTCysNru6Ytvelz2 yqzlr15HRgpX+L0an/Wy7/2G/Q2HAw/cqEQGwJMGL510JqwAaF9p5me6yE23oymGaNgR y6nPsao5gvrjiAStLNWu52u8S9RlB1zjqCx5zufZDVzcC/xVgIjD5gVp6GiPnM3+pqY5 3jZjIWNHaKGncT6NO4KZk5XtDw/4GjYnmKXs/clIuvA5jpoxIwLMlpH7GkRxeVtyymF2 15KAKBwevQluJ5DW7HfkUrYEIk2Ub3KPnAmA/tMuKja0EVDIIKmyia7K4VXjOjke8z7Y HJrQ== 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=4O9H17OnCH0wX+r5V4Qyw8mZdaepv+ja4t4Kr8GBb10=; b=VHMuU5tfx0/V64LKAnJz+q9vLFDijCyhEVIO4vrxpeqgna8r5opx7BhU/3GrXTtlw7 +czsoNj22tGYFvlqHcLYVJLNv1H4WSIATKhYGEH0JajHIennQthYjyF963QeNDmPvs4a u5HbVkfQYns5ZX9/5WrEqkDlfsrdEuWeKK9X9KfJ7RsaRMmgNbG3YjsfxMw7GzLm6mgs y370n5i5O5Sz7UeO+PfVJgPaScUCQ30dnYLOaNBjPhM+vUwuemsj2nvlhLcOUHfBt7E3 78yFi5UoDEpnfR++VtbVEBoBle/CEyg4i/vl1RXrsHy6XnHtgkeDH553EDIVTGQdLjhZ JnaA== 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 o39si4792106qtf.24.2018.03.01.09.01.55; Thu, 01 Mar 2018 09:01:56 -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 B97E0617E0; Thu, 1 Mar 2018 17:01:55 +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 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 3EFC560802; Thu, 1 Mar 2018 17:00:40 +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 32A5361777; Thu, 1 Mar 2018 17:00:21 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id BD02561777 for ; Thu, 1 Mar 2018 17:00:15 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward103j.mail.yandex.net (Yandex) with ESMTP id C224E34C41A0 for ; Thu, 1 Mar 2018 20:00:13 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bh0xFJxQlk-0Dl8SdZn; Thu, 01 Mar 2018 20:00:13 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0CCCD5BZ; Thu, 01 Mar 2018 20:00:12 +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, 1 Mar 2018 19:59:58 +0300 Message-Id: <1519923609-31634-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 2/13] validation: api: check l3/l4 proto types after 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 Signed-off-by: Dmitry Eremin-Solenikov Reviewed-by: Petri Savolainen Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ test/validation/api/packet/packet.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 03449f26e..2ed801640 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2605,6 +2605,10 @@ static void parse_eth_ipv4_udp(void) CU_ASSERT(odp_packet_has_udp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), + ODP_PROTO_L3_TYPE_IPV4); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), + ODP_PROTO_L4_TYPE_UDP); } odp_packet_free_multi(pkt, num_pkt); @@ -2638,6 +2642,10 @@ static void parse_ipv4_udp(void) CU_ASSERT(odp_packet_has_udp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), + ODP_PROTO_L3_TYPE_IPV4); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), + ODP_PROTO_L4_TYPE_UDP); } odp_packet_free_multi(pkt, num_pkt); @@ -2668,6 +2676,10 @@ static void parse_eth_ipv4_tcp(void) CU_ASSERT(odp_packet_has_tcp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); CU_ASSERT(!odp_packet_has_udp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), + ODP_PROTO_L3_TYPE_IPV4); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), + ODP_PROTO_L4_TYPE_TCP); } odp_packet_free_multi(pkt, num_pkt); @@ -2790,6 +2802,10 @@ static void parse_eth_vlan_ipv6_udp(void) CU_ASSERT(odp_packet_has_udp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), + ODP_PROTO_L3_TYPE_IPV6); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), + ODP_PROTO_L4_TYPE_UDP); } odp_packet_free_multi(pkt, num_pkt); @@ -3040,6 +3056,10 @@ static void parse_eth_ipv6_ipsec_ah(void) CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); CU_ASSERT(!odp_packet_has_udp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), + ODP_PROTO_L3_TYPE_IPV6); + CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), + ODP_PROTO_L4_TYPE_TCP); } odp_packet_free_multi(pkt, num_pkt); From patchwork Thu Mar 1 16:59:59 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: 130342 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3044840edc; Thu, 1 Mar 2018 09:02:32 -0800 (PST) X-Google-Smtp-Source: AG47ELsQVzXhn9danLY52vwXzscG8HgC4FI8SLYFSfVx7O/ct4IgZg2eugNHg+Z9NDB/8XhAoe0C X-Received: by 10.13.225.18 with SMTP id k18mr1687202ywe.512.1519923752813; Thu, 01 Mar 2018 09:02:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923752; cv=none; d=google.com; s=arc-20160816; b=bmgsffroLj1uuMo8XEzcIQIbcxAFAdTGKzE325AkWtfEEm0Nai8q69v/1RX7Yphbtp B5OzthbUumsodieXKQHx+tubg+PZFOcAtwPl2Xm5YyEQ9/E3YrVnHIH64M05hRX5nAIw quQ8ueFHFWhb7y9IeLoV7Cvjfb76UH4Sk5sIe4IGHDygYvFXT3CRpYd3lix8NPisCkQN pvBcRbf8uIkYnxCVa7tbFb7XseqS9YwKjNzCtazO7HWf9LRFO7IN7uoN6OA+ipoNst6K /PwzLf/wQICSWYeg4hmZLeuW+crsT/+WGs1XyCl7yh/6Yha8ih2/2fqkyzj++jLowEFd X4rg== 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=wod73VZpQTvf/fUPenQH20R2/DN61UefMwMR5D/haxM=; b=N0AU+Qt2O1i0jWSucX8T5pGva8ge6mutUfGVrI8q/pBQi9JUDTiqlkhhio6GUKU0Cu p9xCADgf+OMCoLSPP1uLMuc57PdzwZZuXVKxfNqJ5JCODH1mFK+sWFA8EqAGaA/0Ivem 54kbrYyNMlSzxqFZpNvDkGOdx37POiNmTQrcqqdIUUcmH7UavzOS3bK5Rq5tNTEePnPf DpxACjIvhF8+yN9zqj4FER0ffPSLU+N5mRQMe4NlyorNB/Z3024nb9L2uYIxTqwJdnQ6 Nxkl5guJ7t9CXrW51V3I2bZB3fYbep8iu3ZRw1WelKEfpMzZ6QBaARbcOQtaM8uCXK6X vJmQ== 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 c125-v6si726609yba.285.2018.03.01.09.02.32; Thu, 01 Mar 2018 09:02:32 -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 73F2760852; Thu, 1 Mar 2018 17:02:32 +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 8779B616DA; Thu, 1 Mar 2018 17: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 47F6F61790; Thu, 1 Mar 2018 17:00:22 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id B619E6176D for ; Thu, 1 Mar 2018 17:00:15 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward105o.mail.yandex.net (Yandex) with ESMTP id AB5C34444E93 for ; Thu, 1 Mar 2018 20:00:14 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id xcEL3KjvPX-0EverSIl; Thu, 01 Mar 2018 20:00:14 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0DCCqRcR; Thu, 01 Mar 2018 20:00:13 +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, 1 Mar 2018 19:59:59 +0300 Message-Id: <1519923609-31634-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 3/13] linux-gen: packet: add odp_packet_l2_type() implementation 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 Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ platform/linux-generic/odp_packet.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 8a5833ded..35b9b59dc 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2486,6 +2486,16 @@ int odp_packet_has_ref(odp_packet_t pkt) return 0; } +odp_proto_l2_type_t odp_packet_l2_type(odp_packet_t pkt) +{ + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); + + if (pkt_hdr->p.input_flags.eth) + return ODP_PROTO_L2_TYPE_ETH; + + return ODP_PROTO_L2_TYPE_NONE; +} + odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt) { odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); From patchwork Thu Mar 1 17:00:00 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: 130346 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3048262edc; Thu, 1 Mar 2018 09:05:14 -0800 (PST) X-Google-Smtp-Source: AG47ELu685Nxs12ku7sc3430epIXlZrur3j6tlEEB2Hmd8jsfZhwzWJ/Gu86Daa/dLpUC6Wb0xPH X-Received: by 10.237.46.165 with SMTP id k34mr4024218qtd.64.1519923914474; Thu, 01 Mar 2018 09:05:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923914; cv=none; d=google.com; s=arc-20160816; b=OzqQRhTDzM+IyOAUNMAENtObgJDbLYcepo4GbhHe7vGnYEgHbvnUBMYsAf6wVFRLDn VOhIwkbHKMHpnnpnzAW8HltVHVWjGg8TrPowTLyzHL2j/YyvJviZdQ963CEOgN/PWz20 48qPXrJTOVeeEYm2RUcniLnbyVaP2l0+mtmC7s2Q5fb5SJRlOzI2+x49PYycFq80nKs7 UXbOx2RAYL8zflQyhg+0jeAY1bcHMHydFtj/ulaTjShndtlQ1FsghgsHJanukycpQDaE rsXMEpSbIJEHhOF3LRdl0WiE57vHtGn6B0jqmsofzYOBSG8XqXPO+pCHBYXbQYrNvNHL 0D+g== 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=7P2EX4kg5jpp72CIAr/aAj/TUc+XRxN6cCOHgK7/uIs=; b=AoGwuTEeRfXHhSJeYXJmzbVfoq5isli3AyAOLvS29f/WcUKYDh/NQekAy9bLyzJi1P gQhg6McAckg6PtnNG9vn3UWsq50/y4ZwWEQb45wS6MfbX6R6k8cxgaq0GLi7W9QFjm+6 6AoeZiS1aIcxe9Lyze8dwHngrRm9MDhFZ6xlYW/GmfAQDI6kt18g0ZC4zix2t4+rs7kd 76T+Gow3LXwVuUMY/CoeAly0ZuBLE+igqgHwdKg883AduRlczpDRMMecjztaZZRBNxnr TrgAlp+G1o966/9vPiMWXdIyoCgf7ELQeSW3aJLuzuYvsEFcFy/p8+85dz97ONzehilN f3jA== 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 b69si4737300qka.469.2018.03.01.09.05.13; Thu, 01 Mar 2018 09:05:14 -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 D752560852; Thu, 1 Mar 2018 17:05:13 +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 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 C1068617A3; Thu, 1 Mar 2018 17:01:01 +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 1BCEE61789; Thu, 1 Mar 2018 17:00:25 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 5ECDF61783 for ; Thu, 1 Mar 2018 17:00:17 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward103o.mail.yandex.net (Yandex) with ESMTP id D6E495885298 for ; Thu, 1 Mar 2018 20:00:15 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 8ph9IA7yhK-0FbWD5B6; Thu, 01 Mar 2018 20:00:15 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0ECmbLWX; Thu, 01 Mar 2018 20:00:14 +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, 1 Mar 2018 20:00:00 +0300 Message-Id: <1519923609-31634-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 4/13] validation: packet: verify odp_packet_l2_type() 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 Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ test/validation/api/packet/packet.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 2ed801640..e2425fc0c 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -2605,6 +2605,8 @@ static void parse_eth_ipv4_udp(void) CU_ASSERT(odp_packet_has_udp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV4); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), @@ -2676,6 +2678,8 @@ static void parse_eth_ipv4_tcp(void) CU_ASSERT(odp_packet_has_tcp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv6(pkt[i])); CU_ASSERT(!odp_packet_has_udp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV4); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), @@ -2802,6 +2806,8 @@ static void parse_eth_vlan_ipv6_udp(void) CU_ASSERT(odp_packet_has_udp(pkt[i])); CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV6); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), @@ -3056,6 +3062,8 @@ static void parse_eth_ipv6_ipsec_ah(void) CU_ASSERT(!odp_packet_has_ipv4(pkt[i])); CU_ASSERT(!odp_packet_has_tcp(pkt[i])); CU_ASSERT(!odp_packet_has_udp(pkt[i])); + CU_ASSERT_EQUAL(odp_packet_l2_type(pkt[i]), + ODP_PROTO_L2_TYPE_ETH); CU_ASSERT_EQUAL(odp_packet_l3_type(pkt[i]), ODP_PROTO_L3_TYPE_IPV6); CU_ASSERT_EQUAL(odp_packet_l4_type(pkt[i]), From patchwork Thu Mar 1 17:00:01 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: 130343 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3045763edc; Thu, 1 Mar 2018 09:03:10 -0800 (PST) X-Google-Smtp-Source: AG47ELuXV79oOFXzs/3z1t9o0E9O2vm9PO1Ch4bUl2bSeshDnwEymL+1JTwhlNBE/3E9oSToyCvr X-Received: by 10.129.121.141 with SMTP id u135mr1647729ywc.187.1519923790814; Thu, 01 Mar 2018 09:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923790; cv=none; d=google.com; s=arc-20160816; b=lu7Q1NYrIYieTkt8ofNyI6iAGXH7XzZjaAGL8mxTCBuZMNVL7KfoUqfABZHyAvpxCM ovyK1CcXFgkkhG7xjKozqdHFtlpD0wvGTJzraZNsk/uHl0+J79Y8t4cyQ2E/4cBHyJcA /R1buBVnL/v7YUOLE7UMyt0hfxg47JSrKnh3HbKxcdkYceRrNPLTVtopChuwyMiX2Fi8 aYHDpKSSsV2iXrvCfcOe3GNfUDL4TCDbBjDXKkCF9F4B+V38l3L3Cfipjpixk+T4OHdN mr9o2JphP/VbwXSadFZ8rd1pFbELY/gmV/4U1xLqfZ8xLpxEJVC0ZB0lxyqfY8pYyXV6 hyVQ== 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=g5/GnUNNNrpdKcaSYJGvjpTLAitucCvHNIx1Sxjepf0=; b=dSJV2dJgZEjQ37+tmVGyVsbDycjP8lFMBbGZqi3i76O/GMpmf/eIMQemZoCD2281MN zEU9Y4faM1RmBo1YD8cICMi8TKVuHNA06B0XwYcMSIJmHebAYTK2iBmDvBm1MwdR4A+w 7xHyEoTC9Jd3nn3U11M6X0DxJAoY7lHVbQgsRBb8pLqj+1HOsDmHGHCl6Lj6+XVKIB34 wlVhWfxk301b1NbEe7LtjlnCkDBe45Ip7Rzq8+rqsP4I8M+DUZWahbN0fqt4OMZGi7vV o8SF4QRD9lEHaen32fAOlhQPb1oiV4qFLuulglzl3JU/5GJydk6gC16EMX4bHAszGv+q lJPg== 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 c14-v6si717320ybm.809.2018.03.01.09.03.10; Thu, 01 Mar 2018 09:03:10 -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 6DB89616FC; Thu, 1 Mar 2018 17:03: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 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 CBF1C60ABA; Thu, 1 Mar 2018 17:00:51 +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 C075A61790; Thu, 1 Mar 2018 17:00:22 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id 487F561789 for ; Thu, 1 Mar 2018 17:00:18 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward100p.mail.yandex.net (Yandex) with ESMTP id C03FC5105B76 for ; Thu, 1 Mar 2018 20:00:16 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id f5ivnDYi5t-0GeqYaml; Thu, 01 Mar 2018 20:00:16 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0FCuXbHh; Thu, 01 Mar 2018 20: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: Thu, 1 Mar 2018 20:00:01 +0300 Message-Id: <1519923609-31634-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 5/13] validation: ipsec: set frag_mode flag 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 Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ test/validation/api/ipsec/ipsec_test_out.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 2850ddfa4..911987388 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -572,7 +572,8 @@ static void test_out_ipv4_ah_sha256_frag_check(void) ipsec_test_part test2 = { .pkt_in = &pkt_ipv4_icmp_0, .num_opt = 1, - .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, + .opt = { .flag.frag_mode = 1, + .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, .out_pkt = 1, .out = { { .status.warn.all = 0, @@ -665,7 +666,8 @@ static void test_out_ipv4_esp_null_sha256_frag_check(void) ipsec_test_part test2 = { .pkt_in = &pkt_ipv4_icmp_0, .num_opt = 1, - .opt = { .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, + .opt = { .flag.frag_mode = 1, + .frag_mode = ODP_IPSEC_FRAG_DISABLED, }, .out_pkt = 1, .out = { { .status.warn.all = 0, From patchwork Thu Mar 1 17:00:02 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: 130344 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3046551edc; Thu, 1 Mar 2018 09:03:47 -0800 (PST) X-Google-Smtp-Source: AG47ELv5HmdtHB2XjpLSi3n++b+y5mTE2xv6vfcAEunOlhKSSWitepUQLEl/iiSsHTssHn0jB/Ua X-Received: by 10.129.161.16 with SMTP id y16mr1678963ywg.168.1519923826807; Thu, 01 Mar 2018 09:03:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923826; cv=none; d=google.com; s=arc-20160816; b=QYrASRIWH0cKF1e2gGvkUbCtXVNEvzTzzVtf0mEE7ioexbaQyt/IwyuWSQdaoEZOrV RMn5myjb5pQeVpwbTdZ3VvmRCBot1N36p5FDtn0r39/Tg7hsygAc8cYPiyur3wnf5XXr kS4pRNg06IqFeIErdCNyTmQkRpXX9j6ojBSVhDebDz8OPpsMTgGgIX/cgquQ5IZkDAMT JuYmb+OLBpBgNHu7nAPaVHu823+yeDa/ejEgYRoBlhAPFTaqYNS1JP/HTwzLoaV3V0iv ln8RLqbqPvmlPhFoB5KYqhHNT2rdsPyT7JZnBG+rlH7HQfgVKSRkJSs3XzrEvn/Cye+/ peSg== 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=9yYnmcy/B7O+ieUSkliUveg7LZkwjuemMvXGvNEATQE=; b=JqeWEMLrRhlnQee0USGb2xMdOJ5xlV5EnL6XoJXEzGiQ35ka0cLQ0VdVlB06VLn20J dBeYq/JglTmXs4Z5m897POUUackVIXWhh6VHYN0I+0oFysQeHtxklnFa4XLM9jVRFTL+ vk7YUM3Trqq0KZ+mo8CoQyROQcJdhG4gqUG4JCU4PCNTf+NVLU29FRNKj00WvX6KAdVS 1UroeITNCJeB6SL16gQuLfRDylwKb98dtJLWMac3s01M1hjMKKXF5IFmyWXkdsEaeQtZ DIHpy89PoRo2Vuxyy8g3XmOH5QN+k+c7wf2mvUeEqojJadN9Jj01BJ0uYP5u/+cEpw7P U4/Q== 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 m124-v6si720438ybb.725.2018.03.01.09.03.46; Thu, 01 Mar 2018 09:03:46 -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 6C60B60632; Thu, 1 Mar 2018 17:03:46 +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 1D3F461750; Thu, 1 Mar 2018 17:00:54 +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 2269761789; Thu, 1 Mar 2018 17:00:23 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id CAD5E607B9 for ; Thu, 1 Mar 2018 17:00:19 +0000 (UTC) Received: from mxback6g.mail.yandex.net (mxback6g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:167]) by forward105p.mail.yandex.net (Yandex) with ESMTP id D62BA4082846 for ; Thu, 1 Mar 2018 20:00:17 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback6g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GcIYGvobuW-0HuK4EbP; Thu, 01 Mar 2018 20:00:17 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0GCeVqQY; Thu, 01 Mar 2018 20: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: Thu, 1 Mar 2018 20:00:02 +0300 Message-Id: <1519923609-31634-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 6/13] linux-gen: ipsec: provide global init/term 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: Dmitry Eremin-Solenikov Signed-off-by: Dmitry Eremin-Solenikov Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ platform/linux-generic/include/odp_internal.h | 4 ++++ platform/linux-generic/odp_init.c | 13 +++++++++++++ platform/linux-generic/odp_ipsec.c | 13 +++++++++++++ 3 files changed, 30 insertions(+) diff --git a/platform/linux-generic/include/odp_internal.h b/platform/linux-generic/include/odp_internal.h index c21228982..ff8e4176f 100644 --- a/platform/linux-generic/include/odp_internal.h +++ b/platform/linux-generic/include/odp_internal.h @@ -76,6 +76,7 @@ enum init_stage { NAME_TABLE_INIT, IPSEC_EVENTS_INIT, IPSEC_SAD_INIT, + IPSEC_INIT, ALL_INIT /* All init stages completed */ }; @@ -142,6 +143,9 @@ int _odp_ishm_init_local(void); int _odp_ishm_term_global(void); int _odp_ishm_term_local(void); +int _odp_ipsec_init_global(void); +int _odp_ipsec_term_global(void); + int _odp_ipsec_sad_init_global(void); int _odp_ipsec_sad_term_global(void); diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index 325c1fb92..19003b6a2 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -150,6 +150,12 @@ int odp_init_global(odp_instance_t *instance, } stage = IPSEC_SAD_INIT; + if (_odp_ipsec_init_global()) { + ODP_ERR("ODP IPsec init failed.\n"); + goto init_failed; + } + stage = IPSEC_INIT; + *instance = (odp_instance_t)odp_global_data.main_pid; return 0; @@ -174,6 +180,13 @@ int _odp_term_global(enum init_stage stage) switch (stage) { case ALL_INIT: + case IPSEC_INIT: + if (_odp_ipsec_term_global()) { + ODP_ERR("ODP IPsec term failed.\n"); + rc = -1; + } + /* Fall through */ + case IPSEC_SAD_INIT: if (_odp_ipsec_sad_term_global()) { ODP_ERR("ODP IPsec SAD term failed.\n"); diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 3e6a80987..8c3d6cd63 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -1796,3 +1796,16 @@ odp_event_t odp_ipsec_packet_to_event(odp_packet_t pkt) { return odp_packet_to_event(pkt); } + +int _odp_ipsec_init_global(void) +{ + odp_ipsec_config_init(&ipsec_config); + + return 0; +} + +int _odp_ipsec_term_global(void) +{ + /* Do nothing for now */ + return 0; +} From patchwork Thu Mar 1 17:00:03 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: 130345 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3047434edc; Thu, 1 Mar 2018 09:04:32 -0800 (PST) X-Google-Smtp-Source: AG47ELvmxHMIjlYi2PW1lrTleT0llEMEYl4sJJaiSnK7qDMeMc95DZ0OaLfdVGA95VAB91eMtE+U X-Received: by 10.237.42.70 with SMTP id k6mr3990984qtf.24.1519923872713; Thu, 01 Mar 2018 09:04:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923872; cv=none; d=google.com; s=arc-20160816; b=LEX5ChCuizEDwMfAgDX76RBhMhnT9R+rg85QWjIayYKW3pj4XufH0o5Xjomzjvufii Km9ciFuwp36SgWvYboyv//N+b2iEs+nUiQL6HBnryaQxK0CygnHmXuR9VPibV/f+tBXb PBmVJwnsZd9gxDKRirD/+I6odufZQxgXhwxm7Drz4zdZfhE//9urD/FfZWbnx8lvINMz qBTW+VFm0FS0voZDQ+0gIvA/a4NTUq7kEr48yRZQ224I+lpIGCHCmtdlvfuGgjJPH+He 24qoYy5LwAY7iqrIJr3j1mInii1sq4ppMcBF63PVhKJ3yS7kxeTahlQ2d57MdHLAV/zG dfww== 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=iDu/Sb5PwZKzo3Yk303Va0eu/jlRJSgqEVkjEaSMAkI=; b=vk8ggNaOrfTJZovf5QcEK1WPnaC4UC/4VN64zqa97UGaT7W4wUPDS3Wdpoj76kTBSU juLwLyQc2XfOQH8B/MkP88D3UHjE9+jNrTEHExHvoPBP1qj1UiODUKm4VySSGmndB6L/ 2knbMAcGsoY1gq9gY9xWkU7folCZL6Dn2cjshuh2jz69L+chRYyLpueyoHbVtQl+6mEA K7AqEX37rIah6hGPYDZ4grwLlkO367k8Q0fwBapwssuiLccfTZCPfvgnt0v6qeVm9X1s SSP8N1VU/r/3vYnMEksNnjS0+UN2bcDVl+pc8s8oLlUc9kCTwvaEM5wPQAKDrl8dZonZ PZAw== 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 g127si4623908qkd.340.2018.03.01.09.04.32; Thu, 01 Mar 2018 09:04:32 -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 6107B6180E; Thu, 1 Mar 2018 17:04:32 +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 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 6EDA56178F; Thu, 1 Mar 2018 17:00:59 +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 71C6661789; Thu, 1 Mar 2018 17:00:24 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 2A016616FC for ; Thu, 1 Mar 2018 17:00:21 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward106o.mail.yandex.net (Yandex) with ESMTP id C8A3E785CD2 for ; Thu, 1 Mar 2018 20:00:19 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 2izoQF0ONE-0I8SgtMv; Thu, 01 Mar 2018 20:00:19 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0HCC9ad0; Thu, 01 Mar 2018 20: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: Thu, 1 Mar 2018 20:00:03 +0300 Message-Id: <1519923609-31634-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 7/13] linux-gen: ipsec: take ipsec_out_opt flags into account 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 Only override frag_mode if respective flag is set. Signed-off-by: Dmitry Eremin-Solenikov Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ platform/linux-generic/odp_ipsec.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 8c3d6cd63..3c9d88cc6 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -1296,6 +1296,7 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, int rc; odp_crypto_packet_result_t crypto; /**< Crypto operation result */ odp_packet_hdr_t *pkt_hdr; + odp_ipsec_frag_mode_t frag_mode; uint32_t mtu; state.ip_offset = odp_packet_l3_offset(pkt); @@ -1307,8 +1308,9 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, ipsec_sa = _odp_ipsec_sa_use(sa); ODP_ASSERT(NULL != ipsec_sa); - if ((opt && opt->frag_mode == ODP_IPSEC_FRAG_CHECK) || - (!opt && ipsec_sa->out.frag_mode == ODP_IPSEC_FRAG_CHECK)) + frag_mode = opt->flag.frag_mode ? opt->frag_mode : + ipsec_sa->out.frag_mode; + if (frag_mode == ODP_IPSEC_FRAG_CHECK) mtu = ipsec_sa->out.mtu; else mtu = UINT32_MAX; @@ -1467,6 +1469,8 @@ int odp_ipsec_in(const odp_packet_t pkt_in[], int num_in, return in_pkt; } +static odp_ipsec_out_opt_t default_out_opt; + int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in, odp_packet_t pkt_out[], int *num_out, const odp_ipsec_out_param_t *param) @@ -1495,7 +1499,7 @@ int odp_ipsec_out(const odp_packet_t pkt_in[], int num_in, ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); if (0 == param->num_opt) - opt = NULL; + opt = &default_out_opt; else opt = ¶m->opt[opt_idx]; @@ -1602,7 +1606,7 @@ int odp_ipsec_out_enq(const odp_packet_t pkt_in[], int num_in, ODP_ASSERT(ODP_IPSEC_SA_INVALID != sa); if (0 == param->num_opt) - opt = NULL; + opt = &default_out_opt; else opt = ¶m->opt[opt_idx]; @@ -1697,7 +1701,7 @@ int odp_ipsec_out_inline(const odp_packet_t pkt_in[], int num_in, } if (0 == param->num_opt) - opt = NULL; + opt = &default_out_opt; else opt = ¶m->opt[opt_idx]; @@ -1801,6 +1805,8 @@ int _odp_ipsec_init_global(void) { odp_ipsec_config_init(&ipsec_config); + memset(&default_out_opt, 0, sizeof(default_out_opt)); + return 0; } From patchwork Thu Mar 1 17:00:04 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: 130350 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3052637edc; Thu, 1 Mar 2018 09:08:57 -0800 (PST) X-Google-Smtp-Source: AG47ELuDXuPNcbR+JQPwirqcmZtMkc0xk8+iY2L7fn1IeZ5vLwFYlcjnS7WchyqVMRritJU5XyrI X-Received: by 2002:a25:4e07:: with SMTP id c7-v6mr1702732ybb.20.1519924137470; Thu, 01 Mar 2018 09:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519924137; cv=none; d=google.com; s=arc-20160816; b=CDxpM5NXiaptK7rLqodJCl3U1ygezK600e0IEUxmOPAxB/OGU41HhNV4otzAxtGgCk tbvc+PZrp4vWOECTHYaJ4i7A2HeD5QcRZnxFaf8o1T5Dj48SpXub3dE5Ly6NdoyRFLDl /+WqSJuHP5qltRdIteGcuFs4t6wB57UC/rhhcPIkA4BAUJpmTnZrNxwvWu4q9w5+WFdX N6lKF3JNjyzYPvO1hmrnaqwai6/K5qGdA+Nzyn6HRppu6E2aerDbdqQ1JiK4mIaJVsSw gNCDq2T9i3d37KpGD2zkZGcArJkKCAjsyUmxSYNzwjqcfNmWmiZGGtjJEETr2fpOf/Qz 1CHA== 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=0mitLQUOW4y2lD44mSgKqrqlKDsA6/JWmCr0bYNK8Fk=; b=qxAgqWDxXUgSk1I8QjF4Ga9ALolu9zhr6HDtrHC60OP4mIRyXtQ1bNtz9lr6J/57aB ddr7yt6exJdLwn45jsq1OPzBZKDmW/upuxNYQz90KL4VYyMX1m6fvqoXRNSqpk+/ZnUA YH8h/4Hi7Xvqlmq+FfVlijRDhm8L4OzNCmXSl06FYhhysfP9x+HGiSzIVSNkHUjbzSFE M8Scp3OjreVQaJ9PrTNU8H38iEw09DY5MRP/tVvDNWBno5fLEI+Lx3a/kFfmbwZOFY3l Vr7U8IbvbO02LaI977EFDF8zShsozyIPMtUcULudn4h9RPaNv8ipzQauKovH4X8CKH7c pZUA== 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 c128si719631ywe.179.2018.03.01.09.08.57; Thu, 01 Mar 2018 09:08:57 -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 22173617DD; Thu, 1 Mar 2018 17:08:57 +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 29D71617AD; Thu, 1 Mar 2018 17:01:19 +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 CDA506177D; Thu, 1 Mar 2018 17:00:29 +0000 (UTC) Received: from forward100o.mail.yandex.net (forward100o.mail.yandex.net [37.140.190.180]) by lists.linaro.org (Postfix) with ESMTPS id 718496176D for ; Thu, 1 Mar 2018 17:00:22 +0000 (UTC) Received: from mxback6o.mail.yandex.net (mxback6o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::20]) by forward100o.mail.yandex.net (Yandex) with ESMTP id 0CA572A227C0 for ; Thu, 1 Mar 2018 20:00:21 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback6o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iw7DGugdlz-0LJGLxss; Thu, 01 Mar 2018 20:00:21 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0JCqtju2; Thu, 01 Mar 2018 20: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: Thu, 1 Mar 2018 20:00:04 +0300 Message-Id: <1519923609-31634-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 8/13] linux-gen: packet: support L4 type No Next Header 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 Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ platform/linux-generic/include/odp/api/plat/packet_inline_types.h | 1 + platform/linux-generic/include/protocols/ip.h | 1 + platform/linux-generic/odp_packet.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h index 2e8efecb6..4b88d3517 100644 --- a/platform/linux-generic/include/odp/api/plat/packet_inline_types.h +++ b/platform/linux-generic/include/odp/api/plat/packet_inline_types.h @@ -90,6 +90,7 @@ typedef union { uint64_t tcp:1; /* TCP */ uint64_t sctp:1; /* SCTP */ uint64_t icmp:1; /* ICMP */ + uint64_t no_next_hdr:1; /* No Next Header */ uint64_t color:2; /* Packet color for traffic mgmt */ uint64_t nodrop:1; /* Drop eligibility status */ diff --git a/platform/linux-generic/include/protocols/ip.h b/platform/linux-generic/include/protocols/ip.h index f02980693..19aef3dcc 100644 --- a/platform/linux-generic/include/protocols/ip.h +++ b/platform/linux-generic/include/protocols/ip.h @@ -167,6 +167,7 @@ typedef struct ODP_PACKED { #define _ODP_IPPROTO_AH 0x33 /**< Authentication Header (51) */ #define _ODP_IPPROTO_ESP 0x32 /**< Encapsulating Security Payload (50) */ #define _ODP_IPPROTO_ICMPV6 0x3A /**< Internet Control Message Protocol (58) */ +#define _ODP_IPPROTO_NO_NEXT 0x3B /**< No Next Header (59) */ #define _ODP_IPPROTO_DEST 0x3C /**< IPv6 Destination header (60) */ #define _ODP_IPPROTO_SCTP 0x84 /**< Stream Control Transmission protocol (132) */ diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 35b9b59dc..462c8a4c7 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2225,6 +2225,10 @@ int packet_parse_common_l3_l4(packet_parser_t *prs, const uint8_t *parseptr, prs->input_flags.sctp = 1; break; + case _ODP_IPPROTO_NO_NEXT: + prs->input_flags.no_next_hdr = 1; + break; + default: prs->input_flags.l4 = 0; break; @@ -2530,6 +2534,8 @@ odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt) else if (pkt_hdr->p.input_flags.icmp && pkt_hdr->p.input_flags.ipv6) return ODP_PROTO_L4_TYPE_ICMPV6; + else if (pkt_hdr->p.input_flags.no_next_hdr) + return ODP_PROTO_L4_TYPE_NO_NEXT; return ODP_PROTO_L4_TYPE_NONE; } From patchwork Thu Mar 1 17:00:05 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: 130347 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3049043edc; Thu, 1 Mar 2018 09:05:53 -0800 (PST) X-Google-Smtp-Source: AG47ELvkVzxe+5YxTO82GaL4lvW65ipjdaxz+emNWRwBLB15gFYn/1kPNwgRFCfAXn2AQA22Venp X-Received: by 2002:a25:6f8a:: with SMTP id k132-v6mr1652930ybc.453.1519923952960; Thu, 01 Mar 2018 09:05:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519923952; cv=none; d=google.com; s=arc-20160816; b=cpuE5jGWc1RHLvIbv9NsKI6sVGxWg/06aZieKglRAfxIvLcdOqCDnuRy6I6eOf6iyc Dbejw2JR2Tuy+G245YX+Fi6xqrD0BPhoObbWTc/uxX/fqanW4cmYTK84Kn2s4IfM4Rim 4Hjj6Z8+H7CeeEbOFVA5YU1xZtFd3/CNOcdtWWbBmRjtjJW61HNftRuw3nOMrvZ8H/24 ConLNqi0YjAk9hxVHplRwmpV1un2jTBb+plMB7z2WtvN4k4lVFSffeBYBu22qLWHbI2n tJ2OPmzgcS6suEjGfinDJ4O7wiswBu2AnTbBIRVchCdT/BIYgAgOAonOK6b6kiHUIxkI 2ltg== 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=qWBvFuVCZYPcT29rOX9ZMTUHYO6IHO1o+tWzHrt70zc=; b=x53DdVs9TRhLqaGmkD09AwU34BahGyc6mDtMNRrlqz9FLZeWciqGo7X5u6B971FTRr 169tGBomKkwOF4/WpTCMNh6V82YgoSO1Ow9iDGF96QnM/ZASijQbFqZEK90tASufWKkk 5C1Ws+uyWRv//Z8u56rlSti/yDU7vLQBZduVMMcjEY1C1ScN6P1Ru7jRcWkRSGGdVP8r gzo6tLODx89iH4Sx/IpX/lCkmPbCf0Q+YRvWoM/zcLI5aw6/+z5iP2f5AxmVpRU6KvKM noObU+aqKhDd4dGpalK6OIXd/rKPxG9nRBeoJsM0057QDPHS5FPickXAFqQG3CmoMcm7 0fTQ== 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 d80-v6si157720ybh.536.2018.03.01.09.05.52; Thu, 01 Mar 2018 09:05: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 7D61C6150F; Thu, 1 Mar 2018 17:05:52 +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 2F500617B1; Thu, 1 Mar 2018 17:01:08 +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 CD2B061789; Thu, 1 Mar 2018 17:00:27 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 0B6C5607B9 for ; Thu, 1 Mar 2018 17:00:24 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward100j.mail.yandex.net (Yandex) with ESMTP id A5B055D8191B for ; Thu, 1 Mar 2018 20:00:22 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id AkjQFqthQe-0M4SOmg1; Thu, 01 Mar 2018 20:00:22 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0LCCf52X; Thu, 01 Mar 2018 20: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, 1 Mar 2018 20:00:05 +0300 Message-Id: <1519923609-31634-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 9/13] validation: ipsec: add L3/L4 types 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 Signed-off-by: Dmitry Eremin-Solenikov Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ test/validation/api/ipsec/ipsec.c | 8 +++ test/validation/api/ipsec/ipsec.h | 5 ++ test/validation/api/ipsec/ipsec_test_in.c | 85 ++++++++++++++++++++++++++++++ test/validation/api/ipsec/ipsec_test_out.c | 10 ++++ 4 files changed, 108 insertions(+) diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index cdaf04f5c..21eaf17b8 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -689,6 +689,14 @@ void ipsec_check_in_one(const ipsec_test_part *part, odp_ipsec_sa_t sa) } ipsec_check_packet(part->out[i].pkt_out, pkto[i]); + if (part->out[i].pkt_out != NULL && + part->out[i].l3_type != _ODP_PROTO_L3_TYPE_UNDEF) + CU_ASSERT_EQUAL(part->out[i].l3_type, + odp_packet_l3_type(pkto[i])); + if (part->out[i].pkt_out != NULL && + part->out[i].l4_type != _ODP_PROTO_L4_TYPE_UNDEF) + CU_ASSERT_EQUAL(part->out[i].l4_type, + odp_packet_l4_type(pkto[i])); odp_packet_free(pkto[i]); } } diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h index 7ba9ef10e..b2d6df698 100644 --- a/test/validation/api/ipsec/ipsec.h +++ b/test/validation/api/ipsec/ipsec.h @@ -42,6 +42,9 @@ typedef struct { uint8_t data[256]; } ipsec_test_packet; +#define _ODP_PROTO_L3_TYPE_UNDEF ((odp_proto_l3_type_t)-1) +#define _ODP_PROTO_L4_TYPE_UNDEF ((odp_proto_l4_type_t)-1) + typedef struct { const ipsec_test_packet *pkt_in; odp_bool_t lookup; @@ -51,6 +54,8 @@ typedef struct { struct { odp_ipsec_op_status_t status; const ipsec_test_packet *pkt_out; + odp_proto_l3_type_t l3_type; + odp_proto_l4_type_t l4_type; } out[1]; } ipsec_test_part; diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c index 8138defb5..d02cb2438 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/test/validation/api/ipsec/ipsec_test_in.c @@ -31,6 +31,8 @@ static void test_in_ipv4_ah_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -62,6 +64,8 @@ static void test_in_ipv4_ah_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -93,6 +97,8 @@ static void test_in_ipv4_ah_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -123,6 +129,9 @@ static void test_in_ipv4_ah_sha256_tun_ipv4_notun(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + /* It is L4_TYPE_IPV4 */ + .l4_type = _ODP_PROTO_L4_TYPE_UNDEF, .pkt_out = &pkt_ipv4_icmp_0_ipip }, }, }; @@ -153,6 +162,8 @@ static void test_in_ipv4_esp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -183,6 +194,8 @@ static void test_in_ipv4_esp_aes_cbc_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -213,6 +226,8 @@ static void test_in_ipv4_esp_aes_cbc_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -243,6 +258,8 @@ static void test_in_ipv4_esp_aes_ctr_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -274,6 +291,8 @@ static void test_in_ipv4_ah_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -305,6 +324,8 @@ static void test_in_ipv4_esp_null_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -336,6 +357,8 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -367,6 +390,8 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -398,6 +423,8 @@ static void test_in_ipv4_esp_udp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -430,6 +457,8 @@ static void test_in_ipv4_esp_udp_null_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -461,6 +490,8 @@ static void test_in_ipv4_ah_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -471,6 +502,8 @@ static void test_in_ipv4_ah_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -505,6 +538,8 @@ static void test_in_ipv4_ah_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -525,6 +560,8 @@ static void test_in_ipv4_ah_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -559,6 +596,8 @@ static void test_in_ipv4_esp_null_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -569,6 +608,8 @@ static void test_in_ipv4_esp_null_sha256_noreplay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -603,6 +644,8 @@ static void test_in_ipv4_esp_null_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -623,6 +666,8 @@ static void test_in_ipv4_esp_null_sha256_replay(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -878,6 +923,8 @@ static void test_in_ipv4_rfc3602_5_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_5 }, }, }; @@ -908,6 +955,8 @@ static void test_in_ipv4_rfc3602_6_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_6 }, }, }; @@ -939,6 +988,8 @@ static void test_in_ipv4_rfc3602_7_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_7 }, }, }; @@ -970,6 +1021,8 @@ static void test_in_ipv4_rfc3602_8_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_rfc3602_8 }, }, }; @@ -1001,6 +1054,8 @@ static void test_in_ipv4_mcgrew_gcm_2_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_UDP, .pkt_out = &pkt_mcgrew_gcm_test_2}, }, }; @@ -1032,6 +1087,8 @@ static void test_in_ipv4_mcgrew_gcm_3_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = _ODP_PROTO_L4_TYPE_UNDEF, .pkt_out = &pkt_mcgrew_gcm_test_3}, }, }; @@ -1063,6 +1120,8 @@ static void test_in_ipv4_mcgrew_gcm_4_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_mcgrew_gcm_test_4}, }, }; @@ -1095,6 +1154,8 @@ static void test_in_ipv4_mcgrew_gcm_12_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_NONE, + .l4_type = _ODP_PROTO_L4_TYPE_UNDEF, .pkt_out = &pkt_mcgrew_gcm_test_12}, }, }; @@ -1127,6 +1188,8 @@ static void test_in_ipv4_mcgrew_gcm_15_esp(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_mcgrew_gcm_test_15}, }, }; @@ -1158,6 +1221,8 @@ static void test_in_ipv4_rfc7634_chacha(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_rfc7634}, }, }; @@ -1188,6 +1253,8 @@ static void test_in_ipv4_ah_aes_gmac_128(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -1218,6 +1285,8 @@ static void test_in_ipv4_esp_null_aes_gmac_128(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -1248,6 +1317,8 @@ static void test_in_ipv6_ah_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1279,6 +1350,8 @@ static void test_in_ipv6_ah_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1310,6 +1383,8 @@ static void test_in_ipv6_ah_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1340,6 +1415,8 @@ static void test_in_ipv6_esp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1371,6 +1448,8 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv4(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1402,6 +1481,8 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv6(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1433,6 +1514,8 @@ static void test_in_ipv6_esp_udp_null_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; @@ -1465,6 +1548,8 @@ static void test_in_ipv6_esp_udp_null_sha256_lookup(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV6, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV6, .pkt_out = &pkt_ipv6_icmp_0 }, }, }; diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index 911987388..3db553b60 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -273,6 +273,8 @@ static void test_out_ipv4_esp_aes_cbc_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -346,6 +348,8 @@ static void test_out_ipv4_esp_aes_cbc_sha256(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -388,6 +392,8 @@ static void test_out_ipv4_esp_aes_ctr_null(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -430,6 +436,8 @@ static void test_out_ipv4_esp_aes_gcm128(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; @@ -532,6 +540,8 @@ static void test_out_ipv4_esp_chacha20_poly1305(void) .out = { { .status.warn.all = 0, .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_ICMPV4, .pkt_out = &pkt_ipv4_icmp_0 }, }, }; From patchwork Thu Mar 1 17:00:06 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: 130352 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3054557edc; Thu, 1 Mar 2018 09:10:34 -0800 (PST) X-Google-Smtp-Source: AG47ELsFrqkigi4W8MnJKxz1JDjpgatGw9EsWH2HYn0SGirvT7hWLKoJi5okdh2Ojj9jzgGB6mb+ X-Received: by 10.200.18.203 with SMTP id b11mr4082450qtj.55.1519924234493; Thu, 01 Mar 2018 09:10:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519924234; cv=none; d=google.com; s=arc-20160816; b=HIX1pE+YUzuI+PdG88L28Cg68NuTtDMA5vZBYf/G0W2U105ZYtE7sXPrrhwB6YUFHV sxAl0f14GxrKFH8KN+TZ1C1+X1/u5BUZNg0bEJ8BBokiyRoLjjxKLv2gmOoCNq4VvapB evxsJ08sF3IrXu0IamPc2erSMZCb9lU5eHRK1jQ8c1tBr9GsBp0uOJq8j8oKcgXg5PdB zFYpkGh2HENlDx1L2IcjQyYhdIL2nTFkYxdR0mSG2ibxkWzXIube7FppfxpwPveRylzk oFLTfDxbSQ7937U/PUi8MDips7jfkyaSOktByqcrzCRL4ycnrxQpvdeaLBpMRrB9xQEm CwQw== 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=6+AnycTTX5YwQvO8hvVNHz4jblsiNjdgTEdCDeAWIiw=; b=RG8Ut+PIHW+/lqXUM2qrTdC79XLZqEittGZb5viuUmPUXAJ8DHXFhTYn+wBrTBPFhT mOAh32ENZZjuloBstPaaus13jkrrTs2Tu4+JqI3CGuHe4bYdHaaON7up/uyQxC+IhAwP +STwTLS/acWglDeHDdp8EmRsNbc66snn8p/kew9FeditdG++w394Ea8bWLbAHWsrnTMB g2aP1c1fcD7uxTN2AUsJD5ZlDh74Onynx0AgtADGcySDkHe4Hpmc/za5+GBB7Nk0B9vo ImxllxAwfsLougDGXgUl4v/wyqNR1CSSIJ9KxgHKZDqoN9HY2V89HoaSf8ql2BbaKjoq DzEw== 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 o126si4667044qkf.145.2018.03.01.09.10.34; Thu, 01 Mar 2018 09:10:34 -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 12FEF60853; Thu, 1 Mar 2018 17:10:34 +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 B3711617E6; Thu, 1 Mar 2018 17:01: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 16CD661789; Thu, 1 Mar 2018 17:00:32 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id 72BC8616FC for ; Thu, 1 Mar 2018 17:00:24 +0000 (UTC) Received: from mxback9o.mail.yandex.net (mxback9o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::23]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 6AD9D5D82141 for ; Thu, 1 Mar 2018 20:00:23 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback9o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hs0xwhFmki-0NwSwj0w; Thu, 01 Mar 2018 20:00:23 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0MCim2Gg; Thu, 01 Mar 2018 20:00:22 +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, 1 Mar 2018 20:00:06 +0300 Message-Id: <1519923609-31634-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 10/13] linux-gen: ipsec: separate ipv4/ipv6 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 Signed-off-by: Dmitry Eremin-Solenikov Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ platform/linux-generic/odp_ipsec.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 3c9d88cc6..80362672d 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -269,6 +269,7 @@ typedef struct { uint16_t ip_next_hdr_offset; uint8_t ip_next_hdr; unsigned is_ipv4 : 1; + unsigned is_ipv6 : 1; union { struct { uint32_t ip_flabel; @@ -669,10 +670,13 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, * state.is_ipv4 = odp_packet_has_ipv4(pkt); */ state.is_ipv4 = (((uint8_t *)state.ip)[0] >> 4) == 0x4; + state.is_ipv6 = (((uint8_t *)state.ip)[0] >> 4) == 0x6; if (state.is_ipv4) rc = ipsec_parse_ipv4(&state, pkt); - else + else if (state.is_ipv6) rc = ipsec_parse_ipv6(&state, pkt); + else + rc = -1; if (rc < 0 || state.ip_tot_len + state.ip_offset > odp_packet_len(pkt)) { status->error.alg = 1; @@ -776,8 +780,10 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, state.ip_tot_len -= state.ip_hdr_len + state.in.hdr_len; if (_ODP_IPPROTO_IPIP == state.ip_next_hdr) { state.is_ipv4 = 1; + state.is_ipv6 = 0; } else if (_ODP_IPPROTO_IPV6 == state.ip_next_hdr) { state.is_ipv4 = 0; + state.is_ipv6 = 1; } else { status->error.proto = 1; goto err; @@ -802,7 +808,7 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, else ipv4hdr->ttl -= ipsec_sa->dec_ttl; _odp_ipv4_csum_update(pkt); - } else if (!state.is_ipv4 && odp_packet_len(pkt) > _ODP_IPV6HDR_LEN) { + } else if (state.is_ipv6 && odp_packet_len(pkt) > _ODP_IPV6HDR_LEN) { _odp_ipv6hdr_t *ipv6hdr = odp_packet_l3_ptr(pkt, NULL); if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode) @@ -816,9 +822,9 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, goto err; } - parse_param.proto = state.is_ipv4 ? - ODP_PROTO_IPV4 : - ODP_PROTO_IPV6; + parse_param.proto = state.is_ipv4 ? ODP_PROTO_IPV4 : + state.is_ipv6 ? ODP_PROTO_IPV6 : + ODP_PROTO_NONE; parse_param.last_layer = ipsec_config.inbound.parse_level; parse_param.chksums = ipsec_config.inbound.chksums; @@ -934,6 +940,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, _ODP_IPV4HDR_PROTO_OFFSET; state->is_ipv4 = 1; + state->is_ipv6 = 0; return 0; } @@ -990,6 +997,7 @@ static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, state->ip_next_hdr_offset = state->ip_offset + _ODP_IPV6HDR_NHDR_OFFSET; state->is_ipv4 = 0; + state->is_ipv6 = 1; return 0; } @@ -1319,20 +1327,25 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, memset(¶m, 0, sizeof(param)); state.is_ipv4 = (((uint8_t *)state.ip)[0] >> 4) == 0x4; + state.is_ipv6 = (((uint8_t *)state.ip)[0] >> 4) == 0x6; if (ODP_IPSEC_MODE_TRANSPORT == ipsec_sa->mode) { if (state.is_ipv4) rc = ipsec_parse_ipv4(&state, pkt); - else + else if (state.is_ipv6) rc = ipsec_parse_ipv6(&state, pkt); + else + rc = -1; if (state.ip_tot_len + state.ip_offset != odp_packet_len(pkt)) rc = -1; } else { if (state.is_ipv4) rc = ipsec_out_tunnel_parse_ipv4(&state, ipsec_sa); - else + else if (state.is_ipv6) rc = ipsec_out_tunnel_parse_ipv6(&state, ipsec_sa); + else + rc = -1; if (rc < 0) { status->error.alg = 1; goto err; From patchwork Thu Mar 1 17: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: 130348 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3050594edc; Thu, 1 Mar 2018 09:07:14 -0800 (PST) X-Google-Smtp-Source: AG47ELtueZ7PnuPJbBQeIYCRIXL9jkVOGRkMrkU25V20+rQkuNlxled9i9a//5PHQnnLFbzxFoPX X-Received: by 10.129.119.196 with SMTP id s187mr1742782ywc.429.1519924034830; Thu, 01 Mar 2018 09:07:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519924034; cv=none; d=google.com; s=arc-20160816; b=zxji9LmfPb0JbovDSbirivEJChjrfm6CAQ2rBc6zkhiwFDQw0h12NCa3ur42IlQxPx dS3zMdOweWjqE2c+KEIIYy638sfE8lbzC/6Jtgpsl6hT07Pq8acHDKR9iyxVx1Q7fIU4 ufcnc15icEswKFTRc7K1sCaCDBKL0w53G48uCF6dYK5QDCAFJiEEXvmC2DSvG79VglUL 4ewd2BRzy7igTH/nynsfwomd16AjisL4d12iGKFc2/dUrrpijhB+LrWyzR5RwD9Loztc HWEU0pN7v/dT9icD8aM2QZMqEFdHkgGbGGxJRUgtZ8dnOHhSH+ZbWZwIWTMx4h4mWZI6 L6aQ== 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=zBr5sDORjJLLCvmg7HxXcWSwjshkep9GAJRc88z+0fo=; b=oSpbTx2xGPg0JiwfxBt0fKTklyfjpfpebAnI37/QjB+w2Nr57t1gqsG0HEGCtg55wq RR8xYuYOELEd0tRJO4Env2GCsOxQDd0leapsxFsD2R19Y9DMslf+AyU2Qhn/kZ/Htm3a DjbElkhY80LEBLQyhdU9tau1ZU3MB5Ozik7rnyje/99aUjg1M8i+3vlJw1ho8D/y00Po 4LOV25PJLNmpTyXZLGyCmF4E33/mPcbwwZOphOeKIu1LiPEEJIuItavh790V7YuZVMyI 54wlqgIHbcZyNat/44wm8hrSLFFSIIVHJBjvVJQZnmoqtfa3Uw2Dh/NSjVp0nM5tEKhK AZsA== 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 w9-v6si251311ybe.191.2018.03.01.09.07.14; Thu, 01 Mar 2018 09:07:14 -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 6649F617D0; Thu, 1 Mar 2018 17:07:14 +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 6B9E5617D2; Thu, 1 Mar 2018 17:01:13 +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 76F9A61789; Thu, 1 Mar 2018 17:00:28 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id AF65E6177B for ; Thu, 1 Mar 2018 17:00:25 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 6E5B22D848AC for ; Thu, 1 Mar 2018 20:00:24 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DVb2n1ecbW-0OlurP4X; Thu, 01 Mar 2018 20:00:24 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0NCW6lVD; Thu, 01 Mar 2018 20: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, 1 Mar 2018 20:00:07 +0300 Message-Id: <1519923609-31634-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 11/13] linux-gen: ipsec: take output ip_param into account 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 Allow per-packet override of IP parameters. Signed-off-by: Dmitry Eremin-Solenikov Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ .../linux-generic/include/odp_ipsec_internal.h | 9 ++--- platform/linux-generic/odp_ipsec.c | 38 ++++++++++++++-------- platform/linux-generic/odp_ipsec_sad.c | 20 ++++++++---- 3 files changed, 40 insertions(+), 27 deletions(-) diff --git a/platform/linux-generic/include/odp_ipsec_internal.h b/platform/linux-generic/include/odp_ipsec_internal.h index a449462ab..dfde4d574 100644 --- a/platform/linux-generic/include/odp_ipsec_internal.h +++ b/platform/linux-generic/include/odp_ipsec_internal.h @@ -161,22 +161,17 @@ struct ipsec_sa_s { union { struct { + odp_ipsec_ipv4_param_t param; odp_u32be_t src_ip; odp_u32be_t dst_ip; /* 32-bit from which low 16 are used */ odp_atomic_u32_t hdr_id; - - uint8_t ttl; - uint8_t dscp; - uint8_t df; } tun_ipv4; struct { + odp_ipsec_ipv6_param_t param; uint8_t src_ip[_ODP_IPV6ADDR_LEN]; uint8_t dst_ip[_ODP_IPV6ADDR_LEN]; - uint8_t hlimit; - uint8_t dscp; - uint32_t flabel; } tun_ipv6; }; } out; diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 80362672d..9d13e60ca 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -888,7 +888,8 @@ static int ipsec_out_tunnel_parse_ipv6(ipsec_state_t *state, static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, ipsec_state_t *state, - ipsec_sa_t *ipsec_sa) + ipsec_sa_t *ipsec_sa, + const odp_ipsec_ipv4_param_t *ipv4_param) { _odp_ipv4hdr_t out_ip; uint16_t flags; @@ -899,7 +900,7 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, else out_ip.tos = (state->out_tunnel.ip_tos & ~_ODP_IP_TOS_DSCP_MASK) | - (ipsec_sa->out.tun_ipv4.dscp << + (ipv4_param->dscp << _ODP_IP_TOS_DSCP_SHIFT); state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset; state->ip_tot_len += _ODP_IPV4HDR_LEN; @@ -911,13 +912,15 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, if (ipsec_sa->copy_df) flags = state->out_tunnel.ip_df; else - flags = ((uint16_t)ipsec_sa->out.tun_ipv4.df) << 14; + flags = ((uint16_t)ipv4_param->df) << 14; out_ip.frag_offset = _odp_cpu_to_be_16(flags); - out_ip.ttl = ipsec_sa->out.tun_ipv4.ttl; + out_ip.ttl = ipv4_param->ttl; /* Will be filled later by packet checksum update */ out_ip.chksum = 0; - out_ip.src_addr = ipsec_sa->out.tun_ipv4.src_ip; - out_ip.dst_addr = ipsec_sa->out.tun_ipv4.dst_ip; + memcpy(&out_ip.src_addr, ipv4_param->src_addr, + _ODP_IPV4ADDR_LEN); + memcpy(&out_ip.dst_addr, ipv4_param->dst_addr, + _ODP_IPV4ADDR_LEN); if (odp_packet_extend_head(pkt, _ODP_IPV4HDR_LEN, NULL, NULL) < 0) @@ -947,7 +950,8 @@ static int ipsec_out_tunnel_ipv4(odp_packet_t *pkt, static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, ipsec_state_t *state, - ipsec_sa_t *ipsec_sa) + ipsec_sa_t *ipsec_sa, + const odp_ipsec_ipv6_param_t *ipv6_param) { _odp_ipv6hdr_t out_ip; uint32_t ver; @@ -958,23 +962,23 @@ static int ipsec_out_tunnel_ipv6(odp_packet_t *pkt, else ver |= ((state->out_tunnel.ip_tos & ~_ODP_IP_TOS_DSCP_MASK) | - (ipsec_sa->out.tun_ipv6.dscp << + (ipv6_param->dscp << _ODP_IP_TOS_DSCP_SHIFT)) << _ODP_IPV6HDR_TC_SHIFT; if (ipsec_sa->copy_flabel) ver |= state->out_tunnel.ip_flabel; else - ver |= ipsec_sa->out.tun_ipv6.flabel; + ver |= ipv6_param->flabel; out_ip.ver_tc_flow = odp_cpu_to_be_32(ver); state->ip_tot_len = odp_packet_len(*pkt) - state->ip_offset; out_ip.payload_len = _odp_cpu_to_be_16(state->ip_tot_len); state->ip_tot_len += _ODP_IPV6HDR_LEN; - out_ip.hop_limit = ipsec_sa->out.tun_ipv6.hlimit; - memcpy(&out_ip.src_addr, ipsec_sa->out.tun_ipv6.src_ip, + out_ip.hop_limit = ipv6_param->hlimit; + memcpy(&out_ip.src_addr, ipv6_param->src_addr, _ODP_IPV6ADDR_LEN); - memcpy(&out_ip.dst_addr, ipsec_sa->out.tun_ipv6.dst_ip, + memcpy(&out_ip.dst_addr, ipv6_param->dst_addr, _ODP_IPV6ADDR_LEN); if (odp_packet_extend_head(pkt, _ODP_IPV6HDR_LEN, @@ -1352,9 +1356,15 @@ static ipsec_sa_t *ipsec_out_single(odp_packet_t pkt, } if (ipsec_sa->tun_ipv4) - rc = ipsec_out_tunnel_ipv4(&pkt, &state, ipsec_sa); + rc = ipsec_out_tunnel_ipv4(&pkt, &state, ipsec_sa, + opt->flag.ip_param ? + &opt->ipv4 : + &ipsec_sa->out.tun_ipv4.param); else - rc = ipsec_out_tunnel_ipv6(&pkt, &state, ipsec_sa); + rc = ipsec_out_tunnel_ipv6(&pkt, &state, ipsec_sa, + opt->flag.ip_param ? + &opt->ipv6 : + &ipsec_sa->out.tun_ipv6.param); } if (rc < 0) { status->error.alg = 1; diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index 3ac8c49c3..05865eb3a 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -326,11 +326,15 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) param->outbound.tunnel.ipv4.dst_addr, sizeof(ipsec_sa->out.tun_ipv4.dst_ip)); odp_atomic_init_u32(&ipsec_sa->out.tun_ipv4.hdr_id, 0); - ipsec_sa->out.tun_ipv4.ttl = + ipsec_sa->out.tun_ipv4.param.src_addr = + &ipsec_sa->out.tun_ipv4.src_ip; + ipsec_sa->out.tun_ipv4.param.dst_addr = + &ipsec_sa->out.tun_ipv4.dst_ip; + ipsec_sa->out.tun_ipv4.param.ttl = param->outbound.tunnel.ipv4.ttl; - ipsec_sa->out.tun_ipv4.dscp = + ipsec_sa->out.tun_ipv4.param.dscp = param->outbound.tunnel.ipv4.dscp; - ipsec_sa->out.tun_ipv4.df = + ipsec_sa->out.tun_ipv4.param.df = param->outbound.tunnel.ipv4.df; } else { ipsec_sa->tun_ipv4 = 0; @@ -340,11 +344,15 @@ odp_ipsec_sa_t odp_ipsec_sa_create(const odp_ipsec_sa_param_t *param) memcpy(&ipsec_sa->out.tun_ipv6.dst_ip, param->outbound.tunnel.ipv6.dst_addr, sizeof(ipsec_sa->out.tun_ipv6.dst_ip)); - ipsec_sa->out.tun_ipv6.hlimit = + ipsec_sa->out.tun_ipv4.param.src_addr = + &ipsec_sa->out.tun_ipv6.src_ip; + ipsec_sa->out.tun_ipv4.param.dst_addr = + &ipsec_sa->out.tun_ipv6.dst_ip; + ipsec_sa->out.tun_ipv6.param.hlimit = param->outbound.tunnel.ipv6.hlimit; - ipsec_sa->out.tun_ipv6.dscp = + ipsec_sa->out.tun_ipv6.param.dscp = param->outbound.tunnel.ipv6.dscp; - ipsec_sa->out.tun_ipv6.flabel = + ipsec_sa->out.tun_ipv6.param.flabel = param->outbound.tunnel.ipv6.flabel; } } From patchwork Thu Mar 1 17: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: 130349 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3051762edc; Thu, 1 Mar 2018 09:08:15 -0800 (PST) X-Google-Smtp-Source: AG47ELsD2NDkjScJYqNJ4ZS5lNJrHOFaKSOYFicpi0y4MfSp7eB3bqjILNE29GwrsJgEpknwHyW6 X-Received: by 2002:a25:c514:: with SMTP id v20-v6mr1661661ybe.405.1519924094960; Thu, 01 Mar 2018 09:08:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519924094; cv=none; d=google.com; s=arc-20160816; b=iKFa3M0V4wLqrA3hPnh5G3ojNfy4xBXhPzg/zUVpLAPf7UZpyf9y2OgLeKYhYk+Jk1 ijog8pT7kX2RzzlMsuYD7bje9gp8pY1U7HWA7gd8PCOWauk+gAXtZF8ZkQP3y808cbBb Ex3ixrBXjMUFLs2zuKjhY4U5DDT/ku3p+hebpusJth96jdVFRSl/UAIww+YOCm4RCq+q Y4LQi+2h2FBLi705MTirTbItlZqPgO6ByXLxNfTYbaAUsD8e6+bjgT4z95wWjcNzvI4s grisKUOHkEuClXTFY6kRx8pJPvcAkX00zyfAHYtdzfTB01Fh7IO4y4ErCKX3UHloWYTg yjng== 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=6zPVKvk87RNIf8z52MvAkbqQpDEUgXnNFFAdHq4fCr8=; b=NZmo9V7Ovaf+yvgn6LmRC4dBy6ECT7whkLVfZgB60bmtdRQabMXUTHZSj9BLps17tl r52SXDkTNYNzKwyq8Z97RNHTY1t+Dqz/aO3Fjekyd8SPS9HuMmsz5oteA4DMGVzLzlFb 44AfrxZ4ROcpDFStX/mES+4BzXQLFpM6qtWCI6rxTrx/OXUk3LIF5XP8GhCXTeiU3MB6 8DF8bE1lRv39N9OK9Q5UmSS8CO5cUTJRqpsUURN0iPi5p+nbJ1NxEQ0HsP8I03PxtP9U nnPVjcQgskvIhnV8YdYeydyXMs40TcCLkfsKNWLoHNONJY1nRMwdVD44yc89m3EHGQ+c RPlg== 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 i201si720725ywe.676.2018.03.01.09.08.14; Thu, 01 Mar 2018 09:08:14 -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 9E7E362781; Thu, 1 Mar 2018 17:08:14 +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 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 C7BE2617CC; Thu, 1 Mar 2018 17:01:15 +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 0EE556177D; Thu, 1 Mar 2018 17:00:29 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id AE6C86177D for ; Thu, 1 Mar 2018 17:00:26 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward103o.mail.yandex.net (Yandex) with ESMTP id 998F15884739 for ; Thu, 1 Mar 2018 20:00:25 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id lxqCCzZYOk-0P4K48j0; Thu, 01 Mar 2018 20:00:25 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0OCSU1V4; Thu, 01 Mar 2018 20: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, 1 Mar 2018 20:00:08 +0300 Message-Id: <1519923609-31634-13-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 12/13] linux-gen: ipsec: support inbound TFC dummy packets 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 Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ platform/linux-generic/odp_ipsec.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 9d13e60ca..fb852e70e 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -651,7 +651,6 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, odp_crypto_packet_op_param_t param; int rc; odp_crypto_packet_result_t crypto; /**< Crypto operation result */ - odp_packet_parse_param_t parse_param; odp_packet_hdr_t *pkt_hdr; state.ip_offset = odp_packet_l3_offset(pkt); @@ -784,6 +783,9 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, } else if (_ODP_IPPROTO_IPV6 == state.ip_next_hdr) { state.is_ipv4 = 0; state.is_ipv6 = 1; + } else if (_ODP_IPPROTO_NO_NEXT == state.ip_next_hdr) { + state.is_ipv4 = 0; + state.is_ipv6 = 0; } else { status->error.proto = 1; goto err; @@ -817,20 +819,30 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, _ODP_IPV6HDR_LEN); else ipv6hdr->hop_limit -= ipsec_sa->dec_ttl; - } else { + } else if (state.ip_next_hdr != _ODP_IPPROTO_NO_NEXT) { status->error.proto = 1; goto err; } - parse_param.proto = state.is_ipv4 ? ODP_PROTO_IPV4 : - state.is_ipv6 ? ODP_PROTO_IPV6 : - ODP_PROTO_NONE; - parse_param.last_layer = ipsec_config.inbound.parse_level; - parse_param.chksums = ipsec_config.inbound.chksums; + if (_ODP_IPPROTO_NO_NEXT == state.ip_next_hdr && + ODP_IPSEC_MODE_TUNNEL == ipsec_sa->mode) { + odp_packet_hdr_t *pkt_hdr = packet_hdr(pkt); - /* We do not care about return code here. - * Parsing error should not result in IPsec error. */ - odp_packet_parse(pkt, state.ip_offset, &parse_param); + packet_parse_reset(pkt_hdr); + pkt_hdr->p.l3_offset = state.ip_offset; + } else { + odp_packet_parse_param_t parse_param; + + parse_param.proto = state.is_ipv4 ? ODP_PROTO_IPV4 : + state.is_ipv6 ? ODP_PROTO_IPV6 : + ODP_PROTO_NONE; + parse_param.last_layer = ipsec_config.inbound.parse_level; + parse_param.chksums = ipsec_config.inbound.chksums; + + /* We do not care about return code here. + * Parsing error should not result in IPsec error. */ + odp_packet_parse(pkt, state.ip_offset, &parse_param); + } *pkt_out = pkt; From patchwork Thu Mar 1 17: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: 130351 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3053489edc; Thu, 1 Mar 2018 09:09:40 -0800 (PST) X-Google-Smtp-Source: AG47ELsZrBssP+EFIwvR2k8g59XXqRyEhR8eFM3/t0ADAvnMGk2JOaP4i+aFjJmDVbdXmp1bFoDk X-Received: by 10.129.181.68 with SMTP id c4mr1733007ywk.338.1519924180298; Thu, 01 Mar 2018 09:09:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519924180; cv=none; d=google.com; s=arc-20160816; b=Y9cdYT8jVWywFYlFmQ7uOC8MTfiSSDKyqnTVE46sDFVCST54QYD64tss1PYJJq8PAZ jf51i3PZ/j69d84EUX3fPLAAcwX0Tmv/+qVejj3W3oiwYRz4d/eI8wcO0pH1z1lnPlNd TxiFtlJAzAkNrbnikD52eFeDmf8FDYcl7t/oG7hFE7l7RPqk8ANx6/EvVGGd46Gt1+G0 +LQH3grNKjQO5j0g2wEcfeFpISDysPEri4ZKYxMIOFUVLN1Mh7t03uZXWvH7VXp96mNF SVbXUxXHFiJwmoVNWLwx3LNW9q60ylsIIi3bMWTqxNBUssfpkTRxgUsT+I2b2ASW1D6p PiCA== 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=k5fX/mm9a9tZEseVls0Bk0SvM0gX8Q9nD/v0roH2urA=; b=baXTfOODD2ymc5UEjLFXl9r8i44AfLgHmIwQynfSRKheI7QWNr7ZKDQjHVUacqINTa K74B9hAzxdW305IH7og0HvV60oZgIU7xwIeJ8boJ0z+CHQGiq/NmP7mQsUQyaisLplIK PFsGRrMGzUfa7GR/YsLxBbaXtdoyR05pYLkvm1XwcfUqhnzpOGYJKVU1gOY2BhDPWPay 67W0Ax/dFyXSXHMv8AGwgOnzGZYHfXKkGpUOifUbV+0HimIxHoGk4b7yk8d8XT6C8LiH Teqnp76Ai+vBwPmH+oXsc9LGlB3bAxJwjrvCk7D29VRHCdCSrSQBRiHOsnVYzMsIpLob 77dg== 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 g185si715443ywh.477.2018.03.01.09.09.40; Thu, 01 Mar 2018 09:09:40 -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 E5C0362789; Thu, 1 Mar 2018 17:09:39 +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 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 6BF7B6177B; Thu, 1 Mar 2018 17:01:24 +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 2C91661790; Thu, 1 Mar 2018 17:00:31 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id F3D1B607B9 for ; Thu, 1 Mar 2018 17:00:27 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward102p.mail.yandex.net (Yandex) with ESMTP id A9A524301AD5 for ; Thu, 1 Mar 2018 20:00:26 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id R5MiJGY34P-0Q8qokML; Thu, 01 Mar 2018 20:00:26 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 7MkXJ9JJAA-0PCiFVLx; Thu, 01 Mar 2018 20: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: Thu, 1 Mar 2018 20:00:09 +0300 Message-Id: <1519923609-31634-14-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> References: <1519923609-31634-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v1 13/13] validation: ipsec: inbound TFC dummy packets check 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 Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a **/ test/validation/api/ipsec/ipsec_test_in.c | 43 ++++++++++++++++++++++++++++--- test/validation/api/ipsec/test_vectors.h | 19 +++++++++++++- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c index d02cb2438..9c1112004 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/test/validation/api/ipsec/ipsec_test_in.c @@ -1131,13 +1131,17 @@ static void test_in_ipv4_mcgrew_gcm_4_esp(void) ipsec_sa_destroy(sa); } -#if 0 static void test_in_ipv4_mcgrew_gcm_12_esp(void) { odp_ipsec_tunnel_param_t tunnel = {}; odp_ipsec_sa_param_t param; odp_ipsec_sa_t sa; + /* This test will not work properly inbound inline mode. + * Packet might be dropped and we will not check for that. */ + if (suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_INLINE) + return; + ipsec_sa_param_fill(¶m, true, false, 0x335467ae, &tunnel, ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12, @@ -1164,7 +1168,38 @@ static void test_in_ipv4_mcgrew_gcm_12_esp(void) ipsec_sa_destroy(sa); } -#endif + +static void test_in_ipv4_mcgrew_gcm_12_esp_notun(void) +{ + odp_ipsec_sa_param_t param; + odp_ipsec_sa_t sa; + + ipsec_sa_param_fill(¶m, + true, false, 0x335467ae, NULL, + ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12, + ODP_AUTH_ALG_AES_GCM, NULL, + &key_mcgrew_gcm_salt_12); + + sa = odp_ipsec_sa_create(¶m); + + CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa); + + ipsec_test_part test = { + .pkt_in = &pkt_mcgrew_gcm_test_12_esp, + .out_pkt = 1, + .out = { + { .status.warn.all = 0, + .status.error.all = 0, + .l3_type = ODP_PROTO_L3_TYPE_IPV4, + .l4_type = ODP_PROTO_L4_TYPE_NO_NEXT, + .pkt_out = &pkt_mcgrew_gcm_test_12_notun }, + }, + }; + + ipsec_check_in_one(&test, sa); + + ipsec_sa_destroy(sa); +} static void test_in_ipv4_mcgrew_gcm_15_esp(void) { @@ -1584,10 +1619,10 @@ odp_testinfo_t ipsec_in_suite[] = { ipsec_check_esp_aes_gcm_256), ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_4_esp, ipsec_check_esp_aes_gcm_128), -#if 0 ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_12_esp, ipsec_check_esp_aes_gcm_128), -#endif + ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_12_esp_notun, + ipsec_check_esp_aes_gcm_128), ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_15_esp, ipsec_check_esp_null_aes_gmac_128), ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_rfc7634_chacha, diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec/test_vectors.h index f14fdb2b3..4d5ab3bdc 100644 --- a/test/validation/api/ipsec/test_vectors.h +++ b/test/validation/api/ipsec/test_vectors.h @@ -1641,7 +1641,7 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_4_esp = { static const ipsec_test_packet pkt_mcgrew_gcm_test_12 = { .len = 14, .l2_offset = 0, - .l3_offset = ODP_PACKET_OFFSET_INVALID, + .l3_offset = 14, .l4_offset = ODP_PACKET_OFFSET_INVALID, .data = { /* ETH - not a part of RFC, added for simplicity */ @@ -1650,6 +1650,23 @@ static const ipsec_test_packet pkt_mcgrew_gcm_test_12 = { }, }; +static const ipsec_test_packet pkt_mcgrew_gcm_test_12_notun = { + .len = 34, + .l2_offset = 0, + .l3_offset = 14, + .l4_offset = 34, + .data = { + /* ETH - not a part of RFC, added for simplicity */ + 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1, + 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00, + + /* IP - not a part of RFC, added for simplicity */ + 0x45, 0x00, 0x00, 0x14, 0x69, 0x8f, 0x00, 0x00, + 0x80, 0x3b, 0x4d, 0xcc, 0xc0, 0xa8, 0x01, 0x02, + 0xc0, 0xa8, 0x01, 0x01, + }, +}; + static const ipsec_test_packet pkt_mcgrew_gcm_test_12_esp = { .len = 70, .l2_offset = 0,