Commit 651f11a8 authored by Shay Agroskin's avatar Shay Agroskin Committed by Greg Kroah-Hartman

net/mlx5e: Refine ets validation function

[ Upstream commit e279d634 ]

Removed an error message received when configuring ETS total
bandwidth to be zero.
Our hardware doesn't support such configuration, so we shall
reject it in the driver. Nevertheless, we removed the error message
in order to eliminate error messages caused by old userspace tools
who try to pass such configuration.

Fixes: ff089191 ("net/mlx5e: Fix ETS BW check")
Signed-off-by: default avatarShay Agroskin <shayag@mellanox.com>
Reviewed-by: default avatarHuy Nguyen <huyn@mellanox.com>
Reviewed-by: default avatarEran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8b882dbb
...@@ -257,7 +257,8 @@ int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets) ...@@ -257,7 +257,8 @@ int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets)
} }
static int mlx5e_dbcnl_validate_ets(struct net_device *netdev, static int mlx5e_dbcnl_validate_ets(struct net_device *netdev,
struct ieee_ets *ets) struct ieee_ets *ets,
bool zero_sum_allowed)
{ {
bool have_ets_tc = false; bool have_ets_tc = false;
int bw_sum = 0; int bw_sum = 0;
...@@ -282,8 +283,9 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev, ...@@ -282,8 +283,9 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev,
} }
if (have_ets_tc && bw_sum != 100) { if (have_ets_tc && bw_sum != 100) {
netdev_err(netdev, if (bw_sum || (!bw_sum && !zero_sum_allowed))
"Failed to validate ETS: BW sum is illegal\n"); netdev_err(netdev,
"Failed to validate ETS: BW sum is illegal\n");
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
...@@ -298,7 +300,7 @@ static int mlx5e_dcbnl_ieee_setets(struct net_device *netdev, ...@@ -298,7 +300,7 @@ static int mlx5e_dcbnl_ieee_setets(struct net_device *netdev,
if (!MLX5_CAP_GEN(priv->mdev, ets)) if (!MLX5_CAP_GEN(priv->mdev, ets))
return -EOPNOTSUPP; return -EOPNOTSUPP;
err = mlx5e_dbcnl_validate_ets(netdev, ets); err = mlx5e_dbcnl_validate_ets(netdev, ets, false);
if (err) if (err)
return err; return err;
...@@ -477,12 +479,9 @@ static u8 mlx5e_dcbnl_setall(struct net_device *netdev) ...@@ -477,12 +479,9 @@ static u8 mlx5e_dcbnl_setall(struct net_device *netdev)
ets.prio_tc[i] = cee_cfg->prio_to_pg_map[i]; ets.prio_tc[i] = cee_cfg->prio_to_pg_map[i];
} }
err = mlx5e_dbcnl_validate_ets(netdev, &ets); err = mlx5e_dbcnl_validate_ets(netdev, &ets, true);
if (err) { if (err)
netdev_err(netdev,
"%s, Failed to validate ETS: %d\n", __func__, err);
goto out; goto out;
}
err = mlx5e_dcbnl_ieee_setets_core(priv, &ets); err = mlx5e_dcbnl_ieee_setets_core(priv, &ets);
if (err) { if (err) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment