DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH 0/6] bnxt patchset with bug fixes
@ 2019-11-13  8:29 Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 1/6] net/bnxt: add missing checks for fw reset Somnath Kotur
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Somnath Kotur @ 2019-11-13  8:29 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>

Please apply.

Ajit Khaparde (2):
  net/bnxt: fix a potential segfault in xstats get
  net/bnxt: fix potential NULL pointer dereference

Kalesh AP (1):
  net/bnxt: add missing checks for fw reset

Rahul Gupta (1):
  net/bnxt: fix flow creation with non-consecutive group ids

Somnath Kotur (1):
  net/bnxt: fix to cap queue count for NS3/Stingray devices

Venkat Duvvuru (1):
  net/bnxt: change print message type from ERR to DEBUG

 drivers/net/bnxt/bnxt.h        |  7 +++++++
 drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++++--
 drivers/net/bnxt/bnxt_flow.c   |  4 +---
 drivers/net/bnxt/bnxt_rxq.c    | 18 +++++++++++++-----
 drivers/net/bnxt/bnxt_stats.c  |  3 +++
 drivers/net/bnxt/bnxt_txq.c    |  2 +-
 6 files changed, 35 insertions(+), 11 deletions(-)

-- 
2.23.0.rc1


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

* [dpdk-dev]  [PATCH 1/6] net/bnxt: add missing checks for fw reset
  2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
@ 2019-11-13  8:29 ` Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 2/6] net/bnxt: fix to cap queue count for NS3/Stingray devices Somnath Kotur
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Somnath Kotur @ 2019-11-13  8:29 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

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

Driver should fail the eth_dev_ops callbacks and accessing
Tx and Rx queues when device is in reset or in error state.
Added missing checks for fw reset in few routines.

Fixes: be14720def9c ("net/bnxt: support FW reset")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b9b055e71..9aff38298 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2063,8 +2063,12 @@ static void
 bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_rxq_info *qinfo)
 {
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_rx_queue *rxq;
 
+	if (is_bnxt_in_error(bp))
+		return;
+
 	rxq = dev->data->rx_queues[queue_id];
 
 	qinfo->mp = rxq->mb_pool;
@@ -2080,8 +2084,12 @@ static void
 bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo)
 {
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_tx_queue *txq;
 
+	if (is_bnxt_in_error(bp))
+		return;
+
 	txq = dev->data->tx_queues[queue_id];
 
 	qinfo->nb_desc = txq->nb_tx_desc;
-- 
2.23.0.rc1


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

* [dpdk-dev] [PATCH 2/6] net/bnxt: fix to cap queue count for NS3/Stingray devices
  2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 1/6] net/bnxt: add missing checks for fw reset Somnath Kotur
@ 2019-11-13  8:29 ` Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix flow creation with non-consecutive group ids Somnath Kotur
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Somnath Kotur @ 2019-11-13  8:29 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Cap max queue count to 128 for NS3 devices and ensure that same count
is reported as part of dev_info_get_op as well

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 7 +++++++
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 drivers/net/bnxt/bnxt_rxq.c    | 2 +-
 drivers/net/bnxt/bnxt_txq.c    | 2 +-
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9901ba902..e259c8239 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -608,6 +608,13 @@ struct bnxt {
 	uint16_t		max_cp_rings;
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
+#define MAX_STINGRAY_RINGS		128U
+#define BNXT_MAX_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))
+
 	uint16_t		max_nq_rings;
 	uint16_t		max_l2_ctx;
 	uint16_t		max_rx_em_flows;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 9aff38298..3a45fb6c7 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -504,7 +504,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 = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx);
+	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 e7c012f68..fa11bec4e 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -296,7 +296,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= bp->max_rx_rings) {
+	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);
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 6b866d445..2d7645eeb 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -90,7 +90,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= bp->max_tx_rings) {
+	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.23.0.rc1


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

* [dpdk-dev] [PATCH 3/6] net/bnxt: fix flow creation with non-consecutive group ids
  2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 1/6] net/bnxt: add missing checks for fw reset Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 2/6] net/bnxt: fix to cap queue count for NS3/Stingray devices Somnath Kotur
