patches for DPDK stable branches
 help / color / Atom feed
* [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11
@ 2020-03-18  5:55 Somnath Kotur
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 1/4] net/bnxt: fix crash in secondary process Somnath Kotur
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Somnath Kotur @ 2020-03-18  5:55 UTC (permalink / raw)
  To: stable

Please apply.

Kalesh AP (2):
  net/bnxt: fix probe in FreeBSD
  net/bnxt: fix IOVA mapping

Rahul Gupta (1):
  net/bnxt: fix default timeout for getting FW version

Stephen Hemminger (1):
  net/bnxt: fix crash in secondary process

 drivers/net/bnxt/bnxt.h        |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c | 44 ++++++++++++------------------------------
 drivers/net/bnxt/bnxt_hwrm.c   | 31 ++++++++++++-----------------
 drivers/net/bnxt/bnxt_hwrm.h   |  2 +-
 drivers/net/bnxt/bnxt_irq.c    |  7 +++++++
 drivers/net/bnxt/bnxt_ring.c   | 15 --------------
 drivers/net/bnxt/bnxt_vnic.c   | 12 ------------
 7 files changed, 34 insertions(+), 81 deletions(-)

-- 
1.8.3.1


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

* [dpdk-stable] [PATCH 18.11 1/4] net/bnxt: fix crash in secondary process
  2020-03-18  5:55 [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Somnath Kotur
@ 2020-03-18  5:55 ` Somnath Kotur
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 2/4] net/bnxt: fix probe in FreeBSD Somnath Kotur
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Somnath Kotur @ 2020-03-18  5:55 UTC (permalink / raw)
  To: stable

From: Stephen Hemminger <stephen@networkplumber.org>

[ upstream commit f35eaaca5f5f09b48f5d96adbaccc4484aa6e058 ]

The secondary process should not modify device state when
init is called. The pci device information pointed to by
dev_private pointer is not correct in secondary process.

Fixes: b7778e8a1c00 ("net/bnxt: refactor to properly allocate resources for PF/VF")

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

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 06dfbf3..878b9f5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -404,6 +404,7 @@ static int bnxt_init_nic(struct bnxt *bp)
 static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 				  struct rte_eth_dev_info *dev_info)
 {
+	struct rte_pci_device *pdev = RTE_DEV_TO_PCI(eth_dev->device);
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint16_t max_vnics, i, j, vpool, vrxq;
 	unsigned int max_rx_rings;
@@ -414,7 +415,7 @@ static void bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 
 	/* PF/VF specifics */
 	if (BNXT_PF(bp))
-		dev_info->max_vfs = bp->pdev->max_vfs;
+		dev_info->max_vfs = pdev->max_vfs;
 	max_rx_rings = RTE_MIN(bp->max_rx_rings, bp->max_stat_ctx);
 	/* For the sake of symmetry, max_rx_queues = max_tx_queues */
 	dev_info->max_rx_queues = max_rx_rings;
@@ -3321,12 +3322,6 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
 	if (version_printed++ == 0)
 		PMD_DRV_LOG(INFO, "%s\n", bnxt_version);
 
-	rte_eth_copy_pci_info(eth_dev, pci_dev);
-
-	bp = eth_dev->data->dev_private;
-
-	bp->dev_stopped = 1;
-
 	eth_dev->dev_ops = &bnxt_dev_ops;
 	eth_dev->rx_pkt_burst = &bnxt_recv_pkts;
 	eth_dev->tx_pkt_burst = &bnxt_xmit_pkts;
@@ -3338,6 +3333,12 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	rte_eth_copy_pci_info(eth_dev, pci_dev);
+
+	bp = eth_dev->data->dev_private;
+
+	bp->dev_stopped = 1;
+
 	if (bnxt_vf_pciid(pci_dev->id.device_id))
 		bp->flags |= BNXT_FLAG_VF;
 
-- 
1.8.3.1


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

* [dpdk-stable] [PATCH 18.11 2/4] net/bnxt: fix probe in FreeBSD
  2020-03-18  5:55 [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Somnath Kotur
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 1/4] net/bnxt: fix crash in secondary process Somnath Kotur
@ 2020-03-18  5:55 ` Somnath Kotur
  2020-03-18 22:59   ` Kevin Traynor
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 3/4] net/bnxt: fix IOVA mapping Somnath Kotur
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Somnath Kotur @ 2020-03-18  5:55 UTC (permalink / raw)
  To: stable

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

In FreeBSD environment, nic_uio driver does not support interrupts
and rte_intr_callback_register() will fail to register interrupts
which in turn causes bnxt driver probe failure.

Fixed driver to ignore interrupt callback failures in FreeBSD.

Fixes: 6de4c538b393 ("net/bnxt: fix error handling in port start")
Fixes: 43f78b380f89 ("net/bnxt: retry IRQ callback deregistration")

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>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 3 +++
 drivers/net/bnxt/bnxt_irq.c    | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 878b9f5..f222c79 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -342,8 +342,11 @@ static int bnxt_init_chip(struct bnxt *bp)
 
 	/* enable uio/vfio intr/eventfd mapping */
 	rc = rte_intr_enable(intr_handle);
+#ifndef RTE_EXEC_ENV_FREEBSD
+	/* In FreeBSD OS, nic_uio driver does not support interrupts */
 	if (rc)
 		goto err_free;
+#endif
 
 	rc = bnxt_get_hwrm_link_config(bp, &new);
 	if (rc) {
diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
index 57365d7..b5f30bb 100644
--- a/drivers/net/bnxt/bnxt_irq.c
+++ b/drivers/net/bnxt/bnxt_irq.c
@@ -152,6 +152,13 @@ int bnxt_request_int(struct bnxt *bp)
 		if (!rc)
 			irq->requested = 1;
 	}
+	#ifdef RTE_EXEC_ENV_FREEBSD
+	/**
+	 * In FreeBSD OS, nic_uio does not support interrupts and
+	 * interrupt register callback will fail.
+	 */
+	rc = 0;
+	#endif
 
 	return rc;
 }
-- 
1.8.3.1


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

* [dpdk-stable] [PATCH 18.11 3/4] net/bnxt: fix IOVA mapping
  2020-03-18  5:55 [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Somnath Kotur
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 1/4] net/bnxt: fix crash in secondary process Somnath Kotur
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 2/4] net/bnxt: fix probe in FreeBSD Somnath Kotur
@ 2020-03-18  5:55 ` Somnath Kotur
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 4/4] net/bnxt: fix default timeout for getting FW version Somnath Kotur
  2020-03-18 22:59 ` [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Kevin Traynor
  4 siblings, 0 replies; 7+ messages in thread
From: Somnath Kotur @ 2020-03-18  5:55 UTC (permalink / raw)
  To: stable

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

[ upstream commit 8f3224f2659e2785d3957e91000c0297fff19b9f ]

Use rte_malloc_virt2iova() to obtain the IO address of a
virtual address obtained through rte_malloc().

Fixed to use the iova address returned by rte_memzone_reserve_aligned()
as the call always returns with populating "mz->iova" with
rte_malloc_virt2iova(mz->addr).

Removed redundant rte_mem_lock_page() call to lock the pages.

Fixes: f55e12f33416 ("net/bnxt: support extended port counters")

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>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 24 ------------------------
 drivers/net/bnxt/bnxt_hwrm.c   | 18 ++++++++----------
 drivers/net/bnxt/bnxt_ring.c   | 15 ---------------
 drivers/net/bnxt/bnxt_vnic.c   | 12 ------------
 4 files changed, 8 insertions(+), 61 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index f222c79..fc5265c 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3232,18 +3232,6 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
 	}
 	memset(mz->addr, 0, mz->len);
 	mz_phys_addr = mz->iova;
-	if ((unsigned long)mz->addr == mz_phys_addr) {
-		PMD_DRV_LOG(DEBUG,
-			    "Memzone physical address same as virtual.\n");
-		PMD_DRV_LOG(DEBUG,
-			    "Using rte_mem_virt2iova()\n");
-		mz_phys_addr = rte_mem_virt2iova(mz->addr);
-		if (mz_phys_addr == RTE_BAD_IOVA) {
-			PMD_DRV_LOG(ERR,
-				    "Can't map address to physical memory\n");
-			return -ENOMEM;
-		}
-	}
 
 	bp->rx_mem_zone = (const void *)mz;
 	bp->hw_rx_port_stats = mz->addr;
@@ -3271,18 +3259,6 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
 	}
 	memset(mz->addr, 0, mz->len);
 	mz_phys_addr = mz->iova;
-	if ((unsigned long)mz->addr == mz_phys_addr) {
-		PMD_DRV_LOG(DEBUG,
-			    "Memzone physical address same as virtual.\n");
-		PMD_DRV_LOG(DEBUG,
-			    "Using rte_mem_virt2iova()\n");
-		mz_phys_addr = rte_mem_virt2iova(mz->addr);
-		if (mz_phys_addr == RTE_BAD_IOVA) {
-			PMD_DRV_LOG(ERR,
-				    "Can't map address to physical memory\n");
-			return -ENOMEM;
-		}
-	}
 
 	bp->tx_mem_zone = (const void *)mz;
 	bp->hw_tx_port_stats = mz->addr;
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 5fdecab..7d2bd9c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -871,9 +871,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 			rc = -ENOMEM;
 			goto error;
 		}
-		rte_mem_lock_page(bp->hwrm_cmd_resp_addr);
 		bp->hwrm_cmd_resp_dma_addr =
-			rte_mem_virt2iova(bp->hwrm_cmd_resp_addr);
+			rte_malloc_virt2iova(bp->hwrm_cmd_resp_addr);
 		if (bp->hwrm_cmd_resp_dma_addr == RTE_BAD_IOVA) {
 			PMD_DRV_LOG(ERR,
 			"Unable to map response buffer to physical memory.\n");
@@ -897,9 +896,8 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 			rc = -ENOMEM;
 			goto error;
 		}
-		rte_mem_lock_page(bp->hwrm_short_cmd_req_addr);
 		bp->hwrm_short_cmd_req_dma_addr =
-			rte_mem_virt2iova(bp->hwrm_short_cmd_req_addr);
+			rte_malloc_virt2iova(bp->hwrm_short_cmd_req_addr);
 		if (bp->hwrm_short_cmd_req_dma_addr == RTE_BAD_IOVA) {
 			rte_free(bp->hwrm_short_cmd_req_addr);
 			PMD_DRV_LOG(ERR,
@@ -2036,7 +2034,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)
 	if (bp->hwrm_cmd_resp_addr == NULL)
 		return -ENOMEM;
 	bp->hwrm_cmd_resp_dma_addr =
-		rte_mem_virt2iova(bp->hwrm_cmd_resp_addr);
+		rte_malloc_virt2iova(bp->hwrm_cmd_resp_addr);
 	if (bp->hwrm_cmd_resp_dma_addr == RTE_BAD_IOVA) {
 		PMD_DRV_LOG(ERR,
 			"unable to map response address to physical memory\n");
@@ -2955,7 +2953,7 @@ int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp)
 			 page_getenum(bp->pf.active_vfs * HWRM_MAX_REQ_LEN));
 	req.req_buf_len = rte_cpu_to_le_16(HWRM_MAX_REQ_LEN);
 	req.req_buf_page_addr0 =
-		rte_cpu_to_le_64(rte_mem_virt2iova(bp->pf.vf_req_buf));
+		rte_cpu_to_le_64(rte_malloc_virt2iova(bp->pf.vf_req_buf));
 	if (req.req_buf_page_addr0 == RTE_BAD_IOVA) {
 		PMD_DRV_LOG(ERR,
 			"unable to map buffer address to physical memory\n");
@@ -3389,7 +3387,7 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)
 	rte_mem_lock_page(buf);
 	if (buf == NULL)
 		return -ENOMEM;
-	dma_handle = rte_mem_virt2iova(buf);
+	dma_handle = rte_malloc_virt2iova(buf);
 	if (dma_handle == RTE_BAD_IOVA) {
 		PMD_DRV_LOG(ERR,
 			"unable to map response address to physical memory\n");
@@ -3424,7 +3422,7 @@ int bnxt_hwrm_get_nvram_item(struct bnxt *bp, uint32_t index,
 	if (!buf)
 		return -ENOMEM;
 
-	dma_handle = rte_mem_virt2iova(buf);
+	dma_handle = rte_malloc_virt2iova(buf);
 	if (dma_handle == RTE_BAD_IOVA) {
 		PMD_DRV_LOG(ERR,
 			"unable to map response address to physical memory\n");
@@ -3477,7 +3475,7 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,
 	if (!buf)
 		return -ENOMEM;
 
-	dma_handle = rte_mem_virt2iova(buf);
+	dma_handle = rte_malloc_virt2iova(buf);
 	if (dma_handle == RTE_BAD_IOVA) {
 		PMD_DRV_LOG(ERR,
 			"unable to map response address to physical memory\n");
@@ -3540,7 +3538,7 @@ static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf,
 
 	req.vf_id = rte_cpu_to_le_16(bp->pf.first_vf_id + vf);
 	req.max_vnic_id_cnt = rte_cpu_to_le_32(bp->pf.total_vnics);
-	req.vnic_id_tbl_addr = rte_cpu_to_le_64(rte_mem_virt2iova(vnic_ids));
+	req.vnic_id_tbl_addr = rte_cpu_to_le_64(rte_malloc_virt2iova(vnic_ids));
 
 	if (req.vnic_id_tbl_addr == RTE_BAD_IOVA) {
 		HWRM_UNLOCK();
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 7a154e2..85bb7a6 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -79,7 +79,6 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	const struct rte_memzone *mz = NULL;
 	char mz_name[RTE_MEMZONE_NAMESIZE];
 	rte_iova_t mz_phys_addr;
-	int sz;
 
 	int stats_len = (tx_ring_info || rx_ring_info) ?
 	    RTE_CACHE_LINE_ROUNDUP(sizeof(struct hwrm_stat_ctx_query_output) -
@@ -155,20 +154,6 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	}
 	memset(mz->addr, 0, mz->len);
 	mz_phys_addr = mz->iova;
-	if ((unsigned long)mz->addr == mz_phys_addr) {
-		PMD_DRV_LOG(WARNING,
-			"Memzone physical address same as virtual.\n");
-		PMD_DRV_LOG(WARNING,
-			"Using rte_mem_virt2iova()\n");
-		for (sz = 0; sz < total_alloc_len; sz += getpagesize())
-			rte_mem_lock_page(((char *)mz->addr) + sz);
-		mz_phys_addr = rte_mem_virt2iova(mz->addr);
-		if (mz_phys_addr == RTE_BAD_IOVA) {
-			PMD_DRV_LOG(ERR,
-			"unable to map ring address to physical memory\n");
-			return -ENOMEM;
-		}
-	}
 
 	if (tx_ring_info) {
 		txq->mz = mz;
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index cc0b0ae..30af7a5 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -140,18 +140,6 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 			return -ENOMEM;
 	}
 	mz_phys_addr = mz->iova;
-	if ((unsigned long)mz->addr == mz_phys_addr) {
-		PMD_DRV_LOG(WARNING,
-			"Memzone physical address same as virtual.\n");
-		PMD_DRV_LOG(WARNING,
-			"Using rte_mem_virt2iova()\n");
-		mz_phys_addr = rte_mem_virt2iova(mz->addr);
-		if (mz_phys_addr == RTE_BAD_IOVA) {
-			PMD_DRV_LOG(ERR,
-				    "unable to map to physical memory\n");
-			return -ENOMEM;
-		}
-	}
 
 	for (i = 0; i < max_vnics; i++) {
 		vnic = &bp->vnic_info[i];
-- 
1.8.3.1


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

* [dpdk-stable] [PATCH 18.11 4/4] net/bnxt: fix default timeout for getting FW version
  2020-03-18  5:55 [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Somnath Kotur
                   ` (2 preceding siblings ...)
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 3/4] net/bnxt: fix IOVA mapping Somnath Kotur
@ 2020-03-18  5:55 ` Somnath Kotur
  2020-03-18 22:59 ` [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Kevin Traynor
  4 siblings, 0 replies; 7+ messages in thread
From: Somnath Kotur @ 2020-03-18  5:55 UTC (permalink / raw)
  To: stable

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

[upstream commit 975ff25e7c2d8dfba2c947b5dc23a3bebf51b2d6 ]

Initially when driver is loading, there is no HWRM timeout configured
by FW, the VER_GET command needs use default timeout as 500ms.

Fixes: 458f0360e8dc ("net/bnxt: get default HWRM command timeout from FW")

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  4 ++--
 drivers/net/bnxt/bnxt_ethdev.c |  2 +-
 drivers/net/bnxt/bnxt_hwrm.c   | 13 ++++---------
 drivers/net/bnxt/bnxt_hwrm.h   |  2 +-
 4 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index 33fef1b..140089d 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -374,8 +374,8 @@ struct bnxt {
 	uint16_t			max_req_len;
 	uint16_t			max_resp_len;
 
-	/* default command timeout value of 50ms */
-#define HWRM_CMD_TIMEOUT	50000
+	/* default command timeout value of 500ms */
+#define DFLT_HWRM_CMD_TIMEOUT	500000
 	/* default HWRM request timeout value */
 	uint32_t		hwrm_cmd_timeout;
 
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index fc5265c..90139bc 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3334,7 +3334,7 @@ static int bnxt_alloc_stats_mem(struct bnxt *bp)
 			"hwrm resource allocation failure rc: %x\n", rc);
 		goto error_free;
 	}
