mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-25 03:46:17 +00:00
bnxt_en: Fix XDP RX path
[ Upstream commit9b3e607871
] The XDP program can change the starting address of the RX data buffer and this information needs to be passed back from bnxt_rx_xdp() to bnxt_rx_pkt() for the XDP_PASS case so that the SKB can point correctly to the modified buffer address. Add back the data_ptr parameter to bnxt_rx_xdp() to make this work. 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: 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>
This commit is contained in:
parent
9bf7939f91
commit
57e2176bac
3 changed files with 8 additions and 5 deletions
|
@ -1937,7 +1937,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr,
|
|||
}
|
||||
|
||||
if (xdp_active) {
|
||||
if (bnxt_rx_xdp(bp, rxr, cons, xdp, data, &len, event)) {
|
||||
if (bnxt_rx_xdp(bp, rxr, cons, xdp, data, &data_ptr, &len, event)) {
|
||||
rc = 1;
|
||||
goto next_rx;
|
||||
}
|
||||
|
|
|
@ -222,7 +222,8 @@ void bnxt_xdp_buff_frags_free(struct bnxt_rx_ring_info *rxr,
|
|||
* false - packet should be passed to the stack.
|
||||
*/
|
||||
bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
|
||||
struct xdp_buff xdp, struct page *page, unsigned int *len, u8 *event)
|
||||
struct xdp_buff xdp, struct page *page, u8 **data_ptr,
|
||||
unsigned int *len, u8 *event)
|
||||
{
|
||||
struct bpf_prog *xdp_prog = READ_ONCE(rxr->xdp_prog);
|
||||
struct bnxt_tx_ring_info *txr;
|
||||
|
@ -255,8 +256,10 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
|
|||
*event &= ~BNXT_RX_EVENT;
|
||||
|
||||
*len = xdp.data_end - xdp.data;
|
||||
if (orig_data != xdp.data)
|
||||
if (orig_data != xdp.data) {
|
||||
offset = xdp.data - xdp.data_hard_start;
|
||||
*data_ptr = xdp.data_hard_start + offset;
|
||||
}
|
||||
|
||||
switch (act) {
|
||||
case XDP_PASS:
|
||||
|
|
|
@ -18,8 +18,8 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp,
|
|||
struct xdp_buff *xdp);
|
||||
void bnxt_tx_int_xdp(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts);
|
||||
bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
|
||||
struct xdp_buff xdp, struct page *page, unsigned int *len,
|
||||
u8 *event);
|
||||
struct xdp_buff xdp, struct page *page, u8 **data_ptr,
|
||||
unsigned int *len, u8 *event);
|
||||
int bnxt_xdp(struct net_device *dev, struct netdev_bpf *xdp);
|
||||
int bnxt_xdp_xmit(struct net_device *dev, int num_frames,
|
||||
struct xdp_frame **frames, u32 flags);
|
||||
|
|
Loading…
Reference in a new issue