@ 2019-11-13  8:29 ` Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 4/6] net/bnxt: fix a potential segfault in xstats get Somnath Kotur
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Somnath Kotur @ 2019-11-13  8:29 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Rahul Gupta <rahul.gupta@broadcom.com>

In non-RSS mode, vnics map 1:1 with Rx queues during init. This can
create problems if non-consecutive group IDs are given as part of
subsequent flow create cmds as they can end up pointing to Rx queues
(mapped during init) that are different than the intended destination
queue as specified in the flow create cmd.
To fix this, now that we have the ability to dynamically create
vnics, do not create any additional vnics other than the default vnic
during init. Allocate them only during flow/filter creation time.

When RSS is disabled we need to use the COS queue count queried
from firmware.

Fixes: 36024b2e7fe5 ("net/bnxt: allow dynamic creation of VNIC")

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 4 +---
 drivers/net/bnxt/bnxt_rxq.c  | 5 ++++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 8f386cdf1..5af571448 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1093,9 +1093,7 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 		    vnic->fw_vnic_id != INVALID_HW_RING_ID)
 			goto use_vnic;
 
-		if (!rxq ||
-		    bp->vnic_info[0].fw_grp_ids[act_q->index] !=
-		    INVALID_HW_RING_ID) {
+		if (!rxq) {
 			PMD_DRV_LOG(ERR,
 				    "Queue invalid or used with other VNIC\n");
 			rte_flow_error_set(error,
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index fa11bec4e..7fd079da3 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -35,7 +35,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	int start_grp_id, end_grp_id = 1, rc = 0;
 	struct bnxt_vnic_info *vnic;
 	struct bnxt_filter_info *filter;
-	enum rte_eth_nb_pools pools = bp->rx_cp_nr_rings, max_pools = 0;
+	enum rte_eth_nb_pools pools = 1, max_pools = 0;
 	struct bnxt_rx_queue *rxq;
 
 	bp->nr_vnics = 0;
@@ -100,7 +100,10 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			rc = -EINVAL;
 			goto err_out;
 		}
+	} else if (!dev_conf->rxmode.mq_mode) {
+		pools = bp->rx_cosq_cnt ? bp->rx_cosq_cnt : pools;
 	}
+
 	nb_q_per_grp = bp->rx_cp_nr_rings / pools;
 	bp->rx_num_qs_per_vnic = nb_q_per_grp;
 	PMD_DRV_LOG(DEBUG, "pools = %u nb_q_per_grp = %u\n",
-- 
2.23.0.rc1


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

* [dpdk-dev] [PATCH 4/6] net/bnxt: fix a potential segfault in xstats get
  2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
                   ` (2 preceding siblings ...)
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix flow creation with non-consecutive group ids Somnath Kotur
@ 2019-11-13  8:29 ` Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 5/6] net/bnxt: change print message type from ERR to DEBUG Somnath Kotur
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Somnath Kotur @ 2019-11-13  8:29 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Ajit Khaparde <ajit.khaparde@broadcom.com>

We would hit a segfault in bnxt_dev_xstats_get_op() if xstats
argument is NULL, Check if the argument is NULL and return appropriately.

Fixes: bfb9c2260be2 ("net/bnxt: support xstats get/reset")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
---
 drivers/net/bnxt/bnxt_stats.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 40b496ac0..14d355fd0 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -468,6 +468,9 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
+	if (xstats == NULL)
+		return 0;
+
 	memset(xstats, 0, sizeof(*xstats));
 
 	bnxt_hwrm_port_qstats(bp);
-- 
2.23.0.rc1


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

* [dpdk-dev] [PATCH 5/6] net/bnxt: change print message type from ERR to DEBUG
  2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
                   ` (3 preceding siblings ...)
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 4/6] net/bnxt: fix a potential segfault in xstats get Somnath Kotur
@ 2019-11-13  8:29 ` Somnath Kotur
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 6/6] net/bnxt: fix potential NULL pointer dereference Somnath Kotur
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
  6 siblings, 0 replies; 15+ messages in thread
From: Somnath Kotur @ 2019-11-13  8:29 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>

When an existing mac_addr is tried to get programmed again, a
message is displayed that the mac_addr already exists.
However the message is of type ERR. This patch changes the message
to type DEBUG

Fixes: 9c3123170314 ("net/bnxt: fix redundant MAC address check")

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3a45fb6c7..27bac8334 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1020,7 +1020,7 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 	/* Attach requested MAC address to the new l2_filter */
 	STAILQ_FOREACH(filter, &vnic->filter, next) {
 		if (filter->mac_index == index) {
-			PMD_DRV_LOG(ERR,
+			PMD_DRV_LOG(DEBUG,
 				    "MAC addr already existed for pool %d\n",
 				    pool);
 			return 0;
-- 
2.23.0.rc1


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

* [dpdk-dev] [PATCH 6/6] net/bnxt: fix potential NULL pointer dereference
  2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
                   ` (4 preceding siblings ...)
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 5/6] net/bnxt: change print message type from ERR to DEBUG Somnath Kotur
@ 2019-11-13  8:29 ` Somnath Kotur
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
  6 siblings, 0 replies; 15+ messages in thread
From: Somnath Kotur @ 2019-11-13  8:29 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

From: Ajit Khaparde <ajit.khaparde@broadcom.com>

Null-checking "rxq" suggests that it may be null, but it has already
been dereferenced on all paths leading to the check.
Refactored the code to address this issue.

Coverity issue: 350594
Fixes: 9989027624c5 ("net/bnxt: fix RxQ start/stop for Thor based NIC")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 7fd079da3..94f105d34 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -515,13 +515,18 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	}
 
 	rxq = bp->rx_queues[rx_queue_id];
-	vnic = rxq->vnic;
-
-	if (!rxq || !vnic) {
+	if (!rxq) {
 		PMD_DRV_LOG(ERR, "Invalid Rx queue %d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
+	vnic = rxq->vnic;
+	if (!vnic) {
+		PMD_DRV_LOG(ERR, "VNIC not initialized for RxQ %d\n",
+			    rx_queue_id);
+		return -EINVAL;
+	}
+
 	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
 	rxq->rx_started = false;
 	PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
-- 
2.23.0.rc1


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

* [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes
  2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
                   ` (5 preceding siblings ...)
  2019-11-13  8:29 ` [dpdk-dev] [PATCH 6/6] net/bnxt: fix potential NULL pointer dereference Somnath Kotur
@ 2019-11-13 15:06 ` Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 1/6] net/bnxt: add missing checks for firmware reset Ajit Khaparde
                     ` (6 more replies)
  6 siblings, 7 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Patchset against dpdk-next-net. Please apply.

v1->v2: Updated commit ids in fixes tag.

Ajit Khaparde (2):
  net/bnxt: fix a potential segfault in xstats get
  net/bnxt: fix potential NULL pointer dereference

Kalesh AP (1):
  net/bnxt: add missing checks for firmware reset

Rahul Gupta (1):
  net/bnxt: fix flow creation with non-consecutive group ids

Somnath Kotur (1):
  net/bnxt: cap queue count for NS3/Stingray devices

Venkat Duvvuru (1):
  net/bnxt: change print message type from ERR to DEBUG

 drivers/net/bnxt/bnxt.h        |  7 +++++++
 drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++++--
 drivers/net/bnxt/bnxt_flow.c   |  4 +---
 drivers/net/bnxt/bnxt_rxq.c    | 18 +++++++++++++-----
 drivers/net/bnxt/bnxt_stats.c  |  3 +++
 drivers/net/bnxt/bnxt_txq.c    |  2 +-
 6 files changed, 35 insertions(+), 11 deletions(-)

-- 
2.21.0 (Apple Git-122.2)


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

* [dpdk-dev] [PATCH v2 1/6] net/bnxt: add missing checks for firmware reset
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
@ 2019-11-13 15:06   ` Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 2/6] net/bnxt: cap queue count for NS3/Stingray devices Ajit Khaparde
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, Santoshkumar Karanappa Rastapur

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

