bnxt_en: Simplify bnxt_xdp_buff_init()
authorMichael Chan <michael.chan@broadcom.com>
Tue, 27 Dec 2022 03:19:37 +0000 (22:19 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:03 +0000 (12:02 +0100)
[ Upstream commit bbfc17e50ba2ed18dfef46b1c433d50a58566bf1 ]

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: b231c3f3414c ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.h

index 9f8a6ce4b356f41acf9d55feee4358a134469478..0166c99cb7c6526c20fe83de97028040cd1cd0bf 100644 (file)
@@ -1922,7 +1922,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,
index c3065ec0a47981064c133ec9bff25bf44e3eefd0..1847f191577d1ea20606f4440fc809554b0c17da 100644 (file)
@@ -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,
index 505911ae095d33b081d0748748f3908cf2fcd4a5..2bbdb8e7c506b93b8705ef8c7fac0cb2343846dd 100644 (file)
@@ -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);