aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2005-05-29 17:13:47 -0400
committerDavid S. Miller <davem@davemloft.net>2005-05-29 17:13:47 -0400
commitd8a33ac435c43a1a404b2ec560ef1d1536710c36 (patch)
tree04359c09e0731e9c33a8c2dd80cc69404e0dde60
parent45b30105e7231b70bb855923dbca443ee3ba44c3 (diff)
[BRIDGE]: features change notification
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>
-rw-r--r--include/linux/netdevice.h1
-rw-r--r--include/linux/notifier.h1
-rw-r--r--net/core/dev.c12
-rw-r--r--net/core/ethtool.c8
4 files changed, 21 insertions, 1 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b25bd02720d3..d8c65ecef9d9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -913,6 +913,7 @@ extern void dev_mc_discard(struct net_device *dev);
913extern void dev_set_promiscuity(struct net_device *dev, int inc); 913extern void dev_set_promiscuity(struct net_device *dev, int inc);
914extern void dev_set_allmulti(struct net_device *dev, int inc); 914extern void dev_set_allmulti(struct net_device *dev, int inc);
915extern void netdev_state_change(struct net_device *dev); 915extern void netdev_state_change(struct net_device *dev);
916extern void netdev_features_change(struct net_device *dev);
916/* Load a device via the kmod */ 917/* Load a device via the kmod */
917extern void dev_load(const char *name); 918extern void dev_load(const char *name);
918extern void dev_mcast_init(void); 919extern void dev_mcast_init(void);
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 9303a003e9ab..5937dd6053c3 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -56,6 +56,7 @@ extern int notifier_call_chain(struct notifier_block **n, unsigned long val, voi
56#define NETDEV_CHANGEADDR 0x0008 56#define NETDEV_CHANGEADDR 0x0008
57#define NETDEV_GOING_DOWN 0x0009 57#define NETDEV_GOING_DOWN 0x0009
58#define NETDEV_CHANGENAME 0x000A 58#define NETDEV_CHANGENAME 0x000A
59#define NETDEV_FEAT_CHANGE 0x000B
59 60
60#define SYS_DOWN 0x0001 /* Notify of system down */ 61#define SYS_DOWN 0x0001 /* Notify of system down */
61#define SYS_RESTART SYS_DOWN 62#define SYS_RESTART SYS_DOWN
diff --git a/net/core/dev.c b/net/core/dev.c
index d4d9e2680adb..f15a3ffff635 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -761,6 +761,18 @@ int dev_change_name(struct net_device *dev, char *newname)
761} 761}
762 762
763/** 763/**
764 * netdev_features_change - device changes fatures
765 * @dev: device to cause notification
766 *
767 * Called to indicate a device has changed features.
768 */
769void netdev_features_change(struct net_device *dev)
770{
771 notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev);
772}
773EXPORT_SYMBOL(netdev_features_change);
774
775/**
764 * netdev_state_change - device changes state 776 * netdev_state_change - device changes state
765 * @dev: device to cause notification 777 * @dev: device to cause notification
766 * 778 *
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index f05fde97c43d..252bfc6f03f4 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -682,6 +682,7 @@ int dev_ethtool(struct ifreq *ifr)
682 void __user *useraddr = ifr->ifr_data; 682 void __user *useraddr = ifr->ifr_data;
683 u32 ethcmd; 683 u32 ethcmd;
684 int rc; 684 int rc;
685 int old_features;
685 686
686 /* 687 /*
687 * XXX: This can be pushed down into the ethtool_* handlers that 688 * XXX: This can be pushed down into the ethtool_* handlers that
@@ -703,6 +704,8 @@ int dev_ethtool(struct ifreq *ifr)
703 if ((rc = dev->ethtool_ops->begin(dev)) < 0) 704 if ((rc = dev->ethtool_ops->begin(dev)) < 0)
704 return rc; 705 return rc;
705 706
707 old_features = dev->features;
708
706 switch (ethcmd) { 709 switch (ethcmd) {
707 case ETHTOOL_GSET: 710 case ETHTOOL_GSET:
708 rc = ethtool_get_settings(dev, useraddr); 711 rc = ethtool_get_settings(dev, useraddr);
@@ -712,7 +715,6 @@ int dev_ethtool(struct ifreq *ifr)
712 break; 715 break;
713 case ETHTOOL_GDRVINFO: 716 case ETHTOOL_GDRVINFO:
714 rc = ethtool_get_drvinfo(dev, useraddr); 717 rc = ethtool_get_drvinfo(dev, useraddr);
715
716 break; 718 break;
717 case ETHTOOL_GREGS: 719 case ETHTOOL_GREGS:
718 rc = ethtool_get_regs(dev, useraddr); 720 rc = ethtool_get_regs(dev, useraddr);
@@ -801,6 +803,10 @@ int dev_ethtool(struct ifreq *ifr)
801 803
802 if(dev->ethtool_ops->complete) 804 if(dev->ethtool_ops->complete)
803 dev->ethtool_ops->complete(dev); 805 dev->ethtool_ops->complete(dev);
806
807 if (old_features != dev->features)
808 netdev_features_change(dev);
809
804 return rc; 810 return rc;
805 811
806 ioctl: 812 ioctl: