Naming the buf_ring dynamically allows to create multiple af_xdp vdevs. Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
Reported-by: Markus Theil <markus.th...@tu-ilmenau.de> Signed-off-by: Xiaolong Ye <xiaolong...@intel.com> --- drivers/net/af_xdp/rte_eth_af_xdp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 497e2cfde..d8e99204e 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -473,7 +473,7 @@ xdp_umem_destroy(struct xsk_umem_info *umem) } static struct -xsk_umem_info *xdp_umem_configure(void) +xsk_umem_info *xdp_umem_configure(struct pmd_internals *internals) { struct xsk_umem_info *umem; const struct rte_memzone *mz; @@ -482,6 +482,7 @@ xsk_umem_info *xdp_umem_configure(void) .comp_size = ETH_AF_XDP_DFLT_NUM_DESCS, .frame_size = ETH_AF_XDP_FRAME_SIZE, .frame_headroom = ETH_AF_XDP_DATA_HEADROOM }; + char ring_name[RTE_RING_NAMESIZE]; int ret; uint64_t i; @@ -491,7 +492,9 @@ xsk_umem_info *xdp_umem_configure(void) return NULL; } - umem->buf_ring = rte_ring_create("af_xdp_ring", + ret = snprintf(ring_name, sizeof(ring_name), "af_xdp_ring_%s_%d", + internals->if_name, internals->queue_idx); + umem->buf_ring = rte_ring_create(ring_name, ETH_AF_XDP_NUM_BUFFERS, rte_socket_id(), 0x0); @@ -541,7 +544,7 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, int ret = 0; int reserve_size; - rxq->umem = xdp_umem_configure(); + rxq->umem = xdp_umem_configure(internals); if (rxq->umem == NULL) return -ENOMEM; -- 2.17.1