DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/7] patchset for bnxt
@ 2019-10-14  0:01 Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 1/7] net/bnxt: fix dereference before null check Ajit Khaparde
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit

Patchset mostly contains bug fixes apart from
removing some dead code and unnecessary comments.
Please apply.

Kalesh AP (5):
  net/bnxt: fix dereference before null check
  net/bnxt: cleanup comments in source
  net/bnxt: move macro definitions to header file
  net/bnxt: fix endianness while retrieving MTU from FW
  net/bnxt: fix error handling

Lance Richardson (1):
  net/bnxt: reset Rx allocation state on Rx queue restart

Somnath Kotur (1):
  net/bnxt: fix race between interrupt handler and dev config

 drivers/net/bnxt/bnxt.h        | 51 +++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_cpr.c    |  2 -
 drivers/net/bnxt/bnxt_ethdev.c | 70 ++++++++++------------------------
 drivers/net/bnxt/bnxt_filter.c |  1 -
 drivers/net/bnxt/bnxt_flow.c   |  7 ----
 drivers/net/bnxt/bnxt_hwrm.c   | 30 +++++----------
 drivers/net/bnxt/bnxt_irq.c    |  7 +++-
 drivers/net/bnxt/bnxt_ring.c   |  3 ++
 drivers/net/bnxt/bnxt_rxr.c    | 16 +++++---
 drivers/net/bnxt/bnxt_stats.c  |  2 +-
 10 files changed, 101 insertions(+), 88 deletions(-)

-- 
2.20.1 (Apple Git-117)


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

* [dpdk-dev] [PATCH 1/7] net/bnxt: fix dereference before null check
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
@ 2019-10-14  0:01 ` Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 2/7] net/bnxt: reset Rx allocation state on Rx queue restart Ajit Khaparde
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur

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

This patch fixes potential null pointer access in bnxt_alloc_ag_data().
Fix to return an error if null check is true.

Fixes: daef48efe5e5 ("net/bnxt: support set MTU")
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_rxr.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_rxr.c b/drivers/net/bnxt/bnxt_rxr.c
index f0f9b020b1..03dae571b6 100644
--- a/drivers/net/bnxt/bnxt_rxr.c
+++ b/drivers/net/bnxt/bnxt_rxr.c
@@ -63,18 +63,22 @@ static inline int bnxt_alloc_ag_data(struct bnxt_rx_queue *rxq,
 	struct bnxt_sw_rx_bd *rx_buf = &rxr->ag_buf_ring[prod];
 	struct rte_mbuf *mbuf;
 
+	if (rxbd == NULL) {
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
+		return -EINVAL;
+	}
+
+	if (rx_buf == NULL) {
+		PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
+		return -EINVAL;
+	}
+
 	mbuf = __bnxt_alloc_rx_data(rxq->mb_pool);
 	if (!mbuf) {
 		rte_atomic64_inc(&rxq->rx_mbuf_alloc_fail);
 		return -ENOMEM;
 	}
 
-	if (rxbd == NULL)
-		PMD_DRV_LOG(ERR, "Jumbo Frame. rxbd is NULL\n");
-	if (rx_buf == NULL)
-		PMD_DRV_LOG(ERR, "Jumbo Frame. rx_buf is NULL\n");
-
-
 	rx_buf->mbuf = mbuf;
 	mbuf->data_off = RTE_PKTMBUF_HEADROOM;
 
-- 
2.20.1 (Apple Git-117)


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

* [dpdk-dev] [PATCH 2/7] net/bnxt: reset Rx allocation state on Rx queue restart
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 1/7] net/bnxt: fix dereference before null check Ajit Khaparde
@ 2019-10-14  0:01 ` Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 3/7] net/bnxt: cleanup comments in source Ajit Khaparde
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev
  Cc: ferruh.yigit, Lance Richardson, stable, Xiaobing Zhang,
	Kalesh Anakkur Purayil

From: Lance Richardson <lance.richardson@broadcom.com>

Call bnxt_rxq_vec_setup() to ensure that rxq->rxrearm_nb and
rxq->rxrearm_start are initialized correctly when a receive
queue is restarted.

