Commit 7dd3de7c authored by Pavan Chebbi's avatar Pavan Chebbi Committed by Jakub Kicinski

bnxt_en: Use PAGE_SIZE to init buffer when multi buffer XDP is not in use

Using BNXT_PAGE_MODE_BUF_SIZE + offset as buffer length value is not
sufficient when running single buffer XDP programs doing redirect
operations. The stack will complain on missing skb tail room. Fix it
by using PAGE_SIZE when calling xdp_init_buff() for single buffer
programs.

Fixes: b231c3f3 ("bnxt: refactor bnxt_rx_xdp to separate xdp_init_buff/xdp_prepare_buff")
Reviewed-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: default avatarPavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 15f7cfae
...@@ -2130,6 +2130,7 @@ struct bnxt { ...@@ -2130,6 +2130,7 @@ struct bnxt {
#define BNXT_DUMP_CRASH 1 #define BNXT_DUMP_CRASH 1
struct bpf_prog *xdp_prog; struct bpf_prog *xdp_prog;
u8 xdp_has_frags;
struct bnxt_ptp_cfg *ptp_cfg; struct bnxt_ptp_cfg *ptp_cfg;
u8 ptp_all_rx_tstamp; u8 ptp_all_rx_tstamp;
......
...@@ -181,6 +181,7 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, ...@@ -181,6 +181,7 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
struct xdp_buff *xdp) struct xdp_buff *xdp)
{ {
struct bnxt_sw_rx_bd *rx_buf; struct bnxt_sw_rx_bd *rx_buf;
u32 buflen = PAGE_SIZE;
struct pci_dev *pdev; struct pci_dev *pdev;
dma_addr_t mapping; dma_addr_t mapping;
u32 offset; u32 offset;
...@@ -192,7 +193,10 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, ...@@ -192,7 +193,10 @@ void bnxt_xdp_buff_init(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
mapping = rx_buf->mapping - bp->rx_dma_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);
xdp_init_buff(xdp, BNXT_PAGE_MODE_BUF_SIZE + offset, &rxr->xdp_rxq); 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);
} }
...@@ -397,8 +401,10 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog) ...@@ -397,8 +401,10 @@ static int bnxt_xdp_set(struct bnxt *bp, struct bpf_prog *prog)
netdev_warn(dev, "ethtool rx/tx channels must be combined to support XDP.\n"); netdev_warn(dev, "ethtool rx/tx channels must be combined to support XDP.\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (prog) if (prog) {
tx_xdp = bp->rx_nr_rings; tx_xdp = bp->rx_nr_rings;
bp->xdp_has_frags = prog->aux->xdp_has_frags;
}
tc = netdev_get_num_tc(dev); tc = netdev_get_num_tc(dev);
if (!tc) if (!tc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment