From: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
To: Jesper Dangaard Brouer <hawk@kernel.org>
Cc: "Alexander Lobakin" <aleksander.lobakin@intel.com>,
"Lorenzo Bianconi" <lorenzo@kernel.org>,
"Toke Høiland-Jørgensen" <toke@kernel.org>,
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,
toke@toke.dk, 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: Sun, 22 Sep 2024 11:17:50 +0200 [thread overview]
Message-ID: <Zu_gvkXe4RYjJXtq@lore-desk> (raw)
In-Reply-To: <09657be6-b5e2-4b5a-96b6-d34174aadd0a@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 4020 bytes --]
>
>
> On 21/09/2024 22.17, Alexander Lobakin wrote:
> > From: Lorenzo Bianconi <lorenzo@kernel.org>
> > Date: Sat, 21 Sep 2024 18:52:56 +0200
> >
> > > This series introduces the xdp_rx_meta struct in the xdp_buff/xdp_frame
> >
> > &xdp_buff is on the stack.
> > &xdp_frame consumes headroom.
> >
> > IOW they're size-sensitive and putting metadata directly there might
> > play bad; if not now, then later.
> >
> > Our idea (me + Toke) was as follows:
> >
> > - new BPF kfunc to build generic meta. If called, the driver builds a
> > generic meta with hash, csum etc., in the data_meta area.
>
> I do agree that it should be the XDP prog (via a new BPF kfunc) that
> decide if xdp_frame should be updated to contain a generic meta struct.
> *BUT* I think we should use the xdp_frame area, and not the
> xdp->data_meta area.
ack, I will add a new kfunc for it.
>
> A details is that I think this kfunc should write data directly into
> xdp_frame area, even then we are only operating on the xdp_buff, as we
> do have access to the area xdp_frame will be created in.
this would avoid to copy it when we convert from xdp_buff to xdp_frame, nice :)
>
>
> When using data_meta area, then netstack encap/decap needs to move the
> data_meta area (extra cycles). The xdp_frame area (live in top) don't
> have this issue.
>
> It is easier to allow xdp_frame area to survive longer together with the
> SKB. Today we "release" this xdp_frame area to be used by SKB for extra
> headroom (see xdp_scrub_frame). I can imagine that we can move SKB
> fields to this area, and reduce the size of the SKB alloc. (This then
> becomes the mini-SKB we discussed a couple of years ago).
>
>
> > Yes, this also consumes headroom, but only when the corresponding func
> > is called. Introducing new fields like you're doing will consume it
> > unconditionally;
>
> We agree on the kfunc call marks area as consumed/in-use. We can extend
> xdp_frame statically like Lorenzo does (with struct xdp_rx_meta), but
> xdp_frame->flags can be used for marking this area as used or not.
the only downside with respect to a TLV approach would be to consume all the
xdp_rx_meta as soon as we set a single xdp rx hw hint in it, right?
The upside is it is easier and it requires less instructions.
>
>
> > - when &xdp_frame gets converted to sk_buff, the function checks whether
> > data_meta contains a generic structure filled with hints.
> >
>
> Agree, but take data from xdp_frame->xdp_rx_meta.
>
> When XDP returns XDP_PASS, then I also want to see this data applied to
> the SKB. In patchset[1] Yan called this xdp_frame_fixup_skb_offloading()
> and xdp_buff_fixup_skb_offloading(). (Perhaps "fixup" isn't the right
> term, "apply" is perhaps better). Having this generic-name allow us to
> extend with newer offloads, and eventually move members out of SKB.
>
> We called it "fixup", because our use-case is that our XDP load-balancer
> (Unimog) XDP_TX bounce packets with in GRE header encap, and on the
> receiving NIC (due to encap) we lost the HW hash/csum, which we want to
> transfer from the original NIC, decap in XDP and apply the original HW
> hash/csum via this "fixup" call.
I already set skb metadata converting xdp_frame into a skb in
__xdp_build_skb_from_frame() but I can collect all this logic in a single
routine.
Regards,
Lorenzo
>
> --Jesper
>
> [1] https://lore.kernel.org/all/cover.1718919473.git.yan@cloudflare.com/
>
> > We also thought about &skb_shared_info, but it's also size-sensitive as
> > it consumes tailroom.
> >
> > > one as a container to store the already supported xdp rx hw hints (rx_hash
> > > and rx_vlan, rx_timestamp will be stored in skb_shared_info area) when the
> > > eBPF program running on the nic performs XDP_REDIRECT. Doing so, we are able
> > > to set the skb metadata converting the xdp_buff/xdp_frame to a skb.
> >
> > Thanks,
> > Olek
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2024-09-22 9: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 [this message]
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
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=Zu_gvkXe4RYjJXtq@lore-desk \
--to=lorenzo.bianconi@redhat.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=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jasowang@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@cloudflare.com \
--cc=kuba@kernel.org \
--cc=lorenzo@kernel.org \
--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=tariqt@nvidia.com \
--cc=toke@kernel.org \
--cc=toke@toke.dk \
--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