Skip to content

Commit ed6b563

Browse files
author
Paolo Abeni
committed
Merge branch 'mlx5e-misc-fixes-2025-11-09'
Tariq Toukan says: ==================== mlx5e misc fixes 2025-11-09 This patchset provides misc bug fixes from the team to the mlx5 Eth driver. ==================== Link: https://patch.msgid.link/1762681073-1084058-1-git-send-email-tariqt@nvidia.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2 parents 02e9578 + 9fcc2b6 commit ed6b563

3 files changed

Lines changed: 31 additions & 7 deletions

File tree

drivers/net/ethernet/mellanox/mlx5/core/devlink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ static int mlx5_devlink_num_doorbells_validate(struct devlink *devlink, u32 id,
541541
max_num_channels = mlx5e_get_max_num_channels(mdev);
542542
if (val32 > max_num_channels) {
543543
NL_SET_ERR_MSG_FMT_MOD(extack,
544-
"Requested num_doorbells (%u) exceeds maximum number of channels (%u)",
544+
"Requested num_doorbells (%u) exceeds max number of channels (%u)",
545545
val32, max_num_channels);
546546
return -EINVAL;
547547
}

drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,8 @@ static int mlx5e_xfrm_add_state(struct net_device *dev,
804804
goto err_xfrm;
805805
}
806806

807-
if (mlx5_eswitch_block_mode(priv->mdev))
807+
err = mlx5_eswitch_block_mode(priv->mdev);
808+
if (err)
808809
goto unblock_ipsec;
809810

810811
if (x->props.mode == XFRM_MODE_TUNNEL &&

drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -595,32 +595,55 @@ static int mlx5e_dcbnl_ieee_setmaxrate(struct net_device *netdev,
595595
struct mlx5_core_dev *mdev = priv->mdev;
596596
u8 max_bw_value[IEEE_8021QAZ_MAX_TCS];
597597
u8 max_bw_unit[IEEE_8021QAZ_MAX_TCS];
598-
__u64 upper_limit_mbps = roundup(255 * MLX5E_100MB, MLX5E_1GB);
598+
__u64 upper_limit_mbps;
599+
__u64 upper_limit_gbps;
599600
int i;
601+
struct {
602+
int scale;
603+
const char *units_str;
604+
} units[] = {
605+
[MLX5_100_MBPS_UNIT] = {
606+
.scale = 100,
607+
.units_str = "Mbps",
608+
},
609+
[MLX5_GBPS_UNIT] = {
610+
.scale = 1,
611+
.units_str = "Gbps",
612+
},
613+
};
600614

601615
memset(max_bw_value, 0, sizeof(max_bw_value));
602616
memset(max_bw_unit, 0, sizeof(max_bw_unit));
617+
upper_limit_mbps = 255 * MLX5E_100MB;
618+
upper_limit_gbps = 255 * MLX5E_1GB;
603619

604620
for (i = 0; i <= mlx5_max_tc(mdev); i++) {
605621
if (!maxrate->tc_maxrate[i]) {
606622
max_bw_unit[i] = MLX5_BW_NO_LIMIT;
607623
continue;
608624
}
609-
if (maxrate->tc_maxrate[i] < upper_limit_mbps) {
625+
if (maxrate->tc_maxrate[i] <= upper_limit_mbps) {
610626
max_bw_value[i] = div_u64(maxrate->tc_maxrate[i],
611627
MLX5E_100MB);
612628
max_bw_value[i] = max_bw_value[i] ? max_bw_value[i] : 1;
613629
max_bw_unit[i] = MLX5_100_MBPS_UNIT;
614-
} else {
630+
} else if (max_bw_value[i] <= upper_limit_gbps) {
615631
max_bw_value[i] = div_u64(maxrate->tc_maxrate[i],
616632
MLX5E_1GB);
617633
max_bw_unit[i] = MLX5_GBPS_UNIT;
634+
} else {
635+
netdev_err(netdev,
636+
"tc_%d maxrate %llu Kbps exceeds limit %llu\n",
637+
i, maxrate->tc_maxrate[i],
638+
upper_limit_gbps);
639+
return -EINVAL;
618640
}
619641
}
620642

621643
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
622-
netdev_dbg(netdev, "%s: tc_%d <=> max_bw %d Gbps\n",
623-
__func__, i, max_bw_value[i]);
644+
netdev_dbg(netdev, "%s: tc_%d <=> max_bw %u %s\n", __func__, i,
645+
max_bw_value[i] * units[max_bw_unit[i]].scale,
646+
units[max_bw_unit[i]].units_str);
624647
}
625648

626649
return mlx5_modify_port_ets_rate_limit(mdev, max_bw_value, max_bw_unit);

0 commit comments

Comments
 (0)