]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
net/mlx5e: Fix mutual exclusion between CQE compression and HW TS
authorAya Levin <ayal@nvidia.com>
Thu, 15 Jul 2021 07:53:28 +0000 (10:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:39:23 +0000 (12:39 +0200)
[ Upstream commit c91c1da72b47fc4c5e353cdd9099ba94ae07d2fa ]

Some profiles of the driver don't support a dedicated PTP-RQ, hence can't
support HW TS and CQE compression simultaneously. When HW TS is enabled
the COE compression is disabled, and should be restored when the HW TS
is turned off. Add rx_filter as an input to modifying CQE compression to
enforce this restriction.

Fixes: 256f79d13c1d ("net/mlx5e: Fix HW TS with CQE compression according to profile")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c

index b1b51bbba0541c2560db298eff2f68f8e9aece24..3f67efbe12fc5ca733a77b5014d954014227d217 100644 (file)
@@ -940,7 +940,7 @@ void mlx5e_set_rx_mode_work(struct work_struct *work);
 
 int mlx5e_hwstamp_set(struct mlx5e_priv *priv, struct ifreq *ifr);
 int mlx5e_hwstamp_get(struct mlx5e_priv *priv, struct ifreq *ifr);
-int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val);
+int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool val, bool rx_filter);
 
 int mlx5e_vlan_rx_add_vid(struct net_device *dev, __always_unused __be16 proto,
                          u16 vid);
index bd72572e03d1d0028d7e58373a92b091ab8d86a1..1cc279d389d6fa04ad59e645dd782421bf79ac0f 100644 (file)
@@ -1882,7 +1882,7 @@ static int set_pflag_rx_cqe_based_moder(struct net_device *netdev, bool enable)
        return set_pflag_cqe_based_moder(netdev, enable, true);
 }
 
-int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val)
+int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val, bool rx_filter)
 {
        bool curr_val = MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS);
        struct mlx5e_params new_params;
@@ -1894,8 +1894,7 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val
        if (curr_val == new_val)
                return 0;
 
-       if (new_val && !priv->profile->rx_ptp_support &&
-           priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE) {
+       if (new_val && !priv->profile->rx_ptp_support && rx_filter) {
                netdev_err(priv->netdev,
                           "Profile doesn't support enabling of CQE compression while hardware time-stamping is enabled.\n");
                return -EINVAL;
@@ -1903,7 +1902,7 @@ int mlx5e_modify_rx_cqe_compression_locked(struct mlx5e_priv *priv, bool new_val
 
        new_params = priv->channels.params;
        MLX5E_SET_PFLAG(&new_params, MLX5E_PFLAG_RX_CQE_COMPRESS, new_val);
-       if (priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE)
+       if (rx_filter)
                new_params.ptp_rx = new_val;
 
        if (new_params.ptp_rx == priv->channels.params.ptp_rx)
@@ -1926,12 +1925,14 @@ static int set_pflag_rx_cqe_compress(struct net_device *netdev,
 {
        struct mlx5e_priv *priv = netdev_priv(netdev);
        struct mlx5_core_dev *mdev = priv->mdev;
+       bool rx_filter;
        int err;
 
        if (!MLX5_CAP_GEN(mdev, cqe_compression))
                return -EOPNOTSUPP;
 
-       err = mlx5e_modify_rx_cqe_compression_locked(priv, enable);
+       rx_filter = priv->tstamp.rx_filter != HWTSTAMP_FILTER_NONE;
+       err = mlx5e_modify_rx_cqe_compression_locked(priv, enable, rx_filter);
        if (err)
                return err;
 
index 2d53eaf3b9241f2bf809eff7b08e09f3f76910fe..fa718e71db2d4807e3ce7c4e908579595db76b4e 100644 (file)
@@ -4004,14 +4004,14 @@ static int mlx5e_hwstamp_config_no_ptp_rx(struct mlx5e_priv *priv, bool rx_filte
 
        if (!rx_filter)
                /* Reset CQE compression to Admin default */
-               return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def);
+               return mlx5e_modify_rx_cqe_compression_locked(priv, rx_cqe_compress_def, false);
 
        if (!MLX5E_GET_PFLAG(&priv->channels.params, MLX5E_PFLAG_RX_CQE_COMPRESS))
                return 0;
 
        /* Disable CQE compression */
        netdev_warn(priv->netdev, "Disabling RX cqe compression\n");
-       err = mlx5e_modify_rx_cqe_compression_locked(priv, false);
+       err = mlx5e_modify_rx_cqe_compression_locked(priv, false, true);
        if (err)
                netdev_err(priv->netdev, "Failed disabling cqe compression err=%d\n", err);