DPDK patches and discussions
 help / color / mirror / Atom feed
From: Volodymyr Fialko <vfialko@marvell.com>
To: <dev@dpdk.org>, Radu Nicolau <radu.nicolau@intel.com>,
	Akhil Goyal <gakhil@marvell.com>
Cc: <jerinj@marvell.com>, <anoobj@marvell.com>,
	Volodymyr Fialko <vfialko@marvell.com>
Subject: [PATCH 1/1] examples/ipsec-secgw: add option for descriptors per QP
Date: Thu, 9 Jun 2022 15:01:29 +0200	[thread overview]
Message-ID: <20220609130129.210099-1-vfialko@marvell.com> (raw)

Added option to configure number of queue pair descriptors via command
line (--desc-nb NUMBER_OF_DESC).

When the crypto processing takes longer durations, small queue pair size
would result in cryptodev enqueue failures. Larger queue pair size would
allow more packets to stay in flight simultaneously and reduce enqueue
failures.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 doc/guides/sample_app_ug/ipsec_secgw.rst |  4 ++++
 examples/ipsec-secgw/ipsec-secgw.c       | 19 ++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/doc/guides/sample_app_ug/ipsec_secgw.rst b/doc/guides/sample_app_ug/ipsec_secgw.rst
index 94197a34f0..2529c95953 100644
--- a/doc/guides/sample_app_ug/ipsec_secgw.rst
+++ b/doc/guides/sample_app_ug/ipsec_secgw.rst
@@ -151,6 +151,7 @@ The application has a number of command line options::
                         --reassemble NUM
                         --mtu MTU
                         --frag-ttl FRAG_TTL_NS
+                        --desc-nb NUMBER_OF_DESC
 
 Where:
 
@@ -258,6 +259,9 @@ Where:
     By default, vector pool size depeneds on packet pool size
     and size of each vector.
 
+*   ``--desc-nb NUMBER_OF_DESC``: Number of descriptors per queue pair.
+    Default value: 2048.
+
 The mapping of lcores to port/queues is similar to other l3fwd applications.
 
 For example, given the following command line to run application in poll mode::
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 25255e053c..146222a1ec 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -62,7 +62,6 @@ volatile bool force_quit;
 
 #define MEMPOOL_CACHE_SIZE 256
 
-#define CDEV_QUEUE_DESC 2048
 #define CDEV_MAP_ENTRIES 16384
 #define CDEV_MP_CACHE_SZ 64
 #define CDEV_MP_CACHE_MULTIPLIER 1.5 /* from rte_mempool.c */
@@ -78,6 +77,11 @@ volatile bool force_quit;
 static uint16_t nb_rxd = IPSEC_SECGW_RX_DESC_DEFAULT;
 static uint16_t nb_txd = IPSEC_SECGW_TX_DESC_DEFAULT;
 
+/*
+ * Configurable number of descriptors per queue pair
+ */
+static uint32_t qp_desc_nb = 2048;
+
 #define ETHADDR_TO_UINT64(addr) __BYTES_TO_UINT64( \
 		(addr)->addr_bytes[0], (addr)->addr_bytes[1], \
 		(addr)->addr_bytes[2], (addr)->addr_bytes[3], \
@@ -113,6 +117,7 @@ struct flow_info flow_info_tbl[RTE_MAX_ETHPORTS];
 #define CMD_LINE_OPT_VECTOR_TIMEOUT	"vector-tmo"
 #define CMD_LINE_OPT_VECTOR_POOL_SZ	"vector-pool-sz"
 #define CMD_LINE_OPT_PER_PORT_POOL	"per-port-pool"
+#define CMD_LINE_OPT_QP_DESC_NB		"desc-nb"
 
 #define CMD_LINE_ARG_EVENT	"event"
 #define CMD_LINE_ARG_POLL	"poll"
