From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 4C2D51BB15 for ; Fri, 19 Apr 2019 14:47:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2019 05:47:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,369,1549958400"; d="scan'208";a="339035714" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by fmsmga005.fm.intel.com with ESMTP; 19 Apr 2019 05:47:41 -0700 From: Ferruh Yigit To: Xiaolong Ye , Qi Zhang Cc: dev@dpdk.org, Markus Theil , David Marchand Date: Fri, 19 Apr 2019 13:47:39 +0100 Message-Id: <20190419124739.79412-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190418152056.15018-1-xiaolong.ye@intel.com> References: <20190418152056.15018-1-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] net/af_xdp: fix creating multiple instance 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: , X-List-Received-Date: Fri, 19 Apr 2019 12:47:44 -0000 From: Xiaolong Ye Naming the buf_ring and umem memzone 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 Reviewed-by: David Marchand --- v2: * squashed buf_ring & memzone patches * removed unused return value * changed format specifier to unsigned --- drivers/net/af_xdp/rte_eth_af_xdp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 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..acf9ad605 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,8 @@ 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]; + char mz_name[RTE_MEMZONE_NAMESIZE]; int ret; uint64_t i; @@ -491,7 +493,9 @@ xsk_umem_info *xdp_umem_configure(void) return NULL; } - umem->buf_ring = rte_ring_create("af_xdp_ring", + snprintf(ring_name, sizeof(ring_name), "af_xdp_ring_%s_%u", + internals->if_name, internals->queue_idx); + umem->buf_ring = rte_ring_create(ring_name, ETH_AF_XDP_NUM_BUFFERS, rte_socket_id(), 0x0); @@ -505,7 +509,9 @@ xsk_umem_info *xdp_umem_configure(void) (void *)(i * ETH_AF_XDP_FRAME_SIZE + ETH_AF_XDP_DATA_HEADROOM)); - mz = rte_memzone_reserve_aligned("af_xdp uemem", + snprintf(mz_name, sizeof(mz_name), "af_xdp_umem_%s_%u", + internals->if_name, internals->queue_idx); + mz = rte_memzone_reserve_aligned(mz_name, ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE, rte_socket_id(), RTE_MEMZONE_IOVA_CONTIG, getpagesize()); @@ -541,7 +547,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.20.1 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 BEEEFA00E6 for ; Fri, 19 Apr 2019 14:47:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6C9101BB86; Fri, 19 Apr 2019 14:47:45 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 4C2D51BB15 for ; Fri, 19 Apr 2019 14:47:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Apr 2019 05:47:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,369,1549958400"; d="scan'208";a="339035714" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.212]) by fmsmga005.fm.intel.com with ESMTP; 19 Apr 2019 05:47:41 -0700 From: Ferruh Yigit To: Xiaolong Ye , Qi Zhang Cc: dev@dpdk.org, Markus Theil , David Marchand Date: Fri, 19 Apr 2019 13:47:39 +0100 Message-Id: <20190419124739.79412-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190418152056.15018-1-xiaolong.ye@intel.com> References: <20190418152056.15018-1-xiaolong.ye@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] net/af_xdp: fix creating multiple instance 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190419124739.UJ0R86roVe7p1HIDzKWEV0MS4mPcBZ9vaxt9Ohcyvaw@z> From: Xiaolong Ye Naming the buf_ring and umem memzone 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 Reviewed-by: David Marchand --- v2: * squashed buf_ring & memzone patches * removed unused return value * changed format specifier to unsigned --- drivers/net/af_xdp/rte_eth_af_xdp.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 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..acf9ad605 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,8 @@ 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]; + char mz_name[RTE_MEMZONE_NAMESIZE]; int ret; uint64_t i; @@ -491,7 +493,9 @@ xsk_umem_info *xdp_umem_configure(void) return NULL; } - umem->buf_ring = rte_ring_create("af_xdp_ring", + snprintf(ring_name, sizeof(ring_name), "af_xdp_ring_%s_%u", + internals->if_name, internals->queue_idx); + umem->buf_ring = rte_ring_create(ring_name, ETH_AF_XDP_NUM_BUFFERS, rte_socket_id(), 0x0); @@ -505,7 +509,9 @@ xsk_umem_info *xdp_umem_configure(void) (void *)(i * ETH_AF_XDP_FRAME_SIZE + ETH_AF_XDP_DATA_HEADROOM)); - mz = rte_memzone_reserve_aligned("af_xdp uemem", + snprintf(mz_name, sizeof(mz_name), "af_xdp_umem_%s_%u", + internals->if_name, internals->queue_idx); + mz = rte_memzone_reserve_aligned(mz_name, ETH_AF_XDP_NUM_BUFFERS * ETH_AF_XDP_FRAME_SIZE, rte_socket_id(), RTE_MEMZONE_IOVA_CONTIG, getpagesize()); @@ -541,7 +547,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.20.1