mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gal Pressman <gal@nvidia.com>
To: Danielle Costantino <dcostantino@meta.com>, netdev@vger.kernel.org
Cc: kuba@kernel.org, tariqt@nvidia.com, pabeni@redhat.com,
	saeedm@nvidia.com, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net/mlx5e: Fix validation logic in rate limiting
Date: Mon, 24 Nov 2025 20:37:37 +0200	[thread overview]
Message-ID: <cbb5488b-4923-4032-a037-7ff851772a64@nvidia.com> (raw)
In-Reply-To: <20251124180043.2314428-1-dcostantino@meta.com>

On 24/11/2025 20:00, Danielle Costantino wrote:
> The rate limiting validation condition currently checks the output
> variable max_bw_value[i] instead of the input value
> maxrate->tc_maxrate[i]. This causes the validation to compare an
> uninitialized or stale value rather than the actual requested rate.
> 
> The condition should check the input rate to properly validate against
> the upper limit:
> 
>     } else if (maxrate->tc_maxrate[i] <= upper_limit_gbps) {
> 
> This aligns with the pattern used in the first branch, which correctly
> checks maxrate->tc_maxrate[i] against upper_limit_mbps.
> 
> The current implementation can lead to unreliable validation behavior:
> 
> - For rates between 25.5 Gbps and 255 Gbps, if max_bw_value[i] is 0
>   from initialization, the GBPS path may be taken regardless of whether
>   the actual rate is within bounds
> 
> - When processing multiple TCs (i > 0), max_bw_value[i] contains the
>   value computed for the previous TC, affecting the validation logic
> 
> - The overflow check for rates exceeding 255 Gbps may not trigger
>   consistently depending on previous array values
> 
> This patch ensures the validation correctly examines the requested rate
> value for proper bounds checking.
> 
> Fixes: 43b27d1bd88a ("net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps")
> Signed-off-by: Danielle Costantino <dcostantino@meta.com>

Thanks Danielle!
Reviewed-by: Gal Pressman <gal@nvidia.com>

  reply	other threads:[~2025-11-24 18:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-24 18:00 Danielle Costantino
2025-11-24 18:37 ` Gal Pressman [this message]
2025-11-26  0:50 ` patchwork-bot+netdevbpf

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=cbb5488b-4923-4032-a037-7ff851772a64@nvidia.com \
    --to=gal@nvidia.com \
    --cc=dcostantino@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.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

all inboxes | Powered by JetHome®