aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-04-01 17:22:57 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-03 17:22:15 -0400
commit22bedad3ce112d5ca1eaf043d4990fa2ed698c87 (patch)
treeb6fba5688d48b1396f01d13ee53610dea7749c15 /include/linux/netdevice.h
parenta748ee2426817a95b1f03012d8f339c45c722ae1 (diff)
net: convert multicast list to list_head
Converts the list and the core manipulating with it to be the same as uc_list. +uses two functions for adding/removing mc address (normal and "global" variant) instead of a function parameter. +removes dev_mcast.c completely. +exposes netdev_hw_addr_list_* macros along with __hw_addr_* functions for manipulation with lists on a sandbox (used in bonding and 80211 drivers) Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h82
1 files changed, 42 insertions, 40 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 60f0c83192fe..a343a21ba8b9 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -228,25 +228,6 @@ struct netif_rx_stats {
228 228
229DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat); 229DECLARE_PER_CPU(struct netif_rx_stats, netdev_rx_stat);
230 230
231struct dev_addr_list {
232 struct dev_addr_list *next;
233 u8 da_addr[MAX_ADDR_LEN];
234 u8 da_addrlen;
235 u8 da_synced;
236 int da_users;
237 int da_gusers;
238};
239
240/*
241 * We tag multicasts with these structures.
242 */
243
244#define dev_mc_list dev_addr_list
245#define dmi_addr da_addr
246#define dmi_addrlen da_addrlen
247#define dmi_users da_users
248#define dmi_gusers da_gusers
249
250struct netdev_hw_addr { 231struct netdev_hw_addr {
251 struct list_head list; 232 struct list_head list;
252 unsigned char addr[MAX_ADDR_LEN]; 233 unsigned char addr[MAX_ADDR_LEN];
@@ -255,8 +236,10 @@ struct netdev_hw_addr {
255#define NETDEV_HW_ADDR_T_SAN 2 236#define NETDEV_HW_ADDR_T_SAN 2
256#define NETDEV_HW_ADDR_T_SLAVE 3 237#define NETDEV_HW_ADDR_T_SLAVE 3
257#define NETDEV_HW_ADDR_T_UNICAST 4 238#define NETDEV_HW_ADDR_T_UNICAST 4
239#define NETDEV_HW_ADDR_T_MULTICAST 5
258 int refcount; 240 int refcount;
259 bool synced; 241 bool synced;
242 bool global_use;
260 struct rcu_head rcu_head; 243 struct rcu_head rcu_head;
261}; 244};
262 245
@@ -265,16 +248,20 @@ struct netdev_hw_addr_list {
265 int count; 248 int count;
266}; 249};
267 250
268#define netdev_uc_count(dev) ((dev)->uc.count) 251#define netdev_hw_addr_list_count(l) ((l)->count)
269#define netdev_uc_empty(dev) ((dev)->uc.count == 0) 252#define netdev_hw_addr_list_empty(l) (netdev_hw_addr_list_count(l) == 0)
270#define netdev_for_each_uc_addr(ha, dev) \ 253#define netdev_hw_addr_list_for_each(ha, l) \
271 list_for_each_entry(ha, &dev->uc.list, list) 254 list_for_each_entry(ha, &(l)->list, list)
272 255
273#define netdev_mc_count(dev) ((dev)->mc_count) 256#define netdev_uc_count(dev) netdev_hw_addr_list_count(&(dev)->uc)
274#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) 257#define netdev_uc_empty(dev) netdev_hw_addr_list_empty(&(dev)->uc)
258#define netdev_for_each_uc_addr(ha, dev) \
259 netdev_hw_addr_list_for_each(ha, &(dev)->uc)
275 260
261#define netdev_mc_count(dev) netdev_hw_addr_list_count(&(dev)->mc)
262#define netdev_mc_empty(dev) netdev_hw_addr_list_empty(&(dev)->mc)
276#define netdev_for_each_mc_addr(mclist, dev) \ 263#define netdev_for_each_mc_addr(mclist, dev) \
277 for (mclist = dev->mc_list; mclist; mclist = mclist->next) 264 netdev_hw_addr_list_for_each(ha, &(dev)->mc)
278 265
279struct hh_cache { 266struct hh_cache {
280 struct hh_cache *hh_next; /* Next entry */ 267 struct hh_cache *hh_next; /* Next entry */
@@ -862,12 +849,10 @@ struct net_device {
862 unsigned char addr_len; /* hardware address length */ 849 unsigned char addr_len; /* hardware address length */
863 unsigned short dev_id; /* for shared network cards */ 850 unsigned short dev_id; /* for shared network cards */
864 851
865 struct netdev_hw_addr_list uc; /* Secondary unicast
866 mac addresses */
867 int uc_promisc;
868 spinlock_t addr_list_lock; 852 spinlock_t addr_list_lock;
869 struct dev_addr_list *mc_list; /* Multicast mac addresses */ 853 struct netdev_hw_addr_list uc; /* Unicast mac addresses */
870 int mc_count; /* Number of installed mcasts */ 854 struct netdev_hw_addr_list mc; /* Multicast mac addresses */
855 int uc_promisc;
871 unsigned int promiscuity; 856 unsigned int promiscuity;
872 unsigned int allmulti; 857 unsigned int allmulti;
873 858
@@ -1980,6 +1965,22 @@ extern struct net_device *alloc_netdev_mq(int sizeof_priv, const char *name,
1980extern int register_netdev(struct net_device *dev); 1965extern int register_netdev(struct net_device *dev);
1981extern void unregister_netdev(struct net_device *dev); 1966extern void unregister_netdev(struct net_device *dev);
1982 1967
1968/* General hardware address lists handling functions */
1969extern int __hw_addr_add_multiple(struct netdev_hw_addr_list *to_list,
1970 struct netdev_hw_addr_list *from_list,
1971 int addr_len, unsigned char addr_type);
1972extern void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list,
1973 struct netdev_hw_addr_list *from_list,
1974 int addr_len, unsigned char addr_type);
1975extern int __hw_addr_sync(struct netdev_hw_addr_list *to_list,
1976 struct netdev_hw_addr_list *from_list,
1977 int addr_len);
1978extern void __hw_addr_unsync(struct netdev_hw_addr_list *to_list,
1979 struct netdev_hw_addr_list *from_list,
1980 int addr_len);
1981extern void __hw_addr_flush(struct netdev_hw_addr_list *list);
1982extern void __hw_addr_init(struct netdev_hw_addr_list *list);
1983
1983/* Functions used for device addresses handling */ 1984/* Functions used for device addresses handling */
1984extern int dev_addr_add(struct net_device *dev, unsigned char *addr, 1985extern int dev_addr_add(struct net_device *dev, unsigned char *addr,
1985 unsigned char addr_type); 1986 unsigned char addr_type);
@@ -2002,18 +2003,19 @@ extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
2002extern void dev_uc_flush(struct net_device *dev); 2003extern void dev_uc_flush(struct net_device *dev);
2003extern void dev_uc_init(struct net_device *dev); 2004extern void dev_uc_init(struct net_device *dev);
2004 2005
2006/* Functions used for multicast addresses handling */
2007extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
2008extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
2009extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
2010extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
2011extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2012extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2013extern void dev_mc_flush(struct net_device *dev);
2014extern void dev_mc_init(struct net_device *dev);
2015
2005/* Functions used for secondary unicast and multicast support */ 2016/* Functions used for secondary unicast and multicast support */
2006extern void dev_set_rx_mode(struct net_device *dev); 2017extern void dev_set_rx_mode(struct net_device *dev);
2007extern void __dev_set_rx_mode(struct net_device *dev); 2018extern void __dev_set_rx_mode(struct net_device *dev);
2008extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
2009extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
2010extern int dev_mc_sync(struct net_device *to, struct net_device *from);
2011extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
2012extern void dev_addr_discard(struct net_device *dev);
2013extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
2014extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
2015extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
2016extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
2017extern int dev_set_promiscuity(struct net_device *dev, int inc); 2019extern int dev_set_promiscuity(struct net_device *dev, int inc);
2018extern int dev_set_allmulti(struct net_device *dev, int inc); 2020extern int dev_set_allmulti(struct net_device *dev, int inc);
2019extern void netdev_state_change(struct net_device *dev); 2021extern void netdev_state_change(struct net_device *dev);