patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable

From: Samik Gupta <samik.gupta@broadcom.com>

This commit introduces a limit on the number of RX rings included in
the RSS redirection table to a value no larger than the size supported
by Thor as defined by BNXT_RSS_TBL_SIZE_THOR.

Fixes: d819382543f3 ("net/bnxt: add RSS redirection table operations")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 90ced972c..9bd4f1da9 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -389,7 +389,7 @@ struct bnxt_coal {
 #define DBR_TYPE_NQ				(0xaULL << 60)
 #define DBR_TYPE_NQ_ARM				(0xbULL << 60)
 
-#define BNXT_RSS_TBL_SIZE_THOR		512
+#define BNXT_RSS_TBL_SIZE_THOR		512U
 #define BNXT_RSS_ENTRIES_PER_CTX_THOR	64
 #define BNXT_MAX_RSS_CTXTS_THOR \
 	(BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 81c8f8d79..c363c8427 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -207,12 +207,15 @@ int is_bnxt_in_error(struct bnxt *bp)
 
 static uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 {
+	unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
+					     BNXT_RSS_TBL_SIZE_THOR);
+
 	if (!BNXT_CHIP_THOR(bp))
 		return 1;
 
-	return RTE_ALIGN_MUL_CEIL(bp->rx_nr_rings,
+	return RTE_ALIGN_MUL_CEIL(num_rss_rings,
 				  BNXT_RSS_ENTRIES_PER_CTX_THOR) /
-				    BNXT_RSS_ENTRIES_PER_CTX_THOR;
+				  BNXT_RSS_ENTRIES_PER_CTX_THOR;
 }
 
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
@@ -424,6 +427,14 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
 		int j, nr_ctxs = bnxt_rss_ctxts(bp);
 
+		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_THOR) {
+			PMD_DRV_LOG(ERR, "RxQ cnt %d > reta_size %d\n",
+				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_THOR);
+			PMD_DRV_LOG(ERR,
+				    "Only queues 0-%d will be in RSS table\n",
+				    BNXT_RSS_TBL_SIZE_THOR - 1);
+		}
+
 		rc = 0;
 		for (j = 0; j < nr_ctxs; j++) {
 			rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, j);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable, Lance Richardson, Somnath Kotur

From: Samik Gupta <samik.gupta@broadcom.com>

This commit reconfigures a vnic's default ring if the current default
ring is stopped by the application. It picks the lowest numbered ring
that is currently active to be the new default, and issues the
hwrm_vnic_cfg command to update the configuration. Applies to adapters
that are not Thor-based.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>

Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index e0ec34216..61196eba9 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -557,12 +557,12 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 	}
 
-	if (BNXT_CHIP_THOR(bp)) {
-		/* Compute current number of active receive queues. */
-		for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
-			if (bp->rx_queues[i]->rx_started)
-				active_queue_cnt++;
+	/* Compute current number of active receive queues. */
+	for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
+		if (bp->rx_queues[i]->rx_started)
+			active_queue_cnt++;
 
+	if (BNXT_CHIP_THOR(bp)) {
 		/*
 		 * For Thor, we need to ensure that the VNIC default receive
 		 * ring corresponds to an active receive queue. When no queue
@@ -582,6 +582,22 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 			/* Reconfigure default receive ring. */
 			bnxt_hwrm_vnic_cfg(bp, vnic);
 		}
+	} else if (active_queue_cnt) {
+		/*
+		 * If the queue being stopped is the current default queue and
+		 * there are other active queues, pick one of them as the
+		 * default and reconfigure the vnic.
+		 */
+		if (vnic->dflt_ring_grp == bp->grp_info[rx_queue_id].fw_grp_id) {
+			for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++) {
+				if (bp->rx_queues[i]->rx_started) {
+					vnic->dflt_ring_grp =
+						bp->grp_info[i].fw_grp_id;
+					bnxt_hwrm_vnic_cfg(bp, vnic);
+					break;
+				}
+			}
+		}
 	}
 
 	if (rc == 0)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In __bnxt_hwrm_func_qcaps, when memory allocations fails
driver is not releasing the hwrm lock. This patch fixes it
by calling hwrm_unlock in that error case.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index ebbf504c0..784e9778a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -718,6 +718,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 			    sizeof(bp->pf->vf_info[0]) * new_max_vfs, 0);
 			if (bp->pf->vf_info == NULL) {
 				PMD_DRV_LOG(ERR, "Alloc vf info fail\n");
+				HWRM_UNLOCK();
 				return -ENOMEM;
 			}
 			bp->pf->max_vfs = new_max_vfs;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
                   ` (2 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In bnxt_reta_update_op() and bnxt_rss_hash_update_op(), driver does not
propagate the error back to the application when the fw command fails.

Fixes: 378ab645bb0b ("net/bnxt: fix RSS RETA indirection table ops")
Fixes: fcc0aa1edc10 ("net/bnxt: add RSS hash configuration")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 8047b0b5d..33358779b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1843,8 +1843,8 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 		}
 	}
 
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
@@ -1949,8 +1949,8 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 	memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len);
 
 rss_config:
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
                   ` (3 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: stable

In case mutex init fails during initialization, start cleanup and
fail the initialization process.

Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 33358779b..0b14ca234 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4739,8 +4739,10 @@ bnxt_init_locks(struct bnxt *bp)
 	}
 
 	err = pthread_mutex_init(&bp->def_cp_lock, NULL);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
+		return err;
+	}
 
 	err = pthread_mutex_init(&bp->health_check_lock, NULL);
 	if (err)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
                   ` (4 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 09/17] net/bnxt: fix max rings computation Ajit Khaparde
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: stable

&device requires the %u format specifer not the %d specifier, as
&device is unsigned.

Fixes: a46bbb57605b ("net/bnxt: update multi device design")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 24d49096a..3409cbbce 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -82,7 +82,7 @@ tf_open_session(struct tf *tfp,
 		return rc;
 
 	TFP_DRV_LOG(INFO,
-		    "domain:%d, bus:%d, device:%d\n",
+		    "domain:%d, bus:%d, device:%u\n",
 		    parms->session_id.internal.domain,
 		    parms->session_id.internal.bus,
 		    parms->session_id.internal.device);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 09/17] net/bnxt: fix max rings computation
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
                   ` (5 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Sriharsha Basavapatna, stable, Somnath Kotur

From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

The current max_rings computation does not take into account the case
when max_nq_rings is <= num_async_cpr. This results in a wrong value
like 0, when max_nq_rings is 1. Fix this by subtracting num_async_cpr
only when max_cp_rings > num_async_cpr.

Apart from this, the entire logic is currently spread across a few
macros, making it hard to read and debug this code. Move this code
into an inline function.

max_msix is not used in the max_rings calculation.
Apparently the max_msix field returned in HWRM_RESC_QCAPS is only
valid for Thor and newer chips. On Wh+ it will be equal to min_compl_rings.
Also, when a function reset is performed on an application quit, FW
will not reset the VF resource pool as per design.
This can lead to a strange condition wherein the max_msix field
on Wh+ keeps changing on each application re-load thereby throwing
throwing off the max_rings computation.

Fixes: f03e66cb64ce ("net/bnxt: limit queue count for NS3/Stingray devices")
Cc: stable@dpdk.org

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 41 +++++++++++++++++++++++-----------
 drivers/net/bnxt/bnxt_ethdev.c |  2 +-
 drivers/net/bnxt/bnxt_rxq.c    |  7 +++---
 drivers/net/bnxt/bnxt_txq.c    |  2 +-
 4 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9c1c87489..bc0935272 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -752,19 +752,6 @@ struct bnxt {
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
 #define MAX_STINGRAY_RINGS		128U
-/* 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 / 2U, \
-					     MAX_STINGRAY_RINGS), \
-				     bp->max_stat_ctx / 2U) : \
-				RTE_MIN(bp->max_rx_rings / 2U, \
-					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)))
 
 #define BNXT_MAX_VF_REP_RINGS	8
 
@@ -822,6 +809,34 @@ struct bnxt {
 	uint16_t		tx_cfa_action;
 };
 
+static
+inline uint16_t bnxt_max_rings(struct bnxt *bp)
+{
+	uint16_t max_tx_rings = bp->max_tx_rings;
+	uint16_t max_rx_rings = bp->max_rx_rings;
+	uint16_t max_cp_rings = bp->max_cp_rings;
+	uint16_t max_rings;
+
+	/* For the sake of symmetry:
+	 * max Tx rings == max Rx rings, one stat ctx for each.
+	 */
+	if (BNXT_STINGRAY(bp)) {
+		max_rx_rings = RTE_MIN(RTE_MIN(max_rx_rings / 2U,
+					       MAX_STINGRAY_RINGS),
+				       bp->max_stat_ctx / 2U);
+	} else {
+		max_rx_rings = RTE_MIN(max_rx_rings / 2U,
+				       bp->max_stat_ctx / 2U);
+	}
+
+	max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
+	if (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))
+		max_cp_rings -= BNXT_NUM_ASYNC_CPR(bp);
+	max_rings = RTE_MIN(max_cp_rings / 2U, max_tx_rings);
+
+	return max_rings;
+}
+
 #define BNXT_FC_TIMER	1 /* Timer freq in Sec Flow Counters */
 
 /**
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0b14ca234..bf8963577 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -920,7 +920,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	if (BNXT_PF(bp))
 		dev_info->max_vfs = pdev->max_vfs;
 
-	max_rx_rings = BNXT_MAX_RINGS(bp);
+	max_rx_rings = bnxt_max_rings(bp);
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
 	dev_info->max_tx_queues = max_rx_rings;
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 328cc994d..19e11e47b 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -311,7 +311,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Rx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_rx_rings);
@@ -364,8 +364,9 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	eth_dev->data->rx_queues[queue_idx] = rxq;
 	/* Allocate RX ring hardware descriptors */
