From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 1110D2BA1 for ; Fri, 9 Jun 2017 12:30:28 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jun 2017 03:30:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.39,317,1493708400"; d="scan'208";a="97483337" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by orsmga002.jf.intel.com with ESMTP; 09 Jun 2017 03:30:24 -0700 From: Pablo de Lara To: jingjing.wu@intel.com Cc: dev@dpdk.org, Pablo de Lara Date: Fri, 9 Jun 2017 03:30:44 +0100 Message-Id: <20170609023044.75127-1-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <1496007391-182136-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1496007391-182136-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH v2] app/testpmd: add parameter to start forwarding sending X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jun 2017 10:30:29 -0000 Add parameter to start forwarding sending first a burst of packets, which is useful when testing a loopback connection. This was already implemented as an internal command, but adding it as a parameter is interesting, as it allows the user to test a loopback connection without entering in the internal command line. Signed-off-by: Pablo de Lara --- Changes in v2: - Added check to prevent user from using --tx-first in interactive mode, to avoid confusion - Added extra information in testpmd help about the new parameter app/test-pmd/parameters.c | 7 +++++++ app/test-pmd/testpmd.c | 6 +++++- app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/run_app.rst | 8 ++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index fbe6284..163fd01 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -89,6 +89,7 @@ usage(char* progname) "[--cmdline-file=FILENAME] " #endif "[--help|-h] | [--auto-start|-a] | [" + "--tx-first" "--coremask=COREMASK --portmask=PORTMASK --numa " "--mbuf-size= | --total-num-mbufs= | " "--nb-cores= | --nb-ports= | " @@ -109,6 +110,8 @@ usage(char* progname) printf(" --auto-start: start forwarding on init " "[always when non-interactive].\n"); printf(" --help: display this message and quit.\n"); + printf(" --tx-first: start forwarding sending a burst first " + "(only if interactive is disabled).\n"); printf(" --nb-cores=N: set the number of forwarding cores " "(1 <= N <= %d).\n", nb_lcores); printf(" --nb-ports=N: set the number of forwarding ports " @@ -674,6 +677,10 @@ launch_args_parse(int argc, char** argv) printf("Auto-start selected\n"); auto_start = 1; } + if (!strcmp(lgopts[opt_idx].name, "tx-first")) { + printf("Start TX first\n"); + tx_first = 1; + } if (!strcmp(lgopts[opt_idx].name, "eth-peers-configfile")) { if (init_peer_eth_addrs(optarg) != 0) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index d1041af..af32397 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -95,6 +95,7 @@ uint16_t verbose_level = 0; /**< Silent by default. */ /* use master core for command line ? */ uint8_t interactive = 0; uint8_t auto_start = 0; +uint8_t tx_first; char cmdline_filename[PATH_MAX] = {0}; /* @@ -2291,6 +2292,9 @@ main(int argc, char** argv) if (argc > 1) launch_args_parse(argc, argv); + if (tx_first && interactive) + rte_exit(EXIT_FAILURE, "--tx-first cannot be used on " + "interactive mode"); if (!nb_rxq && !nb_txq) printf("Warning: Either rx or tx queues should be non-zero\n"); @@ -2350,7 +2354,7 @@ main(int argc, char** argv) int rc; printf("No commandline core given, start packet forwarding\n"); - start_packet_forwarding(0); + start_packet_forwarding(tx_first); printf("Press enter to exit\n"); rc = read(0, &c, 1); pmd_test_exit(); diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index e6c43ba..348aa66 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -299,6 +299,7 @@ extern uint16_t nb_rx_queue_stats_mappings; extern uint16_t verbose_level; /**< Drives messages being displayed, if any. */ extern uint8_t interactive; extern uint8_t auto_start; +extern uint8_t tx_first; extern char cmdline_filename[PATH_MAX]; /**< offline commands file */ extern uint8_t numa_support; /**< set by "--numa" parameter */ extern uint16_t port_topology; /**< set by "--port-topology" parameter */ diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst index 2a43214..3159398 100644 --- a/doc/guides/testpmd_app_ug/run_app.rst +++ b/doc/guides/testpmd_app_ug/run_app.rst @@ -188,6 +188,14 @@ The commandline options are: Start forwarding on initialization. +* ``--tx-first`` + + Start forwarding, after sending a burst of packets first. + +.. Note:: + + This flag should be only used in non-interactive mode. + * ``--nb-cores=N`` Set the number of forwarding cores, -- 2.9.4