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 %. Signed-off-by: Ilya Maximets <[email protected]> --- lib/netdev-dpdk.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 5e2d64651..28a04bb7f 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2286,13 +2286,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; @@ -2768,9 +2763,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; } -- 2.38.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
