Commit 7c951caf authored by Björn Töpel's avatar Björn Töpel Committed by Daniel Borkmann
Browse files

net: Add SO_BUSY_POLL_BUDGET socket option



This option lets a user set a per socket NAPI budget for
busy-polling. If the options is not set, it will use the default of 8.

Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/bpf/20201130185205.196029-3-bjorn.topel@gmail.com
parent 7fd3253a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@
#define SO_DETACH_REUSEPORT_BPF 68

#define SO_PREFER_BUSY_POLL	69
#define SO_BUSY_POLL_BUDGET	70

#if !defined(__KERNEL__)

+1 −0
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@
#define SO_DETACH_REUSEPORT_BPF 68

#define SO_PREFER_BUSY_POLL	69
#define SO_BUSY_POLL_BUDGET	70

#if !defined(__KERNEL__)

+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@
#define SO_DETACH_REUSEPORT_BPF 0x4042

#define SO_PREFER_BUSY_POLL	0x4043
#define SO_BUSY_POLL_BUDGET	0x4044

#if !defined(__KERNEL__)

+1 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@
#define SO_DETACH_REUSEPORT_BPF  0x0047

#define SO_PREFER_BUSY_POLL	 0x0048
#define SO_BUSY_POLL_BUDGET	 0x0049

#if !defined(__KERNEL__)

+2 −1
Original line number Diff line number Diff line
@@ -397,7 +397,8 @@ static void ep_busy_loop(struct eventpoll *ep, int nonblock)
	unsigned int napi_id = READ_ONCE(ep->napi_id);

	if ((napi_id >= MIN_NAPI_ID) && net_busy_loop_on())
		napi_busy_loop(napi_id, nonblock ? NULL : ep_busy_loop_end, ep, false);
		napi_busy_loop(napi_id, nonblock ? NULL : ep_busy_loop_end, ep, false,
			       BUSY_POLL_BUDGET);
}

static inline void ep_reset_busy_poll_napi_id(struct eventpoll *ep)
Loading