From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7684B43BFA; Tue, 27 Feb 2024 00:03:11 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 02E124028C; Tue, 27 Feb 2024 00:03:11 +0100 (CET) Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com [209.85.161.41]) by mails.dpdk.org (Postfix) with ESMTP id 9AADE4028C for ; Tue, 27 Feb 2024 00:03:08 +0100 (CET) Received: by mail-oo1-f41.google.com with SMTP id 006d021491bc7-59fd69bab3bso1542133eaf.2 for ; 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=sRtCjSyRXRJJ+LBYAQwnmEabIRFtxgjy7gQeYu/WopZxMoM4tCiWgCfilcHixLBPDW 3+n6I2a+9TIOabWc3TnPBc6RO8JDN4UXfSLL+V8IhnkJHn9LT74W9M71iuZPRLRw9TRW Pnvy0oxJ9+vx/M+qAixDOpsgHIwQUzx16UVn5OwF20hNDavJRaRIzhwam422/RLBMnul jqq2FnkQ1ogDs/IZ8MoCwCcvJHoMIKo0ARFan9VGWa9isKlW682A8m4Pmoo6Dncl1RAo KCIlkY/CUbbLDKUwOtg3RsQUTZxLy6RyBlWPn06C2rQ/Y+wy0mVdmYDRG84ywSMK/yOq au+Q== X-Gm-Message-State: AOJu0Yz6I/9mwKzNiMARcCM4NPigKXEZvUcHTY3IX9g0ftJ0Df6L9SGp uIDr6YYBeWeyfWfnSg40SqutlVLdNBCvpK1Qf6k6elZMdhXPwTi5OmcxRtU2Cz4MAQDs7HNIei0 f8SogdxId1jmAhXi9C8lWYPW2fbmQRaYGkzwt90WLvsQr3svtBdgjHg== 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 Date: Mon, 26 Feb 2024 18:02:55 -0500 Message-ID: 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 , Ciara Power , Kai Ji , Akhil Goyal , Radu Nicolau Content-Type: multipart/alternative; boundary="000000000000991506061250e9d7" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-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 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 > Tested-by: Ting-Kai Ku > Acked-by: Ciara Power > Acked-by: Kai Ji > --- > 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
Recheck-request: iol-broadcom-Performance=

This patch should not fail a performance test in CI - c= hecking with a rerun now.=C2=A0

<= div dir=3D"ltr" class=3D"gmail_attr">On Mon, Feb 26, 2024 at 5:25=E2=80=AFA= M Radu Nicolau <radu.nicolau@i= ntel.com> wrote:
There are use cases where a SA should be able to use different cryp= todevs 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 f= unction.
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@marvel= l.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

=C2=A0examples/ipsec-secgw/ipsec.c | 25 ++++++++++++++++++++-----
=C2=A01 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[],
=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)
=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->tbl[cdev_id_qp].id;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 else if (cdev_id != =3D ipsec_ctx->tbl[cdev_id_qp].id) {
-=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,
-=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"SA = mapping to multiple cryptodevs is "
-=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"not= supported!");
-=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;
+=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;
+=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, &dev_info_1);
+=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->tbl[cdev_id_qp].id,
+=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&dev_= info_2);
+=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) {
+=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,
+=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"SA = mapped to multiple cryptodevs for SPI %d\n",
+=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->sp= i);
+
+=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 {
+=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,
+=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"SA = mapped to multiple cryptodevs of different types for SPI %d\n",
+=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->sp= i);
+
+=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 }

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Store per core q= ueue pair information */
@@ -908,7 +919,11 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_= ctx *ipsec_ctx,
=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;
=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=A0enqueue_cop(sa->= cqp[ipsec_ctx->lcore_id], &priv->cop);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (likely(sa->c= qp[ipsec_ctx->lcore_id]))
+=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->cqp[ipsec_ctx->lcore_id], &priv->cop= );
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else
+=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, "No CQP available for lcore %d\n",<= 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= ->lcore_id);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0}

--
2.34.1



--000000000000991506061250e9d7--