Driver should fail the eth_dev_ops callbacks and accessing
Tx and Rx queues when device is in reset or in error state.
Added missing checks for fw reset in few routines.

Fixes: be14720def9c ("net/bnxt: support FW reset")

Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e39b87365..94dbe2f1d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2067,8 +2067,12 @@ static void
 bnxt_rxq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_rxq_info *qinfo)
 {
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_rx_queue *rxq;
 
+	if (is_bnxt_in_error(bp))
+		return;
+
 	rxq = dev->data->rx_queues[queue_id];
 
 	qinfo->mp = rxq->mb_pool;
@@ -2084,8 +2088,12 @@ static void
 bnxt_txq_info_get_op(struct rte_eth_dev *dev, uint16_t queue_id,
 	struct rte_eth_txq_info *qinfo)
 {
+	struct bnxt *bp = dev->data->dev_private;
 	struct bnxt_tx_queue *txq;
 
+	if (is_bnxt_in_error(bp))
+		return;
+
 	txq = dev->data->tx_queues[queue_id];
 
 	qinfo->nb_desc = txq->nb_tx_desc;
-- 
2.21.0 (Apple Git-122.2)


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

* [dpdk-dev] [PATCH v2 2/6] net/bnxt: cap queue count for NS3/Stingray devices
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 1/6] net/bnxt: add missing checks for firmware reset Ajit Khaparde
@ 2019-11-13 15:06   ` Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 3/6] net/bnxt: fix flow creation with non-consecutive group ids Ajit Khaparde
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Somnath Kotur, Rahul Gupta

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

Cap max queue count to 128 for NS3 devices and ensure that same count
is reported as part of dev_info_get_op as well

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 7 +++++++
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 drivers/net/bnxt/bnxt_rxq.c    | 2 +-
 drivers/net/bnxt/bnxt_txq.c    | 2 +-
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 9901ba902..e259c8239 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -608,6 +608,13 @@ struct bnxt {
 	uint16_t		max_cp_rings;
 	uint16_t		max_tx_rings;
 	uint16_t		max_rx_rings;
+#define MAX_STINGRAY_RINGS		128U
+#define BNXT_MAX_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))
+
 	uint16_t		max_nq_rings;
 	uint16_t		max_l2_ctx;
 	uint16_t		max_rx_em_flows;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 94dbe2f1d..b00966942 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -505,7 +505,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 = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx);
+	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 e7c012f68..fa11bec4e 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -296,7 +296,7 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= bp->max_rx_rings) {
+	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);
diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index 6b866d445..2d7645eeb 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -90,7 +90,7 @@ int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
-	if (queue_idx >= bp->max_tx_rings) {
+	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.0 (Apple Git-122.2)


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

* [dpdk-dev] [PATCH v2 3/6] net/bnxt: fix flow creation with non-consecutive group ids
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 1/6] net/bnxt: add missing checks for firmware reset Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 2/6] net/bnxt: cap queue count for NS3/Stingray devices Ajit Khaparde
@ 2019-11-13 15:06   ` Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 4/6] net/bnxt: fix a potential segfault in xstats get Ajit Khaparde
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Rahul Gupta, Somnath Kotur

