[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210917060340.12e87d55@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Fri, 17 Sep 2021 06:03:40 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
lorenzo.bianconi@...hat.com, davem@...emloft.net, ast@...nel.org,
daniel@...earbox.net, shayagr@...zon.com, john.fastabend@...il.com,
dsahern@...nel.org, brouer@...hat.com, echaudro@...hat.com,
jasowang@...hat.com, alexander.duyck@...il.com, saeed@...nel.org,
maciej.fijalkowski@...el.com, magnus.karlsson@...el.com,
tirthendu.sarkar@...el.com, toke@...hat.com
Subject: Re: [PATCH v14 bpf-next 10/18] bpf: add multi-buff support to the
bpf_xdp_adjust_tail() API
On Fri, 17 Sep 2021 12:02:46 +0200 Lorenzo Bianconi wrote:
> > > +static inline unsigned int xdp_get_frag_tailroom(const skb_frag_t *frag)
> > > +{
> > > + struct page *page = skb_frag_page(frag);
> > > +
> > > + return page_size(page) - skb_frag_size(frag) - skb_frag_off(frag);
> > > +}
> >
> > How do we deal with NICs which can pack multiple skbs into a page frag?
> > skb_shared_info field to mark the end of last fragment? Just want to make
> > sure there is a path to supporting such designs.
>
> I guess here, intead of using page_size(page) we can rely on xdp_buff->frame_sz
> or even on skb_shared_info()->xdp_frag_truesize (assuming all fragments from a
> given hw have the same truesize, but I think this is something we can rely on)
>
> static inline unsigned int xdp_get_frag_tailroom(struct xdp_buff *xdp,
> const skb_frag_t *frag)
> {
> return xdp->frame_sz - skb_frag_size(frag) - skb_frag_off(frag);
> }
>
> what do you think?
Could work! We'd need to document the semantics of frame_sz for mb
frames clearly but I don't see why not.
Powered by blists - more mailing lists