-	rc = bnxt_hwrm_ver_get(bp);
+	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
 	if (rc)
 		goto error_free;
 	rc = bnxt_hwrm_queue_qportcfg(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 7d2bd9c..6e6d477 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -82,13 +82,7 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 		GRCPF_REG_KONG_CHANNEL_OFFSET : GRCPF_REG_CHIMP_CHANNEL_OFFSET;
 	uint16_t mb_trigger_offset = use_kong_mb ?
 		GRCPF_REG_KONG_COMM_TRIGGER : GRCPF_REG_CHIMP_COMM_TRIGGER;
-	uint32_t timeout;
-
-	/* For VER_GET command, set timeout as 50ms */
-	if (rte_cpu_to_le_16(req->req_type) == HWRM_VER_GET)
-		timeout = HWRM_CMD_TIMEOUT;
-	else
-		timeout = bp->hwrm_cmd_timeout;
+	uint32_t timeout = bp->hwrm_cmd_timeout;
 
 	if (bp->flags & BNXT_FLAG_SHORT_CMD) {
 		void *short_cmd_req = bp->hwrm_short_cmd_req_addr;
@@ -801,7 +795,7 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
 	return rc;
 }
 
-int bnxt_hwrm_ver_get(struct bnxt *bp)
+int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 {
 	int rc = 0;
 	struct hwrm_ver_get_input req = {.req_type = 0 };
@@ -812,6 +806,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	uint32_t dev_caps_cfg;
 
 	bp->max_req_len = HWRM_MAX_REQ_LEN;
+	bp->hwrm_cmd_timeout = timeout;
 	HWRM_PREP(req, VER_GET, BNXT_USE_CHIMP_MB);
 
 	req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
@@ -843,7 +838,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp)
 	/* convert timeout to usec */
 	bp->hwrm_cmd_timeout *= 1000;
 	if (!bp->hwrm_cmd_timeout)
-		bp->hwrm_cmd_timeout = HWRM_CMD_TIMEOUT;
+		bp->hwrm_cmd_timeout = DFLT_HWRM_CMD_TIMEOUT;
 
 	if (resp->hwrm_intf_maj_8b != HWRM_VERSION_MAJOR) {
 		PMD_DRV_LOG(ERR, "Unsupported firmware API version\n");
diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h
index c586ed3..0300bae 100644
--- a/drivers/net/bnxt/bnxt_hwrm.h
+++ b/drivers/net/bnxt/bnxt_hwrm.h
@@ -90,7 +90,7 @@ int bnxt_hwrm_stat_ctx_free(struct bnxt *bp,
 int bnxt_hwrm_ctx_qstats(struct bnxt *bp, uint32_t cid, int idx,
 			 struct rte_eth_stats *stats, uint8_t rx);
 
-int bnxt_hwrm_ver_get(struct bnxt *bp);
+int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout);
 
 int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic);
 int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic);
