DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev]  [PATCH 0/9] bnxt patchset with fixes
@ 2020-04-21  9:12 Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 1/9] net/bnxt: use macro for PCI log format Kalesh A P
                   ` (10 more replies)
  0 siblings, 11 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Please apply.

Kalesh AP (9):
  net/bnxt: use macro for PCI log format
  net/bnxt: return speed capabilities in device info get
  net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in
    progress
  net/bnxt: fix to use true/false for bool types
  net/bnxt: fix to handle port start failure
  net/bnxt: fix vlan add when port is stopped
  net/bnxt: define FW_STATUS location structure for ChiMP devices
  net/bnxt: log firmware status on early init failure
  net/bnxt: fix to not issue HWRM_PORT_MAC_QCFG on a VF

 drivers/net/bnxt/bnxt.h                |  10 ++
 drivers/net/bnxt/bnxt_ethdev.c         | 177 ++++++++++++++++++++++++++++++---
 drivers/net/bnxt/bnxt_hwrm.c           |  23 ++---
 drivers/net/bnxt/bnxt_ring.c           |   2 +-
 drivers/net/bnxt/bnxt_vnic.c           |   2 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  49 +++++++++
 6 files changed, 232 insertions(+), 31 deletions(-)

-- 
2.10.1


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

* [dpdk-dev]  [PATCH 1/9] net/bnxt: use macro for PCI log format
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 2/9] net/bnxt: return speed capabilities in device info get Kalesh A P
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Use PCI_PRI_FMT instead of "%04x:%02x:%02x:%02x" print format.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 6 +++---
 drivers/net/bnxt/bnxt_ring.c | 2 +-
 drivers/net/bnxt/bnxt_vnic.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 09a7328..4c0fac6 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1104,7 +1104,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 	dev_caps_cfg = rte_le_to_cpu_32(resp->dev_caps_cfg);
 
 	if (bp->max_resp_len != max_resp_len) {
-		sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x",
+		sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT,
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
 			bp->pdev->addr.devid, bp->pdev->addr.function);
 
@@ -1139,7 +1139,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 	     (dev_caps_cfg &
 	      HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED)) ||
 	    bp->hwrm_max_ext_req_len > HWRM_MAX_REQ_LEN) {
-		sprintf(type, "bnxt_hwrm_short_%04x:%02x:%02x:%02x",
+		sprintf(type, "bnxt_hwrm_short_" PCI_PRI_FMT,
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
 			bp->pdev->addr.devid, bp->pdev->addr.function);
 
@@ -2574,7 +2574,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)
 	struct rte_pci_device *pdev = bp->pdev;
 	char type[RTE_MEMZONE_NAMESIZE];
 
-	sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x", pdev->addr.domain,
+	sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT, pdev->addr.domain,
 		pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
 	bp->max_resp_len = HWRM_MAX_RESP_LEN;
 	bp->hwrm_cmd_resp_addr = rte_malloc(type, bp->max_resp_len, 0);
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 1999cd7..24a947f 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -196,7 +196,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	total_alloc_len += tpa_info_len;
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
-		 "bnxt_%04x:%02x:%02x:%02x-%04x_%s", pdev->addr.domain,
+		 "bnxt_" PCI_PRI_FMT "-%04x_%s", pdev->addr.domain,
 		 pdev->addr.bus, pdev->addr.devid, pdev->addr.function, qidx,
 		 suffix);
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index bc054a8..326c0d1 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -136,7 +136,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 
 	max_vnics = bp->max_vnics;
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
-		 "bnxt_%04x:%02x:%02x:%02x_vnicattr", pdev->addr.domain,
+		 "bnxt_" PCI_PRI_FMT "_vnicattr", pdev->addr.domain,
 		 pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 	mz = rte_memzone_lookup(mz_name);
-- 
2.10.1


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

* [dpdk-dev] [PATCH 2/9] net/bnxt: return speed capabilities in device info get
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 1/9] net/bnxt: use macro for PCI log format Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 3/9] net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress Kalesh A P
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Added information about supported speeds for the port in the
"dev_infos_get". As other PMDs are returning the speed capabilities,
apps may expect this behavior from bnxt PMD.

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

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d29671d..3397c05 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -667,6 +667,40 @@ static int bnxt_shutdown_nic(struct bnxt *bp)
  * Device configuration and status function
  */
 
+static uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
+{
+	uint32_t link_speed = bp->link_info.support_speeds;
+	uint32_t speed_capa = 0;
+
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB)
+		speed_capa |= ETH_LINK_SPEED_100M;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MBHD)
+		speed_capa |= ETH_LINK_SPEED_100M_HD;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GB)
+		speed_capa |= ETH_LINK_SPEED_1G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2_5GB)
+		speed_capa |= ETH_LINK_SPEED_2_5G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB)
+		speed_capa |= ETH_LINK_SPEED_10G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_20GB)
+		speed_capa |= ETH_LINK_SPEED_20G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_25GB)
+		speed_capa |= ETH_LINK_SPEED_25G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_40GB)
+		speed_capa |= ETH_LINK_SPEED_40G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB)
+		speed_capa |= ETH_LINK_SPEED_50G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB)
+		speed_capa |= ETH_LINK_SPEED_100G;
+
+	if (bp->link_info.auto_mode == HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE)
+		speed_capa |= ETH_LINK_SPEED_FIXED;
+	else
+		speed_capa |= ETH_LINK_SPEED_AUTONEG;
+
+	return speed_capa;
+}
+
 static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 				struct rte_eth_dev_info *dev_info)
 {
@@ -710,6 +744,8 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
 	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
+	dev_info->speed_capa = bnxt_get_speed_capabilities(bp);
+
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_thresh = {
-- 
2.10.1


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

* [dpdk-dev] [PATCH 3/9] net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 1/9] net/bnxt: use macro for PCI log format Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 2/9] net/bnxt: return speed capabilities in device info get Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 4/9] net/bnxt: fix to use true/false for bool types Kalesh A P
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

FW returns HWRM_ERR_CODE_HOT_RESET_PROGRESS(0xa) when it is
unable to process a specific cmd while hot reset is in progress.
Host driver is expected to keep retrying the cmd for 2s with
a gap of 50ms between each retrial.

Also, fixed to fail port start if the HWRM_FUNC_DRV_IF_CHANGE
still returns error after 2 seconds.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  5 +++++
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++--------
 drivers/net/bnxt/bnxt_hwrm.c   |  4 ++++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index a7a9e41..d55a570 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -480,6 +480,11 @@ struct bnxt_error_recovery_info {
 	uint32_t        last_reset_counter;
 };
 
+/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */
+#define BNXT_IF_CHANGE_RETRY_INTERVAL	50
+/* Maximum retry count for FUNC_DRV_IF_CHANGE */
+#define BNXT_IF_CHANGE_RETRY_COUNT	40
+
 struct bnxt_mark_info {
 	uint32_t	mark_id;
 	bool		valid;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3397c05..b6c7132 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1051,7 +1051,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	int vlan_mask = 0;
-	int rc;
+	int rc, retry_cnt = BNXT_IF_CHANGE_RETRY_COUNT;
 
 	if (!eth_dev->data->nb_tx_queues || !eth_dev->data->nb_rx_queues) {
 		PMD_DRV_LOG(ERR, "Queues are not configured yet!\n");
@@ -1064,14 +1064,23 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	}
 
-	rc = bnxt_hwrm_if_change(bp, 1);
-	if (!rc) {
-		if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
-			rc = bnxt_handle_if_change_status(bp);
-			if (rc)
-				return rc;
-		}
+	do {
+		rc = bnxt_hwrm_if_change(bp, 1);
+		if (rc == 0 || rc != -EAGAIN)
+			break;
+
+		rte_delay_ms(BNXT_IF_CHANGE_RETRY_INTERVAL);
+	} while (retry_cnt--);
+
+	if (rc)
+		return rc;
+
+	if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
+		rc = bnxt_handle_if_change_status(bp);
+		if (rc)
+			return rc;
 	}
+
 	bnxt_enable_int(bp);
 
 	rc = bnxt_init_chip(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4c0fac6..dc0b405 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -221,6 +221,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
@@ -249,6 +251,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
-- 
2.10.1


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

* [dpdk-dev] [PATCH 4/9] net/bnxt: fix to use true/false for bool types
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (2 preceding siblings ...)
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 3/9] net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 5/9] net/bnxt: fix to handle port start failure Kalesh A P
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b6c7132..780d9c4 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1065,7 +1065,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	}
 
 	do {
-		rc = bnxt_hwrm_if_change(bp, 1);
+		rc = bnxt_hwrm_if_change(bp, true);
 		if (rc == 0 || rc != -EAGAIN)
 			break;
 
@@ -1113,7 +1113,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	return 0;
 
 error:
-	bnxt_hwrm_if_change(bp, 0);
+	bnxt_hwrm_if_change(bp, false);
 	bnxt_shutdown_nic(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
@@ -1190,7 +1190,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	/* Process any remaining notifications in default completion queue */
 	bnxt_int_handler(eth_dev);
 	bnxt_shutdown_nic(bp);
-	bnxt_hwrm_if_change(bp, 0);
+	bnxt_hwrm_if_change(bp, false);
 
 	rte_free(bp->mark_table);
 	bp->mark_table = NULL;
-- 
2.10.1


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

* [dpdk-dev] [PATCH 5/9] net/bnxt: fix to handle port start failure
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (3 preceding siblings ...)
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 4/9] net/bnxt: fix to use true/false for bool types Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 6/9] net/bnxt: fix vlan add when port is stopped Kalesh A P
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Fixed to invoke clean up in the reverse sequence of
initialization in case any of the FW commands fail
during port start.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
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 Kumar 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 780d9c4..206111d 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1113,10 +1113,10 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	return 0;
 
 error:
-	bnxt_hwrm_if_change(bp, false);
 	bnxt_shutdown_nic(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
+	bnxt_hwrm_if_change(bp, false);
 	eth_dev->data->dev_started = 0;
 	return rc;
 }
-- 
2.10.1


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

* [dpdk-dev] [PATCH 6/9] net/bnxt: fix vlan add when port is stopped
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (4 preceding siblings ...)
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 5/9] net/bnxt: fix to handle port start failure Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 7/9] net/bnxt: define FW_STATUS location structure for ChiMP devices Kalesh A P
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Driver destroys the vnic when the port is brought down.
When user tries to add a vlan when port is stopped, driver
issues HWRM command to FW with invalid vnic_id and it fails.

Fixed to return an error while setting vlan when port is
not started.

Fixes: b4e190d55c25 ("net/bnxt: fix MAC/VLAN filter allocation")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 206111d..589190b 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2082,6 +2082,11 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
+	if (!eth_dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be started before setting vlan\n");
+		return -EINVAL;
+	}
+
 	/* These operations apply to ALL existing MAC/VLAN filters */
 	if (on)
 		return bnxt_add_vlan_filter(bp, vlan_id);
-- 
2.10.1


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

* [dpdk-dev] [PATCH 7/9] net/bnxt: define FW_STATUS location structure for ChiMP devices
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (5 preceding siblings ...)
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 6/9] net/bnxt: fix vlan add when port is stopped Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 8/9] net/bnxt: log firmware status on early init failure Kalesh A P
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Code using this change will be added in next patch.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index da22b62..fe18686 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -38622,4 +38622,53 @@ struct hwrm_cfa_counter_qstats_output {
 	uint8_t	valid;
 } __rte_packed;
 
+/*
+ * This structure is fixed at the beginning of the ChiMP SRAM (GRC
+ * offset: 0x31001F0). Host software is expected to read from this
+ * location for a defined signature. If it exists, the software can
+ * assume the presence of this structure and the validity of the
+ * FW_STATUS location in the next field.
+ */
+/* hcomm_status (size:64b/8B) */
+struct hcomm_status {
+	uint32_t	sig_ver;
+	/*
+	 * This field defines the version of the structure. The latest
+	 * version value is 1.
+	 */
+	#define HCOMM_STATUS_VER_MASK		UINT32_C(0xff)
+	#define HCOMM_STATUS_VER_SFT		0
+	#define HCOMM_STATUS_VER_LATEST		UINT32_C(0x1)
+	#define HCOMM_STATUS_VER_LAST		HCOMM_STATUS_VER_LATEST
+	/*
+	 * This field is to store the signature value to indicate the
+	 * presence of the structure.
+	 */
+	#define HCOMM_STATUS_SIGNATURE_MASK	UINT32_C(0xffffff00)
+	#define HCOMM_STATUS_SIGNATURE_SFT	8
+	#define HCOMM_STATUS_SIGNATURE_VAL	(UINT32_C(0x484353) << 8)
+	#define HCOMM_STATUS_SIGNATURE_LAST	HCOMM_STATUS_SIGNATURE_VAL
+	uint32_t	fw_status_loc;
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK	UINT32_C(0x3)
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT	0
+	/* PCIE configuration space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG	UINT32_C(0x0)
+	/* GRC space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC	UINT32_C(0x1)
+	/* BAR0 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0	UINT32_C(0x2)
+	/* BAR1 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1	UINT32_C(0x3)
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST	\
+		HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
+	/*
+	 * This offset where the fw_status register is located. The value
+	 * is generally 4-byte aligned.
+	 */
+	#define HCOMM_STATUS_TRUE_OFFSET_MASK		UINT32_C(0xfffffffc)
+	#define HCOMM_STATUS_TRUE_OFFSET_SFT		2
+} __attribute__((packed));
+/* This is the GRC offset where the hcomm_status struct resides. */
+#define HCOMM_STATUS_STRUCT_LOC		0x31001F0UL
+
 #endif /* _HSI_STRUCT_DEF_DPDK_H_ */
-- 
2.10.1


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

* [dpdk-dev] [PATCH 8/9] net/bnxt: log firmware status on early init failure
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (6 preceding siblings ...)
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 7/9] net/bnxt: define FW_STATUS location structure for ChiMP devices Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 9/9] net/bnxt: fix to not issue HWRM_PORT_MAC_QCFG on a VF Kalesh A P
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

Firmware reports any fatal error (either ASIC or Firmware related)
via a new status register. This status register can provide more detailed
information about the firmware errors, especially if error occurs
before HWRM_VER_GET is issued. Attempt to map this register if it is
present and check for firmware status when VER_GET command fails.

Refactored the code to allocate the "bp->recovery_info" structure
in bnxt_init_fw() instead of doing in bnxt_hwrm_error_recovery_qcfg().

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |   5 ++
 drivers/net/bnxt/bnxt_ethdev.c | 107 ++++++++++++++++++++++++++++++++++++++---
 drivers/net/bnxt/bnxt_hwrm.c   |  10 ----
 3 files changed, 106 insertions(+), 16 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index d55a570..586d3f5 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -507,6 +507,10 @@ struct bnxt_mark_info {
 #define BNXT_GRCP_WINDOW_2_BASE		0x2000
 #define BNXT_GRCP_WINDOW_3_BASE		0x3000
 
+#define BNXT_GRCP_BASE_MASK		0xfffff000
+#define BNXT_GRCP_OFFSET_MASK		0x00000ffc
+
+#define BNXT_FW_STATUS_HEALTHY		0x8000
 #define BNXT_FW_STATUS_SHUTDOWN		0x100000
 
 #define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
@@ -564,6 +568,7 @@ struct bnxt {
 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD	BIT(3)
 #define BNXT_FW_CAP_ADV_FLOW_MGMT	BIT(5)
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
+#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(7)
 
 	uint32_t		flow_flags;
 #define BNXT_FLOW_FLAG_L2_HDR_SRC_FILTER_EN	BIT(0)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 589190b..1a3c7e6 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -155,6 +155,7 @@ static int bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev);
 static void bnxt_cancel_fw_health_check(struct bnxt *bp);
 static int bnxt_restore_vlan_filters(struct bnxt *bp);
 static void bnxt_dev_recover(void *arg);
+static void bnxt_free_error_recovery_info(struct bnxt *bp);
 
 int is_bnxt_in_error(struct bnxt *bp)
 {
@@ -4967,6 +4968,89 @@ bnxt_get_fw_func_id(uint16_t port)
 	return bp->fw_fid;
 }
 
+static void bnxt_alloc_error_recovery_info(struct bnxt *bp)
+{
+	struct bnxt_error_recovery_info *info = bp->recovery_info;
+
+	if (info) {
+		if (!(bp->fw_cap & BNXT_FW_CAP_HCOMM_FW_STATUS))
+			memset(info, 0, sizeof(*info));
+		return;
+	}
+
+	if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
+		return;
+
+	info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
+			   sizeof(*info), 0);
+	if (!info)
+		bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
+
+	bp->recovery_info = info;
+}
+
+static void bnxt_check_fw_status(struct bnxt *bp)
+{
+	uint32_t fw_status;
+
+	if (!(bp->recovery_info &&
+	      (bp->fw_cap & BNXT_FW_CAP_HCOMM_FW_STATUS)))
+		return;
+
+	fw_status = bnxt_read_fw_status_reg(bp, BNXT_FW_STATUS_REG);
+	if (fw_status != BNXT_FW_STATUS_HEALTHY)
+		PMD_DRV_LOG(ERR, "Firmware not responding, status: %#x\n",
+			    fw_status);
+}
+
+static int bnxt_map_hcomm_fw_status_reg(struct bnxt *bp)
+{
+	struct bnxt_error_recovery_info *info = bp->recovery_info;
+	uint32_t status_loc;
+	uint32_t sig_ver;
+
+	rte_write32(HCOMM_STATUS_STRUCT_LOC, (uint8_t *)bp->bar0 +
+		    BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
+	sig_ver = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+				   BNXT_GRCP_WINDOW_2_BASE +
+				   offsetof(struct hcomm_status,
+					    sig_ver)));
+	/* If the signature is absent, then FW does not support this feature */
+	if ((sig_ver & HCOMM_STATUS_SIGNATURE_MASK) !=
+	    HCOMM_STATUS_SIGNATURE_VAL)
+		return 0;
+
+	if (!info) {
+		info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
+				   sizeof(*info), 0);
+		if (!info)
+			return -ENOMEM;
+		bp->recovery_info = info;
+	} else {
+		memset(info, 0, sizeof(*info));
+	}
+
+	status_loc = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+				      BNXT_GRCP_WINDOW_2_BASE +
+				      offsetof(struct hcomm_status,
+					       fw_status_loc)));
+
+	/* Only pre-map the FW health status GRC register */
+	if (BNXT_FW_STATUS_REG_TYPE(status_loc) != BNXT_FW_STATUS_REG_TYPE_GRC)
+		return 0;
+
+	info->status_regs[BNXT_FW_STATUS_REG] = status_loc;
+	info->mapped_status_regs[BNXT_FW_STATUS_REG] =
+		BNXT_GRCP_WINDOW_2_BASE + (status_loc & BNXT_GRCP_OFFSET_MASK);
+
+	rte_write32((status_loc & BNXT_GRCP_BASE_MASK), (uint8_t *)bp->bar0 +
+		    BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
+
+	bp->fw_cap |= BNXT_FW_CAP_HCOMM_FW_STATUS;
+
+	return 0;
+}
+
 static int bnxt_init_fw(struct bnxt *bp)
 {
 	uint16_t mtu;
@@ -4974,10 +5058,16 @@ static int bnxt_init_fw(struct bnxt *bp)
 
 	bp->fw_cap = 0;
 
-	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	rc = bnxt_map_hcomm_fw_status_reg(bp);
 	if (rc)
 		return rc;
 
+	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	if (rc) {
+		bnxt_check_fw_status(bp);
+		return rc;
+	}
+
 	rc = bnxt_hwrm_func_reset(bp);
 	if (rc)
 		return -EIO;
@@ -5008,6 +5098,7 @@ static int bnxt_init_fw(struct bnxt *bp)
 	if (rc)
 		return rc;
 
+	bnxt_alloc_error_recovery_info(bp);
 	/* Get the adapter error recovery support info */
 	rc = bnxt_hwrm_error_recovery_qcfg(bp);
 	if (rc)
@@ -5344,6 +5435,14 @@ static void bnxt_uninit_ctx_mem(struct bnxt *bp)
 }
 
 static void
+bnxt_free_error_recovery_info(struct bnxt *bp)
+{
+	rte_free(bp->recovery_info);
+	bp->recovery_info = NULL;
+	bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
+}
+
+static void
 bnxt_uninit_locks(struct bnxt *bp)
 {
 	pthread_mutex_destroy(&bp->flow_lock);
@@ -5363,11 +5462,7 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 	bnxt_free_ctx_mem(bp);
 	if (!reconfig_dev) {
 		bnxt_free_hwrm_resources(bp);
-
-		if (bp->recovery_info != NULL) {
-			rte_free(bp->recovery_info);
-			bp->recovery_info = NULL;
-		}
+		bnxt_free_error_recovery_info(bp);
 	}
 
 	bnxt_uninit_ctx_mem(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index dc0b405..666056a 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -5076,16 +5076,6 @@ int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp)
 	if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
 		return 0;
 
-	if (!info) {
-		info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
-				   sizeof(*info), 0);
-		bp->recovery_info = info;
-		if (info == NULL)
-			return -ENOMEM;
-	} else {
-		memset(info, 0, sizeof(*info));
-	}
-
 	HWRM_PREP(&req, HWRM_ERROR_RECOVERY_QCFG, BNXT_USE_CHIMP_MB);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
-- 
2.10.1


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

* [dpdk-dev] [PATCH 9/9] net/bnxt: fix to not issue HWRM_PORT_MAC_QCFG on a VF
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (7 preceding siblings ...)
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 8/9] net/bnxt: log firmware status on early init failure Kalesh A P
@ 2020-04-21  9:12 ` Kalesh A P
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
  10 siblings, 0 replies; 34+ messages in thread
From: Kalesh A P @ 2020-04-21  9:12 UTC (permalink / raw)
  To: dev; +Cc: ferruh.yigit, ajit.khaparde

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

HWRM_PORT_MAC_QCFG is not supported on a VF. Added a PF check
in bnxt_hwrm_port_mac_qcfg() to prevent the probe failure on a VF.

Fixes: 184e3d13d88a ("net/bnxt: fetch SVIF information from firmware")

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

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 666056a..ebf73e4 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3094,6 +3094,9 @@ int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp)
 
 	bp->port_svif = BNXT_SVIF_INVALID;
 
+	if (!BNXT_PF(bp))
+		return 0;
+
 	HWRM_PREP(&req, HWRM_PORT_MAC_QCFG, BNXT_USE_CHIMP_MB);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
-- 
2.10.1


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

* [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (8 preceding siblings ...)
  2020-04-21  9:12 ` [dpdk-dev] [PATCH 9/9] net/bnxt: fix to not issue HWRM_PORT_MAC_QCFG on a VF Kalesh A P
@ 2020-04-21 20:07 ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 01/10] net/bnxt: fix compilation on BSD Ajit Khaparde
                     ` (9 more replies)
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
  10 siblings, 10 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev

Patches with bug fixes.

v1->v2:
 - Fix compilation on BSD.
 - Fix commit logs for some of the patches.

Ajit Khaparde (1):
  net/bnxt: fix compilation on BSD

Kalesh AP (9):
  net/bnxt: use macro for PCI log format
  net/bnxt: return speed capabilities in device get info
  net/bnxt: fix HWRM command failure during FW reset
  net/bnxt: fix to use true/false for bool types
  net/bnxt: fix to handle port start failure
  net/bnxt: fix vlan add when port is stopped
  net/bnxt: add FW status location structure
  net/bnxt: log firmware status on early init failure
  net/bnxt: fix to not issue port MAC query on a VF

 drivers/net/bnxt/bnxt.h                |  10 ++
 drivers/net/bnxt/bnxt_ethdev.c         | 177 ++++++++++++++++++++++---
 drivers/net/bnxt/bnxt_hwrm.c           |  23 ++--
 drivers/net/bnxt/bnxt_ring.c           |   2 +-
 drivers/net/bnxt/bnxt_vnic.c           |   2 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  49 +++++++
 drivers/net/bnxt/tf_core/stack.c       |   2 +-
 7 files changed, 233 insertions(+), 32 deletions(-)

-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 01/10] net/bnxt: fix compilation on BSD
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 02/10] net/bnxt: use macro for PCI log format Ajit Khaparde
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kishore Padmanabha, Lance Richardson

