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

Support for XDP_USE_NEED_WAKEUP? #35

@danielealbano

Description

@danielealbano

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;
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions