From: Michael Chan Date: Tue, 4 Apr 2017 22:14:17 +0000 (-0400) Subject: bnxt_en: Cap the msix vector with the max completion rings. X-Git-Tag: v4.1.12-106.0.20170710_2300~37 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=10d92a0573a6e41cbe648befa3a83a5a1b8ee4df;p=users%2Fjedix%2Flinux-maple.git bnxt_en: Cap the msix vector with the max completion rings. Orabug: 26402533, 26325599, 26366387 The current code enables up to the maximum MSIX vectors in the PCIE config space without considering the max completion rings available. An MSIX vector is only useful when it has an associated completion ring, so it is better to cap it. Signed-off-by: Michael Chan Signed-off-by: David S. Miller (cherry picked from commit 68a946bb81e07ed0e59a99e0c068d091ed42cc1b) Signed-off-by: Brian Maly Signed-off-by: Somasundaram Krishnasamy --- diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 13071e97d2f2..a86238cd1733 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -5229,9 +5229,10 @@ static unsigned int bnxt_get_max_func_irqs(struct bnxt *bp) { #if defined(CONFIG_BNXT_SRIOV) if (BNXT_VF(bp)) - return bp->vf.max_irqs; + return min_t(unsigned int, bp->vf.max_irqs, + bp->vf.max_cp_rings); #endif - return bp->pf.max_irqs; + return min_t(unsigned int, bp->pf.max_irqs, bp->pf.max_cp_rings); } void bnxt_set_max_func_irqs(struct bnxt *bp, unsigned int max_irqs)