Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Support for XDP_USE_NEED_WAKEUP? #35

Open
danielealbano opened this issue Mar 15, 2024 · 0 comments
Open

Support for XDP_USE_NEED_WAKEUP? #35

danielealbano opened this issue Mar 15, 2024 · 0 comments

Comments

@danielealbano
Copy link

danielealbano commented Mar 15, 2024

From a quick overview of the code it seems that there is no support for XDP_USE_NEED_WAKEUP and XDP_RING_NEED_WAKEUP and the sendto / pool functions are invoked continuously.

Their used would drammatically reduce the invocation of the pool and sendto syscalls as they would be needed only when the flag XDP_RING_NEED_WAKEUP would be set on the ring and a flag check comes with basically no cost.

For reference here how the XDP_RING_NEED_WAKEUP flag check is implemented in libxdp
https://github.com/xdp-project/xdp-tools/blob/7fe0a0946a38a26d4196bc3819fc43227e0a9ddd/headers/xdp/xsk.h#L87

Here an example of how that check is used

if (xsk_ring_prod__needs_wakeup(&my_tx_ring))
   sendto(xsk_socket__fd(xsk_handle), NULL, 0, MSG_DONTWAIT, NULL, 0);

Here another example of how the pattern would change for poll
https://android.googlesource.com/kernel/common/+/35556bed836f/samples/bpf/xdpsock_user.c#1103

	rcvd = xsk_ring_cons__peek(&xsk->rx, opt_batch_size, &idx_rx);
	if (!rcvd) {
		if (xsk_ring_prod__needs_wakeup(&xsk->umem->fq))
			ret = poll(fds, num_socks, opt_timeout);
		return;
	}
@danielealbano danielealbano changed the title Add support for XDP_USE_NEED_WAKEUP Support for XDP_USE_NEED_WAKEUP? Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant