# RE: \[PATCH v20 bpf-next 12/23\] bpf: add multi-buff support to the bpf\_xdp\_adjust\_tail() API

- From: John Fastabend \<john.fastabend@gmail.com\>
- Date: 2021-12-11 00:11:33 
- List: netdev
- Page: https://ratatoskr.run/netdev/2021/12/7788899
- Thread: https://ratatoskr.run/bpf/2021/12/7788862/t.md

```text
Lorenzo Bianconi wrote:
> From: Eelco Chaudron <echaudro@redhat.com>
> 
> This change adds support for tail growing and shrinking for XDP multi-buff.
> 
> When called on a multi-buffer packet with a grow request, it will work
> on the last fragment of the packet. So the maximum grow size is the
> last fragments tailroom, i.e. no new buffer will be allocated.
> A XDP mb capable driver is expected to set frag_size in xdp_rxq_info data
> structure to notify the XDP core the fragment size. frag_size set to 0 is
> interpreted by the XDP core as tail growing is not allowed.
> Introduce __xdp_rxq_info_reg utility routine to initialize frag_size field.
> 
> When shrinking, it will work from the last fragment, all the way down to
> the base buffer depending on the shrinking size. It's important to mention
> that once you shrink down the fragment(s) are freed, so you can not grow
> again to the original size.
> 
> Acked-by: Jakub Kicinski <kuba@kernel.org>
> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
>  drivers/net/ethernet/marvell/mvneta.c |  3 +-
>  include/net/xdp.h                     | 16 ++++++-
>  net/core/filter.c                     | 65 +++++++++++++++++++++++++++
>  net/core/xdp.c                        | 12 ++---
>  4 files changed, 88 insertions(+), 8 deletions(-)
> 

LGTM

Acked-by: John Fastabend <john.fastabend@gmail.com>
```
