All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sdf@google.com
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, andrii@kernel.org, davem@davemloft.net,
	kuba@kernel.org, hawk@kernel.org, pabeni@redhat.com,
	edumazet@google.com, toke@redhat.com, memxor@gmail.com,
	alardam@gmail.com, saeedm@nvidia.com, anthony.l.nguyen@intel.com,
	gospo@broadcom.com, vladimir.oltean@nxp.com, nbd@nbd.name,
	john@phrozen.org, leon@kernel.org, simon.horman@corigine.com,
	aelior@marvell.com, christophe.jaillet@wanadoo.fr,
	ecree.xilinx@gmail.com, mst@redhat.com, bjorn@kernel.org,
	magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
	intel-wired-lan@lists.osuosl.org, lorenzo.bianconi@redhat.com
Subject: Re: [RFC v2 bpf-next 2/7] drivers: net: turn on XDP features
Date: Thu, 19 Jan 2023 15:23:31 +0100	[thread overview]
Message-ID: <Y8lSY2rfx5woNJOu@lore-desk> (raw)
In-Reply-To: <Y8hW8IqJTa0zE2aS@google.com>

[-- Attachment #1: Type: text/plain, Size: 2060 bytes --]

> On 01/14, Lorenzo Bianconi wrote:
> > From: Marek Majtyka <alardam@gmail.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
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sdf@google.com
Cc: mst@redhat.com, vladimir.oltean@nxp.com, ast@kernel.org,
	edumazet@google.com, anthony.l.nguyen@intel.com,
	daniel@iogearbox.net, andrii@kernel.org,
	intel-wired-lan@lists.osuosl.org, simon.horman@corigine.com,
	kuba@kernel.org, pabeni@redhat.com, aelior@marvell.com,
	hawk@kernel.org, christophe.jaillet@wanadoo.fr, memxor@gmail.com,
	john@phrozen.org, bjorn@kernel.org, bpf@vger.kernel.org,
	magnus.karlsson@intel.com, leon@kernel.org,
	netdev@vger.kernel.org, toke@redhat.com, ecree.xilinx@gmail.com,
	alardam@gmail.com, gospo@broadcom.com, saeedm@nvidia.com,
	davem@davemloft.net, nbd@nbd.name
Subject: Re: [Intel-wired-lan] [RFC v2 bpf-next 2/7] drivers: net: turn on XDP features
Date: Thu, 19 Jan 2023 15:23:31 +0100	[thread overview]
Message-ID: <Y8lSY2rfx5woNJOu@lore-desk> (raw)
In-Reply-To: <Y8hW8IqJTa0zE2aS@google.com>


[-- Attachment #1.1: Type: text/plain, Size: 2060 bytes --]

> On 01/14, Lorenzo Bianconi wrote:
> > From: Marek Majtyka <alardam@gmail.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
> 

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 162 bytes --]

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

  reply	other threads:[~2023-01-20  4:36 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-14 15:54 [RFC v2 bpf-next 0/7] xdp: introduce xdp-feature support Lorenzo Bianconi
2023-01-14 15:54 ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-14 15:54 ` [RFC v2 bpf-next 1/7] netdev-genl: create a simple family for netdev stuff Lorenzo Bianconi
2023-01-14 15:54   ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-14 17:07   ` kernel test robot
2023-01-14 17:17   ` kernel test robot
2023-01-14 15:54 ` [RFC v2 bpf-next 2/7] drivers: net: turn on XDP features Lorenzo Bianconi
2023-01-14 15:54   ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-14 17:38   ` kernel test robot
2023-01-17 21:29   ` Niklas Söderlund
2023-01-17 21:29     ` [Intel-wired-lan] " Niklas Söderlund
2023-01-17 21:58     ` Toke Høiland-Jørgensen
2023-01-17 21:58       ` [Intel-wired-lan] " Toke Høiland-Jørgensen
2023-01-17 22:05       ` Niklas Söderlund
2023-01-17 22:05         ` [Intel-wired-lan] " Niklas Söderlund
2023-01-17 22:15         ` Toke Høiland-Jørgensen
2023-01-17 22:15           ` [Intel-wired-lan] " Toke Høiland-Jørgensen
2023-01-17 22:29           ` Niklas Söderlund
2023-01-17 22:29             ` [Intel-wired-lan] " Niklas Söderlund
2023-01-17 22:42             ` Toke Høiland-Jørgensen
2023-01-17 22:42               ` [Intel-wired-lan] " Toke Høiland-Jørgensen
2023-01-17 23:45     ` Lorenzo Bianconi
2023-01-17 23:45       ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-18  8:50       ` Niklas Söderlund
2023-01-18  8:50         ` [Intel-wired-lan] " Niklas Söderlund
2023-01-18  9:38         ` Lorenzo Bianconi
2023-01-18  9:38           ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-18 20:30   ` sdf
2023-01-18 20:30     ` [Intel-wired-lan] " sdf
2023-01-19 14:23     ` Lorenzo Bianconi [this message]
2023-01-19 14:23       ` Lorenzo Bianconi
2023-01-14 15:54 ` [RFC v2 bpf-next 3/7] xsk: add usage of XDP features flags Lorenzo Bianconi
2023-01-14 15:54   ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-17 22:07   ` Yonghong Song
2023-01-17 22:07     ` [Intel-wired-lan] " Yonghong Song
2023-01-17 23:34     ` Lorenzo Bianconi
2023-01-17 23:34       ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-17 23:37       ` Yonghong Song
2023-01-17 23:37         ` [Intel-wired-lan] " Yonghong Song
2023-01-14 15:54 ` [RFC v2 bpf-next 4/7] libbpf: add the capability to specify netlink proto in libbpf_netlink_send_recv Lorenzo Bianconi
2023-01-14 15:54   ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-14 15:54 ` [RFC v2 bpf-next 5/7] libbpf: add API to get XDP/XSK supported features Lorenzo Bianconi
2023-01-14 15:54   ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-18  0:58   ` Jakub Kicinski
2023-01-18  0:58     ` [Intel-wired-lan] " Jakub Kicinski
2023-01-19 22:39     ` Lorenzo Bianconi
2023-01-19 22:39       ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-14 15:54 ` [RFC v2 bpf-next 6/7] bpf: devmap: check XDP features in bpf_map_update_elem and __xdp_enqueue Lorenzo Bianconi
2023-01-14 15:54   ` [Intel-wired-lan] " Lorenzo Bianconi
2023-01-14 15:54 ` [RFC v2 bpf-next 7/7] selftests/bpf: introduce XDP compliance test tool Lorenzo Bianconi
2023-01-14 15:54   ` [Intel-wired-lan] " Lorenzo Bianconi
  -- strict thread matches above, loose matches on Subject: below --
2023-01-15  0:22 [RFC v2 bpf-next 1/7] netdev-genl: create a simple family for netdev stuff kernel test robot
2023-01-16  9:04 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8lSY2rfx5woNJOu@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=aelior@marvell.com \
    --cc=alardam@gmail.com \
    --cc=andrii@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=gospo@broadcom.com \
    --cc=hawk@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=memxor@gmail.com \
    --cc=mst@redhat.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=sdf@google.com \
    --cc=simon.horman@corigine.com \
    --cc=toke@redhat.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.