From patchwork Tue Dec 12 17:00:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 121604 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4400965qgn; Tue, 12 Dec 2017 09:24:54 -0800 (PST) X-Google-Smtp-Source: ACJfBovPuNIdN2lgdGwgXFHcmR02Lf8P0tqbWZ/1Sv5aSOOm2q5c4HZna6o74taxbxba0u4XUPxv X-Received: by 10.55.33.13 with SMTP id h13mr6495052qkh.176.1513099494128; Tue, 12 Dec 2017 09:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513099494; cv=none; d=google.com; s=arc-20160816; b=Po0MXjcv92OB5U6CI6HWpP/CawOcRS25y/w99cJNMJK9uMOWWknOtEK3hagMZMmPZ9 TugH6Bmaoqy0rH/dBw0SBWRHiDE6j6rjwyfl7W9TRbmDG5T+y/VS1UfsETgYFajA79W9 5AxrXh2H8RJ//3G09NqkFr553z1DlpBuAQUK0MNO3Vsd1jbsk5oglnMHFoEk9dnb58cN YTYPcMX7ilUm/JCHzsf9WJaYdAyZmS0+pc0g5KnOjG2PcGRicZZ6mJmdAl7nsh9ot3ln 7j4rjKRGZq09QFtjzRxgmuwvZWhKDjeFiCiUF1iAkwxfD8KEz5pbbPywM17RAUknnzg2 mwYg== 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=Rd9OxvpmhOXN4z9liReQsv0Xa1LPM/Z5LMVMUnMVKlw=; b=RYzZG/yedJYraj0CGZH69cdI1e8iqfafQo0xGT79mLNbrzKVKhAOPlEiGucvgo6Xea fgNsg7cmBk/k6qt532Md2BKNE2cKUT32RDUgam6hw49Fj1U+VLodQ84loSrAqBe5+U7o maVyqXE7jGkLfoPAzDNHQ0xIShVnfeTAnX73zggYoUvsZIw1H45NXMlMx6Y75ymkFBBT cmiDivh7q5e+fXhKp5KVX3XqmL0U8vuAYWbg5KnZhJ+uGPaOJpEBTutRYgjyLrFjc5oN PsX6YmfrwhNDw9b5ihGmWR+bWA+jsg/IGFdvyKkCGylucBazU0/V4oe/nwaL/hrTUGCl I8IA== 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 z188si11698645qka.0.2017.12.12.09.24.53; Tue, 12 Dec 2017 09:24:54 -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 CF805608ED; Tue, 12 Dec 2017 17:24:53 +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,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 6DDAE609A2; Tue, 12 Dec 2017 17:03:48 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8DCE960988; Tue, 12 Dec 2017 17:03:30 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id B8554608FD for ; Tue, 12 Dec 2017 17:01:13 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 47CDA784490 for ; Tue, 12 Dec 2017 20:01:11 +0300 (MSK) Received: from smtp1j.mail.yandex.net (smtp1j.mail.yandex.net [2a02:6b8:0:801::ab]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 1AJyfWAymr-1BSqHtJI; Tue, 12 Dec 2017 20:01:11 +0300 Received: by smtp1j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id O5YE7TQVzQ-1A9uQOfW; Tue, 12 Dec 2017 20:01: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, 12 Dec 2017 20:00:47 +0300 Message-Id: <1513098047-19804-17-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513098047-19804-1-git-send-email-odpbot@yandex.ru> References: <1513098047-19804-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v13 16/16] linux-gen: ipsec: pass checksum flags to packet parsing code 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 Pass checksum and protocol parsing flags to packet parsing code. Checksum checks are not yet implemented by odp_packet_parse, it will be done later. Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 304 (lumag:ipsec-ipv6-2) ** https://github.com/Linaro/odp/pull/304 ** Patch: https://github.com/Linaro/odp/pull/304.patch ** Base sha: 65d690fbcf03c6a4d5eb3f01bde36807833feaaa ** Merge commit sha: a17bf2b46352969fad4fbaf801dc8b5da0de7a78 **/ platform/linux-generic/odp_ipsec.c | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 6568924a3..48ae77512 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -198,24 +198,6 @@ static const uint8_t ipsec_padding[255] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, }; -static inline odp_pktio_parser_layer_t parse_layer(odp_ipsec_proto_layer_t l) -{ - switch (l) { - case ODP_IPSEC_LAYER_NONE: - return ODP_PKTIO_PARSER_LAYER_NONE; - case ODP_IPSEC_LAYER_L2: - return ODP_PKTIO_PARSER_LAYER_L2; - case ODP_IPSEC_LAYER_L3: - return ODP_PKTIO_PARSER_LAYER_L3; - case ODP_IPSEC_LAYER_L4: - return ODP_PKTIO_PARSER_LAYER_L4; - case ODP_IPSEC_LAYER_ALL: - return ODP_PKTIO_PARSER_LAYER_ALL; - } - - return ODP_PKTIO_PARSER_LAYER_NONE; -} - typedef struct { void *ip; unsigned stats_length; @@ -605,6 +587,7 @@ 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); @@ -770,15 +753,15 @@ static ipsec_sa_t *ipsec_in_single(odp_packet_t pkt, goto err; } - pkt_hdr = odp_packet_hdr(pkt); - - packet_parse_reset(pkt_hdr); + parse_param.proto = state.is_ipv4 ? + ODP_PROTO_IPV4 : + ODP_PROTO_IPV6; + parse_param.layer = (odp_proto_layer_t)ipsec_config.inbound.parse; + parse_param.chksums = ipsec_config.inbound.chksums; - packet_parse_l3_l4(pkt_hdr, parse_layer(ipsec_config.inbound.parse), - state.ip_offset, - state.is_ipv4 ? - _ODP_ETHTYPE_IPV4 : - _ODP_ETHTYPE_IPV6); + /* 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;