diff options
| -rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.c | 60 | ||||
| -rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 | ||||
| -rw-r--r-- | drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c | 2 |
3 files changed, 50 insertions, 13 deletions
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index d4c300117529..5d21c14853ac 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c | |||
| @@ -5162,6 +5162,7 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp) | |||
| 5162 | cp = le16_to_cpu(resp->alloc_cmpl_rings); | 5162 | cp = le16_to_cpu(resp->alloc_cmpl_rings); |
| 5163 | stats = le16_to_cpu(resp->alloc_stat_ctx); | 5163 | stats = le16_to_cpu(resp->alloc_stat_ctx); |
| 5164 | cp = min_t(u16, cp, stats); | 5164 | cp = min_t(u16, cp, stats); |
| 5165 | hw_resc->resv_irqs = cp; | ||
| 5165 | if (bp->flags & BNXT_FLAG_CHIP_P5) { | 5166 | if (bp->flags & BNXT_FLAG_CHIP_P5) { |
| 5166 | int rx = hw_resc->resv_rx_rings; | 5167 | int rx = hw_resc->resv_rx_rings; |
| 5167 | int tx = hw_resc->resv_tx_rings; | 5168 | int tx = hw_resc->resv_tx_rings; |
| @@ -5175,7 +5176,7 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp) | |||
| 5175 | hw_resc->resv_rx_rings = rx; | 5176 | hw_resc->resv_rx_rings = rx; |
| 5176 | hw_resc->resv_tx_rings = tx; | 5177 | hw_resc->resv_tx_rings = tx; |
| 5177 | } | 5178 | } |
| 5178 | cp = le16_to_cpu(resp->alloc_msix); | 5179 | hw_resc->resv_irqs = le16_to_cpu(resp->alloc_msix); |
| 5179 | hw_resc->resv_hw_ring_grps = rx; | 5180 | hw_resc->resv_hw_ring_grps = rx; |
| 5180 | } | 5181 | } |
| 5181 | hw_resc->resv_cp_rings = cp; | 5182 | hw_resc->resv_cp_rings = cp; |
| @@ -5353,7 +5354,7 @@ static int bnxt_hwrm_reserve_rings(struct bnxt *bp, int tx, int rx, int grp, | |||
| 5353 | 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); |
| 5354 | } | 5355 | } |
| 5355 | 5356 | ||
| 5356 | static int bnxt_cp_rings_in_use(struct bnxt *bp) | 5357 | static int bnxt_nq_rings_in_use(struct bnxt *bp) |
| 5357 | { | 5358 | { |
| 5358 | int cp = bp->cp_nr_rings; | 5359 | int cp = bp->cp_nr_rings; |
| 5359 | int ulp_msix, ulp_base; | 5360 | int ulp_msix, ulp_base; |
| @@ -5368,10 +5369,22 @@ static int bnxt_cp_rings_in_use(struct bnxt *bp) | |||
| 5368 | return cp; | 5369 | return cp; |
| 5369 | } | 5370 | } |
| 5370 | 5371 | ||
| 5372 | static 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 | |||
| 5371 | static bool bnxt_need_reserve_rings(struct bnxt *bp) | 5383 | static bool bnxt_need_reserve_rings(struct bnxt *bp) |
| 5372 | { | 5384 | { |
| 5373 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; | 5385 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; |
| 5374 | 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); | ||
| 5375 | int rx = bp->rx_nr_rings; | 5388 | int rx = bp->rx_nr_rings; |
| 5376 | int vnic = 1, grp = rx; | 5389 | int vnic = 1, grp = rx; |
| 5377 | 5390 | ||
| @@ -5387,7 +5400,7 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp) | |||
| 5387 | rx <<= 1; | 5400 | rx <<= 1; |
| 5388 | if (BNXT_NEW_RM(bp) && | 5401 | if (BNXT_NEW_RM(bp) && |
| 5389 | (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 || |
| 5390 | hw_resc->resv_vnics != vnic || | 5403 | hw_resc->resv_irqs < nq || hw_resc->resv_vnics != vnic || |
| 5391 | (hw_resc->resv_hw_ring_grps != grp && | 5404 | (hw_resc->resv_hw_ring_grps != grp && |
| 5392 | !(bp->flags & BNXT_FLAG_CHIP_P5)))) | 5405 | !(bp->flags & BNXT_FLAG_CHIP_P5)))) |
| 5393 | return true; | 5406 | return true; |
| @@ -5397,7 +5410,7 @@ static bool bnxt_need_reserve_rings(struct bnxt *bp) | |||
| 5397 | static int __bnxt_reserve_rings(struct bnxt *bp) | 5410 | static int __bnxt_reserve_rings(struct bnxt *bp) |
| 5398 | { | 5411 | { |
| 5399 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; | 5412 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; |
| 5400 | int cp = bnxt_cp_rings_in_use(bp); | 5413 | int cp = bnxt_nq_rings_in_use(bp); |
| 5401 | int tx = bp->tx_nr_rings; | 5414 | int tx = bp->tx_nr_rings; |
| 5402 | int rx = bp->rx_nr_rings; | 5415 | int rx = bp->rx_nr_rings; |
| 5403 | int grp, rx_rings, rc; | 5416 | int grp, rx_rings, rc; |
| @@ -5422,7 +5435,7 @@ static int __bnxt_reserve_rings(struct bnxt *bp) | |||
| 5422 | tx = hw_resc->resv_tx_rings; | 5435 | tx = hw_resc->resv_tx_rings; |
| 5423 | if (BNXT_NEW_RM(bp)) { | 5436 | if (BNXT_NEW_RM(bp)) { |
| 5424 | rx = hw_resc->resv_rx_rings; | 5437 | rx = hw_resc->resv_rx_rings; |
| 5425 | cp = hw_resc->resv_cp_rings; | 5438 | cp = hw_resc->resv_irqs; |
| 5426 | grp = hw_resc->resv_hw_ring_grps; | 5439 | grp = hw_resc->resv_hw_ring_grps; |
| 5427 | vnic = hw_resc->resv_vnics; | 5440 | vnic = hw_resc->resv_vnics; |
| 5428 | } | 5441 | } |
| @@ -6292,6 +6305,8 @@ hwrm_func_qcaps_exit: | |||
| 6292 | return rc; | 6305 | return rc; |
| 6293 | } | 6306 | } |
| 6294 | 6307 | ||
| 6308 | static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp); | ||
| 6309 | |||
| 6295 | static int bnxt_hwrm_func_qcaps(struct bnxt *bp) | 6310 | static int bnxt_hwrm_func_qcaps(struct bnxt *bp) |
| 6296 | { | 6311 | { |
| 6297 | int rc; | 6312 | int rc; |
| @@ -6299,6 +6314,11 @@ static int bnxt_hwrm_func_qcaps(struct bnxt *bp) | |||
| 6299 | rc = __bnxt_hwrm_func_qcaps(bp); | 6314 | rc = __bnxt_hwrm_func_qcaps(bp); |
| 6300 | if (rc) | 6315 | if (rc) |
| 6301 | return rc; | 6316 | return rc; |
| 6317 | rc = bnxt_hwrm_queue_qportcfg(bp); | ||
| 6318 | if (rc) { | ||
| 6319 | netdev_err(bp->dev, "hwrm query qportcfg failure rc: %d\n", rc); | ||
| 6320 | return rc; | ||
| 6321 | } | ||
| 6302 | if (bp->hwrm_spec_code >= 0x10803) { | 6322 | if (bp->hwrm_spec_code >= 0x10803) { |
| 6303 | rc = bnxt_alloc_ctx_mem(bp); | 6323 | rc = bnxt_alloc_ctx_mem(bp); |
| 6304 | if (rc) | 6324 | if (rc) |
| @@ -7026,7 +7046,12 @@ unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp) | |||
| 7026 | 7046 | ||
| 7027 | unsigned int bnxt_get_max_func_cp_rings_for_en(struct bnxt *bp) | 7047 | unsigned int bnxt_get_max_func_cp_rings_for_en(struct bnxt *bp) |
| 7028 | { | 7048 | { |
| 7029 | 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; | ||
| 7030 | } | 7055 | } |
| 7031 | 7056 | ||
| 7032 | static unsigned int bnxt_get_max_func_irqs(struct bnxt *bp) | 7057 | static unsigned int bnxt_get_max_func_irqs(struct bnxt *bp) |
| @@ -7048,7 +7073,9 @@ int bnxt_get_avail_msix(struct bnxt *bp, int num) | |||
| 7048 | int total_req = bp->cp_nr_rings + num; | 7073 | int total_req = bp->cp_nr_rings + num; |
| 7049 | int max_idx, avail_msix; | 7074 | int max_idx, avail_msix; |
| 7050 | 7075 | ||
| 7051 | max_idx = min_t(int, bp->total_irqs, max_cp); | 7076 | max_idx = bp->total_irqs; |
| 7077 | if (!(bp->flags & BNXT_FLAG_CHIP_P5)) | ||
| 7078 | max_idx = min_t(int, bp->total_irqs, max_cp); | ||
| 7052 | avail_msix = max_idx - bp->cp_nr_rings; | 7079 | avail_msix = max_idx - bp->cp_nr_rings; |
| 7053 | if (!BNXT_NEW_RM(bp) || avail_msix >= num) | 7080 | if (!BNXT_NEW_RM(bp) || avail_msix >= num) |
| 7054 | return avail_msix; | 7081 | return avail_msix; |
| @@ -7066,7 +7093,7 @@ static int bnxt_get_num_msix(struct bnxt *bp) | |||
| 7066 | if (!BNXT_NEW_RM(bp)) | 7093 | if (!BNXT_NEW_RM(bp)) |
| 7067 | return bnxt_get_max_func_irqs(bp); | 7094 | return bnxt_get_max_func_irqs(bp); |
| 7068 | 7095 | ||
| 7069 | return bnxt_cp_rings_in_use(bp); | 7096 | return bnxt_nq_rings_in_use(bp); |
| 7070 | } | 7097 | } |
| 7071 | 7098 | ||
| 7072 | static int bnxt_init_msix(struct bnxt *bp) | 7099 | static int bnxt_init_msix(struct bnxt *bp) |
| @@ -7794,6 +7821,7 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) | |||
| 7794 | 7821 | ||
| 7795 | rc = bnxt_hwrm_func_resc_qcaps(bp, true); | 7822 | rc = bnxt_hwrm_func_resc_qcaps(bp, true); |
| 7796 | hw_resc->resv_cp_rings = 0; | 7823 | hw_resc->resv_cp_rings = 0; |
| 7824 | hw_resc->resv_irqs = 0; | ||
| 7797 | hw_resc->resv_tx_rings = 0; | 7825 | hw_resc->resv_tx_rings = 0; |
| 7798 | hw_resc->resv_rx_rings = 0; | 7826 | hw_resc->resv_rx_rings = 0; |
| 7799 | hw_resc->resv_hw_ring_grps = 0; | 7827 | hw_resc->resv_hw_ring_grps = 0; |
| @@ -9799,13 +9827,16 @@ static void _bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, | |||
| 9799 | int *max_cp) | 9827 | int *max_cp) |
| 9800 | { | 9828 | { |
| 9801 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; | 9829 | struct bnxt_hw_resc *hw_resc = &bp->hw_resc; |
| 9802 | int max_ring_grps = 0; | 9830 | int max_ring_grps = 0, max_irq; |
| 9803 | 9831 | ||
| 9804 | *max_tx = hw_resc->max_tx_rings; | 9832 | *max_tx = hw_resc->max_tx_rings; |
| 9805 | *max_rx = hw_resc->max_rx_rings; | 9833 | *max_rx = hw_resc->max_rx_rings; |
| 9806 | *max_cp = min_t(int, bnxt_get_max_func_cp_rings_for_en(bp), | 9834 | *max_cp = bnxt_get_max_func_cp_rings_for_en(bp); |
| 9807 | hw_resc->max_irqs - bnxt_get_ulp_msix_num(bp)); | 9835 | max_irq = min_t(int, bnxt_get_max_func_irqs(bp) - |
| 9808 | *max_cp = min_t(int, *max_cp, hw_resc->max_stat_ctxs); | 9836 | bnxt_get_ulp_msix_num(bp), |
| 9837 | bnxt_get_max_func_stat_ctxs(bp)); | ||
| 9838 | if (!(bp->flags & BNXT_FLAG_CHIP_P5)) | ||