@@ -142,6 +147,7 @@ enum {
 	CMD_LINE_OPT_VECTOR_TIMEOUT_NUM,
 	CMD_LINE_OPT_VECTOR_POOL_SZ_NUM,
 	CMD_LINE_OPT_PER_PORT_POOL_NUM,
+	CMD_LINE_OPT_QP_DESC_NB_NUM,
 };
 
 static const struct option lgopts[] = {
@@ -160,6 +166,7 @@ static const struct option lgopts[] = {
 	{CMD_LINE_OPT_VECTOR_TIMEOUT, 1, 0, CMD_LINE_OPT_VECTOR_TIMEOUT_NUM},
 	{CMD_LINE_OPT_VECTOR_POOL_SZ, 1, 0, CMD_LINE_OPT_VECTOR_POOL_SZ_NUM},
 	{CMD_LINE_OPT_PER_PORT_POOL, 0, 0, CMD_LINE_OPT_PER_PORT_POOL_NUM},
+	{CMD_LINE_OPT_QP_DESC_NB, 1, 0, CMD_LINE_OPT_QP_DESC_NB_NUM},
 	{NULL, 0, 0, 0}
 };
 
@@ -886,6 +893,7 @@ print_usage(const char *prgname)
 		" [--event-vector]"
 		" [--vector-size SIZE]"
 		" [--vector-tmo TIMEOUT in ns]"
+		" [--" CMD_LINE_OPT_QP_DESC_NB " NUMBER_OF_DESC]"
 		"\n\n"
 		"  -p PORTMASK: Hexadecimal bitmask of ports to configure\n"
 		"  -P : Enable promiscuous mode\n"
@@ -948,6 +956,8 @@ print_usage(const char *prgname)
 		"  --" CMD_LINE_OPT_PER_PORT_POOL " Enable per port mbuf pool\n"
 		"  --" CMD_LINE_OPT_VECTOR_POOL_SZ " Vector pool size\n"
 		"                    (default value is based on mbuf count)\n"
+		"  --" CMD_LINE_OPT_QP_DESC_NB " DESC_NB"
+		": Number of descriptors per queue pair (default value: 2048)\n"
 		"\n",
 		prgname);
 }
@@ -1341,6 +1351,9 @@ parse_args(int32_t argc, char **argv, struct eh_conf *eh_conf)
 		case CMD_LINE_OPT_PER_PORT_POOL_NUM:
 			per_port_pool = 1;
 			break;
+		case CMD_LINE_OPT_QP_DESC_NB_NUM:
+			qp_desc_nb = parse_decimal(optarg);
+			break;
 		default:
 			print_usage(prgname);
 			return -1;
@@ -1658,7 +1671,7 @@ cryptodevs_init(uint16_t req_queue_num)
 			rte_panic("Failed to initialize cryptodev %u\n",
 					cdev_id);
 
-		qp_conf.nb_descriptors = CDEV_QUEUE_DESC;
+		qp_conf.nb_descriptors = qp_desc_nb;
 		qp_conf.mp_session =
 			socket_ctx[dev_conf.socket_id].session_pool;
 		qp_conf.mp_session_private =
@@ -2543,7 +2556,7 @@ calculate_nb_mbufs(uint16_t nb_ports, uint16_t nb_crypto_qp, uint32_t nb_rxq,
 			nb_ports * nb_lcores * MAX_PKT_BURST +
 			nb_ports * nb_txq * nb_txd +
 			nb_lcores * MEMPOOL_CACHE_SIZE +
-			nb_crypto_qp * CDEV_QUEUE_DESC +
+			nb_crypto_qp * qp_desc_nb +
 			nb_lcores * frag_tbl_sz *
 			FRAG_TBL_BUCKET_ENTRIES),
 		       8192U);
-- 
2.25.1


             reply	other threads:[~2022-06-09 13:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 13:01 Volodymyr Fialko [this message]
2022-06-10  6:21 ` Anoob Joseph
2022-06-15 15:15   ` Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220609130129.210099-1-vfialko@marvell.com \
    --to=vfialko@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=radu.nicolau@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).