Re: [PATCH bpf-next 04/14] xsk: introduce AF_XDP buffer allocation API
From: Björn Töpel <hidden>
Date: 2020-05-08 12:32:20
Also in:
bpf
On 2020-05-08 13:55, Maxim Mikityanskiy wrote:
On 2020-05-07 13:42, Björn Töpel wrote:quoted
From: Björn Töpel <redacted> In order to simplify AF_XDP zero-copy enablement for NIC driver developers, a new AF_XDP buffer allocation API is added. The implementation is based on a single core (single producer/consumer) buffer pool for the AF_XDP UMEM. A buffer is allocated using the xsk_buff_alloc() function, and returned using xsk_buff_free(). If a buffer is disassociated with the pool, e.g. when a buffer is passed to an AF_XDP socket, a buffer is said to be released. Currently, the release function is only used by the AF_XDP internals and not visible to the driver. Drivers using this API should register the XDP memory model with the new MEM_TYPE_XSK_BUFF_POOL type. The API is defined in net/xdp_sock_drv.h. The buffer type is struct xdp_buff, and follows the lifetime of regular xdp_buffs, i.e. the lifetime of an xdp_buff is restricted to a NAPI context. In other words, the API is not replacing xdp_frames. In addition to introducing the API and implementations, the AF_XDP core is migrated to use the new APIs. rfc->v1: Fixed build errors/warnings for m68k and riscv. (kbuild test robot) Added headroom/chunk size getter. (Maxim/Björn) Signed-off-by: Maxim Mikityanskiy <redacted> Signed-off-by: Björn Töpel <redacted>Björn's signoff should go first (as the original author).
Oh, I didn't know that. I'll fix in the next revision!