-	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
-			     "rxr")) {
+	rc = bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
+			     "rxr");
+	if (rc) {
 		PMD_DRV_LOG(ERR,
 			    "ring_dma_zone_reserve for rx_ring failed!\n");
 		goto err;
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index c9792a2af..99a31cef2 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -98,7 +98,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Tx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_tx_rings);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
                   ` (6 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 09/17] net/bnxt: fix max rings computation Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 14/17] net/bnxt: fix PF resource query Ajit Khaparde
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

1. moved invalid VNIC id check to the beginning of the function.
2. removed a duplicate check which avoids unnecessary code indentation.

Fixes: 49d0709b257fc ("net/bnxt: delete and flush L2 filters cleanly")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 42 +++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6f5402070..cee2656c1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4896,37 +4896,35 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	unsigned int rss_idx, fw_idx, i;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+		return 0;
+
 	if (!(vnic->rss_table && vnic->hash_type))
 		return 0;
 
 	if (BNXT_CHIP_P5(bp))
 		return bnxt_vnic_rss_configure_p5(bp, vnic);
 
-	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
-		return 0;
-
-	if (vnic->rss_table && vnic->hash_type) {
-		/*
-		 * Fill the RSS hash & redirection table with
-		 * ring group ids for all VNICs
-		 */
-		for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
-			rss_idx++, fw_idx++) {
-			for (i = 0; i < bp->rx_cp_nr_rings; i++) {
-				fw_idx %= bp->rx_cp_nr_rings;
-				if (vnic->fw_grp_ids[fw_idx] !=
-				    INVALID_HW_RING_ID)
-					break;
-				fw_idx++;
-			}
-			if (i == bp->rx_cp_nr_rings)
-				return 0;
-			vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
+	/*
+	 * Fill the RSS hash & redirection table with
+	 * ring group ids for all VNICs
+	 */
+	for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+	     rss_idx++, fw_idx++) {
+		for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+			fw_idx %= bp->rx_cp_nr_rings;
+			if (vnic->fw_grp_ids[fw_idx] != INVALID_HW_RING_ID)
+				break;
+			fw_idx++;
 		}
-		return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+
+		if (i == bp->rx_cp_nr_rings)
+			return 0;
+
+		vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
 	}
 
-	return 0;
+	return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 }
 
 static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v2 14/17] net/bnxt: fix PF resource query
       [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
                   ` (7 preceding siblings ...)
  2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
