lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 19 Jan 2023 15:23:31 +0100
From:   Lorenzo Bianconi <lorenzo@...nel.org>
To:     sdf@...gle.com
Cc:     bpf@...r.kernel.org, netdev@...r.kernel.org, ast@...nel.org,
        daniel@...earbox.net, andrii@...nel.org, davem@...emloft.net,
        kuba@...nel.org, hawk@...nel.org, pabeni@...hat.com,
        edumazet@...gle.com, toke@...hat.com, memxor@...il.com,
        alardam@...il.com, saeedm@...dia.com, anthony.l.nguyen@...el.com,
        gospo@...adcom.com, vladimir.oltean@....com, nbd@....name,
        john@...ozen.org, leon@...nel.org, simon.horman@...igine.com,
        aelior@...vell.com, christophe.jaillet@...adoo.fr,
        ecree.xilinx@...il.com, mst@...hat.com, bjorn@...nel.org,
        magnus.karlsson@...el.com, maciej.fijalkowski@...el.com,
        intel-wired-lan@...ts.osuosl.org, lorenzo.bianconi@...hat.com
Subject: Re: [RFC v2 bpf-next 2/7] drivers: net: turn on XDP features

> On 01/14, Lorenzo Bianconi wrote:
> > From: Marek Majtyka <alardam@...il.com>
> 

[...]

> 
> Maybe stupid question: why do we need WRITE_ONCE here?
> And if we do need it, do we need READ_ONCE as well?
> 
> WRITE_ONCE(*xdp_features, READ_ONCE(*xdp_features) | flags);

This part is from the Marek's original series. I will let him to comment on it.

> 
> ?
> 
> Also, would it make sense to drop this __xdp_features_set_redirect_target
> and just define the following:
> 
> static inline void
> xdp_features_set_redirect_target(xdp_features_t *xdp_features, bool
> support_sg)
> {
> 	xdp_features_t flags = NETDEV_XDP_ACT_NDO_XMIT;
> 
> 	if (support_sg)
> 		flags |= NETDEV_XDP_ACT_NDO_XMIT_SG;
> 	*xdp_features |= flags; /* or WRITE_ONCE */
> }
> 
> This should avoid having two different sets of functions. Or does it
> look worse because of that 'naked' true/false argument in the call
> sites?

I did this way because we will mainly run it with support_sg set to false,
but I do not have a strong opinion on it, I am fine both ways. I will fix it.

Regards,
Lorenzo

> 
> 
> > +}
> > +
> > +static inline void
> > +xdp_features_clear_redirect_target(xdp_features_t *xdp_features)
> > +{
> > +	WRITE_ONCE(*xdp_features,
> > +		   *xdp_features & ~(NETDEV_XDP_ACT_NDO_XMIT |
> > +				     NETDEV_XDP_ACT_NDO_XMIT_SG));
> > +}
> > +
> > +#else
> > +
> > +static inline void
> > +__xdp_features_set_redirect_target(xdp_features_t *xdp_features, u32
> > flags)
> > +{
> > +}
> > +
> > +static inline void
> > +xdp_features_clear_redirect_target(xdp_features_t *xdp_features)
> > +{
> > +}
> > +
> > +#endif
> > +
> > +static inline void
> > +xdp_features_set_redirect_target(xdp_features_t *xdp_features)
> > +{
> > +	__xdp_features_set_redirect_target(xdp_features,
> > +					   NETDEV_XDP_ACT_NDO_XMIT |
> > +					   NETDEV_XDP_ACT_NDO_XMIT_SG);
> > +}
> > +
> >   #define DEV_MAP_BULK_SIZE XDP_BULK_QUEUE_SIZE
> 
> >   #endif /* __LINUX_NET_XDP_H__ */
> > --
> > 2.39.0
> 

Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