Skip to contentSkip to conversation

bnxt patchset with fixes

PATCH New Kalesh A P 3 participants 34 messages Apr 21, 2020 – Apr 22, 2020 Network drivers

lore
Share & tools
lore

Kalesh A P

author
#0 lore raw

cover bnxt patchset with fixes

From: Kalesh AP <[email protected]>

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(-)
Signature · 1 line
2.10.1
author
#1 lore raw

PATCH 1/9 net/bnxt: use macro for PCI log format

From: Kalesh AP <[email protected]>

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

---
 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(-)
drivers/net/bnxt/bnxt_hwrm.c +3 -3
index 09a7328..4c0fac6 100644
@@ -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);
drivers/net/bnxt/bnxt_ring.c +1 -1
index 1999cd7..24a947f 100644
@@ -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;
drivers/net/bnxt/bnxt_vnic.c +1 -1
index bc054a8..326c0d1 100644
@@ -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);
Signature · 1 line
2.10.1
author
#2 lore raw

PATCH 2/9 net/bnxt: return speed capabilities in device info get

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

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.

---
 drivers/net/bnxt/bnxt_ethdev.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +36 -0
index d29671d..3397c05 100644
@@ -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 = {
Signature · 1 line
2.10.1
author
#3 lore raw

PATCH 3/9 net/bnxt: fix to resend FUNC_DRV_IF_CHANGE when FW reset is in progress

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

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")
---
 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(-)
drivers/net/bnxt/bnxt.h +5 -0
index a7a9e41..d55a570 100644
@@ -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;
drivers/net/bnxt/bnxt_ethdev.c +17 -8
index 3397c05..b6c7132 100644
@@ -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);
drivers/net/bnxt/bnxt_hwrm.c +4 -0
index 4c0fac6..dc0b405 100644
@@ -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; \
Signature · 1 line
2.10.1
author
#4 lore raw

PATCH 4/9 net/bnxt: fix to use true/false for bool types

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

Fixes 0b533591238f ("net/bnxt: inform firmware about IF state changes")
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +3 -3
index b6c7132..780d9c4 100644
@@ -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;
Signature · 1 line
2.10.1
author
#5 lore raw

PATCH 5/9 net/bnxt: fix to handle port start failure

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index 780d9c4..206111d 100644
@@ -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;
 }
Signature · 1 line
2.10.1
author
#6 lore raw

PATCH 6/9 net/bnxt: fix vlan add when port is stopped

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
index 206111d..589190b 100644
@@ -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);
Signature · 1 line
2.10.1
author
#7 lore raw

PATCH 7/9 net/bnxt: define FW_STATUS location structure for ChiMP devices

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

Code using this change will be added in next patch.

---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
drivers/net/bnxt/hsi_struct_def_dpdk.h +49 -0
index da22b62..fe18686 100644
@@ -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_ */
Signature · 1 line
2.10.1
author
#8 lore raw

PATCH 8/9 net/bnxt: log firmware status on early init failure

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

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

---
 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(-)
drivers/net/bnxt/bnxt.h +5 -0
index d55a570..586d3f5 100644
@@ -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)
drivers/net/bnxt/bnxt_ethdev.c +101 -6

146 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +0 -10
index dc0b405..666056a 100644
@@ -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);
Signature · 1 line
2.10.1
author
#9 lore raw

PATCH 9/9 net/bnxt: fix to not issue HWRM_PORT_MAC_QCFG on a VF

In reply to Kalesh A P

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
index 666056a..ebf73e4 100644
@@ -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);
Signature · 1 line
2.10.1
#10 lore raw

v2 cover bnxt patchset with fixes

In reply to Kalesh A P

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(-)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#11 lore raw

PATCH v2 1/10 net/bnxt: fix compilation on BSD

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

Fixes cef1ca505d7f ("net/bnxt: support EM/EEM")
---
 drivers/net/bnxt/tf_core/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/stack.c +1 -1
index 3337073b7..9cfbd244f 100644
@@ -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--;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#12 lore raw

PATCH v2 2/10 net/bnxt: use macro for PCI log format

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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

---
 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(-)
drivers/net/bnxt/bnxt_hwrm.c +3 -3
index 09a73286b..4c0fac6be 100644
@@ -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);
drivers/net/bnxt/bnxt_ring.c +1 -1
index 1999cd786..24a947f27 100644
@@ -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;
drivers/net/bnxt/bnxt_vnic.c +1 -1
index bc054a8e0..326c0d1b6 100644
@@ -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);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#13 lore raw