@ 2020-12-09 19:22 ` Ajit Khaparde
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
  9 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 19:22 UTC (permalink / raw)
  To: dev; +Cc: Somnath Kotur, stable, Venkat Duvvuru, Kalesh AP

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

This cmd should be called by every driver after 'hwrm_func_cfg'
to get the actual number of resources allocated by the HWRM.
The values returned in the cmd are the max values for that PF.

Also, now that the max values for the PF are computed in probe itself,
no need to invoke FUNC_QCAPs or any other cmd in dev_configure_op()
as that would just override the actual max values obtained above.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c |  7 -------
 drivers/net/bnxt/bnxt_hwrm.c   | 36 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index bf8963577..21d9e26ca 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1071,13 +1071,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		}
 
 		pthread_mutex_unlock(&bp->def_cp_lock);
-	} else {
-		/* legacy driver needs to get updated values */
-		rc = bnxt_hwrm_func_qcaps(bp);
-		if (rc) {
-			PMD_DRV_LOG(ERR, "hwrm func qcaps fail:%d\n", rc);
-			return rc;
-		}
 	}
 
 	/* Inherit new configurations */
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index cee2656c1..a3eb133c0 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3456,6 +3456,35 @@ static int bnxt_update_max_resources(struct bnxt *bp,
 	return 0;
 }
 
+/* Update the PF resource values based on how many resources
+ * got allocated to it.
+ */
+static int bnxt_update_max_resources_pf_only(struct bnxt *bp)
+{
+	struct hwrm_func_qcfg_input req = {0};
+	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc;
+
+	/* Get the actual allocated values now */
+	HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB);
+	req.fid = rte_cpu_to_le_16(0xffff);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+	HWRM_CHECK_RESULT();
+
+	bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->alloc_rsscos_ctx);
+	bp->max_stat_ctx = rte_le_to_cpu_16(resp->alloc_stat_ctx);
+	bp->max_cp_rings = rte_le_to_cpu_16(resp->alloc_cmpl_rings);
+	bp->max_tx_rings = rte_le_to_cpu_16(resp->alloc_tx_rings);
+	bp->max_rx_rings = rte_le_to_cpu_16(resp->alloc_rx_rings);
+	bp->max_l2_ctx = rte_le_to_cpu_16(resp->alloc_l2_ctx);
+	bp->max_ring_grps = rte_le_to_cpu_16(resp->alloc_hw_ring_grps);
+	bp->max_vnics = rte_le_to_cpu_16(resp->alloc_vnics);
+
+	HWRM_UNLOCK();
+
+	return 0;
+}
+
 int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
 {
 	struct hwrm_func_qcfg_input req = {0};
@@ -3555,8 +3584,13 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
 		  HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE);
 	bp->pf->func_cfg_flags |=
 		HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE;
+
 	rc = bnxt_hwrm_pf_func_cfg(bp, &pf_resc);
-	rc = __bnxt_hwrm_func_qcaps(bp);
+	if (rc)
+		return rc;
+
+	rc = bnxt_update_max_resources_pf_only(bp);
+
 	return rc;
 }
 
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
                     ` (7 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable

From: Samik Gupta <samik.gupta@broadcom.com>

This commit introduces a limit on the number of RX rings included in
the RSS redirection table to a value no larger than the size supported
by Thor as defined by BNXT_RSS_TBL_SIZE_THOR.

Fixes: d819382543f3 ("net/bnxt: add RSS redirection table operations")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  2 +-
 drivers/net/bnxt/bnxt_ethdev.c | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 90ced972c..9bd4f1da9 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -389,7 +389,7 @@ struct bnxt_coal {
 #define DBR_TYPE_NQ				(0xaULL << 60)
 #define DBR_TYPE_NQ_ARM				(0xbULL << 60)
 
-#define BNXT_RSS_TBL_SIZE_THOR		512
+#define BNXT_RSS_TBL_SIZE_THOR		512U
 #define BNXT_RSS_ENTRIES_PER_CTX_THOR	64
 #define BNXT_MAX_RSS_CTXTS_THOR \
 	(BNXT_RSS_TBL_SIZE_THOR / BNXT_RSS_ENTRIES_PER_CTX_THOR)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 81c8f8d79..c363c8427 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -207,12 +207,15 @@ int is_bnxt_in_error(struct bnxt *bp)
 
 static uint16_t bnxt_rss_ctxts(const struct bnxt *bp)
 {
+	unsigned int num_rss_rings = RTE_MIN(bp->rx_nr_rings,
+					     BNXT_RSS_TBL_SIZE_THOR);
+
 	if (!BNXT_CHIP_THOR(bp))
 		return 1;
 
-	return RTE_ALIGN_MUL_CEIL(bp->rx_nr_rings,
+	return RTE_ALIGN_MUL_CEIL(num_rss_rings,
 				  BNXT_RSS_ENTRIES_PER_CTX_THOR) /
-				    BNXT_RSS_ENTRIES_PER_CTX_THOR;
+				  BNXT_RSS_ENTRIES_PER_CTX_THOR;
 }
 
 uint16_t bnxt_rss_hash_tbl_size(const struct bnxt *bp)
@@ -424,6 +427,14 @@ static int bnxt_setup_one_vnic(struct bnxt *bp, uint16_t vnic_id)
 	if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS) {
 		int j, nr_ctxs = bnxt_rss_ctxts(bp);
 
+		if (bp->rx_nr_rings > BNXT_RSS_TBL_SIZE_THOR) {
+			PMD_DRV_LOG(ERR, "RxQ cnt %d > reta_size %d\n",
+				    bp->rx_nr_rings, BNXT_RSS_TBL_SIZE_THOR);
+			PMD_DRV_LOG(ERR,
+				    "Only queues 0-%d will be in RSS table\n",
+				    BNXT_RSS_TBL_SIZE_THOR - 1);
+		}
+
 		rc = 0;
 		for (j = 0; j < nr_ctxs; j++) {
 			rc = bnxt_hwrm_vnic_ctx_alloc(bp, vnic, j);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
                     ` (6 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Samik Gupta, stable, Lance Richardson, Somnath Kotur

From: Samik Gupta <samik.gupta@broadcom.com>

This commit reconfigures a vnic's default ring if the current default
ring is stopped by the application. It picks the lowest numbered ring
that is currently active to be the new default, and issues the
hwrm_vnic_cfg command to update the configuration. Applies to adapters
that are not Thor-based.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>

Signed-off-by: Samik Gupta <samik.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index e0ec34216..61196eba9 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -557,12 +557,12 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 		rc = bnxt_vnic_rss_configure(bp, vnic);
 	}
 
-	if (BNXT_CHIP_THOR(bp)) {
-		/* Compute current number of active receive queues. */
-		for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
-			if (bp->rx_queues[i]->rx_started)
-				active_queue_cnt++;
+	/* Compute current number of active receive queues. */
+	for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++)
+		if (bp->rx_queues[i]->rx_started)
+			active_queue_cnt++;
 
+	if (BNXT_CHIP_THOR(bp)) {
 		/*
 		 * For Thor, we need to ensure that the VNIC default receive
 		 * ring corresponds to an active receive queue. When no queue
@@ -582,6 +582,22 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 			/* Reconfigure default receive ring. */
 			bnxt_hwrm_vnic_cfg(bp, vnic);
 		}
+	} else if (active_queue_cnt) {
+		/*
+		 * If the queue being stopped is the current default queue and
+		 * there are other active queues, pick one of them as the
+		 * default and reconfigure the vnic.
+		 */
+		if (vnic->dflt_ring_grp == bp->grp_info[rx_queue_id].fw_grp_id) {
+			for (i = vnic->start_grp_id; i < vnic->end_grp_id; i++) {
+				if (bp->rx_queues[i]->rx_started) {
+					vnic->dflt_ring_grp =
+						bp->grp_info[i].fw_grp_id;
+					bnxt_hwrm_vnic_cfg(bp, vnic);
+					break;
+				}
+			}
+		}
 	}
 
 	if (rc == 0)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
                     ` (5 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In __bnxt_hwrm_func_qcaps, when memory allocations fails
driver is not releasing the hwrm lock. This patch fixes it
by calling hwrm_unlock in that error case.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index ebbf504c0..784e9778a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -718,6 +718,7 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
 			    sizeof(bp->pf->vf_info[0]) * new_max_vfs, 0);
 			if (bp->pf->vf_info == NULL) {
 				PMD_DRV_LOG(ERR, "Alloc vf info fail\n");
+				HWRM_UNLOCK();
 				return -ENOMEM;
 			}
 			bp->pf->max_vfs = new_max_vfs;
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
                     ` (2 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
                     ` (4 subsequent siblings)
  8 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

In bnxt_reta_update_op() and bnxt_rss_hash_update_op(), driver does not
propagate the error back to the application when the fw command fails.

Fixes: 378ab645bb0b ("net/bnxt: fix RSS RETA indirection table ops")
Fixes: fcc0aa1edc10 ("net/bnxt: add RSS hash configuration")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 8047b0b5d..33358779b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1843,8 +1843,8 @@ static int bnxt_reta_update_op(struct rte_eth_dev *eth_dev,
 		}
 	}
 
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
@@ -1949,8 +1949,8 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev,
 	memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len);
 
 rss_config:
-	bnxt_hwrm_vnic_rss_cfg(bp, vnic);
-	return 0;
+	rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+	return rc;
 }
 
 static int bnxt_rss_hash_conf_get_op(struct rte_eth_dev *eth_dev,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
                     ` (3 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:42     ` [dpdk-stable] [dpdk-dev] " Lance Richardson
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
                     ` (3 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: stable

In case mutex init fails during initialization, start cleanup and
fail the initialization process.

Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 33358779b..0b14ca234 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -4739,8 +4739,10 @@ bnxt_init_locks(struct bnxt *bp)
 	}
 
 	err = pthread_mutex_init(&bp->def_cp_lock, NULL);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
+		return err;
+	}
 
 	err = pthread_mutex_init(&bp->health_check_lock, NULL);
 	if (err)
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
                     ` (4 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-10 15:54     ` [dpdk-stable] [dpdk-dev] " Lance Richardson
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 09/17] net/bnxt: fix max rings computation Ajit Khaparde
                     ` (2 subsequent siblings)
  8 siblings, 1 reply; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: stable

&device requires the %u format specifer not the %d specifier, as
&device is unsigned.

Fixes: a46bbb57605b ("net/bnxt: update multi device design")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/tf_core/tf_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
index 24d49096a..3409cbbce 100644
--- a/drivers/net/bnxt/tf_core/tf_core.c
+++ b/drivers/net/bnxt/tf_core/tf_core.c
@@ -82,7 +82,7 @@ tf_open_session(struct tf *tfp,
 		return rc;
 
 	TFP_DRV_LOG(INFO,
-		    "domain:%d, bus:%d, device:%d\n",
+		    "domain:%d, bus:%d, device:%u\n",
 		    parms->session_id.internal.domain,
 		    parms->session_id.internal.bus,
 		    parms->session_id.internal.device);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 09/17] net/bnxt: fix max rings computation
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
                     ` (5 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 14/17] net/bnxt: fix PF resource query Ajit Khaparde
  8 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Sriharsha Basavapatna, stable, Somnath Kotur

From: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>

The current max_rings computation does not take into account the case
when max_nq_rings is <= num_async_cpr. This results in a wrong value
like 0, when max_nq_rings is 1. Fix this by subtracting num_async_cpr
only when max_cp_rings > num_async_cpr.

Apart from this, the entire logic is currently spread across a few
macros, making it hard to read and debug this code. Move this code
into an inline function.

max_msix is not used in the max_rings calculation.
Apparently the max_msix field returned in HWRM_RESC_QCAPS is only
valid for Thor and newer chips. On Wh+ it will be equal to min_compl_rings.
Also, when a function reset is performed on an application quit, FW
will not reset the VF resource pool as per design.
This can lead to a strange condition wherein the max_msix field
on Wh+ keeps changing on each application re-load thereby throwing
throwing off the max_rings computation.

Fixes: f03e66cb64ce ("net/bnxt: limit queue count for NS3/Stingray devices")
Cc: stable@dpdk.org

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 41 +++++++++++++++++++++++-----------
 drivers/net/bnxt/bnxt_ethdev.c |  2 +-
 drivers/net/bnxt/bnxt_rxq.c    |  7 +++---
 drivers/net/bnxt/bnxt_txq.c    |  2 +-
 4 files changed, 34 insertions(+), 18 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9c1c87489..bc0935272 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -752,19 +752,6 @@ struct bnxt {
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
 #define MAX_STINGRAY_RINGS		128U
-/* 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 / 2U, \
-					     MAX_STINGRAY_RINGS), \
-				     bp->max_stat_ctx / 2U) : \
-				RTE_MIN(bp->max_rx_rings / 2U, \
-					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)))
 
 #define BNXT_MAX_VF_REP_RINGS	8
 
@@ -822,6 +809,34 @@ struct bnxt {
 	uint16_t		tx_cfa_action;
 };
 
+static
+inline uint16_t bnxt_max_rings(struct bnxt *bp)
+{
+	uint16_t max_tx_rings = bp->max_tx_rings;
+	uint16_t max_rx_rings = bp->max_rx_rings;
+	uint16_t max_cp_rings = bp->max_cp_rings;
+	uint16_t max_rings;
+
+	/* For the sake of symmetry:
+	 * max Tx rings == max Rx rings, one stat ctx for each.
+	 */
+	if (BNXT_STINGRAY(bp)) {
+		max_rx_rings = RTE_MIN(RTE_MIN(max_rx_rings / 2U,
+					       MAX_STINGRAY_RINGS),
+				       bp->max_stat_ctx / 2U);
+	} else {
+		max_rx_rings = RTE_MIN(max_rx_rings / 2U,
+				       bp->max_stat_ctx / 2U);
+	}
+
+	max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
+	if (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))
+		max_cp_rings -= BNXT_NUM_ASYNC_CPR(bp);
+	max_rings = RTE_MIN(max_cp_rings / 2U, max_tx_rings);
+
+	return max_rings;
+}
+
 #define BNXT_FC_TIMER	1 /* Timer freq in Sec Flow Counters */
 
 /**
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 0b14ca234..bf8963577 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -920,7 +920,7 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	if (BNXT_PF(bp))
 		dev_info->max_vfs = pdev->max_vfs;
 
-	max_rx_rings = BNXT_MAX_RINGS(bp);
+	max_rx_rings = bnxt_max_rings(bp);
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
 	dev_info->max_tx_queues = max_rx_rings;
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 328cc994d..19e11e47b 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -311,7 +311,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Rx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_rx_rings);
@@ -364,8 +364,9 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 
 	eth_dev->data->rx_queues[queue_idx] = rxq;
 	/* Allocate RX ring hardware descriptors */
-	if (bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
-			     "rxr")) {
+	rc = bnxt_alloc_rings(bp, queue_idx, NULL, rxq, rxq->cp_ring, NULL,
+			     "rxr");
+	if (rc) {
 		PMD_DRV_LOG(ERR,
 			    "ring_dma_zone_reserve for rx_ring failed!\n");
 		goto err;
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index c9792a2af..99a31cef2 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -98,7 +98,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= BNXT_MAX_RINGS(bp)) {
+	if (queue_idx >= bnxt_max_rings(bp)) {
 		PMD_DRV_LOG(ERR,
 			"Cannot create Tx ring %d. Only %d rings available\n",
 			queue_idx, bp->max_tx_rings);
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
                     ` (6 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 09/17] net/bnxt: fix max rings computation Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 14/17] net/bnxt: fix PF resource query Ajit Khaparde
  8 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

1. moved invalid VNIC id check to the beginning of the function.
2. removed a duplicate check which avoids unnecessary code indentation.

Fixes: 49d0709b257fc ("net/bnxt: delete and flush L2 filters cleanly")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 42 +++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 6f5402070..cee2656c1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -4896,37 +4896,35 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
 	unsigned int rss_idx, fw_idx, i;
 
+	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
+		return 0;
+
 	if (!(vnic->rss_table && vnic->hash_type))
 		return 0;
 
 	if (BNXT_CHIP_P5(bp))
 		return bnxt_vnic_rss_configure_p5(bp, vnic);
 
-	if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
-		return 0;
-
-	if (vnic->rss_table && vnic->hash_type) {
-		/*
-		 * Fill the RSS hash & redirection table with
-		 * ring group ids for all VNICs
-		 */
-		for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
-			rss_idx++, fw_idx++) {
-			for (i = 0; i < bp->rx_cp_nr_rings; i++) {
-				fw_idx %= bp->rx_cp_nr_rings;
-				if (vnic->fw_grp_ids[fw_idx] !=
-				    INVALID_HW_RING_ID)
-					break;
-				fw_idx++;
-			}
-			if (i == bp->rx_cp_nr_rings)
-				return 0;
-			vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
+	/*
+	 * Fill the RSS hash & redirection table with
+	 * ring group ids for all VNICs
+	 */
+	for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE;
+	     rss_idx++, fw_idx++) {
+		for (i = 0; i < bp->rx_cp_nr_rings; i++) {
+			fw_idx %= bp->rx_cp_nr_rings;
+			if (vnic->fw_grp_ids[fw_idx] != INVALID_HW_RING_ID)
+				break;
+			fw_idx++;
 		}
-		return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
+
+		if (i == bp->rx_cp_nr_rings)
+			return 0;
+
+		vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx];
 	}
 
-	return 0;
+	return bnxt_hwrm_vnic_rss_cfg(bp, vnic);
 }
 
 static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal,
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* [dpdk-stable] [PATCH v3 14/17] net/bnxt: fix PF resource query
       [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
                     ` (7 preceding siblings ...)
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
@ 2020-12-09 23:53   ` Ajit Khaparde
  8 siblings, 0 replies; 20+ messages in thread
From: Ajit Khaparde @ 2020-12-09 23:53 UTC (permalink / raw)
  To: dev; +Cc: Somnath Kotur, stable, Venkat Duvvuru, Kalesh AP

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

This cmd should be called by every driver after 'hwrm_func_cfg'
to get the actual number of resources allocated by the HWRM.
The values returned in the cmd are the max values for that PF.

Also, now that the max values for the PF are computed in probe itself,
no need to invoke FUNC_QCAPs or any other cmd in dev_configure_op()
as that would just override the actual max values obtained above.

Fixes: f8168ca0e690 ("net/bnxt: support thor controller")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c |  7 -------
 drivers/net/bnxt/bnxt_hwrm.c   | 36 +++++++++++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index bf8963577..21d9e26ca 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1071,13 +1071,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		}
 
 		pthread_mutex_unlock(&bp->def_cp_lock);
