[dpdk-dev] app/testpmd: add parameter to start forwarding sending

Message ID 1496007391-182136-1-git-send-email-pablo.de.lara.guarch@intel.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

De Lara Guarch, Pablo May 28, 2017, 9:36 p.m. UTC
  Add parameter to start forwarding sending first
a burst of packets, which is useful when testing
a loopback connection.

This was already implemented as an internal command,
but adding it as a parameter is interesting, as it
allows the user to test a loopback connection without
entering in the internal command line.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test-pmd/parameters.c             | 5 +++++
 app/test-pmd/testpmd.c                | 5 +++--
 app/test-pmd/testpmd.h                | 1 +
 doc/guides/testpmd_app_ug/run_app.rst | 4 ++++
 4 files changed, 13 insertions(+), 2 deletions(-)
  

Comments

Jingjing Wu June 7, 2017, 9:17 a.m. UTC | #1
> -----Original Message-----
> From: De Lara Guarch, Pablo
> Sent: Monday, May 29, 2017 5:37 AM
> To: Wu, Jingjing <jingjing.wu@intel.com>
> Cc: dev@dpdk.org; De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [PATCH] app/testpmd: add parameter to start forwarding sending
> 
> Add parameter to start forwarding sending first
> a burst of packets, which is useful when testing
> a loopback connection.
> 
> This was already implemented as an internal command,
> but adding it as a parameter is interesting, as it
> allows the user to test a loopback connection without
> entering in the internal command line.
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  app/test-pmd/parameters.c             | 5 +++++
>  app/test-pmd/testpmd.c                | 5 +++--
>  app/test-pmd/testpmd.h                | 1 +
>  doc/guides/testpmd_app_ug/run_app.rst | 4 ++++
>  4 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> index fbe6284..0da4172 100644
> --- a/app/test-pmd/parameters.c
> +++ b/app/test-pmd/parameters.c
> @@ -89,6 +89,7 @@ usage(char* progname)
>  	       "[--cmdline-file=FILENAME] "
>  #endif
>  	       "[--help|-h] | [--auto-start|-a] | ["
> +	       "--tx-first"

Just consider about the interactive mode.
If using command start, will it still call start_packet_forwarding(0)?
And if start tx_first, still call start_packet_forwarding(1)?

It may cause confused whether this argu "--tx-first" works.
If it only works for non-interactive, you'd better to comment it.


Thanks
Jingjing
  
De Lara Guarch, Pablo June 7, 2017, 1:20 p.m. UTC | #2
Hi Jingjing,

> -----Original Message-----
> From: Wu, Jingjing
> Sent: Wednesday, June 07, 2017 10:18 AM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org
> Subject: RE: [PATCH] app/testpmd: add parameter to start forwarding
> sending
> 
> 
> 
> > -----Original Message-----
> > From: De Lara Guarch, Pablo
> > Sent: Monday, May 29, 2017 5:37 AM
> > To: Wu, Jingjing <jingjing.wu@intel.com>
> > Cc: dev@dpdk.org; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>
> > Subject: [PATCH] app/testpmd: add parameter to start forwarding
> sending
> >
> > Add parameter to start forwarding sending first
> > a burst of packets, which is useful when testing
> > a loopback connection.
> >
> > This was already implemented as an internal command,
> > but adding it as a parameter is interesting, as it
> > allows the user to test a loopback connection without
> > entering in the internal command line.
> >
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > ---
> >  app/test-pmd/parameters.c             | 5 +++++
> >  app/test-pmd/testpmd.c                | 5 +++--
> >  app/test-pmd/testpmd.h                | 1 +
> >  doc/guides/testpmd_app_ug/run_app.rst | 4 ++++
> >  4 files changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > index fbe6284..0da4172 100644
> > --- a/app/test-pmd/parameters.c
> > +++ b/app/test-pmd/parameters.c
> > @@ -89,6 +89,7 @@ usage(char* progname)
> >  	       "[--cmdline-file=FILENAME] "
> >  #endif
> >  	       "[--help|-h] | [--auto-start|-a] | ["
> > +	       "--tx-first"
> 
> Just consider about the interactive mode.
> If using command start, will it still call start_packet_forwarding(0)?
> And if start tx_first, still call start_packet_forwarding(1)?
> 

If using the commands "start" and "start tx_first", the behaviour will remain the same.
The only behaviour that will change is the non-interactive forwarding mode,
and when using auto-start in interactive mode.

Do you think it should modify the behaviour of "start", in the command line,
so if "--tx-first" is passed, then it sends a burst regardless using "start" or "start tx_first"?

Thanks for the review!
Pablo

> It may cause confused whether this argu "--tx-first" works.
> If it only works for non-interactive, you'd better to comment it.
> 
> 
> Thanks
> Jingjing
  