PATCH v2 3/10 net/bnxt: return speed capabilities in device get info

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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.

---
 drivers/net/bnxt/bnxt_ethdev.c | 36 ++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +36 -0
index d29671d64..3397c0535 100644
@@ -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 = {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#14 lore raw

PATCH v2 4/10 net/bnxt: fix HWRM command failure during FW reset

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 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(-)
drivers/net/bnxt/bnxt.h +5 -0
index a7a9e4113..d55a57039 100644
@@ -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;
drivers/net/bnxt/bnxt_ethdev.c +17 -8
index 3397c0535..b6c713256 100644
@@ -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);
drivers/net/bnxt/bnxt_hwrm.c +4 -0
index 4c0fac6be..dc0b40560 100644
@@ -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; \
Signature · 1 line
2.21.1 (Apple Git-122.3)
#15 lore raw

PATCH v2 5/10 net/bnxt: fix to use true/false for bool types

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

Fixes 0b533591238f ("net/bnxt: inform firmware about IF state changes")
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +3 -3
index b6c713256..780d9c46e 100644
@@ -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;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#16 lore raw

PATCH v2 6/10 net/bnxt: fix to handle port start failure

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index 780d9c46e..206111db5 100644
@@ -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;
 }
Signature · 1 line
2.21.1 (Apple Git-122.3)
#17 lore raw

PATCH v2 7/10 net/bnxt: fix vlan add when port is stopped

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
index 206111db5..589190b37 100644
@@ -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);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#18 lore raw

PATCH v2 8/10 net/bnxt: add FW status location structure

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

Code using this change will be added in next patch.

---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
drivers/net/bnxt/hsi_struct_def_dpdk.h +49 -0
index da22b6249..fe18686f8 100644
@@ -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_ */
Signature · 1 line
2.21.1 (Apple Git-122.3)
#19 lore raw

