net/af_xdp: optimize Rx mbuf allocation
authorRongQing Li <lirongqing@baidu.com>
Wed, 25 Nov 2020 11:01:32 +0000 (19:01 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:04 +0000 (16:03 +0100)
commit543e64d244c74b59a0b59f262391f571b1172c82
tree8a98bfb2861d12e8719dc94e9adf9a45e78545c3
parentbf403cfe3f0db4ecaeaaf1a25420bd367ceaf8b8
net/af_xdp: optimize Rx mbuf allocation

While receiving packets, the max bunch number of mbufs are allocated
and if hardware does not receive the max bunch number packets, it
will free redundancy mbufs, this is low performance.

So optimize Rx performance, by allocating number of mbuf based on
result of xsk_ring_cons__peek, to avoid to redundancy allocation,
and free mbuf when receive packets.

And Rx cached_cons must be roll backed if fails to allocate mbuf.

Signed-off-by: RongQing Li <lirongqing@baidu.com>
Signed-off-by: Dongsheng Rong <rongdongsheng@baidu.com>
Acked-by: Ciara Loftus <ciara.loftus@intel.com>
drivers/net/af_xdp/rte_eth_af_xdp.c