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 A10EB43BA2; Fri, 23 Feb 2024 12:01:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8AEBD402ED; Fri, 23 Feb 2024 12:01:24 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by mails.dpdk.org (Postfix) with ESMTP id 3AE9B402E4; Fri, 23 Feb 2024 12:01:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708686084; x=1740222084; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=egObfLJB2wfYkBPibhdPZupAsPqF8OrmU7eHxMqLSaA=; b=Ju/4iMTk9E9QA+ggZ0jwAwkzBgn/ZXrnrMYze1CFRn6T6g2igvHkC7Hr k1ZLWCPItMBLoXYtN/Pr2DQke3G7CCglGDNkYmngnMEUxVgYyGVwEwGiZ WGOYgoR52eWX0ylkitSqwEAhhO7lb6/j5zUWjXptgDTVZsXORlFO4iV9j fkL1b7YjRm2OUjLfID8lNfJgZmSw4myL7mPoaiItJOsIDD5imTeecefB3 fgGDs/q8l4Xf32bpb29AkccsywWBqHfFXtXeVoy8GVusUldzI5BbKauPe j25iePXkqHHB+45t+NR/j3F5rN0+FT0Wr3BWwPLxAroeT+w64MJJ4xnWy w==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="14405961" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="14405961" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2024 03:01:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="5879967" Received: from silpixa00401455.ir.intel.com (HELO silpixa00400884.ir.intel.com) ([10.243.22.53]) by fmviesa010.fm.intel.com with ESMTP; 23 Feb 2024 03:01:20 -0800 From: Radu Nicolau To: dev@dpdk.org Cc: Radu Nicolau , stable@dpdk.org, vfialko@marvell.com, Ting-Kai Ku , Ciara Power , Kai Ji , Akhil Goyal Subject: [PATCH v2] examples/ipsec-secgw: fix cryptodev to SA mapping Date: Fri, 23 Feb 2024 11:01:12 +0000 Message-Id: <20240223110113.122947-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: 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 Signed-off-by: Radu Nicolau Tested-by: Ting-Kai Ku Signed-off-by: Radu Nicolau Acked-by: Ciara Power Acked-by: Kai Ji --- v2: add likely to CQP available branch 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..7bb9646736 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 (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