| From foo@baz Wed 22 May 2019 08:37:51 AM CEST |
| From: Saeed Mahameed <saeedm@mellanox.com> |
| Date: Tue, 7 May 2019 12:59:38 -0700 |
| Subject: net/mlx5e: Fix ethtool rxfh commands when CONFIG_MLX5_EN_RXNFC is disabled |
| |
| From: Saeed Mahameed <saeedm@mellanox.com> |
| |
| [ Upstream commit 8f0916c6dc5cd5e3bc52416fa2a9ff4075080180 ] |
| |
| ethtool user spaces needs to know ring count via ETHTOOL_GRXRINGS when |
| executing (ethtool -x) which is retrieved via ethtool get_rxnfc callback, |
| in mlx5 this callback is disabled when CONFIG_MLX5_EN_RXNFC=n. |
| |
| This patch allows only ETHTOOL_GRXRINGS command on mlx5e_get_rxnfc() when |
| CONFIG_MLX5_EN_RXNFC is disabled, so ethtool -x will continue working. |
| |
| Fixes: fe6d86b3c316 ("net/mlx5e: Add CONFIG_MLX5_EN_RXNFC for ethtool rx nfc") |
| Signed-off-by: Saeed Mahameed <saeedm@mellanox.com> |
| Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| --- |
| drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 18 +++++++++++++++++- |
| 1 file changed, 17 insertions(+), 1 deletion(-) |
| |
| --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
| +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c |
| @@ -1609,6 +1609,22 @@ static int mlx5e_flash_device(struct net |
| return mlx5e_ethtool_flash_device(priv, flash); |
| } |
| |
| +#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; |
| +} |
| +#endif |
| + |
| const struct ethtool_ops mlx5e_ethtool_ops = { |
| .get_drvinfo = mlx5e_get_drvinfo, |
| .get_link = ethtool_op_get_link, |
| @@ -1627,8 +1643,8 @@ const struct ethtool_ops mlx5e_ethtool_o |
| .get_rxfh_indir_size = mlx5e_get_rxfh_indir_size, |
| .get_rxfh = mlx5e_get_rxfh, |
| .set_rxfh = mlx5e_set_rxfh, |
| -#ifdef CONFIG_MLX5_EN_RXNFC |
| .get_rxnfc = mlx5e_get_rxnfc, |
| +#ifdef CONFIG_MLX5_EN_RXNFC |
| .set_rxnfc = mlx5e_set_rxnfc, |
| #endif |
| .flash_device = mlx5e_flash_device, |