From: Rahul Gupta <rahul.gupta@broadcom.com>

In non-RSS mode, vnics map 1:1 with Rx queues during init. This can
create problems if non-consecutive group IDs are given as part of
subsequent flow create cmds as they can end up pointing to Rx queues
(mapped during init) that are different than the intended destination
queue as specified in the flow create cmd.
To fix this, now that we have the ability to dynamically create
vnics, do not create any additional vnics other than the default vnic
during init. Allocate them only during flow/filter creation time.

When RSS is disabled we need to use the COS queue count queried
from firmware.

Fixes: 36024b2e7fe5 ("net/bnxt: allow dynamic creation of VNIC")

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_flow.c | 4 +---
 drivers/net/bnxt/bnxt_rxq.c  | 5 ++++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 8f386cdf1..5af571448 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1093,9 +1093,7 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 		    vnic->fw_vnic_id != INVALID_HW_RING_ID)
 			goto use_vnic;
 
-		if (!rxq ||
-		    bp->vnic_info[0].fw_grp_ids[act_q->index] !=
-		    INVALID_HW_RING_ID) {
+		if (!rxq) {
 			PMD_DRV_LOG(ERR,
 				    "Queue invalid or used with other VNIC\n");
 			rte_flow_error_set(error,
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index fa11bec4e..7fd079da3 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -35,7 +35,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 	int start_grp_id, end_grp_id = 1, rc = 0;
 	struct bnxt_vnic_info *vnic;
 	struct bnxt_filter_info *filter;
-	enum rte_eth_nb_pools pools = bp->rx_cp_nr_rings, max_pools = 0;
+	enum rte_eth_nb_pools pools = 1, max_pools = 0;
 	struct bnxt_rx_queue *rxq;
 
 	bp->nr_vnics = 0;
@@ -100,7 +100,10 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
 			rc = -EINVAL;
 			goto err_out;
 		}
+	} else if (!dev_conf->rxmode.mq_mode) {
+		pools = bp->rx_cosq_cnt ? bp->rx_cosq_cnt : pools;
 	}
+
 	nb_q_per_grp = bp->rx_cp_nr_rings / pools;
 	bp->rx_num_qs_per_vnic = nb_q_per_grp;
 	PMD_DRV_LOG(DEBUG, "pools = %u nb_q_per_grp = %u\n",
-- 
2.21.0 (Apple Git-122.2)


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

* [dpdk-dev] [PATCH v2 4/6] net/bnxt: fix a potential segfault in xstats get
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
                     ` (2 preceding siblings ...)
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 3/6] net/bnxt: fix flow creation with non-consecutive group ids Ajit Khaparde
@ 2019-11-13 15:06   ` Ajit Khaparde
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 5/6] net/bnxt: change print message type from ERR to DEBUG Ajit Khaparde
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, stable, Andy Gospodarek

We would hit a segfault in bnxt_dev_xstats_get_op() if xstats
argument is NULL, Check if the argument is NULL and return appropriately.

Fixes: bfb9c2260be2 ("net/bnxt: support xstats get/reset")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Andy Gospodarek <gospo@broadcom.com>
---
 drivers/net/bnxt/bnxt_stats.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index 40b496ac0..14d355fd0 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -468,6 +468,9 @@ int bnxt_dev_xstats_get_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
+	if (xstats == NULL)
+		return 0;
+
 	memset(xstats, 0, sizeof(*xstats));
 
 	bnxt_hwrm_port_qstats(bp);
-- 
2.21.0 (Apple Git-122.2)


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

* [dpdk-dev] [PATCH v2 5/6] net/bnxt: change print message type from ERR to DEBUG
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
                     ` (3 preceding siblings ...)
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 4/6] net/bnxt: fix a potential segfault in xstats get Ajit Khaparde
@ 2019-11-13 15:06   ` Ajit Khaparde
  2019-11-13 15:07   ` [dpdk-dev] [PATCH v2 6/6] net/bnxt: fix potential NULL pointer dereference Ajit Khaparde
  2019-11-13 15:14   ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
  6 siblings, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:06 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Venkat Duvvuru, Somnath Kotur

From: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>

When an existing mac_addr is tried to get programmed again, a
message is displayed that the mac_addr already exists.
However the message is of type ERR. This patch changes the message
to type DEBUG

Fixes: 938a87db4324 ("net/bnxt: fix redundant MAC address check")

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b00966942..393706b80 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1024,7 +1024,7 @@ static int bnxt_add_mac_filter(struct bnxt *bp, struct bnxt_vnic_info *vnic,
 	/* Attach requested MAC address to the new l2_filter */
 	STAILQ_FOREACH(filter, &vnic->filter, next) {
 		if (filter->mac_index == index) {
-			PMD_DRV_LOG(ERR,
+			PMD_DRV_LOG(DEBUG,
 				    "MAC addr already existed for pool %d\n",
 				    pool);
 			return 0;
-- 
2.21.0 (Apple Git-122.2)


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

* [dpdk-dev] [PATCH v2 6/6] net/bnxt: fix potential NULL pointer dereference
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
                     ` (4 preceding siblings ...)
  2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 5/6] net/bnxt: change print message type from ERR to DEBUG Ajit Khaparde
