bnxt_en: Add completion ring pointer in TX and RX ring structures
From the TX or RX ring structure, we need to find the corresponding completion ring during initialization. On P5 chips, we use the MSIX/napi entry to locate the completion ring because there is only one RX/TX ring per MSIX. To allow multiple TX rings for each MSIX, we need to add a direct pointer from the TX ring and RX ring structures. This also simplifies the existing logic. Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d1eec61410
commit
7845b8dfc7
@ -3584,11 +3584,11 @@ static int bnxt_alloc_cp_sub_ring(struct bnxt *bp,
|
||||
static int bnxt_alloc_cp_rings(struct bnxt *bp)
|
||||
{
|
||||
bool sh = !!(bp->flags & BNXT_FLAG_SHARED_RINGS);
|
||||
int i, rc, ulp_base_vec, ulp_msix;
|
||||
int i, j, rc, ulp_base_vec, ulp_msix;
|
||||
|
||||
ulp_msix = bnxt_get_ulp_msix_num(bp);
|
||||
ulp_base_vec = bnxt_get_ulp_msix_base(bp);
|
||||
for (i = 0; i < bp->cp_nr_rings; i++) {
|
||||
for (i = 0, j = 0; i < bp->cp_nr_rings; i++) {
|
||||
struct bnxt_napi *bnapi = bp->bnapi[i];
|
||||
struct bnxt_cp_ring_info *cpr, *cpr2;
|
||||
struct bnxt_ring_struct *ring;
|
||||
@ -3626,6 +3626,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
|
||||
if (rc)
|
||||
return rc;
|
||||
cpr2->bnapi = bnapi;
|
||||
bp->rx_ring[i].rx_cpr = cpr2;
|
||||
}
|
||||
if ((sh && i < bp->tx_nr_rings) ||
|
||||
(!sh && i >= bp->rx_nr_rings)) {
|
||||
@ -3634,6 +3635,7 @@ static int bnxt_alloc_cp_rings(struct bnxt *bp)
|
||||
if (rc)
|
||||
return rc;
|
||||
cpr2->bnapi = bnapi;
|
||||
bp->tx_ring[j++].tx_cpr = cpr2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -4654,6 +4656,8 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init)
|
||||
BNXT_RMEM_RING_PTE_FLAG;
|
||||
rxr->rx_agg_ring_struct.ring_mem.flags =
|
||||
BNXT_RMEM_RING_PTE_FLAG;
|
||||
} else {
|
||||
rxr->rx_cpr = &bp->bnapi[i]->cp_ring;
|
||||
}
|
||||
rxr->bnapi = bp->bnapi[i];
|
||||
bp->bnapi[i]->rx_ring = &bp->rx_ring[i];
|
||||
@ -4682,6 +4686,8 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool irq_re_init)
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
txr->tx_ring_struct.ring_mem.flags =
|
||||
BNXT_RMEM_RING_PTE_FLAG;
|
||||
else
|
||||
txr->tx_cpr = &bp->bnapi[i]->cp_ring;
|
||||
txr->bnapi = bp->bnapi[j];
|
||||
bp->bnapi[j]->tx_ring = txr;
|
||||
bp->tx_ring_map[i] = bp->tx_nr_rings_xdp + i;
|
||||
@ -5242,28 +5248,18 @@ static u16 bnxt_cp_ring_from_grp(struct bnxt *bp, struct bnxt_ring_struct *ring)
|
||||
|
||||
static u16 bnxt_cp_ring_for_rx(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
|
||||
{
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
struct bnxt_napi *bnapi = rxr->bnapi;
|
||||
struct bnxt_cp_ring_info *cpr;
|
||||
|
||||
cpr = &bnapi->cp_ring.cp_ring_arr[BNXT_RX_HDL];
|
||||
return cpr->cp_ring_struct.fw_ring_id;
|
||||
} else {
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
return rxr->rx_cpr->cp_ring_struct.fw_ring_id;
|
||||
else
|
||||
return bnxt_cp_ring_from_grp(bp, &rxr->rx_ring_struct);
|
||||
}
|
||||
}
|
||||
|
||||
static u16 bnxt_cp_ring_for_tx(struct bnxt *bp, struct bnxt_tx_ring_info *txr)
|
||||
{
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
struct bnxt_napi *bnapi = txr->bnapi;
|
||||
struct bnxt_cp_ring_info *cpr;
|
||||
|
||||
cpr = &bnapi->cp_ring.cp_ring_arr[BNXT_TX_HDL];
|
||||
return cpr->cp_ring_struct.fw_ring_id;
|
||||
} else {
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
return txr->tx_cpr->cp_ring_struct.fw_ring_id;
|
||||
else
|
||||
return bnxt_cp_ring_from_grp(bp, &txr->tx_ring_struct);
|
||||
}
|
||||
}
|
||||
|
||||
static int bnxt_alloc_rss_indir_tbl(struct bnxt *bp)
|
||||
@ -6022,12 +6018,10 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
|
||||
u32 map_idx;
|
||||
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
struct bnxt_cp_ring_info *cpr2 = txr->tx_cpr;
|
||||
struct bnxt_napi *bnapi = txr->bnapi;
|
||||
struct bnxt_cp_ring_info *cpr, *cpr2;
|
||||
u32 type2 = HWRM_RING_ALLOC_CMPL;
|
||||
|
||||
cpr = &bnapi->cp_ring;
|
||||
cpr2 = &cpr->cp_ring_arr[BNXT_TX_HDL];
|
||||
ring = &cpr2->cp_ring_struct;
|
||||
ring->handle = BNXT_TX_HDL;
|
||||
map_idx = bnapi->index;
|
||||
@ -6062,11 +6056,9 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp)
|
||||
bnxt_db_write(bp, &rxr->rx_db, rxr->rx_prod);
|
||||
bp->grp_info[map_idx].rx_fw_ring_id = ring->fw_ring_id;
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5) {
|
||||
struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring;
|
||||
struct bnxt_cp_ring_info *cpr2 = rxr->rx_cpr;
|
||||
u32 type2 = HWRM_RING_ALLOC_CMPL;
|
||||
struct bnxt_cp_ring_info *cpr2;
|
||||
|
||||
cpr2 = &cpr->cp_ring_arr[BNXT_RX_HDL];
|
||||
ring = &cpr2->cp_ring_struct;
|
||||
ring->handle = BNXT_RX_HDL;
|
||||
rc = hwrm_ring_alloc_send_msg(bp, ring, type2, map_idx);
|
||||
|
@ -806,6 +806,7 @@ struct bnxt_db_info {
|
||||
|
||||
struct bnxt_tx_ring_info {
|
||||
struct bnxt_napi *bnapi;
|
||||
struct bnxt_cp_ring_info *tx_cpr;
|
||||
u16 tx_prod;
|
||||
u16 tx_cons;
|
||||
u16 tx_hw_cons;
|
||||
@ -916,6 +917,7 @@ struct bnxt_tpa_idx_map {
|
||||
|
||||
struct bnxt_rx_ring_info {
|
||||
struct bnxt_napi *bnapi;
|
||||
struct bnxt_cp_ring_info *rx_cpr;
|
||||
u16 rx_prod;
|
||||
u16 rx_agg_prod;
|
||||
u16 rx_sw_agg_prod;
|
||||
|
@ -3941,7 +3941,7 @@ static int bnxt_run_loopback(struct bnxt *bp)
|
||||
|
||||
cpr = &rxr->bnapi->cp_ring;
|
||||
if (bp->flags & BNXT_FLAG_CHIP_P5)
|
||||
cpr = &cpr->cp_ring_arr[BNXT_RX_HDL];
|
||||
cpr = rxr->rx_cpr;
|
||||
pkt_size = min(bp->dev->mtu + ETH_HLEN, bp->rx_copy_thresh);
|
||||
skb = netdev_alloc_skb(bp->dev, pkt_size);
|
||||
if (!skb)
|
||||
|
Loading…
x
Reference in New Issue
Block a user