On Wed, 8 Apr 2020 10:53:39 -0700 Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > > + * This macro reserves tailroom in the XDP buffer by limiting the > > + * XDP/BPF data access to data_hard_end. Notice same area (and size) > > + * is used for XDP_PASS, when constructing the SKB via build_skb(). > > + */ > > +#define xdp_data_hard_end(xdp) \ > > + ((xdp)->data_hard_start + (xdp)->frame_sz - \ > > + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) > > I think it should be said somewhere that the drivers are expected to > DMA map memory up to xdp_data_hard_end(xdp). No, I don't want driver to DMA map memory up to xdp_data_hard_end(xdp). The driver will/should map up-to the configured MTU. Reading ahead, I can see that you worry about XDP_TX, that doesn't do the MTU check in xdp_ok_fwd_dev() like we do for XDP_REDIRECT. Guess, we need to check that before doing XDP_TX, such that we don't DMA sync for_device, for an area that does not included the original DMA-map area. I wonder if that is a violation, if so, it is also problematic for adjust *head*. -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer