fix file specification in comments
[powerpc.git] / include / linux / netdevice.h
index fea0d9d..3044622 100644 (file)
@@ -42,6 +42,8 @@
 struct vlan_group;
 struct ethtool_ops;
 struct netpoll_info;
+/* 802.11 specific */
+struct wireless_dev;
                                        /* source back-compat hooks */
 #define SET_ETHTOOL_OPS(netdev,ops) \
        ( (netdev)->ethtool_ops = (ops) )
@@ -302,7 +304,7 @@ struct net_device
 
        unsigned long           state;
 
-       struct net_device       *next;
+       struct list_head        dev_list;
        
        /* The device initialization function. Called only once. */
        int                     (*init)(struct net_device *dev);
@@ -347,13 +349,15 @@ struct net_device
 
 
        struct net_device_stats* (*get_stats)(struct net_device *dev);
+       struct net_device_stats stats;
 
+#ifdef CONFIG_WIRELESS_EXT
        /* List of functions to handle Wireless Extensions (instead of ioctl).
         * See <net/iw_handler.h> for details. Jean II */
        const struct iw_handler_def *   wireless_handlers;
        /* Instance data managed by the core of Wireless Extensions. */
        struct iw_public_data * wireless_data;
-
+#endif
        const struct ethtool_ops *ethtool_ops;
 
        /*
@@ -398,6 +402,8 @@ struct net_device
        void                    *ip6_ptr;       /* IPv6 specific data */
        void                    *ec_ptr;        /* Econet specific data */
        void                    *ax25_ptr;      /* AX.25 specific data */
+       struct wireless_dev     *ieee80211_ptr; /* IEEE 802.11 specific data,
+                                                  assign before registering */
 
 /*
  * Cache line mostly used on receive path (including eth_type_trans())
@@ -529,10 +535,11 @@ struct net_device
        struct net_bridge_port  *br_port;
 
        /* class/net/name entry */
-       struct class_device     class_dev;
+       struct device           dev;
        /* space for optional statistics and wireless sysfs groups */
        struct attribute_group  *sysfs_groups[3];
 };
+#define to_net_dev(d) container_of(d, struct net_device, dev)
 
 #define        NETDEV_ALIGN            32
 #define        NETDEV_ALIGN_CONST      (NETDEV_ALIGN - 1)
@@ -548,7 +555,7 @@ static inline void *netdev_priv(struct net_device *dev)
 /* Set the sysfs physical device reference for the network logical device
  * if set prior to registration will cause a symlink during initialization.
  */
-#define SET_NETDEV_DEV(net, pdev)      ((net)->class_dev.dev = (pdev))
+#define SET_NETDEV_DEV(net, pdev)      ((net)->dev.parent = (pdev))
 
 struct packet_type {
        __be16                  type;   /* This is really htons(ether_type). */
@@ -568,13 +575,36 @@ struct packet_type {
 #include <linux/notifier.h>
 
 extern struct net_device               loopback_dev;           /* The loopback */
-extern struct net_device               *dev_base;              /* All devices */
+extern struct list_head                        dev_base_head;          /* All devices */
 extern rwlock_t                                dev_base_lock;          /* Device list lock */
 
+#define for_each_netdev(d)             \
+               list_for_each_entry(d, &dev_base_head, dev_list)
+#define for_each_netdev_safe(d, n)     \
+               list_for_each_entry_safe(d, n, &dev_base_head, dev_list)
+#define for_each_netdev_continue(d)            \
+               list_for_each_entry_continue(d, &dev_base_head, dev_list)
+#define net_device_entry(lh)   list_entry(lh, struct net_device, dev_list)
+
+static inline struct net_device *next_net_device(struct net_device *dev)
+{
+       struct list_head *lh;
+
+       lh = dev->dev_list.next;
+       return lh == &dev_base_head ? NULL : net_device_entry(lh);
+}
+
+static inline struct net_device *first_net_device(void)
+{
+       return list_empty(&dev_base_head) ? NULL :
+               net_device_entry(dev_base_head.next);
+}
+
 extern int                     netdev_boot_setup_check(struct net_device *dev);
 extern unsigned long           netdev_boot_base(const char *prefix, int unit);
 extern struct net_device    *dev_getbyhwaddr(unsigned short type, char *hwaddr);
 extern struct net_device *dev_getfirstbyhwtype(unsigned short type);
+extern struct net_device *__dev_getfirstbyhwtype(unsigned short type);
 extern void            dev_add_pack(struct packet_type *pt);
 extern void            dev_remove_pack(struct packet_type *pt);
 extern void            __dev_remove_pack(struct packet_type *pt);
@@ -588,7 +618,7 @@ extern int          dev_open(struct net_device *dev);
 extern int             dev_close(struct net_device *dev);
 extern int             dev_queue_xmit(struct sk_buff *skb);
 extern int             register_netdevice(struct net_device *dev);
-extern int             unregister_netdevice(struct net_device *dev);
+extern void            unregister_netdevice(struct net_device *dev);
 extern void            free_netdev(struct net_device *dev);
 extern void            synchronize_net(void);
 extern int             register_netdevice_notifier(struct notifier_block *nb);
@@ -646,8 +676,10 @@ static inline void netif_start_queue(struct net_device *dev)
 static inline void netif_wake_queue(struct net_device *dev)
 {
 #ifdef CONFIG_NETPOLL_TRAP
-       if (netpoll_trap())
+       if (netpoll_trap()) {
+               clear_bit(__LINK_STATE_XOFF, &dev->state);
                return;
+       }
 #endif
        if (test_and_clear_bit(__LINK_STATE_XOFF, &dev->state))
                __netif_schedule(dev);
@@ -655,10 +687,6 @@ static inline void netif_wake_queue(struct net_device *dev)
 
 static inline void netif_stop_queue(struct net_device *dev)
 {
-#ifdef CONFIG_NETPOLL_TRAP
-       if (netpoll_trap())
-               return;
-#endif
        set_bit(__LINK_STATE_XOFF, &dev->state);
 }