[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHC2DlTAoxwKVR/m@lore-desk>
Date: Fri, 9 Apr 2021 22:16:14 +0200
From: Lorenzo Bianconi <lorenzo.bianconi@...hat.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: Lorenzo Bianconi <lorenzo@...nel.org>, bpf@...r.kernel.org,
netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
ast@...nel.org, daniel@...earbox.net, shayagr@...zon.com,
sameehj@...zon.com, dsahern@...nel.org, brouer@...hat.com,
echaudro@...hat.com, jasowang@...hat.com,
alexander.duyck@...il.com, saeed@...nel.org,
maciej.fijalkowski@...el.com
Subject: Re: [PATCH v8 bpf-next 00/14] mvneta: introduce XDP multi-buffer
support
> Lorenzo Bianconi wrote:
[...]
>
> I just read the commit messages for v8 so far. But, I'm still wondering how
> to handle use cases where we want to put extra bytes at the end of the
> packet, or really anywhere in the general case. We can extend tail with above
> is there anyway to then write into that extra space?
>
> I think most use cases will only want headers so we can likely make it
> a callout to a helper. Could we add something like, xdp_get_bytes(start, end)
> to pull in the bytes?
>
> My dumb pseudoprogram being something like,
>
> trailer[16] = {0,1,2,3,4,5,6,7,8,9,a,b,c,d,e}
> trailer_size = 16;
> old_end = xdp->length;
> new_end = xdp->length + trailer_size;
>
> err = bpf_xdp_adjust_tail(xdp, trailer_size)
> if (err) return err;
>
> err = xdp_get_bytes(xdp, old_end, new_end);
> if (err) return err;
>
> memcpy(xdp->data, trailer, trailer_size);
>
> Do you think that could work if we code up xdp_get_bytes()? Does the driver
> have enough context to adjust xdp to map to my get_bytes() call? I think
> so but we should check.
Hi John,
can you please give more details about how xdp_get_bytes() is expected to work?
iiuc trailer will be pulled at the beginning of the frame after updating the
xdp_buff with xdp_get_bytes helper, correct?
If so I guess it will doable, it is just a matter of reserve more space mapping
the buffer on the dma engine respect to XDP_PACKET_HEADROOM. If the frame does
not fit in a single buffer, it will be split over multiple buffers.
If you are referring to add trailer at the end of the buffer, I guess it is
doable as well introducing a bpf helper.
I guess both of the solutions are orthogonal to this series.
Regards,
Lorenzo
>
> >
> > More info about the main idea behind this approach can be found here [1][2].
>
> Thanks for working on this!
>
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists