[dpdk-dev,3/5] app/testpmd: add command line option for multiseg

Message ID 20171123120804.143897-4-shahafs@mellanox.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Shahaf Shuler Nov. 23, 2017, 12:08 p.m. UTC
  This patch enables multi segment send Tx offloads from the command line.

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
---
 app/test-pmd/parameters.c             | 8 ++++++++
 app/test-pmd/testpmd.c                | 4 ++++
 app/test-pmd/testpmd.h                | 1 +
 doc/guides/testpmd_app_ug/run_app.rst | 4 ++++
 4 files changed, 17 insertions(+)
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 1a145c387..8a68a39ea 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -214,6 +214,8 @@  usage(char* progname)
 	       "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("  --enable-multiseg: "
+	       "enables multi segment send Tx offload on all ports.\n");
 }
 
 #ifdef RTE_LIBRTE_CMDLINE
@@ -566,6 +568,8 @@  launch_args_parse(int argc, char** argv)
 	enum { TX, RX };
 	/* Default Rx offloads for all ports. */
 	uint64_t rx_offloads = rx_mode.offloads;
+	/* Default Tx offloads for all ports. */
+	uint64_t tx_offloads = tx_mode.offloads;
 
 	static struct option lgopts[] = {
 		{ "help",			0, 0, 0 },
@@ -642,6 +646,7 @@  launch_args_parse(int argc, char** argv)
 		{ "no-rmv-interrupt",		0, 0, 0 },
 		{ "print-event",		1, 0, 0 },
 		{ "mask-event",			1, 0, 0 },
+		{ "enable-multiseg",		0, 0, 0 },
 		{ 0, 0, 0, 0 },
 	};
 
@@ -1115,6 +1120,8 @@  launch_args_parse(int argc, char** argv)
 					rte_exit(EXIT_FAILURE,
 						 "invalid mask-event argument\n");
 				}
+			if (!strcmp(lgopts[opt_idx].name, "enable-multiseg"))
+				tx_offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
 
 			break;
 		case 'h':
@@ -1131,4 +1138,5 @@  launch_args_parse(int argc, char** argv)
 
 	/* Set offload configuration from command line parameters. */
 	rx_mode.offloads = rx_offloads;
+	tx_mode.offloads = tx_offloads;
 }
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a97edcadd..2550677c3 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -339,6 +339,8 @@  struct rte_eth_rxmode rx_mode = {
 	.ignore_offload_bitfield = 1, /**< Use rte_eth_rxq_conf offloads API */
 };
 
+struct rte_eth_txmode tx_mode;
+
 struct rte_fdir_conf fdir_conf = {
 	.mode = RTE_FDIR_MODE_NONE,
 	.pballoc = RTE_FDIR_PBALLOC_64K,
@@ -599,6 +601,8 @@  init_config(void)
 
 	RTE_ETH_FOREACH_DEV(pid) {
 		port = &ports[pid];
+		/* Apply default Tx configuration for all ports */
+		port->dev_conf.txmode = tx_mode;
 		rte_eth_dev_info_get(pid, &port->dev_info);
 
 		if (numa_support) {
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 6af70e02a..8e572704e 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -415,6 +415,7 @@  extern portid_t fwd_ports_ids[RTE_MAX_ETHPORTS];
 extern struct rte_port *ports;
 
 extern struct rte_eth_rxmode rx_mode;
+extern struct rte_eth_txmode tx_mode;
 extern uint64_t rss_hf;
 
 extern queueid_t nb_rxq;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index cb94582b9..b21a1fe8a 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -497,3 +497,7 @@  The commandline options are:
     configured flow rules only (see flow command).
 
     Ports that do not support this mode are automatically discarded.
+
+*   ``--enable-multiseg``
+
+    Enables multi segment send Tx offload on all ports.