From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by dpdk.org (Postfix) with ESMTP id 5180658EB for ; Wed, 30 Apr 2014 15:30:04 +0200 (CEST) Received: by mail-we0-f177.google.com with SMTP id t60so1652893wes.22 for ; Wed, 30 Apr 2014 06:30:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=1iHb7EY6Uuf+9PhIpeIqGZC92Z5PsNcnMRgQiz5HUNE=; b=VjGuXBJ7JOr6/T8mPwowZHmjmQM5+Xub/ZH7xrXAvmZRCouzJMecHvI4oTiBmOZuI1 ymr3G6eKb+tW2N5Gx673t3IGGj/FbtNxlo8kNfjVYD1o46UrKEUKkhWQdQ5MEMwhrFyq x0GAnIuzESA3AXDltShW+yBIn+w0cLLpN6kH6VFY5pzlh7PhlAQPmLSP6J4OG8xsY1kd Di0zRHTS8HWqvkzh0vZSRFCv+xZ8fZLBVfgC8gW+7mZe5pqp+DvABi/JkcT1+91OQ4QW BrBw5RMHBdyraghGroPvUGZ6agUt6JOeuBBXpOK+HftBSAUzJLg5wWgAVQGBhhJvt9D8 g9Sg== X-Gm-Message-State: ALoCoQkbFcloZJfOfYvTTPxomHdSx7w4Wf6H8zgxe7cXVXpa3X/I/tQIETt2o430nuIY4TTkjcYY X-Received: by 10.180.228.42 with SMTP id sf10mr3774860wic.48.1398864608344; Wed, 30 Apr 2014 06:30:08 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id ft8sm3660258wib.13.2014.04.30.06.30.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Apr 2014 06:30:07 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Wed, 30 Apr 2014 15:30:02 +0200 Message-Id: <1398864602-31454-1-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 Subject: [dpdk-dev] [PATCH] app/testpmd: add --disable-link-check option X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Apr 2014 13:30:04 -0000 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 --- 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; /**