You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experimenting with AF_XDP and would love to use rustix instead of libc. For the BPF side of things, I use aya, so only the non-BPF related syscalls remain. Some syscalls are already supported like mmap and socket but others would need to be implemented or expanded/modified. I created a list of missing syscalls, constants and structs. Most of the syscalls, etc were added in 4.18 with some additions and modifications in later kernel versions.
xdp_options, used by getsockopt(...,XDP_OPTIONS,...)
If this is something you are interested in adding, I'd be happy to work on PR(s) to implement it but I would require some guidance:
Some syscall parameters/returns come in two versions, how should this be implemented?
Should kernel versions required for syscalls be listed?
I'm unsure how testing can be done for things like setsockopt as I don't think there is a syscall to check their result.
For {get,set}sockopt and bind I can orient myself at already existing syscalls in rustix but for if_indextoname and if_nametoindex, I'm unsure how to implement them.
Hi,
I'm experimenting with AF_XDP and would love to use
rustixinstead oflibc. For the BPF side of things, I useaya, so only the non-BPF related syscalls remain. Some syscalls are already supported likemmapandsocketbut others would need to be implemented or expanded/modified. I created a list of missing syscalls, constants and structs. Most of the syscalls, etc were added in 4.18 with some additions and modifications in later kernel versions.Syscalls:
setsockopt(fd, SOL_XDP, XDP_UMEM_REG, umem_reg, sizeof(umem_reg)),umem_regsee structssetsockopt(fs, SOL_XDP, XDP_UMEM_FILL_RING, fill_size, sizeof(fill_size)),fill_size=u32(https://github.com/torvalds/linux/blob/v6.6/net/xdp/xsk.c#L944)setsockopt(fs, SOL_XDP, XDP_UMEM_COMPLETION_RING, comp_size, sizeof(comp_size)),comp_size=u32setsockopt(fs, SOL_XDP, XDP_RX_RING, rx_size, sizeof(rx_size)),rx_size=u32setsockopt(fs, SOL_XDP, XDP_TX_RING, tx_size, sizeof(tx_size))tx_size=u32getsockopt(fd, SOL_XDP, XDP_MMAP_OFFSETS, *xdp_mmap_offsets, &optlen),xdp_mmap_offsetssee structsgetsockopt(fd, SOL_XDP, XDP_STATISTICS, *xdp_statistics, &optlen),xdp_statisticssee structsgetsockopt(fd, SOL_XDP, XDP_OPTIONS, *xdp_options, &optlen),xdp_optionssee structsbind(fd, *sockaddr_xdp, sizeof(sockaddr_xdp)),sockaddr_xdpsee structs,bindwith various addresses is already supported but not withsockaddr_xdpif_indextonameif_nametoindex(optional)Constants:
AF_XDPPF_XDPsame asAF_XDPSOL_XDPStructs:
bind(fd, *sockaddr_xdp, sizeof(sockaddr_xdp))xdp_mmap_offsetsgetsockopt(...,XDP_MMAP_OFFSETS,...)setsockopt(...,XDP_UMEM_REG,...)mmapassizeof(xdp_desc)forXDP_PGOFF_{RX,TX}_RINGgetsockopt(...,XDP_STATISTICS,...)getsockopt(...,XDP_OPTIONS,...)If this is something you are interested in adding, I'd be happy to work on PR(s) to implement it but I would require some guidance:
setsockoptas I don't think there is a syscall to check their result.{get,set}sockoptandbindI can orient myself at already existing syscalls inrustixbut forif_indextonameandif_nametoindex, I'm unsure how to implement them.