From: Joe Damato <jdamato@fastly.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: chuck.lever@oracle.com, jlayton@kernel.org,
linux-api@vger.kernel.org, brauner@kernel.org,
edumazet@google.com, davem@davemloft.net,
alexander.duyck@gmail.com, sridhar.samudrala@intel.com,
kuba@kernel.org, weiwan@google.com,
Joe Damato <jdamato@fastly.com>
Subject: [net-next v2 4/4] net: print error if SO_BUSY_POLL_BUDGET is large
Date: Thu, 25 Jan 2024 00:30:14 +0000 [thread overview]
Message-ID: <20240125003014.43103-5-jdamato@fastly.com> (raw)
In-Reply-To: <20240125003014.43103-1-jdamato@fastly.com>
When drivers call netif_napi_add_weight with a weight that is larger
than NAPI_POLL_WEIGHT, the networking code allows the larger weight, but
prints an error.
Replicate this check for SO_BUSY_POLL_BUDGET; check if the user
specified amount exceeds NAPI_POLL_WEIGHT, allow it anyway, but print an
error.
Signed-off-by: Joe Damato <jdamato@fastly.com>
---
net/core/sock.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/core/sock.c b/net/core/sock.c
index 158dbdebce6a..ed243bd0dd77 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1153,6 +1153,9 @@ int sk_setsockopt(struct sock *sk, int level, int optname,
return -EPERM;
if (val < 0 || val > U16_MAX)
return -EINVAL;
+ if (val > NAPI_POLL_WEIGHT)
+ pr_err("SO_BUSY_POLL_BUDGET %u exceeds suggested maximum %u\n", val,
+ NAPI_POLL_WEIGHT);
WRITE_ONCE(sk->sk_busy_poll_budget, val);
return 0;
#endif
--
2.25.1
prev parent reply other threads:[~2024-01-25 0:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 0:30 [net-next v2 0/4] Per epoll context busy poll support Joe Damato
2024-01-25 0:30 ` [net-next v2 1/4] eventpoll: support busy poll per epoll instance Joe Damato
2024-01-25 0:30 ` [net-next v2 2/4] eventpoll: Add per-epoll busy poll packet budget Joe Damato
2024-01-25 0:30 ` [net-next v2 3/4] eventpoll: Add epoll ioctl for epoll_params Joe Damato
2024-01-25 2:46 ` Willem de Bruijn
2024-01-25 4:27 ` Joe Damato
2024-01-25 14:11 ` Willem de Bruijn
2024-01-25 13:12 ` kernel test robot
2024-01-25 0:30 ` Joe Damato [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240125003014.43103-5-jdamato@fastly.com \
--to=jdamato@fastly.com \
--cc=alexander.duyck@gmail.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jlayton@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sridhar.samudrala@intel.com \
--cc=weiwan@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).