bpf: xdp: Allow head adjustment in XDP prog
This patch allows XDP prog to extend/remove the packet data at the head (like adding or removing header). It is done by adding a new XDP helper bpf_xdp_adjust_head(). It also renames bpf_helper_changes_skb_data() to bpf_helper_changes_pkt_data() to better reflect that XDP prog does not work on skb. This patch adds one "xdp_adjust_head" bit to bpf_prog for the XDP-capable driver to check if the XDP prog requires bpf_xdp_adjust_head() support. The driver can then decide to error out during XDP_SETUP_PROG. Signed-off-by: Martin KaFai Lau <kafai@fb.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Acked-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

szülő
8a03cf2cb7
commit
17bedab272
@@ -2507,6 +2507,11 @@ static int qede_xdp_set(struct qede_dev *edev, struct bpf_prog *prog)
|
||||
{
|
||||
struct qede_reload_args args;
|
||||
|
||||
if (prog && prog->xdp_adjust_head) {
|
||||
DP_ERR(edev, "Does not support bpf_xdp_adjust_head()\n");
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
/* If we're called, there was already a bpf reference increment */
|
||||
args.func = &qede_xdp_reload_func;
|
||||
args.u.new_prog = prog;
|
||||
|
Reference in New Issue
Block a user