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 DD905A0561; Thu, 27 Feb 2020 21:00:15 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E87052C02; Thu, 27 Feb 2020 21:00:14 +0100 (CET) Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by dpdk.org (Postfix) with ESMTP id 576221F1C for ; Thu, 27 Feb 2020 21:00:13 +0100 (CET) Received: by mail-pj1-f65.google.com with SMTP id ep11so244853pjb.2 for ; Thu, 27 Feb 2020 12:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EXUJ5Jf093EveMMSe7XZIT7V3ipshkOSd/QJquPwtaw=; b=hwkLGH5+9VHyWMonNtHVRQ8Szh6qQg0PFoKTaoGRi0r9TDhwn2zXbr8S6LYPUOrtfe boLeA7TUQa7FL2tHuCHgr7efsofK5tpF8jI8ipG+hvRP9LARxhRQ2n687cwwOjvKE/jj vOJ2gZ2TvbI/DTcNL7YSWSffSt7zAH1yplGpqFiYnzzGiHODpW3o9dZE9uXdqRw0I3L2 wy/Yri/9thW5DKd6BkLvPsh/CjGCS4FMJ+f9iP3Y08ExYzsXPNvGt9Mv+2p8irRN1sLu cdtPbMMdITZsQuDPj+anwoTD2Sbt3oAC+/xJwPD3TZo5uVhBuCy3x93ksz/fA24KkmLM O/sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EXUJ5Jf093EveMMSe7XZIT7V3ipshkOSd/QJquPwtaw=; b=BY7i9x0ZCIiXVUhhhZ2hy8AwabcwlR3BewtsjUC2kw7E6fzgxtNs5FPFQDxT3PwwJg 8/1PCpa8mVNzEgNrtxAn7gNUnFmfDMmhLDMS/dXfU4coKdf7Vp4JpCenLXD7XgfcxE4t u7WIDfxKlbi2lMGcOyUyuYMO96TOoQV5EYEhy1utPY4GFXDcdT0+xET1DUh/juXgRlVI lIQ+Mer4qTtxEmLbmoa7GfChE4jT+piE+5wB9EyfbfxnGY/qAl6VGSoEo5emnmP4Z7BV E+gsSgKwzo0hybtDlOZDSg0K0aMyX1W2HQzhtSVCdi3AtTRk8D9Vgf5e/Kud38dEeJGr mMWA== X-Gm-Message-State: APjAAAW12GIU7fXzLH1XtCTs7vSUjopHV7QG9sV1V96VQvaKU3MbpA0v jUAWcjsBgOmJuxkqKyBmJ9IYC5CNW7s= X-Google-Smtp-Source: APXvYqwAVATqG37FG2sCseger3hehakKlMO08kYgwQG4HWmBgbOTpi+O+uo3GGWZgCXMxmzrUGGPCg== X-Received: by 2002:a17:90a:d104:: with SMTP id l4mr673927pju.60.1582833611163; Thu, 27 Feb 2020 12:00:11 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id z10sm7334222pgf.35.2020.02.27.12.00.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 12:00:10 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Thu, 27 Feb 2020 12:00:03 -0800 Message-Id: <20200227200003.746-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200224231117.16354-1-stephen@networkplumber.org> References: <20200224231117.16354-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" 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 --- 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