mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-27 01:11:31 +00:00
net/mlx5e: Fix ETS BW check
Fix bug that allows ets bw sum to be 0% when ets tc type exists.
Fixes: 08fb1dacdd ('net/mlx5e: Support DCBNL IEEE ETS')
Signed-off-by: Moshe Shemesh <moshe@mellanox.com>
Reviewed-by: Huy Nguyen <huyn@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
37e92a9d4f
commit
ff0891915c
1 changed files with 7 additions and 3 deletions
|
|
@ -274,6 +274,7 @@ 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 have_ets_tc = false;
|
||||||
int bw_sum = 0;
|
int bw_sum = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -288,11 +289,14 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Validate Bandwidth Sum */
|
/* Validate Bandwidth Sum */
|
||||||
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
|
for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) {
|
||||||
if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS)
|
if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) {
|
||||||
|
have_ets_tc = true;
|
||||||
bw_sum += ets->tc_tx_bw[i];
|
bw_sum += ets->tc_tx_bw[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (bw_sum != 0 && bw_sum != 100) {
|
if (have_ets_tc && bw_sum != 100) {
|
||||||
netdev_err(netdev,
|
netdev_err(netdev,
|
||||||
"Failed to validate ETS: BW sum is illegal\n");
|
"Failed to validate ETS: BW sum is illegal\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue