Merge branch 'mhi-net-immutable' of https://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_ethtool.c
index 2d37742..5e9474d 100644 (file)
@@ -447,12 +447,29 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
                goto out;
        }
 
-       new_channels.params = priv->channels.params;
+       /* Don't allow changing the number of channels if HTB offload is active,
+        * because the numeration of the QoS SQs will change, while per-queue
+        * qdiscs are attached.
+        */
+       if (priv->htb.maj_id) {
+               err = -EINVAL;
+               netdev_err(priv->netdev, "%s: HTB offload is active, cannot change the number of channels\n",
+                          __func__);
+               goto out;
+       }
+
+       new_channels.params = *cur_params;
        new_channels.params.num_channels = count;
 
        if (!test_bit(MLX5E_STATE_OPENED, &priv->state)) {
+               struct mlx5e_params old_params;
+
+               old_params = *cur_params;
                *cur_params = new_channels.params;
                err = mlx5e_num_channels_changed(priv);
+               if (err)
+                       *cur_params = old_params;
+
                goto out;
        }
 
@@ -1966,6 +1983,16 @@ static int set_pflag_tx_port_ts(struct net_device *netdev, bool enable)
        if (!MLX5_CAP_GEN(mdev, ts_cqe_to_dest_cqn))
                return -EOPNOTSUPP;
 
+       /* Don't allow changing the PTP state if HTB offload is active, because
+        * the numeration of the QoS SQs will change, while per-queue qdiscs are
+        * attached.
+        */
+       if (priv->htb.maj_id) {
+               netdev_err(priv->netdev, "%s: HTB offload is active, cannot change the PTP state\n",
+                          __func__);
+               return -EINVAL;
+       }
+
        new_channels.params = priv->channels.params;
        MLX5E_SET_PFLAG(&new_channels.params, MLX5E_PFLAG_TX_PORT_TS, enable);
        /* No need to verify SQ stop room as