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 D22F1436C8; Mon, 11 Dec 2023 10:54:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0823A40E72; Mon, 11 Dec 2023 10:54:06 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mails.dpdk.org (Postfix) with ESMTP id 2C13B402B2; Mon, 11 Dec 2023 10:54:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702288445; x=1733824445; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=dgxsTfc6DesCjE6vHMs8WvKCgHpi45QRDzkkKGKqcJI=; b=Ey5TlY7zZNM05vj+ek25GWgHtHhz+D34xUv64/GNppHgFiOhrxD+VRj5 lcgJtPnC+oZj8eeN15OTEqFUVkkrn0b9VaESlBcm/MUSy7uTuw0vtFU0P q/DgTiGoP0lExXkD8ir1U0w897rJi9oEqPtegkg2+DZ8mcKQNcNKJtcQE kWxu5teiimTa4NzejXdFbL2rm7gp65DzxFLTI4COieeQrwD5sDixBIKBr 4NnopPLi7uq8qCq0jEajxo7cQcwnm+uY6To0hUmM0Sh9vv5xrGUV1ZGlO +L+bapR/W78FxDr3iV2NkfAJdYMrPiBfsBlI/juw1pYfmqSyEo8FkxYR/ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10920"; a="7979380" X-IronPort-AV: E=Sophos;i="6.04,267,1695711600"; d="scan'208";a="7979380" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Dec 2023 01:54:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10920"; a="838966523" X-IronPort-AV: E=Sophos;i="6.04,267,1695711600"; d="scan'208";a="838966523" Received: from silpixa00400884.ir.intel.com ([10.243.22.113]) by fmsmga008.fm.intel.com with ESMTP; 11 Dec 2023 01:54:01 -0800 From: Radu Nicolau To: Radu Nicolau , Akhil Goyal Cc: dev@dpdk.org, ciara.power@intel.com, ting-kai.ku@intel.com, stable@dpdk.org, vfialko@marvell.com Subject: [PATCH] examples/ipsec-secgw: fix cryptodev to SA mapping Date: Mon, 11 Dec 2023 09:53:49 +0000 Message-Id: <20231211095349.9895-1-radu.nicolau@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- examples/ipsec-secgw/ipsec.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index f5cec4a928..593eab4e73 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -288,10 +288,9 @@ create_lookaside_session(struct ipsec_ctx *ipsec_ctx_lcore[], if (cdev_id == RTE_CRYPTO_MAX_DEVS) cdev_id = ipsec_ctx->tbl[cdev_id_qp].id; else if (cdev_id != ipsec_ctx->tbl[cdev_id_qp].id) { - RTE_LOG(ERR, IPSEC, - "SA mapping to multiple cryptodevs is " - "not supported!"); - return -EINVAL; + RTE_LOG(WARNING, IPSEC, + "SA mapped to multiple cryptodevs for SPI %d\n", + sa->spi); } /* Store per core queue pair information */ @@ -908,7 +907,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 (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.25.1