bnxt_en: Parameterize RX buffer offsets.
Convert the global constants BNXT_RX_OFFSET and BNXT_RX_DMA_OFFSET to device parameters. This will make it easier to support XDP with headroom support which requires different RX buffer offsets. Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
745fc05c9d
commit
b3dba77cf0
|
@ -583,7 +583,7 @@ static inline u8 *__bnxt_alloc_rx_data(struct bnxt *bp, dma_addr_t *mapping,
|
||||||
if (!data)
|
if (!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
*mapping = dma_map_single(&pdev->dev, data + BNXT_RX_DMA_OFFSET,
|
*mapping = dma_map_single(&pdev->dev, data + bp->rx_dma_offset,
|
||||||
bp->rx_buf_use_size, bp->rx_dir);
|
bp->rx_buf_use_size, bp->rx_dir);
|
||||||
|
|
||||||
if (dma_mapping_error(&pdev->dev, *mapping)) {
|
if (dma_mapping_error(&pdev->dev, *mapping)) {
|
||||||
|
@ -607,7 +607,7 @@ static inline int bnxt_alloc_rx_data(struct bnxt *bp,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
rx_buf->data = data;
|
rx_buf->data = data;
|
||||||
rx_buf->data_ptr = data + BNXT_RX_OFFSET;
|
rx_buf->data_ptr = data + bp->rx_offset;
|
||||||
rx_buf->mapping = mapping;
|
rx_buf->mapping = mapping;
|
||||||
|
|
||||||
rxbd->rx_bd_haddr = cpu_to_le64(mapping);
|
rxbd->rx_bd_haddr = cpu_to_le64(mapping);
|
||||||
|
@ -778,7 +778,7 @@ static struct sk_buff *bnxt_rx_skb(struct bnxt *bp,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
skb_reserve(skb, BNXT_RX_OFFSET);
|
skb_reserve(skb, bp->rx_offset);
|
||||||
skb_put(skb, offset_and_len & 0xffff);
|
skb_put(skb, offset_and_len & 0xffff);
|
||||||
return skb;
|
return skb;
|
||||||
}
|
}
|
||||||
|
@ -1255,7 +1255,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
|
||||||
}
|
}
|
||||||
|
|
||||||
tpa_info->data = new_data;
|
tpa_info->data = new_data;
|
||||||
tpa_info->data_ptr = new_data + BNXT_RX_OFFSET;
|
tpa_info->data_ptr = new_data + bp->rx_offset;
|
||||||
tpa_info->mapping = new_mapping;
|
tpa_info->mapping = new_mapping;
|
||||||
|
|
||||||
skb = build_skb(data, 0);
|
skb = build_skb(data, 0);
|
||||||
|
@ -1267,7 +1267,7 @@ static inline struct sk_buff *bnxt_tpa_end(struct bnxt *bp,
|
||||||
bnxt_abort_tpa(bp, bnapi, cp_cons, agg_bufs);
|
bnxt_abort_tpa(bp, bnapi, cp_cons, agg_bufs);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
skb_reserve(skb, BNXT_RX_OFFSET);
|
skb_reserve(skb, bp->rx_offset);
|
||||||
skb_put(skb, len);
|
skb_put(skb, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2332,7 +2332,7 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
rxr->rx_tpa[i].data = data;
|
rxr->rx_tpa[i].data = data;
|
||||||
rxr->rx_tpa[i].data_ptr = data + BNXT_RX_OFFSET;
|
rxr->rx_tpa[i].data_ptr = data + bp->rx_offset;
|
||||||
rxr->rx_tpa[i].mapping = mapping;
|
rxr->rx_tpa[i].mapping = mapping;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2348,6 +2348,9 @@ static int bnxt_init_rx_rings(struct bnxt *bp)
|
||||||
{
|
{
|
||||||
int i, rc = 0;
|
int i, rc = 0;
|
||||||
|
|
||||||
|
bp->rx_offset = BNXT_RX_OFFSET;
|
||||||
|
bp->rx_dma_offset = BNXT_RX_DMA_OFFSET;
|
||||||
|
|
||||||
for (i = 0; i < bp->rx_nr_rings; i++) {
|
for (i = 0; i < bp->rx_nr_rings; i++) {
|
||||||
rc = bnxt_init_one_rx_ring(bp, i);
|
rc = bnxt_init_one_rx_ring(bp, i);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
|
|
@ -997,6 +997,8 @@ struct bnxt {
|
||||||
|
|
||||||
u32 rx_buf_size;
|
u32 rx_buf_size;
|
||||||
u32 rx_buf_use_size; /* useable size */
|
u32 rx_buf_use_size; /* useable size */
|
||||||
|
u16 rx_offset;
|
||||||
|
u16 rx_dma_offset;
|
||||||
enum dma_data_direction rx_dir;
|
enum dma_data_direction rx_dir;
|
||||||
u32 rx_ring_size;
|
u32 rx_ring_size;
|
||||||
u32 rx_agg_ring_size;
|
u32 rx_agg_ring_size;
|
||||||
|
|
Loading…
Reference in New Issue