diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2022-01-21 13:10:06 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2022-01-22 01:14:03 +0300 |
commit | ab0db46396ca7a29cb3b5fc206abb5ffa63ad617 (patch) | |
tree | 4a77f5db26ef6560f54a857157adac3dc49290c4 /net/core/filter.c | |
parent | 0c5e118cb4b8a885622f76e528135e86f722ba7f (diff) | |
download | linux-ab0db46396ca7a29cb3b5fc206abb5ffa63ad617.tar.xz |
xdp: disable XDP_REDIRECT for xdp frags
XDP_REDIRECT is not fully supported yet for xdp frags since not
all XDP capable drivers can map non-linear xdp_frame in ndo_xdp_xmit
so disable it for the moment.
Acked-by: Toke Hoiland-Jorgensen <toke@redhat.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://lore.kernel.org/r/0da25e117d0e2673f5d0ce6503393c55c6fb1be9.1642758637.git.lorenzo@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/core/filter.c')
-rw-r--r-- | net/core/filter.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/core/filter.c b/net/core/filter.c index 945ccaaab3cb..a06931c27eeb 100644 --- a/net/core/filter.c +++ b/net/core/filter.c @@ -4266,6 +4266,14 @@ int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp, struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info); enum bpf_map_type map_type = ri->map_type; + /* XDP_REDIRECT is not fully supported yet for xdp frags since + * not all XDP capable drivers can map non-linear xdp_frame in + * ndo_xdp_xmit. + */ + if (unlikely(xdp_buff_has_frags(xdp) && + map_type != BPF_MAP_TYPE_CPUMAP)) + return -EOPNOTSUPP; + if (map_type == BPF_MAP_TYPE_XSKMAP) return __xdp_do_redirect_xsk(ri, dev, xdp, xdp_prog); |