diff mbox series

[v2,bpf-next,13/22] xsk: report ZC multi-buffer capability via xdp_features

Message ID 20230529155024.222213-14-maciej.fijalkowski@intel.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series xsk: multi-buffer support | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-8 success Logs for test_maps on s390x with gcc
netdev/series_format fail Series longer than 15 patches (and no cover letter)
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 4173 this patch: 4173
netdev/cc_maintainers warning 8 maintainers not CCed: kuba@kernel.org hawk@kernel.org pabeni@redhat.com john.fastabend@gmail.com davem@davemloft.net jonathan.lemon@gmail.com lorenzo@kernel.org edumazet@google.com
netdev/build_clang success Errors and warnings before: 921 this patch: 921
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4392 this patch: 4392
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 22 lines checked
netdev/kdoc fail Errors and warnings before: 1 this patch: 2
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-7 success Logs for test_maps on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-10 success Logs for test_maps on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-19 success Logs for test_progs_no_alu32_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-22 success Logs for test_progs_parallel on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-25 success Logs for test_verifier on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-27 success Logs for test_verifier on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-28 success Logs for test_verifier on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-29 success Logs for veristat
bpf/vmtest-bpf-next-VM_Test-9 success Logs for test_maps on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-11 success Logs for test_progs on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-13 fail Logs for test_progs on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-14 fail Logs for test_progs on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-15 success Logs for test_progs_no_alu32 on aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-17 fail Logs for test_progs_no_alu32 on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-18 fail Logs for test_progs_no_alu32 on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-20 success Logs for test_progs_no_alu32_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-21 success Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-23 success Logs for test_progs_parallel on x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-24 success Logs for test_progs_parallel on x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-26 success Logs for test_verifier on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-16 fail Logs for test_progs_no_alu32 on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-12 fail Logs for test_progs on s390x with gcc
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-6 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-2 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-4 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-5 success Logs for build for x86_64 with llvm-16

Commit Message

Maciej Fijalkowski May 29, 2023, 3:50 p.m. UTC
Introduce new xdp_feature NETDEV_XDP_ACT_NDO_ZC_SG that will be used to
find out if user space that wants to do ZC multi-buffer will be able to
do so against underlying ZC driver.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
 include/uapi/linux/netdev.h | 4 ++--
 net/xdp/xsk_buff_pool.c     | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Simon Horman May 30, 2023, 11:55 a.m. UTC | #1