@ 2019-11-13 15:07   ` Ajit Khaparde
  2019-11-13 15:14   ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
  6 siblings, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:07 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Somnath Kotur

Null-checking "rxq" suggests that it may be null, but it has already
been dereferenced on all paths leading to the check.
Refactored the code to address this issue.

Coverity issue: 350594
Fixes: fc4bfea59696 ("net/bnxt: fix Rx queue start/stop for Thor based NICs")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_rxq.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index 7fd079da3..94f105d34 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -515,13 +515,18 @@ int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 	}
 
 	rxq = bp->rx_queues[rx_queue_id];
-	vnic = rxq->vnic;
-
-	if (!rxq || !vnic) {
+	if (!rxq) {
 		PMD_DRV_LOG(ERR, "Invalid Rx queue %d\n", rx_queue_id);
 		return -EINVAL;
 	}
 
+	vnic = rxq->vnic;
+	if (!vnic) {
+		PMD_DRV_LOG(ERR, "VNIC not initialized for RxQ %d\n",
+			    rx_queue_id);
+		return -EINVAL;
+	}
+
 	dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED;
 	rxq->rx_started = false;
 	PMD_DRV_LOG(DEBUG, "Rx queue stopped\n");
-- 
2.21.0 (Apple Git-122.2)


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

* Re: [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes
  2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
                     ` (5 preceding siblings ...)
  2019-11-13 15:07   ` [dpdk-dev] [PATCH v2 6/6] net/bnxt: fix potential NULL pointer dereference Ajit Khaparde
@ 2019-11-13 15:14   ` Ajit Khaparde
  6 siblings, 0 replies; 15+ messages in thread