-	} else {
-		/* legacy driver needs to get updated values */
-		rc = bnxt_hwrm_func_qcaps(bp);
-		if (rc) {
-			PMD_DRV_LOG(ERR, "hwrm func qcaps fail:%d\n", rc);
-			return rc;
-		}
 	}
 
 	/* Inherit new configurations */
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index cee2656c1..a3eb133c0 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3456,6 +3456,35 @@ static int bnxt_update_max_resources(struct bnxt *bp,
 	return 0;
 }
 
+/* Update the PF resource values based on how many resources
+ * got allocated to it.
+ */
+static int bnxt_update_max_resources_pf_only(struct bnxt *bp)
+{
+	struct hwrm_func_qcfg_input req = {0};
+	struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
+	int rc;
+
+	/* Get the actual allocated values now */
+	HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB);
+	req.fid = rte_cpu_to_le_16(0xffff);
+	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+	HWRM_CHECK_RESULT();
+
+	bp->max_rsscos_ctx = rte_le_to_cpu_16(resp->alloc_rsscos_ctx);
+	bp->max_stat_ctx = rte_le_to_cpu_16(resp->alloc_stat_ctx);
+	bp->max_cp_rings = rte_le_to_cpu_16(resp->alloc_cmpl_rings);
+	bp->max_tx_rings = rte_le_to_cpu_16(resp->alloc_tx_rings);
+	bp->max_rx_rings = rte_le_to_cpu_16(resp->alloc_rx_rings);
+	bp->max_l2_ctx = rte_le_to_cpu_16(resp->alloc_l2_ctx);
+	bp->max_ring_grps = rte_le_to_cpu_16(resp->alloc_hw_ring_grps);
+	bp->max_vnics = rte_le_to_cpu_16(resp->alloc_vnics);
+
+	HWRM_UNLOCK();
+
+	return 0;
+}
+
 int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
 {
 	struct hwrm_func_qcfg_input req = {0};
@@ -3555,8 +3584,13 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp)
 		  HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE);
 	bp->pf->func_cfg_flags |=
 		HWRM_FUNC_CFG_INPUT_FLAGS_STD_TX_RING_MODE_DISABLE;
