* [PATCH net 0/5] mlx5e misc fixes 2025-11-09
@ 2025-11-09 9:37 Tariq Toukan
2025-11-09 9:37 ` [PATCH net 1/5] net/mlx5e: Fix missing error assignment in mlx5e_xfrm_add_state() Tariq Toukan
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Tariq Toukan @ 2025-11-09 9:37 UTC (permalink / raw)
To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn, David S. Miller
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
netdev, linux-rdma, linux-kernel, Gal Pressman
Hi,
This patchset provides misc bug fixes from the team to the mlx5 Eth
driver.
Thanks,
Tariq.
Carolina Jubran (1):
net/mlx5e: Fix missing error assignment in mlx5e_xfrm_add_state()
Cosmin Ratiu (1):
net/mlx5e: Trim the length of the num_doorbell error
Gal Pressman (3):
net/mlx5e: Fix maxrate wraparound in threshold between units
net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps
net/mlx5e: Fix potentially misleading debug message
.../net/ethernet/mellanox/mlx5/core/devlink.c | 2 +-
.../mellanox/mlx5/core/en_accel/ipsec.c | 3 +-
.../ethernet/mellanox/mlx5/core/en_dcbnl.c | 33 ++++++++++++++++---
3 files changed, 31 insertions(+), 7 deletions(-)
base-commit: 96a9178a29a6b84bb632ebeb4e84cf61191c73d5
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net 1/5] net/mlx5e: Fix missing error assignment in mlx5e_xfrm_add_state()
2025-11-09 9:37 [PATCH net 0/5] mlx5e misc fixes 2025-11-09 Tariq Toukan
@ 2025-11-09 9:37 ` Tariq Toukan
2025-11-09 9:37 ` [PATCH net 2/5] net/mlx5e: Trim the length of the num_doorbell error Tariq Toukan
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Tariq Toukan @ 2025-11-09 9:37 UTC (permalink / raw)
To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn, David S. Miller
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
netdev, linux-rdma, linux-kernel, Gal Pressman, Carolina Jubran
From: Carolina Jubran <cjubran@nvidia.com>
Assign the return value of mlx5_eswitch_block_mode() to 'err' before
checking it to avoid returning an uninitialized error code.
Fixes: 22239eb258bc ("net/mlx5e: Prevent tunnel reformat when tunnel mode not allowed")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202510271649.uwsIxD6O-lkp@intel.com/
Closes: http://lore.kernel.org/linux-rdma/aPIEK4rLB586FdDt@stanley.mountain/
Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Jianbo Liu <jianbol@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
index 0a4fb8c92268..35d9530037a6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c
@@ -804,7 +804,8 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
goto err_xfrm;
}
- if (mlx5_eswitch_block_mode(priv->mdev))
+ err = mlx5_eswitch_block_mode(priv->mdev);
+ if (err)
goto unblock_ipsec;
if (x->props.mode == XFRM_MODE_TUNNEL &&
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net 2/5] net/mlx5e: Trim the length of the num_doorbell error
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 ` Tariq Toukan
2025-11-09 9:37 ` [PATCH net 3/5] net/mlx5e: Fix maxrate wraparound in threshold between units Tariq Toukan
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Tariq Toukan @ 2025-11-09 9:37 UTC (permalink / raw)
To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn, David S. Miller
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
netdev, linux-rdma, linux-kernel, Gal Pressman, Cosmin Ratiu
From: Cosmin Ratiu <cratiu@nvidia.com>
When trying to set num_doorbells to a value greater than the max number
of channels, the error message was going over the netlink limit of 80
chars, truncating the most important part of the message, the number of
channels.
Fix that by trimming the length a bit.
Fixes: 11bbcfb7668c ("net/mlx5e: Use the 'num_doorbells' devlink param")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/devlink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
index fceea83abbd7..887adf4807d1 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/devlink.c
@@ -541,7 +541,7 @@ static int mlx5_devlink_num_doorbells_validate(struct devlink *devlink, u32 id,
max_num_channels = mlx5e_get_max_num_channels(mdev);
if (val32 > max_num_channels) {
NL_SET_ERR_MSG_FMT_MOD(extack,
- "Requested num_doorbells (%u) exceeds maximum number of channels (%u)",
+ "Requested num_doorbells (%u) exceeds max number of channels (%u)",
val32, max_num_channels);
return -EINVAL;
}
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net 3/5] net/mlx5e: Fix maxrate wraparound in threshold between units
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 ` 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
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Tariq Toukan @ 2025-11-09 9:37 UTC (permalink / raw)
To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn, David S. Miller
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
netdev, linux-rdma, linux-kernel, Gal Pressman
From: Gal Pressman <gal@nvidia.com>
The previous calculation used roundup() which caused an overflow for
rates between 25.5Gbps and 26Gbps.
For example, a rate of 25.6Gbps would result in using 100Mbps units with
value of 256, which would overflow the 8 bits field.
Simplify the upper_limit_mbps calculation by removing the
unnecessary roundup, and adjust the comparison to use <= to correctly
handle the boundary condition.
Fixes: d8880795dabf ("net/mlx5e: Implement DCBNL IEEE max rate")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index d166c0d5189e..345614471052 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -595,18 +595,19 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
struct mlx5_core_dev *mdev = priv->mdev;
u8 max_bw_value[IEEE_8021QAZ_MAX_TCS];
u8 max_bw_unit[IEEE_8021QAZ_MAX_TCS];
- __u64 upper_limit_mbps = roundup(255 * MLX5E_100MB, MLX5E_1GB);
+ __u64 upper_limit_mbps;
int i;
memset(max_bw_value, 0, sizeof(max_bw_value));
memset(max_bw_unit, 0, sizeof(max_bw_unit));
+ upper_limit_mbps = 255 * MLX5E_100MB;
for (i = 0; i <= mlx5_max_tc(mdev); i++) {
if (!maxrate->tc_maxrate[i]) {
max_bw_unit[i] = MLX5_BW_NO_LIMIT;
continue;
}
- if (maxrate->tc_maxrate[i] < upper_limit_mbps) {
+ if (maxrate->tc_maxrate[i] <= upper_limit_mbps) {
max_bw_value[i] = div_u64(maxrate->tc_maxrate[i],
MLX5E_100MB);
max_bw_value[i] = max_bw_value[i] ? max_bw_value[i] : 1;
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net 4/5] net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps
2025-11-09 9:37 [PATCH net 0/5] mlx5e misc fixes 2025-11-09 Tariq Toukan
` (2 preceding siblings ...)
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 ` Tariq Toukan
2025-11-20 21:42 ` Danielle Costantino
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
5 siblings, 1 reply; 9+ messages in thread
From: Tariq Toukan @ 2025-11-09 9:37 UTC (permalink / raw)
To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn, David S. Miller
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
netdev, linux-rdma, linux-kernel, Gal Pressman
From: Gal Pressman <gal@nvidia.com>
Add validation to reject rates exceeding 255 Gbps that would overflow
the 8 bits max bandwidth field.
Fixes: d8880795dabf ("net/mlx5e: Implement DCBNL IEEE max rate")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index 345614471052..d88a48210fdc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -596,11 +596,13 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
u8 max_bw_value[IEEE_8021QAZ_MAX_TCS];
u8 max_bw_unit[IEEE_8021QAZ_MAX_TCS];
__u64 upper_limit_mbps;
+ __u64 upper_limit_gbps;
int i;
memset(max_bw_value, 0, sizeof(max_bw_value));
memset(max_bw_unit, 0, sizeof(max_bw_unit));
upper_limit_mbps = 255 * MLX5E_100MB;
+ upper_limit_gbps = 255 * MLX5E_1GB;
for (i = 0; i <= mlx5_max_tc(mdev); i++) {
if (!maxrate->tc_maxrate[i]) {
@@ -612,10 +614,16 @@ 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 {
+ } 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;
+ } else {
+ netdev_err(netdev,
+ "tc_%d maxrate %llu Kbps exceeds limit %llu\n",
+ i, maxrate->tc_maxrate[i],
+ upper_limit_gbps);
+ return -EINVAL;
}
}
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH net 5/5] net/mlx5e: Fix potentially misleading debug message
2025-11-09 9:37 [PATCH net 0/5] mlx5e misc fixes 2025-11-09 Tariq Toukan
` (3 preceding siblings ...)
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-09 9:37 ` Tariq Toukan
2025-11-11 14:10 ` [PATCH net 0/5] mlx5e misc fixes 2025-11-09 patchwork-bot+netdevbpf
5 siblings, 0 replies; 9+ messages in thread
From: Tariq Toukan @ 2025-11-09 9:37 UTC (permalink / raw)
To: Eric Dumazet, Jakub Kicinski, Paolo Abeni, Andrew Lunn, David S. Miller
Cc: Saeed Mahameed, Leon Romanovsky, Tariq Toukan, Mark Bloch,
netdev, linux-rdma, linux-kernel, Gal Pressman
From: Gal Pressman <gal@nvidia.com>
Change the debug message to print the correct units instead of always
assuming Gbps, as the value can be in either 100 Mbps or 1 Gbps units.
Fixes: 5da8bc3effb6 ("net/mlx5e: DCBNL, Add debug messages log")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Nimrod Oren <noren@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
.../net/ethernet/mellanox/mlx5/core/en_dcbnl.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index d88a48210fdc..9b93da4d52f6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -598,6 +598,19 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
__u64 upper_limit_mbps;
__u64 upper_limit_gbps;
int i;
+ struct {
+ int scale;
+ const char *units_str;
+ } units[] = {
+ [MLX5_100_MBPS_UNIT] = {
+ .scale = 100,
+ .units_str = "Mbps",
+ },
+ [MLX5_GBPS_UNIT] = {
+ .scale = 1,
+ .units_str = "Gbps",
+ },
+ };
memset(max_bw_value, 0, sizeof(max_bw_value));
memset(max_bw_unit, 0, sizeof(max_bw_unit));
@@ -628,8 +641,9 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
}
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
- netdev_dbg(netdev, "%s: tc_%d <=> max_bw %d Gbps\n",
- __func__, i, max_bw_value[i]);
+ netdev_dbg(netdev, "%s: tc_%d <=> max_bw %u %s\n", __func__, i,
+ max_bw_value[i] * units[max_bw_unit[i]].scale,
+ units[max_bw_unit[i]].units_str);
}
return mlx5_modify_port_ets_rate_limit(mdev, max_bw_value, max_bw_unit);
--
2.31.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net 0/5] mlx5e misc fixes 2025-11-09
2025-11-09 9:37 [PATCH net 0/5] mlx5e misc fixes 2025-11-09 Tariq Toukan
` (4 preceding siblings ...)
2025-11-09 9:37 ` [PATCH net 5/5] net/mlx5e: Fix potentially misleading debug message Tariq Toukan
@ 2025-11-11 14:10 ` patchwork-bot+netdevbpf
5 siblings, 0 replies; 9+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-11 14:10 UTC (permalink / raw)
To: Tariq Toukan
Cc: edumazet, kuba, pabeni, andrew+netdev, davem, saeedm, leon,
mbloch, netdev, linux-rdma, linux-kernel, gal
Hello:
This series was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Sun, 9 Nov 2025 11:37:48 +0200 you wrote:
> Hi,
>
> This patchset provides misc bug fixes from the team to the mlx5 Eth
> driver.
>
> Thanks,
> Tariq.
>
> [...]
Here is the summary with links:
- [net,1/5] net/mlx5e: Fix missing error assignment in mlx5e_xfrm_add_state()
https://git.kernel.org/netdev/net/c/0bcd5b3b50cc
- [net,2/5] net/mlx5e: Trim the length of the num_doorbell error
https://git.kernel.org/netdev/net/c/2dc768c05217
- [net,3/5] net/mlx5e: Fix maxrate wraparound in threshold between units
https://git.kernel.org/netdev/net/c/a7bf4d5063c7
- [net,4/5] net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps
https://git.kernel.org/netdev/net/c/43b27d1bd88a
- [net,5/5] net/mlx5e: Fix potentially misleading debug message
https://git.kernel.org/netdev/net/c/9fcc2b6c1052
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net 4/5] net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps
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
0 siblings, 1 reply; 9+ messages in thread
From: Danielle Costantino @ 2025-11-20 21:42 UTC (permalink / raw)
To: Gal Pressman, Paolo Abeni
Cc: Tariq Toukan, Nimrod Oren, Saeed Mahameed, Leon Romanovsky,
netdev, linux-kernel
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;
Here, max_bw_value[i] is used in the condition before it's assigned in
this branch. This appears to be a copy-paste error from the previous
commit a7bf4d5063c7 ("net/mlx5e: Fix maxrate wraparound in threshold
between units").
The condition should check the input value maxrate->tc_maxrate[i], not
the output variable max_bw_value[i]:
} else if (maxrate->tc_maxrate[i] <= upper_limit_gbps) {
This matches the pattern used in the first branch:
if (maxrate->tc_maxrate[i] <= upper_limit_mbps) {
max_bw_value[i] = div_u64(maxrate->tc_maxrate[i], MLX5E_100MB);
...
}
Impact:
-------
The current code will compare an uninitialized (or stale from previous
iteration) max_bw_value[i] against upper_limit_gbps, rather than
comparing the actual requested rate. This means:
1. For rates between 25.5 Gbps and 255 Gbps:
- If max_bw_value[i] happens to be 0 (from memset), the condition
(0 <= 255000000000) is true, incorrectly allowing the GBPS path
- The rate gets converted to Gbps units, which may be correct by
accident
2. The validation in the else clause that rejects rates > 255 Gbps may
never trigger correctly if max_bw_value[i] from a previous iteration
is small enough
3. For i > 0, max_bw_value[i] contains the computed value from the
previous TC, leading to incorrect branching logic
This makes the overflow validation unreliable and could allow rates that
should be rejected, or reject rates that should be accepted.
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.
Thanks,
--
Danielle Costantino
Meta Platforms, Inc.
Flagged by Claude Code with https://github.com/masoncl/review-prompts/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH net 4/5] net/mlx5e: Fix wraparound in rate limiting for values above 255 Gbps
2025-11-20 21:42 ` Danielle Costantino
@ 2025-11-23 7:05 ` Gal Pressman
0 siblings, 0 replies; 9+ messages in thread
From: Gal Pressman @ 2025-11-23 7:05 UTC (permalink / raw)
To: Danielle Costantino, Paolo Abeni
Cc: Tariq Toukan, Nimrod Oren, Saeed Mahameed, Leon Romanovsky,
netdev, linux-kernel
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!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-23 7:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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
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®