[dpdk-dev] [PATCH v2 1/5] testpmd: add retry option

2016-06-08 Thread Wang, Zhihong


> -Original Message-
> From: De Lara Guarch, Pablo
> Sent: Tuesday, June 7, 2016 5:28 PM
> To: Wang, Zhihong ; dev at dpdk.org
> Cc: Ananyev, Konstantin ; Richardson, Bruce
> ; thomas.monjalon at 6wind.com
> Subject: RE: [PATCH v2 1/5] testpmd: add retry option
> 
> 
> 
> > -Original Message-
> > From: Wang, Zhihong
> > Sent: Wednesday, June 01, 2016 4:28 AM
> > To: dev at dpdk.org
> > Cc: Ananyev, Konstantin; Richardson, Bruce; De Lara Guarch, Pablo;
> > thomas.monjalon at 6wind.com; Wang, Zhihong
> > Subject: [PATCH v2 1/5] testpmd: add retry option
> >
> > This patch adds retry option in testpmd to prevent most packet losses.
> > It can be enabled by "set fwd  retry". All modes except rxonly
> > support this option.
> >
> > Adding retry mechanism expands test case coverage to support scenarios
> > where packet loss affects test results.
> >
> >
> > Signed-off-by: Zhihong Wang 
> 
> ...
> 
> > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> > @@ -249,8 +249,10 @@ set fwd
> >
> >  Set the packet forwarding mode::
> >
> > -   testpmd> set fwd (io|mac|mac_retry|macswap|flowgen| \
> > - rxonly|txonly|csum|icmpecho)
> > +   testpmd> set fwd (io|mac|macswap|flowgen| \
> > + rxonly|txonly|csum|icmpecho) (""|retry)
> > +
> > +``retry`` can be specified for forwarding engines except ``rx_only``.
> >
> >  The available information categories are:
> >
> > @@ -260,8 +262,6 @@ The available information categories are:
> >
> >  * ``mac``: Changes the source and the destination Ethernet addresses of
> > packets before forwarding them.
> >
> > -* ``mac_retry``: Same as "mac" forwarding mode, but includes retries if the
> > destination queue is full.
> > -
> >  * ``macswap``: MAC swap forwarding mode.
> >Swaps the source and the destination Ethernet addresses of packets
> before
> > forwarding them.
> >
> > @@ -392,7 +392,7 @@ Set number of packets per burst::
> >
> >  This is equivalent to the ``--burst command-line`` option.
> >
> > -In ``mac_retry`` forwarding mode, the transmit delay time and number of
> > retries can also be set::
> > +When retry is enabled, the transmit delay time and number of retries can
> > also be set::
> >
> > testpmd> set burst tx delay (micrseconds) retry (num)
> 
> Could you fix the typo "micrseconds" in this patch?

Sure ;)

> 
> >
> > --
> > 2.5.0
> 
> Apart from this,
> 
> Acked-by: Pablo de Lara 



[dpdk-dev] [PATCH v2 1/5] testpmd: add retry option

2016-06-07 Thread De Lara Guarch, Pablo


> -Original Message-
> From: Wang, Zhihong
> Sent: Wednesday, June 01, 2016 4:28 AM
> To: dev at dpdk.org
> Cc: Ananyev, Konstantin; Richardson, Bruce; De Lara Guarch, Pablo;
> thomas.monjalon at 6wind.com; Wang, Zhihong
> Subject: [PATCH v2 1/5] testpmd: add retry option
> 
> This patch adds retry option in testpmd to prevent most packet losses.
> It can be enabled by "set fwd  retry". All modes except rxonly
> support this option.
> 
> Adding retry mechanism expands test case coverage to support scenarios
> where packet loss affects test results.
> 
> 
> Signed-off-by: Zhihong Wang 

...

> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
> @@ -249,8 +249,10 @@ set fwd
> 
>  Set the packet forwarding mode::
> 
> -   testpmd> set fwd (io|mac|mac_retry|macswap|flowgen| \
> - rxonly|txonly|csum|icmpecho)
> +   testpmd> set fwd (io|mac|macswap|flowgen| \
> + rxonly|txonly|csum|icmpecho) (""|retry)
> +
> +``retry`` can be specified for forwarding engines except ``rx_only``.
> 
>  The available information categories are:
> 
> @@ -260,8 +262,6 @@ The available information categories are:
> 
>  * ``mac``: Changes the source and the destination Ethernet addresses of
> packets before forwarding them.
> 
> -* ``mac_retry``: Same as "mac" forwarding mode, but includes retries if the
> destination queue is full.
> -
>  * ``macswap``: MAC swap forwarding mode.
>Swaps the source and the destination Ethernet addresses of packets before
> forwarding them.
> 
> @@ -392,7 +392,7 @@ Set number of packets per burst::
> 
>  This is equivalent to the ``--burst command-line`` option.
> 
> -In ``mac_retry`` forwarding mode, the transmit delay time and number of
> retries can also be set::
> +When retry is enabled, the transmit delay time and number of retries can
> also be set::
> 
> testpmd> set burst tx delay (micrseconds) retry (num)

Could you fix the typo "micrseconds" in this patch?

> 
> --
> 2.5.0

Apart from this,

Acked-by: Pablo de Lara 



[dpdk-dev] [PATCH v2 1/5] testpmd: add retry option

2016-06-01 Thread Zhihong Wang
This patch adds retry option in testpmd to prevent most packet losses.
It can be enabled by "set fwd  retry". All modes except rxonly
support this option.

Adding retry mechanism expands test case coverage to support scenarios
where packet loss affects test results.


Signed-off-by: Zhihong Wang 
---
 app/test-pmd/Makefile   |   1 -
 app/test-pmd/cmdline.c  |  75 -
 app/test-pmd/config.c   |  47 +++-
 app/test-pmd/csumonly.c |  12 ++
 app/test-pmd/flowgen.c  |  12 ++
 app/test-pmd/icmpecho.c |  15 +++
 app/test-pmd/iofwd.c|  22 +++-
 app/test-pmd/macfwd-retry.c | 164 
 app/test-pmd/macfwd.c   |  13 +++
 app/test-pmd/macswap.c  |  12 ++
 app/test-pmd/testpmd.c  |   4 +-
 app/test-pmd/testpmd.h  |  11 +-
 app/test-pmd/txonly.c   |  12 ++
 doc/guides/testpmd_app_ug/run_app.rst   |   1 -
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  10 +-
 15 files changed, 227 insertions(+), 184 deletions(-)
 delete mode 100644 app/test-pmd/macfwd-retry.c

diff --git a/app/test-pmd/Makefile b/app/test-pmd/Makefile
index 40039a1..2a0b5a5 100644
--- a/app/test-pmd/Makefile
+++ b/app/test-pmd/Makefile
@@ -50,7 +50,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline.c
 SRCS-y += config.c
 SRCS-y += iofwd.c
 SRCS-y += macfwd.c
-SRCS-y += macfwd-retry.c
 SRCS-y += macswap.c
 SRCS-y += flowgen.c
 SRCS-y += rxonly.c
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c5b9479..0af3f05 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -246,8 +246,8 @@ static void cmd_help_long_parsed(void *parsed_result,
"Set number of packets per burst.\n\n"

"set burst tx delay (microseconds) retry (num)\n"
-   "Set the transmit delay time and number of retries"
-   " in mac_retry forwarding mode.\n\n"
+   "Set the transmit delay time and number of retries,"
+   " effective when retry is enabled.\n\n"

"set txpkts (x[,y]*)\n"
"Set the length of each segment of TXONLY"
@@ -4480,6 +4480,7 @@ static void cmd_set_fwd_mode_parsed(void *parsed_result,
 {
struct cmd_set_fwd_mode_result *res = parsed_result;

+   retry_enabled = 0;
set_pkt_forwarding_mode(res->mode);
 }

@@ -4525,6 +4526,74 @@ static void cmd_set_fwd_mode_init(void)
token_struct->string_data.str = token;
 }

+/* *** SET RETRY FORWARDING MODE *** */
+struct cmd_set_fwd_retry_mode_result {
+   cmdline_fixed_string_t set;
+   cmdline_fixed_string_t fwd;
+   cmdline_fixed_string_t mode;
+   cmdline_fixed_string_t retry;
+};
+
+static void cmd_set_fwd_retry_mode_parsed(void *parsed_result,
+   __attribute__((unused)) struct cmdline *cl,
+   __attribute__((unused)) void *data)
+{
+   struct cmd_set_fwd_retry_mode_result *res = parsed_result;
+
+   retry_enabled = 1;
+   set_pkt_forwarding_mode(res->mode);
+}
+
+cmdline_parse_token_string_t cmd_setfwd_retry_set =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result,
+   set, "set");
+cmdline_parse_token_string_t cmd_setfwd_retry_fwd =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result,
+   fwd, "fwd");
+cmdline_parse_token_string_t cmd_setfwd_retry_mode =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result,
+   mode,
+   "" /* defined at init */);
+cmdline_parse_token_string_t cmd_setfwd_retry_retry =
+   TOKEN_STRING_INITIALIZER(struct cmd_set_fwd_retry_mode_result,
+   retry, "retry");
+
+cmdline_parse_inst_t cmd_set_fwd_retry_mode = {
+   .f = cmd_set_fwd_retry_mode_parsed,
+   .data = NULL,
+   .help_str = NULL, /* defined at init */
+   .tokens = {
+   (void *)_setfwd_retry_set,
+   (void *)_setfwd_retry_fwd,
+   (void *)_setfwd_retry_mode,
+   (void *)_setfwd_retry_retry,
+   NULL,
+   },
+};
+
+static void cmd_set_fwd_retry_mode_init(void)
+{
+   char *modes, *c;
+   static char token[128];
+   static char help[256];
+   cmdline_parse_token_string_t *token_struct;
+
+   modes = list_pkt_forwarding_retry_modes();
+   snprintf(help, sizeof(help), "set fwd %s retry - "
+   "set packet forwarding mode with retry", modes);
+   cmd_set_fwd_retry_mode.help_str = help;
+
+   /* string token separator is # */
+   for (c = token; *modes != '\0'; modes++)
+   if (*modes == '|')
+   *c++ = '#';
+   else
+