diff mbox series

[RFC,v2,bpf-next,3/7] xsk: add usage of XDP features flags

Message ID 36956338853442e6d546687678a93470a164ff17.1673710867.git.lorenzo@kernel.org (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series xdp: introduce xdp-feature support | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR fail PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ${{ matrix.test }} on ${{ matrix.arch }} with ${{ matrix.toolchain }}
bpf/vmtest-bpf-next-VM_Test-2 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-3 fail Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-4 fail Logs for build for aarch64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-5 fail Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-6 fail Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-7 fail Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-8 success Logs for llvm-toolchain
bpf/vmtest-bpf-next-VM_Test-9 success Logs for set-matrix
netdev/tree_selection success Clearly marked for bpf-next, async
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 success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit fail Errors and warnings before: 293 this patch: 223
netdev/cc_maintainers warning 2 maintainers not CCed: john.fastabend@gmail.com jonathan.lemon@gmail.com
netdev/build_clang fail Errors and warnings before: 294 this patch: 14
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn fail Errors and warnings before: 384 this patch: 223
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Lorenzo Bianconi Jan. 14, 2023, 3:54 p.m. UTC
From: Marek Majtyka <alardam@gmail.com>

Change necessary condition check for XSK from ndo functions to
xdp features flags.

Signed-off-by: Marek Majtyka <alardam@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 net/xdp/xsk_buff_pool.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Yonghong Song Jan. 17, 2023, 10:07 p.m. UTC | #1
On 1/14/23 7:54 AM, Lorenzo Bianconi wrote:
> From: Marek Majtyka <alardam@gmail.com>
> 
> Change necessary condition check for XSK from ndo functions to
> xdp features flags.
> 
> Signed-off-by: Marek Majtyka <alardam@gmail.com>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> ---
>   net/xdp/xsk_buff_pool.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> index ed6c71826d31..2e6fa082142a 100644
> --- a/net/xdp/xsk_buff_pool.c
> +++ b/net/xdp/xsk_buff_pool.c
> @@ -178,8 +178,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
>   		/* For copy-mode, we are done. */
>   		return 0;
>   
> -	if (!netdev->netdev_ops->ndo_bpf ||
> -	    !netdev->netdev_ops->ndo_xsk_wakeup) {
> +	if ((netdev->xdp_features & NETDEV_XDP_ACT_ZC) != NETDEV_XDP_ACT_ZC) {

Maybe:
	if (!(netdev->xdp_features & NETDEV_XDP_ACT_ZC))
?

>   		err = -EOPNOTSUPP;
>   		goto err_unreg_pool;
>   	}
Lorenzo Bianconi Jan. 17, 2023, 11:34 p.m. UTC | #2
> 
> 
> On 1/14/23 7:54 AM, Lorenzo Bianconi wrote:
> > From: Marek Majtyka <alardam@gmail.com>
> > 
> > Change necessary condition check for XSK from ndo functions to
> > xdp features flags.
> > 
> > Signed-off-by: Marek Majtyka <alardam@gmail.com>
> > Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> > ---
> >   net/xdp/xsk_buff_pool.c | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> > 
> > diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> > index ed6c71826d31..2e6fa082142a 100644
> > --- a/net/xdp/xsk_buff_pool.c
> > +++ b/net/xdp/xsk_buff_pool.c
> > @@ -178,8 +178,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
> >   		/* For copy-mode, we are done. */
> >   		return 0;
> > -	if (!netdev->netdev_ops->ndo_bpf ||
> > -	    !netdev->netdev_ops->ndo_xsk_wakeup) {
> > +	if ((netdev->xdp_features & NETDEV_XDP_ACT_ZC) != NETDEV_XDP_ACT_ZC) {
> 
> Maybe:
> 	if (!(netdev->xdp_features & NETDEV_XDP_ACT_ZC))

I would say it not equivalent since:

NETDEV_XDP_ACT_ZC = 0x5f

and we want the device supports all the ZC requested features. Agree?

Regards,
Lorenzo

> ?
> 
> >   		err = -EOPNOTSUPP;
> >   		goto err_unreg_pool;
> >   	}
Yonghong Song Jan. 17, 2023, 11:37 p.m. UTC | #3
On 1/17/23 3:34 PM, Lorenzo Bianconi wrote:
>>
>>
>> On 1/14/23 7:54 AM, Lorenzo Bianconi wrote:
>>> From: Marek Majtyka <alardam@gmail.com>
>>>
>>> Change necessary condition check for XSK from ndo functions to
>>> xdp features flags.
>>>
>>> Signed-off-by: Marek Majtyka <alardam@gmail.com>
>>> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
>>> ---
>>>    net/xdp/xsk_buff_pool.c | 3 +--
>>>    1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
>>> index ed6c71826d31..2e6fa082142a 100644
>>> --- a/net/xdp/xsk_buff_pool.c
>>> +++ b/net/xdp/xsk_buff_pool.c
>>> @@ -178,8 +178,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
>>>    		/* For copy-mode, we are done. */
>>>    		return 0;
>>> -	if (!netdev->netdev_ops->ndo_bpf ||
>>> -	    !netdev->netdev_ops->ndo_xsk_wakeup) {
>>> +	if ((netdev->xdp_features & NETDEV_XDP_ACT_ZC) != NETDEV_XDP_ACT_ZC) {
>>
>> Maybe:
>> 	if (!(netdev->xdp_features & NETDEV_XDP_ACT_ZC))
> 
> I would say it not equivalent since:
> 
> NETDEV_XDP_ACT_ZC = 0x5f
> 
> and we want the device supports all the ZC requested features. Agree?

I missed the fact that NETDEV_XDP_ACT_ZC is not a BIT(...).
So your implementation is correct, sorry for the noise.

> 
> Regards,
> Lorenzo
> 
>> ?
>>
>>>    		err = -EOPNOTSUPP;
>>>    		goto err_unreg_pool;
>>>    	}
diff mbox series

Patch

diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
index ed6c71826d31..2e6fa082142a 100644
--- a/net/xdp/xsk_buff_pool.c
+++ b/net/xdp/xsk_buff_pool.c
@@ -178,8 +178,7 @@  int xp_assign_dev(struct xsk_buff_pool *pool,
 		/* For copy-mode, we are done. */
 		return 0;
 
-	if (!netdev->netdev_ops->ndo_bpf ||
-	    !netdev->netdev_ops->ndo_xsk_wakeup) {
+	if ((netdev->xdp_features & NETDEV_XDP_ACT_ZC) != NETDEV_XDP_ACT_ZC) {
 		err = -EOPNOTSUPP;
 		goto err_unreg_pool;
 	}