| From 5d98b26580e76c67392bea09898a94dadc5ab501 Mon Sep 17 00:00:00 2001 |
| From: Michael Chan <michael.chan@broadcom.com> |
| Date: Tue, 10 Dec 2019 02:49:07 -0500 |
| Subject: [PATCH] bnxt_en: Fix MSIX request logic for RDMA driver. |
| |
| commit 0c722ec0a289c7f6b53f89bad1cfb7c4db3f7a62 upstream. |
| |
| The logic needs to check both bp->total_irqs and the reserved IRQs in |
| hw_resc->resv_irqs if applicable and see if both are enough to cover |
| the L2 and RDMA requested vectors. The current code is only checking |
| bp->total_irqs and can fail in some code paths, such as the TX timeout |
| code path with the RDMA driver requesting vectors after recovery. In |
| this code path, we have not reserved enough MSIX resources for the |
| RDMA driver yet. |
| |
| Fixes: 75720e6323a1 ("bnxt_en: Keep track of reserved IRQs.") |
| Signed-off-by: Michael Chan <michael.chan@broadcom.com> |
| Signed-off-by: David S. Miller <davem@davemloft.net> |
| Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> |
| |
| diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
| index fc77caf0a076..0ee0d689d94e 100644 |
| --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
| +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c |
| @@ -113,8 +113,10 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id, |
| { |
| struct net_device *dev = edev->net; |
| struct bnxt *bp = netdev_priv(dev); |
| + struct bnxt_hw_resc *hw_resc; |
| int max_idx, max_cp_rings; |
| int avail_msix, idx; |
| + int total_vecs; |
| int rc = 0; |
| |
| ASSERT_RTNL(); |
| @@ -142,7 +144,10 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id, |
| } |
| edev->ulp_tbl[ulp_id].msix_base = idx; |
| edev->ulp_tbl[ulp_id].msix_requested = avail_msix; |
| - if (bp->total_irqs < (idx + avail_msix)) { |
| + hw_resc = &bp->hw_resc; |
| + total_vecs = idx + avail_msix; |
| + if (bp->total_irqs < total_vecs || |
| + (BNXT_NEW_RM(bp) && hw_resc->resv_irqs < total_vecs)) { |
| if (netif_running(dev)) { |
| bnxt_close_nic(bp, true, false); |
| rc = bnxt_open_nic(bp, true, false); |
| @@ -156,7 +161,6 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id, |
| } |
| |
| if (BNXT_NEW_RM(bp)) { |
| - struct bnxt_hw_resc *hw_resc = &bp->hw_resc; |
| int resv_msix; |
| |
| resv_msix = hw_resc->resv_irqs - bp->cp_nr_rings; |
| -- |
| 2.7.4 |
| |