Bruce Richardson June 7, 2017, 1:23 p.m. UTC | #3
On Wed, Jun 07, 2017 at 01:20:45PM +0000, De Lara Guarch, Pablo wrote:
> Hi Jingjing,
> 
> > -----Original Message-----
> > From: Wu, Jingjing
> > Sent: Wednesday, June 07, 2017 10:18 AM
> > To: De Lara Guarch, Pablo
> > Cc: dev@dpdk.org
> > Subject: RE: [PATCH] app/testpmd: add parameter to start forwarding
> > sending
> > 
> > 
> > 
> > > -----Original Message-----
> > > From: De Lara Guarch, Pablo
> > > Sent: Monday, May 29, 2017 5:37 AM
> > > To: Wu, Jingjing <jingjing.wu@intel.com>
> > > Cc: dev@dpdk.org; De Lara Guarch, Pablo
> > <pablo.de.lara.guarch@intel.com>
> > > Subject: [PATCH] app/testpmd: add parameter to start forwarding
> > sending
> > >
> > > Add parameter to start forwarding sending first
> > > a burst of packets, which is useful when testing
> > > a loopback connection.
> > >
> > > This was already implemented as an internal command,
> > > but adding it as a parameter is interesting, as it
> > > allows the user to test a loopback connection without
> > > entering in the internal command line.
> > >
> > > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> > > ---
> > >  app/test-pmd/parameters.c             | 5 +++++
> > >  app/test-pmd/testpmd.c                | 5 +++--
> > >  app/test-pmd/testpmd.h                | 1 +
> > >  doc/guides/testpmd_app_ug/run_app.rst | 4 ++++
> > >  4 files changed, 13 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
> > > index fbe6284..0da4172 100644
> > > --- a/app/test-pmd/parameters.c
> > > +++ b/app/test-pmd/parameters.c
> > > @@ -89,6 +89,7 @@ usage(char* progname)
> > >  	       "[--cmdline-file=FILENAME] "
> > >  #endif
> > >  	       "[--help|-h] | [--auto-start|-a] | ["
> > > +	       "--tx-first"
> > 
> > Just consider about the interactive mode.
> > If using command start, will it still call start_packet_forwarding(0)?
> > And if start tx_first, still call start_packet_forwarding(1)?
> > 
> 
> If using the commands "start" and "start tx_first", the behaviour will remain the same.
> The only behaviour that will change is the non-interactive forwarding mode,
> and when using auto-start in interactive mode.
> 
> Do you think it should modify the behaviour of "start", in the command line,
> so if "--tx-first" is passed, then it sends a burst regardless using "start" or "start tx_first"?
> 
> Thanks for the review!
> Pablo
> 
> > It may cause confused whether this argu "--tx-first" works.
> > If it only works for non-interactive, you'd better to comment it.
> > 
> > 
My 2c is that this flag should be only used for non-interactive mode,
and you get an error if it is used with -i flag. That should minimize any
confusion.

/Bruce
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index fbe6284..0da4172 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -89,6 +89,7 @@  usage(char* progname)
 	       "[--cmdline-file=FILENAME] "
 #endif
 	       "[--help|-h] | [--auto-start|-a] | ["
+	       "--tx-first"
 	       "--coremask=COREMASK --portmask=PORTMASK --numa "
 	       "--mbuf-size= | --total-num-mbufs= | "
 	       "--nb-cores= | --nb-ports= | "
@@ -674,6 +675,10 @@  launch_args_parse(int argc, char** argv)
 				printf("Auto-start selected\n");
 				auto_start = 1;
 			}
+			if (!strcmp(lgopts[opt_idx].name, "tx-first")) {
+				printf("Start TX first\n");
+				tx_first = 1;
+			}
 			if (!strcmp(lgopts[opt_idx].name,
 				    "eth-peers-configfile")) {
 				if (init_peer_eth_addrs(optarg) != 0)
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index d1041af..39a1225 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -95,6 +95,7 @@  uint16_t verbose_level = 0; /**< Silent by default. */
 /* use master core for command line ? */
 uint8_t interactive = 0;
 uint8_t auto_start = 0;
+uint8_t tx_first;
 char cmdline_filename[PATH_MAX] = {0};
 
 /*
@@ -2339,7 +2340,7 @@  main(int argc, char** argv)
 	if (interactive == 1) {
 		if (auto_start) {
 			printf("Start automatic packet forwarding\n");
-			start_packet_forwarding(0);
+			start_packet_forwarding(tx_first);
 		}
 		prompt();
 		pmd_test_exit();
@@ -2350,7 +2351,7 @@  main(int argc, char** argv)
 		int rc;
 
 		printf("No commandline core given, start packet forwarding\n");
-		start_packet_forwarding(0);
+		start_packet_forwarding(tx_first);
 		printf("Press enter to exit\n");
 		rc = read(0, &c, 1);
 		pmd_test_exit();
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index e6c43ba..348aa66 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -299,6 +299,7 @@  extern uint16_t nb_rx_queue_stats_mappings;
 extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */
 extern uint8_t  interactive;
 extern uint8_t  auto_start;
+extern uint8_t  tx_first;
 extern char cmdline_filename[PATH_MAX]; /**< offline commands file */
 extern uint8_t  numa_support; /**< set by "--numa" parameter */
 extern uint16_t port_topology; /**< set by "--port-topology" parameter */
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 2a43214..4171fcb 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -188,6 +188,10 @@  The commandline options are:
 
     Start forwarding on initialization.
 
+*   ``--tx-first``
+
+    Start forwarding, after sending a burst of packets first.
+
 *   ``--nb-cores=N``
 
     Set the number of forwarding cores,