DPDK patches and discussions
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: dev@dpdk.org, ajit.khaparde@broadcom.com
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 10/10] net/bnxt: fix to cap max rings to minimum of compl rings and stat contexts
Date: Mon, 13 Jan 2020 10:06:09 +0530	[thread overview]
Message-ID: <20200113043609.27363-11-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20200113043609.27363-1-kalesh-anakkur.purayil@broadcom.com>

From: Somnath Kotur <somnath.kotur@broadcom.com>

Max Tx rings count could be lesser than max Rx rings in some
cases, so take this into account as well.

Account for stat contexts available(one for each ring) along with
no: of completion rings(one for each ring) to cap the max no: of
Tx /Rx rings that can be possibly created.

Fixes: f03e66cb ("net/bnxt: limit queue count for NS3/Stingray devices")

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 3487b91..ddb2681 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -622,12 +622,19 @@ struct bnxt {
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
 #define MAX_STINGRAY_RINGS		128U
-#define BNXT_MAX_RINGS(bp) \
+/* For sake of symmetry, max Tx rings == max Rx rings, one stat ctx for each */
+#define BNXT_MAX_RX_RINGS(bp) \
 	(BNXT_STINGRAY(bp) ? RTE_MIN(RTE_MIN(bp->max_rx_rings, \
 					     MAX_STINGRAY_RINGS), \
-				     bp->max_stat_ctx) : \
-				RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx))
+				     bp->max_stat_ctx / 2U) : \
+				RTE_MIN(bp->max_rx_rings, \
+					bp->max_stat_ctx / 2U))
+#define BNXT_MAX_TX_RINGS(bp) \
+	(RTE_MIN((bp)->max_tx_rings, BNXT_MAX_RX_RINGS(bp)))
 
+#define BNXT_MAX_RINGS(bp) \
+	(RTE_MIN((((bp)->max_cp_rings - BNXT_NUM_ASYNC_CPR(bp)) / 2U), \
+		 BNXT_MAX_TX_RINGS(bp)))
 	uint16_t		max_nq_rings;
 	uint16_t		max_l2_ctx;
 	uint16_t		max_rx_em_flows;
-- 
2.10.1


      parent reply	other threads:[~2020-01-13  4:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-13  4:35 [dpdk-dev] [PATCH 00/10] bnxt patch set with fixes Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 01/10] net/bnxt: handle flow create failure Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 02/10] net/bnxt: fix probe failure in FreeBSD Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 03/10] net/bnxt: fix to use correct IOVA mapping Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 04/10] net/bnxt: fix enable/disable VLAN filtering Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 05/10] net/bnxt: fix enable/disable vlan strip Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 06/10] net/bnxt: handle hw filter setting when port is stopped Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 07/10] net/bnxt: fix a memory leak in port stop Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 08/10] net/bnxt: use macro for PCI log format Kalesh A P
2020-01-13  4:36 ` [dpdk-dev] [PATCH 09/10] net/bnxt: release port upon close Kalesh A P
2020-01-13  4:36 ` Kalesh A P [this message]

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=20200113043609.27363-11-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=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).