Re: [PATCH v3 23/23] app/testpmd: rework softnic forward mode
From: Iremonger, Bernard <hidden>
Date: 2018-06-28 13:45:14
Hi Jasvinder,
-----Original Message-----
From: Singh, Jasvinder
Sent: Wednesday, June 27, 2018 5:31 PM
To: dev@dpdk.org
Cc: Dumitrescu, Cristian <redacted>; Iremonger,
Bernard [off-list ref]; Pattan, Reshma
[off-list ref]
Subject: [PATCH v3 23/23] app/testpmd: rework softnic forward mode
Modied the testpmd softnic forwarding mode as per the changes in softnic
PMD.
To run testpmd application with softnic fwd mode, following command is
used;
$ ./testpmd -c 0xc -n 4 --vdev 'net_softnic0,firmware=script.cli'
-- -i --forward-mode=softnic
Signed-off-by: Jasvinder Singh <redacted>
Signed-off-by: Reshma Pattan <redacted>
---
app/test-pmd/Makefile | 4 +-
app/test-pmd/cmdline.c | 54 ++++-
app/test-pmd/config.c | 57 +++++
app/test-pmd/{tm.c => softnicfwd.c} | 405 +++++++++++-----------------------
--
app/test-pmd/testpmd.c | 29 +--
app/test-pmd/testpmd.h | 44 +---
6 files changed, 248 insertions(+), 345 deletions(-) rename app/test-
pmd/{tm.c => softnicfwd.c} (61%)<snip>
quoted hunk ↗ jump to hunk
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index27e2aa8..3fcbc17 100644--- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c@@ -69,6 +69,9 @@ #ifdef RTE_LIBRTE_I40E_PMD #include <rte_pmd_i40e.h> #endif +#ifdef RTE_LIBRTE_PMD_SOFTNIC +#include <rte_eth_softnic.h> +#endif #ifdef RTE_LIBRTE_BNXT_PMD #include <rte_pmd_bnxt.h> #endif@@ -14806,20 +14809,14 @@ static voidcmd_set_port_tm_hierarchy_default_parsed(void *parsed_result, p = &ports[port_id]; - /* Port tm flag */ - if (p->softport.tm_flag == 0) { - printf(" tm not enabled on port %u (error)\n", port_id); - return; - } - /* Forward mode: tm */
Should "tm" be replaced by "softnic" in line above.
- if (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, "tm")) {
- printf(" tm mode not enabled(error)\n");
+ if (strcmp(cur_fwd_config.fwd_eng->fwd_mode_name, "softnic")) {
+ printf(" softnicfwd mode not enabled(error)\n");
return;
}
/* Set the default tm hierarchy */
- p->softport.tm.default_hierarchy_enable = 1;
+ p->softport.default_tm_hierarchy_enable = 1;
}
cmdline_parse_inst_t cmd_set_port_tm_hierarchy_default = { @@ -
17543,15 +17540,50 @@ cmdline_read_from_file(const char *filename) 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
+ portid_t softnic_portid, pid;
+ uint8_t softnic_enable = 0;
+
+ if (strcmp(cur_fwd_eng->fwd_mode_name, "softnic") == 0) {
+ RTE_ETH_FOREACH_DEV(pid) {
+ struct rte_port *port = &ports[pid];
+ const char *driver = port->dev_info.driver_name;
+
+ if (strcmp(driver, "net_softnic") == 0) {
+ softnic_portid = pid;
+ softnic_enable = 1;
+ break;
+ }
+ }
+ }
+#endif
+
testpmd_cl = cmdline_stdin_new(main_ctx, "testpmd> ");
if (testpmd_cl == NULL)
return;
- cmdline_interact(testpmd_cl);
- cmdline_stdin_exit(testpmd_cl);
+
+ for (;;) {
+ status = cmdline_poll(testpmd_cl);
+ if (status < 0)
+ rte_panic("CLI poll error (%" PRId32 ")\n", status);
+ else if (status == RDLINE_EXITED) {
+ 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
+ }
}<snip> Should the testpmd help command be updated for the softnic, lines 125 to 1136 in cmdline.c ? Regards, Bernard.