Re: [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure

Quoted 3 lines · Ajit Khaparde

From: Kalesh AP <[email protected]>

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.

Quoted 51 lines
---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
drivers/net/bnxt/hsi_struct_def_dpdk.h +36 -0
index da22b6249..fe18686f8 100644
@@ -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 */

drivers/net/bnxt/hsi_struct_def_dpdk.h struct hwrm_cfa_counter_qstats_output { · line 38670

Quoted 10 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +10 -0
+	#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.

#20 lore raw

Re: [dpdk-dev] [PATCH v2 08/10] net/bnxt: add FW status location structure

Quoted 73 lines · Ferruh Yigit
Quoted 3 lines · Ajit Khaparde

From: Kalesh AP <[email protected]>

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.

Review

Quoted 8 lines
---
 drivers/net/bnxt/hsi_struct_def_dpdk.h | 49 ++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
(quoted diff) +0 -0

b/drivers/net/bnxt/hsi_struct_def_dpdk.h

Quoted 28 lines

index da22b6249..fe18686f8 100644

drivers/net/bnxt/hsi_struct_def_dpdk.h +21 -0
@@ -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.

drivers/net/bnxt/hsi_struct_def_dpdk.h struct hwrm_cfa_counter_qstats_output { · line 38655

Quoted 10 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +10 -0
+      */
+     #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)

drivers/net/bnxt/hsi_struct_def_dpdk.h struct hwrm_cfa_counter_qstats_output { · line 38657

Quoted 2 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +2 -0
+     /* GRC space */
+     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_GRC

UINT32_C(0x1)

drivers/net/bnxt/hsi_struct_def_dpdk.h struct hwrm_cfa_counter_qstats_output { · line 38659

Quoted 2 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +2 -0
+     /* BAR0 space */
+     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR0

UINT32_C(0x2)

drivers/net/bnxt/hsi_struct_def_dpdk.h struct hwrm_cfa_counter_qstats_output { · line 38661

Quoted 2 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +2 -0
+     /* BAR1 space */
+     #define HCOMM_STATUS_FW_STATUS_LOC_ADDR_SPACE_BAR1

UINT32_C(0x3)

drivers/net/bnxt/hsi_struct_def_dpdk.h struct hwrm_cfa_counter_qstats_output {

Quoted 7 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +7 -0
+     #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)

Quoted 9 lines

drivers/net/bnxt/hsi_struct_def_dpdk.h struct hwrm_cfa_counter_qstats_output { · line 38670

Quoted 2 lines
drivers/net/bnxt/hsi_struct_def_dpdk.h +2 -0
+     #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

#21 lore raw

PATCH v2 9/10 net/bnxt: log firmware status on early init failure

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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

---
 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(-)
drivers/net/bnxt/bnxt.h +5 -0
index d55a57039..586d3f534 100644
@@ -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)
drivers/net/bnxt/bnxt_ethdev.c +101 -6

146 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +0 -10
index dc0b40560..666056ac1 100644
@@ -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);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#22 lore raw

PATCH v2 10/10 net/bnxt: fix to not issue port MAC query on a VF

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
index 666056ac1..ebf73e44c 100644
@@ -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);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#23 lore raw

v3 cover bnxt patchset with fixes

In reply to Kalesh A P

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(-)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#24 lore raw

PATCH v3 1/9 net/bnxt: fix compilation on BSD

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

Fixes cef1ca505d7f ("net/bnxt: support EM/EEM")
---
 drivers/net/bnxt/tf_core/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/stack.c +1 -1
index 3337073b7..9cfbd244f 100644
@@ -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--;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#25 lore raw

PATCH v3 2/9 net/bnxt: use macro for PCI log format

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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

---
 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(-)
drivers/net/bnxt/bnxt_hwrm.c +3 -3
index 09a73286b..4c0fac6be 100644
@@ -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);
drivers/net/bnxt/bnxt_ring.c +1 -1
index 1999cd786..24a947f27 100644
@@ -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;
drivers/net/bnxt/bnxt_vnic.c +1 -1
index bc054a8e0..326c0d1b6 100644
@@ -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);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#26 lore raw

PATCH v3 3/9 net/bnxt: return speed capabilities in device get info

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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.

---
 drivers/net/bnxt/bnxt_ethdev.c | 36 ++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +36 -0
index d29671d64..3397c0535 100644
@@ -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 = {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#27 lore raw

PATCH v3 4/9 net/bnxt: fix HWRM command failure during FW reset

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 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(-)
drivers/net/bnxt/bnxt.h +5 -0
index a7a9e4113..d55a57039 100644
@@ -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;
drivers/net/bnxt/bnxt_ethdev.c +17 -8
index 3397c0535..b6c713256 100644
@@ -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);
drivers/net/bnxt/bnxt_hwrm.c +4 -0
index 4c0fac6be..dc0b40560 100644
@@ -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; \
Signature · 1 line
2.21.1 (Apple Git-122.3)
#28 lore raw

PATCH v3 5/9 net/bnxt: fix to use true/false for bool types

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

Fixes 0b533591238f ("net/bnxt: inform firmware about IF state changes")
---
 drivers/net/bnxt/bnxt_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +3 -3
index b6c713256..780d9c46e 100644
@@ -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;
Signature · 1 line
2.21.1 (Apple Git-122.3)
#29 lore raw

PATCH v3 6/9 net/bnxt: fix to handle port start failure

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +1 -1
index 780d9c46e..206111db5 100644
@@ -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;
 }
Signature · 1 line
2.21.1 (Apple Git-122.3)
#30 lore raw

PATCH v3 7/9 net/bnxt: fix vlan add when port is stopped

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_ethdev.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +5 -0
index 206111db5..589190b37 100644
@@ -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);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#31 lore raw

PATCH v3 8/9 net/bnxt: log firmware status on early init failure

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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

---
 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(-)
drivers/net/bnxt/bnxt.h +5 -0
index d55a57039..586d3f534 100644
@@ -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)
drivers/net/bnxt/bnxt_ethdev.c +101 -6

146 lines not on this page · raw message

drivers/net/bnxt/bnxt_hwrm.c +0 -10
index dc0b40560..666056ac1 100644
@@ -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);
drivers/net/bnxt/hsi_struct_def_dpdk.h +49 -0

53 lines not on this page · raw message

Signature · 1 line
2.21.1 (Apple Git-122.3)
#32 lore raw

PATCH v3 9/9 net/bnxt: fix to not issue port MAC query on a VF

In reply to Ajit Khaparde

From: Kalesh AP <[email protected]>

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")
---
 drivers/net/bnxt/bnxt_hwrm.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
index 666056ac1..ebf73e44c 100644
@@ -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);
Signature · 1 line
2.21.1 (Apple Git-122.3)
#33 lore raw
In reply to Ajit Khaparde
Quoted 12 lines · Ajit Khaparde

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

Quoted 10 lines

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.