patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] app/testpmd: fix RSS stream invalid Tx port set
@ 2018-02-04 17:27 Matan Azrad
       [not found] ` <1517839763-24122-1-git-send-email-matan@mellanox.com>
  0 siblings, 1 reply; 3+ 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] 3+ messages in thread

* [dpdk-stable] [PATCH v2 1/3] app/testpmd: fix port index in RSS fwd config
       [not found] ` <1517839763-24122-1-git-send-email-matan@mellanox.com>
@ 2018-02-05 14:09   ` Matan Azrad
  2018-02-05 14:09   ` [dpdk-stable] [PATCH v2 2/3] app/testpmd: fix port topology " Matan Azrad
  1 sibling, 0 replies; 3+ messages in thread
From: Matan Azrad @ 2018-02-05 14:09 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: dev, stable

When multi-queue ports are configured by the user, the testpmd streams
are created by rss_fwd_config_setup() function.

This function may configure to the streams either invalid Rx ports or
invalid Tx ports.

An invalid Tx port is configured when the number of ports is odd.
In this case, the last Tx port will be always invalid.

An invalid Rx port is configured when NUMA support is configured by the
user and the number of forward ports is much smaller than the number of
all ports. In this case, also the Tx port is invalid.

Change calculations to get valid ports.

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

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

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 7f2afa2..3053b56 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1989,7 +1989,8 @@ struct igb_ring_desc_16_bytes {
 		 * if we are in loopback, simply send stuff out through the
 		 * ingress port
 		 */
-		if (port_topology == PORT_TOPOLOGY_LOOP)
+		if (port_topology == PORT_TOPOLOGY_LOOP ||
+		    txp >= cur_fwd_config.nb_fwd_ports)
 			txp = rxp;
 
 		fs->rx_port = fwd_ports_ids[rxp];
@@ -2006,11 +2007,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] 3+ messages in thread

* [dpdk-stable] [PATCH v2 2/3] app/testpmd: fix port topology in RSS fwd config
       [not found] ` <1517839763-24122-1-git-send-email-matan@mellanox.com>
  2018-02-05 14:09   ` [dpdk-stable] [PATCH v2 1/3] app/testpmd: fix port index in RSS fwd config Matan Azrad
@ 2018-02-05 14:09   ` Matan Azrad
  1 sibling, 0 replies; 3+ messages in thread
From: Matan Azrad @ 2018-02-05 14:09 UTC (permalink / raw)
  To: Wenzhuo Lu; +Cc: dev, stable

The testpmd user can configure port topology mode to define the port
topology between the testpmd forward ports(paired, chained and loop).

When multi-queue ports are configured by the user, the testpmd
streams are created by rss_fwd_config_setup() function, this function
doesn't take into account the chained topology mode and configures the
forward streams with paired topology mode in this case.

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

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

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

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 3053b56..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,19 +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 >= cur_fwd_config.nb_fwd_ports)
-			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];
-- 
1.8.3.1

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

end of thread, other threads:[~2018-02-05 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04 17:27 [dpdk-stable] [PATCH 1/2] app/testpmd: fix RSS stream invalid Tx port set Matan Azrad
     [not found] ` <1517839763-24122-1-git-send-email-matan@mellanox.com>
2018-02-05 14:09   ` [dpdk-stable] [PATCH v2 1/3] app/testpmd: fix port index in RSS fwd config Matan Azrad
2018-02-05 14:09   ` [dpdk-stable] [PATCH v2 2/3] app/testpmd: fix port topology " Matan Azrad

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).