[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZbD8TWLihi4SZTwR@boxer>
Date: Wed, 24 Jan 2024 13:02:21 +0100
From: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: <bpf@...r.kernel.org>, <ast@...nel.org>, <daniel@...earbox.net>,
<andrii@...nel.org>, <netdev@...r.kernel.org>, <magnus.karlsson@...el.com>,
<bjorn@...nel.org>, <echaudro@...hat.com>, <lorenzo@...nel.org>,
<martin.lau@...ux.dev>, <tirthendu.sarkar@...el.com>,
<john.fastabend@...il.com>, <horms@...nel.org>
Subject: Re: [PATCH v5 bpf 03/11] xsk: fix usage of multi-buffer BPF helpers
for ZC XDP
On Tue, Jan 23, 2024 at 05:53:17PM -0800, Jakub Kicinski wrote:
> On Mon, 22 Jan 2024 23:16:02 +0100 Maciej Fijalkowski wrote:
> >
> > +static void __shrink_data(struct xdp_buff *xdp, struct xdp_mem_info *mem_info,
> > + skb_frag_t *frag, int shrink)
> > +{
> > + if (mem_info->type == MEM_TYPE_XSK_BUFF_POOL)
> > + xsk_buff_get_tail(xdp)->data_end -= shrink;
> > + skb_frag_size_sub(frag, shrink);
>
> nit: this has just one caller, why not inline these 3 lines?
we usually rely on compiler to do that, we have the rule "no inlines in
source files", no?
>
> > +}
> > +
> > +static bool shrink_data(struct xdp_buff *xdp, skb_frag_t *frag, int shrink)
>
> nit: prefix the function name, please
will rename to bpf_xdp_shrink_data(). Thanks for taking a look!
>
> > +{
> > + struct xdp_mem_info *mem_info = &xdp->rxq->mem;
> > +
> > + if (skb_frag_size(frag) == shrink) {
> > + struct page *page = skb_frag_page(frag);
> > + struct xdp_buff *zc_frag = NULL;
> > +
> > + if (mem_info->type == MEM_TYPE_XSK_BUFF_POOL) {
> > + zc_frag = xsk_buff_get_tail(xdp);
> > +
> > + xsk_buff_del_tail(zc_frag);
> > + }
> > +
> > + __xdp_return(page_address(page), mem_info, false, zc_frag);
> > + return true;
> > + }
> > + __shrink_data(xdp, mem_info, frag, shrink);
> > + return false;
Powered by blists - more mailing lists