From patchwork Thu Mar 1 21:00:47 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: 130427 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp3289193edc; Thu, 1 Mar 2018 13:13:26 -0800 (PST) X-Google-Smtp-Source: AG47ELus/KxaiLbYHObpKQySWH1hBU5fDqzdLnGCGkwce03qfVLDYe8cTpSQGK+JGcgN+J0gI8UH X-Received: by 10.233.239.129 with SMTP id d123mr5043207qkg.57.1519938804881; Thu, 01 Mar 2018 13:13:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519938804; cv=none; d=google.com; s=arc-20160816; b=wLoMG3h2KIRJ/L5sI8BvuvaOqBAEI2lkbsIz09xk82AaLxzBB+vgCDyTP9oE7tNkac m/ftej+km2ulEyEIizMfunnYp22pxjBqrMNAuPdR/1YWG/xY38WNYiyo7oB/ltZYPBHi 3mHg0I94CccNaZe1I7CN6ORL2iMbwc8OOHmvcGipoSeM/3rwETRSAMnFQIZIqetJlAnV 3nwTAvkOX4vNilJlCaMr/yWjXA15rVwbHO1h6WZ1lck/BX3XoK5UeNOd11NXQW73VLOZ hgp+x1SFBvDGYlqCHAFyzsNFrsDxxUwiVoHQKFbTBMl8CxddPSjO9umR4hxqCZwf9uQR 8a+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=stRQ4tSaSk/mGFy9sbhq4mA5MBx3tMqr1x41ICTHkmw=; b=ogf/jDdylOdpevuAXUV4trVUneBchgX1CsGjDL/0m2N4MujNdnk+6+ctmlueeeLAOA Yst0aCtSy2bRYR1eNy6svBmhCNphIEYNCVXRz9vcBRCc++gS8YGeQF1ecrS8TBvvZaeB 4fUi91z6EyTIeVYTJs9KFupZbNgg25J1ytxRozkUx+6p/BmEju69761Ax3x4jgLL272z r9gk2tBgs5i9iRx5G+jvjbkywKfbqBsVhWZ1pgRFHxmEJ2CUuidhxrpuwrXlQGBzIVfO Utlw/Im/DLmoxQ3hhpjjiX4ySoBkwQ1uaL97JKcCrf7O+LHdQ39MTtoD3KQqOZqcESoz H3Rw== 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 r11si5135191qkk.187.2018.03.01.13.13.24; Thu, 01 Mar 2018 13:13:24 -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 82A3C627A5; Thu, 1 Mar 2018 21:13:24 +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 09CED627DD; Thu, 1 Mar 2018 21:03:14 +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 23B21627AC; Thu, 1 Mar 2018 21:03:07 +0000 (UTC) Received: from forward100p.mail.yandex.net (forward100p.mail.yandex.net [77.88.28.100]) by lists.linaro.org (Postfix) with ESMTPS id CF0CD627AC for ; Thu, 1 Mar 2018 21:01:46 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward100p.mail.yandex.net (Yandex) with ESMTP id 6BEB45105A97 for ; Fri, 2 Mar 2018 00:01:03 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Egxe7Qjoy1-13lalNOW; Fri, 02 Mar 2018 00:01:03 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id BpjAadXdWb-122uqw15; Fri, 02 Mar 2018 00:01:03 +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: Fri, 2 Mar 2018 00:00:47 +0300 Message-Id: <1519938053-24031-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519938053-24031-1-git-send-email-odpbot@yandex.ru> References: <1519938053-24031-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 505 Subject: [lng-odp] [PATCH v2 7/13] 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 Reviewed-by: Bill Fischofer Signed-off-by: Maxim Uvarov --- /** Email created from pull request 505 (muvarov:devel/master_merge_api-next) ** https://github.com/Linaro/odp/pull/505 ** Patch: https://github.com/Linaro/odp/pull/505.patch ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6 ** Merge commit sha: 5da68bf06572d3d0651c37cbba03aa91995ec465 **/ 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; }