Re: [RFC v2 bpf-next 2/7] drivers: net: turn on XDP features

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[...]

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

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux