netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Jesper Dangaard Brouer <hawk@kernel.org>
Cc: "Arthur Fabre" <afabre@cloudflare.com>,
	"Daniel Xu" <dxu@dxuuu.xyz>,
	"Stanislav Fomichev" <stfomichev@gmail.com>,
	"Toke Høiland-Jørgensen" <toke@redhat.com>,
	"Lorenzo Bianconi" <lorenzo.bianconi@redhat.com>,
	"Jakub Sitnicki" <jakub@cloudflare.com>,
	"Alexander Lobakin" <aleksander.lobakin@intel.com>,
	bpf@vger.kernel.org, netdev@vger.kernel.org, ast@kernel.org,
	daniel@iogearbox.net, davem@davemloft.net, kuba@kernel.org,
	john.fastabend@gmail.com, edumazet@google.com, pabeni@redhat.com,
	sdf@fomichev.me, tariqt@nvidia.com, saeedm@nvidia.com,
	anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	intel-wired-lan@lists.osuosl.org, mst@redhat.com,
	jasowang@redhat.com, mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com,
	kernel-team <kernel-team@cloudflare.com>,
	"Yan Zhai" <yan@cloudflare.com>
Subject: Re: [RFC bpf-next 0/4] Add XDP rx hw hints support performing XDP_REDIRECT
Date: Fri, 4 Oct 2024 16:18:17 +0200	[thread overview]
Message-ID: <Zv_5KdpkaYY-6z1f@lore-desk> (raw)
In-Reply-To: <75fb1dd3-fe14-426c-bc59-9a582c4b0e8d@kernel.org>

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

On Oct 04, Jesper Dangaard Brouer wrote:
> 
> 
> On 04/10/2024 15.55, Arthur Fabre wrote:
> > On Fri Oct 4, 2024 at 12:38 PM CEST, Jesper Dangaard Brouer wrote:
> > > [...]
> > > > > > There are two different use-cases for the metadata:
> > > > > > 
> > > > > > * "Hardware" metadata (like the hash, rx_timestamp...). There are only a
> > > > > >     few well known fields, and only XDP can access them to set them as
> > > > > >     metadata, so storing them in a struct somewhere could make sense.
> > > > > > 
> > > > > > * Arbitrary metadata used by services. Eg a TC filter could set a field
> > > > > >     describing which service a packet is for, and that could be reused for
> > > > > >     iptables, routing, socket dispatch...
> > > > > >     Similarly we could set a "packet_id" field that uniquely identifies a
> > > > > >     packet so we can trace it throughout the network stack (through
> > > > > >     clones, encap, decap, userspace services...).
> > > > > >     The skb->mark, but with more room, and better support for sharing it.
> > > > > > 
> > > > > > We can only know the layout ahead of time for the first one. And they're
> > > > > > similar enough in their requirements (need to be stored somewhere in the
> > > > > > SKB, have a way of retrieving each one individually, that it seems to
> > > > > > make sense to use a common API).
> > > > > 
> > > > > Why not have the following layout then?
> > > > > 
> > > > > +---------------+-------------------+----------------------------------------+------+
> > > > > | more headroom | user-defined meta | hw-meta (potentially fixed skb format) | data |
> > > > > +---------------+-------------------+----------------------------------------+------+
> > > > >                   ^                                                            ^
> > > > >               data_meta                                                      data
> > > > > 
> > > > > You obviously still have a problem of communicating the layout if you
> > > > > have some redirects in between, but you, in theory still have this
> > > > > problem with user-defined metadata anyway (unless I'm missing
> > > > > something).
> > > > > 
> > > 
> > > Hmm, I think you are missing something... As far as I'm concerned we are
> > > discussing placing the KV data after the xdp_frame, and not in the XDP
> > > data_meta area (as your drawing suggests).  The xdp_frame is stored at
> > > the very top of the headroom.  Lorenzo's patchset is extending struct
> > > xdp_frame and now we are discussing to we can make a more flexible API
> > > for extending this. I understand that Toke confirmed this here [3].  Let
> > > me know if I missed something :-)
> > > 
> > >    [3] https://lore.kernel.org/all/874j62u1lb.fsf@toke.dk/
> > > 
> > > As part of designing this flexible API, we/Toke are trying hard not to
> > > tie this to a specific data area.  This is a good API design, keeping it
> > > flexible enough that we can move things around should the need arise.
> > 
> > +1. And if we have an API for doing this for user-defined metadata, it
> > seems like we might as well use it for hardware metadata too.
> > 
> > With something roughly like:
> > 
> >      *val get(id)
> > 
> >      set(id, *val)
> > 
> > with pre-defined ids for hardware metadata, consumers don't need to know
> > the layout, or where / how the data is stored.
> > 
> > Under the hood we can implement it however we want, and change it in the
> > future.
> > 
> > I was initially thinking we could store hardware metadata the same way
> > as user defined metadata, but Toke and Lorenzo seem to prefer storing it
> > in a fixed struct.
> 
> If the API hide the actual location then we can always move things
> around, later.  If your popcnt approach is fast enough, then IMO we
> don't need a fixed struct for hardware metadata.

