Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions drivers/net/veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,8 @@ static struct sk_buff *veth_xdp_rcv_skb(struct veth_rq *rq,
orig_data = xdp->data;
orig_data_end = xdp->data_end;

xdp_update_mem_type(xdp);

act = bpf_prog_run_xdp(xdp_prog, xdp);

switch (act) {
Expand Down
7 changes: 7 additions & 0 deletions include/net/xdp.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ xdp_update_skb_frags_info(struct sk_buff *skb, u8 nr_frags,
skb->unreadable |= !!(xdp_flags & XDP_FLAGS_FRAGS_UNREADABLE);
}

static inline void
xdp_update_mem_type(struct xdp_buff *xdp)
{
xdp->rxq->mem.type = page_pool_page_is_pp(virt_to_page(xdp->data)) ?
MEM_TYPE_PAGE_POOL : MEM_TYPE_PAGE_SHARED;
}

/* Avoids inlining WARN macro in fast-path */
void xdp_warn(const char *msg, const char *func, const int line);
#define XDP_WARN(msg) xdp_warn(msg, __func__, __LINE__)
Expand Down
2 changes: 2 additions & 0 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5357,6 +5357,8 @@ u32 bpf_prog_run_generic_xdp(struct sk_buff *skb, struct xdp_buff *xdp,
orig_bcast = is_multicast_ether_addr_64bits(eth->h_dest);
orig_eth_type = eth->h_proto;

xdp_update_mem_type(xdp);

act = bpf_prog_run_xdp(xdp_prog, xdp);

/* check if bpf_xdp_adjust_head was used */
Expand Down
Loading