Re: [PATCH v14 bpf-next 10/18] bpf: add multi-buff support to the bpf_xdp_adjust_tail() API
From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-09-17 13:03:45
Also in:
netdev
From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-09-17 13:03:45
Also in:
netdev
On Fri, 17 Sep 2021 12:02:46 +0200 Lorenzo Bianconi wrote:
quoted
quoted
+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.