diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-04 13:22:25 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-04 13:22:25 -0500 |
commit | 6683ece36e3531fc8c75f69e7165c5f20930be88 (patch) | |
tree | 4dd9fe9057248577a75eb60ae9f83a999f062b02 | |
parent | 1b924032533033a4dae1a239981677bdae21949b (diff) |
net: use helpers to access mc list V2
This patch introduces the similar helpers as those already done for uc list.
However multicast lists are no list_head lists but "mademanually". The three
macros added by this patch will make the transition of mc_list to list_head
smooth in two steps:
1) convert all drivers to use these macros (with the original iterator of type
"struct dev_mc_list")
2) once all drivers are converted, convert list type and iterators to "struct
netdev_hw_addr" in one patch.
>From now on, drivers can (and should) use "netdev_for_each_mc_addr" to iterate
over the addresses with iterator of type "struct netdev_hw_addr". Also macros
"netdev_mc_count" and "netdev_mc_empty" to read list's length. This is the state
which should be reached in all drivers.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 622ba5aa93c4..e535700a3b72 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -268,6 +268,12 @@ struct netdev_hw_addr_list { | |||
268 | #define netdev_for_each_uc_addr(ha, dev) \ | 268 | #define netdev_for_each_uc_addr(ha, dev) \ |
269 | list_for_each_entry(ha, &dev->uc.list, list) | 269 | list_for_each_entry(ha, &dev->uc.list, list) |
270 | 270 | ||
271 | #define netdev_mc_count(dev) ((dev)->mc_count) | ||
272 | #define netdev_mc_empty(dev) (netdev_mc_count(dev) == 0) | ||
273 | |||
274 | #define netdev_for_each_mc_addr(mclist, dev) \ | ||
275 | for (mclist = dev->mc_list; mclist; mclist = mclist->next) | ||
276 | |||
271 | struct hh_cache { | 277 | struct hh_cache { |
272 | struct hh_cache *hh_next; /* Next entry */ | 278 | struct hh_cache *hh_next; /* Next entry */ |
273 | atomic_t hh_refcnt; /* number of users */ | 279 | atomic_t hh_refcnt; /* number of users */ |