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.