Skip to content

Commit

Permalink
netdev-dpdk: Free mbufs in bulk.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Kevin Traynor <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
igsilya committed Jan 27, 2023
1 parent b7f5401 commit ebaee44
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit ebaee44

Please sign in to comment.