summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorKumar Kartikeya Dwivedi <memxor@gmail.com>2021-07-02 16:48:21 +0530
committerAlexei Starovoitov <ast@kernel.org>2021-07-07 20:01:45 -0700
commitfe21cb91ae7bca1ae7805454be80b6d03bec85f7 (patch)
tree91a88140fb07744b5809d5791e6c1e99896de020 /include/linux
parenta080cdccc93da8754e4a20aea4f9c5fcc448547f (diff)
downloadlinux-stable-fe21cb91ae7bca1ae7805454be80b6d03bec85f7.tar.gz
linux-stable-fe21cb91ae7bca1ae7805454be80b6d03bec85f7.tar.bz2
linux-stable-fe21cb91ae7bca1ae7805454be80b6d03bec85f7.zip
net: core: Split out code to run generic XDP prog
This helper can later be utilized in code that runs cpumap and devmap programs in generic redirect mode and adjust skb based on changes made to xdp_buff. When returning XDP_REDIRECT/XDP_TX, it invokes __skb_push, so whenever a generic redirect path invokes devmap/cpumap prog if set, it must __skb_pull again as we expect mac header to be pulled. It also drops the skb_reset_mac_len call after do_xdp_generic, as the mac_header and network_header are advanced by the same offset, so the difference (mac_len) remains constant. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com> Link: https://lore.kernel.org/bpf/20210702111825.491065-2-memxor@gmail.com
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index eaf5bb008aa9..42f6f866d5f3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3984,6 +3984,8 @@ static inline void dev_consume_skb_any(struct sk_buff *skb)
__dev_kfree_skb_any(skb, SKB_REASON_CONSUMED);
}
+u32 bpf_prog_run_generic_xdp(struct sk_buff *skb, struct xdp_buff *xdp,
+ struct bpf_prog *xdp_prog);
void generic_xdp_tx(struct sk_buff *skb, struct bpf_prog *xdp_prog);
int do_xdp_generic(struct bpf_prog *xdp_prog, struct sk_buff *skb);
int netif_rx(struct sk_buff *skb);