Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Stephen Hemminger and committed by
David S. Miller
d8a33ac4 45b30105

+21 -1
+1
include/linux/netdevice.h
··· 913 913 extern void dev_set_promiscuity(struct net_device *dev, int inc); 914 914 extern void dev_set_allmulti(struct net_device *dev, int inc); 915 915 extern void netdev_state_change(struct net_device *dev); 916 + extern void netdev_features_change(struct net_device *dev); 916 917 /* Load a device via the kmod */ 917 918 extern void dev_load(const char *name); 918 919 extern void dev_mcast_init(void);
+1
include/linux/notifier.h
··· 56 56 #define NETDEV_CHANGEADDR 0x0008 57 57 #define NETDEV_GOING_DOWN 0x0009 58 58 #define NETDEV_CHANGENAME 0x000A 59 + #define NETDEV_FEAT_CHANGE 0x000B 59 60 60 61 #define SYS_DOWN 0x0001 /* Notify of system down */ 61 62 #define SYS_RESTART SYS_DOWN
+12
net/core/dev.c
··· 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 + */ 769 + void netdev_features_change(struct net_device *dev) 770 + { 771 + notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev); 772 + } 773 + EXPORT_SYMBOL(netdev_features_change); 774 + 775 + /** 764 776 * netdev_state_change - device changes state 765 777 * @dev: device to cause notification 766 778 *
+7 -1
net/core/ethtool.c
··· 682 682 void __user *useraddr = ifr->ifr_data; 683 683 u32 ethcmd; 684 684 int rc; 685 + int old_features; 685 686 686 687 /* 687 688 * XXX: This can be pushed down into the ethtool_* handlers that ··· 704 703 if ((rc = dev->ethtool_ops->begin(dev)) < 0) 705 704 return rc; 706 705 706 + old_features = dev->features; 707 + 707 708 switch (ethcmd) { 708 709 case ETHTOOL_GSET: 709 710 rc = ethtool_get_settings(dev, useraddr); ··· 715 712 break; 716 713 case ETHTOOL_GDRVINFO: 717 714 rc = ethtool_get_drvinfo(dev, useraddr); 718 - 719 715 break; 720 716 case ETHTOOL_GREGS: 721 717 rc = ethtool_get_regs(dev, useraddr); ··· 803 801 804 802 if(dev->ethtool_ops->complete) 805 803 dev->ethtool_ops->complete(dev); 804 + 805 + if (old_features != dev->features) 806 + netdev_features_change(dev); 807 + 806 808 return rc; 807 809 808 810 ioctl: