Skip to contentSkip to conversation

crypto/cnxk: add max queue pairs limit devargs

PATCH Applied Ankur Dwivedi 2 participants 2 messages Sep 30, 2021 – Oct 16, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/cnxk: add max queue pairs limit devargs

Adds max queue pairs limit devargs for crypto cnxk driver. This can be used to set a limit on the number of maximum queue pairs supported by the device. The default value is 63.

---
 doc/guides/cryptodevs/cnxk.rst               | 15 +++++
 drivers/crypto/cnxk/cn10k_cryptodev.c        |  7 +++
 drivers/crypto/cnxk/cn9k_cryptodev.c         |  7 +++
 drivers/crypto/cnxk/cnxk_cryptodev.h         |  2 +
 drivers/crypto/cnxk/cnxk_cryptodev_devargs.c | 61 ++++++++++++++++++++
 drivers/crypto/cnxk/cnxk_cryptodev_ops.c     |  5 +-
 drivers/crypto/cnxk/meson.build              |  1 +
 7 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
doc/guides/cryptodevs/cnxk.rst +15 -0
index 752316fd37..85171a50a6 100644
@@ -158,6 +158,21 @@ Bind the CPT VF device to the vfio_pci driver:
     ./usertools/dpdk-devbind.py -u 0002:20:00.1
     ./usertools/dpdk-devbind.py -b vfio-pci 0002:20:00.1
 
+Runtime Config Options
+----------------------
+
+- ``Maximum queue pairs limit`` (default ``63``)
+
+   The number of maximum queue pairs supported by the device, can be limited
+   during runtime by using ``max_qps_limit`` ``devargs`` parameter.
+
+   For example::
+
+      -a 0002:20:00.1,max_qps_limit=4
+
+   With the above configuration, the number of maximum queue pairs supported
+   by the device is limited to 4.
+
 Debugging Options
 -----------------
 
drivers/crypto/cnxk/cn10k_cryptodev.c +7 -0
index 012eb0c051..869d322d9b 100644
@@ -68,6 +68,13 @@ cn10k_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		roc_cpt->pci_dev = pci_dev;
+
+		rc = cnxk_cpt_parse_devargs(dev->device->devargs, vf);
+		if (rc) {
+			plt_err("Failed to parse devargs rc=%d", rc);
+			goto pmd_destroy;
+		}
+
 		rc = roc_cpt_dev_init(roc_cpt);
 		if (rc) {
 			plt_err("Failed to initialize roc cpt rc=%d", rc);
drivers/crypto/cnxk/cn9k_cryptodev.c +7 -0
index 6b8cb01a12..54df06eec0 100644
@@ -68,6 +68,13 @@ cn9k_cpt_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 
 	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
 		roc_cpt->pci_dev = pci_dev;
+
+		rc = cnxk_cpt_parse_devargs(dev->device->devargs, vf);
+		if (rc) {
+			plt_err("Failed to parse devargs rc=%d", rc);
+			goto pmd_destroy;
+		}
+
 		rc = roc_cpt_dev_init(roc_cpt);
 		if (rc) {
 			plt_err("Failed to initialize roc cpt rc=%d", rc);
drivers/crypto/cnxk/cnxk_cryptodev.h +2 -0
index 8e051fa0fa..cfb9d291a9 100644
@@ -25,9 +25,11 @@ struct cnxk_cpt_vf {
 	struct rte_security_capability sec_caps[CNXK_SEC_MAX_CAPS];
 	uint64_t cnxk_fpm_iova[CNXK_AE_EC_ID_MAX];
 	struct roc_ae_ec_group *ec_grp[CNXK_AE_EC_ID_MAX];
+	uint16_t max_qps_limit;
 };
 
 uint64_t cnxk_cpt_default_ff_get(void);
 int cnxk_cpt_eng_grp_add(struct roc_cpt *roc_cpt);
+int cnxk_cpt_parse_devargs(struct rte_devargs *devargs, struct cnxk_cpt_vf *vf);
 
 #endif /* _CNXK_CRYPTODEV_H_ */
drivers/crypto/cnxk/cnxk_cryptodev_devargs.c new file +61 -0

61 lines not on this page · raw message

drivers/crypto/cnxk/cnxk_cryptodev_ops.c +4 -1
index 41d8fe49e1..e49f826225 100644
@@ -150,7 +150,10 @@ cnxk_cpt_dev_info_get(struct rte_cryptodev *dev,
 	struct cnxk_cpt_vf *vf = dev->data->dev_private;
 	struct roc_cpt *roc_cpt = &vf->cpt;
 
-	info->max_nb_queue_pairs = roc_cpt->nb_lf_avail;
+	info->max_nb_queue_pairs =
+		RTE_MIN(roc_cpt->nb_lf_avail, vf->max_qps_limit);
+	plt_cpt_dbg("max_nb_queue_pairs %u", info->max_nb_queue_pairs);
+
 	info->feature_flags = cnxk_cpt_default_ff_get();
 	info->capabilities = cnxk_crypto_capabilities_get(vf);
 	info->sym.max_nb_sessions = 0;
drivers/crypto/cnxk/meson.build +1 -0
index 437d208b5a..024109f7e9 100644
@@ -17,6 +17,7 @@ sources = files(
         'cn10k_ipsec.c',
         'cnxk_cryptodev.c',
         'cnxk_cryptodev_capabilities.c',
+        'cnxk_cryptodev_devargs.c',
         'cnxk_cryptodev_ops.c',
         'cnxk_cryptodev_sec.c',
 )
Signature · 1 line
2.28.0