Skip to contentSkip to conversation

bnxt_en: Bug fixes.

PATCH Applied Michael Chan 2 participants 6 messages Nov 16, 2020 – Nov 17, 2020

Subsystems (3)
lore
Share & tools
lore

Michael Chan

author maintainer
#0 lore raw

cover bnxt_en: Bug fixes.

This first patch fixes a module eeprom A2h addressing issue. The next 2 patches fix counter related issues. The last one skips an unsupported firmware call on the VF to avoid the error log.

Please queue the 1st 3 patches for -stable. Thanks.

Edwin Peer (1):
bnxt_en: read EEPROM A2h address using page 0

Michael Chan (2):
bnxt_en: Free port stats during firmware reset.
bnxt_en: Fix counter overflow logic.

Vasundhara Volam (1):
bnxt_en: Avoid unnecessary NVM_GET_DEV_INFO cmd error log on VFs.

 drivers/net/ethernet/broadcom/bnxt/bnxt.c         | 4 +++-
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
Signature · 1 line
2.18.1
author maintainer
#1 lore raw

PATCH 1/4 bnxt_en: read EEPROM A2h address using page 0

From: Edwin Peer <[email protected]>

The module eeprom address range returned by bnxt_get_module_eeprom() should be 256 bytes of A0h address space, the lower half of the A2h address space, and page 0 for the upper half of the A2h address space.

Fix the firmware call by passing page_number 0 for the A2h slave address space.

Fixes 42ee18fe4ca2 ("bnxt_en: Add Support for ETHTOOL_GMODULEINFO and ETHTOOL_GMODULEEEPRO")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +1 -1
index 53687bc7fcf5..f133ea5674cb 100644
@@ -2997,7 +2997,7 @@ static int bnxt_get_module_eeprom(struct net_device *dev,
 	/* Read A2 portion of the EEPROM */
 	if (length) {
 		start -= ETH_MODULE_SFF_8436_LEN;
-		rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 1,
+		rc = bnxt_read_sfp_module_eeprom_info(bp, I2C_DEV_ADDR_A2, 0,
 						      start, length, data);
 	}
 	return rc;
Signature · 1 line
2.18.1
author maintainer
#2 lore raw

PATCH 2/4 bnxt_en: Free port stats during firmware reset.

In reply to Michael Chan

Firmware is unable to retain the port counters during any kind of fatal or non-fatal resets, so we must clear the port counters to avoid false detection of port counter overflow.

Fixes fea6b3335527 ("bnxt_en: Accumulate all counters.")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -1
index 7975f59735d6..448e1ba762ee 100644
@@ -4099,7 +4099,8 @@ static void bnxt_free_mem(struct bnxt *bp, bool irq_re_init)
 	bnxt_free_ntp_fltrs(bp, irq_re_init);
 	if (irq_re_init) {
 		bnxt_free_ring_stats(bp);
-		if (!(bp->fw_cap & BNXT_FW_CAP_PORT_STATS_NO_RESET))
+		if (!(bp->fw_cap & BNXT_FW_CAP_PORT_STATS_NO_RESET) ||
+		    test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
 			bnxt_free_port_stats(bp);
 		bnxt_free_ring_grps(bp);
 		bnxt_free_vnics(bp);
Signature · 1 line
2.18.1
author maintainer
#3 lore raw

PATCH 3/4 bnxt_en: Fix counter overflow logic.

In reply to Michael Chan

bnxt_add_one_ctr() adds a hardware counter to a software counter and adjusts for the hardware counter wraparound against the mask. The logic assumes that the hardware counter is always smaller than or equal to the mask.

This assumption is mostly correct. But in some cases if the firmware is older and does not provide the accurate mask, the driver can use a mask that is smaller than the actual hardware mask. This can cause some extra carry bits to be added to the software counter, resulting in counters that far exceed the actual value. Fix it by masking the hardware counter with the mask passed into bnxt_add_one_ctr().

Fixes fea6b3335527 ("bnxt_en: Accumulate all counters.")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -0
index 448e1ba762ee..7c21aaa8b9af 100644
@@ -7758,6 +7758,7 @@ static void bnxt_add_one_ctr(u64 hw, u64 *sw, u64 mask)
 {
 	u64 sw_tmp;
 
+	hw &= mask;
 	sw_tmp = (*sw & ~mask) | hw;
 	if (hw < (*sw & mask))
 		sw_tmp += mask + 1;
Signature · 1 line
2.18.1
author maintainer
#4 lore raw

PATCH 4/4 bnxt_en: Avoid unnecessary NVM_GET_DEV_INFO cmd error log on VFs.

In reply to Michael Chan

From: Vasundhara Volam <[email protected]>

VFs do not have access permissions to issue NVM_GET_DEV_INFO firmware command.

Fixes 4933f6753b50 ("bnxt_en: Add bnxt_hwrm_nvm_get_dev_info() to query NVM info.")
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 -0
index f133ea5674cb..1471c9a36238 100644
@@ -2079,6 +2079,9 @@ int bnxt_hwrm_nvm_get_dev_info(struct bnxt *bp,
 	struct hwrm_nvm_get_dev_info_input req = {0};
 	int rc;
 
+	if (BNXT_VF(bp))
+		return -EOPNOTSUPP;
+
 	bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_NVM_GET_DEV_INFO, -1, -1);
 	mutex_lock(&bp->hwrm_cmd_lock);
 	rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
Signature · 1 line
2.18.1
maintainer Applied
#5 lore raw
In reply to Michael Chan
Quoted 5 lines · On Sun, 15 Nov 2020 19:27:48 -0500 Michael Chan wrote:

This first patch fixes a module eeprom A2h addressing issue. The next 2 patches fix counter related issues. The last one skips an unsupported firmware call on the VF to avoid the error log.

Please queue the 1st 3 patches for -stable. Thanks.

Applied, thanks!