> 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! >