All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] bnxt_en: Bug fixes.
@ 2020-12-27 19:18 Michael Chan
  2020-12-27 19:18 ` [PATCH net 1/2] bnxt_en: Fix AER recovery Michael Chan
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Chan @ 2020-12-27 19:18 UTC (permalink / raw)
  To: davem; +Cc: netdev, kuba, gospo

The first patch fixes recovery of fatal AER errors.  The second one
fixes a potential array out of bounds issue.

Please queue for -stable.  Thanks.

Michael Chan (1):
  bnxt_en: Check TQM rings for maximum supported value.

Vasundhara Volam (1):
  bnxt_en: Fix AER recovery.

 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 38 +++++++++++------------
 drivers/net/ethernet/broadcom/bnxt/bnxt.h |  7 ++++-
 2 files changed, 25 insertions(+), 20 deletions(-)

-- 
2.18.1


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

* [PATCH net 1/2] bnxt_en: Fix AER recovery.
  2020-12-27 19:18 [PATCH net 0/2] bnxt_en: Bug fixes Michael Chan
@ 2020-12-27 19:18 ` Michael Chan
  2020-12-27 19:18 ` [PATCH net 2/2] bnxt_en: Check TQM rings for maximum supported value Michael Chan
  2020-12-28 22:20 ` [PATCH net 0/2] bnxt_en: Bug fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Chan @ 2020-12-27 19:18 UTC (permalink / raw)
  To: davem; +Cc: netdev, kuba, gospo, Vasundhara Volam

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

A recent change skips sending firmware messages to the firmware when
pci_channel_offline() is true during fatal AER error.  To make this
complete, we need to move the re-initialization sequence to
bnxt_io_resume(), otherwise the firmware messages to re-initialize
will all be skipped.  In any case, it is more correct to re-initialize
in bnxt_io_resume().

Also, fix the reverse x-mas tree format when defining variables
in bnxt_io_slot_reset().

Fixes: b340dc680ed4 ("bnxt_en: Avoid sending firmware messages when AER error is detected.")
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
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.c | 31 ++++++++++-------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 4edd6f8e017e..b8351e24395d 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -12887,10 +12887,10 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,
  */
 static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
 {
+	pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct bnxt *bp = netdev_priv(netdev);
 	int err = 0, off;
-	pci_ers_result_t result = PCI_ERS_RESULT_DISCONNECT;
 
 	netdev_info(bp->dev, "PCI Slot Reset\n");
 
@@ -12919,22 +12919,8 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
 		pci_save_state(pdev);
 
 		err = bnxt_hwrm_func_reset(bp);
-		if (!err) {
-			err = bnxt_hwrm_func_qcaps(bp);
-			if (!err && netif_running(netdev))
-				err = bnxt_open(netdev);
-		}
-		bnxt_ulp_start(bp, err);
-		if (!err) {
-			bnxt_reenable_sriov(bp);
+		if (!err)
 			result = PCI_ERS_RESULT_RECOVERED;
-		}
-	}
-
-	if (result != PCI_ERS_RESULT_RECOVERED) {
-		if (netif_running(netdev))
-			dev_close(netdev);
-		pci_disable_device(pdev);
 	}
 
 	rtnl_unlock();
@@ -12952,10 +12938,21 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
 static void bnxt_io_resume(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
+	struct bnxt *bp = netdev_priv(netdev);
+	int err;
 
+	netdev_info(bp->dev, "PCI Slot Resume\n");
 	rtnl_lock();
 
-	netif_device_attach(netdev);
+	err = bnxt_hwrm_func_qcaps(bp);
+	if (!err && netif_running(netdev))
+		err = bnxt_open(netdev);
+
+	bnxt_ulp_start(bp, err);
+	if (!err) {
+		bnxt_reenable_sriov(bp);
+		netif_device_attach(netdev);
+	}
 
 	rtnl_unlock();
 }
-- 
2.18.1


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

