aboutsummaryrefslogtreecommitdiff
path: root/samples/bpf
diff options
context:
space:
mode:
authorBjörn Töpel2020-11-30 19:52:05 +0100
committerDaniel Borkmann2020-12-01 00:09:26 +0100
commit41bf900fe2a0cd56bdc3639ac73d509d52826149 (patch)
tree692c28a2c5f525ad2deab0ec1c4d1c92878b6488 /samples/bpf
parentb35fc1482ceb2f36bedd1587c3cfea3167baa2f1 (diff)
samples/bpf: Add option to set the busy-poll budget
Support for the SO_BUSY_POLL_BUDGET setsockopt, via the batching option ('b'). Signed-off-by: Björn Töpel <bjorn.topel@intel.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> Link: https://lore.kernel.org/bpf/20201130185205.196029-11-bjorn.topel@gmail.com
Diffstat (limited to 'samples/bpf')
-rw-r--r--samples/bpf/xdpsock_user.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index 4622a17fafe1..036bd019e400 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -1480,6 +1480,11 @@ static void apply_setsockopt(struct xsk_socket_info *xsk)
if (setsockopt(xsk_socket__fd(xsk->xsk), SOL_SOCKET, SO_BUSY_POLL,
(void *)&sock_opt, sizeof(sock_opt)) < 0)
exit_with_error(errno);
+
+ sock_opt = opt_batch_size;
+ if (setsockopt(xsk_socket__fd(xsk->xsk), SOL_SOCKET, SO_BUSY_POLL_BUDGET,
+ (void *)&sock_opt, sizeof(sock_opt)) < 0)
+ exit_with_error(errno);
}
int main(int argc, char **argv)