+
 	rc = bnxt_hwrm_pf_func_cfg(bp, &pf_resc);
-	rc = __bnxt_hwrm_func_qcaps(bp);
+	if (rc)
+		return rc;
+
+	rc = bnxt_update_max_resources_pf_only(bp);
+
 	return rc;
 }
 
-- 
2.21.1 (Apple Git-122.3)


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
@ 2020-12-10 15:42     ` Lance Richardson
  0 siblings, 0 replies; 20+ messages in thread
From: Lance Richardson @ 2020-12-10 15:42 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev, stable

On Wed, Dec 9, 2020 at 6:56 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> In case mutex init fails during initialization, start cleanup and
> fail the initialization process.
>
> Fixes: a73b8e939f10 ("net/bnxt: fix race between start and interrupt handler")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 33358779b..0b14ca234 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -4739,8 +4739,10 @@ bnxt_init_locks(struct bnxt *bp)
>         }
>
>         err = pthread_mutex_init(&bp->def_cp_lock, NULL);
> -       if (err)
> +       if (err) {
>                 PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
> +               return err;
> +       }
>
>         err = pthread_mutex_init(&bp->health_check_lock, NULL);
>         if (err)
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int
  2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
@ 2020-12-10 15:54     ` Lance Richardson
  0 siblings, 0 replies; 20+ messages in thread
