[dpdk-dev,RFC,3/3] app/testpmd: a parameter to set max queue per VF

Message ID 1501529240-64181-4-git-send-email-wenzhuo.lu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Wenzhuo Lu July 31, 2017, 7:27 p.m. UTC
  Add a parameter in testpmd CLI. This parameter is used
to set the max queue number per VF.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 app/test-pmd/parameters.c | 33 ++++++++++++++++++++++++++++++++-
 app/test-pmd/testpmd.c    |  2 ++
 app/test-pmd/testpmd.h    |  1 +
 3 files changed, 35 insertions(+), 1 deletion(-)
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 2f7f70f..2dd806d 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -100,7 +100,7 @@ 
 	       "--rss-ip | --rss-udp | "
 	       "--rxpt= | --rxht= | --rxwt= | --rxfreet= | "
 	       "--txpt= | --txht= | --txwt= | --txfreet= | "
-	       "--txrst= | --txqflags= ]\n",
+	       "--txrst= | --txqflags= | --vf-max-queue= ]\n",
 	       progname);
 #ifdef RTE_LIBRTE_CMDLINE
 	printf("  --interactive: run in interactive mode.\n");
@@ -216,6 +216,8 @@ 
 	       "disable print of designated event or all of them.\n");
 	printf("  --flow-isolate-all: "
 	       "requests flow API isolated mode on all ports at initialization time.\n");
+	printf("  --vf-max-queue=N: set the maximum queue number per VF "
+	       "(N: positive integer).\n");
 }
 
 #ifdef RTE_LIBRTE_CMDLINE
@@ -638,6 +640,7 @@ 
 		{ "no-rmv-interrupt",		0, 0, 0 },
 		{ "print-event",		1, 0, 0 },
 		{ "mask-event",			1, 0, 0 },
+		{ "vf-max-queue",		1, 0, 0 },
 		{ 0, 0, 0, 0 },
 	};
 
@@ -1133,3 +1136,31 @@ 
 		}
 	}
 }
+
+void
+pre_launch_args_parse(int argc, char **argv)
+{
+	int i;
+	char *tmp;
+	int nb_queue = 0;
+
+	/**
+	 * Don't want to check the first string.
+	 * It should not be a parameter.
+	 */
+	for (i = 1; i < argc; i++) {
+		tmp = *(argv + i);
+		if (!strncmp(tmp, "--vf-max-queue=", 15)) {
+			tmp += 15;
+			nb_queue = atoi(tmp);
+			if (nb_queue > 0)
+				g_max_queue_number_per_vf = nb_queue;
+			else
+				rte_exit(EXIT_FAILURE,
+					 "vf-max-queue must be > 0\n");
+
+			/* delete it if more than 1 patameters to check */
+			break;
+		}
+	}
+}
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index e754d12..b374f38 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2289,6 +2289,8 @@  uint8_t port_is_bonding_slave(portid_t slave_pid)
 	signal(SIGINT, signal_handler);
 	signal(SIGTERM, signal_handler);
 
+	pre_launch_args_parse(argc, argv);
+
 	diag = rte_eal_init(argc, argv);
 	if (diag < 0)
 		rte_panic("Cannot init EAL\n");
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index c9d7739..8d0e72b 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -650,6 +650,7 @@  void port_rss_hash_key_update(portid_t port_id, char rss_type[],
 uint8_t *open_ddp_package_file(const char *file_path, uint32_t *size);
 int save_ddp_package_file(const char *file_path, uint8_t *buf, uint32_t size);
 int close_ddp_package_file(uint8_t *buf);
+void pre_launch_args_parse(int argc, char **argv);
 
 enum print_warning {
 	ENABLED_WARN = 0,