There is no ENODATA in the errno.h in BSD.
Use a common errno to return error.

Fixes: cef1ca505d7f ("net/bnxt: support EM/EEM")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
---
 drivers/net/bnxt/tf_core/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/stack.c b/drivers/net/bnxt/tf_core/stack.c
index 3337073b7..9cfbd244f 100644
--- a/drivers/net/bnxt/tf_core/stack.c
+++ b/drivers/net/bnxt/tf_core/stack.c
@@ -73,7 +73,7 @@ int
 stack_pop(struct stack *st, uint32_t *x)
 {
 	if (stack_is_empty(st))
-		return -ENODATA;
+		return -ENOENT;
 
 	*x = st->items[st->top];
 	st->top--;
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 02/10] net/bnxt: use macro for PCI log format
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 01/10] net/bnxt: fix compilation on BSD Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 03/10] net/bnxt: return speed capabilities in device get info Ajit Khaparde
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP

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

Use PCI_PRI_FMT instead of "%04x:%02x:%02x:%02x" print format.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 6 +++---
 drivers/net/bnxt/bnxt_ring.c | 2 +-
 drivers/net/bnxt/bnxt_vnic.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 09a73286b..4c0fac6be 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1104,7 +1104,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 	dev_caps_cfg = rte_le_to_cpu_32(resp->dev_caps_cfg);
 
 	if (bp->max_resp_len != max_resp_len) {
-		sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x",
+		sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT,
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
 			bp->pdev->addr.devid, bp->pdev->addr.function);
 
@@ -1139,7 +1139,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 	     (dev_caps_cfg &
 	      HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED)) ||
 	    bp->hwrm_max_ext_req_len > HWRM_MAX_REQ_LEN) {
-		sprintf(type, "bnxt_hwrm_short_%04x:%02x:%02x:%02x",
+		sprintf(type, "bnxt_hwrm_short_" PCI_PRI_FMT,
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
 			bp->pdev->addr.devid, bp->pdev->addr.function);
 
@@ -2574,7 +2574,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)
 	struct rte_pci_device *pdev = bp->pdev;
 	char type[RTE_MEMZONE_NAMESIZE];
 
-	sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x", pdev->addr.domain,
+	sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT, pdev->addr.domain,
 		pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
 	bp->max_resp_len = HWRM_MAX_RESP_LEN;
 	bp->hwrm_cmd_resp_addr = rte_malloc(type, bp->max_resp_len, 0);
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 1999cd786..24a947f27 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -196,7 +196,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	total_alloc_len += tpa_info_len;
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
-		 "bnxt_%04x:%02x:%02x:%02x-%04x_%s", pdev->addr.domain,
+		 "bnxt_" PCI_PRI_FMT "-%04x_%s", pdev->addr.domain,
 		 pdev->addr.bus, pdev->addr.devid, pdev->addr.function, qidx,
 		 suffix);
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index bc054a8e0..326c0d1b6 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -136,7 +136,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 
 	max_vnics = bp->max_vnics;
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
-		 "bnxt_%04x:%02x:%02x:%02x_vnicattr", pdev->addr.domain,
+		 "bnxt_" PCI_PRI_FMT "_vnicattr", pdev->addr.domain,
 		 pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 	mz = rte_memzone_lookup(mz_name);
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 03/10] net/bnxt: return speed capabilities in device get info
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 01/10] net/bnxt: fix compilation on BSD Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 02/10] net/bnxt: use macro for PCI log format Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 04/10] net/bnxt: fix HWRM command failure during FW reset Ajit Khaparde
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP

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

Added information about supported speeds for the port in the
"dev_infos_get". As other PMDs are returning the speed capabilities,
apps may expect this behavior from bnxt PMD.

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

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d29671d64..3397c0535 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -667,6 +667,40 @@ static int bnxt_shutdown_nic(struct bnxt *bp)
  * Device configuration and status function
  */
 
+static uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
+{
+	uint32_t link_speed = bp->link_info.support_speeds;
+	uint32_t speed_capa = 0;
+
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB)
+		speed_capa |= ETH_LINK_SPEED_100M;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MBHD)
+		speed_capa |= ETH_LINK_SPEED_100M_HD;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GB)
+		speed_capa |= ETH_LINK_SPEED_1G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2_5GB)
+		speed_capa |= ETH_LINK_SPEED_2_5G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB)
+		speed_capa |= ETH_LINK_SPEED_10G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_20GB)
+		speed_capa |= ETH_LINK_SPEED_20G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_25GB)
+		speed_capa |= ETH_LINK_SPEED_25G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_40GB)
+		speed_capa |= ETH_LINK_SPEED_40G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB)
+		speed_capa |= ETH_LINK_SPEED_50G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB)
+		speed_capa |= ETH_LINK_SPEED_100G;
+
+	if (bp->link_info.auto_mode == HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE)
+		speed_capa |= ETH_LINK_SPEED_FIXED;
+	else
+		speed_capa |= ETH_LINK_SPEED_AUTONEG;
+
+	return speed_capa;
+}
+
 static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 				struct rte_eth_dev_info *dev_info)
 {
@@ -710,6 +744,8 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
 	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
+	dev_info->speed_capa = bnxt_get_speed_capabilities(bp);
+
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_thresh = {
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 04/10] net/bnxt: fix HWRM command failure during FW reset
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
                     ` (2 preceding siblings ...)
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 03/10] net/bnxt: return speed capabilities in device get info Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 05/10] net/bnxt: fix to use true/false for bool types Ajit Khaparde
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Lance Richardson, Somnath Kotur

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

FW returns HWRM_ERR_CODE_HOT_RESET_PROGRESS(0xa) when it is
unable to process a specific cmd while hot reset is in progress.
Host driver is expected to keep retrying the cmd for 2s with
a gap of 50ms between each retrial.

Also, fixed to fail port start if the HWRM_FUNC_DRV_IF_CHANGE
still returns error after 2 seconds.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  5 +++++
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++--------
 drivers/net/bnxt/bnxt_hwrm.c   |  4 ++++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index a7a9e4113..d55a57039 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -480,6 +480,11 @@ struct bnxt_error_recovery_info {
 	uint32_t        last_reset_counter;
 };
 
+/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */
+#define BNXT_IF_CHANGE_RETRY_INTERVAL	50
+/* Maximum retry count for FUNC_DRV_IF_CHANGE */
+#define BNXT_IF_CHANGE_RETRY_COUNT	40
+
 struct bnxt_mark_info {
 	uint32_t	mark_id;
 	bool		valid;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3397c0535..b6c713256 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1051,7 +1051,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	int vlan_mask = 0;
-	int rc;
+	int rc, retry_cnt = BNXT_IF_CHANGE_RETRY_COUNT;
 
 	if (!eth_dev->data->nb_tx_queues || !eth_dev->data->nb_rx_queues) {
 		PMD_DRV_LOG(ERR, "Queues are not configured yet!\n");
@@ -1064,14 +1064,23 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	}
 
-	rc = bnxt_hwrm_if_change(bp, 1);
-	if (!rc) {
-		if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
-			rc = bnxt_handle_if_change_status(bp);
-			if (rc)
-				return rc;
-		}
+	do {
+		rc = bnxt_hwrm_if_change(bp, 1);
+		if (rc == 0 || rc != -EAGAIN)
+			break;
+
+		rte_delay_ms(BNXT_IF_CHANGE_RETRY_INTERVAL);
+	} while (retry_cnt--);
+
+	if (rc)
+		return rc;
+
+	if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
+		rc = bnxt_handle_if_change_status(bp);
+		if (rc)
+			return rc;
 	}
+
 	bnxt_enable_int(bp);
 
 	rc = bnxt_init_chip(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4c0fac6be..dc0b40560 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -221,6 +221,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
@@ -249,6 +251,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 05/10] net/bnxt: fix to use true/false for bool types
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
                     ` (3 preceding siblings ...)
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 04/10] net/bnxt: fix HWRM command failure during FW reset Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 06/10] net/bnxt: fix to handle port start failure Ajit Khaparde
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur, Lance Richardson

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

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b6c713256..780d9c46e 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1065,7 +1065,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	}
 
 	do {
-		rc = bnxt_hwrm_if_change(bp, 1);
+		rc = bnxt_hwrm_if_change(bp, true);
 		if (rc == 0 || rc != -EAGAIN)
 			break;
 
@@ -1113,7 +1113,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	return 0;
 
 error:
-	bnxt_hwrm_if_change(bp, 0);
+	bnxt_hwrm_if_change(bp, false);
 	bnxt_shutdown_nic(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
@@ -1190,7 +1190,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	/* Process any remaining notifications in default completion queue */
 	bnxt_int_handler(eth_dev);
 	bnxt_shutdown_nic(bp);
-	bnxt_hwrm_if_change(bp, 0);
+	bnxt_hwrm_if_change(bp, false);
 
 	rte_free(bp->mark_table);
 	bp->mark_table = NULL;
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 06/10] net/bnxt: fix to handle port start failure
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
                     ` (4 preceding siblings ...)
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 05/10] net/bnxt: fix to use true/false for bool types Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 07/10] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

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

Fixed to invoke clean up in the reverse sequence of
initialization in case any of the FW commands fail
during port start.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
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 | 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 780d9c46e..206111db5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1113,10 +1113,10 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	return 0;
 
 error:
-	bnxt_hwrm_if_change(bp, false);
 	bnxt_shutdown_nic(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
+	bnxt_hwrm_if_change(bp, false);
 	eth_dev->data->dev_started = 0;
 	return rc;
 }
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 07/10] net/bnxt: fix vlan add when port is stopped
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
                     ` (5 preceding siblings ...)
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 06/10] net/bnxt: fix to handle port start failure Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure Ajit Khaparde
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Venkat Duvvuru

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

Driver destroys the vnic when the port is brought down.
When user tries to add a vlan when port is stopped, driver
issues HWRM command to FW with invalid vnic_id and it fails.

Fixed to return an error while setting vlan when port is
not started.

Fixes: b4e190d55c25 ("net/bnxt: fix MAC/VLAN filter allocation")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 206111db5..589190b37 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2082,6 +2082,11 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
+	if (!eth_dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be started before setting vlan\n");
+		return -EINVAL;
+	}
+
 	/* These operations apply to ALL existing MAC/VLAN filters */
 	if (on)
 		return bnxt_add_vlan_filter(bp, vlan_id);
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
                     ` (6 preceding siblings ...)
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 07/10] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 21:05     ` Ferruh Yigit
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 09/10] net/bnxt: log firmware status on early init failure Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 10/10] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
  9 siblings, 1 reply; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP

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

Code using this change will be added in next patch.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index da22b6249..fe18686f8 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -38622,4 +38622,53 @@ struct hwrm_cfa_counter_qstats_output {
 	uint8_t	valid;
 } __rte_packed;
 
+/*
+ * This structure is fixed at the beginning of the ChiMP SRAM (GRC
+ * offset: 0x31001F0). Host software is expected to read from this
+ * location for a defined signature. If it exists, the software can
+ * assume the presence of this structure and the validity of the
+ * FW_STATUS location in the next field.
+ */
+/* hcomm_status (size:64b/8B) */
+struct hcomm_status {
+	uint32_t	sig_ver;
+	/*
+	 * This field defines the version of the structure. The latest
+	 * version value is 1.
+	 */
+	#define HCOMM_STATUS_VER_MASK		UINT32_C(0xff)
+	#define HCOMM_STATUS_VER_SFT		0
+	#define HCOMM_STATUS_VER_LATEST		UINT32_C(0x1)
+	#define HCOMM_STATUS_VER_LAST		HCOMM_STATUS_VER_LATEST
+	/*
+	 * This field is to store the signature value to indicate the
+	 * presence of the structure.
+	 */
+	#define HCOMM_STATUS_SIGNATURE_MASK	UINT32_C(0xffffff00)
+	#define HCOMM_STATUS_SIGNATURE_SFT	8
+	#define HCOMM_STATUS_SIGNATURE_VAL	(UINT32_C(0x484353) << 8)
+	#define HCOMM_STATUS_SIGNATURE_LAST	HCOMM_STATUS_SIGNATURE_VAL
+	uint32_t	fw_status_loc;
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK	UINT32_C(0x3)
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT	0
+	/* PCIE configuration space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG	UINT32_C(0x0)
+	/* GRC space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC	UINT32_C(0x1)
+	/* BAR0 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0	UINT32_C(0x2)
+	/* BAR1 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1	UINT32_C(0x3)
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST	\
+		HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
+	/*
+	 * This offset where the fw_status register is located. The value
+	 * is generally 4-byte aligned.
+	 */
+	#define HCOMM_STATUS_TRUE_OFFSET_MASK		UINT32_C(0xfffffffc)
+	#define HCOMM_STATUS_TRUE_OFFSET_SFT		2
+} __attribute__((packed));
+/* This is the GRC offset where the hcomm_status struct resides. */
+#define HCOMM_STATUS_STRUCT_LOC		0x31001F0UL
+
 #endif /* _HSI_STRUCT_DEF_DPDK_H_ */
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 09/10] net/bnxt: log firmware status on early init failure
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
                     ` (7 preceding siblings ...)
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 10/10] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP

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

Firmware reports any fatal error (either ASIC or Firmware related)
via a new status register. This status register can provide more detailed
information about the firmware errors, especially if error occurs
before HWRM_VER_GET is issued. Attempt to map this register if it is
present and check for firmware status when VER_GET command fails.

Refactored the code to allocate the "bp->recovery_info" structure
in bnxt_init_fw() instead of doing in bnxt_hwrm_error_recovery_qcfg().

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |   5 ++
 drivers/net/bnxt/bnxt_ethdev.c | 107 +++++++++++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.c   |  10 ---
 3 files changed, 106 insertions(+), 16 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index d55a57039..586d3f534 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -507,6 +507,10 @@ struct bnxt_mark_info {
 #define BNXT_GRCP_WINDOW_2_BASE		0x2000
 #define BNXT_GRCP_WINDOW_3_BASE		0x3000
 
+#define BNXT_GRCP_BASE_MASK		0xfffff000
+#define BNXT_GRCP_OFFSET_MASK		0x00000ffc
+
+#define BNXT_FW_STATUS_HEALTHY		0x8000
 #define BNXT_FW_STATUS_SHUTDOWN		0x100000
 
 #define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
@@ -564,6 +568,7 @@ struct bnxt {
 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD	BIT(3)
 #define BNXT_FW_CAP_ADV_FLOW_MGMT	BIT(5)
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
+#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(7)
 
 	uint32_t		flow_flags;
 #define BNXT_FLOW_FLAG_L2_HDR_SRC_FILTER_EN	BIT(0)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 589190b37..1a3c7e609 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -155,6 +155,7 @@ static int bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev);
 static void bnxt_cancel_fw_health_check(struct bnxt *bp);
 static int bnxt_restore_vlan_filters(struct bnxt *bp);
 static void bnxt_dev_recover(void *arg);
+static void bnxt_free_error_recovery_info(struct bnxt *bp);
 
 int is_bnxt_in_error(struct bnxt *bp)
 {
@@ -4967,6 +4968,89 @@ bnxt_get_fw_func_id(uint16_t port)
 	return bp->fw_fid;
 }
 
+static void bnxt_alloc_error_recovery_info(struct bnxt *bp)
+{
+	struct bnxt_error_recovery_info *info = bp->recovery_info;
+
+	if (info) {
+		if (!(bp->fw_cap & BNXT_FW_CAP_HCOMM_FW_STATUS))
+			memset(info, 0, sizeof(*info));
+		return;
+	}
+
+	if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
+		return;
+
+	info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
+			   sizeof(*info), 0);
+	if (!info)
+		bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
+
+	bp->recovery_info = info;
+}
+
+static void bnxt_check_fw_status(struct bnxt *bp)
+{
+	uint32_t fw_status;
+
+	if (!(bp->recovery_info &&
+	      (bp->fw_cap & BNXT_FW_CAP_HCOMM_FW_STATUS)))
+		return;
+
+	fw_status = bnxt_read_fw_status_reg(bp, BNXT_FW_STATUS_REG);
+	if (fw_status != BNXT_FW_STATUS_HEALTHY)
+		PMD_DRV_LOG(ERR, "Firmware not responding, status: %#x\n",
+			    fw_status);
+}
+
+static int bnxt_map_hcomm_fw_status_reg(struct bnxt *bp)
+{
+	struct bnxt_error_recovery_info *info = bp->recovery_info;
+	uint32_t status_loc;
+	uint32_t sig_ver;
+
+	rte_write32(HCOMM_STATUS_STRUCT_LOC, (uint8_t *)bp->bar0 +
+		    BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
+	sig_ver = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+				   BNXT_GRCP_WINDOW_2_BASE +
+				   offsetof(struct hcomm_status,
+					    sig_ver)));
+	/* If the signature is absent, then FW does not support this feature */
+	if ((sig_ver & HCOMM_STATUS_SIGNATURE_MASK) !=
+	    HCOMM_STATUS_SIGNATURE_VAL)
+		return 0;
+
+	if (!info) {
+		info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
+				   sizeof(*info), 0);
+		if (!info)
+			return -ENOMEM;
+		bp->recovery_info = info;
+	} else {
+		memset(info, 0, sizeof(*info));
+	}
+
+	status_loc = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+				      BNXT_GRCP_WINDOW_2_BASE +
+				      offsetof(struct hcomm_status,
+					       fw_status_loc)));
+
+	/* Only pre-map the FW health status GRC register */
+	if (BNXT_FW_STATUS_REG_TYPE(status_loc) != BNXT_FW_STATUS_REG_TYPE_GRC)
+		return 0;
+
+	info->status_regs[BNXT_FW_STATUS_REG] = status_loc;
+	info->mapped_status_regs[BNXT_FW_STATUS_REG] =
+		BNXT_GRCP_WINDOW_2_BASE + (status_loc & BNXT_GRCP_OFFSET_MASK);
+
+	rte_write32((status_loc & BNXT_GRCP_BASE_MASK), (uint8_t *)bp->bar0 +
+		    BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
+
+	bp->fw_cap |= BNXT_FW_CAP_HCOMM_FW_STATUS;
+
+	return 0;
+}
+
 static int bnxt_init_fw(struct bnxt *bp)
 {
 	uint16_t mtu;
@@ -4974,10 +5058,16 @@ static int bnxt_init_fw(struct bnxt *bp)
 
 	bp->fw_cap = 0;
 
-	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	rc = bnxt_map_hcomm_fw_status_reg(bp);
 	if (rc)
 		return rc;
 
+	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	if (rc) {
+		bnxt_check_fw_status(bp);
+		return rc;
+	}
+
 	rc = bnxt_hwrm_func_reset(bp);
 	if (rc)
 		return -EIO;
@@ -5008,6 +5098,7 @@ static int bnxt_init_fw(struct bnxt *bp)
 	if (rc)
 		return rc;
 
+	bnxt_alloc_error_recovery_info(bp);
 	/* Get the adapter error recovery support info */
 	rc = bnxt_hwrm_error_recovery_qcfg(bp);
 	if (rc)
@@ -5343,6 +5434,14 @@ static void bnxt_uninit_ctx_mem(struct bnxt *bp)
 	bnxt_uninit_fc_ctx_mem(bp);
 }
 
+static void
+bnxt_free_error_recovery_info(struct bnxt *bp)
+{
+	rte_free(bp->recovery_info);
+	bp->recovery_info = NULL;
+	bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
+}
+
 static void
 bnxt_uninit_locks(struct bnxt *bp)
 {
@@ -5363,11 +5462,7 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 	bnxt_free_ctx_mem(bp);
 	if (!reconfig_dev) {
 		bnxt_free_hwrm_resources(bp);
-
-		if (bp->recovery_info != NULL) {
-			rte_free(bp->recovery_info);
-			bp->recovery_info = NULL;
-		}
+		bnxt_free_error_recovery_info(bp);
 	}
 
 	bnxt_uninit_ctx_mem(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index dc0b40560..666056ac1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -5076,16 +5076,6 @@ int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp)
 	if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
 		return 0;
 
-	if (!info) {
-		info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
-				   sizeof(*info), 0);
-		bp->recovery_info = info;
-		if (info == NULL)
-			return -ENOMEM;
-	} else {
-		memset(info, 0, sizeof(*info));
-	}
-
 	HWRM_PREP(&req, HWRM_ERROR_RECOVERY_QCFG, BNXT_USE_CHIMP_MB);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v2 10/10] net/bnxt: fix to not issue port MAC query on a VF
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
                     ` (8 preceding siblings ...)
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 09/10] net/bnxt: log firmware status on early init failure Ajit Khaparde
@ 2020-04-21 20:07   ` Ajit Khaparde
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 20:07 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, Somnath Kotur

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

HWRM_PORT_MAC_QCFG is not supported on a VF. Added a PF check
in bnxt_hwrm_port_mac_qcfg() to prevent the probe failure on a VF.

Fixes: 184e3d13d88a ("net/bnxt: fetch SVIF information from firmware")

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

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 666056ac1..ebf73e44c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3094,6 +3094,9 @@ int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp)
 
 	bp->port_svif = BNXT_SVIF_INVALID;
 
+	if (!BNXT_PF(bp))
+		return 0;
+
 	HWRM_PREP(&req, HWRM_PORT_MAC_QCFG, BNXT_USE_CHIMP_MB);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
-- 
2.21.1 (Apple Git-122.3)


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

* Re: [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure
  2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure Ajit Khaparde
@ 2020-04-21 21:05     ` Ferruh Yigit
  2020-04-21 21:21       ` Ajit Khaparde
  0 siblings, 1 reply; 34+ messages in thread
From: Ferruh Yigit @ 2020-04-21 21:05 UTC (permalink / raw)
  To: Ajit Khaparde, dev; +Cc: Kalesh AP

On 4/21/2020 9:07 PM, Ajit Khaparde wrote:
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> 
> Code using this change will be added in next patch.

It can be better to merge this patch to next one, where it uses this new struct.

> 
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> ---
>  drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> index da22b6249..fe18686f8 100644
> --- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
> +++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> @@ -38622,4 +38622,53 @@ struct hwrm_cfa_counter_qstats_output {
>  	uint8_t	valid;
>  } __rte_packed;
>  
> +/*
> + * This structure is fixed at the beginning of the ChiMP SRAM (GRC
> + * offset: 0x31001F0). Host software is expected to read from this
> + * location for a defined signature. If it exists, the software can
> + * assume the presence of this structure and the validity of the
> + * FW_STATUS location in the next field.
> + */
> +/* hcomm_status (size:64b/8B) */
> +struct hcomm_status {
> +	uint32_t	sig_ver;
> +	/*
> +	 * This field defines the version of the structure. The latest
> +	 * version value is 1.
> +	 */
> +	#define HCOMM_STATUS_VER_MASK		UINT32_C(0xff)
> +	#define HCOMM_STATUS_VER_SFT		0
> +	#define HCOMM_STATUS_VER_LATEST		UINT32_C(0x1)
> +	#define HCOMM_STATUS_VER_LAST		HCOMM_STATUS_VER_LATEST
> +	/*
> +	 * This field is to store the signature value to indicate the
> +	 * presence of the structure.
> +	 */
> +	#define HCOMM_STATUS_SIGNATURE_MASK	UINT32_C(0xffffff00)
> +	#define HCOMM_STATUS_SIGNATURE_SFT	8
> +	#define HCOMM_STATUS_SIGNATURE_VAL	(UINT32_C(0x484353) << 8)
> +	#define HCOMM_STATUS_SIGNATURE_LAST	HCOMM_STATUS_SIGNATURE_VAL
> +	uint32_t	fw_status_loc;
> +	#define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK	UINT32_C(0x3)
> +	#define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT	0
> +	/* PCIE configuration space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG	UINT32_C(0x0)
> +	/* GRC space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC	UINT32_C(0x1)
> +	/* BAR0 space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0	UINT32_C(0x2)
> +	/* BAR1 space */
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1	UINT32_C(0x3)
> +	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST	\
> +		HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
> +	/*
> +	 * This offset where the fw_status register is located. The value
> +	 * is generally 4-byte aligned.
> +	 */
> +	#define HCOMM_STATUS_TRUE_OFFSET_MASK		UINT32_C(0xfffffffc)
> +	#define HCOMM_STATUS_TRUE_OFFSET_SFT		2
> +} __attribute__((packed));

Can you please prefer '__rte_packed' instead of the '__attribute__((packed))'?
If you recognized I have updated all the occurrences in next-net already while
rebasing on top of main repo. But please send new patches according it.

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

* Re: [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure
  2020-04-21 21:05     ` Ferruh Yigit
