Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45.
[cascardo/ovs.git] / datapath / linux-2.6 / compat-2.6 / include / linux / netdevice.h
1 #ifndef __LINUX_NETDEVICE_WRAPPER_H
2 #define __LINUX_NETDEVICE_WRAPPER_H 1
3
4 #include_next <linux/netdevice.h>
5
6 struct net;
7
8 #ifndef to_net_dev
9 #define to_net_dev(class) container_of(class, struct net_device, class_dev)
10 #endif
11
12 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
13 static inline
14 struct net *dev_net(const struct net_device *dev)
15 {
16         return NULL;
17 }
18 #endif /* linux kernel < 2.6.26 */
19
20 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
21 #define proc_net init_net.proc_net
22 #endif
23
24 #ifndef for_each_netdev
25 /* Linux before 2.6.22 didn't have for_each_netdev at all. */
26 #define for_each_netdev(net, d) for (d = dev_base; d; d = d->next)
27 #elif LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
28 /* Linux 2.6.24 added a network namespace pointer to the macro. */
29 #undef for_each_netdev
30 #define for_each_netdev(net,d) list_for_each_entry(d, &dev_base_head, dev_list)
31 #endif
32
33
34
35 #endif