-- 
1.8.3.1


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

* Re: [dpdk-stable] [PATCH 18.11 2/4] net/bnxt: fix probe in FreeBSD
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 2/4] net/bnxt: fix probe in FreeBSD Somnath Kotur
@ 2020-03-18 22:59   ` Kevin Traynor
  0 siblings, 0 replies; 7+ messages in thread
From: Kevin Traynor @ 2020-03-18 22:59 UTC (permalink / raw)
  To: Somnath Kotur, stable

On 18/03/2020 05:55, Somnath Kotur wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 

Added [ upstream commit d9fc6a0d07559cfa718efe971a51620c23ba211e ]

> In FreeBSD environment, nic_uio driver does not support interrupts
> and rte_intr_callback_register() will fail to register interrupts
> which in turn causes bnxt driver probe failure.
> 
> Fixed driver to ignore interrupt callback failures in FreeBSD.
> 
> Fixes: 6de4c538b393 ("net/bnxt: fix error handling in port start")
> Fixes: 43f78b380f89 ("net/bnxt: retry IRQ callback deregistration")
> 
> 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>
> Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
> Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
> ---
>  drivers/net/bnxt/bnxt_ethdev.c | 3 +++
>  drivers/net/bnxt/bnxt_irq.c    | 7 +++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 878b9f5..f222c79 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -342,8 +342,11 @@ static int bnxt_init_chip(struct bnxt *bp)
>  
>  	/* enable uio/vfio intr/eventfd mapping */
>  	rc = rte_intr_enable(intr_handle);
> +#ifndef RTE_EXEC_ENV_FREEBSD
> +	/* In FreeBSD OS, nic_uio driver does not support interrupts */
>  	if (rc)
>  		goto err_free;
> +#endif
>  
>  	rc = bnxt_get_hwrm_link_config(bp, &new);
>  	if (rc) {
> diff --git a/drivers/net/bnxt/bnxt_irq.c b/drivers/net/bnxt/bnxt_irq.c
> index 57365d7..b5f30bb 100644
> --- a/drivers/net/bnxt/bnxt_irq.c
> +++ b/drivers/net/bnxt/bnxt_irq.c
> @@ -152,6 +152,13 @@ int bnxt_request_int(struct bnxt *bp)
>  		if (!rc)
>  			irq->requested = 1;
>  	}
> +	#ifdef RTE_EXEC_ENV_FREEBSD
> +	/**
> +	 * In FreeBSD OS, nic_uio does not support interrupts and
> +	 * interrupt register callback will fail.
> +	 */
> +	rc = 0;
> +	#endif
>  
>  	return rc;
>  }
> 


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

* Re: [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11
  2020-03-18  5:55 [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Somnath Kotur
                   ` (3 preceding siblings ...)
  2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 4/4] net/bnxt: fix default timeout for getting FW version Somnath Kotur
