aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorMichael Chan <michael.chan@broadcom.com>2018-12-09 07:01:01 -0500
committerDavid S. Miller <davem@davemloft.net>2018-12-09 14:46:58 -0500
commitc0b8cda05e1d8151f57a79e525c2c7d51cec2f4e (patch)
tree330aff091d8869e8d04e81347c9c775c4220583f /drivers/net
parent75720e6323a1d195ae3ebf1a7b5e17c2e687f552 (diff)
bnxt_en: Fix NQ/CP rings accounting on the new 57500 chips.
The new 57500 chips have introduced the NQ structure in addition to the existing CP rings in all chips. We need to introduce a new bnxt_nq_rings_in_use(). On legacy chips, the 2 functions are the same and one will just call the other. On the new chips, they refer to the 2 separate ring structures. The new function is now called to determine the resource (NQ or CP rings) associated with MSIX that are in use. On 57500 chips, the RDMA driver does not use the CP rings so we don't need to do the subtraction adjustment. Fixes: 41e8d7983752 ("bnxt_en: Modify the ring reservation functions for 57500 series chips.") Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnxt/bnxt.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index c39820b2268f..2e90d98640d1 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -5354,7 +5354,7 @@ static int bnxt_hwrm_reserve_rings(struct bnxt *bp, int tx, int rx, int grp,
5354 return bnxt_hwrm_reserve_vf_rings(bp, tx, rx, grp, cp, vnic); 5354 return bnxt_hwrm_reserve_vf_rings(bp, tx, rx, grp, cp, vnic);
5355} 5355}
5356 5356
5357static int bnxt_cp_rings_in_use(struct bnxt *bp) 5357static int bnxt_nq_rings_in_use(struct bnxt *bp)
5358{ 5358{
5359 int cp = bp->cp_nr_rings; 5359 int cp = bp->cp_nr_rings;
5360 int ulp_msix, ulp_base; 5360 int ulp_msix, ulp_base;
@@ -5369,10 +5369,22 @@ static int bnxt_cp_rings_in_use(struct bnxt *bp)
5369 return cp; 5369 return cp;
5370} 5370}
5371 5371
5372static int bnxt_cp_rings_in_use(struct bnxt *bp)
5373{
5374 int cp;
5375
5376 if (!(bp->flags & BNXT_FLAG_CHIP_P5))
5377 return bnxt_nq_rings_in_use(bp);
5378
5379 cp = bp->tx_nr_rings + bp->rx_nr_rings;
5380 return cp;
5381}
5382
5372static bool bnxt_need_reserve_rings(struct bnxt *bp) 5383static bool bnxt_need_reserve_rings(struct bnxt *bp)
5373{ 5384{
5374 struct bnxt_hw_resc *hw_resc = &bp->hw_resc; 5385 struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
5375 int cp = bnxt_cp_rings_in_use(bp); 5386 int cp = bnxt_cp_rings_in_use(bp);
5387 int nq = bnxt_nq_rings_in_use(bp);
5376 int rx = bp->rx_nr_rings; 5388 int rx = bp->rx_nr_rings;
5377 int vnic = 1, grp = rx; 5389 int vnic = 1, grp = rx;
5378 5390
@@ -5388,7 +5400,7 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
5388 rx <<= 1; 5400 rx <<= 1;
5389 if (BNXT_NEW_RM(bp) && 5401 if (BNXT_NEW_RM(bp) &&
5390 (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp || 5402 (hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
5391 hw_resc->resv_vnics != vnic || 5403 hw_resc->resv_irqs < nq || hw_resc->resv_vnics != vnic ||
5392 (hw_resc->resv_hw_ring_grps != grp && 5404 (hw_resc->resv_hw_ring_grps != grp &&
5393 !(bp->flags & BNXT_FLAG_CHIP_P5)))) 5405 !(bp->flags & BNXT_FLAG_CHIP_P5))))
5394 return true; 5406 return true;
@@ -5398,7 +5410,7 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp)
5398static int __bnxt_reserve_rings(struct bnxt *bp) 5410static int __bnxt_reserve_rings(struct bnxt *bp)
5399{ 5411{
5400 struct bnxt_hw_resc *hw_resc = &bp->hw_resc; 5412 struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
5401 int cp = bnxt_cp_rings_in_use(bp); 5413 int cp = bnxt_nq_rings_in_use(bp);
5402 int tx = bp->tx_nr_rings; 5414 int tx = bp->tx_nr_rings;
5403 int rx = bp->rx_nr_rings; 5415 int rx = bp->rx_nr_rings;
5404 int grp, rx_rings, rc; 5416 int grp, rx_rings, rc;
@@ -5423,7 +5435,7 @@ static int __bnxt_reserve_rings(struct bnxt *bp)
5423 tx = hw_resc->resv_tx_rings; 5435 tx = hw_resc->resv_tx_rings;
5424 if (BNXT_NEW_RM(bp)) { 5436 if (BNXT_NEW_RM(bp)) {
5425 rx = hw_resc->resv_rx_rings; 5437 rx = hw_resc->resv_rx_rings;
5426 cp = hw_resc->resv_cp_rings; 5438 cp = hw_resc->resv_irqs;
5427 grp = hw_resc->resv_hw_ring_grps; 5439 grp = hw_resc->resv_hw_ring_grps;
5428 vnic = hw_resc->resv_vnics; 5440 vnic = hw_resc->resv_vnics;
5429 } 5441 }
@@ -7034,7 +7046,12 @@ unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp)
7034 7046
7035unsigned int bnxt_get_max_func_cp_rings_for_en(struct bnxt *bp) 7047unsigned int bnxt_get_max_func_cp_rings_for_en(struct bnxt *bp)
7036{ 7048{
7037 return bp->hw_resc.max_cp_rings - bnxt_get_ulp_msix_num(bp); 7049 unsigned int cp = bp->hw_resc.max_cp_rings;
7050
7051 if (!(bp->flags & BNXT_FLAG_CHIP_P5))
7052 cp -= bnxt_get_ulp_msix_num(bp);
7053
7054 return cp;
7038} 7055}
7039 7056
7040static unsigned int bnxt_get_max_func_irqs(struct bnxt *bp) 7057static unsigned int bnxt_get_max_func_irqs(struct bnxt *bp)
@@ -7076,7 +7093,7 @@ static int bnxt_get_num_msix(struct bnxt *bp)
7076 if (!BNXT_NEW_RM(bp)) 7093 if (!BNXT_NEW_RM(bp))
7077 return bnxt_get_max_func_irqs(bp); 7094 return bnxt_get_max_func_irqs(bp);
7078 7095
7079 return bnxt_cp_rings_in_use(bp); 7096 return bnxt_nq_rings_in_use(bp);
7080} 7097}
7081 7098
7082static int bnxt_init_msix(struct bnxt *bp) 7099static int bnxt_init_msix(struct bnxt *bp)