[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZbN3Oh6+i34mGRLp@gmail.com>
Date: Fri, 26 Jan 2024 01:11:22 -0800
From: Breno Leitao <leitao@...ian.org>
To: Joe Damato <jdamato@...tly.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
dhowells@...hat.com, alexander@...alicyn.com,
wuyun.abel@...edance.com, kuniyu@...zon.com, pabeni@...hat.com,
kuba@...nel.org, edumazet@...gle.com, davem@...emloft.net
Subject: Re: [PATCH net-next] net: print error if SO_BUSY_POLL_BUDGET is large
Hi Joe,
On Thu, Jan 25, 2024 at 07:18:40PM +0000, Joe Damato wrote:
> 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@...tly.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);
'val' is a signed value variable. I suspect it will never be negative given
the line above (val < 0 || val > U16_MAX), but, I am wondering if you
should still print it as signed integer (%d) to keep it consistent.
Powered by blists - more mailing lists