* [dpdk-dev] [PATCH] app/testpmd: add --disable-link-check option
@ 2014-04-30 13:30 David Marchand
2014-05-16 14:27 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: David Marchand @ 2014-04-30 13:30 UTC (permalink / raw)
To: dev
When starting/stopping ports, a link status check on all available ports is
done. This can be annoying when cables are not plugged at the time.
Default behavior is untouched.
Signed-off-by: David Marchand <david.marchand@6wind.com>
---
app/test-pmd/cmdline.c | 41 +++++++++++++++++++++++++++++++++++++++++
app/test-pmd/parameters.c | 5 +++++
app/test-pmd/testpmd.c | 9 +++++++--
app/test-pmd/testpmd.h | 1 +
4 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 7becedc..9d3c823 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -2335,6 +2335,46 @@ cmdline_parse_inst_t cmd_set_flush_rx = {
},
};
+/* *** ENABLE/DISABLE LINK STATUS CHECK *** */
+struct cmd_set_link_check {
+ cmdline_fixed_string_t set;
+ cmdline_fixed_string_t link_check;
+ cmdline_fixed_string_t mode;
+};
+
+static void
+cmd_set_link_check_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_set_link_check *res = parsed_result;
+ no_link_check = (uint8_t)((strcmp(res->mode, "on") == 0) ? 0 : 1);
+}
+
+cmdline_parse_token_string_t cmd_setlinkcheck_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_link_check,
+ set, "set");
+cmdline_parse_token_string_t cmd_setlinkcheck_link_check =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_link_check,
+ link_check, "link_check");
+cmdline_parse_token_string_t cmd_setlinkcheck_mode =
+ TOKEN_STRING_INITIALIZER(struct cmd_set_link_check,
+ mode, "on#off");
+
+
+cmdline_parse_inst_t cmd_set_link_check = {
+ .f = cmd_set_link_check_parsed,
+ .help_str = "set link_check on|off: enable/disable link status check "
+ "when starting/stopping a port",
+ .data = NULL,
+ .tokens = {
+ (void *)&cmd_setlinkcheck_set,
+ (void *)&cmd_setlinkcheck_link_check,
+ (void *)&cmd_setlinkcheck_mode,
+ NULL,
+ },
+};
+
#ifdef RTE_NIC_BYPASS
/* *** SET NIC BYPASS MODE *** */
struct cmd_set_bypass_mode_result {
@@ -5131,6 +5171,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_set_allmulti_mode_one,
(cmdline_parse_inst_t *)&cmd_set_allmulti_mode_all,
(cmdline_parse_inst_t *)&cmd_set_flush_rx,
+ (cmdline_parse_inst_t *)&cmd_set_link_check,
#ifdef RTE_NIC_BYPASS
(cmdline_parse_inst_t *)&cmd_set_bypass_mode,
(cmdline_parse_inst_t *)&cmd_set_bypass_event,
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index f537e49..4fa6296 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -192,6 +192,8 @@ usage(char* progname)
"(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1);
printf(" --no-flush-rx: Don't flush RX streams before forwarding."
" Used mainly with PCAP drivers.\n");
+ printf(" --disable-link-check: disable check on link status when "
+ "starting/stopping ports.\n");
}
#ifdef RTE_LIBRTE_CMDLINE
@@ -533,6 +535,7 @@ launch_args_parse(int argc, char** argv)
{ "tx-queue-stats-mapping", 1, 0, 0 },
{ "rx-queue-stats-mapping", 1, 0, 0 },
{ "no-flush-rx", 0, 0, 0 },
+ { "disable-link-check", 0, 0, 0 },
{ 0, 0, 0, 0 },
};
@@ -967,6 +970,8 @@ launch_args_parse(int argc, char** argv)
}
if (!strcmp(lgopts[opt_idx].name, "no-flush-rx"))
no_flush_rx = 1;
+ if (!strcmp(lgopts[opt_idx].name, "disable-link-check"))
+ no_link_check = 1;
break;
case 'h':
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index a661d33..b9447f2 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -259,6 +259,11 @@ uint16_t port_topology = PORT_TOPOLOGY_PAIRED; /* Ports are paired by default */
uint8_t no_flush_rx = 0; /* flush by default */
/*
+ * Avoids to check link status when starting/stopping a port.
+ */
+uint8_t no_link_check = 0; /* check by default */
+
+/*
* NIC bypass mode configuration options.
*/
#ifdef RTE_NIC_BYPASS
@@ -1360,7 +1365,7 @@ start_port(portid_t pid)
need_check_link_status = 1;
}
- if (need_check_link_status)
+ if (need_check_link_status && !no_link_check)
check_all_ports_link_status(nb_ports, RTE_PORT_ALL);
else
printf("Please stop the ports first\n");
@@ -1402,7 +1407,7 @@ stop_port(portid_t pid)
printf("Port %d can not be set into stopped\n", pi);
need_check_link_status = 1;
}
- if (need_check_link_status)
+ if (need_check_link_status && !no_link_check)
check_all_ports_link_status(nb_ports, RTE_PORT_ALL);
printf("Done\n");
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 5b4ee6f..e1664fa 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -273,6 +273,7 @@ extern uint8_t numa_support; /**< set by "--numa" parameter */
extern uint16_t port_topology; /**< set by "--port-topology" parameter */
extern uint8_t no_flush_rx; /**<set by "--no-flush-rx" parameter */
extern uint8_t mp_anon; /**< set by "--mp-anon" parameter */
+extern uint8_t no_link_check; /**<set by "--disable-link-check" parameter */
#ifdef RTE_NIC_BYPASS
extern uint32_t bypass_timeout; /**< Store the NIC bypass watchdog timeout */
--
1.7.10.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-16 14:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 13:30 [dpdk-dev] [PATCH] app/testpmd: add --disable-link-check option David Marchand
2014-05-16 14:27 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).