Re: [PATCH v14 bpf-next 00/18] mvneta: introduce XDP multi-buffer support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 Sep 2021 23:01:48 +0200 Toke Høiland-Jørgensen wrote:
> > In fact I don't think there is anything infra can do better for
> > flushing than the prog itself:
> >
> > 	bool mod = false;
> >
> > 	ptr = bpf_header_pointer(...);
> > 	...
> > 	if (some_cond(...)) {
> > 		change_packet(...);
> > 		mod = true;
> > 	}
> > 	...
> > 	if (mod)  
> 
> to have an additional check like:
> 
> if (mod && ptr == stack)
> 
> (or something to that effect). No?

Good point. Do you think we should have the kernel add/inline this
optimization or have the user do it explicitly.

The draft API was:

void *xdp_mb_pointer_flush(struct xdp_buff *xdp_md, u32 flags, 
                           u32 offset, u32 len, void *stack_buf)

Which does not take the ptr returned by header_pointer(), but that's
easy to add (well, easy other than the fact it'd be the 6th arg).

BTW I drafted the API this way to cater to the case where flush()
is called without a prior call to header_pointer(). For when packet
trailer or header is populated directly from a map value. Dunno if
that's actually useful, either.




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux