]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net/mlx5e: Check support before TC swap in ETS init
authorTariq Toukan <tariqt@mellanox.com>
Tue, 10 Oct 2017 13:54:30 +0000 (16:54 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 12 Jan 2018 00:01:49 +0000 (02:01 +0200)
Should not do the following swap between TCs 0 and 1
when max num of TCs is 1:
tclass[prio=0]=1, tclass[prio=1]=0, tclass[prio=i]=i (for i>1)

Fixes: 08fb1dacdd76 ("net/mlx5e: Support DCBNL IEEE ETS")
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c

index a5c5134f5cb25af4935ab597ce50c967d81a5dc2..3d46ef48d5b82ef0d1f85e93a0ac0694080173b4 100644 (file)
@@ -937,9 +937,11 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv)
                ets.prio_tc[i] = i;
        }
 
-       /* tclass[prio=0]=1, tclass[prio=1]=0, tclass[prio=i]=i (for i>1) */
-       ets.prio_tc[0] = 1;
-       ets.prio_tc[1] = 0;
+       if (ets.ets_cap > 1) {
+               /* tclass[prio=0]=1, tclass[prio=1]=0, tclass[prio=i]=i (for i>1) */
+               ets.prio_tc[0] = 1;
+               ets.prio_tc[1] = 0;
+       }
 
        err = mlx5e_dcbnl_ieee_setets_core(priv, &ets);
        if (err)