From patchwork Wed Feb 21 17:00:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 129110 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp843098ljc; Wed, 21 Feb 2018 09:06:06 -0800 (PST) X-Google-Smtp-Source: AH8x224+DoluQtInpyrRQdDsJcrJ9i2grpPJNXeMcXR9AVUcbrnHMb+7jwgIC/pQ/Jx6Q7gVvHyc X-Received: by 10.200.64.91 with SMTP id j27mr6413780qtl.29.1519232765944; Wed, 21 Feb 2018 09:06:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519232765; cv=none; d=google.com; s=arc-20160816; b=itsh+beQ5Lcm7U0ZdeSMHjp0L0l1ws09gJQZ4KnzTYWntbj7F6VRncvka3X+ZfFB1/ kQoda5lYqvcGgj7GRhBiSyNKVThb7fa23oC0svV43mlJ4zSP6ke+hLYgICC/7Bf+Kf5q piw0lGPi/e0Xd8IPA3nXnbSjT5QvKEPT873Xr21UaPHNnQAtgtXbX3UtCuxfNQ0IdoI5 t9/zwyKCzbZCOKE0U7SgsE6TFGTpwpzIHeEjMzmWSwG8CUOndsAOHDP/GIQnXi+THMLw B3LLMyfXu7/CYDQmgOsDT9i2oRc+aU9S+CAO1lIr8LoTGLhJvqihSg79qonSRpFV0ulQ TqVg== 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=jTkb+dsuluW78vy9RPReAqTeXTtAuU2zpM0QogvTq0c=; b=PSNlCtaiITdqlOmUr2TnPpzCeVmDLlRx3wX1C8UDkTqE2vptqAESAG+TrUGUVyQhwi va6e3OoVMd6DdF5rtrkRFf0kI5YXMcBNqBfKAGE0VPuGSjD4jJx065spjjq/ncmvrvMd sMkSrPwRHfZ13ah/NONQzmAaw0Gj9p9ie9xK0+++SfRtd37FHxEjX/0I/ug2x0RTvGtl KdyP6P/33NWNpQKsITdoAoiOgqksgmC50RzjhBySJJBAhfOsk4dM1BB4DPaEjxL03u7h SgV2PagUr4LBl+rpey2aFSX89KfjFimFNq5Z9OBjmayQLRVnLP/N06ZEb9BRVb8jzQfQ wyNA== 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 95si1861864qkx.203.2018.02.21.09.06.05; Wed, 21 Feb 2018 09:06:05 -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 8924661705; Wed, 21 Feb 2018 17:06:05 +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 74B81617D3; Wed, 21 Feb 2018 17:00:43 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8FB4A617C4; Wed, 21 Feb 2018 17:00:25 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 13864617A3 for ; Wed, 21 Feb 2018 17:00:17 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 08C984305C1D for ; Wed, 21 Feb 2018 20:00:16 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id OqZ7iLmxIe-0FMeXosY; Wed, 21 Feb 2018 20:00:15 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id yTStk9eEsG-0FuGiieq; Wed, 21 Feb 2018 20:00:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 21 Feb 2018 20:00:00 +0300 Message-Id: <1519232408-28445-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> References: <1519232408-28445-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 494 Subject: [lng-odp] [PATCH API-NEXT v1 7/15] 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 494 (lumag:ipsec-tfc-imp) ** https://github.com/Linaro/odp/pull/494 ** Patch: https://github.com/Linaro/odp/pull/494.patch ** Base sha: ea2afab619ae74108a03798bc358fdfcd29fdd88 ** Merge commit sha: 7bc900650676584bfb99c8a92c3d8812b458f172 **/ platform/linux-generic/odp_ipsec.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index 8c3d6cd63..cfdfa9dc9 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,10 @@ 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 = ipsec_sa->out.frag_mode; + if (opt->flag.frag_mode) + frag_mode = opt->frag_mode; + if (frag_mode == ODP_IPSEC_FRAG_CHECK) mtu = ipsec_sa->out.mtu; else mtu = UINT32_MAX; @@ -1467,6 +1470,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 +1500,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 +1607,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 +1702,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 +1806,8 @@ int _odp_ipsec_init_global(void) { odp_ipsec_config_init(&ipsec_config); + memset(&default_out_opt, 0, sizeof(default_out_opt)); + return 0; }