]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux.git] / drivers / net / ethernet / mellanox / mlx5 / core / en_ethtool.c
index 20e628c907e53a3020c211575e059ab800c22e50..7347d673f448a4203283e1c6d2198cbcad34bfc7 100644 (file)
@@ -1958,21 +1958,27 @@ static u32 mlx5e_get_priv_flags(struct net_device *netdev)
        return priv->channels.params.pflags;
 }
 
-#ifndef CONFIG_MLX5_EN_RXNFC
-/* When CONFIG_MLX5_EN_RXNFC=n we only support ETHTOOL_GRXRINGS
- * otherwise this function will be defined from en_fs_ethtool.c
- */
 static int mlx5e_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info, u32 *rule_locs)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
 
-       if (info->cmd != ETHTOOL_GRXRINGS)
-               return -EOPNOTSUPP;
-       /* ring_count is needed by ethtool -x */
-       info->data = priv->channels.params.num_channels;
-       return 0;
+       /* ETHTOOL_GRXRINGS is needed by ethtool -x which is not part
+        * of rxnfc. We keep this logic out of mlx5e_ethtool_get_rxnfc,
+        * to avoid breaking "ethtool -x" when mlx5e_ethtool_get_rxnfc
+        * is compiled out via CONFIG_MLX5_EN_RXNFC=n.
+        */
+       if (info->cmd == ETHTOOL_GRXRINGS) {
+               info->data = priv->channels.params.num_channels;
+               return 0;
+       }
+
+       return mlx5e_ethtool_get_rxnfc(dev, info, rule_locs);
+}
+
+static int mlx5e_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
+{
+       return mlx5e_ethtool_set_rxnfc(dev, cmd);
 }
-#endif
 
 const struct ethtool_ops mlx5e_ethtool_ops = {
        .get_drvinfo       = mlx5e_get_drvinfo,
@@ -1993,9 +1999,7 @@ const struct ethtool_ops mlx5e_ethtool_ops = {
        .get_rxfh          = mlx5e_get_rxfh,
        .set_rxfh          = mlx5e_set_rxfh,
        .get_rxnfc         = mlx5e_get_rxnfc,
-#ifdef CONFIG_MLX5_EN_RXNFC
        .set_rxnfc         = mlx5e_set_rxnfc,
-#endif
        .get_tunable       = mlx5e_get_tunable,
        .set_tunable       = mlx5e_set_tunable,
        .get_pauseparam    = mlx5e_get_pauseparam,