Fixes: bc4a000f2f53 ("net/bnxt: implement SSE vector mode")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Xiaobing Zhang <xiaobing.zhang@broadcom.com>
Reviewed-by: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ring.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 19af727635..0a182d3a84 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -626,6 +626,9 @@ int bnxt_alloc_hwrm_rx_ring(struct bnxt *bp, int queue_index)
 		bnxt_db_write(&rxr->ag_db, rxr->ag_prod);
 	}
 	rxq->index = queue_index;
+#ifdef RTE_ARCH_X86
+	bnxt_rxq_vec_setup(rxq);
+#endif
 
 	return 0;
 
-- 
2.20.1 (Apple Git-117)


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

* [dpdk-dev] [PATCH 3/7] net/bnxt: cleanup comments in source
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 1/7] net/bnxt: fix dereference before null check Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 2/7] net/bnxt: reset Rx allocation state on Rx queue restart Ajit Khaparde
@ 2019-10-14  0:01 ` Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 4/7] net/bnxt: move macro definitions to header file Ajit Khaparde
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur

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

- updated one comment for more readability and understanding
- fixed typo in comments
- moved a comment to right place
- removed one out-of-date comment
- removed few commented code

Fixes: f2a768d4d186 ("net/bnxt: add completion ring")
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_cpr.c    |  2 --
 drivers/net/bnxt/bnxt_filter.c |  1 -
 drivers/net/bnxt/bnxt_flow.c   |  7 -------
 drivers/net/bnxt/bnxt_hwrm.c   | 28 +++++++++-------------------
 4 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_cpr.c b/drivers/net/bnxt/bnxt_cpr.c
index 118cf034d2..e6f30fecbf 100644
--- a/drivers/net/bnxt/bnxt_cpr.c
+++ b/drivers/net/bnxt/bnxt_cpr.c
@@ -58,8 +58,6 @@ void bnxt_handle_async_event(struct bnxt *bp,
 	struct bnxt_error_recovery_info *info;
 	uint32_t event_data;
 
-	/* TODO: HWRM async events are not defined yet */
-	/* Needs to handle: link events, error events, etc. */
 	switch (event_id) {
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_STATUS_CHANGE:
 	case HWRM_ASYNC_EVENT_CMPL_EVENT_ID_LINK_SPEED_CHANGE:
diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index e95d47d296..8120b39165 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -82,7 +82,6 @@ void bnxt_free_all_filters(struct bnxt *bp)
 	struct bnxt_filter_info *filter, *temp_filter;
 	unsigned int i;
 
-//	for (i = 0; i < MAX_FF_POOLS; i++) {
 	for (i = 0; i < bp->nr_vnics; i++) {
 		vnic = &bp->vnic_info[i];
 		filter = STAILQ_FIRST(&vnic->filter);
diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c
index 5aeb001408..85d23540fe 100644
--- a/drivers/net/bnxt/bnxt_flow.c
+++ b/drivers/net/bnxt/bnxt_flow.c
@@ -1087,10 +1087,6 @@ 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 ||
-		    //!rxq->rx_deferred_start) {
 		if (!rxq ||
 		    bp->vnic_info[0].fw_grp_ids[act_q->index] !=
 		    INVALID_HW_RING_ID) {
@@ -1320,9 +1316,6 @@ bnxt_validate_and_parse_flow(struct rte_eth_dev *dev,
 			}
 			rxq = bp->rx_queues[rss->queue[i]];
 
-			//if (bp->vnic_info[0].fw_grp_ids[rss->queue[i]] !=
-			    //INVALID_HW_RING_ID ||
-			    //!rxq->rx_deferred_start) {
 			if (bp->vnic_info[0].fw_grp_ids[rss->queue[i]] !=
 			    INVALID_HW_RING_ID) {
 				PMD_DRV_LOG(ERR,
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 5b430b9415..1a1ea1bdef 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -74,9 +74,9 @@ static void bnxt_hwrm_set_pg_attr(struct bnxt_ring_mem_info *rmem,
 
 /*
  * HWRM Functions (sent to HWRM)
- * These are named bnxt_hwrm_*() and return -1 if bnxt_hwrm_send_message()
- * fails (ie: a timeout), and a positive non-zero HWRM error code if the HWRM
- * command was failed by the ChiMP.
+ * These are named bnxt_hwrm_*() and return 0 on success or -110 if the
+ * HWRM command times out, or a negative error code if the HWRM
+ * command was failed by the FW.
  */
 
 static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
@@ -176,11 +176,11 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 }
 
 /*
- * HWRM_PREP() should be used to prepare *ALL* HWRM commands.  It grabs the
+ * HWRM_PREP() should be used to prepare *ALL* HWRM commands. It grabs the
  * spinlock, and does initial processing.
  *
  * HWRM_CHECK_RESULT() returns errors on failure and may not be used.  It
- * releases the spinlock only if it returns.  If the regular int return codes
+ * releases the spinlock only if it returns. If the regular int return codes
  * are not used by the function, HWRM_CHECK_RESULT() should not be used
  * directly, rather it should be copied and modified to suit the function.
  *
@@ -518,7 +518,6 @@ static int bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
 	struct hwrm_port_mac_ptp_qcfg_output *resp = bp->hwrm_cmd_resp_addr;
 	struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
 
-/*	if (bp->hwrm_spec_code < 0x10801 || ptp)  TBD  */
 	if (ptp)
 		return 0;
 
@@ -2161,10 +2160,6 @@ int bnxt_hwrm_func_clr_stats(struct bnxt *bp, uint16_t fid)
 	return rc;
 }
 
-/*
- * HWRM utility functions
- */
-
 int bnxt_clear_all_hwrm_stat_ctxs(struct bnxt *bp)
 {
 	unsigned int i;
@@ -2383,6 +2378,10 @@ int bnxt_alloc_all_hwrm_ring_grps(struct bnxt *bp)
 	return rc;
 }
 
+/*
+ * HWRM utility functions
+ */
+
 void bnxt_free_hwrm_resources(struct bnxt *bp)
 {
 	/* Release memzone */
@@ -2432,8 +2431,6 @@ int bnxt_clear_hwrm_vnic_filters(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 			rc = bnxt_hwrm_clear_l2_filter(bp, filter);
 		STAILQ_REMOVE(&vnic->filter, filter, bnxt_filter_info, next);
 		bnxt_free_filter(bp, filter);
-		//if (rc)
-			//break;
 	}
 	return rc;
 }
@@ -2458,8 +2455,6 @@ bnxt_clear_hwrm_vnic_flows(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 
 		STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next);
 		rte_free(flow);
-		//if (rc)
-			//break;
 	}
 	return rc;
 }
@@ -2514,7 +2509,6 @@ void bnxt_free_all_hwrm_resources(struct bnxt *bp)
 	for (i = bp->max_vnics - 1; i >= 0; i--) {
 		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
 
-		// If the VNIC ID is invalid we are not currently using the VNIC
 		if (vnic->fw_vnic_id == INVALID_HW_RING_ID)
 			continue;
 
@@ -4226,10 +4220,6 @@ int bnxt_hwrm_set_ntuple_filter(struct bnxt *bp,
 	    HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_SRC_MACADDR)
 		memcpy(req.src_macaddr, filter->src_macaddr,
 		       RTE_ETHER_ADDR_LEN);
-	//if (enables &
-	    //HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_DST_MACADDR)
-		//memcpy(req.dst_macaddr, filter->dst_macaddr,
-		       //RTE_ETHER_ADDR_LEN);
 	if (enables &
 	    HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_ETHERTYPE)
 		req.ethertype = rte_cpu_to_be_16(filter->ethertype);
-- 
2.20.1 (Apple Git-117)


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

* [dpdk-dev] [PATCH 4/7] net/bnxt: move macro definitions to header file
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
                   ` (2 preceding siblings ...)
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 3/7] net/bnxt: cleanup comments in source Ajit Khaparde
@ 2019-10-14  0:01 ` Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 5/7] net/bnxt: fix race between interrupt handler and dev config Ajit Khaparde
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Lance Richardson

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

Move device and vendor ids macro definition from bnxt_ethdev.c
to bnxt.h.
There is no functionality impact.

Fixes: 882aa9c6e2e1 ("net/bnxt: move PCI device ids to the driver")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        | 50 +++++++++++++++++++++++++++++++++
 drivers/net/bnxt/bnxt_ethdev.c | 51 ++--------------------------------
 2 files changed, 53 insertions(+), 48 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 080365804c..189f693b06 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -21,6 +21,56 @@
 #include "bnxt_cpr.h"
 #include "bnxt_util.h"
 
+/* Vendor ID */
+#define PCI_VENDOR_ID_BROADCOM		0x14E4
+
+/* Device IDs */
+#define BROADCOM_DEV_ID_STRATUS_NIC_VF1 0x1606
+#define BROADCOM_DEV_ID_STRATUS_NIC_VF2 0x1609
+#define BROADCOM_DEV_ID_STRATUS_NIC	0x1614
+#define BROADCOM_DEV_ID_57414_VF	0x16c1
+#define BROADCOM_DEV_ID_57301		0x16c8
+#define BROADCOM_DEV_ID_57302		0x16c9
+#define BROADCOM_DEV_ID_57304_PF	0x16ca
+#define BROADCOM_DEV_ID_57304_VF	0x16cb
+#define BROADCOM_DEV_ID_57417_MF	0x16cc
+#define BROADCOM_DEV_ID_NS2		0x16cd
+#define BROADCOM_DEV_ID_57311		0x16ce
+#define BROADCOM_DEV_ID_57312		0x16cf
+#define BROADCOM_DEV_ID_57402		0x16d0
+#define BROADCOM_DEV_ID_57404		0x16d1
+#define BROADCOM_DEV_ID_57406_PF	0x16d2
+#define BROADCOM_DEV_ID_57406_VF	0x16d3
+#define BROADCOM_DEV_ID_57402_MF	0x16d4
+#define BROADCOM_DEV_ID_57407_RJ45	0x16d5
+#define BROADCOM_DEV_ID_57412		0x16d6
+#define BROADCOM_DEV_ID_57414		0x16d7
+#define BROADCOM_DEV_ID_57416_RJ45	0x16d8
+#define BROADCOM_DEV_ID_57417_RJ45	0x16d9
+#define BROADCOM_DEV_ID_5741X_VF	0x16dc
+#define BROADCOM_DEV_ID_57412_MF	0x16de
+#define BROADCOM_DEV_ID_57314		0x16df
+#define BROADCOM_DEV_ID_57317_RJ45	0x16e0
+#define BROADCOM_DEV_ID_5731X_VF	0x16e1
+#define BROADCOM_DEV_ID_57417_SFP	0x16e2
+#define BROADCOM_DEV_ID_57416_SFP	0x16e3
+#define BROADCOM_DEV_ID_57317_SFP	0x16e4
+#define BROADCOM_DEV_ID_57404_MF	0x16e7
+#define BROADCOM_DEV_ID_57406_MF	0x16e8
+#define BROADCOM_DEV_ID_57407_SFP	0x16e9
+#define BROADCOM_DEV_ID_57407_MF	0x16ea
+#define BROADCOM_DEV_ID_57414_MF	0x16ec
+#define BROADCOM_DEV_ID_57416_MF	0x16ee
+#define BROADCOM_DEV_ID_57508		0x1750
+#define BROADCOM_DEV_ID_57504		0x1751
+#define BROADCOM_DEV_ID_57502		0x1752
+#define BROADCOM_DEV_ID_57500_VF1	0x1806
+#define BROADCOM_DEV_ID_57500_VF2	0x1807
+#define BROADCOM_DEV_ID_58802		0xd802
+#define BROADCOM_DEV_ID_58804		0xd804
+#define BROADCOM_DEV_ID_58808		0x16f0
+#define BROADCOM_DEV_ID_58802_VF	0xd800
+
 #define BNXT_MAX_MTU		9574
 #define VLAN_TAG_SIZE		4
 #define BNXT_NUM_VLANS		2
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 90a97fac1b..b58a875c7d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -32,54 +32,9 @@ static const char bnxt_version[] =
 	"Broadcom NetXtreme driver " DRV_MODULE_NAME;
 int bnxt_logtype_driver;
 
-#define PCI_VENDOR_ID_BROADCOM 0x14E4
-
-#define BROADCOM_DEV_ID_STRATUS_NIC_VF1 0x1606
-#define BROADCOM_DEV_ID_STRATUS_NIC_VF2 0x1609
-#define BROADCOM_DEV_ID_STRATUS_NIC 0x1614
-#define BROADCOM_DEV_ID_57414_VF 0x16c1
-#define BROADCOM_DEV_ID_57301 0x16c8
-#define BROADCOM_DEV_ID_57302 0x16c9
-#define BROADCOM_DEV_ID_57304_PF 0x16ca
-#define BROADCOM_DEV_ID_57304_VF 0x16cb
-#define BROADCOM_DEV_ID_57417_MF 0x16cc
-#define BROADCOM_DEV_ID_NS2 0x16cd
-#define BROADCOM_DEV_ID_57311 0x16ce
-#define BROADCOM_DEV_ID_57312 0x16cf
-#define BROADCOM_DEV_ID_57402 0x16d0
-#define BROADCOM_DEV_ID_57404 0x16d1
-#define BROADCOM_DEV_ID_57406_PF 0x16d2
-#define BROADCOM_DEV_ID_57406_VF 0x16d3
-#define BROADCOM_DEV_ID_57402_MF 0x16d4
-#define BROADCOM_DEV_ID_57407_RJ45 0x16d5
-#define BROADCOM_DEV_ID_57412 0x16d6
-#define BROADCOM_DEV_ID_57414 0x16d7
-#define BROADCOM_DEV_ID_57416_RJ45 0x16d8
-#define BROADCOM_DEV_ID_57417_RJ45 0x16d9
-#define BROADCOM_DEV_ID_5741X_VF 0x16dc
-#define BROADCOM_DEV_ID_57412_MF 0x16de
-#define BROADCOM_DEV_ID_57314 0x16df
-#define BROADCOM_DEV_ID_57317_RJ45 0x16e0
-#define BROADCOM_DEV_ID_5731X_VF 0x16e1
-#define BROADCOM_DEV_ID_57417_SFP 0x16e2
-#define BROADCOM_DEV_ID_57416_SFP 0x16e3
-#define BROADCOM_DEV_ID_57317_SFP 0x16e4
-#define BROADCOM_DEV_ID_57404_MF 0x16e7
-#define BROADCOM_DEV_ID_57406_MF 0x16e8
-#define BROADCOM_DEV_ID_57407_SFP 0x16e9
-#define BROADCOM_DEV_ID_57407_MF 0x16ea
-#define BROADCOM_DEV_ID_57414_MF 0x16ec
-#define BROADCOM_DEV_ID_57416_MF 0x16ee
-#define BROADCOM_DEV_ID_57508 0x1750
-#define BROADCOM_DEV_ID_57504 0x1751
-#define BROADCOM_DEV_ID_57502 0x1752
-#define BROADCOM_DEV_ID_57500_VF1 0x1806
-#define BROADCOM_DEV_ID_57500_VF2 0x1807
-#define BROADCOM_DEV_ID_58802 0xd802
-#define BROADCOM_DEV_ID_58804 0xd804
-#define BROADCOM_DEV_ID_58808 0x16f0
-#define BROADCOM_DEV_ID_58802_VF 0xd800
-
+/*
+ * The set of PCI devices this driver supports
+ */
 static const struct rte_pci_id bnxt_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_BROADCOM,
 			 BROADCOM_DEV_ID_STRATUS_NIC_VF1) },
-- 
2.20.1 (Apple Git-117)


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

* [dpdk-dev] [PATCH 5/7] net/bnxt: fix race between interrupt handler and dev config
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
                   ` (3 preceding siblings ...)
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 4/7] net/bnxt: move macro definitions to header file Ajit Khaparde
@ 2019-10-14  0:01 ` Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 6/7] net/bnxt: fix endianness while retrieving MTU from FW Ajit Khaparde
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Somnath Kotur, stable, Kalesh AP

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

Fix a possible that while interrupt handler is in the middle of processing,
dev_configure_op() might come in and try to destroy/realloc the default
completion ring on which interrupt completions arrive.
Synchronize the two so they don't race each other

Fixes: 7bc8e9a227cc ("net/bnxt: support async link notification")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 189f693b06..e5bdf63602 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -574,6 +574,7 @@ struct bnxt {
 	void				*hwrm_short_cmd_req_addr;
 	rte_iova_t			hwrm_short_cmd_req_dma_addr;
 	rte_spinlock_t			hwrm_lock;
+	pthread_mutex_t			def_cp_lock;
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
 	uint16_t                        hwrm_max_ext_req_len;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b58a875c7d..e7ec99e15d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -627,6 +627,9 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		 * resource reservation. This will ensure the resource counts
 		 * are calculated correctly.
 		 */
+
+		pthread_mutex_lock(&bp->def_cp_lock);
+
 		if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) {
 			bnxt_disable_int(bp);
 			bnxt_free_cp_ring(bp, bp->async_cp_ring);
@@ -635,15 +638,20 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
 		rc = bnxt_hwrm_func_reserve_vf_resc(bp, false);
 		if (rc) {
 			PMD_DRV_LOG(ERR, "HWRM resource alloc fail:%x\n", rc);
+			pthread_mutex_unlock(&bp->def_cp_lock);
 			return -ENOSPC;
 		}
 
 		if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) {
 			rc = bnxt_alloc_async_cp_ring(bp);
-			if (rc)
+			if (rc) {
+				pthread_mutex_unlock(&bp->def_cp_lock);
 				return rc;
+			}
 			bnxt_enable_int(bp);
 		}
+
+		pthread_mutex_unlock(&bp->def_cp_lock);
 	} else {
 		/* legacy driver needs to get updated values */
 		rc = bnxt_hwrm_func_qcaps(bp);
@@ -4585,8 +4593,14 @@ bnxt_init_locks(struct bnxt *bp)
 	int err;
 
 	err = pthread_mutex_init(&bp->flow_lock, NULL);
-	if (err)
+	if (err) {
 		PMD_DRV_LOG(ERR, "Unable to initialize flow_lock\n");
+		return err;
+	}
+
+	err = pthread_mutex_init(&bp->def_cp_lock, NULL);
+	if (err)
+		PMD_DRV_LOG(ERR, "Unable to initialize def_cp_lock\n");
 	return err;
 }
 
@@ -4735,6 +4749,7 @@ static void
 bnxt_uninit_locks(struct bnxt *bp)
 {
 	pthread_mutex_destroy(&bp->flow_lock);
+	pthread_mutex_destroy(&bp->def_cp_lock);
 }
 
 static int
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 6c5bcfb623..4feb637e22 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -30,9 +30,12 @@ void bnxt_int_handler(void *param)
 		return;
 
 	raw_cons = cpr->cp_raw_cons;
+	pthread_mutex_lock(&bp->def_cp_lock);
 	while (1) {
-		if (!cpr || !cpr->cp_ring_struct || !cpr->cp_db.doorbell)
+		if (!cpr || !cpr->cp_ring_struct || !cpr->cp_db.doorbell) {
+			pthread_mutex_unlock(&bp->def_cp_lock);
 			return;
+		}
 
 		cons = RING_CMP(cpr->cp_ring_struct, raw_cons);
 		cmp = &cpr->cp_desc_ring[cons];
@@ -49,6 +52,8 @@ void bnxt_int_handler(void *param)
 		bnxt_db_nq_arm(cpr);
 	else
 		B_CP_DB_REARM(cpr, cpr->cp_raw_cons);
+
+	pthread_mutex_unlock(&bp->def_cp_lock);
 }
 
 int bnxt_free_int(struct bnxt *bp)
-- 
2.20.1 (Apple Git-117)


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

* [dpdk-dev] [PATCH 6/7] net/bnxt: fix endianness while retrieving MTU from FW
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
                   ` (4 preceding siblings ...)
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 5/7] net/bnxt: fix race between interrupt handler and dev config Ajit Khaparde
@ 2019-10-14  0:01 ` Ajit Khaparde
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 7/7] net/bnxt: fix error handling Ajit Khaparde
  2019-10-14  3:58 ` [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur

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

In bnxt_hwrm_func_qcfg(), use rte_le_to_cpu_16 while getting
the mtu value from command response.

Fixes: 905cd45ce30ef ("net/bnxt: use configured MTU during load")
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 1a1ea1bdef..18e7429a77 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -2882,7 +2882,7 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu)
 	}
 
 	if (mtu)
