From patchwork Tue Feb 27 19: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: 129856 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp217565lja; Tue, 27 Feb 2018 12:09:23 -0800 (PST) X-Google-Smtp-Source: AG47ELtlYiws0QPBhKbigBmJYLNcq16OnCZpiq9HpAnssBFE6otsEg1XYh4q1hOJmTzsGIhpXW/k X-Received: by 10.200.67.7 with SMTP id z7mr8804135qtm.18.1519762163598; Tue, 27 Feb 2018 12:09:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519762163; cv=none; d=google.com; s=arc-20160816; b=WWaTpl7Ujl36GCTP/s52gqzAl9OwBeHwosuFEZEu7Wa08fY3M3kpIpigtWRnu3nwP6 7RbmosN+5wnrmH6kuFyA/4piZNh9IZmyrdXbXDToxfhkDt5xMjZDkvojzj9W4PECVmiJ ebDBGJ6I8SHgRnPupeAqxRH8gDBZAHyIDKiKNL2s13qJ60RZZLuo96rXCVTiedW4EHib +3bKntduApOSGNJ5VfhRwtZdTaEsZCJkdWJHCb/qOjLmLwW38Dz4pQ+VyL9uTjeMoTH1 wwc4O0iw/1obu8dXj0wcAX8+7Uvxc5H+9YdqVBhKszS9h6BFBmO0uO7gy8mslgIAp9DX MRqQ== 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=BJVMsGw0iVfn0HaxGBh8B3Z0H4f7TvMUb+dKVK7+FvI=; b=cm0glcWpP0hNBRl6Nt2Uww12Ojz5u2lybJrHu4wWZ8pRhPodQ6wfobw9sFGLuNvqoQ 8W/3O7JoZMzjImfaiWAHkhxqgNO4e1OHL8Wj/0fJKj9vSoZwqSZ/9TCD4eKsCMpUEvBD YtK7Ez86QvlFBpcjaCbYU1IUgxPbCo7+tzH7HcUMVntdX2S/T5IrvlOLdJNh3QA2TozC 3Mz8FvwO2KB3rfHNr9zPTtSWZ03GX1w+Sbkz8gkyibb9JLpZ2wmQvMtjKPghBH07/w5+ Tez8ix2rLf/SqSe33s3T3huIL6D8QaeogPQa88S5gBJrWax09mlRNq27fQP2UVLxWBti 8z4g== 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 o3si1509291qtd.213.2018.02.27.12.09.23; Tue, 27 Feb 2018 12:09: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 47D0161762; Tue, 27 Feb 2018 20:09:23 +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 64F4861794; Tue, 27 Feb 2018 20:01:47 +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 AE1606178E; Tue, 27 Feb 2018 20:01:39 +0000 (UTC) Received: from forward103o.mail.yandex.net (forward103o.mail.yandex.net [37.140.190.177]) by lists.linaro.org (Postfix) with ESMTPS id 3052D6174D for ; Tue, 27 Feb 2018 20:00:24 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward103o.mail.yandex.net (Yandex) with ESMTP id DD34E58815F8 for ; Tue, 27 Feb 2018 23:00:11 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id kfiLYfm4Qi-0BWa0omb; Tue, 27 Feb 2018 23:00:11 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0AQiC5G2; Tue, 27 Feb 2018 23:00:10 +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: Tue, 27 Feb 2018 22:59:59 +0300 Message-Id: <1519761609-20848-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 1/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 666a4617c..2459a3aa8 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2485,6 +2485,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 Tue Feb 27 20: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: 129845 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp208727lja; Tue, 27 Feb 2018 12:01:16 -0800 (PST) X-Google-Smtp-Source: AG47ELui5UPgLBYvFAUgKG6uj+GZZSf3dWMSgW8j2kczuQfV0ulcdIa867KapwDJot8qQAAe2zyC X-Received: by 10.55.12.19 with SMTP id 19mr24779396qkm.277.1519761675479; Tue, 27 Feb 2018 12:01:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519761675; cv=none; d=google.com; s=arc-20160816; b=uVy0I2v1P0eSqsfLzjzbUdwtzcrJDmFXWpHOfwZi4ZRqS3r+tBb7IIlQk7wfRQ5RoZ hm8J2f2XDmmGbNKST2PiWZUwkIfZMqcRxCfi/3GyLOv1d7kEDCZbB6fNJvHAaaOM5bBa qN9UkSDN7NEEEiteJj7JmPtbhZCJjLLPI2x6jdYyZ/J8OSkGiW4Gy/kyTkjaFeqeHrrN xNXjCpsbuyuonJwuBYoid9EfhE2CyjJI9iKi44nHgfxA4MUGgNsEEFjJVcNlshcVbO1f Ywtga3wSuw1AKushuErruUD0GBnLdV7Uu+6yoNv1Er5u3+Llh1pDpgKxLkvsjQPCelaY 5HKg== 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=MbQDWOnuJMotj9/vN4a9GyMhDcxHbzf4vhgTdi72O3k=; b=SufaFxmscl1Knrs9wkaM7REANW0f66YxGjr00jqgDLQhCZ89Te2KhguPeY53lu2s9d atY/ToIUbwHfNBT0HOJYgJNQa9EgUZfjLKcXwlAI9DLqV05cQacJqeZpGm3CFbZsczGj YMupeCNfFQ+ojSpZRSUsUCKeHL7BVsbgO5mGHhDpyGMNvBlwuKwNDgkijCLfpNSO8OmZ Hobh0qpV6L88LZOfumAjCPfwBfGCeZs9AZfqLExbpwIvpkp+MX27kNAr2wY8/3rfD6rI YLFzIbLGmibm25Ei2z1zsRlFvsNKWQ1VXmRRlja+bA7JUXrYmKqXTVQWnnZFI7yKELZb EJIg== 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 a7si1139043qtk.231.2018.02.27.12.01.14; Tue, 27 Feb 2018 12:01:15 -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 EB1006176D; Tue, 27 Feb 2018 20:01: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 6AFF761750; Tue, 27 Feb 2018 20:00:22 +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 791916173F; Tue, 27 Feb 2018 20:00:15 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 0055C61735 for ; Tue, 27 Feb 2018 20:00:14 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 8C4E21841DE for ; Tue, 27 Feb 2018 23:00:12 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rnzQ6DQgRi-0CZ0h8lX; Tue, 27 Feb 2018 23:00:12 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0BQuDtaN; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:00 +0300 Message-Id: <1519761609-20848-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 2/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 104d6c7dc..a564c0028 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 Tue Feb 27 20: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: 129846 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp209802lja; Tue, 27 Feb 2018 12:01:56 -0800 (PST) X-Google-Smtp-Source: AG47ELu6Sfkr4emjb5vx3RLU7m2KTtIoYEyw7j9nmqUfRafLUrszW3qjuAjtqcbpUfL7ln30zWO0 X-Received: by 10.200.8.93 with SMTP id x29mr24338416qth.240.1519761716130; Tue, 27 Feb 2018 12:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519761716; cv=none; d=google.com; s=arc-20160816; b=fja/8Oe0GDw0Y7YaYw0s1Oyg9mrCy1ZCQrdhtBcJ+HrsuhTleAEEpPNxlArDv0KTMh fSPMZtNjEtL+f7+Vejvdm2mylPtjzimtVk8KlZFq0PFTkp0kbyO1lHkfCkOdnR5LgKVB n506WXskyd2po515YbOLQTD6KJHYEZrG8G30sq3bcvgw1EWy4Ob1/N9SnT8lJil2mrx5 OkidYQWxWjuqmWaWA63xGxzAS+09WqlGHH5K5hE+I4Wqa92MVG0gyu/vMs+4qMZOdb+E jG/PS3di0SqTiV05GNfvzdlCSCNGt0f3HbSAQ2s7kXBYwzvYZeo6f3cK3wi15FBCcm+I cF5Q== 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=0YQEunqyrKACVkKTP2Gg93BBAuheiG21rqarC+y5mE0=; b=JX/GNppvYjQ6opG1r3Ij438sSy8Kp5I4AdfmMC5gw2ihaaVLe8rWsK+MXeQEnLHPEv LlMq9H6aBxxZLfLmRVVzSPn5IpcJy3zCn46RswvGq7jYSidjgfaUWKnK9frp11pCy/Jn HjJJx2z7MkDwR97tspFPQCcqJaQeGtxeJOTYbK6KuwX2lR/6Ee+dPkw9y/syFvI/+pHy DoL4tab4q1FWo4KWqo0y8X89rGWR+vocA4BuKiaBjz5sCHKkRtpUyoyd8rAb8oj3bUGF Rc8nc8vpb6QpRSeyKwenbjV8wAPxMolsZv3mHzFeB5aew3Ywln88H73XoEd4w0VNsXIQ bjaw== 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 o63si943496qtd.423.2018.02.27.12.01.54; Tue, 27 Feb 2018 12: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 6DC38617AF; Tue, 27 Feb 2018 20:01:54 +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 D5EF361761; Tue, 27 Feb 2018 20:00:28 +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 B90556173F; Tue, 27 Feb 2018 20:00:16 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id E66456173E for ; Tue, 27 Feb 2018 20:00:14 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 6B4C056030DA for ; Tue, 27 Feb 2018 23:00:13 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback12j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id spvsxv4AAW-0DoK2Qct; Tue, 27 Feb 2018 23:00:13 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0CQuUjnv; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:01 +0300 Message-Id: <1519761609-20848-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 3/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 Tue Feb 27 20: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: 129847 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp210871lja; Tue, 27 Feb 2018 12:02:42 -0800 (PST) X-Google-Smtp-Source: AG47ELvmBK8kIp6t5TTQ1MNSsKD37BqrWHA1C4E3s0M5nUBB90N8aa11jjYXZeVC7yS0rWzuCBTT X-Received: by 10.200.6.205 with SMTP id j13mr13991480qth.102.1519761761130; Tue, 27 Feb 2018 12:02:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519761761; cv=none; d=google.com; s=arc-20160816; b=n9sHUyVYlgOyC5O30C0eoiNE51k0AM6Ycmr8PRxO/BrEIwuIfxLxUu6PkmGlXXvFcT B0in0fwfv5bqgGoLWnUc4KcHqrgTcYmpotmuWTJ/Z717Vl29L++8xdfbAHZGBmB7hemY zj9JNFNiUkjWBUvq0+A1EeVNNSh0XCJS4ZuamjhVmUpwDmLf999w9+DLA7EfMH5nv8W9 WTRuUIW4TR82pMQEw6B0CA/M9ptMuXa/rO1V+Up+HbbQ4f+wVtMbugGMbJlPOzD++dFh pGOrgV7WfL+Wm9kz1/vMkxN6XJDpIZWit0ioYDw179WI6ZokISanGGAc93A6gSLNtFxs XxGw== 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=6dhJ4QQfA9O4xWPY9vF/nKN98xtp4Ty6X/1JSSvHiNM=; b=ZAneKwml6z9Aebi6YFvbfI6W1FoI0wa8oGTTF6frlMcl4XHOOL7Iuci2IkCt45l4g6 xQpoE587eSYKbFCnxN8zL/Nu2RU1I63V7UlifgN06WkjEP4QAoF9ELS3N3Dj/rNkGKhE HtF2ZlulaYz4UXQU+W3Cs81MFkBwDFVL8KMibX+JoX6EObhjLWbs+RHCB+w8AosB4TBm EGxgcUuh7VvUN+WviHlfCJ+7STdGU7O20UdsHerjb0CNMGFhzezWzEWz1jIwRs8w51XG CqfZ6+GwfS2qL+/Twm5Ood+MPKlZoqp3C+0ry/s2PHMSchi++e4rygAZr1KGbZaHte/Y B7+g== 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 q26si1369192qtl.157.2018.02.27.12.02.40; Tue, 27 Feb 2018 12:02:41 -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 2F792617CC; Tue, 27 Feb 2018 20:02:40 +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 29E6F60656; Tue, 27 Feb 2018 20: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 04BBC6174B; Tue, 27 Feb 2018 20: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 32A546038A for ; Tue, 27 Feb 2018 20:00:16 +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 A1EDF4444ED9 for ; Tue, 27 Feb 2018 23:00:14 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback2o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Kr2gXGnGDs-0E58g8Wd; Tue, 27 Feb 2018 23:00:14 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0DQKSgqe; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:02 +0300 Message-Id: <1519761609-20848-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 4/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 444e1163b..fcf7d1109 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 */ }; @@ -136,6 +137,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 a2d9d52ff..0da1a5d11 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 Tue Feb 27 20: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: 129848 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp211856lja; Tue, 27 Feb 2018 12:03:31 -0800 (PST) X-Google-Smtp-Source: AG47ELsBJd+ddrbT2+wZURI4ilJYbIQJU1+nDEHAIJ7V93Xf6B+qOFdN4YY+oL6MJjrak/PGEbOv X-Received: by 10.55.66.77 with SMTP id p74mr25166033qka.55.1519761811132; Tue, 27 Feb 2018 12:03:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519761811; cv=none; d=google.com; s=arc-20160816; b=pyerDyEFMXF8xtEoGa1ubpOMnqTjsgYiPQTMBC8ZyNzjGzNeU4IL4zC9iffvL/Vhf/ WvcKC0kl2pYfnAvrf+BLAz8p8EimFIlpCk1phUMjV0D4VysJf5sWvLRfKbLAcG92XdIK OVA68eB4sqadKuIEpC9nsZ2A58DBQbOEp+uR6fnIEndVsC1H0Eg7ZKrkGMRq1uT/9A35 hf64KI7BHL1FPdt+Fe1nc5rBcAKe0YBJ+Q7hmekVZOmWGOzOK/RYSbqTF5HGZbcj8qHD XiY4rZbCKqICAS5ieGFUWLm53Uf/fWXUF12ue9vBM6hAHPQzx2WVa4ZdCymRVaFBJ+WM d3vA== 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=ayeJANED3otING1WnG0BvLsF3CaH0vbmSGN3PJ3r8Pw=; b=M+pQnGg0qDchKnOWotKzX+m3wFO/2UErGOH7dAO5IKTmcgLJa99vlO981LROdzh6Jt jPyD4JXEobD+8pGCSk1ln4k9VcoLWQbHOsKg3JrAP+YmDXwDRfj2voa+B8YPT+yZ39N3 sI06JmA3ccMh6iQqsljnw7s3Zvb3Ic/S9ir2IXFqUz3EJdJ8H2fqtmDc4DOwveE66wYD hnVK3v2+bJkIAAI5KXsfBtR2om90xaCXA0G8MDYw8j88xMktZwlhkhvMlLcDesxxQFPb QAaTIpKpVMwk6+maNikheZoBU8posgF5B4IvpdSQhIaMW0eksaM6gI3ZXZyjVMneHmpO jh2A== 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 i29si1149403qte.473.2018.02.27.12.03.30; Tue, 27 Feb 2018 12:03:31 -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 B15EE61801; Tue, 27 Feb 2018 20:03:30 +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 BC2E76077E; Tue, 27 Feb 2018 20:00:37 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D644961735; Tue, 27 Feb 2018 20:00:19 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id ECF6961735 for ; Tue, 27 Feb 2018 20:00:16 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 83733430389A for ; Tue, 27 Feb 2018 23:00:15 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id bpGE82Ks4w-0Fsu0FkQ; Tue, 27 Feb 2018 23:00:15 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0EQuIOS8; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:03 +0300 Message-Id: <1519761609-20848-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 5/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 Tue Feb 27 20: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: 129849 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp212488lja; Tue, 27 Feb 2018 12:04:10 -0800 (PST) X-Google-Smtp-Source: AG47ELvUSIv5gg9aCV32/ewhF8vXj9GpdmJFHByLSUwcEE+f11AW9bQ07AoAMPSYixDhbXGg6PB8 X-Received: by 10.237.59.59 with SMTP id p56mr26313488qte.84.1519761850681; Tue, 27 Feb 2018 12:04:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519761850; cv=none; d=google.com; s=arc-20160816; b=Is+XyORBcNAZk77M42PYWVi43yCZvXsrXUKZcaSeFU+OQTNIsU4WTirOu+5Gm7b1p/ jRmwjH/0RWgmaQs0TAKqGTBM9zysnbn+sLT/BTsnDnaG2Qo5oxl6QvgHGoeuRXX0aAqo DeNHn2DkvwwRcehw+LQzYKDZfIiSjtvh5Utl2j1qiW9ERV9a5Q/weHC8uN5j90jkHMC3 cxT/ve/jCMYUXjfM1mrArMMsbaM+ZY6cbqBcJHoYFvysGVU0mHJJNiPXr6IBP9xlIU3H eL5Fba20bk6kGSvxKSGQw/Bwya8TWkBDCiQfH8X/3ITB01eazRjtFRBosfPwYnvm/FY5 Nw8A== 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=NIyV0eKCBirc+nK/g+vCthjEHShcv87SO89dqUlRsIA=; b=dsnZZbBMnTh15c3vR/Id90Ck8lr3CnJPOQPwTfnpbEm6YLrSiXkK51nfv68uuQNPLw 4kBoIsbE0fSlr+dOf0eyBT4WE1GPWJn4qHLo4J1BWtK3VLYxiIb3ux3Cn+HVWToTtU/8 EYIYzvnN5jDOyhlZyJUEBTQibahhBYSDiz3PFvESNYKBpujaS1H/cVZ5dtVQ567jM8oq NGIByiZuslkQAH98r5OroRzjIGKmc77+Aw4zzjjcdItLtWoqxNAfGw2sBLRFkHp36/DW kRADpVlq9zzDPBFSVbEvLsWnQVrxyl7wrLzEDT/+Ono8gHjphXl2h47nXRGmYheBaAb3 e9xw== 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 p30si3307427qtl.313.2018.02.27.12.04.10; Tue, 27 Feb 2018 12:04: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 52A9360C76; Tue, 27 Feb 2018 20:04: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 119A260834; Tue, 27 Feb 2018 20:00:41 +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 60EE26173E; Tue, 27 Feb 2018 20:00:21 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id 51F896173E for ; Tue, 27 Feb 2018 20:00:17 +0000 (UTC) Received: from mxback8o.mail.yandex.net (mxback8o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::22]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 4839B1841B7 for ; Tue, 27 Feb 2018 23:00:16 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback8o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id fAqL6T6SYp-0GH0WkpH; Tue, 27 Feb 2018 23:00:16 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0FQOwCcn; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:04 +0300 Message-Id: <1519761609-20848-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 6/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 2459a3aa8..b30cc63ad 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -2224,6 +2224,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; @@ -2529,6 +2533,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 Tue Feb 27 20: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: 129853 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp215104lja; Tue, 27 Feb 2018 12:06:41 -0800 (PST) X-Google-Smtp-Source: AG47ELui7XGfVmdGfORFurRqBR0mF0/oD9ip89S+Ke1K/4bk+n+YnOapmCAovMZfc7Jm1apEN+uI X-Received: by 10.200.49.108 with SMTP id h41mr23909776qtb.227.1519762000889; Tue, 27 Feb 2018 12:06:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519762000; cv=none; d=google.com; s=arc-20160816; b=bF40qLr4nbX+vWB7u2cq0VCNSjomwlp8iE+HbDtZJOH5f1WYW7eYsXdFpEVHdE78mv kBRwlu79LA+zhvUwTHeU2kTbgY8bludq9m6mTsP7I5pXFpfVrfIJoYliI8CFAdYiRq1E ryU6w3u7N6HaEjxlEsrAtIum8JBtbB0B9NA1Oxbc2IsGGvuWD++US2uhY4MBEZvC45Ph NVtvmO0ahGIOSKuQZTBSLkfa5+9DwnPpdMeYjs+anBejM6hv+YyMDQi/Kg8MUaoM8RVX S5Lzc3RQPDzAGefhzeYf+FcC4uR5Tye3NF1PiDIC2A/OAY2oWudJeYHTxeSqEKfEIt7h ouhA== 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=FX3ttH9+bDT4jLdBDFURKTprZDfBJvGwpKox6jzMoKQ=; b=GWEDrZc8XxsiodENHJDc2IP0AZkfCy4ZqR4qkqlWq8s+wn42NyhseIGALumZHxqhrp tqOZ5qKvB0LoVBIBxceQtUugCXyyZLxE7N7kDXhVWR2PpRGVUnXMFi4UzEsxI8MOiXBP hns3fr4Bz8o39IVedKeYhLGeRNx7Ehm/MCAJWLY84gRPYp5aIAM7CRnHpc5pugpBRr0J c1tN6rbQ5ycLzTwOjtkDSVRllTcFcAzOw4ZRC6NEERKE40+3ktmiIs+nC3zd8Z9fjgof NZrRR53M3v/HVmRlRbe4/Cohy93u9Ugzi8Dj2+kCXACCT2LO6HmNMZEw6/aSSntfdld2 Fegw== 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 r11si11533581qta.118.2018.02.27.12.06.40; Tue, 27 Feb 2018 12:06: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 9293160B17; Tue, 27 Feb 2018 20:06:40 +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 4751561778; Tue, 27 Feb 2018 20: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 A1FBC61745; Tue, 27 Feb 2018 20:01:05 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 7FFE36038A for ; Tue, 27 Feb 2018 20:00:19 +0000 (UTC) Received: from mxback4j.mail.yandex.net (mxback4j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10d]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 2B79721838A2 for ; Tue, 27 Feb 2018 23:00:18 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback4j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id e34sbO71jA-0HYCXppO; Tue, 27 Feb 2018 23:00:18 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0GQuBGRx; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:05 +0300 Message-Id: <1519761609-20848-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 7/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 Tue Feb 27 20: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: 129850 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp213375lja; Tue, 27 Feb 2018 12:04:55 -0800 (PST) X-Google-Smtp-Source: AG47ELvCSs1X7OtCWjqOiV7hV6n85so0k2TUGH6hx2L00qWy+1eG1+MQhjEI35jrqgfJOup8vdPG X-Received: by 10.200.20.149 with SMTP id l21mr3743275qtj.156.1519761895500; Tue, 27 Feb 2018 12:04:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519761895; cv=none; d=google.com; s=arc-20160816; b=U74RMfjwwF6rOjvuKePJ/nkGcuAGxCd2OS/L+RAmsKjffqQf6egw8FnDXIsfgai1Wo 74kcxgBwJAomTNAOwh6bPQyM7iBzu1V9Ch15fWImlnGaXLVY9g2+3OXmtWRh/DFL+0bH njyGZ/ybwusDwBs3zK4FofNzRNN7Z50Ci0Jz59Do74Eso2Al6k+7xmmNPwGpqvSRGQEs wQZqZ5vWJwjRdB7ygDS3twoi9ermUD8HAydsR8GSv/ow45hdXbc0HulWvy4ewnFgLSjy JaUZpfs5GvHT1otJL6hZ6uB1ruhQLCLBCMSDFmwUCFLLw6+rpBFv6wr0t7ardrs7jcPZ cM9Q== 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=9D+Bfnss814Fw83yGm6tq6ccW1Um3jh4o9cjk9unvg0=; b=MW2BnUaCYhCUIHJvZwS2Z3rlp8Ea7AdmhPbjufxMxqygrOYpnkaqSFnqdGPJyWlZJo WtC0Z8tVo4t5txEvermCN/UUo5zE3FBpvhY5XtQigBh/5Gxhn17rV4DgvJzCfApkKlMo u/zS76pZiedFUOI9LuqluO2UdEI9LS5ID2yvWPG/S7kT4/cFpJ+WK7vg3k7Xeq3rLkX9 oYZhx2lT4I7KtzxIpLbrW+L5Sp3ZpVciYicF/ekv20KK+qETcc7Z/5ZGfe6Q0aL/AgPP 7FLetH9mxuMmTFP1yw3XJtqAVhwqpg5Bby7oWOM8yVQlIirVNiBLll+Kw6hOMOWgI/Pt EBsw== 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 a51si4991373qta.366.2018.02.27.12.04.54; Tue, 27 Feb 2018 12:04:55 -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 9FF1861745; Tue, 27 Feb 2018 20:04:54 +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 8F5D26173E; Tue, 27 Feb 2018 20:01:12 +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 3015C6176B; Tue, 27 Feb 2018 20:01:04 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id 204B661735 for ; Tue, 27 Feb 2018 20:00:20 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 1498C2183223 for ; Tue, 27 Feb 2018 23:00:19 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id k6SyYilpQp-0Im46UNi; Tue, 27 Feb 2018 23:00:19 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0IQO5mOC; Tue, 27 Feb 2018 23:00:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 27 Feb 2018 23:00:06 +0300 Message-Id: <1519761609-20848-9-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 8/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 Tue Feb 27 20: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: 129851 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp214149lja; Tue, 27 Feb 2018 12:05:44 -0800 (PST) X-Google-Smtp-Source: AG47ELupWOB4L9b2xgamiS2a90ZZYl0R5W3eIIE0vRXWcCAzf9UrNSSwMkufn81zsRgXOxLK0MNt X-Received: by 2002:a25:4117:: with SMTP id o23-v6mr10510842yba.159.1519761944529; Tue, 27 Feb 2018 12:05:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519761944; cv=none; d=google.com; s=arc-20160816; b=JZJv2v+XlWJd5I+5YcScK4BEHfZCPBCT5F5J8ilGnAczQ8lA3SFUz8c1TafdGKyQFp AEHMCzUDY3b3a7gusLoZ0MkJNYD4I6a7jx47WyriBpkOKvozAhjHytsfkpa+n7ppWg0m Bczf8ruxhysWFywfCdxF1RbWpx8FqST/LAtHF6VLHrMwtO+NuZWZw7eLht4FrEVG8hgu ORG7QqiK2rqMUu5CNh0qDWVSV7XNfi0paxJEFXDBifc4el4qDtYM2O+zoWuBpH459CM7 MDmWQRpIoHeC+n7CaRZbVIjs+9zoxA0CbcuudENLIrylQstJnY+wQDsYaVt2hj47zZlq ub/Q== 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=67PXqEkphsWp5GQoD6Xonpot0gVvz2s4+4Zd9gv8O18=; b=f1rUQWK8wQeNOV6KMrwVAxZLtQYhghR3qdOjlaSfycqQQYkJ+EKYhmC+QfgQowDiCg eprk3lgFpyfJ02/jnoK9uPIQLVRhlIi6yyI0lIQYpgaouwJZfsWco7orIS73k8sOAlW9 qvzTh74DYy+rBP6TEhrxv4y7AA1fdOI6cp1mtrzPHIi3PPvKFecPucM7v8lYnjCVeFdx i5qxXPNzCqLKafuDbCb+EU1Ixv+xfM3JvLVxOl4ARbDUDfPAfnzVNrNrIBsposmlZF2C EYPederELs2RcYAw85s8H2oGyXit3bY5uj+XppxNr2qOd7dm69gXVL/Zmw2tnrN1Zne7 EdKg== 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 29si10899277qtp.474.2018.02.27.12.05.44; Tue, 27 Feb 2018 12:05:44 -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 0A5EF607B9; Tue, 27 Feb 2018 20:05:44 +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 E736161755; Tue, 27 Feb 2018 20:01:16 +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 6B00C61745; Tue, 27 Feb 2018 20:01:04 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id B4CC66174A for ; Tue, 27 Feb 2018 20:00:20 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward102p.mail.yandex.net (Yandex) with ESMTP id B28C243032C5 for ; Tue, 27 Feb 2018 23:00:19 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dl9awmIgH4-0JuCviqr; Tue, 27 Feb 2018 23:00:19 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0JQ4ckpW; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:07 +0300 Message-Id: <1519761609-20848-10-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 9/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ .../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 Tue Feb 27 20: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: 129855 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp216974lja; Tue, 27 Feb 2018 12:08:40 -0800 (PST) X-Google-Smtp-Source: AG47ELuFdcrIElTDbCwzpPGsZEcN5/9pGYVckQ09Myl8KLf2PwYzMYi5MVEV3E3v9c/zptYY5jmz X-Received: by 10.55.212.2 with SMTP id l2mr25587780qki.268.1519762120509; Tue, 27 Feb 2018 12:08:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519762120; cv=none; d=google.com; s=arc-20160816; b=rBN2hZTcUHTM8iEIK/x8+Dc7iuvTo/HKNx6MIRhWZbtlrME4KD2m8+cPgRE8suq5hX /m7+2BVBTlyFm0YChTbAtZ3JBb6bGLMQ72Xi/oPFGPNRKElG48SzjaHTanGaSmRx544K gpPKV3IV6bO2XQNNodspvMlGo5EOrj8W9tfrAdSPDNNguozqzhOSkDy977HQ8rP/TDTU 8BkLd77pwQVJprYrEhtq/Xiu8jCdROv7Vs+2uxxvq9pVPfBGN4tzLwL5WpbjUgulK3DK kD1I54qINp0JsKJI0UT2f0iJPiXq/2b0jWjMbt8xESuBfhvxCsNt/PIlUv2sA1wBaVuG tuUg== 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=onBzfYYlsYUwuAp+iYI8Jx1dHL8xrr6lLZJbyg5nKd0=; b=iE4BqwXIlsxTpRqIX8X7lC3a8eyC9zvAlbNXk3fNFGZzgbKrukUHK3vxeBruV3QJow /PSdtO2Uleszp+0VmWPAm4etBkUjEHqBGLmjDTXuiyWMvnlk7LTq9epMW5FLo+uAwsVP cmW/r2LZvA5HYBEGORHEUCF40KtV3QiLaHQx7GkT1IT0uAdsiTK6+ez8OxndsKJR29b7 OHoXzrT1UijM1ZipQZGdRjFddRD/f6XLwgj/DsVmxwK28Vx9zQ3ZYVWwUy48Q0Z2inLs PVTZG3dfQEDf6IusLmD3FfuUgX8ES5ophZlKI3DLhMUJTFm2jY5Feun0I0UskV/ZWa3+ g8FQ== 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 j3si659983qkd.369.2018.02.27.12.08.40; Tue, 27 Feb 2018 12:08: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 0C1F461737; Tue, 27 Feb 2018 20:08:40 +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 CF10061789; Tue, 27 Feb 2018 20:01: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 4C5356173F; Tue, 27 Feb 2018 20:01:09 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 52E896173F for ; Tue, 27 Feb 2018 20:00:21 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 4D28856030C1 for ; Tue, 27 Feb 2018 23:00:20 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Fzf06aK1Q7-0K8W5Pkw; Tue, 27 Feb 2018 23:00:20 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0JQOB4KF; Tue, 27 Feb 2018 23: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: Tue, 27 Feb 2018 23:00:08 +0300 Message-Id: <1519761609-20848-11-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 10/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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 Tue Feb 27 20: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: 129854 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp216197lja; Tue, 27 Feb 2018 12:07:56 -0800 (PST) X-Google-Smtp-Source: AG47ELuKzpqO9ToGor858tgzTIV2es0Gc0CDbQtn7UukVyTcznAI6T2dtJcgUIG+Waois6ICijSk X-Received: by 10.55.217.143 with SMTP id q15mr24459169qkl.38.1519762076038; Tue, 27 Feb 2018 12:07:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519762076; cv=none; d=google.com; s=arc-20160816; b=uhL3u+MhrV+cS+OdzDbNfd3jRHm2WncRg+MGliqF31oNKrofy29a8S8mIMBEH9OK8p fSnCbOEzwxU8I5ZaUpKwx81F4fi8aiddqYp3qQdEMzMtkOSBEudo54y2JpGhPaqpEUaq wqrJOj1gKrCc+4adQsk5N/ZaIe1ty1u92rSg0iZeWiRRZ7aLq0G0Ro9M1ARw/HootB+S dYIqJwtsSSb0fMCdq3u/l9piQFIzzg7Mp1J5gWLsiC0PfU5pnFJ0I8qhOaIPsN3t8EOp 8e9480B2R/AZigxbvY8Wp/I9bYR36/dCK2ayCqaXDl5Gy1o27yOsf5tvBaUZ4rJVnemT entg== 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=K8mLsNwQO8+iIqmUrz60XFRS5hf0Ud8ZZx2yiG+XOc4=; b=ck5P+f8ZXEXytbYZi4fuR1ecu9zWZjimnji/A34b4d8Uty3Vxenb32lpw6cPnC06TX dFKuLKmmAYTpKHEmGbcg7WIwmMs/eAugzPY8P5melhcQLLKf1xFbvu8YqnzZ176x8lYX kzukrREjE8nHKw6E949ACzISKrUdpDGf/xsbC9IRsPusBwub5gZpwMOf000748Ip3BH7 1V29CPGH5wFm+vSdzLOE8eFQKbULB2NTIUZsvxPHuxg1usQcilRPOHg/lKeDQS2VbKpg or111cCDD02oveJy3Qmf2xFq8XtkVezwdZwyJNBpJoG5Izhq/hat2pFLs4hXDf/rutQR TP5Q== 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 y36si1551447qtj.99.2018.02.27.12.07.55; Tue, 27 Feb 2018 12:07: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 B362A616E1; Tue, 27 Feb 2018 20:07: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, 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 9154D61773; Tue, 27 Feb 2018 20:01:28 +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 D34DF6174B; Tue, 27 Feb 2018 20:01:06 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id DA9EF6173E for ; Tue, 27 Feb 2018 20:00:21 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward103p.mail.yandex.net (Yandex) with ESMTP id C96572183236 for ; Tue, 27 Feb 2018 23:00:20 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id jfVogqi8gv-0KOST60p; Tue, 27 Feb 2018 23:00:20 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Upcczghx1N-0KQu3oGg; Tue, 27 Feb 2018 23:00:20 +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: Tue, 27 Feb 2018 23:00:09 +0300 Message-Id: <1519761609-20848-12-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> References: <1519761609-20848-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v3 11/11] 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 --- /** Email created from pull request 502 (lumag:ipsec-imp-upd) ** https://github.com/Linaro/odp/pull/502 ** Patch: https://github.com/Linaro/odp/pull/502.patch ** Base sha: ce5c4f9e7ce9fe504451c29429b9ae9fb68083ae ** Merge commit sha: fcd6960c97fe9a0a399be4f3418ba3dd83134544 **/ 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,