[03/19] batman-adv: compat macros/defines for local multicast group fetching
Commit Message
The data structures and locking mechanisms for fetching multicast mac
addresses from a net_device have changed a little between kernel
versions 2.6.21 to 2.6.35.
Therefore this commit backports two macros (netdev_mc_count(),
netdev_for_each_mc_addr()) for older kernel versions and abstracts the
way of locking and accessing the variables with own customized macros.
Signed-off-by: Linus Lüssing <linus.luessing@saxnet.de>
---
compat.h | 40 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 40 insertions(+), 0 deletions(-)
Comments
> +#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)
> +
> +#define MC_LIST struct netdev_hw_addr_list_mc
> +#define MC_LIST_ADDR addr
> +
> +#endif /* > KERNEL_VERSION(2, 6, 34) */
Should have been "MC_LIST struct netdev_hw_addr" instead... fixed
upstream (and will be fixed in next patchset here).
Cheers, Linus
@@ -270,4 +270,44 @@ int bat_seq_printf(struct seq_file *m, const char *f, ...);
#endif /* < KERNEL_VERSION(2, 6, 33) */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+
+#define netdev_mc_count(dev) ((dev)->mc_count)
+#define netdev_for_each_mc_addr(mclist, dev) \
+ for (mclist = dev->mc_list; mclist; mclist = mclist->next)
+
+#endif /* < KERNEL_VERSION(2, 6, 34) */
+
+
+/*
+ * net_device - multicast list handling
+ * structures
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
+
+#define MC_LIST struct dev_addr_list
+#define MC_LIST_ADDR da_addr
+
+#endif /* < KERNEL_VERSION(2, 6, 35) */
+
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 34)
+
+#define MC_LIST struct netdev_hw_addr_list_mc
+#define MC_LIST_ADDR addr
+
+#endif /* > KERNEL_VERSION(2, 6, 34) */
+
+/*
+ * net_device - multicast list handling
+ * locking
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27)
+
+#define netif_addr_lock_bh(soft_iface) \
+ netif_tx_lock_bh(soft_iface)
+#define netif_addr_unlock_bh(soft_iface) \
+ netif_tx_unlock_bh(soft_iface)
+
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 27) */
+
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */