From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rnd-relay.smtp.broadcom.com (rnd-relay.smtp.broadcom.com [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 0A8FA1B1B0 for ; Wed, 10 Jan 2018 23:12:37 +0100 (CET) Received: from nis-sj1-27.broadcom.com (nis-sj1-27.lvn.broadcom.net [10.75.144.136]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 3B55330C068; Wed, 10 Jan 2018 14:12:34 -0800 (PST) Received: from C02PT1RBG8WP.dhcp.broadcom.net (c02pt1rbg8wp.dhcp.broadcom.net [10.136.50.173]) by nis-sj1-27.broadcom.com (Postfix) with ESMTP id 1E8B0AC074A; Wed, 10 Jan 2018 14:12:19 -0800 (PST) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Wed, 10 Jan 2018 14:12:16 -0800 Message-Id: <20180110221216.94484-1-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.14.3 (Apple Git-98) Subject: [dpdk-dev] [PATCH] net/bnxt: fix check for on-chip resources 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: Wed, 10 Jan 2018 22:12:39 -0000 In some cases tx_nr_rings/rx_nr_rings may not be initialized. In those scenarios, we may wrongly fail device initialization. This patch fixes it. Use max_tx_rings/max_rx_rings instead. Fixes: 2da0426e7cf8 ("net/bnxt: check on-chip resources") Signed-off-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 87a07bab9..36c01fa69 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -530,8 +530,8 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) bp->tx_queues = (void *)eth_dev->data->tx_queues; /* Inherit new configurations */ - if (eth_dev->data->nb_rx_queues > bp->rx_nr_rings || - eth_dev->data->nb_tx_queues > bp->tx_nr_rings || + if (eth_dev->data->nb_rx_queues > bp->max_rx_rings || + eth_dev->data->nb_tx_queues > bp->max_tx_rings || eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues + 1 > bp->max_cp_rings || eth_dev->data->nb_rx_queues + eth_dev->data->nb_tx_queues > @@ -545,7 +545,7 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) eth_dev->data->nb_rx_queues); RTE_LOG(ERR, PMD, "Res available: TxQ %d, RxQ %d, CQ %d Stat %d, Grp %d\n", - bp->tx_nr_rings, bp->rx_nr_rings, bp->max_cp_rings, + bp->max_tx_rings, bp->max_rx_rings, bp->max_cp_rings, bp->max_stat_ctx, bp->max_ring_grps); return -ENOSPC; } -- 2.14.3 (Apple Git-98)