netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/4] bnxt_en: Bug fixes.
@ 2020-11-16  0:27 Michael Chan
  2020-11-16  0:27 ` [PATCH net 1/4] bnxt_en: read EEPROM A2h address using page 0 Michael Chan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Michael Chan @ 2020-11-16  0:27 UTC (permalink / raw)
  To: kuba; +Cc: netdev, gospo

[-- Attachment #1: Type: text/plain, Size: 695 bytes --]

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

-- 
2.18.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4166 bytes --]

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

* [PATCH net 1/4] bnxt_en: read EEPROM A2h address using page 0
  2020-11-16  0:27 [PATCH net 0/4] bnxt_en: Bug fixes Michael Chan
@ 2020-11-16  0:27 ` Michael Chan
  2020-11-16  0:27 ` [PATCH net 2/4] bnxt_en: Free port stats during firmware reset Michael Chan
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Chan @ 2020-11-16  0:27 UTC (permalink / raw)
  To: kuba; +Cc: netdev, gospo

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

From: Edwin Peer <edwin.peer@broadcom.com>

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")
Signed-off-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index 53687bc7fcf5..f133ea5674cb 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -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;
-- 
2.18.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4166 bytes --]

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

* [PATCH net 2/4] bnxt_en: Free port stats during firmware reset.
  2020-11-16  0:27 [PATCH net 0/4] bnxt_en: Bug fixes Michael Chan
  2020-11-16  0:27 ` [PATCH net 1/4] bnxt_en: read EEPROM A2h address using page 0 Michael Chan
@ 2020-11-16  0:27 ` Michael Chan
  2020-11-16  0:27 ` [PATCH net 3/4] bnxt_en: Fix counter overflow logic Michael Chan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Chan @ 2020-11-16  0:27 UTC (permalink / raw)
  To: kuba; +Cc: netdev, gospo

[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]

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.")
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 7975f59735d6..448e1ba762ee 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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);
-- 
2.18.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4166 bytes --]

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

* [PATCH net 3/4] bnxt_en: Fix counter overflow logic.
  2020-11-16  0:27 [PATCH net 0/4] bnxt_en: Bug fixes Michael Chan
  2020-11-16  0:27 ` [PATCH net 1/4] bnxt_en: read EEPROM A2h address using page 0 Michael Chan
  2020-11-16  0:27 ` [PATCH net 2/4] bnxt_en: Free port stats during firmware reset Michael Chan
@ 2020-11-16  0:27 ` Michael Chan
  2020-11-16  0:27 ` [PATCH net 4/4] bnxt_en: Avoid unnecessary NVM_GET_DEV_INFO cmd error log on VFs Michael Chan
  2020-11-17  1:44 ` [PATCH net 0/4] bnxt_en: Bug fixes Jakub Kicinski
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Chan @ 2020-11-16  0:27 UTC (permalink / raw)
  To: kuba; +Cc: netdev, gospo

[-- Attachment #1: Type: text/plain, Size: 1437 bytes --]

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.")
Reviewed-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 448e1ba762ee..7c21aaa8b9af 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -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;
-- 
2.18.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4166 bytes --]

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

* [PATCH net 4/4] bnxt_en: Avoid unnecessary NVM_GET_DEV_INFO cmd error log on VFs.
  2020-11-16  0:27 [PATCH net 0/4] bnxt_en: Bug fixes Michael Chan
                   ` (2 preceding siblings ...)
  2020-11-16  0:27 ` [PATCH net 3/4] bnxt_en: Fix counter overflow logic Michael Chan
@ 2020-11-16  0:27 ` Michael Chan
  2020-11-17  1:44 ` [PATCH net 0/4] bnxt_en: Bug fixes Jakub Kicinski
  4 siblings, 0 replies; 6+ messages in thread
From: Michael Chan @ 2020-11-16  0:27 UTC (permalink / raw)
  To: kuba; +Cc: netdev, gospo

[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]

From: Vasundhara Volam <vasundhara-v.volam@broadcom.com>

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.")
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index f133ea5674cb..1471c9a36238 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -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);
-- 
2.18.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4166 bytes --]

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

* Re: [PATCH net 0/4] bnxt_en: Bug fixes.
  2020-11-16  0:27 [PATCH net 0/4] bnxt_en: Bug fixes Michael Chan
                   ` (3 preceding siblings ...)
  2020-11-16  0:27 ` [PATCH net 4/4] bnxt_en: Avoid unnecessary NVM_GET_DEV_INFO cmd error log on VFs Michael Chan
@ 2020-11-17  1:44 ` Jakub Kicinski
  4 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2020-11-17  1:44 UTC (permalink / raw)
  To: Michael Chan; +Cc: netdev, gospo

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!

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

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

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-16  0:27 [PATCH net 0/4] bnxt_en: Bug fixes Michael Chan
2020-11-16  0:27 ` [PATCH net 1/4] bnxt_en: read EEPROM A2h address using page 0 Michael Chan
2020-11-16  0:27 ` [PATCH net 2/4] bnxt_en: Free port stats during firmware reset Michael Chan
2020-11-16  0:27 ` [PATCH net 3/4] bnxt_en: Fix counter overflow logic Michael Chan
2020-11-16  0:27 ` [PATCH net 4/4] bnxt_en: Avoid unnecessary NVM_GET_DEV_INFO cmd error log on VFs Michael Chan
2020-11-17  1:44 ` [PATCH net 0/4] bnxt_en: Bug fixes Jakub Kicinski

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