From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 649CAA0563; Thu, 27 Feb 2020 22:00:14 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 11BD02C02; Thu, 27 Feb 2020 22:00:13 +0100 (CET) Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 75A77B62 for ; Thu, 27 Feb 2020 22:00:11 +0100 (CET) Received: from uucp by smtp.tuxdriver.com with local-rmail (Exim 4.63) (envelope-from ) id 1j7QGP-0004Ur-FS; Thu, 27 Feb 2020 16:00:09 -0500 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.15.2/8.14.6) with ESMTP id 01RKu4K1019485; Thu, 27 Feb 2020 15:56:04 -0500 Received: (from linville@localhost) by localhost.localdomain (8.15.2/8.15.2/Submit) id 01RKu4nc019484; Thu, 27 Feb 2020 15:56:04 -0500 Date: Thu, 27 Feb 2020 15:56:04 -0500 From: "John W. Linville" To: Stephen Hemminger Cc: dev@dpdk.org Message-ID: <20200227205604.GC3353@tuxdriver.com> References: <20200224231117.16354-1-stephen@networkplumber.org> <20200227200003.746-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200227200003.746-1-stephen@networkplumber.org> User-Agent: Mutt/1.12.1 (2019-06-15) Subject: Re: [dpdk-dev] [PATCH v2] net/af_packet: remove limitation on number of qpairs 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" On Thu, Feb 27, 2020 at 12:00:03PM -0800, Stephen Hemminger wrote: > Since qpairs is part of the vdev arguments, there is no need to > limit it to 16. The queue arrays can be dynamically sized based > on the requested parameters. > > Signed-off-by: Stephen Hemminger LGTM! Acked-by: John W. Linville > --- > drivers/net/af_packet/rte_eth_af_packet.c | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c > index f5806bf42c46..e5e0aa9277a8 100644 > --- a/drivers/net/af_packet/rte_eth_af_packet.c > +++ b/drivers/net/af_packet/rte_eth_af_packet.c > @@ -37,8 +37,6 @@ > #define DFLT_FRAME_SIZE (1 << 11) > #define DFLT_FRAME_COUNT (1 << 9) > > -#define RTE_PMD_AF_PACKET_MAX_RINGS 16 > - > struct pkt_rx_queue { > int sockfd; > > @@ -77,8 +75,8 @@ struct pmd_internals { > > struct tpacket_req req; > > - struct pkt_rx_queue rx_queue[RTE_PMD_AF_PACKET_MAX_RINGS]; > - struct pkt_tx_queue tx_queue[RTE_PMD_AF_PACKET_MAX_RINGS]; > + struct pkt_rx_queue *rx_queue; > + struct pkt_tx_queue *tx_queue; > }; > > static const char *valid_arguments[] = { > @@ -601,6 +599,18 @@ rte_pmd_init_internals(struct rte_vdev_device *dev, > if (*internals == NULL) > return -1; > > + > + (*internals)->rx_queue = rte_calloc_socket("af_packet_rx", > + nb_queues, > + sizeof(struct pkt_rx_queue), > + 0, numa_node); > + (*internals)->tx_queue = rte_calloc_socket("af_packet_tx", > + nb_queues, > + sizeof(struct pkt_tx_queue), > + 0, numa_node); > + if (!(*internals)->rx_queue || !(*internals)->tx_queue) > + return -1; > + > for (q = 0; q < nb_queues; q++) { > (*internals)->rx_queue[q].map = MAP_FAILED; > (*internals)->tx_queue[q].map = MAP_FAILED; > @@ -846,8 +856,7 @@ rte_eth_from_packet(struct rte_vdev_device *dev, > pair = &kvlist->pairs[k_idx]; > if (strstr(pair->key, ETH_AF_PACKET_NUM_Q_ARG) != NULL) { > qpairs = atoi(pair->value); > - if (qpairs < 1 || > - qpairs > RTE_PMD_AF_PACKET_MAX_RINGS) { > + if (qpairs < 1) { > PMD_LOG(ERR, > "%s: invalid qpairs value", > name); > @@ -1019,6 +1028,8 @@ rte_pmd_af_packet_remove(struct rte_vdev_device *dev) > rte_free(internals->tx_queue[q].rd); > } > free(internals->if_name); > + rte_free(internals->rx_queue); > + rte_free(internals->tx_queue); > > rte_eth_dev_release_port(eth_dev); > > -- > 2.20.1 > > -- John W. Linville Someday the world will need a hero, and you linville@tuxdriver.com might be all we have. Be ready.