mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gal Pressman <gal@nvidia.com>
To: Danielle Costantino <dcostantino@meta.com>,
	Paolo Abeni <pabeni@redhat.com>
Cc: Tariq Toukan <tariqt@nvidia.com>, Nimrod Oren <noren@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Leon Romanovsky <leonro@nvidia.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 4/5] net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps
Date: Sun, 23 Nov 2025 09:05:04 +0200	[thread overview]
Message-ID: <d78d22d3-c8de-4d8a-9990-a66ec9ca904a@nvidia.com> (raw)
In-Reply-To: <20251120214228.1594282-1-dcostantino@meta.com>

On 20/11/2025 23:42, Danielle Costantino wrote:
> On Sun, Nov 9, 2025 at 11:37:52AM +0200, Gal Pressman wrote:
>> Add validation to reject rates exceeding 255 Gbps that would overflow
>> the 8 bits max bandwidth field.
> 
> Hi Gal, Tariq, Paolo,
> 
> While reviewing this commit (43b27d1bd88a) for backporting, I believe
> I've found a logic error in the validation condition.
> 
> The issue is on line 617:
> 
>     } else if (max_bw_value[i] <= upper_limit_gbps) {
>         max_bw_value[i] = div_u64(maxrate->tc_maxrate[i], MLX5E_1GB);
>         max_bw_unit[i]  = MLX5_GBPS_UNIT;
> 
> Suggested fix:
> --------------
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
> index d88a48210fdc..XXXXXXXX 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
> @@ -614,7 +614,7 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
>  						  MLX5E_100MB);
>  			max_bw_value[i] = max_bw_value[i] ? max_bw_value[i] : 1;
>  			max_bw_unit[i]  = MLX5_100_MBPS_UNIT;
> -		} else if (max_bw_value[i] <= upper_limit_gbps) {
> +		} else if (maxrate->tc_maxrate[i] <= upper_limit_gbps) {
>  			max_bw_value[i] = div_u64(maxrate->tc_maxrate[i],
>  						  MLX5E_1GB);
>  			max_bw_unit[i]  = MLX5_GBPS_UNIT;
> 
> Let me know if you'd like me to send a formal patch for this.

Hi Danielle,
Your fix is correct, please submit a patch.

Thanks for catching this!

  reply	other threads:[~2025-11-23  7:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-09  9:37 [PATCH net 0/5] mlx5e misc fixes 2025-11-09 Tariq Toukan
2025-11-09  9:37 ` [PATCH net 1/5] net/mlx5e: Fix missing error assignment in mlx5e_xfrm_add_state() Tariq Toukan
2025-11-09  9:37 ` [PATCH net 2/5] net/mlx5e: Trim the length of the num_doorbell error Tariq Toukan
2025-11-09  9:37 ` [PATCH net 3/5] net/mlx5e: Fix maxrate wraparound in threshold between units Tariq Toukan
2025-11-09  9:37 ` [PATCH net 4/5] net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps Tariq Toukan
2025-11-20 21:42   ` Danielle Costantino
2025-11-23  7:05     ` Gal Pressman [this message]
2025-11-09  9:37 ` [PATCH net 5/5] net/mlx5e: Fix potentially misleading debug message Tariq Toukan
2025-11-11 14:10 ` [PATCH net 0/5] mlx5e misc fixes 2025-11-09 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=d78d22d3-c8de-4d8a-9990-a66ec9ca904a@nvidia.com \
    --to=gal@nvidia.com \
    --cc=dcostantino@meta.com \
    --cc=leonro@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=noren@nvidia.com \
    --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®