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.h66
1 files changed, 35 insertions, 31 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index dc3c15b726bc..7353b3e1f4fc 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -741,44 +741,48 @@ struct packet_type {
741#include <linux/notifier.h> 741#include <linux/notifier.h>
742 742
743extern struct net_device loopback_dev; /* The loopback */ 743extern struct net_device loopback_dev; /* The loopback */
744extern struct list_head dev_base_head; /* All devices */
745extern rwlock_t dev_base_lock; /* Device list lock */ 744extern rwlock_t dev_base_lock; /* Device list lock */
746 745
747#define for_each_netdev(d) \
748 list_for_each_entry(d, &dev_base_head, dev_list)
749#define for_each_netdev_safe(d, n) \
750 list_for_each_entry_safe(d, n, &dev_base_head, dev_list)
751#define for_each_netdev_continue(d) \
752 list_for_each_entry_continue(d, &dev_base_head, dev_list)
753#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
754
755static inline struct net_device *next_net_device(struct net_device *dev)
756{
757 struct list_head *lh;
758 746
759 lh = dev->dev_list.next; 747#define for_each_netdev(net, d) \
760 return lh == &dev_base_head ? NULL : net_device_entry(lh); 748 list_for_each_entry(d, &(net)->dev_base_head, dev_list)
761} 749#define for_each_netdev_safe(net, d, n) \
750 list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
751#define for_each_netdev_continue(net, d) \
752 list_for_each_entry_continue(d, &(net)->dev_base_head, dev_list)
753#define net_device_entry(lh) list_entry(lh, struct net_device, dev_list)
762 754
763static inline struct net_device *first_net_device(void) 755#define next_net_device(d) \
764{ 756({ \
765 return list_empty(&dev_base_head) ? NULL : 757 struct net_device *dev = d; \
766 net_device_entry(dev_base_head.next); 758 struct list_head *lh; \
767} 759 struct net *net; \
760 \
761 net = dev->nd_net; \
762 lh = dev->dev_list.next; \
763 lh == &net->dev_base_head ? NULL : net_device_entry(lh); \
764})
765
766#define first_net_device(N) \
767({ \
768 struct net *NET = (N); \
769 list_empty(&NET->dev_base_head) ? NULL : \
770 net_device_entry(NET->dev_base_head.next); \
771})
768 772
769extern int netdev_boot_setup_check(struct net_device *dev); 773extern int netdev_boot_setup_check(struct net_device *dev);
770extern unsigned long netdev_boot_base(const char *prefix, int unit); 774extern unsigned long netdev_boot_base(const char *prefix, int unit);
771extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr); 775extern struct net_device *dev_getbyhwaddr(struct net *net, unsigned short type, char *hwaddr);
772extern struct net_device *dev_getfirstbyhwtype(unsigned short type); 776extern struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type);
773extern struct net_device *__dev_getfirstbyhwtype(unsigned short type); 777extern struct net_device *__dev_getfirstbyhwtype(struct net *net, unsigned short type);
774extern void dev_add_pack(struct packet_type *pt); 778extern void dev_add_pack(struct packet_type *pt);
775extern void dev_remove_pack(struct packet_type *pt); 779extern void dev_remove_pack(struct packet_type *pt);
776extern void __dev_remove_pack(struct packet_type *pt); 780extern void __dev_remove_pack(struct packet_type *pt);
777 781
778extern struct net_device *dev_get_by_flags(unsigned short flags, 782extern struct net_device *dev_get_by_flags(struct net *net, unsigned short flags,
779 unsigned short mask); 783 unsigned short mask);
780extern struct net_device *dev_get_by_name(const char *name); 784extern struct net_device *dev_get_by_name(struct net *net, const char *name);
781extern struct net_device *__dev_get_by_name(const char *name); 785extern struct net_device *__dev_get_by_name(struct net *net, const char *name);
782extern int dev_alloc_name(struct net_device *dev, const char *name); 786extern int dev_alloc_name(struct net_device *dev, const char *name);
783extern int dev_open(struct net_device *dev); 787extern int dev_open(struct net_device *dev);
784extern int dev_close(struct net_device *dev); 788extern int dev_close(struct net_device *dev);
@@ -790,8 +794,8 @@ extern void synchronize_net(void);
790extern int register_netdevice_notifier(struct notifier_block *nb); 794extern int register_netdevice_notifier(struct notifier_block *nb);
791extern int unregister_netdevice_notifier(struct notifier_block *nb); 795extern int unregister_netdevice_notifier(struct notifier_block *nb);
792extern int call_netdevice_notifiers(unsigned long val, void *v); 796extern int call_netdevice_notifiers(unsigned long val, void *v);
793extern struct net_device *dev_get_by_index(int ifindex); 797extern struct net_device *dev_get_by_index(struct net *net, int ifindex);
794extern struct net_device *__dev_get_by_index(int ifindex); 798extern struct net_device *__dev_get_by_index(struct net *net, int ifindex);
795extern int dev_restart(struct net_device *dev); 799extern int dev_restart(struct net_device *dev);
796#ifdef CONFIG_NETPOLL_TRAP 800#ifdef CONFIG_NETPOLL_TRAP
797extern int netpoll_trap(void); 801extern int netpoll_trap(void);
@@ -1007,8 +1011,8 @@ extern int netif_rx_ni(struct sk_buff *skb);
1007#define HAVE_NETIF_RECEIVE_SKB 1 1011#define HAVE_NETIF_RECEIVE_SKB 1
1008extern int netif_receive_skb(struct sk_buff *skb); 1012extern int netif_receive_skb(struct sk_buff *skb);
1009extern int dev_valid_name(const char *name); 1013extern int dev_valid_name(const char *name);
1010extern int dev_ioctl(unsigned int cmd, void __user *); 1014extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
1011extern int dev_ethtool(struct ifreq *); 1015extern int dev_ethtool(struct net *net, struct ifreq *);
1012extern unsigned dev_get_flags(const struct net_device *); 1016extern unsigned dev_get_flags(const struct net_device *);
1013extern int dev_change_flags(struct net_device *, unsigned); 1017extern int dev_change_flags(struct net_device *, unsigned);
1014extern int dev_change_name(struct net_device *, char *); 1018extern int dev_change_name(struct net_device *, char *);
@@ -1327,7 +1331,7 @@ extern void dev_set_allmulti(struct net_device *dev, int inc);
1327extern void netdev_state_change(struct net_device *dev); 1331extern void netdev_state_change(struct net_device *dev);
1328extern void netdev_features_change(struct net_device *dev); 1332extern void netdev_features_change(struct net_device *dev);
1329/* Load a device via the kmod */ 1333/* Load a device via the kmod */
1330extern void dev_load(const char *name); 1334extern void dev_load(struct net *net, const char *name);
1331extern void dev_mcast_init(void); 1335extern void dev_mcast_init(void);
1332extern int netdev_max_backlog; 1336extern int netdev_max_backlog;
1333extern int weight_p; 1337extern int weight_p;