[1/1] examples/ipsec-secgw: add option for descriptors per QP

Message ID 20220609130129.210099-1-vfialko@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [1/1] examples/ipsec-secgw: add option for descriptors per QP |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Volodymyr Fialko June 9, 2022, 1:01 p.m. UTC
  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(-)
  

Comments

Anoob Joseph June 10, 2022, 6:21 a.m. UTC | #1
> 
> 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>

Acked-by: Anoob Joseph <anoobj@marvell.com>
  
Akhil Goyal June 15, 2022, 3:15 p.m. UTC | #2
> > 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>
> 
> Acked-by: Anoob Joseph <anoobj@marvell.com>

Acked-by: Akhil Goyal <gakhil@marvell.com>

Applied to dpdk-next-crypto
  

Patch

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);