From: Ajit Khaparde @ 2019-11-13 15:14 UTC (permalink / raw)
  To: dpdk-dev; +Cc: Ferruh Yigit

On Wed, Nov 13, 2019 at 7:07 AM Ajit Khaparde <ajit.khaparde@broadcom.com>
wrote:

> Patchset against dpdk-next-net. Please apply.
>
> v1->v2: Updated commit ids in fixes tag.
>
> Ajit Khaparde (2):
>   net/bnxt: fix a potential segfault in xstats get
>   net/bnxt: fix potential NULL pointer dereference
>
> Kalesh AP (1):
>   net/bnxt: add missing checks for firmware reset
>
> Rahul Gupta (1):
>   net/bnxt: fix flow creation with non-consecutive group ids
>
> Somnath Kotur (1):
>   net/bnxt: cap queue count for NS3/Stingray devices
>
> Venkat Duvvuru (1):
>   net/bnxt: change print message type from ERR to DEBUG
>
>  drivers/net/bnxt/bnxt.h        |  7 +++++++
>  drivers/net/bnxt/bnxt_ethdev.c | 12 ++++++++++--
>  drivers/net/bnxt/bnxt_flow.c   |  4 +---
>  drivers/net/bnxt/bnxt_rxq.c    | 18 +++++++++++++-----
>  drivers/net/bnxt/bnxt_stats.c  |  3 +++
>  drivers/net/bnxt/bnxt_txq.c    |  2 +-
>  6 files changed, 35 insertions(+), 11 deletions(-)
>

Patchset applied to dpdk-next-net-brcm.


>
> --
> 2.21.0 (Apple Git-122.2)
>
>

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

end of thread, other threads:[~2019-11-13 15:14 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13  8:29 [dpdk-dev] [PATCH 0/6] bnxt patchset with bug fixes Somnath Kotur
2019-11-13  8:29 ` [dpdk-dev] [PATCH 1/6] net/bnxt: add missing checks for fw reset Somnath Kotur
2019-11-13  8:29 ` [dpdk-dev] [PATCH 2/6] net/bnxt: fix to cap queue count for NS3/Stingray devices Somnath Kotur
2019-11-13  8:29 ` [dpdk-dev] [PATCH 3/6] net/bnxt: fix flow creation with non-consecutive group ids Somnath Kotur
2019-11-13  8:29 ` [dpdk-dev] [PATCH 4/6] net/bnxt: fix a potential segfault in xstats get Somnath Kotur
2019-11-13  8:29 ` [dpdk-dev] [PATCH 5/6] net/bnxt: change print message type from ERR to DEBUG Somnath Kotur
2019-11-13  8:29 ` [dpdk-dev] [PATCH 6/6] net/bnxt: fix potential NULL pointer dereference Somnath Kotur
2019-11-13 15:06 ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes Ajit Khaparde
2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 1/6] net/bnxt: add missing checks for firmware reset Ajit Khaparde
2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 2/6] net/bnxt: cap queue count for NS3/Stingray devices Ajit Khaparde
2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 3/6] net/bnxt: fix flow creation with non-consecutive group ids Ajit Khaparde
2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 4/6] net/bnxt: fix a potential segfault in xstats get Ajit Khaparde
2019-11-13 15:06   ` [dpdk-dev] [PATCH v2 5/6] net/bnxt: change print message type from ERR to DEBUG Ajit Khaparde
2019-11-13 15:07   ` [dpdk-dev] [PATCH v2 6/6] net/bnxt: fix potential NULL pointer dereference Ajit Khaparde
2019-11-13 15:14   ` [dpdk-dev] [PATCH v2 0/6] bnxt patchset with bug fixes 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).