mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-13 14:04:05 +08:00
bnxt_en: Simplify bnxt_xdp_buff_init()
bnxt_xdp_buff_init() does not modify the data_ptr or the len parameters,
so no need to pass in the addresses of these parameters.
Fixes: b231c3f341
("bnxt: refactor bnxt_rx_xdp to separate xdp_init_buff/xdp_prepare_buff")
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@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
0020ae2a4a
commit
bbfc17e50b
@ -1925,7 +1925,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
|
||||
dma_addr = rx_buf->mapping;
|
||||
|
||||
if (bnxt_xdp_attached(bp, rxr)) {
|
||||
bnxt_xdp_buff_init(bp, rxr, cons, &data_ptr, &len, &xdp);
|
||||
bnxt_xdp_buff_init(bp, rxr, cons, data_ptr, len, &xdp);
|
||||
if (agg_bufs) {
|
||||
u32 frag_len = bnxt_rx_agg_pages_xdp(bp, cpr, &xdp,
|
||||
cp_cons, agg_bufs,
|
||||
|
@ -177,7 +177,7 @@ bool bnxt_xdp_attached(struct bnxt *bp, struct bnxt_rx_ring_info *rxr)
|
||||
}
|
||||
|
||||
void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
|
||||
u16 cons, u8 **data_ptr, unsigned int *len,
|
||||
u16 cons, u8 *data_ptr, unsigned int len,
|
||||
struct xdp_buff *xdp)
|
||||
{
|
||||
struct bnxt_sw_rx_bd *rx_buf;
|
||||
@ -191,13 +191,13 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
|
||||
offset = bp->rx_offset;
|
||||
|
||||
mapping = rx_buf->mapping - bp->rx_dma_offset;
|
||||
dma_sync_single_for_cpu(&pdev->dev, mapping + offset, *len, bp->rx_dir);
|
||||
dma_sync_single_for_cpu(&pdev->dev, mapping + offset, len, bp->rx_dir);
|
||||
|
||||
if (bp->xdp_has_frags)
|
||||
buflen = BNXT_PAGE_MODE_BUF_SIZE + offset;
|
||||
|
||||
xdp_init_buff(xdp, buflen, &rxr->xdp_rxq);
|
||||
xdp_prepare_buff(xdp, *data_ptr - offset, offset, *len, false);
|
||||
xdp_prepare_buff(xdp, data_ptr - offset, offset, len, false);
|
||||
}
|
||||
|
||||
void bnxt_xdp_buff_frags_free(struct bnxt_rx_ring_info *rxr,
|
||||
|
@ -27,7 +27,7 @@ int bnxt_xdp_xmit(struct net_device *dev, int num_frames,
|
||||
bool bnxt_xdp_attached(struct bnxt *bp, struct bnxt_rx_ring_info *rxr);
|
||||
|
||||
void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
|
||||
u16 cons, u8 **data_ptr, unsigned int *len,
|
||||
u16 cons, u8 *data_ptr, unsigned int len,
|
||||
struct xdp_buff *xdp);
|
||||
void bnxt_xdp_buff_frags_free(struct bnxt_rx_ring_info *rxr,
|
||||
struct xdp_buff *xdp);
|
||||
|
Loading…
Reference in New Issue
Block a user