[dpdk-dev] examples/load_balancer: fix Tx flush

Message ID f370cd13bd8a4d4e0ee82c05c2a67420044cdbb6.1493285259.git.Andriy.Berestovskyy@caviumnetworks.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Andriy Berestovskyy April 27, 2017, 9:27 a.m. UTC
  Port ID is not an index from 0 to n_nic_ports, but rather a value
of nic_ports array.

Signed-off-by: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>
---
 examples/load_balancer/runtime.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Thomas Monjalon May 1, 2017, 4:16 p.m. UTC | #1
27/04/2017 11:27, Andriy Berestovskyy:
> Port ID is not an index from 0 to n_nic_ports, but rather a value
> of nic_ports array.
> 
> Signed-off-by: Andriy Berestovskyy <Andriy.Berestovskyy@caviumnetworks.com>

Fixes: af75078fece3 ("first public release")

Applied, thanks
  

Patch

diff --git a/examples/load_balancer/runtime.c b/examples/load_balancer/runtime.c
index 8192c08..7f918aa 100644
--- a/examples/load_balancer/runtime.c
+++ b/examples/load_balancer/runtime.c
@@ -420,10 +420,12 @@  static inline void
 app_lcore_io_tx_flush(struct app_lcore_params_io *lp)
 {
 	uint8_t port;
+	uint32_t i;
 
-	for (port = 0; port < lp->tx.n_nic_ports; port ++) {
+	for (i = 0; i < lp->tx.n_nic_ports; i++) {
 		uint32_t n_pkts;
 
+		port = lp->tx.nic_ports[i];
 		if (likely((lp->tx.mbuf_out_flush[port] == 0) ||
 		           (lp->tx.mbuf_out[port].n_mbufs == 0))) {
 			lp->tx.mbuf_out_flush[port] = 1;