aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h27
1 files changed, 25 insertions, 2 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ac0c92b1e002..30446222b396 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -304,7 +304,7 @@ struct net_device
304 304
305 unsigned long state; 305 unsigned long state;
306 306
307 struct net_device *next; 307 struct list_head dev_list;
308 308
309 /* The device initialization function. Called only once. */ 309 /* The device initialization function. Called only once. */
310 int (*init)(struct net_device *dev); 310 int (*init)(struct net_device *dev);
@@ -575,13 +575,36 @@ struct packet_type {
575#include <linux/notifier.h> 575#include <linux/notifier.h>
576 576
577extern struct net_device loopback_dev; /* The loopback */ 577extern struct net_device loopback_dev; /* The loopback */
578extern struct net_device *dev_base; /* All devices */ 578extern struct list_head dev_base_head; /* All devices */
579extern rwlock_t dev_base_lock; /* Device list lock */ 579extern rwlock_t dev_base_lock; /* Device list lock */
580 580
581#define for_each_netdev(d) \
582 list_for_each_entry(d, &dev_base_head, dev_list)
583#define for_each_netdev_safe(d, n) \
584 list_for_each_entry_safe(d, n, &dev_base_head, dev_list)
585#define for_each_netdev_continue(d) \
586 list_for_each_entry_continue(d, &dev_base_head, dev_list)
587#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
588
589static inline struct net_device *next_net_device(struct net_device *dev)
590{
591 struct list_head *lh;
592
593 lh = dev->dev_list.next;
594 return lh == &dev_base_head ? NULL : net_device_entry(lh);
595}
596
597static inline struct net_device *first_net_device(void)
598{
599 return list_empty(&dev_base_head) ? NULL :
600 net_device_entry(dev_base_head.next);
601}
602
581extern int netdev_boot_setup_check(struct net_device *dev); 603extern int netdev_boot_setup_check(struct net_device *dev);
582extern unsigned long netdev_boot_base(const char *prefix, int unit); 604extern unsigned long netdev_boot_base(const char *prefix, int unit);
583extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); 605extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
584extern struct net_device *dev_getfirstbyhwtype(unsigned short type); 606extern struct net_device *dev_getfirstbyhwtype(unsigned short type);
607extern struct net_device *__dev_getfirstbyhwtype(unsigned short type);
585extern void dev_add_pack(struct packet_type *pt); 608extern void dev_add_pack(struct packet_type *pt);
586extern void dev_remove_pack(struct packet_type *pt); 609extern void dev_remove_pack(struct packet_type *pt);
587extern void __dev_remove_pack(struct packet_type *pt); 610extern void __dev_remove_pack(struct packet_type *pt);