From patchwork Mon Feb 26 15: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: 129658 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp296276lja; Mon, 26 Feb 2018 07:02:27 -0800 (PST) X-Google-Smtp-Source: AG47ELtpdz73MdHEc3h/FOvMO7KeBAe+B54W89Xg6dlw+bj7LiZuafv8NBBgaRvl7LVK6Oncxr1W X-Received: by 2002:a25:845:: with SMTP id 66-v6mr6925886ybi.433.1519657347211; Mon, 26 Feb 2018 07:02:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519657347; cv=none; d=google.com; s=arc-20160816; b=nuTR1SSepSHiow7O3Xr+Tl9axQEOpGweySwYTiGa2NfPnlBibMnV5R262yiZNirDIj 7EWDlPruYSh6zI7JdVdfaGBcHSbKxydowFrqh1kMxEX/XgN9VqlQLdfcqs+xVwxKHJzr Rkxz+VLUAFXCtmUHiVdYRECxqUG9RIiEItcOilERxw8heVCKx8R2Z81RMCDgerok/aG/ UbsEdnHRqBeujoGvTCTqYGTGRrvq7+DH6/F4hMmgg0Dhw457q0BYMBN3MZqvhMjgXvZ/ +Q0rn3a7N+JVR5Lp9cWxydJdAksFxq/3dLPmxh53dBSOKKP2QrmVX0riNnhyotz+5Q55 SUwg== 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=5PKRoPP0niFCx2jGZKIqtZz6qr4ApCXCCP7mWXYmRww=; b=DdbaBWy8hwK65oaFUnrgOCfeszKoK0zmen6lX5X8KZ5P/UlE43cj48RNz0qb4Da5Ay sWze0r0GyJGOeS9hkHAXdSXeZHcLnsdr7J3EHPJUy6/LiF7/zhC+z1AexOBD99eX/NEv qlvszI8JoqkngNEClnT3RSOvUsSDFXXbp70wWjSqN93Y4mni0XjGoVIyN3zQE/kxvCGS BnherjRRUfnU9PJR0vaNVBUStZTHLjg5OL3gslJU6H7EwnEvgYPAiyEb2mkmb30Vij/8 3yJ557Yz9fSyz1+9KRS/BCFkUvpHPIeG+wec23oRGkMnVcg8VEimKmGF8r+w2Q7vaKpQ Gi3g== 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 f67-v6si1541355ybf.256.2018.02.26.07.02.26; Mon, 26 Feb 2018 07:02:27 -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 A3C4B60883; Mon, 26 Feb 2018 15:02:26 +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 5C67B6074A; Mon, 26 Feb 2018 15:00:35 +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 B6B866176F; Mon, 26 Feb 2018 15:00:20 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 0973D6176F for ; Mon, 26 Feb 2018 15:00:17 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 66C5E785204 for ; Mon, 26 Feb 2018 18:00:15 +0300 (MSK) Received: from smtp1o.mail.yandex.net (smtp1o.mail.yandex.net [2a02:6b8:0:1a2d::25]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iGojg0e6ZB-0Fnq4upi; Mon, 26 Feb 2018 18:00:15 +0300 Received: by smtp1o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id kHvqsGsU0k-0ETKKVgf; Mon, 26 Feb 2018 18: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: Mon, 26 Feb 2018 18:00:03 +0300 Message-Id: <1519657209-30140-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519657209-30140-1-git-send-email-odpbot@yandex.ru> References: <1519657209-30140-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 502 Subject: [lng-odp] [PATCH API-NEXT v1 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: c91eae61d19350dd19aacf18c1148c9491398c14 ** Merge commit sha: 8c909084626ccef140542645cd34549ce7f4bcde **/ 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; }