Commit ed6b5632 authored by Paolo Abeni's avatar Paolo Abeni
Browse files

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: default avatarPaolo Abeni <pabeni@redhat.com>
parents 02e9578c 9fcc2b6c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 −1
Original line number Diff line number Diff line
@@ -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 &&
+28 −5
Original line number Diff line number Diff line
@@ -595,32 +595,55 @@ 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;
	__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));
	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]) {
			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;
			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;
		}
	}

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