All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] bnxt_en: Disable interrupts when allocating CP rings or NQs.
@ 2019-01-31 19:31 Michael Chan
  2019-01-31 20:56 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2019-01-31 19:31 UTC (permalink / raw)
  To: davem; +Cc: netdev

When calling firmware to allocate a CP ring or NQ, an interrupt associated
with that ring may be generated immediately before the doorbell is even
setup after the firmware call returns.  When servicing the interrupt, the
driver may crash when trying to access the doorbell.

Fix it by disabling interrupt on that vector until the doorbell is
set up.

Fixes: 697197e5a173 ("bnxt_en: Re-structure doorbells.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---

Please queue this for 4.20 stable as well.  Thanks.

 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 6a51287..8bc7e49 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -4973,12 +4973,18 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
 		struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
 		struct bnxt_ring_struct *ring = &cpr->cp_ring_struct;
 		u32 map_idx = ring->map_idx;
+		unsigned int vector;
 
+		vector = bp->irq_tbl[map_idx].vector;
+		disable_irq_nosync(vector);
 		rc = hwrm_ring_alloc_send_msg(bp, ring, type, map_idx);
-		if (rc)
+		if (rc) {
+			enable_irq(vector);
 			goto err_out;
+		}
 		bnxt_set_db(bp, &cpr->cp_db, type, map_idx, ring->fw_ring_id);
 		bnxt_db_nq(bp, &cpr->cp_db, cpr->cp_raw_cons);
+		enable_irq(vector);
 		bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id;
 
 		if (!i) {
-- 
2.5.1


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

* Re: [PATCH net] bnxt_en: Disable interrupts when allocating CP rings or NQs.
  2019-01-31 19:31 [PATCH net] bnxt_en: Disable interrupts when allocating CP rings or NQs Michael Chan
@ 2019-01-31 20:56 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-01-31 20:56 UTC (permalink / raw)
  To: michael.chan; +Cc: netdev

From: Michael Chan <michael.chan@broadcom.com>
Date: Thu, 31 Jan 2019 14:31:48 -0500

> When calling firmware to allocate a CP ring or NQ, an interrupt associated
> with that ring may be generated immediately before the doorbell is even
> setup after the firmware call returns.  When servicing the interrupt, the
> driver may crash when trying to access the doorbell.
> 
> Fix it by disabling interrupt on that vector until the doorbell is
> set up.
> 
> Fixes: 697197e5a173 ("bnxt_en: Re-structure doorbells.")
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
> 
> Please queue this for 4.20 stable as well.  Thanks.

Applied and queued up, thanks.

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

end of thread, other threads:[~2019-01-31 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-31 19:31 [PATCH net] bnxt_en: Disable interrupts when allocating CP rings or NQs Michael Chan
2019-01-31 20:56 ` David Miller

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.