Skip to content

Commit 75720e6

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Keep track of reserved IRQs.
The new 57500 chips use 1 NQ per MSIX vector, whereas legacy chips use 1 CP ring per MSIX vector. To better unify this, add a resv_irqs field to struct bnxt_hw_resc. On legacy chips, we initialize resv_irqs with resv_cp_rings. On new chips, we initialize it with the allocated MSIX resources. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 804fba4 commit 75720e6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5162,6 +5162,7 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
51625162
cp = le16_to_cpu(resp->alloc_cmpl_rings);
51635163
stats = le16_to_cpu(resp->alloc_stat_ctx);
51645164
cp = min_t(u16, cp, stats);
5165+
hw_resc->resv_irqs = cp;
51655166
if (bp->flags & BNXT_FLAG_CHIP_P5) {
51665167
int rx = hw_resc->resv_rx_rings;
51675168
int tx = hw_resc->resv_tx_rings;
@@ -5175,7 +5176,7 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp)
51755176
hw_resc->resv_rx_rings = rx;
51765177
hw_resc->resv_tx_rings = tx;
51775178
}
5178-
cp = le16_to_cpu(resp->alloc_msix);
5179+
hw_resc->resv_irqs = le16_to_cpu(resp->alloc_msix);
51795180
hw_resc->resv_hw_ring_grps = rx;
51805181
}
51815182
hw_resc->resv_cp_rings = cp;
@@ -7055,7 +7056,9 @@ int bnxt_get_avail_msix(struct bnxt *bp, int num)
70557056
int total_req = bp->cp_nr_rings + num;
70567057
int max_idx, avail_msix;
70577058

7058-
max_idx = min_t(int, bp->total_irqs, max_cp);
7059+
max_idx = bp->total_irqs;
7060+
if (!(bp->flags & BNXT_FLAG_CHIP_P5))
7061+
max_idx = min_t(int, bp->total_irqs, max_cp);
70597062
avail_msix = max_idx - bp->cp_nr_rings;
70607063
if (!BNXT_NEW_RM(bp) || avail_msix >= num)
70617064
return avail_msix;
@@ -7801,6 +7804,7 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
78017804

78027805
rc = bnxt_hwrm_func_resc_qcaps(bp, true);
78037806
hw_resc->resv_cp_rings = 0;
7807+
hw_resc->resv_irqs = 0;
78047808
hw_resc->resv_tx_rings = 0;
78057809
hw_resc->resv_rx_rings = 0;
78067810
hw_resc->resv_hw_ring_grps = 0;

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,7 @@ struct bnxt_hw_resc {
928928
u16 min_stat_ctxs;
929929
u16 max_stat_ctxs;
930930
u16 max_irqs;
931+
u16 resv_irqs;
931932
};
932933

933934
#if defined(CONFIG_BNXT_SRIOV)

drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static int bnxt_req_msix_vecs(struct bnxt_en_dev *edev, int ulp_id,
168168
if (BNXT_NEW_RM(bp)) {
169169
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
170170

171-
avail_msix = hw_resc->resv_cp_rings - bp->cp_nr_rings;
171+
avail_msix = hw_resc->resv_irqs - bp->cp_nr_rings;
172172
edev->ulp_tbl[ulp_id].msix_requested = avail_msix;
173173
}
174174
bnxt_fill_msix_vecs(bp, ent);

0 commit comments

Comments
 (0)