@ 2020-04-21 21:21       ` Ajit Khaparde
  0 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:21 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dpdk-dev, Kalesh AP

On Tue, Apr 21, 2020 at 2:05 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:

> On 4/21/2020 9:07 PM, Ajit Khaparde wrote:
> > From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> >
> > Code using this change will be added in next patch.
>
> It can be better to merge this patch to next one, where it uses this new
> struct.
>
> >
> > Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> > Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> > ---
> >  drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
> >  1 file changed, 49 insertions(+)
> >
> > diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h
> b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> > index da22b6249..fe18686f8 100644
> > --- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
> > +++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
> > @@ -38622,4 +38622,53 @@ struct hwrm_cfa_counter_qstats_output {
> >       uint8_t valid;
> >  } __rte_packed;
> >
> > +/*
> > + * This structure is fixed at the beginning of the ChiMP SRAM (GRC
> > + * offset: 0x31001F0). Host software is expected to read from this
> > + * location for a defined signature. If it exists, the software can
> > + * assume the presence of this structure and the validity of the
> > + * FW_STATUS location in the next field.
> > + */
> > +/* hcomm_status (size:64b/8B) */
> > +struct hcomm_status {
> > +     uint32_t        sig_ver;
> > +     /*
> > +      * This field defines the version of the structure. The latest
> > +      * version value is 1.
> > +      */
> > +     #define HCOMM_STATUS_VER_MASK           UINT32_C(0xff)
> > +     #define HCOMM_STATUS_VER_SFT            0
> > +     #define HCOMM_STATUS_VER_LATEST         UINT32_C(0x1)
> > +     #define HCOMM_STATUS_VER_LAST           HCOMM_STATUS_VER_LATEST
> > +     /*
> > +      * This field is to store the signature value to indicate the
> > +      * presence of the structure.
> > +      */
> > +     #define HCOMM_STATUS_SIGNATURE_MASK     UINT32_C(0xffffff00)
> > +     #define HCOMM_STATUS_SIGNATURE_SFT      8
> > +     #define HCOMM_STATUS_SIGNATURE_VAL      (UINT32_C(0x484353) << 8)
> > +     #define HCOMM_STATUS_SIGNATURE_LAST     HCOMM_STATUS_SIGNATURE_VAL
> > +     uint32_t        fw_status_loc;
> > +     #define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK       UINT32_C(0x3)
> > +     #define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT        0
> > +     /* PCIE configuration space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG
> UINT32_C(0x0)
> > +     /* GRC space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC
>  UINT32_C(0x1)
> > +     /* BAR0 space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0
> UINT32_C(0x2)
> > +     /* BAR1 space */
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
> UINT32_C(0x3)
> > +     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST      \
> > +             HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
> > +     /*
> > +      * This offset where the fw_status register is located. The value
> > +      * is generally 4-byte aligned.
> > +      */
> > +     #define HCOMM_STATUS_TRUE_OFFSET_MASK
>  UINT32_C(0xfffffffc)
> > +     #define HCOMM_STATUS_TRUE_OFFSET_SFT            2
> > +} __attribute__((packed));
>
> Can you please prefer '__rte_packed' instead of the
> '__attribute__((packed))'?
> If you recognized I have updated all the occurrences in next-net already
> while
> rebasing on top of main repo. But please send new patches according it.
>
Sure, can do that. Thanks

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

* [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes
  2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
                   ` (9 preceding siblings ...)
  2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