-		*mtu = resp->mtu;
+		*mtu = rte_le_to_cpu_16(resp->mtu);
 
 	switch (resp->port_partition_type) {
 	case HWRM_FUNC_QCFG_OUTPUT_PORT_PARTITION_TYPE_NPAR1_0:
-- 
2.20.1 (Apple Git-117)


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

* [dpdk-dev] [PATCH 7/7] net/bnxt: fix error handling
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
                   ` (5 preceding siblings ...)
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 6/7] net/bnxt: fix endianness while retrieving MTU from FW Ajit Khaparde
@ 2019-10-14  0:01 ` Ajit Khaparde
  2019-10-14  3:58 ` [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  0:01 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, Kalesh AP, stable, Somnath Kotur

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

Add missing return instead of setting the error status in case of error.

Fixes: bfb9c2260be2 ("net/bnxt: support xstats get/reset")
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_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index f486a5634b..fa29f9de19 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -575,7 +575,7 @@ int bnxt_dev_xstats_reset_op(struct rte_eth_dev *eth_dev)
 	if (BNXT_VF(bp) || !BNXT_SINGLE_PF(bp) ||
 	    !(bp->flags & BNXT_FLAG_PORT_STATS)) {
 		PMD_DRV_LOG(ERR, "Operation not supported\n");
-		ret = -ENOTSUP;
+		return -ENOTSUP;
 	}
 
 	ret = bnxt_hwrm_port_clr_stats(bp);
-- 
2.20.1 (Apple Git-117)


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

* Re: [dpdk-dev] [PATCH 0/7] patchset for bnxt
  2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
                   ` (6 preceding siblings ...)
  2019-10-14  0:01 ` [dpdk-dev] [PATCH 7/7] net/bnxt: fix error handling Ajit Khaparde
@ 2019-10-14  3:58 ` Ajit Khaparde
  7 siblings, 0 replies; 9+ messages in thread
From: Ajit Khaparde @ 2019-10-14  3:58 UTC (permalink / raw)
  To: dev; +Cc: Ferruh Yigit

On Sun, Oct 13, 2019 at 5:01 PM Ajit Khaparde <ajit.khaparde@broadcom.com>
wrote:

> Patchset mostly contains bug fixes apart from
> removing some dead code and unnecessary comments.
> Please apply.
>
Patchset applied to dpdk-next-net-brcm



>
> Kalesh AP (5):
>   net/bnxt: fix dereference before null check
>   net/bnxt: cleanup comments in source
>   net/bnxt: move macro definitions to header file
>   net/bnxt: fix endianness while retrieving MTU from FW
>   net/bnxt: fix error handling
>
> Lance Richardson (1):
>   net/bnxt: reset Rx allocation state on Rx queue restart
>
> Somnath Kotur (1):
>   net/bnxt: fix race between interrupt handler and dev config
>
>  drivers/net/bnxt/bnxt.h        | 51 +++++++++++++++++++++++++
>  drivers/net/bnxt/bnxt_cpr.c    |  2 -
>  drivers/net/bnxt/bnxt_ethdev.c | 70 ++++++++++------------------------
>  drivers/net/bnxt/bnxt_filter.c |  1 -
>  drivers/net/bnxt/bnxt_flow.c   |  7 ----
>  drivers/net/bnxt/bnxt_hwrm.c   | 30 +++++----------
>  drivers/net/bnxt/bnxt_irq.c    |  7 +++-
>  drivers/net/bnxt/bnxt_ring.c   |  3 ++
>  drivers/net/bnxt/bnxt_rxr.c    | 16 +++++---
>  drivers/net/bnxt/bnxt_stats.c  |  2 +-
>  10 files changed, 101 insertions(+), 88 deletions(-)
>
> --
> 2.20.1 (Apple Git-117)
>
>

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

end of thread, other threads:[~2019-10-14  3:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14  0:01 [dpdk-dev] [PATCH 0/7] patchset for bnxt Ajit Khaparde
2019-10-14  0:01 ` [dpdk-dev] [PATCH 1/7] net/bnxt: fix dereference before null check Ajit Khaparde
2019-10-14  0:01 ` [dpdk-dev] [PATCH 2/7] net/bnxt: reset Rx allocation state on Rx queue restart Ajit Khaparde
2019-10-14  0:01 ` [dpdk-dev] [PATCH 3/7] net/bnxt: cleanup comments in source Ajit Khaparde
2019-10-14  0:01 ` [dpdk-dev] [PATCH 4/7] net/bnxt: move macro definitions to header file Ajit Khaparde
2019-10-14  0:01 ` [dpdk-dev] [PATCH 5/7] net/bnxt: fix race between interrupt handler and dev config Ajit Khaparde
2019-10-14  0:01 ` [dpdk-dev] [PATCH 6/7] net/bnxt: fix endianness while retrieving MTU from FW Ajit Khaparde
2019-10-14  0:01 ` [dpdk-dev] [PATCH 7/7] net/bnxt: fix error handling Ajit Khaparde
2019-10-14  3:58 ` [dpdk-dev] [PATCH 0/7] patchset for bnxt 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).