[dpdk-dev] [PATCH 1/2] app/testpmd: fix RSS stream invalid Tx port set
Matan Azrad
matan at mellanox.com
Sun Feb 4 18:27:04 CET 2018
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 at dpdk.org
Signed-off-by: Matan Azrad <matan at 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
More information about the dev
mailing list