Message ID | 20200305051542.991898-11-kuba@kernel.org |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
Series | ethtool: consolidate parameter checking for irq coalescing | expand |
On Wed, 2020-03-04 at 21:15 -0800, Jakub Kicinski wrote: > Set ethtool_ops->supported_coalesce_params to let > the core reject unsupported coalescing parameters. > > This driver did not previously reject unsupported parameters. > > v3: adjust commit message for new member name > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> > --- > drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 3 +++ > drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 ++++++ > drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c | 3 +++ > 3 files changed, 12 insertions(+) > the only minor thing is the duplication of the same flags in all types of mlx5 netdevs, all mlx5 netdevs use the same infrastructure of rx/tx ring management, so they will always share the same flags. Anyway i can follow up with a patch to factor out the duplication. Acked-by: Saeed Mahameed <saeedm@mellanox.com> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > index 06f6f08ff5eb..01539b874b5e 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c > @@ -1965,6 +1965,9 @@ static int mlx5e_set_rxnfc(struct net_device > *dev, struct ethtool_rxnfc *cmd) > } > > const struct ethtool_ops mlx5e_ethtool_ops = { > + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | > + ETHTOOL_COALESCE_MAX_FRAMES | > + ETHTOOL_COALESCE_USE_ADAPTIVE, > .get_drvinfo = mlx5e_get_drvinfo, > .get_link = ethtool_op_get_link, > .get_strings = mlx5e_get_strings, > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c > b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c > index 1a8897f80547..c506143c8559 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c > @@ -376,6 +376,9 @@ static int > mlx5e_uplink_rep_set_link_ksettings(struct net_device *netdev, > } > > static const struct ethtool_ops mlx5e_rep_ethtool_ops = { > + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | > + ETHTOOL_COALESCE_MAX_FRAMES | > + ETHTOOL_COALESCE_USE_ADAPTIVE, > .get_drvinfo = mlx5e_rep_get_drvinfo, > .get_link = ethtool_op_get_link, > .get_strings = mlx5e_rep_get_strings, > @@ -392,6 +395,9 @@ static const struct ethtool_ops > mlx5e_rep_ethtool_ops = { > }; > > static const struct ethtool_ops mlx5e_uplink_rep_ethtool_ops = { > + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | > + ETHTOOL_COALESCE_MAX_FRAMES | > + ETHTOOL_COALESCE_USE_ADAPTIVE, > .get_drvinfo = mlx5e_uplink_rep_get_drvinfo, > .get_link = ethtool_op_get_link, > .get_strings = mlx5e_rep_get_strings, > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c > b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c > index 90cb50fe17fd..1eef66ee849e 100644 > --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c > +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c > @@ -235,6 +235,9 @@ static int mlx5i_get_link_ksettings(struct > net_device *netdev, > } > > const struct ethtool_ops mlx5i_ethtool_ops = { > + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | > + ETHTOOL_COALESCE_MAX_FRAMES | > + ETHTOOL_COALESCE_USE_ADAPTIVE, > .get_drvinfo = mlx5i_get_drvinfo, > .get_strings = mlx5i_get_strings, > .get_sset_count = mlx5i_get_sset_count,
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c index 06f6f08ff5eb..01539b874b5e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c @@ -1965,6 +1965,9 @@ static int mlx5e_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) } const struct ethtool_ops mlx5e_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES | + ETHTOOL_COALESCE_USE_ADAPTIVE, .get_drvinfo = mlx5e_get_drvinfo, .get_link = ethtool_op_get_link, .get_strings = mlx5e_get_strings, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c index 1a8897f80547..c506143c8559 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c @@ -376,6 +376,9 @@ static int mlx5e_uplink_rep_set_link_ksettings(struct net_device *netdev, } static const struct ethtool_ops mlx5e_rep_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES | + ETHTOOL_COALESCE_USE_ADAPTIVE, .get_drvinfo = mlx5e_rep_get_drvinfo, .get_link = ethtool_op_get_link, .get_strings = mlx5e_rep_get_strings, @@ -392,6 +395,9 @@ static const struct ethtool_ops mlx5e_rep_ethtool_ops = { }; static const struct ethtool_ops mlx5e_uplink_rep_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES | + ETHTOOL_COALESCE_USE_ADAPTIVE, .get_drvinfo = mlx5e_uplink_rep_get_drvinfo, .get_link = ethtool_op_get_link, .get_strings = mlx5e_rep_get_strings, diff --git a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c index 90cb50fe17fd..1eef66ee849e 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c @@ -235,6 +235,9 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev, } const struct ethtool_ops mlx5i_ethtool_ops = { + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | + ETHTOOL_COALESCE_MAX_FRAMES | + ETHTOOL_COALESCE_USE_ADAPTIVE, .get_drvinfo = mlx5i_get_drvinfo, .get_strings = mlx5i_get_strings, .get_sset_count = mlx5i_get_sset_count,
Set ethtool_ops->supported_coalesce_params to let the core reject unsupported coalescing parameters. This driver did not previously reject unsupported parameters. v3: adjust commit message for new member name Signed-off-by: Jakub Kicinski <kuba@kernel.org> --- drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 3 +++ drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 6 ++++++ drivers/net/ethernet/mellanox/mlx5/core/ipoib/ethtool.c | 3 +++ 3 files changed, 12 insertions(+)