From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2677943BFB
	for <public@inbox.dpdk.org>; Tue, 27 Feb 2024 00:03:12 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 182D542E4A;
	Tue, 27 Feb 2024 00:03:12 +0100 (CET)
Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com
 [209.85.161.54]) by mails.dpdk.org (Postfix) with ESMTP id 9517D4027D
 for <stable@dpdk.org>; Tue, 27 Feb 2024 00:03:08 +0100 (CET)
Received: by mail-oo1-f54.google.com with SMTP id
 006d021491bc7-5a078ac712eso1081652eaf.1
 for <stable@dpdk.org>; Mon, 26 Feb 2024 15:03:08 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=iol.unh.edu; s=unh-iol; t=1708988587; x=1709593387; darn=dpdk.org;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=MaSG3fVHWZhoXWOnXCBdArE42bEYTAP9UUhi8TUtsIA=;
 b=VIibjlv+TymQ28//rOfuo+LZ+uwFJSI3Tllfgecz7q+NAgBsYd2l3bF1HptT6xmE19
 BwkEQFaJZ+TyU8Cw20ipvY/JWEgMjq6JlNPLDaImNA6hdZh945JnxucoioIMZR8F+ISD
 L6bST1XmTBbJfuK2Rew7yteKx1LhBpHw+byCE=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1708988587; x=1709593387;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=MaSG3fVHWZhoXWOnXCBdArE42bEYTAP9UUhi8TUtsIA=;
 b=kuLEhPbQp4B2LchAxBK9zJD6eZr//XnpwC77cBUwNvseWi33VR8IPm4aLUfB7WkMo2
 s7gJ61fOpXt+7fkGc1K+WXjIMhfKm9ZZrJYej2CGgUfJbrgj4GXXfubSWGOCwoJlLUGl
 FPTstYt2irTe6gZrqfroXkKfMeWx5vNhF3c5Su8exgSz0Mkq+04gFVIWHf+YZqBcLPIE
 p5zG6457cWp8KgtzPvZC2HRXBnlpFHorBxcL4e/JswyarrvJIa0/Pn7qon4p9Q+CeanL
 a3V19SIBfkCopMUEueNaZuastUMp3TbvMbYIS9DVQlCJJ6Zh/+woZFi3IsGCaezqhgcY
 WfHg==
X-Forwarded-Encrypted: i=1;
 AJvYcCVzcmTWlq68HYzOQzYFnXXwI1q52K1wv42e60OCu5VT4jpNqYIpBGR5bBe8WceaHUqwEyU1KMTCeDqGCFk6g28=
X-Gm-Message-State: AOJu0YxqaCDaMM+Aen+vJhqsrTC5ZYNM9tOSXT0RUD8ngiba7tA4gg4K
 GdYGLPinfuR1tEkJHWJtTGmKv2cpZn9LCRsfZZQ2KidLkGb2oUMh86XvayNogmC7oC2HiJbT34K
 KFk8GxKDXyqKhlCY3UunyZRENyAL4TcavYyv09A==
X-Google-Smtp-Source: AGHT+IFR6J3BVO/t9QMZjFBDqjzGl4OpO2JdP4CHP4mXM8q4yH/t4y0TRMGOsm8FRQ80H7siiG+r8WtXNoqQ7ub1Ob0=
X-Received: by 2002:a4a:6f52:0:b0:5a0:4598:cadf with SMTP id
 i18-20020a4a6f52000000b005a04598cadfmr7148768oof.3.1708988585978; Mon, 26 Feb
 2024 15:03:05 -0800 (PST)
MIME-Version: 1.0
References: <20231211095349.9895-1-radu.nicolau@intel.com>
 <20240226102545.18667-1-radu.nicolau@intel.com>
In-Reply-To: <20240226102545.18667-1-radu.nicolau@intel.com>
From: Patrick Robb <probb@iol.unh.edu>
Date: Mon, 26 Feb 2024 18:02:55 -0500
Message-ID: <CAJvnSUBGzvAH3wN65kd6SSDGZwqdvZGAL9ntM-CauDu_JDnY_Q@mail.gmail.com>
Subject: Re: [PATCH v3] examples/ipsec-secgw: fix cryptodev to SA mapping
To: dev@dpdk.org
Cc: anoobj@marvell.com, stable@dpdk.org, vfialko@marvell.com, 
 Ting-Kai Ku <ting-kai.ku@intel.com>, Ciara Power <ciara.power@intel.com>,
 Kai Ji <kai.ji@intel.com>, 
 Akhil Goyal <gakhil@marvell.com>, Radu Nicolau <radu.nicolau@intel.com>
