Re: [RFC PATCH net-next v2 06/17] ethtool: support for netlink notifications

From: Michal Kubecek
Date: Mon Jul 30 2018 - 13:01:25 EST


On Mon, Jul 30, 2018 at 03:16:55PM +0200, Jiri Pirko wrote:
> Mon, Jul 30, 2018 at 02:53:12PM CEST, mkubecek@xxxxxxx wrote:
>
> [...]
>
> >diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> >index c1295c7a452e..c4b0c575d57e 100644
> >--- a/include/linux/netdevice.h
> >+++ b/include/linux/netdevice.h
> >@@ -2444,6 +2444,7 @@ enum netdev_cmd {
> > NETDEV_CVLAN_FILTER_DROP_INFO,
> > NETDEV_SVLAN_FILTER_PUSH_INFO,
> > NETDEV_SVLAN_FILTER_DROP_INFO,
> >+ NETDEV_ETHTOOL,
>
> I don't understand why this goes through netdev notifier. What's the
> reason?

To allow triggering a notification from other code (ethtool ioctl or
e.g. netdev_features_change()) when netlink interface is built as a
module. If it's a (performance?) problem, an alternative could be having
a global pointer which would be either null or point to ethtool_notify()
depending on whether the module is loaded (and ready).

(Which made me realize I forgot to handle a race between module
unloading and processing a notification.)

Another question is if we really need the option to build the netlink
interface as a module. I must admit my main motivation to have it as
a module is that it makes testing and debugging easier.

Michal