linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ethtool: netlink: add missing netdev_features_change() call
@ 2020-11-05 16:26 Alexander Lobakin
  2020-11-07 23:23 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Lobakin @ 2020-11-05 16:26 UTC (permalink / raw)
  To: David S. Miller, Jakub Kicinski
  Cc: Michal Kubecek, Maxim Mikityanskiy, Alexander Lobakin, netdev,
	linux-kernel

After updating userspace Ethtool from 5.7 to 5.9, I noticed that
NETDEV_FEAT_CHANGE is no more raised when changing netdev features
through Ethtool.
That's because the old Ethtool ioctl interface always calls
netdev_features_change() at the end of user request processing to
inform the kernel that our netdevice has some features changed, but
the new Netlink interface does not. Instead, it just notifies itself
with ETHTOOL_MSG_FEATURES_NTF.
Replace this ethtool_notify() call with netdev_features_change(), so
the kernel will be aware of any features changes, just like in case
with the ioctl interface. This does not omit Ethtool notifications,
as Ethtool itself listens to NETDEV_FEAT_CHANGE and drops
ETHTOOL_MSG_FEATURES_NTF on it
(net/ethtool/netlink.c:ethnl_netdev_event()).

Fixes: 0980bfcd6954 ("ethtool: set netdev features with FEATURES_SET request")
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 net/ethtool/features.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/ethtool/features.c b/net/ethtool/features.c
index 8ee4cdbd6b82..38f526f2125d 100644
--- a/net/ethtool/features.c
+++ b/net/ethtool/features.c
@@ -279,8 +279,9 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
 					  wanted_diff_mask, new_active,
 					  active_diff_mask, compact);
 	}
+
 	if (mod)
-		ethtool_notify(dev, ETHTOOL_MSG_FEATURES_NTF, NULL);
+		netdev_features_change(dev);
 
 out_rtnl:
 	rtnl_unlock();
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] ethtool: netlink: add missing netdev_features_change() call
  2020-11-05 16:26 [PATCH net] ethtool: netlink: add missing netdev_features_change() call Alexander Lobakin
@ 2020-11-07 23:23 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2020-11-07 23:23 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: David S. Miller, Michal Kubecek, Maxim Mikityanskiy, netdev,
	linux-kernel

On Thu, 05 Nov 2020 16:26:58 +0000 Alexander Lobakin wrote:
> After updating userspace Ethtool from 5.7 to 5.9, I noticed that
> NETDEV_FEAT_CHANGE is no more raised when changing netdev features
> through Ethtool.
> That's because the old Ethtool ioctl interface always calls
> netdev_features_change() at the end of user request processing to
> inform the kernel that our netdevice has some features changed, but
> the new Netlink interface does not. Instead, it just notifies itself
> with ETHTOOL_MSG_FEATURES_NTF.
> Replace this ethtool_notify() call with netdev_features_change(), so
> the kernel will be aware of any features changes, just like in case
> with the ioctl interface. This does not omit Ethtool notifications,
> as Ethtool itself listens to NETDEV_FEAT_CHANGE and drops
> ETHTOOL_MSG_FEATURES_NTF on it
> (net/ethtool/netlink.c:ethnl_netdev_event()).
> 
> Fixes: 0980bfcd6954 ("ethtool: set netdev features with FEATURES_SET request")
> Signed-off-by: Alexander Lobakin <alobakin@pm.me>

LGTM, one nit below

> diff --git a/net/ethtool/features.c b/net/ethtool/features.c
> index 8ee4cdbd6b82..38f526f2125d 100644
> --- a/net/ethtool/features.c
> +++ b/net/ethtool/features.c
> @@ -279,8 +279,9 @@ int ethnl_set_features(struct sk_buff *skb, struct genl_info *info)
>  					  wanted_diff_mask, new_active,
>  					  active_diff_mask, compact);
>  	}
> +

I think the reply and notification are purposefully grouped, please
drop this extra new line.

>  	if (mod)
> -		ethtool_notify(dev, ETHTOOL_MSG_FEATURES_NTF, NULL);
> +		netdev_features_change(dev);
>  
>  out_rtnl:
>  	rtnl_unlock();


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-07 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 16:26 [PATCH net] ethtool: netlink: add missing netdev_features_change() call Alexander Lobakin
2020-11-07 23:23 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).