]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/mlx5e: Use extack in set ringparams callback
authorGal Pressman <gal@nvidia.com>
Thu, 8 Aug 2024 05:59:22 +0000 (08:59 +0300)
committerJakub Kicinski <kuba@kernel.org>
Sat, 10 Aug 2024 05:13:15 +0000 (22:13 -0700)
In case of errors in set ringparams, reflect it through extack instead
of a dmesg print.
While at it, make the messages more human friendly and remove two
redundant checks that are already validated by the core.

Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20240808055927.2059700-7-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@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_rep.c
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c

index 5fd82c67b6ab7f9e827c936408d66cc93c5db51e..01781b70434cf0b507b3f4a1c4795c08d16827f0 100644 (file)
@@ -1172,7 +1172,8 @@ void mlx5e_ethtool_get_ringparam(struct mlx5e_priv *priv,
                                 struct ethtool_ringparam *param,
                                 struct kernel_ethtool_ringparam *kernel_param);
 int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv,
-                               struct ethtool_ringparam *param);
+                               struct ethtool_ringparam *param,
+                               struct netlink_ext_ack *extack);
 void mlx5e_ethtool_get_channels(struct mlx5e_priv *priv,
                                struct ethtool_channels *ch);
 int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
index 5fd81253d6b9d3155a26835c19aadb20e61d1be0..51624053722aa751900713b607d095f739b9ea01 100644 (file)
@@ -352,35 +352,25 @@ static void mlx5e_get_ringparam(struct net_device *dev,
 }
 
 int mlx5e_ethtool_set_ringparam(struct mlx5e_priv *priv,
-                               struct ethtool_ringparam *param)
+                               struct ethtool_ringparam *param,
+                               struct netlink_ext_ack *extack)
 {
        struct mlx5e_params new_params;
        u8 log_rq_size;
        u8 log_sq_size;
        int err = 0;
 
-       if (param->rx_jumbo_pending) {
-               netdev_info(priv->netdev, "%s: rx_jumbo_pending not supported\n",
-                           __func__);
-               return -EINVAL;
-       }
-       if (param->rx_mini_pending) {
-               netdev_info(priv->netdev, "%s: rx_mini_pending not supported\n",
-                           __func__);
-               return -EINVAL;
-       }
-
        if (param->rx_pending < (1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE)) {
-               netdev_info(priv->netdev, "%s: rx_pending (%d) < min (%d)\n",
-                           __func__, param->rx_pending,
-                           1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE);
+               NL_SET_ERR_MSG_FMT_MOD(extack, "rx (%d) < min (%d)",
+                                      param->rx_pending,
+                                      1 << MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE);
                return -EINVAL;
        }
 
        if (param->tx_pending < (1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)) {
-               netdev_info(priv->netdev, "%s: tx_pending (%d) < min (%d)\n",
-                           __func__, param->tx_pending,
-                           1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE);
+               NL_SET_ERR_MSG_FMT_MOD(extack, "tx (%d) < min (%d)",
+                                      param->tx_pending,
+                                      1 << MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE);
                return -EINVAL;
        }
 
@@ -416,7 +406,7 @@ static int mlx5e_set_ringparam(struct net_device *dev,
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
 
-       return mlx5e_ethtool_set_ringparam(priv, param);
+       return mlx5e_ethtool_set_ringparam(priv, param, extack);
 }
 
 void mlx5e_ethtool_get_channels(struct mlx5e_priv *priv,
index 8790d57dc6dbf0bc466ec7bdef66680ec2a587a8..916ba0db29f2fe088921d833bb373692c54310d7 100644 (file)
@@ -360,7 +360,7 @@ mlx5e_rep_set_ringparam(struct net_device *dev,
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
 
-       return mlx5e_ethtool_set_ringparam(priv, param);
+       return mlx5e_ethtool_set_ringparam(priv, param, extack);
 }
 
 static void mlx5e_rep_get_channels(struct net_device *dev,
index 26f8a11b89068ef0e7323276daf1890cb024d250..424ff39db28d0eca7a47aa00cf75ee1d00c66dbd 100644 (file)
@@ -74,7 +74,7 @@ static int mlx5i_set_ringparam(struct net_device *dev,
 {
        struct mlx5e_priv *priv = mlx5i_epriv(dev);
 
-       return mlx5e_ethtool_set_ringparam(priv, param);
+       return mlx5e_ethtool_set_ringparam(priv, param, extack);
 }
 
 static void mlx5i_get_ringparam(struct net_device *dev,