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 |
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; > }
> > > 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; > > }
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 --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; }