aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2014-05-28 21:44:46 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-02 13:40:54 -0400
commit670e5b8eaf85704742bc3cb1df51fdd3ce08fc15 (patch)
treeb11726054cc9e4741d00666998c9010b59608f7b /include/linux
parent3e820811583e7c7f8d7793775d82898e5136a855 (diff)
net: Add support for device specific address syncing
This change provides a function to be used in order to break the ndo_set_rx_mode call into a set of address add and remove calls. The code is based on the implementation of dev_uc_sync/dev_mc_sync. Since they essentially do the same thing but with only one dev I simply named my functions __dev_uc_sync/__dev_mc_sync. I also implemented an unsync version of the functions as well to allow for cleanup on close. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/netdevice.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 2db1610bf109..774e5391eb8e 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3003,6 +3003,15 @@ int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
3003 struct netdev_hw_addr_list *from_list, int addr_len); 3003 struct netdev_hw_addr_list *from_list, int addr_len);
3004void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, 3004void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
3005 struct netdev_hw_addr_list *from_list, int addr_len); 3005 struct netdev_hw_addr_list *from_list, int addr_len);
3006int __hw_addr_sync_dev(struct netdev_hw_addr_list *list,
3007 struct net_device *dev,
3008 int (*sync)(struct net_device *, const unsigned char *),
3009 int (*unsync)(struct net_device *,
3010 const unsigned char *));
3011void __hw_addr_unsync_dev(struct netdev_hw_addr_list *list,
3012 struct net_device *dev,
3013 int (*unsync)(struct net_device *,
3014 const unsigned char *));
3006void __hw_addr_init(struct netdev_hw_addr_list *list); 3015void __hw_addr_init(struct netdev_hw_addr_list *list);
3007 3016
3008/* Functions used for device addresses handling */ 3017/* Functions used for device addresses handling */
@@ -3023,6 +3032,38 @@ void dev_uc_unsync(struct net_device *to, struct net_device *from);
3023void dev_uc_flush(struct net_device *dev); 3032void dev_uc_flush(struct net_device *dev);
3024void dev_uc_init(struct net_device *dev); 3033void dev_uc_init(struct net_device *dev);
3025 3034
3035/**
3036 * __dev_uc_sync - Synchonize device's unicast list
3037 * @dev: device to sync
3038 * @sync: function to call if address should be added
3039 * @unsync: function to call if address should be removed
3040 *
3041 * Add newly added addresses to the interface, and release
3042 * addresses that have been deleted.
3043 **/
3044static inline int __dev_uc_sync(struct net_device *dev,
3045 int (*sync)(struct net_device *,
3046 const unsigned char *),
3047 int (*unsync)(struct net_device *,
3048 const unsigned char *))
3049{
3050 return __hw_addr_sync_dev(&dev->uc, dev, sync, unsync);
3051}
3052
3053/**
3054 * __dev_uc_unsync - Remove synchonized addresses from device
3055 * @dev: device to sync
3056 * @unsync: function to call if address should be removed
3057 *
3058 * Remove all addresses that were added to the device by dev_uc_sync().
3059 **/
3060static inline void __dev_uc_unsync(struct net_device *dev,
3061 int (*unsync)(struct net_device *,
3062 const unsigned char *))
3063{
3064 __hw_addr_unsync_dev(&dev->uc, dev, unsync);
3065}
3066
3026/* Functions used for multicast addresses handling */ 3067/* Functions used for multicast addresses handling */
3027int dev_mc_add(struct net_device *dev, const unsigned char *addr); 3068int dev_mc_add(struct net_device *dev, const unsigned char *addr);
3028int dev_mc_add_global(struct net_device *dev, const unsigned char *addr); 3069int dev_mc_add_global(struct net_device *dev, const unsigned char *addr);
@@ -3035,6 +3076,38 @@ void dev_mc_unsync(struct net_device *to, struct net_device *from);
3035void dev_mc_flush(struct net_device *dev); 3076void dev_mc_flush(struct net_device *dev);
3036void dev_mc_init(struct net_device *dev); 3077void dev_mc_init(struct net_device *dev);
3037 3078
3079/**
3080 * __dev_mc_sync - Synchonize device's multicast list
3081 * @dev: device to sync
3082 * @sync: function to call if address should be added
3083 * @unsync: function to call if address should be removed
3084 *
3085 * Add newly added addresses to the interface, and release
3086 * addresses that have been deleted.
3087 **/
3088static inline int __dev_mc_sync(struct net_device *dev,
3089 int (*sync)(struct net_device *,
3090 const unsigned char *),
3091 int (*unsync)(struct net_device *,
3092 const unsigned char *))
3093{
3094 return __hw_addr_sync_dev(&dev->mc, dev, sync, unsync);
3095}
3096
3097/**
3098 * __dev_mc_unsync - Remove synchonized addresses from device
3099 * @dev: device to sync
3100 * @unsync: function to call if address should be removed
3101 *
3102 * Remove all addresses that were added to the device by dev_mc_sync().
3103 **/
3104static inline void __dev_mc_unsync(struct net_device *dev,
3105 int (*unsync)(struct net_device *,
3106 const unsigned char *))
3107{
3108 __hw_addr_unsync_dev(&dev->mc, dev, unsync);
3109}
3110
3038/* Functions used for secondary unicast and multicast support */ 3111/* Functions used for secondary unicast and multicast support */
3039void dev_set_rx_mode(struct net_device *dev); 3112void dev_set_rx_mode(struct net_device *dev);
3040void __dev_set_rx_mode(struct net_device *dev); 3113void __dev_set_rx_mode(struct net_device *dev);