Content-Type: multipart/alternative; boundary="000000000000991506061250e9d7"
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

--000000000000991506061250e9d7
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Recheck-request: iol-broadcom-Performance

This patch should not fail a performance test in CI - checking with a rerun
now.

On Mon, Feb 26, 2024 at 5:25=E2=80=AFAM Radu Nicolau <radu.nicolau@intel.co=
m> wrote:

> There are use cases where a SA should be able to use different cryptodevs
> on
> different lcores, for example there can be cryptodevs with just 1 qp per
> VF.
> For this purpose this patch relaxes the check in create lookaside session
> function.
> Also add a check to verify that a CQP is available for the current lcore.
>
> Fixes: a8ade12123c3 ("examples/ipsec-secgw: create lookaside sessions at
> init")
> Cc: stable@dpdk.org
> Cc: vfialko@marvell.com
>
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> Tested-by: Ting-Kai Ku <ting-kai.ku@intel.com>
> Acked-by: Ciara Power <ciara.power@intel.com>
> Acked-by: Kai Ji <kai.ji@intel.com>
> ---
> v3: check if the cryptodev are not of the same type
>
>  examples/ipsec-secgw/ipsec.c | 25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
> index f5cec4a928..b59576c049 100644
> --- a/examples/ipsec-secgw/ipsec.c
> +++ b/examples/ipsec-secgw/ipsec.c
> @@ -288,10 +288,21 @@ create_lookaside_session(struct ipsec_ctx
> *ipsec_ctx_lcore[],
>                 if (cdev_id =3D=3D RTE_CRYPTO_MAX_DEVS)
>                         cdev_id =3D ipsec_ctx->tbl[cdev_id_qp].id;
>                 else if (cdev_id !=3D ipsec_ctx->tbl[cdev_id_qp].id) {
> -                       RTE_LOG(ERR, IPSEC,
> -                                       "SA mapping to multiple cryptodev=
s
> is "
> -                                       "not supported!");
> -                       return -EINVAL;
> +                       struct rte_cryptodev_info dev_info_1, dev_info_2;
> +                       rte_cryptodev_info_get(cdev_id, &dev_info_1);
> +
>  rte_cryptodev_info_get(ipsec_ctx->tbl[cdev_id_qp].id,
> +                                       &dev_info_2);
> +                       if (dev_info_1.driver_id =3D=3D dev_info_2.driver=
_id) {
> +                               RTE_LOG(WARNING, IPSEC,
> +                                       "SA mapped to multiple cryptodevs
> for SPI %d\n",
> +                                       sa->spi);
> +
> +                       } else {
> +                               RTE_LOG(WARNING, IPSEC,
> +                                       "SA mapped to multiple cryptodevs
> of different types for SPI %d\n",
> +                                       sa->spi);
> +
> +                       }
>                 }
>
>                 /* Store per core queue pair information */
> @@ -908,7 +919,11 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct
> ipsec_ctx *ipsec_ctx,
>                         continue;
>                 }
>
> -               enqueue_cop(sa->cqp[ipsec_ctx->lcore_id], &priv->cop);
> +               if (likely(sa->cqp[ipsec_ctx->lcore_id]))
> +                       enqueue_cop(sa->cqp[ipsec_ctx->lcore_id],
> &priv->cop);
> +               else
> +                       RTE_LOG(ERR, IPSEC, "No CQP available for lcore
> %d\n",
> +                                       ipsec_ctx->lcore_id);
>         }
>  }
>
> --
> 2.34.1
>
>

--000000000000991506061250e9d7
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Recheck-request: iol-broadcom-Performance=
<div><br></div><div>This patch should not fail a performance test in CI - c=
hecking with a rerun now.=C2=A0</div></div><br><div class=3D"gmail_quote"><=
div dir=3D"ltr" class=3D"gmail_attr">On Mon, Feb 26, 2024 at 5:25=E2=80=AFA=
M Radu Nicolau &lt;<a href=3D"mailto:radu.nicolau@intel.com">radu.nicolau@i=
ntel.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D=
"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-le=
ft:1ex">There are use cases where a SA should be able to use different cryp=
todevs on<br>
different lcores, for example there can be cryptodevs with just 1 qp per VF=
.<br>
For this purpose this patch relaxes the check in create lookaside session f=
unction.<br>
Also add a check to verify that a CQP is available for the current lcore.<b=
r>
<br>
Fixes: a8ade12123c3 (&quot;examples/ipsec-secgw: create lookaside sessions =
at init&quot;)<br>
Cc: <a href=3D"mailto:stable@dpdk.org" target=3D"_blank">stable@dpdk.org</a=
><br>
Cc: <a href=3D"mailto:vfialko@marvell.com" target=3D"_blank">vfialko@marvel=
l.com</a><br>
<br>
Signed-off-by: Radu Nicolau &lt;<a href=3D"mailto:radu.nicolau@intel.com" t=
arget=3D"_blank">radu.nicolau@intel.com</a>&gt;<br>
Tested-by: Ting-Kai Ku &lt;<a href=3D"mailto:ting-kai.ku@intel.com" target=
=3D"_blank">ting-kai.ku@intel.com</a>&gt;<br>
Acked-by: Ciara Power &lt;<a href=3D"mailto:ciara.power@intel.com" target=
=3D"_blank">ciara.power@intel.com</a>&gt;<br>
Acked-by: Kai Ji &lt;<a href=3D"mailto:kai.ji@intel.com" target=3D"_blank">=
kai.ji@intel.com</a>&gt;<br>
---<br>
v3: check if the cryptodev are not of the same type<br>
<br>
=C2=A0examples/ipsec-secgw/ipsec.c | 25 ++++++++++++++++++++-----<br>
=C2=A01 file changed, 20 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c<br=
>
index f5cec4a928..b59576c049 100644<br>
--- a/examples/ipsec-secgw/ipsec.c<br>
+++ b/examples/ipsec-secgw/ipsec.c<br>
@@ -288,10 +288,21 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_=
lcore[],<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (cdev_id =3D=3D =
RTE_CRYPTO_MAX_DEVS)<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 cdev_id =3D ipsec_ctx-&gt;tbl[cdev_id_qp].id;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else if (cdev_id !=
=3D ipsec_ctx-&gt;tbl[cdev_id_qp].id) {<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0RTE_LOG(ERR, IPSEC,<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;SA =
mapping to multiple cryptodevs is &quot;<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;not=
 supported!&quot;);<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return -EINVAL;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0struct rte_cryptodev_info dev_info_1, dev_info_2;<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0rte_cryptodev_info_get(cdev_id, &amp;dev_info_1);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0rte_cryptodev_info_get(ipsec_ctx-&gt;tbl[cdev_id_qp].id,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&amp;dev_=
info_2);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0if (dev_info_1.driver_id =3D=3D dev_info_2.driver_id) {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_LOG(WARNING, IPSEC,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;SA =
mapped to multiple cryptodevs for SPI %d\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sa-&gt;sp=
i);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0} else {<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_LOG(WARNING, IPSEC,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&quot;SA =
mapped to multiple cryptodevs of different types for SPI %d\n&quot;,<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sa-&gt;sp=
i);<br>
+<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0}<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Store per core q=
ueue pair information */<br>
@@ -908,7 +919,11 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_=
ctx *ipsec_ctx,<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 continue;<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
<br>
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0enqueue_cop(sa-&gt;=
cqp[ipsec_ctx-&gt;lcore_id], &amp;priv-&gt;cop);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (likely(sa-&gt;c=
qp[ipsec_ctx-&gt;lcore_id]))<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0enqueue_cop(sa-&gt;cqp[ipsec_ctx-&gt;lcore_id], &amp;priv-&gt;cop=
);<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else<br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0RTE_LOG(ERR, IPSEC, &quot;No CQP available for lcore %d\n&quot;,<=
br>
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ipsec_ctx=
-&gt;lcore_id);<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }<br>
=C2=A0}<br>
<br>
-- <br>
2.34.1<br>
<br>
</blockquote></div><br clear=3D"all"><div><br></div></div>

--000000000000991506061250e9d7--