From db05057a790a9ceba60e33e07c899aa807fff9b7 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Mon, 27 Jul 2009 17:05:17 -0700 Subject: [PATCH] compat-2.6: new netns compat work There is still more to go. Signed-off-by: Luis R. Rodriguez --- compat/compat-2.6.32.h | 7 ++++ compat/compat.diff | 84 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 75 insertions(+), 16 deletions(-) diff --git a/compat/compat-2.6.32.h b/compat/compat-2.6.32.h index 931fac2136a4..3a1aecd5548e 100644 --- a/compat/compat-2.6.32.h +++ b/compat/compat-2.6.32.h @@ -14,6 +14,13 @@ #define SDIO_DEVICE_ID_INTEL_IWMC3200GPS 0x1405 #define SDIO_DEVICE_ID_INTEL_IWMC3200BT 0x1406 +/* + * struct genl_multicast_group was made netns aware through + * patch "genetlink: make netns aware" by johannes, we just + * force this to always use the default init_net + */ +#define genl_info_net(x) &init_net + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)) */ #endif /* LINUX_26_32_COMPAT_H */ diff --git a/compat/compat.diff b/compat/compat.diff index bdf56695d24f..d3f8e90e4702 100644 --- a/compat/compat.diff +++ b/compat/compat.diff @@ -949,22 +949,6 @@ - zd_chip_control_leds(&mac->chip, LED_OFF); + zd_chip_control_leds(&mac->chip, ZD_LED_OFF); } ---- a/net/wireless/wext.c 2009-07-27 14:43:30.802074596 -0700 -+++ b/net/wireless/wext.c 2009-07-27 14:43:31.310065767 -0700 -@@ -1118,8 +1118,13 @@ static int wireless_process_ioctl(struct - return private(dev, iwr, cmd, info, handler); - } - /* Old driver API : call driver ioctl handler */ -+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) - if (dev->netdev_ops->ndo_do_ioctl) - return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); -+#else -+ if (dev->do_ioctl) -+ return dev->do_ioctl(dev, ifr, cmd); -+#endif - return -EOPNOTSUPP; - } - --- a/drivers/net/wireless/libertas/defs.h 2009-07-08 14:04:29.692256519 -0700 +++ b/drivers/net/wireless/libertas/defs.h 2009-07-08 14:03:26.712279246 -0700 @@ -16,6 +16,14 @@ @@ -982,3 +966,71 @@ #define LBS_DEB_ENTER 0x00000001 #define LBS_DEB_LEAVE 0x00000002 +--- a/net/wireless/wext.c 2009-07-27 15:38:09.989056661 -0700 ++++ b/net/wireless/wext.c 2009-07-27 16:05:06.681045663 -0700 +@@ -1118,8 +1118,13 @@ + return private(dev, iwr, cmd, info, handler); + } + /* Old driver API : call driver ioctl handler */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)) + if (dev->netdev_ops->ndo_do_ioctl) + return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd); ++#else ++ if (dev->do_ioctl) ++ return dev->do_ioctl(dev, ifr, cmd); ++#endif + return -EOPNOTSUPP; + } + +@@ -1272,6 +1277,7 @@ + } + #endif + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) + static int __net_init wext_pernet_init(struct net *net) + { + skb_queue_head_init(&net->wext_nlevents); +@@ -1315,6 +1321,29 @@ + + static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process); + ++#else ++/* Older kernels get the old way of doing stuff*/ ++static struct sk_buff_head wireless_nlevent_queue; ++ ++static int __init wireless_nlevent_init(void) ++{ ++ skb_queue_head_init(&wireless_nlevent_queue); ++ return 0; ++} ++ ++subsys_initcall(wireless_nlevent_init); ++ ++static void wireless_nlevent_process(unsigned long data) ++{ ++ struct sk_buff *skb; ++ while ((skb = skb_dequeue(&wireless_nlevent_queue))) ++ rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC); ++} ++ ++static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0); ++ ++#endif ++ + static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev, + struct sk_buff *skb) + { +@@ -1525,8 +1554,13 @@ + + skb_shinfo(skb)->frag_list = compskb; + #endif ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)) + skb_queue_tail(&dev_net(dev)->wext_nlevents, skb); + schedule_work(&wireless_nlevent_work); ++#else ++ skb_queue_tail(&wireless_nlevent_queue, skb); ++ tasklet_schedule(&wireless_nlevent_tasklet); ++#endif + } + EXPORT_SYMBOL(wireless_send_event); + -- 2.30.2