On Mon, May 29, 2023 at 05:50:15PM +0200, Maciej Fijalkowski wrote:
> Introduce new xdp_feature NETDEV_XDP_ACT_NDO_ZC_SG that will be used to
> find out if user space that wants to do ZC multi-buffer will be able to
> do so against underlying ZC driver.
> 
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  include/uapi/linux/netdev.h | 4 ++--
>  net/xdp/xsk_buff_pool.c     | 6 ++++++
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> index 639524b59930..bfca07224f7b 100644
> --- a/include/uapi/linux/netdev.h
> +++ b/include/uapi/linux/netdev.h
> @@ -33,8 +33,8 @@ enum netdev_xdp_act {
>  	NETDEV_XDP_ACT_HW_OFFLOAD = 16,
>  	NETDEV_XDP_ACT_RX_SG = 32,
>  	NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
> -
> -	NETDEV_XDP_ACT_MASK = 127,
> +	NETDEV_XDP_ACT_NDO_ZC_SG = 128,

Hi Maciej,

Please consider adding NETDEV_XDP_ACT_NDO_ZC_SG to the Kernel doc
a just above netdev_xdp_act.

> +	NETDEV_XDP_ACT_MASK = 255,
>  };
>  
>  enum {

...
Maciej Fijalkowski May 30, 2023, 12:31 p.m. UTC | #2
On Tue, May 30, 2023 at 01:55:45PM +0200, Simon Horman wrote:
> On Mon, May 29, 2023 at 05:50:15PM +0200, Maciej Fijalkowski wrote:
> > Introduce new xdp_feature NETDEV_XDP_ACT_NDO_ZC_SG that will be used to
> > find out if user space that wants to do ZC multi-buffer will be able to
> > do so against underlying ZC driver.
> > 
> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > ---
> >  include/uapi/linux/netdev.h | 4 ++--
> >  net/xdp/xsk_buff_pool.c     | 6 ++++++
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> > index 639524b59930..bfca07224f7b 100644
> > --- a/include/uapi/linux/netdev.h
> > +++ b/include/uapi/linux/netdev.h
> > @@ -33,8 +33,8 @@ enum netdev_xdp_act {
> >  	NETDEV_XDP_ACT_HW_OFFLOAD = 16,
> >  	NETDEV_XDP_ACT_RX_SG = 32,
> >  	NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
> > -
> > -	NETDEV_XDP_ACT_MASK = 127,
> > +	NETDEV_XDP_ACT_NDO_ZC_SG = 128,
> 
> Hi Maciej,
> 
> Please consider adding NETDEV_XDP_ACT_NDO_ZC_SG to the Kernel doc
> a just above netdev_xdp_act.

right, my bad. i'll do this in next rev but i'd like to gather more
feedback from people. thanks once again for spotting an issue.

> 
> > +	NETDEV_XDP_ACT_MASK = 255,
> >  };
> >  
> >  enum {
> 
> ...
Simon Horman May 30, 2023, 7:57 p.m. UTC | #3
On Tue, May 30, 2023 at 02:31:20PM +0200, Maciej Fijalkowski wrote:
> On Tue, May 30, 2023 at 01:55:45PM +0200, Simon Horman wrote:
> > On Mon, May 29, 2023 at 05:50:15PM +0200, Maciej Fijalkowski wrote:
> > > Introduce new xdp_feature NETDEV_XDP_ACT_NDO_ZC_SG that will be used to
> > > find out if user space that wants to do ZC multi-buffer will be able to
> > > do so against underlying ZC driver.
> > > 
> > > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > > ---
> > >  include/uapi/linux/netdev.h | 4 ++--
> > >  net/xdp/xsk_buff_pool.c     | 6 ++++++
> > >  2 files changed, 8 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> > > index 639524b59930..bfca07224f7b 100644
> > > --- a/include/uapi/linux/netdev.h
> > > +++ b/include/uapi/linux/netdev.h
> > > @@ -33,8 +33,8 @@ enum netdev_xdp_act {
> > >  	NETDEV_XDP_ACT_HW_OFFLOAD = 16,
> > >  	NETDEV_XDP_ACT_RX_SG = 32,
> > >  	NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
> > > -
> > > -	NETDEV_XDP_ACT_MASK = 127,
> > > +	NETDEV_XDP_ACT_NDO_ZC_SG = 128,
> > 
> > Hi Maciej,
> > 
> > Please consider adding NETDEV_XDP_ACT_NDO_ZC_SG to the Kernel doc
> > a just above netdev_xdp_act.
> 
> right, my bad. i'll do this in next rev but i'd like to gather more
> feedback from people. thanks once again for spotting an issue.

Thanks, good plan.
Magnus Karlsson May 31, 2023, 10:16 a.m. UTC | #4
On Mon, 29 May 2023 at 17:57, Maciej Fijalkowski
<maciej.fijalkowski@intel.com> wrote:
>
> Introduce new xdp_feature NETDEV_XDP_ACT_NDO_ZC_SG that will be used to
> find out if user space that wants to do ZC multi-buffer will be able to
> do so against underlying ZC driver.
>
> Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
>  include/uapi/linux/netdev.h | 4 ++--
>  net/xdp/xsk_buff_pool.c     | 6 ++++++
>  2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> index 639524b59930..bfca07224f7b 100644
> --- a/include/uapi/linux/netdev.h
> +++ b/include/uapi/linux/netdev.h
> @@ -33,8 +33,8 @@ enum netdev_xdp_act {
>         NETDEV_XDP_ACT_HW_OFFLOAD = 16,
>         NETDEV_XDP_ACT_RX_SG = 32,
>         NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
> -
> -       NETDEV_XDP_ACT_MASK = 127,
> +       NETDEV_XDP_ACT_NDO_ZC_SG = 128,

Since this flag has nothing to do with an NDO, I would prefer the
simpler NETDEV_XDP_ACT_ZC_SG. What do you think?

> +       NETDEV_XDP_ACT_MASK = 255,
>  };
>
>  enum {
> diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> index 0a9f8ea68de3..43cca5fa90cf 100644
> --- a/net/xdp/xsk_buff_pool.c
> +++ b/net/xdp/xsk_buff_pool.c
> @@ -189,6 +189,12 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
>                 goto err_unreg_pool;
>         }
>
> +       if (!(netdev->xdp_features & NETDEV_XDP_ACT_NDO_ZC_SG) &&
> +           flags & XDP_USE_SG) {
> +               err = -EOPNOTSUPP;
> +               goto err_unreg_pool;
> +       }
> +
>         bpf.command = XDP_SETUP_XSK_POOL;
>         bpf.xsk.pool = pool;
>         bpf.xsk.queue_id = queue_id;
> --
> 2.35.3
>
>
Maciej Fijalkowski May 31, 2023, 1:20 p.m. UTC | #5
On Wed, May 31, 2023 at 12:16:13PM +0200, Magnus Karlsson wrote:
> On Mon, 29 May 2023 at 17:57, Maciej Fijalkowski
> <maciej.fijalkowski@intel.com> wrote:
> >
> > Introduce new xdp_feature NETDEV_XDP_ACT_NDO_ZC_SG that will be used to
> > find out if user space that wants to do ZC multi-buffer will be able to
> > do so against underlying ZC driver.
> >
> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> > ---
> >  include/uapi/linux/netdev.h | 4 ++--
> >  net/xdp/xsk_buff_pool.c     | 6 ++++++
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
> > index 639524b59930..bfca07224f7b 100644
> > --- a/include/uapi/linux/netdev.h
> > +++ b/include/uapi/linux/netdev.h
> > @@ -33,8 +33,8 @@ enum netdev_xdp_act {
> >         NETDEV_XDP_ACT_HW_OFFLOAD = 16,
> >         NETDEV_XDP_ACT_RX_SG = 32,
> >         NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
> > -
> > -       NETDEV_XDP_ACT_MASK = 127,
> > +       NETDEV_XDP_ACT_NDO_ZC_SG = 128,
> 
> Since this flag has nothing to do with an NDO, I would prefer the
> simpler NETDEV_XDP_ACT_ZC_SG. What do you think?

+1, brain fart with that "NDO" on my side.

> 
> > +       NETDEV_XDP_ACT_MASK = 255,
> >  };
> >
> >  enum {
> > diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> > index 0a9f8ea68de3..43cca5fa90cf 100644
> > --- a/net/xdp/xsk_buff_pool.c
> > +++ b/net/xdp/xsk_buff_pool.c
> > @@ -189,6 +189,12 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
> >                 goto err_unreg_pool;
> >         }
> >
> > +       if (!(netdev->xdp_features & NETDEV_XDP_ACT_NDO_ZC_SG) &&
> > +           flags & XDP_USE_SG) {
> > +               err = -EOPNOTSUPP;
> > +               goto err_unreg_pool;
> > +       }
> > +
> >         bpf.command = XDP_SETUP_XSK_POOL;
> >         bpf.xsk.pool = pool;
> >         bpf.xsk.queue_id = queue_id;
> > --
> > 2.35.3
> >
> >
>
diff mbox series

Patch

diff --git a/include/uapi/linux/netdev.h b/include/uapi/linux/netdev.h
index 639524b59930..bfca07224f7b 100644
--- a/include/uapi/linux/netdev.h
+++ b/include/uapi/linux/netdev.h
@@ -33,8 +33,8 @@  enum netdev_xdp_act {
 	NETDEV_XDP_ACT_HW_OFFLOAD = 16,
 	NETDEV_XDP_ACT_RX_SG = 32,
 	NETDEV_XDP_ACT_NDO_XMIT_SG = 64,
-
-	NETDEV_XDP_ACT_MASK = 127,
+	NETDEV_XDP_ACT_NDO_ZC_SG = 128,
+	NETDEV_XDP_ACT_MASK = 255,
 };
 
 enum {
diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index 0a9f8ea68de3..43cca5fa90cf 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -189,6 +189,12 @@  int xp_assign_dev(struct xsk_buff_pool *pool,
 		goto err_unreg_pool;
 	}
 
+	if (!(netdev->xdp_features & NETDEV_XDP_ACT_NDO_ZC_SG) &&
+	    flags & XDP_USE_SG) {
+		err = -EOPNOTSUPP;
+		goto err_unreg_pool;
+	}
+
 	bpf.command = XDP_SETUP_XSK_POOL;
 	bpf.xsk.pool = pool;
 	bpf.xsk.queue_id = queue_id;