From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id F02ACA00E6 for ; Fri, 19 Apr 2019 11:46:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C5C9D1BB2E; Fri, 19 Apr 2019 11:46:22 +0200 (CEST) Received: from mail-ua1-f66.google.com (mail-ua1-f66.google.com [209.85.222.66]) by dpdk.org (Postfix) with ESMTP id B01D31BB21 for ; Fri, 19 Apr 2019 11:46:21 +0200 (CEST) Received: by mail-ua1-f66.google.com with SMTP id v7so1600974uak.13 for ; Fri, 19 Apr 2019 02:46:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u05xyfddGLCwaRJvwLq10dd6bTdO8HYailDrZL3NO7k=; b=kH+JJbwJ1SBVt194nj7uAMVdKKDlfJEb56CIQoSDqjRopLiY1SmK1CZzj/Tl1eYrbj 2ha7++uKNF5xXC9Ym2/kdJcIHtDfk6sj19ix5zgWzYUObDbe5t5ev/AizJxHD1QBwnKv Mb50RzBbU0qePHELbeqkbMjCum2lTctjxENbyDFpeBgLgbdOFCQuL6EgYVhGAnOVmWbs GdfYzEPQaJFktYWr9l1dELcULUA79DqNukTi1pfETQK6Eq27O/ADxiL5l6SLEVsI2nt6 xaBeTs0C8WfFzXMGWg4BrfUCHJOZCI2TqsDCv7DTRfLvb4+CEeyf536SdanYNGQDotlH rAmw== X-Gm-Message-State: APjAAAV2Q1LghYj0QalthStda9+IszlOgfUtMA53lZkWYBWsUaTMbzAI PE5zl0A5UXh5YOY8O47G0+Lrw1m7iZRNEUvFS48B6g== X-Google-Smtp-Source: APXvYqyMw9FFUQ3jvZ5/bbxyqUvBga0Yshpst8x/YXO1rUOIJPJfeWZMzevIycLMvU4Lky3+Y7i4oaukbs+2W1+YhKs= X-Received: by 2002:ab0:2682:: with SMTP id t2mr1523919uao.126.1555667181078; Fri, 19 Apr 2019 02:46:21 -0700 (PDT) MIME-Version: 1.0 References: <34359a7b-f2c8-81f2-8a49-f1238e8dfbf0@tu-ilmenau.de> <20190418152056.15018-1-xiaolong.ye@intel.com> In-Reply-To: <20190418152056.15018-1-xiaolong.ye@intel.com> From: David Marchand Date: Fri, 19 Apr 2019 11:46:10 +0200 Message-ID: To: Xiaolong Ye Cc: dev , Ferruh Yigit , Qi Zhang Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v1 1/2] net/af_xdp: name the buf ring dynamically X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190419094610.B4Z8yfIkhas9m9wvItP7gYBJQGDlnrJulfJY8LtP9nI@z> On Thu, Apr 18, 2019 at 5:27 PM Xiaolong Ye wrote: > 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 > Signed-off-by: Xiaolong Ye > --- > 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); > You can drop the ret assignment, you won't check it anyway. queue_idx is unsigned %d -> %u ? + 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 > > Reviewed-by: David Marchand -- David Marchand