@ 2020-04-21 21:33 ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 1/9] net/bnxt: fix compilation on BSD Ajit Khaparde
                     ` (9 more replies)
  10 siblings, 10 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev

Patches with bug fixes.

v1->v2:
 - Fix compilation on BSD.
 - Fix commit logs for some of the patches.

v2->v3:
 - Squashed patches 8,9 into a single patch.

Ajit Khaparde (1):
  net/bnxt: fix compilation on BSD

Kalesh AP (8):
  net/bnxt: use macro for PCI log format
  net/bnxt: return speed capabilities in device get info
  net/bnxt: fix HWRM command failure during FW reset
  net/bnxt: fix to use true/false for bool types
  net/bnxt: fix to handle port start failure
  net/bnxt: fix vlan add when port is stopped
  net/bnxt: log firmware status on early init failure
  net/bnxt: fix to not issue port MAC query on a VF

 drivers/net/bnxt/bnxt.h                |  10 ++
 drivers/net/bnxt/bnxt_ethdev.c         | 177 ++++++++++++++++++++++---
 drivers/net/bnxt/bnxt_hwrm.c           |  23 ++--
 drivers/net/bnxt/bnxt_ring.c           |   2 +-
 drivers/net/bnxt/bnxt_vnic.c           |   2 +-
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  49 +++++++
 drivers/net/bnxt/tf_core/stack.c       |   2 +-
 7 files changed, 233 insertions(+), 32 deletions(-)

-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 1/9] net/bnxt: fix compilation on BSD
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 2/9] net/bnxt: use macro for PCI log format Ajit Khaparde
                     ` (8 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kishore Padmanabha, Lance Richardson

There is no ENODATA in the errno.h in BSD.
Use a common errno to return error.

Fixes: cef1ca505d7f ("net/bnxt: support EM/EEM")
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
---
 drivers/net/bnxt/tf_core/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/stack.c b/drivers/net/bnxt/tf_core/stack.c
index 3337073b7..9cfbd244f 100644
--- a/drivers/net/bnxt/tf_core/stack.c
+++ b/drivers/net/bnxt/tf_core/stack.c
@@ -73,7 +73,7 @@ int
 stack_pop(struct stack *st, uint32_t *x)
 {
 	if (stack_is_empty(st))
-		return -ENODATA;
+		return -ENOENT;
 
 	*x = st->items[st->top];
 	st->top--;
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 2/9] net/bnxt: use macro for PCI log format
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 1/9] net/bnxt: fix compilation on BSD Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 3/9] net/bnxt: return speed capabilities in device get info Ajit Khaparde
                     ` (7 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP

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

Use PCI_PRI_FMT instead of "%04x:%02x:%02x:%02x" print format.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_hwrm.c | 6 +++---
 drivers/net/bnxt/bnxt_ring.c | 2 +-
 drivers/net/bnxt/bnxt_vnic.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 09a73286b..4c0fac6be 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -1104,7 +1104,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 	dev_caps_cfg = rte_le_to_cpu_32(resp->dev_caps_cfg);
 
 	if (bp->max_resp_len != max_resp_len) {
-		sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x",
+		sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT,
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
 			bp->pdev->addr.devid, bp->pdev->addr.function);
 
@@ -1139,7 +1139,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp, uint32_t timeout)
 	     (dev_caps_cfg &
 	      HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED)) ||
 	    bp->hwrm_max_ext_req_len > HWRM_MAX_REQ_LEN) {
-		sprintf(type, "bnxt_hwrm_short_%04x:%02x:%02x:%02x",
+		sprintf(type, "bnxt_hwrm_short_" PCI_PRI_FMT,
 			bp->pdev->addr.domain, bp->pdev->addr.bus,
 			bp->pdev->addr.devid, bp->pdev->addr.function);
 
@@ -2574,7 +2574,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)
 	struct rte_pci_device *pdev = bp->pdev;
 	char type[RTE_MEMZONE_NAMESIZE];
 
-	sprintf(type, "bnxt_hwrm_%04x:%02x:%02x:%02x", pdev->addr.domain,
+	sprintf(type, "bnxt_hwrm_" PCI_PRI_FMT, pdev->addr.domain,
 		pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
 	bp->max_resp_len = HWRM_MAX_RESP_LEN;
 	bp->hwrm_cmd_resp_addr = rte_malloc(type, bp->max_resp_len, 0);
diff --git a/drivers/net/bnxt/bnxt_ring.c b/drivers/net/bnxt/bnxt_ring.c
index 1999cd786..24a947f27 100644
--- a/drivers/net/bnxt/bnxt_ring.c
+++ b/drivers/net/bnxt/bnxt_ring.c
@@ -196,7 +196,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
 	total_alloc_len += tpa_info_len;
 
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
-		 "bnxt_%04x:%02x:%02x:%02x-%04x_%s", pdev->addr.domain,
+		 "bnxt_" PCI_PRI_FMT "-%04x_%s", pdev->addr.domain,
 		 pdev->addr.bus, pdev->addr.devid, pdev->addr.function, qidx,
 		 suffix);
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c
index bc054a8e0..326c0d1b6 100644
--- a/drivers/net/bnxt/bnxt_vnic.c
+++ b/drivers/net/bnxt/bnxt_vnic.c
@@ -136,7 +136,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)
 
 	max_vnics = bp->max_vnics;
 	snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
-		 "bnxt_%04x:%02x:%02x:%02x_vnicattr", pdev->addr.domain,
+		 "bnxt_" PCI_PRI_FMT "_vnicattr", pdev->addr.domain,
 		 pdev->addr.bus, pdev->addr.devid, pdev->addr.function);
 	mz_name[RTE_MEMZONE_NAMESIZE - 1] = 0;
 	mz = rte_memzone_lookup(mz_name);
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 3/9] net/bnxt: return speed capabilities in device get info
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 1/9] net/bnxt: fix compilation on BSD Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 2/9] net/bnxt: use macro for PCI log format Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 4/9] net/bnxt: fix HWRM command failure during FW reset Ajit Khaparde
                     ` (6 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP

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

Added information about supported speeds for the port in the
"dev_infos_get". As other PMDs are returning the speed capabilities,
apps may expect this behavior from bnxt PMD.

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

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d29671d64..3397c0535 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -667,6 +667,40 @@ static int bnxt_shutdown_nic(struct bnxt *bp)
  * Device configuration and status function
  */
 
+static uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
+{
+	uint32_t link_speed = bp->link_info.support_speeds;
+	uint32_t speed_capa = 0;
+
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_LINK_SPEED_100MB)
+		speed_capa |= ETH_LINK_SPEED_100M;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100MBHD)
+		speed_capa |= ETH_LINK_SPEED_100M_HD;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_1GB)
+		speed_capa |= ETH_LINK_SPEED_1G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_2_5GB)
+		speed_capa |= ETH_LINK_SPEED_2_5G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_10GB)
+		speed_capa |= ETH_LINK_SPEED_10G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_20GB)
+		speed_capa |= ETH_LINK_SPEED_20G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_25GB)
+		speed_capa |= ETH_LINK_SPEED_25G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_40GB)
+		speed_capa |= ETH_LINK_SPEED_40G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_50GB)
+		speed_capa |= ETH_LINK_SPEED_50G;
+	if (link_speed & HWRM_PORT_PHY_QCFG_OUTPUT_SUPPORT_SPEEDS_100GB)
+		speed_capa |= ETH_LINK_SPEED_100G;
+
+	if (bp->link_info.auto_mode == HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE)
+		speed_capa |= ETH_LINK_SPEED_FIXED;
+	else
+		speed_capa |= ETH_LINK_SPEED_AUTONEG;
+
+	return speed_capa;
+}
+
 static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 				struct rte_eth_dev_info *dev_info)
 {
@@ -710,6 +744,8 @@ static int bnxt_dev_info_get_op(struct rte_eth_dev *eth_dev,
 	dev_info->tx_offload_capa = BNXT_DEV_TX_OFFLOAD_SUPPORT;
 	dev_info->flow_type_rss_offloads = BNXT_ETH_RSS_SUPPORT;
 
+	dev_info->speed_capa = bnxt_get_speed_capabilities(bp);
+
 	/* *INDENT-OFF* */
 	dev_info->default_rxconf = (struct rte_eth_rxconf) {
 		.rx_thresh = {
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 4/9] net/bnxt: fix HWRM command failure during FW reset
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
                     ` (2 preceding siblings ...)
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 3/9] net/bnxt: return speed capabilities in device get info Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 5/9] net/bnxt: fix to use true/false for bool types Ajit Khaparde
                     ` (5 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Lance Richardson, Somnath Kotur

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

FW returns HWRM_ERR_CODE_HOT_RESET_PROGRESS(0xa) when it is
unable to process a specific cmd while hot reset is in progress.
Host driver is expected to keep retrying the cmd for 2s with
a gap of 50ms between each retrial.

Also, fixed to fail port start if the HWRM_FUNC_DRV_IF_CHANGE
still returns error after 2 seconds.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h        |  5 +++++
 drivers/net/bnxt/bnxt_ethdev.c | 25 +++++++++++++++++--------
 drivers/net/bnxt/bnxt_hwrm.c   |  4 ++++
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index a7a9e4113..d55a57039 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -480,6 +480,11 @@ struct bnxt_error_recovery_info {
 	uint32_t        last_reset_counter;
 };
 
+/* Frequency for the FUNC_DRV_IF_CHANGE retry in milliseconds */
+#define BNXT_IF_CHANGE_RETRY_INTERVAL	50
+/* Maximum retry count for FUNC_DRV_IF_CHANGE */
+#define BNXT_IF_CHANGE_RETRY_COUNT	40
+
 struct bnxt_mark_info {
 	uint32_t	mark_id;
 	bool		valid;
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 3397c0535..b6c713256 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1051,7 +1051,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	struct bnxt *bp = eth_dev->data->dev_private;
 	uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads;
 	int vlan_mask = 0;
-	int rc;
+	int rc, retry_cnt = BNXT_IF_CHANGE_RETRY_COUNT;
 
 	if (!eth_dev->data->nb_tx_queues || !eth_dev->data->nb_rx_queues) {
 		PMD_DRV_LOG(ERR, "Queues are not configured yet!\n");
@@ -1064,14 +1064,23 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 			bp->rx_cp_nr_rings, RTE_ETHDEV_QUEUE_STAT_CNTRS);
 	}
 
-	rc = bnxt_hwrm_if_change(bp, 1);
-	if (!rc) {
-		if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
-			rc = bnxt_handle_if_change_status(bp);
-			if (rc)
-				return rc;
-		}
+	do {
+		rc = bnxt_hwrm_if_change(bp, 1);
+		if (rc == 0 || rc != -EAGAIN)
+			break;
+
+		rte_delay_ms(BNXT_IF_CHANGE_RETRY_INTERVAL);
+	} while (retry_cnt--);
+
+	if (rc)
+		return rc;
+
+	if (bp->flags & BNXT_FLAG_IF_CHANGE_HOT_FW_RESET_DONE) {
+		rc = bnxt_handle_if_change_status(bp);
+		if (rc)
+			return rc;
 	}
+
 	bnxt_enable_int(bp);
 
 	rc = bnxt_init_chip(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 4c0fac6be..dc0b40560 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -221,6 +221,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
@@ -249,6 +251,8 @@ static int bnxt_hwrm_send_message(struct bnxt *bp, void *msg,
 			rc = -EINVAL; \
 		else if (rc == HWRM_ERR_CODE_CMD_NOT_SUPPORTED) \
 			rc = -ENOTSUP; \
+		else if (rc == HWRM_ERR_CODE_HOT_RESET_PROGRESS) \
+			rc = -EAGAIN; \
 		else if (rc > 0) \
 			rc = -EIO; \
 		return rc; \
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 5/9] net/bnxt: fix to use true/false for bool types
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
                     ` (3 preceding siblings ...)
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 4/9] net/bnxt: fix HWRM command failure during FW reset Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 6/9] net/bnxt: fix to handle port start failure Ajit Khaparde
                     ` (4 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur, Lance Richardson

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

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b6c713256..780d9c46e 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1065,7 +1065,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	}
 
 	do {
-		rc = bnxt_hwrm_if_change(bp, 1);
+		rc = bnxt_hwrm_if_change(bp, true);
 		if (rc == 0 || rc != -EAGAIN)
 			break;
 
@@ -1113,7 +1113,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	return 0;
 
 error:
-	bnxt_hwrm_if_change(bp, 0);
+	bnxt_hwrm_if_change(bp, false);
 	bnxt_shutdown_nic(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
@@ -1190,7 +1190,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	/* Process any remaining notifications in default completion queue */
 	bnxt_int_handler(eth_dev);
 	bnxt_shutdown_nic(bp);
-	bnxt_hwrm_if_change(bp, 0);
+	bnxt_hwrm_if_change(bp, false);
 
 	rte_free(bp->mark_table);
 	bp->mark_table = NULL;
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 6/9] net/bnxt: fix to handle port start failure
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
                     ` (4 preceding siblings ...)
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 5/9] net/bnxt: fix to use true/false for bool types Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 7/9] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
                     ` (3 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Somnath Kotur

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

Fixed to invoke clean up in the reverse sequence of
initialization in case any of the FW commands fail
during port start.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
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 | 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 780d9c46e..206111db5 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1113,10 +1113,10 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
 	return 0;
 
 error:
-	bnxt_hwrm_if_change(bp, false);
 	bnxt_shutdown_nic(bp);
 	bnxt_free_tx_mbufs(bp);
 	bnxt_free_rx_mbufs(bp);
+	bnxt_hwrm_if_change(bp, false);
 	eth_dev->data->dev_started = 0;
 	return rc;
 }
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 7/9] net/bnxt: fix vlan add when port is stopped
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
                     ` (5 preceding siblings ...)
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 6/9] net/bnxt: fix to handle port start failure Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 8/9] net/bnxt: log firmware status on early init failure Ajit Khaparde
                     ` (2 subsequent siblings)
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, stable, Venkat Duvvuru

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

Driver destroys the vnic when the port is brought down.
When user tries to add a vlan when port is stopped, driver
issues HWRM command to FW with invalid vnic_id and it fails.

Fixed to return an error while setting vlan when port is
not started.

Fixes: b4e190d55c25 ("net/bnxt: fix MAC/VLAN filter allocation")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 206111db5..589190b37 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -2082,6 +2082,11 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
 	if (rc)
 		return rc;
 
+	if (!eth_dev->data->dev_started) {
+		PMD_DRV_LOG(ERR, "port must be started before setting vlan\n");
+		return -EINVAL;
+	}
+
 	/* These operations apply to ALL existing MAC/VLAN filters */
 	if (on)
 		return bnxt_add_vlan_filter(bp, vlan_id);
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 8/9] net/bnxt: log firmware status on early init failure
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
                     ` (6 preceding siblings ...)
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 7/9] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 9/9] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
  2020-04-22 11:44   ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ferruh Yigit
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP

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

Firmware reports any fatal error (either ASIC or Firmware related)
via a new status register. This status register can provide more detailed
information about the firmware errors, especially if error occurs
before HWRM_VER_GET is issued. Attempt to map this register if it is
present and check for firmware status when VER_GET command fails.

Refactored the code to allocate the "bp->recovery_info" structure
in bnxt_init_fw() instead of doing in bnxt_hwrm_error_recovery_qcfg().

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt.h                |   5 ++
 drivers/net/bnxt/bnxt_ethdev.c         | 107 +++++++++++++++++++++++--
 drivers/net/bnxt/bnxt_hwrm.c           |  10 ---
 drivers/net/bnxt/hsi_struct_def_dpdk.h |  49 +++++++++++
 4 files changed, 155 insertions(+), 16 deletions(-)

diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h
index d55a57039..586d3f534 100644
--- a/drivers/net/bnxt/bnxt.h
+++ b/drivers/net/bnxt/bnxt.h
@@ -507,6 +507,10 @@ struct bnxt_mark_info {
 #define BNXT_GRCP_WINDOW_2_BASE		0x2000
 #define BNXT_GRCP_WINDOW_3_BASE		0x3000
 
+#define BNXT_GRCP_BASE_MASK		0xfffff000
+#define BNXT_GRCP_OFFSET_MASK		0x00000ffc
+
+#define BNXT_FW_STATUS_HEALTHY		0x8000
 #define BNXT_FW_STATUS_SHUTDOWN		0x100000
 
 #define BNXT_HWRM_SHORT_REQ_LEN		sizeof(struct hwrm_short_input)
@@ -564,6 +568,7 @@ struct bnxt {
 #define BNXT_FW_CAP_ERR_RECOVER_RELOAD	BIT(3)
 #define BNXT_FW_CAP_ADV_FLOW_MGMT	BIT(5)
 #define BNXT_FW_CAP_ADV_FLOW_COUNTERS	BIT(6)
+#define BNXT_FW_CAP_HCOMM_FW_STATUS	BIT(7)
 
 	uint32_t		flow_flags;
 #define BNXT_FLOW_FLAG_L2_HDR_SRC_FILTER_EN	BIT(0)
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index 589190b37..1a3c7e609 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -155,6 +155,7 @@ static int bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev);
 static void bnxt_cancel_fw_health_check(struct bnxt *bp);
 static int bnxt_restore_vlan_filters(struct bnxt *bp);
 static void bnxt_dev_recover(void *arg);
+static void bnxt_free_error_recovery_info(struct bnxt *bp);
 
 int is_bnxt_in_error(struct bnxt *bp)
 {
@@ -4967,6 +4968,89 @@ bnxt_get_fw_func_id(uint16_t port)
 	return bp->fw_fid;
 }
 
+static void bnxt_alloc_error_recovery_info(struct bnxt *bp)
+{
+	struct bnxt_error_recovery_info *info = bp->recovery_info;
+
+	if (info) {
+		if (!(bp->fw_cap & BNXT_FW_CAP_HCOMM_FW_STATUS))
+			memset(info, 0, sizeof(*info));
+		return;
+	}
+
+	if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
+		return;
+
+	info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
+			   sizeof(*info), 0);
+	if (!info)
+		bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
+
+	bp->recovery_info = info;
+}
+
+static void bnxt_check_fw_status(struct bnxt *bp)
+{
+	uint32_t fw_status;
+
+	if (!(bp->recovery_info &&
+	      (bp->fw_cap & BNXT_FW_CAP_HCOMM_FW_STATUS)))
+		return;
+
+	fw_status = bnxt_read_fw_status_reg(bp, BNXT_FW_STATUS_REG);
+	if (fw_status != BNXT_FW_STATUS_HEALTHY)
+		PMD_DRV_LOG(ERR, "Firmware not responding, status: %#x\n",
+			    fw_status);
+}
+
+static int bnxt_map_hcomm_fw_status_reg(struct bnxt *bp)
+{
+	struct bnxt_error_recovery_info *info = bp->recovery_info;
+	uint32_t status_loc;
+	uint32_t sig_ver;
+
+	rte_write32(HCOMM_STATUS_STRUCT_LOC, (uint8_t *)bp->bar0 +
+		    BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
+	sig_ver = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+				   BNXT_GRCP_WINDOW_2_BASE +
+				   offsetof(struct hcomm_status,
+					    sig_ver)));
+	/* If the signature is absent, then FW does not support this feature */
+	if ((sig_ver & HCOMM_STATUS_SIGNATURE_MASK) !=
+	    HCOMM_STATUS_SIGNATURE_VAL)
+		return 0;
+
+	if (!info) {
+		info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
+				   sizeof(*info), 0);
+		if (!info)
+			return -ENOMEM;
+		bp->recovery_info = info;
+	} else {
+		memset(info, 0, sizeof(*info));
+	}
+
+	status_loc = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+				      BNXT_GRCP_WINDOW_2_BASE +
+				      offsetof(struct hcomm_status,
+					       fw_status_loc)));
+
+	/* Only pre-map the FW health status GRC register */
+	if (BNXT_FW_STATUS_REG_TYPE(status_loc) != BNXT_FW_STATUS_REG_TYPE_GRC)
+		return 0;
+
+	info->status_regs[BNXT_FW_STATUS_REG] = status_loc;
+	info->mapped_status_regs[BNXT_FW_STATUS_REG] =
+		BNXT_GRCP_WINDOW_2_BASE + (status_loc & BNXT_GRCP_OFFSET_MASK);
+
+	rte_write32((status_loc & BNXT_GRCP_BASE_MASK), (uint8_t *)bp->bar0 +
+		    BNXT_GRCPF_REG_WINDOW_BASE_OUT + 4);
+
+	bp->fw_cap |= BNXT_FW_CAP_HCOMM_FW_STATUS;
+
+	return 0;
+}
+
 static int bnxt_init_fw(struct bnxt *bp)
 {
 	uint16_t mtu;
@@ -4974,10 +5058,16 @@ static int bnxt_init_fw(struct bnxt *bp)
 
 	bp->fw_cap = 0;
 
-	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	rc = bnxt_map_hcomm_fw_status_reg(bp);
 	if (rc)
 		return rc;
 
+	rc = bnxt_hwrm_ver_get(bp, DFLT_HWRM_CMD_TIMEOUT);
+	if (rc) {
+		bnxt_check_fw_status(bp);
+		return rc;
+	}
+
 	rc = bnxt_hwrm_func_reset(bp);
 	if (rc)
 		return -EIO;
@@ -5008,6 +5098,7 @@ static int bnxt_init_fw(struct bnxt *bp)
 	if (rc)
 		return rc;
 
+	bnxt_alloc_error_recovery_info(bp);
 	/* Get the adapter error recovery support info */
 	rc = bnxt_hwrm_error_recovery_qcfg(bp);
 	if (rc)
@@ -5343,6 +5434,14 @@ static void bnxt_uninit_ctx_mem(struct bnxt *bp)
 	bnxt_uninit_fc_ctx_mem(bp);
 }
 
+static void
+bnxt_free_error_recovery_info(struct bnxt *bp)
+{
+	rte_free(bp->recovery_info);
+	bp->recovery_info = NULL;
+	bp->fw_cap &= ~BNXT_FW_CAP_ERROR_RECOVERY;
+}
+
 static void
 bnxt_uninit_locks(struct bnxt *bp)
 {
@@ -5363,11 +5462,7 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
 	bnxt_free_ctx_mem(bp);
 	if (!reconfig_dev) {
 		bnxt_free_hwrm_resources(bp);
-
-		if (bp->recovery_info != NULL) {
-			rte_free(bp->recovery_info);
-			bp->recovery_info = NULL;
-		}
+		bnxt_free_error_recovery_info(bp);
 	}
 
 	bnxt_uninit_ctx_mem(bp);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index dc0b40560..666056ac1 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -5076,16 +5076,6 @@ int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp)
 	if (!(bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY))
 		return 0;
 
-	if (!info) {
-		info = rte_zmalloc("bnxt_hwrm_error_recovery_qcfg",
-				   sizeof(*info), 0);
-		bp->recovery_info = info;
-		if (info == NULL)
-			return -ENOMEM;
-	} else {
-		memset(info, 0, sizeof(*info));
-	}
-
 	HWRM_PREP(&req, HWRM_ERROR_RECOVERY_QCFG, BNXT_USE_CHIMP_MB);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
diff --git a/drivers/net/bnxt/hsi_struct_def_dpdk.h b/drivers/net/bnxt/hsi_struct_def_dpdk.h
index da22b6249..7e30c9ffc 100644
--- a/drivers/net/bnxt/hsi_struct_def_dpdk.h
+++ b/drivers/net/bnxt/hsi_struct_def_dpdk.h
@@ -38622,4 +38622,53 @@ struct hwrm_cfa_counter_qstats_output {
 	uint8_t	valid;
 } __rte_packed;
 
+/*
+ * This structure is fixed at the beginning of the ChiMP SRAM (GRC
+ * offset: 0x31001F0). Host software is expected to read from this
+ * location for a defined signature. If it exists, the software can
+ * assume the presence of this structure and the validity of the
+ * FW_STATUS location in the next field.
+ */
+/* hcomm_status (size:64b/8B) */
+struct hcomm_status {
+	uint32_t	sig_ver;
+	/*
+	 * This field defines the version of the structure. The latest
+	 * version value is 1.
+	 */
+	#define HCOMM_STATUS_VER_MASK		UINT32_C(0xff)
+	#define HCOMM_STATUS_VER_SFT		0
+	#define HCOMM_STATUS_VER_LATEST		UINT32_C(0x1)
+	#define HCOMM_STATUS_VER_LAST		HCOMM_STATUS_VER_LATEST
+	/*
+	 * This field is to store the signature value to indicate the
+	 * presence of the structure.
+	 */
+	#define HCOMM_STATUS_SIGNATURE_MASK	UINT32_C(0xffffff00)
+	#define HCOMM_STATUS_SIGNATURE_SFT	8
+	#define HCOMM_STATUS_SIGNATURE_VAL	(UINT32_C(0x484353) << 8)
+	#define HCOMM_STATUS_SIGNATURE_LAST	HCOMM_STATUS_SIGNATURE_VAL
+	uint32_t	fw_status_loc;
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_MASK	UINT32_C(0x3)
+	#define HCOMM_STATUS_TRUE_ADDR_SPACE_SFT	0
+	/* PCIE configuration space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_PCIE_CFG	UINT32_C(0x0)
+	/* GRC space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC	UINT32_C(0x1)
+	/* BAR0 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0	UINT32_C(0x2)
+	/* BAR1 space */
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1	UINT32_C(0x3)
+	#define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_LAST	\
+		HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1
+	/*
+	 * This offset where the fw_status register is located. The value
+	 * is generally 4-byte aligned.
+	 */
+	#define HCOMM_STATUS_TRUE_OFFSET_MASK		UINT32_C(0xfffffffc)
+	#define HCOMM_STATUS_TRUE_OFFSET_SFT		2
+} __rte_packed;
+/* This is the GRC offset where the hcomm_status struct resides. */
+#define HCOMM_STATUS_STRUCT_LOC		0x31001F0UL
+
 #endif /* _HSI_STRUCT_DEF_DPDK_H_ */
-- 
2.21.1 (Apple Git-122.3)


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

* [dpdk-dev] [PATCH v3 9/9] net/bnxt: fix to not issue port MAC query on a VF
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
                     ` (7 preceding siblings ...)
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 8/9] net/bnxt: log firmware status on early init failure Ajit Khaparde
@ 2020-04-21 21:33   ` Ajit Khaparde
  2020-04-22 11:44   ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ferruh Yigit
  9 siblings, 0 replies; 34+ messages in thread
From: Ajit Khaparde @ 2020-04-21 21:33 UTC (permalink / raw)
  To: dev; +Cc: Kalesh AP, Somnath Kotur

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

HWRM_PORT_MAC_QCFG is not supported on a VF. Added a PF check
in bnxt_hwrm_port_mac_qcfg() to prevent the probe failure on a VF.

Fixes: 184e3d13d88a ("net/bnxt: fetch SVIF information from firmware")

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

diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 666056ac1..ebf73e44c 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3094,6 +3094,9 @@ int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp)
 
 	bp->port_svif = BNXT_SVIF_INVALID;
 
+	if (!BNXT_PF(bp))
+		return 0;
+
 	HWRM_PREP(&req, HWRM_PORT_MAC_QCFG, BNXT_USE_CHIMP_MB);
 
 	rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
-- 
2.21.1 (Apple Git-122.3)


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

* Re: [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes
  2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
                     ` (8 preceding siblings ...)
  2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 9/9] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
@ 2020-04-22 11:44   ` Ferruh Yigit
  9 siblings, 0 replies; 34+ messages in thread
From: Ferruh Yigit @ 2020-04-22 11:44 UTC (permalink / raw)
  To: Ajit Khaparde, dev

On 4/21/2020 10:33 PM, Ajit Khaparde wrote:
> Patches with bug fixes.
> 
> v1->v2:
>  - Fix compilation on BSD.
>  - Fix commit logs for some of the patches.
> 
> v2->v3:
>  - Squashed patches 8,9 into a single patch.
> 
> Ajit Khaparde (1):
>   net/bnxt: fix compilation on BSD
> 
> Kalesh AP (8):
>   net/bnxt: use macro for PCI log format
>   net/bnxt: return speed capabilities in device get info
>   net/bnxt: fix HWRM command failure during FW reset
>   net/bnxt: fix to use true/false for bool types
>   net/bnxt: fix to handle port start failure
>   net/bnxt: fix vlan add when port is stopped
>   net/bnxt: log firmware status on early init failure
>   net/bnxt: fix to not issue port MAC query on a VF
> 

Hi Ajit,

Please let me merge the series directly to next-net, skipping your tree (and
since you have your review tags on them I believe you are OK to merge them), to
be able to make the series in the -rc1.

Series applied to dpdk-next-net/master, thanks.

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

end of thread, other threads:[~2020-04-22 11:44 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  9:12 [dpdk-dev] [PATCH 0/9] bnxt patchset with fixes Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 1/9] net/bnxt: use macro for PCI log format Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 2/9] net/bnxt: return speed capabilities in device info get Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 3/9] net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 4/9] net/bnxt: fix to use true/false for bool types Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 5/9] net/bnxt: fix to handle port start failure Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 6/9] net/bnxt: fix vlan add when port is stopped Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 7/9] net/bnxt: define FW_STATUS location structure for ChiMP devices Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 8/9] net/bnxt: log firmware status on early init failure Kalesh A P
2020-04-21  9:12 ` [dpdk-dev] [PATCH 9/9] net/bnxt: fix to not issue HWRM_PORT_MAC_QCFG on a VF Kalesh A P
2020-04-21 20:07 ` [dpdk-dev] [PATCH v2 00/10] bnxt patchset with fixes Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 01/10] net/bnxt: fix compilation on BSD Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 02/10] net/bnxt: use macro for PCI log format Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 03/10] net/bnxt: return speed capabilities in device get info Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 04/10] net/bnxt: fix HWRM command failure during FW reset Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 05/10] net/bnxt: fix to use true/false for bool types Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 06/10] net/bnxt: fix to handle port start failure Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 07/10] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure Ajit Khaparde
2020-04-21 21:05     ` Ferruh Yigit
2020-04-21 21:21       ` Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 09/10] net/bnxt: log firmware status on early init failure Ajit Khaparde
2020-04-21 20:07   ` [dpdk-dev] [PATCH v2 10/10] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
2020-04-21 21:33 ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 1/9] net/bnxt: fix compilation on BSD Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 2/9] net/bnxt: use macro for PCI log format Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 3/9] net/bnxt: return speed capabilities in device get info Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 4/9] net/bnxt: fix HWRM command failure during FW reset Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 5/9] net/bnxt: fix to use true/false for bool types Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 6/9] net/bnxt: fix to handle port start failure Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 7/9] net/bnxt: fix vlan add when port is stopped Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 8/9] net/bnxt: log firmware status on early init failure Ajit Khaparde
2020-04-21 21:33   ` [dpdk-dev] [PATCH v3 9/9] net/bnxt: fix to not issue port MAC query on a VF Ajit Khaparde
2020-04-22 11:44   ` [dpdk-dev] [PATCH v3 0/9] bnxt patchset with fixes Ferruh Yigit

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