DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH] net/bnxt: fix check for on-chip resources
Date: Wed, 10 Jan 2018 14:12:16 -0800	[thread overview]
Message-ID: <20180110221216.94484-1-ajit.khaparde@broadcom.com> (raw)

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 <ajit.khaparde@broadcom.com>
---
 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)

             reply	other threads:[~2018-01-10 22:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 22:12 Ajit Khaparde [this message]
2018-01-11 18:27 ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180110221216.94484-1-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).