From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from USCAMAIL.TILERA.COM (uscamail.tilera.com [12.218.212.166]) by dpdk.org (Postfix) with ESMTP id 0174E156 for ; Thu, 3 Apr 2014 19:28:45 +0200 (CEST) Received: from sclab-apps-2.internal.tilera.com (10.108.0.15) by USCAEXCH2.tad.internal.tilera.com (10.103.0.33) with Microsoft SMTP Server (TLS) id 14.0.702.0; Thu, 3 Apr 2014 10:30:20 -0700 Received: (from cchemparathy@localhost) by sclab-apps-2.internal.tilera.com (8.14.4/8.14.4/Submit) id s33HUKD8029241; Thu, 3 Apr 2014 10:30:20 -0700 X-Authentication-Warning: sclab-apps-2.internal.tilera.com: cchemparathy set sender to cchemparathy@tilera.com using -f From: Cyril Chemparathy To: Date: Thu, 3 Apr 2014 10:30:11 -0700 Message-ID: <1396546216-29200-2-git-send-email-cchemparathy@tilera.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1396546216-29200-1-git-send-email-cchemparathy@tilera.com> References: <1396546216-29200-1-git-send-email-cchemparathy@tilera.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [dpdk-dev] [PATCH 1/6] test-pmd: add support for single port loopback topology 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: Thu, 03 Apr 2014 17:28:46 -0000 This commits adds a new "loop" option to the --port-topology argument. With the loop option specified, ingress traffic is simply transmitted back on the same interface. Signed-off-by: Cyril Chemparathy --- app/test-pmd/config.c | 16 ++++++++++++++-- app/test-pmd/parameters.c | 2 ++ app/test-pmd/testpmd.h | 3 ++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 0816227..1d3cdba 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -733,7 +733,8 @@ simple_fwd_config_setup(void) portid_t j; portid_t inc = 2; - if (port_topology == PORT_TOPOLOGY_CHAINED) { + if (port_topology == PORT_TOPOLOGY_CHAINED || + port_topology == PORT_TOPOLOGY_LOOP) { inc = 1; } else if (nb_fwd_ports % 2) { printf("\nWarning! Cannot handle an odd number of ports " @@ -761,7 +762,10 @@ simple_fwd_config_setup(void) setup_fwd_config_of_each_lcore(&cur_fwd_config); for (i = 0; i < cur_fwd_config.nb_fwd_ports; i = (portid_t) (i + inc)) { - j = (portid_t) ((i + 1) % cur_fwd_config.nb_fwd_ports); + if (port_topology != PORT_TOPOLOGY_LOOP) + j = (portid_t) ((i + 1) % cur_fwd_config.nb_fwd_ports); + else + j = i; fwd_streams[i]->rx_port = fwd_ports_ids[i]; fwd_streams[i]->rx_queue = 0; fwd_streams[i]->tx_port = fwd_ports_ids[j]; @@ -825,10 +829,18 @@ rss_fwd_config_setup(void) struct fwd_stream *fs; fs = fwd_streams[lc_id]; + if ((rxp & 0x1) == 0) txp = (portid_t) (rxp + 1); else txp = (portid_t) (rxp - 1); + /* + * if we are in loopback, simply send stuff out through the + * ingress port + */ + if (port_topology == PORT_TOPOLOGY_LOOP) + txp = rxp; + fs->rx_port = fwd_ports_ids[rxp]; fs->rx_queue = rxq; fs->tx_port = fwd_ports_ids[txp]; diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index f537e49..d47d020 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -756,6 +756,8 @@ launch_args_parse(int argc, char** argv) port_topology = PORT_TOPOLOGY_PAIRED; else if (!strcmp(optarg, "chained")) port_topology = PORT_TOPOLOGY_CHAINED; + else if (!strcmp(optarg, "loop")) + port_topology = PORT_TOPOLOGY_LOOP; else rte_exit(EXIT_FAILURE, "port-topology %s invalid -" " must be: paired or chained \n", diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 5b4ee6f..a4842ec 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -80,7 +80,8 @@ typedef uint16_t streamid_t; enum { PORT_TOPOLOGY_PAIRED, - PORT_TOPOLOGY_CHAINED + PORT_TOPOLOGY_CHAINED, + PORT_TOPOLOGY_LOOP, }; #ifdef RTE_TEST_PMD_RECORD_BURST_STATS -- 1.8.3.1