From: Lance Richardson @ 2020-12-10 15:54 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev, stable

On Wed, Dec 9, 2020 at 6:56 PM Ajit Khaparde <ajitkhaparde@gmail.com> wrote:
>
> &device requires the %u format specifer not the %d specifier, as
> &device is unsigned.
>
> Fixes: a46bbb57605b ("net/bnxt: update multi device design")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/tf_core/tf_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/tf_core/tf_core.c b/drivers/net/bnxt/tf_core/tf_core.c
> index 24d49096a..3409cbbce 100644
> --- a/drivers/net/bnxt/tf_core/tf_core.c
> +++ b/drivers/net/bnxt/tf_core/tf_core.c
> @@ -82,7 +82,7 @@ tf_open_session(struct tf *tfp,
>                 return rc;
>
>         TFP_DRV_LOG(INFO,
> -                   "domain:%d, bus:%d, device:%d\n",
> +                   "domain:%d, bus:%d, device:%u\n",
>                     parms->session_id.internal.domain,
>                     parms->session_id.internal.bus,
>                     parms->session_id.internal.device);
> --
> 2.21.1 (Apple Git-122.3)
>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-12-10 15:55 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201209192233.6518-1-ajit.khaparde@broadcom.com>
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 09/17] net/bnxt: fix max rings computation Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
2020-12-09 19:22 ` [dpdk-stable] [PATCH v2 14/17] net/bnxt: fix PF resource query Ajit Khaparde
     [not found] ` <20201209235347.16180-1-ajit.khaparde@broadcom.com>
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 01/17] net/bnxt: fix RX rings in RSS redirection table Ajit Khaparde
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 02/17] net/bnxt: fix VNIC config on Rx queue stop Ajit Khaparde
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 04/17] net/bnxt: release hwrm lock in the error case Ajit Khaparde
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 06/17] net/bnxt: fix to return error when fw command fails Ajit Khaparde
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 07/17] net/bnxt: fix cleanup on mutex init failure Ajit Khaparde
2020-12-10 15:42     ` [dpdk-stable] [dpdk-dev] " Lance Richardson
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 08/17] net/bnxt: fix format specifier for unsigned int Ajit Khaparde
2020-12-10 15:54     ` [dpdk-stable] [dpdk-dev] " Lance Richardson
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 09/17] net/bnxt: fix max rings computation Ajit Khaparde
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function Ajit Khaparde
2020-12-09 23:53   ` [dpdk-stable] [PATCH v3 14/17] net/bnxt: fix PF resource query Ajit Khaparde

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).