Updated device_ops test to configure the device with user specific arguments. Fix handling unsupported values for queue_pairs and queue_size
Fixes: c0e871657d6a ("app/mldev: support queue pairs and size") Cc: sta...@dpdk.org Signed-off-by: Srikanth Yalavarthi <syalavar...@marvell.com> --- app/test-mldev/test_common.c | 10 ++++++++++ app/test-mldev/test_device_ops.c | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/test-mldev/test_common.c b/app/test-mldev/test_common.c index 3cf1362285b..357a85a3126 100644 --- a/app/test-mldev/test_common.c +++ b/app/test-mldev/test_common.c @@ -106,6 +106,16 @@ ml_test_opt_check(struct ml_options *opt) return -EINVAL; } + if (opt->queue_pairs == 0) { + ml_err("Invalid option, queue_pairs = %d", opt->queue_pairs); + return -EINVAL; + } + + if (opt->queue_size == 0) { + ml_err("Invalid option, queue_size = %d", opt->queue_size); + return -EINVAL; + } + return 0; } diff --git a/app/test-mldev/test_device_ops.c b/app/test-mldev/test_device_ops.c index 81b3ca18f36..dacc0232a2f 100644 --- a/app/test-mldev/test_device_ops.c +++ b/app/test-mldev/test_device_ops.c @@ -102,15 +102,17 @@ test_device_reconfigure(struct ml_test *test, struct ml_options *opt) if (ret != 0) return ret; - /* setup one queue pair with nb_desc = 1 */ - qp_conf.nb_desc = 1; - qp_conf.cb = NULL; + /* setup queue pairs with nb_user options */ + for (qp_id = 0; qp_id < opt->queue_pairs; qp_id++) { + qp_conf.nb_desc = opt->queue_size; + qp_conf.cb = NULL; - ret = rte_ml_dev_queue_pair_setup(opt->dev_id, qp_id, &qp_conf, opt->socket_id); - if (ret != 0) { - ml_err("Failed to setup ML device queue-pair, dev_id = %d, qp_id = %u\n", - opt->dev_id, qp_id); - goto error; + ret = rte_ml_dev_queue_pair_setup(opt->dev_id, qp_id, &qp_conf, opt->socket_id); + if (ret != 0) { + ml_err("Failed to setup ML device queue-pair, dev_id = %d, qp_id = %u\n", + opt->dev_id, qp_id); + goto error; + } } /* start device */ -- 2.41.0