Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2877

kernel-2.6.18-238.el5.src.rpm

From: Michal Schmidt <mschmidt@redhat.com>
Date: Fri, 3 Sep 2010 19:58:06 -0400
Subject: [net] netdevice: add netdev_for_each_mc_addr
Message-id: <20100903195805.7750.47778.stgit@localhost6.localdomain6>
Patchwork-id: 28130
O-Subject: [RHEL5.6 BZ556476 PATCH 4/6] netdevice.h: add
	netdev_for_each_mc_addr()
Bugzilla: 556476
RH-Acked-by: David S. Miller <davem@redhat.com>
RH-Acked-by: Thomas Graf <tgraf@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=556476

netdev_for_each_mc_addr() was introduced by Jiri Pirko's upstream cleanup
of multicast lists in 2.6.34 and 2.6.35. We cannot do the same cleanup in
RHEL for KABI reasons, but at least having this macro with similar
functionality would be nice.

Note that the first argument must be a (struct dev_mc_list*).
I considered introducing a struct netdev_hw_addr as an alias for
dev_mc_list to make usage in drivers exactly the same as in upstream, but
I decided against it because it felt too kludgy.

So, when upstream uses:
  struct netdev_hw_addr *ha;
  netdev_for_each_mc_addr(ha, net_dev)
    do_something_with(ha->addr);
in RHEL we will have:
  struct dev_mc_list *ha;
  netdev_for_each_mc_addr(ha, net_dev)
    do_something_with(ha->dmi_addr);

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4b6c2f3..bc5db30 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -185,6 +185,9 @@ struct dev_mc_list
 	int			dmi_gusers;
 };
 
+#define netdev_for_each_mc_addr(mcl, dev) \
+	for (mcl = (dev)->mc_list; mcl; mcl = mcl->next)
+
 struct hh_cache
 {
 	struct hh_cache *hh_next;	/* Next entry			     */