summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@ovn.org>2023-01-09 19:28:46 +0100
committerIlya Maximets <i.maximets@ovn.org>2023-01-27 16:07:39 +0100
commitebaee446240133f5ec5064553535dfe392f60999 (patch)
tree515177f44d93fe7151f401295a4ca7022d850ef2 /lib
parentb7f540129b587616d9977020bb529dcd8490f5c4 (diff)
downloadopenvswitch-ebaee446240133f5ec5064553535dfe392f60999.tar.gz
netdev-dpdk: Free mbufs in bulk.
rte_pktmbuf_free_bulk() function was introduced in 19.11 and became stable in 21.11. Use it to free arrays of mbufs instead of freeing packets one by one. In simple V2V testing with 64B packets, 2 PMD threads and bidirectional traffic this change improves performance by 3.5 - 4.5 %. Reviewed-by: David Marchand <david.marchand@redhat.com> Acked-by: Kevin Traynor <ktraynor@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/netdev-dpdk.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index ab5b8223e..fb0dd43f7 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2287,13 +2287,8 @@ netdev_dpdk_eth_tx_burst(struct netdev_dpdk *dev, int qid,
}
if (OVS_UNLIKELY(nb_tx != cnt)) {
- /* Free buffers, which we couldn't transmit, one at a time (each
- * packet could come from a different mempool) */
- int i;
-
- for (i = nb_tx; i < cnt; i++) {
- rte_pktmbuf_free(pkts[i]);
- }
+ /* Free buffers, which we couldn't transmit. */
+ rte_pktmbuf_free_bulk(&pkts[nb_tx], cnt - nb_tx);
}
return cnt - nb_tx;
@@ -2769,9 +2764,7 @@ netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
}
pkts = (struct rte_mbuf **) batch->packets;
- for (int i = 0; i < vhost_batch_cnt; i++) {
- rte_pktmbuf_free(pkts[i]);
- }
+ rte_pktmbuf_free_bulk(pkts, vhost_batch_cnt);
return 0;
}