* [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
* [dpdk-dev] [PATCH 2/2] app/testpmd: use dedicated function to get Tx port
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 ` Matan Azrad
2018-02-05 14:09 ` [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config Matan Azrad
1 sibling, 0 replies; 7+ messages in thread
From: Matan Azrad @ 2018-02-04 17:27 UTC (permalink / raw)
To: Wenzhuo Lu; +Cc: dev
A new function was added to get a Tx port as a function of the topology
mode and the Rx port.
Use this function to get the Tx port of simple stream.
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
app/test-pmd/config.c | 31 +++----------------------------
1 file changed, 3 insertions(+), 28 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 02ab1e3..4bb255c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1916,19 +1916,6 @@ struct igb_ring_desc_16_bytes {
simple_fwd_config_setup(void)
{
portid_t i;
- portid_t j;
- portid_t inc = 2;
-
- 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 "
- "with the current port topology. Configuration "
- "must be changed to have an even number of ports, "
- "or relaunch application with "
- "--port-topology=chained\n\n");
- }
cur_fwd_config.nb_fwd_ports = (portid_t) nb_fwd_ports;
cur_fwd_config.nb_fwd_streams =
@@ -1947,26 +1934,14 @@ struct igb_ring_desc_16_bytes {
(lcoreid_t) cur_fwd_config.nb_fwd_ports;
setup_fwd_config_of_each_lcore(&cur_fwd_config);
- for (i = 0; i < cur_fwd_config.nb_fwd_ports; i = (portid_t) (i + inc)) {
- if (port_topology != PORT_TOPOLOGY_LOOP)
- j = (portid_t) ((i + 1) % cur_fwd_config.nb_fwd_ports);
- else
- j = i;
+ for (i = 0; i < cur_fwd_config.nb_fwd_ports; 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];
+ fwd_streams[i]->tx_port =
+ fwd_ports_ids[fwd_topology_tx_port_get(i)];
fwd_streams[i]->tx_queue = 0;
fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
fwd_streams[i]->retry_enabled = retry_enabled;
-
- if (port_topology == PORT_TOPOLOGY_PAIRED) {
- fwd_streams[j]->rx_port = fwd_ports_ids[j];
- fwd_streams[j]->rx_queue = 0;
- fwd_streams[j]->tx_port = fwd_ports_ids[i];
- fwd_streams[j]->tx_queue = 0;
- fwd_streams[j]->peer_addr = fwd_streams[j]->tx_port;
- fwd_streams[j]->retry_enabled = retry_enabled;
- }
}
}
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config
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 ` Matan Azrad
2018-02-05 14:09 ` [dpdk-dev] [PATCH v2 1/3] app/testpmd: fix port index in RSS fwd config Matan Azrad
` (3 more replies)
1 sibling, 4 replies; 7+ messages in thread
From: Matan Azrad @ 2018-02-05 14:09 UTC (permalink / raw)
To: Wenzhuo Lu; +Cc: dev
V2:
split the fix patch to 2 patches.
Matan Azrad (3):
app/testpmd: fix port index in RSS fwd config
app/testpmd: fix port topology in RSS fwd config
app/testpmd: use dedicated function to get Tx port
app/test-pmd/config.c | 85 +++++++++++++++++++++------------------------------
1 file changed, 35 insertions(+), 50 deletions(-)
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2 1/3] app/testpmd: fix port index in RSS fwd config
2018-02-05 14:09 ` [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config Matan Azrad
@ 2018-02-05 14:09 ` Matan Azrad
2018-02-05 14:09 ` [dpdk-dev] [PATCH v2 2/3] app/testpmd: fix port topology " Matan Azrad
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ 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] 7+ messages in thread
* [dpdk-dev] [PATCH v2 2/3] app/testpmd: fix port topology in RSS fwd config
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 ` 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
3 siblings, 0 replies; 7+ 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] 7+ messages in thread
* [dpdk-dev] [PATCH v2 3/3] app/testpmd: use dedicated function to get Tx port
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 ` Matan Azrad
2018-02-06 17:20 ` [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config Thomas Monjalon
3 siblings, 0 replies; 7+ messages in thread
From: Matan Azrad @ 2018-02-05 14:09 UTC (permalink / raw)
To: Wenzhuo Lu; +Cc: dev
A new function was added to get a Tx port index as a function of the
topology mode and the Rx port index.
Use this function to get the Tx port index of simple stream.
Signed-off-by: Matan Azrad <matan@mellanox.com>
---
app/test-pmd/config.c | 31 +++----------------------------
1 file changed, 3 insertions(+), 28 deletions(-)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 02ab1e3..4bb255c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1916,19 +1916,6 @@ struct igb_ring_desc_16_bytes {
simple_fwd_config_setup(void)
{
portid_t i;
- portid_t j;
- portid_t inc = 2;
-
- 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 "
- "with the current port topology. Configuration "
- "must be changed to have an even number of ports, "
- "or relaunch application with "
- "--port-topology=chained\n\n");
- }
cur_fwd_config.nb_fwd_ports = (portid_t) nb_fwd_ports;
cur_fwd_config.nb_fwd_streams =
@@ -1947,26 +1934,14 @@ struct igb_ring_desc_16_bytes {
(lcoreid_t) cur_fwd_config.nb_fwd_ports;
setup_fwd_config_of_each_lcore(&cur_fwd_config);
- for (i = 0; i < cur_fwd_config.nb_fwd_ports; i = (portid_t) (i + inc)) {
- if (port_topology != PORT_TOPOLOGY_LOOP)
- j = (portid_t) ((i + 1) % cur_fwd_config.nb_fwd_ports);
- else
- j = i;
+ for (i = 0; i < cur_fwd_config.nb_fwd_ports; 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];
+ fwd_streams[i]->tx_port =
+ fwd_ports_ids[fwd_topology_tx_port_get(i)];
fwd_streams[i]->tx_queue = 0;
fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port;
fwd_streams[i]->retry_enabled = retry_enabled;
-
- if (port_topology == PORT_TOPOLOGY_PAIRED) {
- fwd_streams[j]->rx_port = fwd_ports_ids[j];
- fwd_streams[j]->rx_queue = 0;
- fwd_streams[j]->tx_port = fwd_ports_ids[i];
- fwd_streams[j]->tx_queue = 0;
- fwd_streams[j]->peer_addr = fwd_streams[j]->tx_port;
- fwd_streams[j]->retry_enabled = retry_enabled;
- }
}
}
--
1.8.3.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config
2018-02-05 14:09 ` [dpdk-dev] [PATCH v2 0/3] testpmd: fix rss forward config Matan Azrad
` (2 preceding siblings ...)
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 ` Thomas Monjalon
3 siblings, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2018-02-06 17:20 UTC (permalink / raw)
To: Matan Azrad; +Cc: dev, Wenzhuo Lu
> Matan Azrad (3):
> app/testpmd: fix port index in RSS fwd config
> app/testpmd: fix port topology in RSS fwd config
> app/testpmd: use dedicated function to get Tx port
Applied, thanks
^ 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).