net/af_xdp: use single producer/consumer ring
authorXiao Wang <xiao.w.wang@intel.com>
Wed, 8 Jan 2020 13:37:08 +0000 (08:37 -0500)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 17 Jan 2020 18:46:02 +0000 (19:46 +0100)
The ring is used only by af_xdp PMD itself, so no need to support
multi-producer and multi-consumer mode. This patch changes the ring
to single-producer and single-consumer mode, which could yield better
performance for addr enqueue and dequeue.

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Tested-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
drivers/net/af_xdp/rte_eth_af_xdp.c

index d903e6c..683e2a5 100644 (file)
@@ -809,7 +809,7 @@ xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals,
        umem->buf_ring = rte_ring_create(ring_name,
                                         ETH_AF_XDP_NUM_BUFFERS,
                                         rte_socket_id(),
-                                        0x0);
+                                        RING_F_SP_ENQ | RING_F_SC_DEQ);
        if (umem->buf_ring == NULL) {
                AF_XDP_LOG(ERR, "Failed to create rte_ring\n");
                goto err;