[BRIDGE]: features change notification
authorStephen Hemminger <shemminger@osdl.org>
Sun, 29 May 2005 21:13:47 +0000 (14:13 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 29 May 2005 21:13:47 +0000 (14:13 -0700)
Resend of earlier patch (no changes) from Catalin used to provide
device feature change notification.

Signed-off-by: Catalin BOIE <catab at umbrella.ro>
Acked-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
include/linux/notifier.h
net/core/dev.c
net/core/ethtool.c

index b25bd02720d3010cbdd692cc9720ddb8faf3022d..d8c65ecef9d9c78c318bb2dfda4241f565a74574 100644 (file)
@@ -913,6 +913,7 @@ extern void         dev_mc_discard(struct net_device *dev);
 extern void            dev_set_promiscuity(struct net_device *dev, int inc);
 extern void            dev_set_allmulti(struct net_device *dev, int inc);
 extern void            netdev_state_change(struct net_device *dev);
+extern void            netdev_features_change(struct net_device *dev);
 /* Load a device via the kmod */
 extern void            dev_load(const char *name);
 extern void            dev_mcast_init(void);
index 9303a003e9ab85147dcafc82c6d74fc27d468bf5..5937dd6053c398d594889a02c4894924f577ba16 100644 (file)
@@ -56,6 +56,7 @@ extern int notifier_call_chain(struct notifier_block **n, unsigned long val, voi
 #define NETDEV_CHANGEADDR      0x0008
 #define NETDEV_GOING_DOWN      0x0009
 #define NETDEV_CHANGENAME      0x000A
+#define NETDEV_FEAT_CHANGE     0x000B
 
 #define SYS_DOWN       0x0001  /* Notify of system down */
 #define SYS_RESTART    SYS_DOWN
index d4d9e2680adbbc6c52c2b8486857a7573b96cec3..f15a3ffff635d9c6ef5edf65c8dbeff02509793b 100644 (file)
@@ -760,6 +760,18 @@ int dev_change_name(struct net_device *dev, char *newname)
        return err;
 }
 
+/**
+ *     netdev_features_change - device changes fatures
+ *     @dev: device to cause notification
+ *
+ *     Called to indicate a device has changed features.
+ */
+void netdev_features_change(struct net_device *dev)
+{
+       notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev);
+}
+EXPORT_SYMBOL(netdev_features_change);
+
 /**
  *     netdev_state_change - device changes state
  *     @dev: device to cause notification
index f05fde97c43d6a8741fa8992972f022998be5161..252bfc6f03f4ad9ed6050c848e99b8758d3f7986 100644 (file)
@@ -682,6 +682,7 @@ int dev_ethtool(struct ifreq *ifr)
        void __user *useraddr = ifr->ifr_data;
        u32 ethcmd;
        int rc;
+       int old_features;
 
        /*
         * XXX: This can be pushed down into the ethtool_* handlers that
@@ -703,6 +704,8 @@ int dev_ethtool(struct ifreq *ifr)
                if ((rc = dev->ethtool_ops->begin(dev)) < 0)
                        return rc;
 
+       old_features = dev->features;
+
        switch (ethcmd) {
        case ETHTOOL_GSET:
                rc = ethtool_get_settings(dev, useraddr);
@@ -712,7 +715,6 @@ int dev_ethtool(struct ifreq *ifr)
                break;
        case ETHTOOL_GDRVINFO:
                rc = ethtool_get_drvinfo(dev, useraddr);
-
                break;
        case ETHTOOL_GREGS:
                rc = ethtool_get_regs(dev, useraddr);
@@ -801,6 +803,10 @@ int dev_ethtool(struct ifreq *ifr)
        
        if(dev->ethtool_ops->complete)
                dev->ethtool_ops->complete(dev);
+
+       if (old_features != dev->features)
+               netdev_features_change(dev);
+
        return rc;
 
  ioctl: