DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] app/testpmd: fix RSS stream invalid Tx port set
@ 2018-02-04 17:27 Matan Azrad
  2018-02-04 17:27 ` [dpdk-dev] [PATCH 2/2] app/testpmd: use dedicated function to get Tx port Matan Azrad
  2018-02-05 14:09 ` [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config Matan Azrad
  0 siblings, 2 replies; 7+ messages in thread
From: Matan Azrad @ 2018-02-04 17:27 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: dev, stable

Testpmd application configures RSS forward streams, by default, when
the number of queues is higher than 1.

In this mode the configured port topology is not taken into account.
Morever, the Tx port may be invalid in case of odd number of forward
ports.

Configure the RSS stream Tx port by dedicated function which calculates
a valid Tx port as a function of the topology mode and the Rx port.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 app/test-pmd/config.c | 54 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 32 insertions(+), 22 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7f2afa2..02ab1e3 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1882,6 +1882,36 @@ struct igb_ring_desc_16_bytes {
 	}
 }
 
+static portid_t
+fwd_topology_tx_port_get(portid_t rxp)
+{
+	static int warning_once = 1;
+
+	RTE_ASSERT(rxp < cur_fwd_config.nb_fwd_ports);
+
+	switch (port_topology) {
+	default:
+	case PORT_TOPOLOGY_PAIRED:
+		if ((rxp & 0x1) == 0) {
+			if (rxp + 1 < cur_fwd_config.nb_fwd_ports)
+				return rxp + 1;
+			if (warning_once) {
+				printf("\nWarning! port-topology=paired"
+				       " and odd forward ports number,"
+				       " the last port will pair with"
+				       " itself.\n\n");
+				warning_once = 0;
+			}
+			return rxp;
+		}
+		return rxp - 1;
+	case PORT_TOPOLOGY_CHAINED:
+		return (rxp + 1) % cur_fwd_config.nb_fwd_ports;
+	case PORT_TOPOLOGY_LOOP:
+		return rxp;
+	}
+}
+
 static void
 simple_fwd_config_setup(void)
 {
@@ -1944,11 +1974,6 @@ struct igb_ring_desc_16_bytes {
  * For the RSS forwarding test all streams distributed over lcores. Each stream
  * being composed of a RX queue to poll on a RX port for input messages,
  * associated with a TX queue of a TX port where to send forwarded packets.
- * All packets received on the RX queue of index "RxQj" of the RX port "RxPi"
- * are sent on the TX queue "TxQl" of the TX port "TxPk" according to the two
- * following rules:
- *    - TxPk = (RxPi + 1) if RxPi is even, (RxPi - 1) if RxPi is odd
- *    - TxQl = RxQj
  */
 static void
 rss_fwd_config_setup(void)
@@ -1980,18 +2005,7 @@ struct igb_ring_desc_16_bytes {
 		struct fwd_stream *fs;
 
 		fs = fwd_streams[sm_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;
-
+		txp = fwd_topology_tx_port_get(rxp);
 		fs->rx_port = fwd_ports_ids[rxp];
 		fs->rx_queue = rxq;
 		fs->tx_port = fwd_ports_ids[txp];
@@ -2006,11 +2020,7 @@ struct igb_ring_desc_16_bytes {
 		 * Restart from RX queue 0 on next RX port
 		 */
 		rxq = 0;
-		if (numa_support && (nb_fwd_ports <= (nb_ports >> 1)))
-			rxp = (portid_t)
-				(rxp + ((nb_ports >> 1) / nb_fwd_ports));
-		else
-			rxp = (portid_t) (rxp + 1);
+		rxp++;
 	}
 }
 
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-06 17:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04 17:27 [dpdk-dev] [PATCH 1/2] app/testpmd: fix RSS stream invalid Tx port set Matan Azrad
2018-02-04 17:27 ` [dpdk-dev] [PATCH 2/2] app/testpmd: use dedicated function to get Tx port Matan Azrad
2018-02-05 14:09 ` [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config Matan Azrad
2018-02-05 14:09   ` [dpdk-dev] [PATCH v2 1/3] app/testpmd: fix port index in RSS fwd config Matan Azrad
2018-02-05 14:09   ` [dpdk-dev] [PATCH v2 2/3] app/testpmd: fix port topology " Matan Azrad
2018-02-05 14:09   ` [dpdk-dev] [PATCH v2 3/3] app/testpmd: use dedicated function to get Tx port Matan Azrad
2018-02-06 17:20   ` [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config 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).