netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Joe Damato <jdamato@fastly.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	dhowells@redhat.com, alexander@mihalicyn.com,
	wuyun.abel@bytedance.com, kuniyu@amazon.com, pabeni@redhat.com,
	kuba@kernel.org, edumazet@google.com, davem@davemloft.net
Subject: Re: [PATCH net-next] net: print error if SO_BUSY_POLL_BUDGET is large
Date: Fri, 26 Jan 2024 01:11:22 -0800	[thread overview]
Message-ID: <ZbN3Oh6+i34mGRLp@gmail.com> (raw)
In-Reply-To: <20240125191840.6740-1-jdamato@fastly.com>

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@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);

'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.

      parent reply	other threads:[~2024-01-26  9:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 19:18 [PATCH net-next] net: print error if SO_BUSY_POLL_BUDGET is large Joe Damato
2024-01-25 19:33 ` Eric Dumazet
2024-01-26  9:11 ` Breno Leitao [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=ZbN3Oh6+i34mGRLp@gmail.com \
    --to=leitao@debian.org \
    --cc=alexander@mihalicyn.com \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=jdamato@fastly.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wuyun.abel@bytedance.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).