net: use helpers to access mc list V2
[safe/jmp/linux-2.6] / include / linux / netdevice.h
index 468a11d..e535700 100644 (file)
@@ -263,6 +263,17 @@ struct netdev_hw_addr_list {
        int                     count;
 };
 
+#define netdev_uc_count(dev) ((dev)->uc.count)
+#define netdev_uc_empty(dev) ((dev)->uc.count == 0)
+#define netdev_for_each_uc_addr(ha, dev) \
+       list_for_each_entry(ha, &dev->uc.list, list)
+
+#define netdev_mc_count(dev) ((dev)->mc_count)
+#define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0)
+
+#define netdev_for_each_mc_addr(mclist, dev) \
+       for (mclist = dev->mc_list; mclist; mclist = mclist->next)
+
 struct hh_cache {
        struct hh_cache *hh_next;       /* Next entry                        */
        atomic_t        hh_refcnt;      /* number of users                   */
@@ -621,30 +632,21 @@ struct net_device_ops {
                                                   struct net_device *dev);
        u16                     (*ndo_select_queue)(struct net_device *dev,
                                                    struct sk_buff *skb);
-#define HAVE_CHANGE_RX_FLAGS
        void                    (*ndo_change_rx_flags)(struct net_device *dev,
                                                       int flags);
-#define HAVE_SET_RX_MODE
        void                    (*ndo_set_rx_mode)(struct net_device *dev);
-#define HAVE_MULTICAST
        void                    (*ndo_set_multicast_list)(struct net_device *dev);
-#define HAVE_SET_MAC_ADDR
        int                     (*ndo_set_mac_address)(struct net_device *dev,
                                                       void *addr);
-#define HAVE_VALIDATE_ADDR
        int                     (*ndo_validate_addr)(struct net_device *dev);
-#define HAVE_PRIVATE_IOCTL
        int                     (*ndo_do_ioctl)(struct net_device *dev,
                                                struct ifreq *ifr, int cmd);
-#define HAVE_SET_CONFIG
        int                     (*ndo_set_config)(struct net_device *dev,
                                                  struct ifmap *map);
-#define HAVE_CHANGE_MTU
        int                     (*ndo_change_mtu)(struct net_device *dev,
                                                  int new_mtu);
        int                     (*ndo_neigh_setup)(struct net_device *dev,
                                                   struct neigh_parms *);
-#define HAVE_TX_TIMEOUT
        void                    (*ndo_tx_timeout) (struct net_device *dev);
 
        struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
@@ -656,7 +658,6 @@ struct net_device_ops {
        void                    (*ndo_vlan_rx_kill_vid)(struct net_device *dev,
                                                        unsigned short vid);
 #ifdef CONFIG_NET_POLL_CONTROLLER
-#define HAVE_NETDEV_POLL
        void                    (*ndo_poll_controller)(struct net_device *dev);
 #endif
 #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
@@ -1009,6 +1010,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
        return 0;
 }
 
+#ifndef CONFIG_NET_NS
+static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
+{
+       skb->dev = dev;
+}
+#else /* CONFIG_NET_NS */
+void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
+#endif
+
 static inline bool netdev_uses_trailer_tags(struct net_device *dev)
 {
 #ifdef CONFIG_NET_DSA_TAG_TRAILER