Skip to content

Commit bf1782d

Browse files
spikehkuba-moo
authored andcommitted
bnxt_en: refactor bnxt_alloc_rx_rings() to call bnxt_alloc_rx_agg_bmap()
Refactor bnxt_alloc_rx_rings() to call bnxt_alloc_rx_agg_bmap() for allocating rx_agg_bmap. Reviewed-by: Somnath Kotur <[email protected]> Signed-off-by: David Wei <[email protected]> Reviewed-by: Michael Chan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 5883a3e commit bf1782d

File tree

1 file changed

+16
-20
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+16
-20
lines changed

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

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,6 +3764,19 @@ static int bnxt_alloc_rx_page_pool(struct bnxt *bp,
37643764
return PTR_ERR(pool);
37653765
}
37663766

3767+
static int bnxt_alloc_rx_agg_bmap(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
3768+
{
3769+
u16 mem_size;
3770+
3771+
rxr->rx_agg_bmap_size = bp->rx_agg_ring_mask + 1;
3772+
mem_size = rxr->rx_agg_bmap_size / 8;
3773+
rxr->rx_agg_bmap = kzalloc(mem_size, GFP_KERNEL);
3774+
if (!rxr->rx_agg_bmap)
3775+
return -ENOMEM;
3776+
3777+
return 0;
3778+
}
3779+
37673780
static int bnxt_alloc_rx_rings(struct bnxt *bp)
37683781
{
37693782
int numa_node = dev_to_node(&bp->pdev->dev);
@@ -3808,19 +3821,15 @@ static int bnxt_alloc_rx_rings(struct bnxt *bp)
38083821

38093822
ring->grp_idx = i;
38103823
if (agg_rings) {
3811-
u16 mem_size;
3812-
38133824
ring = &rxr->rx_agg_ring_struct;
38143825
rc = bnxt_alloc_ring(bp, &ring->ring_mem);
38153826
if (rc)
38163827
return rc;
38173828

38183829
ring->grp_idx = i;
3819-
rxr->rx_agg_bmap_size = bp->rx_agg_ring_mask + 1;
3820-
mem_size = rxr->rx_agg_bmap_size / 8;
3821-
rxr->rx_agg_bmap = kzalloc(mem_size, GFP_KERNEL);
3822-
if (!rxr->rx_agg_bmap)
3823-
return -ENOMEM;
3830+
rc = bnxt_alloc_rx_agg_bmap(bp, rxr);
3831+
if (rc)
3832+
return rc;
38243833
}
38253834
}
38263835
if (bp->flags & BNXT_FLAG_TPA)
@@ -15331,19 +15340,6 @@ static const struct netdev_stat_ops bnxt_stat_ops = {
1533115340
.get_base_stats = bnxt_get_base_stats,
1533215341
};
1533315342

15334-
static int bnxt_alloc_rx_agg_bmap(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
15335-
{
15336-
u16 mem_size;
15337-
15338-
rxr->rx_agg_bmap_size = bp->rx_agg_ring_mask + 1;
15339-
mem_size = rxr->rx_agg_bmap_size / 8;
15340-
rxr->rx_agg_bmap = kzalloc(mem_size, GFP_KERNEL);
15341-
if (!rxr->rx_agg_bmap)
15342-
return -ENOMEM;
15343-
15344-
return 0;
15345-
}
15346-
1534715343
static int bnxt_queue_mem_alloc(struct net_device *dev, void *qmem, int idx)
1534815344
{
1534915345
struct bnxt_rx_ring_info *rxr, *clone;

0 commit comments

Comments
 (0)