+48
-12
drivers/net/ethernet/broadcom/bnxt/bnxt.c
+48
-12
drivers/net/ethernet/broadcom/bnxt/bnxt.c
···
5162
5162
cp = le16_to_cpu(resp->alloc_cmpl_rings);
5163
5163
stats = le16_to_cpu(resp->alloc_stat_ctx);
5164
5164
cp = min_t(u16, cp, stats);
5165
+
hw_resc->resv_irqs = cp;
5165
5166
if (bp->flags & BNXT_FLAG_CHIP_P5) {
5166
5167
int rx = hw_resc->resv_rx_rings;
5167
5168
int tx = hw_resc->resv_tx_rings;
···
5176
5175
hw_resc->resv_rx_rings = rx;
5177
5176
hw_resc->resv_tx_rings = tx;
5178
5177
}
5179
-
cp = le16_to_cpu(resp->alloc_msix);
5178
+
hw_resc->resv_irqs = le16_to_cpu(resp->alloc_msix);
5180
5179
hw_resc->resv_hw_ring_grps = rx;
5181
5180
}
5182
5181
hw_resc->resv_cp_rings = cp;
···
5354
5353
return bnxt_hwrm_reserve_vf_rings(bp, tx, rx, grp, cp, vnic);
5355
5354
}
5356
5355
5357
-
static int bnxt_cp_rings_in_use(struct bnxt *bp)
5356
+
static int bnxt_nq_rings_in_use(struct bnxt *bp)
5358
5357
{
5359
5358
int cp = bp->cp_nr_rings;
5360
5359
int ulp_msix, ulp_base;
···
5369
5368
return cp;
5370
5369
}
5371
5370
5371
+
static int bnxt_cp_rings_in_use(struct bnxt *bp)
5372
+
{
5373
+
int cp;
5374
+
5375
+
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
5376
+
return bnxt_nq_rings_in_use(bp);
5377
+
5378
+
cp = bp->tx_nr_rings + bp->rx_nr_rings;
5379
+
return cp;
5380
+
}
5381
+
5372
5382
static bool bnxt_need_reserve_rings(struct bnxt *bp)
5373
5383
{
5374
5384
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
5375
5385
int cp = bnxt_cp_rings_in_use(bp);
5386
+
int nq = bnxt_nq_rings_in_use(bp);
5376
5387
int rx = bp->rx_nr_rings;
5377
5388
int vnic = 1, grp = rx;
5378
5389
···
5400
5387
rx <<= 1;
5401
5388
if (BNXT_NEW_RM(bp) &&
5402
5389
(hw_resc->resv_rx_rings != rx || hw_resc->resv_cp_rings != cp ||
5403
-
hw_resc->resv_vnics != vnic ||
5390
+
hw_resc->resv_irqs < nq || hw_resc->resv_vnics != vnic ||
5404
5391
(hw_resc->resv_hw_ring_grps != grp &&
5405
5392
!(bp->flags & BNXT_FLAG_CHIP_P5))))
5406
5393
return true;
···
5410
5397
static int __bnxt_reserve_rings(struct bnxt *bp)
5411
5398
{
5412
5399
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
5413
-
int cp = bnxt_cp_rings_in_use(bp);
5400
+
int cp = bnxt_nq_rings_in_use(bp);
5414
5401
int tx = bp->tx_nr_rings;
5415
5402
int rx = bp->rx_nr_rings;
5416
5403
int grp, rx_rings, rc;
···
5435
5422
tx = hw_resc->resv_tx_rings;
5436
5423
if (BNXT_NEW_RM(bp)) {
5437
5424
rx = hw_resc->resv_rx_rings;
5438
-
cp = hw_resc->resv_cp_rings;
5425
+
cp = hw_resc->resv_irqs;
5439
5426
grp = hw_resc->resv_hw_ring_grps;
5440
5427
vnic = hw_resc->resv_vnics;
5441
5428
}
···
6305
6292
return rc;
6306
6293
}
6307
6294
6295
+
static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
6296
+
6308
6297
static int bnxt_hwrm_func_qcaps(struct bnxt *bp)
6309
6298
{
6310
6299
int rc;
···
6314
6299
rc = __bnxt_hwrm_func_qcaps(bp);
6315
6300
if (rc)
6316
6301
return rc;
6302
+
rc = bnxt_hwrm_queue_qportcfg(bp);
6303
+
if (rc) {
6304
+
netdev_err(bp->dev, "hwrm query qportcfg failure rc: %d\n", rc);
6305
+
return rc;
6306
+
}
6317
6307
if (bp->hwrm_spec_code >= 0x10803) {
6318
6308
rc = bnxt_alloc_ctx_mem(bp);
6319
6309
if (rc)
···
7046
7026
7047
7027
unsigned int bnxt_get_max_func_cp_rings_for_en(struct bnxt *bp)
7048
7028
{
7049
-
return bp->hw_resc.max_cp_rings - bnxt_get_ulp_msix_num(bp);
7029
+
unsigned int cp = bp->hw_resc.max_cp_rings;
7030
+
7031
+
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
7032
+
cp -= bnxt_get_ulp_msix_num(bp);
7033
+
7034
+
return cp;
7050
7035
}
7051
7036
7052
7037
static unsigned int bnxt_get_max_func_irqs(struct bnxt *bp)
···
7073
7048
int total_req = bp->cp_nr_rings + num;
7074
7049
int max_idx, avail_msix;
7075
7050
7076
-
max_idx = min_t(int, bp->total_irqs, max_cp);
7051
+
max_idx = bp->total_irqs;
7052
+
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
7053
+
max_idx = min_t(int, bp->total_irqs, max_cp);
7077
7054
avail_msix = max_idx - bp->cp_nr_rings;
7078
7055
if (!BNXT_NEW_RM(bp) || avail_msix >= num)
7079
7056
return avail_msix;
···
7093
7066
if (!BNXT_NEW_RM(bp))
7094
7067
return bnxt_get_max_func_irqs(bp);
7095
7068
7096
-
return bnxt_cp_rings_in_use(bp);
7069
+
return bnxt_nq_rings_in_use(bp);
7097
7070
}
7098
7071
7099
7072
static int bnxt_init_msix(struct bnxt *bp)
···
7821
7794
7822
7795
rc = bnxt_hwrm_func_resc_qcaps(bp, true);
7823
7796
hw_resc->resv_cp_rings = 0;
7797
+
hw_resc->resv_irqs = 0;
7824
7798
hw_resc->resv_tx_rings = 0;
7825
7799
hw_resc->resv_rx_rings = 0;
7826
7800
hw_resc->resv_hw_ring_grps = 0;
···
9827
9799
int *max_cp)
9828
9800
{
9829
9801
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
9830
-
int max_ring_grps = 0;
9802
+
int max_ring_grps = 0, max_irq;
9831
9803
9832
9804
*max_tx = hw_resc->max_tx_rings;
9833
9805
*max_rx = hw_resc->max_rx_rings;
9834
-
*max_cp = min_t(int, bnxt_get_max_func_cp_rings_for_en(bp),
9835
-
hw_resc->max_irqs - bnxt_get_ulp_msix_num(bp));
9836
-
*max_cp = min_t(int, *max_cp, hw_resc->max_stat_ctxs);
9806
+
*max_cp = bnxt_get_max_func_cp_rings_for_en(bp);
9807
+
max_irq = min_t(int, bnxt_get_max_func_irqs(bp) -
9808
+
bnxt_get_ulp_msix_num(bp),
9809
+
bnxt_get_max_func_stat_ctxs(bp));
9810
+
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
9811
+
*max_cp = min_t(int, *max_cp, max_irq);
9837
9812
max_ring_grps = hw_resc->max_hw_ring_grps;
9838
9813
if (BNXT_CHIP_TYPE_NITRO_A0(bp) && BNXT_PF(bp)) {
9839
9814
*max_cp -= 1;
···
9844
9813
}
9845
9814
if (bp->flags & BNXT_FLAG_AGG_RINGS)
9846
9815
*max_rx >>= 1;
9816
+
if (bp->flags & BNXT_FLAG_CHIP_P5) {
9817
+
bnxt_trim_rings(bp, max_rx, max_tx, *max_cp, false);
9818
+
/* On P5 chips, max_cp output param should be available NQs */
9819
+
*max_cp = max_irq;
9820
+
}
9847
9821
*max_rx = min_t(int, *max_rx, max_ring_grps);
9848
9822
}
9849
9823
+1
drivers/net/ethernet/broadcom/bnxt/bnxt.h
+1
drivers/net/ethernet/broadcom/bnxt/bnxt.h
+1
-1
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
+1
-1
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c
···
168
168
if (BNXT_NEW_RM(bp)) {
169
169
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
170
170
171
-
avail_msix = hw_resc->resv_cp_rings - bp->cp_nr_rings;
171
+
avail_msix = hw_resc->resv_irqs - bp->cp_nr_rings;
172
172
edev->ulp_tbl[ulp_id].msix_requested = avail_msix;
173
173
}
174
174
bnxt_fill_msix_vecs(bp, ent);