* [PATCH net 2/2] bnxt_en: Check TQM rings for maximum supported value.
  2020-12-27 19:18 [PATCH net 0/2] bnxt_en: Bug fixes Michael Chan
  2020-12-27 19:18 ` [PATCH net 1/2] bnxt_en: Fix AER recovery Michael Chan
@ 2020-12-27 19:18 ` Michael Chan
  2020-12-28 22:20 ` [PATCH net 0/2] bnxt_en: Bug fixes patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Chan @ 2020-12-27 19:18 UTC (permalink / raw)
  To: davem; +Cc: netdev, kuba, gospo

TQM rings are hardware resources that require host context memory
managed by the driver.  The driver supports up to 9 TQM rings and
the number of rings to use is requested by firmware during run-time.
Cap this number to the maximum supported to prevent accessing beyond
the array.  Future firmware may request more than 9 TQM rings.  Define
macros to remove the magic number 9 from the C code.

Fixes: ac3158cb0108 ("bnxt_en: Allocate TQM ring context memory according to fw specification.")
Reviewed-by: Pavan Chebbi <pavan.chebbi@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 | 7 +++++--
 drivers/net/ethernet/broadcom/bnxt/bnxt.h | 7 ++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index b8351e24395d..d10e4f85dd11 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -6790,8 +6790,10 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp)
 		ctx->tqm_fp_rings_count = resp->tqm_fp_rings_count;
 		if (!ctx->tqm_fp_rings_count)
 			ctx->tqm_fp_rings_count = bp->max_q;
+		else if (ctx->tqm_fp_rings_count > BNXT_MAX_TQM_FP_RINGS)
+			ctx->tqm_fp_rings_count = BNXT_MAX_TQM_FP_RINGS;
 
-		tqm_rings = ctx->tqm_fp_rings_count + 1;
+		tqm_rings = ctx->tqm_fp_rings_count + BNXT_MAX_TQM_SP_RINGS;
 		ctx_pg = kcalloc(tqm_rings, sizeof(*ctx_pg), GFP_KERNEL);
 		if (!ctx_pg) {
 			kfree(ctx);
@@ -6925,7 +6927,8 @@ static int bnxt_hwrm_func_backing_store_cfg(struct bnxt *bp, u32 enables)
 	     pg_attr = &req.tqm_sp_pg_size_tqm_sp_lvl,
 	     pg_dir = &req.tqm_sp_page_dir,
 	     ena = FUNC_BACKING_STORE_CFG_REQ_ENABLES_TQM_SP;
-	     i < 9; i++, num_entries++, pg_attr++, pg_dir++, ena <<= 1) {
+	     i < BNXT_MAX_TQM_RINGS;
+	     i++, num_entries++, pg_attr++, pg_dir++, ena <<= 1) {
 		if (!(enables & ena))
 			continue;
 
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 950ea26ae0d2..51996c85547e 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -1436,6 +1436,11 @@ struct bnxt_ctx_pg_info {
 	struct bnxt_ctx_pg_info **ctx_pg_tbl;
 };
 
+#define BNXT_MAX_TQM_SP_RINGS		1
+#define BNXT_MAX_TQM_FP_RINGS		8
+#define BNXT_MAX_TQM_RINGS		\
+	(BNXT_MAX_TQM_SP_RINGS + BNXT_MAX_TQM_FP_RINGS)
+
 struct bnxt_ctx_mem_info {
 	u32	qp_max_entries;
 	u16	qp_min_qp1_entries;
@@ -1474,7 +1479,7 @@ struct bnxt_ctx_mem_info {
 	struct bnxt_ctx_pg_info stat_mem;
 	struct bnxt_ctx_pg_info mrav_mem;
 	struct bnxt_ctx_pg_info tim_mem;
-	struct bnxt_ctx_pg_info *tqm_mem[9];
+	struct bnxt_ctx_pg_info *tqm_mem[BNXT_MAX_TQM_RINGS];
 };
 
 struct bnxt_fw_health {
-- 
2.18.1


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

* Re: [PATCH net 0/2] bnxt_en: Bug fixes.
  2020-12-27 19:18 [PATCH net 0/2] bnxt_en: Bug fixes Michael Chan
  2020-12-27 19:18 ` [PATCH net 1/2] bnxt_en: Fix AER recovery Michael Chan
  2020-12-27 19:18 ` [PATCH net 2/2] bnxt_en: Check TQM rings for maximum supported value Michael Chan
@ 2020-12-28 22:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2020-12-28 22:20 UTC (permalink / raw)
  To: Michael Chan; +Cc: davem, netdev, kuba, gospo

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Sun, 27 Dec 2020 14:18:16 -0500 you wrote:
> The first patch fixes recovery of fatal AER errors.  The second one
> fixes a potential array out of bounds issue.
> 
> Please queue for -stable.  Thanks.
> 
> Michael Chan (1):
>   bnxt_en: Check TQM rings for maximum supported value.
> 
> [...]

Here is the summary with links:
  - [net,1/2] bnxt_en: Fix AER recovery.
    https://git.kernel.org/netdev/net/c/fb1e6e562b37
  - [net,2/2] bnxt_en: Check TQM rings for maximum supported value.
    https://git.kernel.org/netdev/net/c/a029a2fef5d1

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net 0/2] bnxt_en: Bug fixes.
  2021-01-11  9:26 Michael Chan
@ 2021-01-13  4:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-01-13  4:10 UTC (permalink / raw)
  To: Michael Chan; +Cc: davem, netdev, kuba, gospo

Hello:

This series was applied to netdev/net.git (refs/heads/master):

On Mon, 11 Jan 2021 04:26:38 -0500 you wrote:
> This series has 2 fixes.  The first one fixes a resource accounting error
> with the RDMA driver loaded and the second one fixes the firmware
> flashing sequence after defragmentation.
> 
> Please queue the 1st one for -stable.  Thanks.
> 
> Michael Chan (1):
>   bnxt_en: Improve stats context resource accounting with RDMA driver
>     loaded.
> 
> [...]

Here is the summary with links:
  - [net,1/2] bnxt_en: Improve stats context resource accounting with RDMA driver loaded.
    https://git.kernel.org/netdev/net/c/869c4d5eb1e6
  - [net,2/2] bnxt_en: Clear DEFRAG flag in firmware message when retry flashing.
    https://git.kernel.org/netdev/net/c/687487751814

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* [PATCH net 0/2] bnxt_en: Bug fixes.
@ 2021-01-11  9:26 Michael Chan
  2021-01-13  4:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Chan @ 2021-01-11  9:26 UTC (permalink / raw)
  To: davem; +Cc: netdev, kuba, gospo

This series has 2 fixes.  The first one fixes a resource accounting error
with the RDMA driver loaded and the second one fixes the firmware
flashing sequence after defragmentation.

Please queue the 1st one for -stable.  Thanks.

Michael Chan (1):
  bnxt_en: Improve stats context resource accounting with RDMA driver
    loaded.

Pavan Chebbi (1):
  bnxt_en: Clear DEFRAG flag in firmware message when retry flashing.

 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 ++-
 drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c     | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

-- 
2.18.1


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

end of thread, other threads:[~2021-01-13  4:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-27 19:18 [PATCH net 0/2] bnxt_en: Bug fixes Michael Chan
2020-12-27 19:18 ` [PATCH net 1/2] bnxt_en: Fix AER recovery Michael Chan
2020-12-27 19:18 ` [PATCH net 2/2] bnxt_en: Check TQM rings for maximum supported value Michael Chan
2020-12-28 22:20 ` [PATCH net 0/2] bnxt_en: Bug fixes patchwork-bot+netdevbpf
2021-01-11  9:26 Michael Chan
2021-01-13  4:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.