@ 2020-03-18 22:59 ` Kevin Traynor
  4 siblings, 0 replies; 7+ messages in thread
From: Kevin Traynor @ 2020-03-18 22:59 UTC (permalink / raw)
  To: Somnath Kotur, stable

On 18/03/2020 05:55, Somnath Kotur wrote:
> Please apply.
> 
> Kalesh AP (2):
>   net/bnxt: fix probe in FreeBSD
>   net/bnxt: fix IOVA mapping
> 
> Rahul Gupta (1):
>   net/bnxt: fix default timeout for getting FW version
> 
> Stephen Hemminger (1):
>   net/bnxt: fix crash in secondary process
> 
>  drivers/net/bnxt/bnxt.h        |  4 ++--
>  drivers/net/bnxt/bnxt_ethdev.c | 44 ++++++++++++------------------------------
>  drivers/net/bnxt/bnxt_hwrm.c   | 31 ++++++++++++-----------------
>  drivers/net/bnxt/bnxt_hwrm.h   |  2 +-
>  drivers/net/bnxt/bnxt_irq.c    |  7 +++++++
>  drivers/net/bnxt/bnxt_ring.c   | 15 --------------
>  drivers/net/bnxt/bnxt_vnic.c   | 12 ------------
>  7 files changed, 34 insertions(+), 81 deletions(-)
> 

Series applied, thanks.


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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18  5:55 [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Somnath Kotur
2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 1/4] net/bnxt: fix crash in secondary process Somnath Kotur
2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 2/4] net/bnxt: fix probe in FreeBSD Somnath Kotur
2020-03-18 22:59   ` Kevin Traynor
2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 3/4] net/bnxt: fix IOVA mapping Somnath Kotur
2020-03-18  5:55 ` [dpdk-stable] [PATCH 18.11 4/4] net/bnxt: fix default timeout for getting FW version Somnath Kotur
2020-03-18 22:59 ` [dpdk-stable] [PATCH 18.11 0/4] bnxt backport fixes for 18.11 Kevin Traynor

patches for DPDK stable branches

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/ public-inbox