最近看到 AF_XDP
https://www.kernel.org/doc/html/v4.19/networking/af_xdp.html#rings
/usr/include/linux/if_xdp.h , 系统定义了 4 个 mmap offset
/* Pgoff for mmaping the rings */
#define XDP_PGOFF_RX_RING 0
#define XDP_PGOFF_TX_RING 0x80000000
#define XDP_UMEM_PGOFF_FILL_RING 0x100000000ULL
#define XDP_UMEM_PGOFF_COMPLETION_RING 0x180000000ULL
使用示例
https://github.com/libbpf/libbpf/blob/b91f53ec5f1aba2a9d01dc00c4434063abd921e8/src/xsk.c#L265
https://github.com/libbpf/libbpf/blob/b91f53ec5f1aba2a9d01dc00c4434063abd921e8/src/xsk.c#L282
如上,在这些 mmap 用法上 offset 都远大于 length,为什么不会出错呢