app/testpmd: workaround softnic CLI modifications

Message ID 1532449282-9352-1-git-send-email-motih@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series app/testpmd: workaround softnic CLI modifications |

Checks

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

Commit Message

Moti Haimovsky July 24, 2018, 4:21 p.m. UTC
  This patch returns the previous testpmd command line handling
routines (namely cmdline_interact and cmdline_stdin_exit) to the
prompt routine in order to overcome testpmd abnormal exit observed on
several setups.
These routines will only by used when testpmd is compiled without
support for RTE_LIBRTE_PMD_SOFTNIC

Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
Cc: stable@dpdk.org

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
---
 app/test-pmd/cmdline.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
  

Comments

Cristian Dumitrescu July 24, 2018, 5:39 p.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Moti Haimovsky
> Sent: Tuesday, July 24, 2018 5:21 PM
> To: thomas@monjalon.net
> Cc: dev@dpdk.org; stable@dpdk.org; Moti Haimovsky
> <motih@mellanox.com>
> Subject: [dpdk-dev] [PATCH] app/testpmd: workaround softnic CLI
> modifications
> 
> This patch returns the previous testpmd command line handling
> routines (namely cmdline_interact and cmdline_stdin_exit) to the
> prompt routine in order to overcome testpmd abnormal exit observed on
> several setups.
> These routines will only by used when testpmd is compiled without
> support for RTE_LIBRTE_PMD_SOFTNIC
> 
> Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> ---
>  app/test-pmd/cmdline.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 

We should probably fix the issue in the cmdline library to bring cmdline_poll() on parity with cmdline_interact(), but this is a decent workaround to avoid breaking those automation scripts that rely on Ctrl+D behavior.

Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
  
Thomas Monjalon July 25, 2018, 8:21 a.m. UTC | #2
24/07/2018 19:39, Dumitrescu, Cristian:
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Moti Haimovsky
> > Sent: Tuesday, July 24, 2018 5:21 PM
> > To: thomas@monjalon.net
> > Cc: dev@dpdk.org; stable@dpdk.org; Moti Haimovsky
> > <motih@mellanox.com>
> > Subject: [dpdk-dev] [PATCH] app/testpmd: workaround softnic CLI
> > modifications
> > 
> > This patch returns the previous testpmd command line handling
> > routines (namely cmdline_interact and cmdline_stdin_exit) to the
> > prompt routine in order to overcome testpmd abnormal exit observed on
> > several setups.
> > These routines will only by used when testpmd is compiled without
> > support for RTE_LIBRTE_PMD_SOFTNIC
> > 
> > Fixes: 0ad778b398c6 ("app/testpmd: rework softnic forward mode")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Moti Haimovsky <motih@mellanox.com>
> > ---
> >  app/test-pmd/cmdline.c | 18 +++++++++---------
> >  1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> 
> We should probably fix the issue in the cmdline library to bring cmdline_poll() on parity with cmdline_interact(), but this is a decent workaround to avoid breaking those automation scripts that rely on Ctrl+D behavior.

This workaround works only when disabling softnic.
It means:
	1/ softnic usage is not fixed
	2/ we need to disable softnic for all other usages

I think it is not good enough.
  

Patch

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 2c32029..2f350fc 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -17896,13 +17896,12 @@  struct cmd_config_per_queue_tx_offload_result {
 void
 prompt(void)
 {
-	int status;
-
 	/* initialize non-constant commands */
 	cmd_set_fwd_mode_init();
 	cmd_set_fwd_retry_mode_init();
 
 #if defined RTE_LIBRTE_PMD_SOFTNIC
+	int status;
 	portid_t softnic_portid, pid;
 	uint8_t softnic_enable = 0;
 
@@ -17924,6 +17923,10 @@  struct cmd_config_per_queue_tx_offload_result {
 	if (testpmd_cl == NULL)
 		return;
 
+#if !defined RTE_LIBRTE_PMD_SOFTNIC
+	cmdline_interact(testpmd_cl);
+	cmdline_stdin_exit(testpmd_cl);
+#else
 	for (;;) {
 		status = cmdline_poll(testpmd_cl);
 		if (status < 0)
@@ -17932,14 +17935,11 @@  struct cmd_config_per_queue_tx_offload_result {
 			cmdline_stdin_exit(testpmd_cl);
 			rte_exit(0, "\n");
 		}
-
-#if defined RTE_LIBRTE_PMD_SOFTNIC
-
-	if ((softnic_enable == 1) &&
-		(strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0))
-		rte_pmd_softnic_manage(softnic_portid);
-#endif
+		if ((softnic_enable == 1) &&
+			(strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0))
+			rte_pmd_softnic_manage(softnic_portid);
 	}
+#endif /* RTE_LIBRTE_PMD_SOFTNIC */
 }
 
 void