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 E95ACA00C3 for ; Fri, 15 May 2020 20:45:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 61D551DB22; Fri, 15 May 2020 20:45:56 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 6E6B71DABD; Fri, 15 May 2020 20:45:51 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id E01D391BD1; Fri, 15 May 2020 11:44:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com E01D391BD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1589568283; bh=zcYm5AFdl10xRLFhsguv/e6WGSvcwPI1364LdkapUH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=keV7O2zgmZiWuc6tnx+6LmVMyioxO2ggWn7yBl8GSPRq+RIVNG+uJxhWuyLdUeHt2 ejm2dZW+UPqdyf33MRQUFB5GhZosldf5ULa22HB8CKRmAWcpRdFPNEajc+obrAITSo Z+6gAOWsND2v8l5/5CoXtFBo/GoMyZpvXdIjo/Ng= Received: from localhost.localdomain (unknown [10.230.185.215]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id D374314008B; Fri, 15 May 2020 11:45:49 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, stable@dpdk.org, Kalesh AP , Somnath Kotur Date: Fri, 15 May 2020 11:45:36 -0700 Message-Id: <20200515184542.89318-4-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20200515184542.89318-1-ajit.khaparde@broadcom.com> References: <20200515184542.89318-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v1 3/9] net/bnxt: fix to alloc COS queue info dynamically X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Fixes: 698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue") Cc: stable@dpdk.org Signed-off-by: Ajit Khaparde Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 4 ++-- drivers/net/bnxt/bnxt_ethdev.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index f4b39b345..570767253 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -637,8 +637,8 @@ struct bnxt { uint32_t hwrm_cmd_timeout; struct bnxt_link_info link_info; - struct bnxt_cos_queue_info rx_cos_queue[BNXT_COS_QUEUE_COUNT]; - struct bnxt_cos_queue_info tx_cos_queue[BNXT_COS_QUEUE_COUNT]; + struct bnxt_cos_queue_info *rx_cos_queue; + struct bnxt_cos_queue_info *tx_cos_queue; uint8_t tx_cosq_id[BNXT_COS_QUEUE_COUNT]; uint8_t rx_cosq_cnt; uint8_t max_tc; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 3bd30dfa1..fa1f84d44 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -197,6 +197,12 @@ static void bnxt_free_leds_info(struct bnxt *bp) bp->leds = NULL; } +static void bnxt_free_cos_queues(struct bnxt *bp) +{ + rte_free(bp->rx_cos_queue); + rte_free(bp->tx_cos_queue); +} + static void bnxt_free_mem(struct bnxt *bp, bool reconfig) { bnxt_free_filter_mem(bp); @@ -230,6 +236,27 @@ static int bnxt_alloc_leds_info(struct bnxt *bp) return 0; } +static int bnxt_alloc_cos_queues(struct bnxt *bp) +{ + bp->rx_cos_queue = + rte_zmalloc("bnxt_rx_cosq", + BNXT_COS_QUEUE_COUNT * + sizeof(struct bnxt_cos_queue_info), + 0); + if (bp->rx_cos_queue == NULL) + return -ENOMEM; + + bp->tx_cos_queue = + rte_zmalloc("bnxt_tx_cosq", + BNXT_COS_QUEUE_COUNT * + sizeof(struct bnxt_cos_queue_info), + 0); + if (bp->tx_cos_queue == NULL) + return -ENOMEM; + + return 0; +} + static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig) { int rc; @@ -1234,6 +1261,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev) bnxt_uninit_resources(bp, false); bnxt_free_leds_info(bp); + bnxt_free_cos_queues(bp); eth_dev->dev_ops = NULL; eth_dev->rx_pkt_burst = NULL; @@ -5382,6 +5410,10 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev) if (rc) goto error_free; + rc = bnxt_alloc_cos_queues(bp); + if (rc) + goto error_free; + rc = bnxt_init_resources(bp, false); if (rc) goto error_free; -- 2.21.1 (Apple Git-122.3)