diff mbox series

[v20,bpf-next,23/23] xdp: disable XDP_REDIRECT for xdp multi-buff

Message ID a6b33109dea5e82d975ea1ee229f7714d0ffdf77.1639162846.git.lorenzo@kernel.org (mailing list archive)
State New, archived
Delegated to: BPF
Headers show
Series mvneta: introduce XDP multi-buffer support | expand

Checks

Context Check Description
bpf/vmtest-bpf-next success VM_Test
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count fail Series longer than 15 patches (and no cover letter)
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 28 this patch: 28
netdev/cc_maintainers warning 6 maintainers not CCed: kafai@fb.com songliubraving@fb.com hawk@kernel.org kpsingh@kernel.org yhs@fb.com andrii@kernel.org
netdev/build_clang success Errors and warnings before: 22 this patch: 22
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 32 this patch: 32
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 13 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-PR fail merge-conflict

Commit Message

Lorenzo Bianconi Dec. 10, 2021, 7:14 p.m. UTC
XDP_REDIRECT is not fully supported yet for xdp multi-buff since not
all XDP capable drivers can map non-linear xdp_frame in ndo_xdp_xmit
so disable it for the moment.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 net/core/filter.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Jesper Dangaard Brouer Dec. 11, 2021, 6:49 a.m. UTC | #1
On 10/12/2021 20.14, Lorenzo Bianconi wrote:
> XDP_REDIRECT is not fully supported yet for xdp multi-buff since not
> all XDP capable drivers can map non-linear xdp_frame in ndo_xdp_xmit
> so disable it for the moment.
> 
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---

LGTM you addressed my last review comments.

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

I do expect followup patches that add support for ndo_xdp_xmit in drivers...


>   net/core/filter.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 14860931733d..def6e9f451a7 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -4186,6 +4186,13 @@ int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp,
>   	struct bpf_map *map;
>   	int err;
>   
> +	/* XDP_REDIRECT is not fully supported yet for xdp multi-buff since
> +	 * not all XDP capable drivers can map non-linear xdp_frame in
> +	 * ndo_xdp_xmit.
> +	 */
> +	if (unlikely(xdp_buff_is_mb(xdp) && map_type != BPF_MAP_TYPE_CPUMAP))
> +		return -EOPNOTSUPP;
> +
>   	ri->map_id = 0; /* Valid map id idr range: [1,INT_MAX[ */
>   	ri->map_type = BPF_MAP_TYPE_UNSPEC;
>   
>
diff mbox series

Patch

diff --git a/net/core/filter.c b/net/core/filter.c
index 14860931733d..def6e9f451a7 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4186,6 +4186,13 @@  int xdp_do_redirect(struct net_device *dev, struct xdp_buff *xdp,
 	struct bpf_map *map;
 	int err;
 
+	/* XDP_REDIRECT is not fully supported yet for xdp multi-buff since
+	 * not all XDP capable drivers can map non-linear xdp_frame in
+	 * ndo_xdp_xmit.
+	 */
+	if (unlikely(xdp_buff_is_mb(xdp) && map_type != BPF_MAP_TYPE_CPUMAP))
+		return -EOPNOTSUPP;
+
 	ri->map_id = 0; /* Valid map id idr range: [1,INT_MAX[ */
 	ri->map_type = BPF_MAP_TYPE_UNSPEC;