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 C354943C06 for ; Tue, 27 Feb 2024 14:28:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3E61406A2; Tue, 27 Feb 2024 14:28:53 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id 43BC240150; Tue, 27 Feb 2024 14:28:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709040532; x=1740576532; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6fh/XXXdnV3AK7tITFBGlGCONNMgRhd9y0XCKsG3tt8=; b=S7J/iDSNfp6h6H4sGA6FMI6pqCzPsjo1drYYCHxYn76HyynGpWwKLEM3 JhJ5EuRn0P3BKu6DcYc1Nv91vR/gPLpLvWnT517YmAfGuTKY75K2DKuNv VFzZP/5IZohP+BG5L86Dxaz2FjTgnoMbwr+SdiLOkPoO6yDhDmGVg72T3 w2xZxiZh4g0nRDRA3vaAfY1egEi/lkYz/sh3HMKxfpua05jpUnmTPl80z O9mUEtAGTJ9hCA9idrSn3WW83EGjwFc1mR/zpSx0lyt3VfYgzkd+IsNV+ xsvDieqo363+b3l0MLNNdgfuB0YC9w9GgmWiQn1d5Zj6xBjJhV4V3EumL Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="14800872" X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="14800872" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2024 05:28:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="7390850" Received: from silpixa00401455.ir.intel.com (HELO silpixa00400884.ir.intel.com) ([10.243.22.53]) by orviesa007.jf.intel.com with ESMTP; 27 Feb 2024 05:28:49 -0800 From: Radu Nicolau To: dev@dpdk.org Cc: anoobj@marvell.com, Radu Nicolau , stable@dpdk.org, vfialko@marvell.com, Ting-Kai Ku , Ciara Power , Kai Ji , Akhil Goyal Subject: [PATCH v4] examples/ipsec-secgw: fix cryptodev to SA mapping Date: Tue, 27 Feb 2024 13:28:46 +0000 Message-Id: <20240227132846.415698-1-radu.nicolau@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231211095349.9895-1-radu.nicolau@intel.com> References: <20231211095349.9895-1-radu.nicolau@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-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 Tested-by: Ting-Kai Ku Acked-by: Ciara Power Acked-by: Kai Ji --- v4: replaced plain if with RTE_ASSERT examples/ipsec-secgw/ipsec.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index f5cec4a928..c321108119 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 == 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; + 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 == 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,6 +919,7 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, continue; } + RTE_ASSERT(sa->cqp[ipsec_ctx->lcore_id] != NULL); enqueue_cop(sa->cqp[ipsec_ctx->lcore_id], &priv->cop); } } -- 2.34.1