]>
Commit | Line | Data |
---|---|---|
ffc20820 GKH |
1 | From foo@baz Fri 31 May 2019 03:16:39 PM PDT |
2 | From: Michael Chan <michael.chan@broadcom.com> | |
3 | Date: Wed, 22 May 2019 19:12:55 -0400 | |
4 | Subject: bnxt_en: Fix possible BUG() condition when calling pci_disable_msix(). | |
5 | ||
6 | From: Michael Chan <michael.chan@broadcom.com> | |
7 | ||
8 | [ Upstream commit 1b3f0b75c39f534278a895c117282014e9d0ae1f ] | |
9 | ||
10 | When making configuration changes, the driver calls bnxt_close_nic() | |
11 | and then bnxt_open_nic() for the changes to take effect. A parameter | |
12 | irq_re_init is passed to the call sequence to indicate if IRQ | |
13 | should be re-initialized. This irq_re_init parameter needs to | |
14 | be included in the bnxt_reserve_rings() call. bnxt_reserve_rings() | |
15 | can only call pci_disable_msix() if the irq_re_init parameter is | |
16 | true, otherwise it may hit BUG() because some IRQs may not have been | |
17 | freed yet. | |
18 | ||
19 | Fixes: 41e8d7983752 ("bnxt_en: Modify the ring reservation functions for 57500 series chips.") | |
20 | Signed-off-by: Michael Chan <michael.chan@broadcom.com> | |
21 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | --- | |
24 | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 +++++++------ | |
25 | drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 +- | |
26 | drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +- | |
27 | drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 +- | |
28 | 4 files changed, 10 insertions(+), 9 deletions(-) | |
29 | ||
30 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |
31 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |
32 | @@ -7514,22 +7514,23 @@ static void bnxt_clear_int_mode(struct b | |
33 | bp->flags &= ~BNXT_FLAG_USING_MSIX; | |
34 | } | |
35 | ||
36 | -int bnxt_reserve_rings(struct bnxt *bp) | |
37 | +int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init) | |
38 | { | |
39 | int tcs = netdev_get_num_tc(bp->dev); | |
40 | - bool reinit_irq = false; | |
41 | + bool irq_cleared = false; | |
42 | int rc; | |
43 | ||
44 | if (!bnxt_need_reserve_rings(bp)) | |
45 | return 0; | |
46 | ||
47 | - if (BNXT_NEW_RM(bp) && (bnxt_get_num_msix(bp) != bp->total_irqs)) { | |
48 | + if (irq_re_init && BNXT_NEW_RM(bp) && | |
49 | + bnxt_get_num_msix(bp) != bp->total_irqs) { | |
50 | bnxt_ulp_irq_stop(bp); | |
51 | bnxt_clear_int_mode(bp); | |
52 | - reinit_irq = true; | |
53 | + irq_cleared = true; | |
54 | } | |
55 | rc = __bnxt_reserve_rings(bp); | |
56 | - if (reinit_irq) { | |
57 | + if (irq_cleared) { | |
58 | if (!rc) | |
59 | rc = bnxt_init_int_mode(bp); | |
60 | bnxt_ulp_irq_restart(bp, rc); | |
61 | @@ -8428,7 +8429,7 @@ static int __bnxt_open_nic(struct bnxt * | |
62 | return rc; | |
63 | } | |
64 | } | |
65 | - rc = bnxt_reserve_rings(bp); | |
66 | + rc = bnxt_reserve_rings(bp, irq_re_init); | |
67 | if (rc) | |
68 | return rc; | |
69 | if ((bp->flags & BNXT_FLAG_RFS) && | |
70 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h | |
71 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h | |
72 | @@ -1778,7 +1778,7 @@ unsigned int bnxt_get_avail_stat_ctxs_fo | |
73 | unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp); | |
74 | unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp); | |
75 | int bnxt_get_avail_msix(struct bnxt *bp, int num); | |
76 | -int bnxt_reserve_rings(struct bnxt *bp); | |
77 | +int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init); | |
78 | void bnxt_tx_disable(struct bnxt *bp); | |
79 | void bnxt_tx_enable(struct bnxt *bp); | |
80 | int bnxt_hwrm_set_pause(struct bnxt *); | |
81 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | |
82 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | |
83 | @@ -788,7 +788,7 @@ static int bnxt_set_channels(struct net_ | |
84 | */ | |
85 | } | |
86 | } else { | |
87 | - rc = bnxt_reserve_rings(bp); | |
88 | + rc = bnxt_reserve_rings(bp, true); | |
89 | } | |
90 | ||
91 | return rc; | |
92 | --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | |
93 | +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | |
94 | @@ -147,7 +147,7 @@ static int bnxt_req_msix_vecs(struct bnx | |
95 | bnxt_close_nic(bp, true, false); | |
96 | rc = bnxt_open_nic(bp, true, false); | |
97 | } else { | |
98 | - rc = bnxt_reserve_rings(bp); | |
99 | + rc = bnxt_reserve_rings(bp, true); | |
100 | } | |
101 | } | |
102 | if (rc) { |