./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
-----------------
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);
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);
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_ */
--- /dev/null
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#include <rte_devargs.h>
+
+#include "cnxk_cryptodev.h"
+
+#define CNXK_MAX_QPS_LIMIT "max_qps_limit"
+#define CNXK_MAX_QPS_LIMIT_MIN 1
+#define CNXK_MAX_QPS_LIMIT_MAX (ROC_CPT_MAX_LFS - 1)
+
+static int
+parse_max_qps_limit(const char *key, const char *value, void *extra_args)
+{
+ RTE_SET_USED(key);
+ uint32_t val;
+
+ val = atoi(value);
+
+ if (val < CNXK_MAX_QPS_LIMIT_MIN || val > CNXK_MAX_QPS_LIMIT_MAX)
+ return -EINVAL;
+
+ *(uint16_t *)extra_args = val;
+
+ return 0;
+}
+
+int
+cnxk_cpt_parse_devargs(struct rte_devargs *devargs, struct cnxk_cpt_vf *vf)
+{
+ uint16_t max_qps_limit = CNXK_MAX_QPS_LIMIT_MAX;
+ struct rte_kvargs *kvlist;
+ int rc;
+
+ if (devargs == NULL)
+ goto null_devargs;
+
+ kvlist = rte_kvargs_parse(devargs->args, NULL);
+ if (kvlist == NULL)
+ goto exit;
+
+ rc = rte_kvargs_process(kvlist, CNXK_MAX_QPS_LIMIT,
+ &parse_max_qps_limit, &max_qps_limit);
+ if (rc < 0) {
+ plt_err("max_qps_limit should in the range <%d-%d>",
+ CNXK_MAX_QPS_LIMIT_MIN, CNXK_MAX_QPS_LIMIT_MAX);
+ rte_kvargs_free(kvlist);
+ goto exit;
+ }
+ rte_kvargs_free(kvlist);
+
+null_devargs:
+ vf->max_qps_limit = max_qps_limit;
+ return 0;
+
+exit:
+ return -EINVAL;
+}
+
+RTE_PMD_REGISTER_PARAM_STRING(crypto_cnxk, CNXK_MAX_QPS_LIMIT "=<1-63>");
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;
'cn10k_ipsec.c',
'cnxk_cryptodev.c',
'cnxk_cryptodev_capabilities.c',
+ 'cnxk_cryptodev_devargs.c',
'cnxk_cryptodev_ops.c',
'cnxk_cryptodev_sec.c',
)