[1/5,pktgen] fix race condition in start
Checks
Commit Message
Flag SENDING_PACKETS must be set last.
When it is set before SEND_FOREVER flag, Tx lcores start to call
pktgen_send_pkts. But as current_tx_count is 0 and SEND_FOREVER
is not yet set, SENDING_PACKETS will be cleared.
This causes in some cases that start command will no take effect.
Fixes: f5f901fdf52b ("Update for 1.8 rte_mbuf changes.")
Signed-off-by: Rafal Kozik <rk@semihalf.com>
---
app/pktgen-cmds.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -1412,10 +1412,10 @@ pktgen_start_transmitting(port_info_t *info)
rte_atomic64_set(&info->current_tx_count,
rte_atomic64_read(&info->transmit_count));
- pktgen_set_port_flags(info, SENDING_PACKETS);
-
if (rte_atomic64_read(&info->current_tx_count) == 0)
pktgen_set_port_flags(info, SEND_FOREVER);
+
+ pktgen_set_port_flags(info, SENDING_PACKETS);
}
}