summaryrefslogtreecommitdiff
path: root/lib/dpif-netdev.c
diff options
context:
space:
mode:
authorRosemarie O'Riorden <roriorden@redhat.com>2022-04-26 15:24:31 -0400
committerIlya Maximets <i.maximets@ovn.org>2022-05-04 21:18:08 +0200
commit7e7083cc4628a2884edb264d3bc68c6655be12f8 (patch)
tree852f5cb198186c2117cde80efa58637125c068df /lib/dpif-netdev.c
parent8523ee2f8a2d15cb320662dcc3a7ffa9bebe704d (diff)
downloadopenvswitch-7e7083cc4628a2884edb264d3bc68c6655be12f8.tar.gz
dpif-netdev: Replace loop iterating over packet batch with macro.
The function dp_netdev_pmd_flush_output_on_port() iterates over the p->output_pkts batch directly, when it should be using the special iterator macro, DP_PACKET_BATCH_FOR_EACH. However, this wasn't possible because the macro could not accept &p->output_pkts. The addition of parentheses when BATCH is dereferenced allows the macro to expand properly. Parenthesizing arguments in macros is good practice to be able to handle whichever expressions are passed in. Signed-off-by: Rosemarie O'Riorden <roriorden@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib/dpif-netdev.c')
-rw-r--r--lib/dpif-netdev.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 676434308..61929049c 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -5210,8 +5210,8 @@ dp_netdev_pmd_flush_output_on_port(struct dp_netdev_pmd_thread *pmd,
int n_txq = netdev_n_txq(p->port->netdev);
/* Re-batch per txq based on packet hash. */
- for (i = 0; i < output_cnt; i++) {
- struct dp_packet *packet = p->output_pkts.packets[i];
+ struct dp_packet *packet;
+ DP_PACKET_BATCH_FOR_EACH (j, packet, &p->output_pkts) {
uint32_t hash;
if (OVS_LIKELY(dp_packet_rss_valid(packet))) {