From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id B9233A0555;
	Thu, 20 Feb 2020 09:05:08 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 45A4C1BFFA;
	Thu, 20 Feb 2020 09:03:05 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 6EA211C013
 for <dev@dpdk.org>; Thu, 20 Feb 2020 09:03:02 +0100 (CET)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 01K81JMv016880; Thu, 20 Feb 2020 00:03:01 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-type; s=pfpt0818; bh=SWljHSTI8EyiKAcZJT39xoB6mPI5oEE/qi3K1cbUkFo=;
 b=xIUrjmYHjceEbY7K3hFcS2dfDJb7DrWnniAtGQnL8uknnW9asZGqpsivlyjNfazKoSHH
 IUrhY3LlpR6ieHarO96UE9ssWcDHC3gGI5eIZxVKRb3ED/OmufQGS2mzvgohpjxwyfjJ
 gZjSUmyCFRyotKivCqyhYW0nM557JiVu50JuUJDhq5sL+i7bGOT3KHtJf8sU0ALp4FbG
 LOrzOc+XyRxttTspnkiQ5ncaWOtVn8SpA8N8d73TxGNJN1p7dWt3HS5zx2PwJb7ivQgi
 6TZ0PtFqC2IiaQ9DPk9JqCcbx3DciyQzkP1NJ7cVSR7+EozGIRW5SU9bOJJLXaALoTOc Bw== 
Received: from sc-exch03.marvell.com ([199.233.58.183])
 by mx0a-0016f401.pphosted.com with ESMTP id 2y8ubhefm4-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Thu, 20 Feb 2020 00:03:01 -0800
Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH03.marvell.com
 (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 20 Feb
 2020 00:03:00 -0800
Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com
 (10.93.176.83) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Thu, 20 Feb 2020 00:03:00 -0800
Received: from luke.marvell.com (unknown [10.95.130.24])
 by maili.marvell.com (Postfix) with ESMTP id 70A9E3F7040;
 Thu, 20 Feb 2020 00:02:57 -0800 (PST)
From: Lukasz Bartosik <lbartosik@marvell.com>
To: Akhil Goyal <akhil.goyal@nxp.com>, Radu Nicolau <radu.nicolau@intel.com>, 
 Thomas Monjalon <thomas@monjalon.net>
CC: Jerin Jacob <jerinj@marvell.com>, Narayana Prasad <pathreya@marvell.com>, 
 Ankur Dwivedi <adwivedi@marvell.com>, Anoob Joseph <anoobj@marvell.com>,
 Archana Muniganti <marchana@marvell.com>, Tejasree Kondoj
 <ktejasree@marvell.com>, Vamsi Attunuru <vattunuru@marvell.com>,
 "Konstantin Ananyev" <konstantin.ananyev@intel.com>, <dev@dpdk.org>
Date: Thu, 20 Feb 2020 09:02:07 +0100
Message-ID: <1582185727-6749-16-git-send-email-lbartosik@marvell.com>
X-Mailer: git-send-email 2.7.4
In-Reply-To: <1582185727-6749-1-git-send-email-lbartosik@marvell.com>
References: <1580824721-21527-1-git-send-email-lbartosik@marvell.com>
 <1582185727-6749-1-git-send-email-lbartosik@marvell.com>
MIME-Version: 1.0
Content-Type: text/plain
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572
 definitions=2020-02-20_02:2020-02-19,
 2020-02-20 signatures=0
Subject: [dpdk-dev] [PATCH v4 15/15] examples/ipsec-secgw: reserve crypto
	queues in event mode
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Reserve minimum number of crypto queues equal to number of ports.
This is to fulfill inline protocol offload requirements.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
---
 examples/ipsec-secgw/ipsec-secgw.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 341e7b4..982d00b 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1919,7 +1919,7 @@ check_cryptodev_mask(uint8_t cdev_id)
 }
 
 static uint16_t
-cryptodevs_init(void)
+cryptodevs_init(uint16_t req_queue_num)
 {
 	struct rte_cryptodev_config dev_conf;
 	struct rte_cryptodev_qp_conf qp_conf;
@@ -1982,6 +1982,7 @@ cryptodevs_init(void)
 			i++;
 		}
 
+		qp = RTE_MIN(max_nb_qps, RTE_MAX(req_queue_num, qp));
 		if (qp == 0)
 			continue;
 
@@ -2726,7 +2727,16 @@ main(int32_t argc, char **argv)
 
 	sess_sz = max_session_size();
 
-	nb_crypto_qp = cryptodevs_init();
+	/*
+	 * In event mode request minimum number of crypto queues
+	 * to be reserved equal to number of ports.
+	 */
+	if (eh_conf->mode == EH_PKT_TRANSFER_MODE_EVENT)
+		nb_crypto_qp = rte_eth_dev_count_avail();
+	else
+		nb_crypto_qp = 0;
+
+	nb_crypto_qp = cryptodevs_init(nb_crypto_qp);
 
 	if (nb_bufs_in_pool == 0) {
 		RTE_ETH_FOREACH_DEV(portid) {
-- 
2.7.4