From patchwork Tue Dec 12 23:00:32 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: 121678 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp4750121qgn; Tue, 12 Dec 2017 15:19:24 -0800 (PST) X-Google-Smtp-Source: ACJfBoveEwpJZkdeK+nke1mL7XDR3pKJddY8Hw5px192Y6ocW6sewmqr5mLmfnGXoyMbDXf9gFxL X-Received: by 10.55.146.65 with SMTP id u62mr8206845qkd.112.1513120764017; Tue, 12 Dec 2017 15:19:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513120764; cv=none; d=google.com; s=arc-20160816; b=ope4wF8Hv5dTTJjDVAkD6b5y8AUSoZZ/cwKAvr9OYH5mBU3AOEau2hbw+j8d2SKux7 EsQWykAWKO03CZioJ/1zr6X1nctRUsw8fCOUaRfajXoVg40Dw2rH2rROBBQ8ewMtYahZ BU78l14bYlzimQjNE8zrxuW91XWWCPYyekVo5piXVQTSiOBXjZo5KOl0gjeLuUYoWOuW AmWJSy/WGRE0yg7b50VY5MYwKUgBn4dDRMu0IamXpqeyeSaMMcYUG0cmLHqGrVb2vjcp ppGNHEm9U4QUZHkV7oXVsXDb8uxF5igMSXEeMrxIuRvuZqNQs3XXudw2J2fhKed+9ZZ/ +JxQ== 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=Ons2c/V7GAQUXExmCCkR6nq+5zUE/xuLBk74KR93S3s=; b=PrC3g+Txd5YDX5ECwQCxF4z/FF/AUAnQBVvIcj0HyPiqX2A2T991EOrl4reJx08rar 6rhmvNF1cqHj1u9szDWNXpLpFCxXeVBAnpvWVtDjgNNDufTbIIB7d22czJc7ybhzJWTJ n0eZrEl/YrJJodEeg+L1s1uHs1V/vef4kkdcDoRKBCJyTZBi5eDWmpP7vgiM2MT79Y9j TQCDB28R4GBYf8IZRAq6qvpixbgT1FullZTox7FHO79Io4aKICQh8WqCSPFhjeTmbTto SSIbRWAMz3VudmEj1Y3yBdwezP7KN1eR/l9/iiPsM5wYnGTMDrCQ6CHgTKs1EyzMc2aR tgwA== 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 n14si360667qki.204.2017.12.12.15.19.23; Tue, 12 Dec 2017 15:19: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 A9D436091B; Tue, 12 Dec 2017 23:19: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=-5.4 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 1AD72608F6; Tue, 12 Dec 2017 23:02:34 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id A1C7E6091E; Tue, 12 Dec 2017 23:02:09 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id E84C56091E for ; Tue, 12 Dec 2017 23:00:44 +0000 (UTC) Received: from mxback12j.mail.yandex.net (mxback12j.mail.yandex.net [IPv6:2a02:6b8:0:1619::87]) by forward106p.mail.yandex.net (Yandex) with ESMTP id C177B2D85CDA for ; Wed, 13 Dec 2017 02:00:43 +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 1t69djj1Jt-0hjSQj6F; Wed, 13 Dec 2017 02:00:43 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3wAtrviM64-0h0mnfoo; Wed, 13 Dec 2017 02:00:43 +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: Wed, 13 Dec 2017 02:00:32 +0300 Message-Id: <1513119632-28755-17-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513119632-28755-1-git-send-email-odpbot@yandex.ru> References: <1513119632-28755-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 304 Subject: [lng-odp] [PATCH API-NEXT v14 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: d96a8207591fbcaac25b79286d7d72a537354c1f ** Merge commit sha: 832a79461bc8bd90e572c396fa081e162e1dacb6 **/ 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..4f23eb17b 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.last_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;