+1. I am fine with the KV approach for nic metadata as well if it is fast enough.
If you want I can modify my series to use kfunc sto store data after xdp_frame
and then you can plug the KV encoding. What do you think? Up to you.

Regards,
Lorenzo

> 
> --Jesper

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

  reply	other threads:[~2024-10-04 14:18 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-21 16:52 [RFC bpf-next 0/4] Add XDP rx hw hints support performing XDP_REDIRECT Lorenzo Bianconi
2024-09-21 16:52 ` [RFC bpf-next 1/4] net: xdp: Add xdp_rx_meta structure Lorenzo Bianconi
2024-09-21 16:52 ` [RFC bpf-next 2/4] net: xdp: Update rx_hash of xdp_rx_meta struct running xmo_rx_hash callback Lorenzo Bianconi
2024-09-21 16:52 ` [RFC bpf-next 3/4] net: xdp: Update rx_vlan of xdp_rx_meta struct running xmo_rx_vlan_tag callback Lorenzo Bianconi
2024-09-21 16:53 ` [RFC bpf-next 4/4] net: xdp: Update rx timestamp of xdp_rx_meta struct running xmo_rx_timestamp callback Lorenzo Bianconi
2024-09-21 20:17 ` [RFC bpf-next 0/4] Add XDP rx hw hints support performing XDP_REDIRECT Alexander Lobakin
2024-09-21 21:36   ` Jesper Dangaard Brouer
2024-09-22  9:17     ` Lorenzo Bianconi
2024-09-22 11:12       ` Toke Høiland-Jørgensen
2024-09-22 15:40         ` Lorenzo Bianconi
2024-09-26 10:54           ` Toke Høiland-Jørgensen
2024-09-26 14:57             ` Lorenzo Bianconi
2024-09-27  1:43               ` Stanislav Fomichev
2024-09-26 11:31         ` Arthur Fabre
2024-09-26 12:41           ` Toke Høiland-Jørgensen
2024-09-26 15:44             ` Arthur Fabre
2024-09-27 10:24               ` Toke Høiland-Jørgensen
2024-09-27 14:46                 ` Arthur Fabre
2024-09-27 15:06                   ` Lorenzo Bianconi
2024-09-30 10:58                     ` Toke Høiland-Jørgensen
2024-09-30 11:49                       ` Lorenzo Bianconi
2024-10-01 14:16                         ` Arthur Fabre
2024-10-01 14:54                           ` Lorenzo Bianconi
2024-10-01 15:14                             ` Toke Høiland-Jørgensen
2024-10-02 17:02                               ` Stanislav Fomichev
2024-10-02 18:38                                 ` Toke Høiland-Jørgensen
2024-10-02 22:49                                   ` Stanislav Fomichev
2024-10-03  6:35                                     ` Arthur Fabre
2024-10-03 20:26                                       ` Stanislav Fomichev
2024-10-04  2:13                                         ` Daniel Xu
2024-10-04 10:38                                           ` Jesper Dangaard Brouer
2024-10-04 13:55                                             ` Arthur Fabre
2024-10-04 14:14                                               ` Jesper Dangaard Brouer
2024-10-04 14:18                                                 ` Lorenzo Bianconi [this message]
2024-10-04 14:29                                                   ` Arthur Fabre
2024-10-04 17:53                                             ` Stanislav Fomichev
2024-10-06 10:27                                               ` Toke Høiland-Jørgensen
2024-10-07 18:48                                                 ` Stanislav Fomichev
2024-10-08  7:15                                                   ` Arthur Fabre
2024-10-04 16:27                                           ` Stanislav Fomichev
2024-09-30 10:52                   ` Toke Høiland-Jørgensen
2024-10-01 14:06                     ` Arthur Fabre
2024-10-01 15:28                       ` Toke Høiland-Jørgensen
2024-10-03  6:51                         ` Arthur Fabre
2024-09-22  9:08   ` Lorenzo Bianconi

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=Zv_5KdpkaYY-6z1f@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=afabre@cloudflare.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dxu@dxuuu.xyz \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jakub@cloudflare.com \
    --cc=jasowang@redhat.com \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=saeedm@nvidia.com \
    --cc=sdf@fomichev.me \
    --cc=stfomichev@gmail.com \
    --cc=tariqt@nvidia.com \
    --cc=toke@redhat.com \
    --cc=yan@cloudflare.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).