]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/mlx5e: Use extack in get coalesce callback
authorGal Pressman <gal@nvidia.com>
Thu, 8 Aug 2024 05:59:23 +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 get coalesce, reflect it through extack instead of
a dmesg print.

Signed-off-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20240808055927.2059700-8-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 01781b70434cf0b507b3f4a1c4795c08d16827f0..7832f6b6c8a826f779cdbf4920247a97ed000334 100644 (file)
@@ -1180,7 +1180,8 @@ int mlx5e_ethtool_set_channels(struct mlx5e_priv *priv,
                               struct ethtool_channels *ch);
 int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
                               struct ethtool_coalesce *coal,
-                              struct kernel_ethtool_coalesce *kernel_coal);
+                              struct kernel_ethtool_coalesce *kernel_coal,
+                              struct netlink_ext_ack *extack);
 int mlx5e_ethtool_set_coalesce(struct mlx5e_priv *priv,
                               struct ethtool_coalesce *coal,
                               struct kernel_ethtool_coalesce *kernel_coal,
index 51624053722aa751900713b607d095f739b9ea01..9760215926db5b43cfa17c6f494855428e9c4295 100644 (file)
@@ -545,12 +545,15 @@ static int mlx5e_set_channels(struct net_device *dev,
 
 int mlx5e_ethtool_get_coalesce(struct mlx5e_priv *priv,
                               struct ethtool_coalesce *coal,
-                              struct kernel_ethtool_coalesce *kernel_coal)
+                              struct kernel_ethtool_coalesce *kernel_coal,
+                              struct netlink_ext_ack *extack)
 {
        struct dim_cq_moder *rx_moder, *tx_moder;
 
-       if (!MLX5_CAP_GEN(priv->mdev, cq_moderation))
+       if (!MLX5_CAP_GEN(priv->mdev, cq_moderation)) {
+               NL_SET_ERR_MSG_MOD(extack, "CQ moderation not supported");
                return -EOPNOTSUPP;
+       }
 
        rx_moder = &priv->channels.params.rx_cq_moderation;
        coal->rx_coalesce_usecs         = rx_moder->usec;
@@ -574,7 +577,7 @@ static int mlx5e_get_coalesce(struct net_device *netdev,
 {
        struct mlx5e_priv *priv = netdev_priv(netdev);
 
-       return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal);
+       return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal, extack);
 }
 
 static int mlx5e_ethtool_get_per_queue_coalesce(struct mlx5e_priv *priv, u32 queue,
index 916ba0db29f2fe088921d833bb373692c54310d7..b885042eef14229d9537bc5db71e539e65eb9c2b 100644 (file)
@@ -386,7 +386,7 @@ static int mlx5e_rep_get_coalesce(struct net_device *netdev,
 {
        struct mlx5e_priv *priv = netdev_priv(netdev);
 
-       return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal);
+       return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal, extack);
 }
 
 static int mlx5e_rep_set_coalesce(struct net_device *netdev,
index 424ff39db28d0eca7a47aa00cf75ee1d00c66dbd..9772327d5124614d3c45d81111c7361317cf81c1 100644 (file)
@@ -132,7 +132,7 @@ static int mlx5i_get_coalesce(struct net_device *netdev,
 {
        struct mlx5e_priv *priv = mlx5i_epriv(netdev);
 
-       return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal);
+       return mlx5e_ethtool_get_coalesce(priv, coal, kernel_coal, extack);
 }
 
 static int mlx5i_get_ts_info(struct net_device *netdev,