debug: remove roaming events
[pandora-wifi.git] / patches / 01-netdev.patch
1
2 This patch backports the struct net_device_ops changes added
3 on 2.6.29. It also backports the namespace changes added
4 through net/wireless/wext.c. Note that there is another
5 patch file which also addresses netns changes, we leave
6 them separate as there is no easy way to split the stuff
7 without creating a headache on maintenance of the pathes.
8
9 --- a/drivers/net/usb/rndis_host.c
10 +++ b/drivers/net/usb/rndis_host.c
11 @@ -274,6 +274,7 @@ response_error:
12         return -EDOM;
13  }
14  
15 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
16  /* same as usbnet_netdev_ops but MTU change not allowed */
17  static const struct net_device_ops rndis_netdev_ops = {
18         .ndo_open               = usbnet_open,
19 @@ -283,6 +284,7 @@ static const struct net_device_ops rndis
20         .ndo_set_mac_address    = eth_mac_addr,
21         .ndo_validate_addr      = eth_validate_addr,
22  };
23 +#endif
24  
25  int
26  generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
27 @@ -345,7 +347,11 @@ generic_rndis_bind(struct usbnet *dev, s
28         dev->rx_urb_size &= ~(dev->maxpacket - 1);
29         u.init->max_transfer_size = cpu_to_le32(dev->rx_urb_size);
30  
31 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
32         net->netdev_ops = &rndis_netdev_ops;
33 +#else
34 +       net->change_mtu = NULL;
35 +#endif
36  
37         retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
38         if (unlikely(retval < 0)) {
39 --- a/drivers/net/usb/usbnet.c
40 +++ b/drivers/net/usb/usbnet.c
41 @@ -1236,6 +1236,7 @@ void usbnet_disconnect (struct usb_inter
42  }
43  EXPORT_SYMBOL_GPL(usbnet_disconnect);
44  
45 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
46  static const struct net_device_ops usbnet_netdev_ops = {
47         .ndo_open               = usbnet_open,
48         .ndo_stop               = usbnet_stop,
49 @@ -1245,6 +1246,7 @@ static const struct net_device_ops usbne
50         .ndo_set_mac_address    = eth_mac_addr,
51         .ndo_validate_addr      = eth_validate_addr,
52  };
53 +#endif
54  
55  /*-------------------------------------------------------------------------*/
56  
57 @@ -1324,7 +1326,15 @@ usbnet_probe (struct usb_interface *udev
58                 net->features |= NETIF_F_HIGHDMA;
59  #endif
60  
61 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
62         net->netdev_ops = &usbnet_netdev_ops;
63 +#else
64 +       net->change_mtu = usbnet_change_mtu;
65 +       net->hard_start_xmit = usbnet_start_xmit;
66 +       net->open = usbnet_open;
67 +       net->stop = usbnet_stop;
68 +       net->tx_timeout = usbnet_tx_timeout;
69 +#endif
70         net->watchdog_timeo = TX_TIMEOUT_JIFFIES;
71         net->ethtool_ops = &usbnet_ethtool_ops;
72  
73 --- a/drivers/net/wireless/rndis_wlan.c
74 +++ b/drivers/net/wireless/rndis_wlan.c
75 @@ -2703,6 +2703,7 @@ static int bcm4320b_early_init(struct us
76         return 0;
77  }
78  
79 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
80  /* same as rndis_netdev_ops but with local multicast handler */
81  static const struct net_device_ops rndis_wlan_netdev_ops = {
82         .ndo_open               = usbnet_open,
83 @@ -2713,6 +2714,7 @@ static const struct net_device_ops rndis
84         .ndo_validate_addr      = eth_validate_addr,
85         .ndo_set_multicast_list = rndis_wlan_set_multicast_list,
86  };
87 +#endif
88  
89  static int rndis_wlan_bind(struct usbnet *usbdev, struct usb_interface *intf)
90  {
91 @@ -2760,7 +2762,11 @@ static int rndis_wlan_bind(struct usbnet
92          * rndis_host wants to avoid all OID as much as possible
93          * so do promisc/multicast handling in rndis_wlan.
94          */
95 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
96         usbdev->net->netdev_ops = &rndis_wlan_netdev_ops;
97 +#else
98 +       usbdev->net->set_multicast_list = rndis_wlan_set_multicast_list;
99 +#endif
100  
101         tmp = RNDIS_PACKET_TYPE_DIRECTED | RNDIS_PACKET_TYPE_BROADCAST;
102         retval = rndis_set_oid(usbdev, OID_GEN_CURRENT_PACKET_FILTER, &tmp,
103 --- a/net/mac80211/iface.c
104 +++ b/net/mac80211/iface.c
105 @@ -666,6 +666,7 @@ static u16 ieee80211_netdev_select_queue
106         return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
107  }
108  
109 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
110  static const struct net_device_ops ieee80211_dataif_ops = {
111         .ndo_open               = ieee80211_open,
112         .ndo_stop               = ieee80211_stop,
113 @@ -676,6 +677,7 @@ static const struct net_device_ops ieee8
114         .ndo_set_mac_address    = ieee80211_change_mac,
115         .ndo_select_queue       = ieee80211_netdev_select_queue,
116  };
117 +#endif
118  
119  static u16 ieee80211_monitor_select_queue(struct net_device *dev,
120                                           struct sk_buff *skb)
121 @@ -710,6 +712,7 @@ static u16 ieee80211_monitor_select_queu
122         return ieee80211_downgrade_queue(local, skb);
123  }
124  
125 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
126  static const struct net_device_ops ieee80211_monitorif_ops = {
127         .ndo_open               = ieee80211_open,
128         .ndo_stop               = ieee80211_stop,
129 @@ -720,14 +723,28 @@ static const struct net_device_ops ieee8
130         .ndo_set_mac_address    = eth_mac_addr,
131         .ndo_select_queue       = ieee80211_monitor_select_queue,
132  };
133 +#endif
134  
135  static void ieee80211_if_setup(struct net_device *dev)
136  {
137         ether_setup(dev);
138 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
139         dev->netdev_ops = &ieee80211_dataif_ops;
140 +#else
141 +       dev->hard_start_xmit = ieee80211_subif_start_xmit;
142 +       dev->set_multicast_list = ieee80211_set_multicast_list;
143 +       dev->change_mtu = ieee80211_change_mtu;
144 +       dev->set_mac_address = ieee80211_change_mac;
145 +       dev->select_queue = ieee80211_netdev_select_queue;
146 +       dev->open = ieee80211_open;
147 +       dev->stop = ieee80211_stop;
148 +       /* we will validate the address ourselves in ->open */
149 +       dev->validate_addr = NULL;
150 +#endif
151         dev->destructor = free_netdev;
152  }
153  
154 +
155  /*
156   * Helper function to initialise an interface to a specific type.
157   */
158 @@ -739,7 +756,11 @@ static void ieee80211_setup_sdata(struct
159  
160         /* and set some type-dependent values */
161         sdata->vif.type = type;
162 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
163         sdata->dev->netdev_ops = &ieee80211_dataif_ops;
164 +#else
165 +       sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit;
166 +#endif
167         sdata->wdev.iftype = type;
168  
169         /* only monitor differs */
170 @@ -762,7 +783,13 @@ static void ieee80211_setup_sdata(struct
171                 break;
172         case NL80211_IFTYPE_MONITOR:
173                 sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
174 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
175                 sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
176 +#else
177 +               sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit;
178 +               sdata->dev->select_queue = ieee80211_monitor_select_queue;
179 +               sdata->dev->set_mac_address = eth_mac_addr;
180 +#endif
181                 sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
182                                       MONITOR_FLAG_OTHER_BSS;
183                 break;
184 @@ -831,6 +858,8 @@ int ieee80211_if_add(struct ieee80211_lo
185                 return -ENOMEM;
186         dev_net_set(ndev, wiphy_net(local->hw.wiphy));
187  
188 +/* This is an optimization, just ignore for older kernels */
189 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
190         ndev->needed_headroom = local->tx_headroom +
191                                 4*6 /* four MAC addresses */
192                                 + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */
193 @@ -839,6 +868,7 @@ int ieee80211_if_add(struct ieee80211_lo
194                                 - ETH_HLEN /* ethernet hard_header_len */
195                                 + IEEE80211_ENCRYPT_HEADROOM;
196         ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM;
197 +#endif
198  
199         ret = dev_alloc_name(ndev, ndev->name);
200         if (ret < 0)
201 @@ -884,6 +914,10 @@ int ieee80211_if_add(struct ieee80211_lo
202         if (ret)
203                 goto fail;
204  
205 +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,28))
206 +       ndev->uninit = ieee80211_teardown_sdata;
207 +#endif
208 +
209         if (ieee80211_vif_is_mesh(&sdata->vif) &&
210             params && params->mesh_id_len)
211                 ieee80211_sdata_set_mesh_id(sdata,
212 --- a/drivers/net/b44.c
213 +++ b/drivers/net/b44.c
214 @@ -2109,6 +2109,7 @@ static int __devinit b44_get_invariants(
215         return err;
216  }
217  
218 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
219  static const struct net_device_ops b44_netdev_ops = {
220         .ndo_open               = b44_open,
221         .ndo_stop               = b44_close,
222 @@ -2124,6 +2125,7 @@ static const struct net_device_ops b44_n
223         .ndo_poll_controller    = b44_poll_controller,
224  #endif
225  };
226 +#endif
227  
228  static int __devinit b44_init_one(struct ssb_device *sdev,
229                                   const struct ssb_device_id *ent)
230 @@ -2163,9 +2165,26 @@ static int __devinit b44_init_one(struct
231         bp->rx_pending = B44_DEF_RX_RING_PENDING;
232         bp->tx_pending = B44_DEF_TX_RING_PENDING;
233  
234 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
235 +       dev->open = b44_open;
236 +       dev->stop = b44_close;
237 +       dev->hard_start_xmit = b44_start_xmit;
238 +       dev->get_stats = b44_get_stats;
239 +       dev->set_multicast_list = b44_set_rx_mode;
240 +       dev->set_mac_address = b44_set_mac_addr;
241 +       dev->do_ioctl = b44_ioctl;
242 +       dev->tx_timeout = b44_tx_timeout;
243 +       netif_napi_add(dev, &bp->napi, b44_poll, 64);
244 +       dev->watchdog_timeo = B44_TX_TIMEOUT;
245 +#ifdef CONFIG_NET_POLL_CONTROLLER
246 +       dev->poll_controller = b44_poll_controller;
247 +#endif
248 +       dev->change_mtu = b44_change_mtu;
249 +#else
250         dev->netdev_ops = &b44_netdev_ops;
251         netif_napi_add(dev, &bp->napi, b44_poll, 64);
252         dev->watchdog_timeo = B44_TX_TIMEOUT;
253 +#endif
254         dev->irq = sdev->irq;
255         SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
256  
257 --- a/net/wireless/wext-core.c
258 +++ b/net/wireless/wext-core.c
259 @@ -340,6 +340,7 @@ static const int compat_event_type_size[
260  
261  /* IW event code */
262  
263 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
264  static int __net_init wext_pernet_init(struct net *net)
265  {
266         skb_queue_head_init(&net->wext_nlevents);
267 @@ -382,6 +383,29 @@ static void wireless_nlevent_process(str
268  
269  static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
270  
271 +#else
272 +/* Older kernels get the old way of doing stuff*/
273 +static struct sk_buff_head wireless_nlevent_queue;
274 +
275 +static int __init wireless_nlevent_init(void)
276 +{
277 +       skb_queue_head_init(&wireless_nlevent_queue);
278 +       return 0;
279 +}
280 +
281 +subsys_initcall(wireless_nlevent_init);
282 +
283 +static void wireless_nlevent_process(unsigned long data)
284 +{
285 +       struct sk_buff *skb;
286 +       while ((skb = skb_dequeue(&wireless_nlevent_queue)))
287 +               rtnl_notify(skb, &init_net, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
288 +}
289 +
290 +static DECLARE_TASKLET(wireless_nlevent_tasklet, wireless_nlevent_process, 0);
291 +
292 +#endif
293 +
294  static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
295                                               struct sk_buff *skb)
296  {
297 @@ -592,8 +616,13 @@ void wireless_send_event(struct net_devi
298  
299         skb_shinfo(skb)->frag_list = compskb;
300  #endif
301 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
302         skb_queue_tail(&dev_net(dev)->wext_nlevents, skb);
303         schedule_work(&wireless_nlevent_work);
304 +#else
305 +       skb_queue_tail(&wireless_nlevent_queue, skb);
306 +       tasklet_schedule(&wireless_nlevent_tasklet);
307 +#endif
308  }
309  EXPORT_SYMBOL(wireless_send_event);
310  
311 @@ -902,8 +931,13 @@ static int wireless_process_ioctl(struct
312                         return private(dev, iwr, cmd, info, handler);
313         }
314         /* Old driver API : call driver ioctl handler */
315 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
316         if (dev->netdev_ops->ndo_do_ioctl)
317                 return dev->netdev_ops->ndo_do_ioctl(dev, ifr, cmd);
318 +#else
319 +       if (dev->do_ioctl)
320 +               return dev->do_ioctl(dev, ifr, cmd);
321 +#endif
322         return -EOPNOTSUPP;
323  }
324  
325 --- a/drivers/net/wireless/ipw2x00/ipw2100.c
326 +++ b/drivers/net/wireless/ipw2x00/ipw2100.c
327 @@ -6091,6 +6091,7 @@ static void ipw2100_rf_kill(struct work_
328  
329  static void ipw2100_irq_tasklet(struct ipw2100_priv *priv);
330  
331 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
332  static const struct net_device_ops ipw2100_netdev_ops = {
333         .ndo_open               = ipw2100_open,
334         .ndo_stop               = ipw2100_close,
335 @@ -6101,6 +6102,7 @@ static const struct net_device_ops ipw21
336         .ndo_set_mac_address    = ipw2100_set_address,
337         .ndo_validate_addr      = eth_validate_addr,
338  };
339 +#endif
340  
341  /* Look into using netdev destructor to shutdown ieee80211? */
342  
343 @@ -6126,7 +6128,16 @@ static struct net_device *ipw2100_alloc_
344         priv->ieee->perfect_rssi = -20;
345         priv->ieee->worst_rssi = -85;
346  
347 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
348         dev->netdev_ops = &ipw2100_netdev_ops;
349 +#else
350 +       dev->open = ipw2100_open;
351 +       dev->stop = ipw2100_close;
352 +       dev->init = ipw2100_net_init;
353 +       dev->tx_timeout = ipw2100_tx_timeout;
354 +       dev->set_mac_address = ipw2100_set_address;
355 +#endif
356 +
357         dev->ethtool_ops = &ipw2100_ethtool_ops;
358         dev->wireless_handlers = &ipw2100_wx_handler_def;
359         priv->wireless_data.libipw = priv->ieee;
360 --- a/drivers/net/wireless/ipw2x00/ipw2200.c
361 +++ b/drivers/net/wireless/ipw2x00/ipw2200.c
362 @@ -11635,6 +11635,7 @@ static netdev_tx_t ipw_prom_hard_start_x
363         return NETDEV_TX_OK;
364  }
365  
366 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
367  static const struct net_device_ops ipw_prom_netdev_ops = {
368         .ndo_open               = ipw_prom_open,
369         .ndo_stop               = ipw_prom_stop,
370 @@ -11643,6 +11644,7 @@ static const struct net_device_ops ipw_p
371         .ndo_set_mac_address    = eth_mac_addr,
372         .ndo_validate_addr      = eth_validate_addr,
373  };
374 +#endif
375  
376  static int ipw_prom_alloc(struct ipw_priv *priv)
377  {
378 @@ -11663,7 +11665,13 @@ static int ipw_prom_alloc(struct ipw_pri
379         memcpy(priv->prom_net_dev->dev_addr, priv->mac_addr, ETH_ALEN);
380  
381         priv->prom_net_dev->type = ARPHRD_IEEE80211_RADIOTAP;
382 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
383         priv->prom_net_dev->netdev_ops = &ipw_prom_netdev_ops;
384 +#else
385 +       priv->prom_net_dev->open = ipw_prom_open;
386 +       priv->prom_net_dev->stop = ipw_prom_stop;
387 +       priv->prom_net_dev->hard_start_xmit = ipw_prom_hard_start_xmit;
388 +#endif
389  
390         priv->prom_priv->ieee->iw_mode = IW_MODE_MONITOR;
391         SET_NETDEV_DEV(priv->prom_net_dev, &priv->pci_dev->dev);
392 @@ -11691,6 +11699,7 @@ static void ipw_prom_free(struct ipw_pri
393  
394  #endif
395  
396 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
397  static const struct net_device_ops ipw_netdev_ops = {
398         .ndo_init               = ipw_net_init,
399         .ndo_open               = ipw_net_open,
400 @@ -11701,6 +11710,7 @@ static const struct net_device_ops ipw_n
401         .ndo_change_mtu         = libipw_change_mtu,
402         .ndo_validate_addr      = eth_validate_addr,
403  };
404 +#endif
405  
406  static int __devinit ipw_pci_probe(struct pci_dev *pdev,
407                                    const struct pci_device_id *ent)
408 @@ -11802,7 +11812,15 @@ static int __devinit ipw_pci_probe(struc
409         priv->ieee->perfect_rssi = -20;
410         priv->ieee->worst_rssi = -85;
411  
412 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
413         net_dev->netdev_ops = &ipw_netdev_ops;
414 +#else
415 +       net_dev->open = ipw_net_open;
416 +       net_dev->stop = ipw_net_stop;
417 +       net_dev->init = ipw_net_init;
418 +       net_dev->set_multicast_list = ipw_net_set_multicast_list;
419 +       net_dev->set_mac_address = ipw_net_set_mac_address;
420 +#endif
421         priv->wireless_data.spy_data = &priv->ieee->spy_data;
422         net_dev->wireless_data = &priv->wireless_data;
423         net_dev->wireless_handlers = &ipw_wx_handler_def;
424 --- a/drivers/net/wireless/ipw2x00/libipw_module.c
425 +++ b/drivers/net/wireless/ipw2x00/libipw_module.c
426 @@ -157,6 +157,10 @@ struct net_device *alloc_ieee80211(int s
427                 goto failed;
428         }
429         ieee = netdev_priv(dev);
430 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29))
431 +       dev->hard_start_xmit = libipw_xmit;
432 +       dev->change_mtu = libipw_change_mtu;
433 +#endif
434  
435         ieee->dev = dev;
436  
437 --- a/drivers/net/wireless/libertas/main.c
438 +++ b/drivers/net/wireless/libertas/main.c
439 @@ -881,6 +881,7 @@ static void lbs_free_adapter(struct lbs_
440         lbs_deb_leave(LBS_DEB_MAIN);
441  }
442  
443 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
444  static const struct net_device_ops lbs_netdev_ops = {
445         .ndo_open               = lbs_dev_open,
446         .ndo_stop               = lbs_eth_stop,
447 @@ -891,6 +892,7 @@ static const struct net_device_ops lbs_n
448         .ndo_change_mtu         = eth_change_mtu,
449         .ndo_validate_addr      = eth_validate_addr,
450  };
451 +#endif
452  
453  /**
454   * @brief This function adds the card. it will probe the
455 @@ -936,7 +938,16 @@ struct lbs_private *lbs_add_card(void *c
456         wdev->netdev = dev;
457         priv->dev = dev;
458  
459 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
460         dev->netdev_ops = &lbs_netdev_ops;
461 +#else
462 +       dev->open = lbs_dev_open;
463 +       dev->hard_start_xmit = lbs_hard_start_xmit;
464 +       dev->stop = lbs_eth_stop;
465 +       dev->set_mac_address = lbs_set_mac_address;
466 +       dev->tx_timeout = lbs_tx_timeout;
467 +       dev->set_multicast_list = lbs_set_multicast_list;
468 +#endif
469         dev->watchdog_timeo = 5 * HZ;
470         dev->ethtool_ops = &lbs_ethtool_ops;
471  #ifdef WIRELESS_EXT
472 @@ -1242,11 +1253,13 @@ out:
473         lbs_deb_leave(LBS_DEB_MAIN);
474  }
475  
476 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
477  static const struct net_device_ops rtap_netdev_ops = {
478         .ndo_open = lbs_rtap_open,
479         .ndo_stop = lbs_rtap_stop,
480         .ndo_start_xmit = lbs_rtap_hard_start_xmit,
481  };
482 +#endif
483  
484  static int lbs_add_rtap(struct lbs_private *priv)
485  {
486 @@ -1267,7 +1280,13 @@ static int lbs_add_rtap(struct lbs_priva
487  
488         memcpy(rtap_dev->dev_addr, priv->current_addr, ETH_ALEN);
489         rtap_dev->type = ARPHRD_IEEE80211_RADIOTAP;
490 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
491         rtap_dev->netdev_ops = &rtap_netdev_ops;
492 +#else
493 +       rtap_dev->open = lbs_rtap_open;
494 +       rtap_dev->stop = lbs_rtap_stop;
495 +       rtap_dev->hard_start_xmit = lbs_rtap_hard_start_xmit;
496 +#endif
497         rtap_dev->ml_priv = priv;
498         SET_NETDEV_DEV(rtap_dev, priv->dev->dev.parent);
499  
500 --- a/drivers/net/wireless/libertas/mesh.c
501 +++ b/drivers/net/wireless/libertas/mesh.c
502 @@ -332,6 +332,7 @@ static int lbs_mesh_dev_open(struct net_
503         return ret;
504  }
505  
506 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
507  static const struct net_device_ops mesh_netdev_ops = {
508         .ndo_open               = lbs_mesh_dev_open,
509         .ndo_stop               = lbs_mesh_stop,
510 @@ -339,6 +340,7 @@ static const struct net_device_ops mesh_
511         .ndo_set_mac_address    = lbs_set_mac_address,
512         .ndo_set_multicast_list = lbs_set_multicast_list,
513  };
514 +#endif
515  
516  /**
517   * @brief This function adds mshX interface
518 @@ -363,7 +365,15 @@ int lbs_add_mesh(struct lbs_private *pri
519         mesh_dev->ml_priv = priv;
520         priv->mesh_dev = mesh_dev;
521  
522 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
523         mesh_dev->netdev_ops = &mesh_netdev_ops;
524 +#else
525 +       mesh_dev->open = lbs_mesh_dev_open;
526 +       mesh_dev->hard_start_xmit = lbs_hard_start_xmit;
527 +       mesh_dev->stop = lbs_mesh_stop;
528 +       mesh_dev->set_mac_address = lbs_set_mac_address;
529 +       mesh_dev->set_multicast_list = lbs_set_multicast_list;
530 +#endif
531         mesh_dev->ethtool_ops = &lbs_ethtool_ops;
532         memcpy(mesh_dev->dev_addr, priv->dev->dev_addr, ETH_ALEN);
533  
534 --- a/drivers/net/wireless/libertas/defs.h
535 +++ b/drivers/net/wireless/libertas/defs.h
536 @@ -16,6 +16,14 @@
537  #define DRV_NAME "libertas"
538  #endif
539  
540 +/*
541 + * Really nasty hack to avoid stuffing compat.diff with tons of ifdefs,
542 + * we could add this to a compat header file but too lazy to check ml_priv
543 + * is not used anywhere else
544 + */
545 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26))
546 +#define ml_priv priv
547 +#endif
548  
549  #define LBS_DEB_ENTER  0x00000001
550  #define LBS_DEB_LEAVE  0x00000002
551 --- a/drivers/net/wireless/mac80211_hwsim.c
552 +++ b/drivers/net/wireless/mac80211_hwsim.c
553 @@ -1015,16 +1015,22 @@ static struct device_driver mac80211_hws
554         .name = "mac80211_hwsim"
555  };
556  
557 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
558  static const struct net_device_ops hwsim_netdev_ops = {
559         .ndo_start_xmit         = hwsim_mon_xmit,
560         .ndo_change_mtu         = eth_change_mtu,
561         .ndo_set_mac_address    = eth_mac_addr,
562         .ndo_validate_addr      = eth_validate_addr,
563  };
564 +#endif
565  
566  static void hwsim_mon_setup(struct net_device *dev)
567  {
568 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
569         dev->netdev_ops = &hwsim_netdev_ops;
570 +#else
571 +       dev->hard_start_xmit = hwsim_mon_xmit;
572 +#endif
573         dev->destructor = free_netdev;
574         ether_setup(dev);
575         dev->tx_queue_len = 0;
576 --- a/net/bluetooth/bnep/netdev.c
577 +++ b/net/bluetooth/bnep/netdev.c
578 @@ -167,8 +167,12 @@ static inline int bnep_net_proto_filter(
579  }
580  #endif
581  
582 -static netdev_tx_t bnep_net_xmit(struct sk_buff *skb,
583 -                                struct net_device *dev)
584 +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,31))
585 +static netdev_tx_t bnep_net_xmit(struct sk_buff *skb, struct net_device *dev)
586 +#else
587 +static int bnep_net_xmit(struct sk_buff *skb, struct net_device *dev)
588 +#endif
589 +
590  {
591         struct bnep_session *s = netdev_priv(dev);
592         struct sock *sk = s->sock->sk;
593 @@ -209,6 +213,7 @@ static netdev_tx_t bnep_net_xmit(struct 
594         return NETDEV_TX_OK;
595  }
596  
597 +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
598  static const struct net_device_ops bnep_netdev_ops = {
599         .ndo_open            = bnep_net_open,
600         .ndo_stop            = bnep_net_close,
601 @@ -220,6 +225,16 @@ static const struct net_device_ops bnep_
602         .ndo_change_mtu      = eth_change_mtu,
603  
604  };
605 +#else
606 +static struct net_device_stats *bnep_net_get_stats(struct net_device *dev)
607 +{
608 +       return &dev->stats;
609 +}
610 +static int bnep_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
611 +{
612 +       return -EINVAL;
613 +}
614 +#endif
615  
616  void bnep_net_setup(struct net_device *dev)
617  {
618 @@ -228,7 +243,18 @@ void bnep_net_setup(struct net_device *d
619         dev->addr_len = ETH_ALEN;
620  
621         ether_setup(dev);
622 +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
623         dev->netdev_ops = &bnep_netdev_ops;
624 +#else
625 +       dev->open            = bnep_net_open;
626 +       dev->stop            = bnep_net_close;
627 +       dev->hard_start_xmit = bnep_net_xmit;
628 +       dev->get_stats       = bnep_net_get_stats;
629 +       dev->do_ioctl        = bnep_net_ioctl;
630 +       dev->set_mac_address = bnep_net_set_mac_addr;
631 +       dev->set_multicast_list = bnep_net_set_mc_list;
632 +       dev->tx_timeout      = bnep_net_timeout;
633 +#endif
634  
635         dev->watchdog_timeo  = HZ * 2;
636  }
637 --- a/drivers/net/atl1e/atl1e_main.c
638 +++ b/drivers/net/atl1e/atl1e_main.c
639 @@ -2202,6 +2202,7 @@ static void atl1e_shutdown(struct pci_de
640         atl1e_suspend(pdev, PMSG_SUSPEND);
641  }
642  
643 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
644  static const struct net_device_ops atl1e_netdev_ops = {
645         .ndo_open               = atl1e_open,
646         .ndo_stop               = atl1e_close,
647 @@ -2219,6 +2220,7 @@ static const struct net_device_ops atl1e
648  #endif
649  
650  };
651 +#endif
652  
653  static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
654  {
655 @@ -2226,7 +2228,23 @@ static int atl1e_init_netdev(struct net_
656         pci_set_drvdata(pdev, netdev);
657  
658         netdev->irq  = pdev->irq;
659 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
660         netdev->netdev_ops = &atl1e_netdev_ops;
661 +#else
662 +       netdev->change_mtu = atl1e_change_mtu;
663 +       netdev->hard_start_xmit = atl1e_xmit_frame;
664 +       netdev->open = atl1e_open;
665 +       netdev->stop = atl1e_close;
666 +       netdev->tx_timeout = atl1e_tx_timeout;
667 +       netdev->set_mac_address = atl1e_set_mac_addr;
668 +       netdev->do_ioctl = atl1e_ioctl;
669 +       netdev->get_stats = atl1e_get_stats;
670 +       netdev->set_multicast_list = atl1e_set_multi;
671 +       netdev->vlan_rx_register = atl1e_vlan_rx_register;
672 +#ifdef CONFIG_NET_POLL_CONTROLLER
673 +       netdev->poll_controller = atl1e_netpoll;
674 +#endif
675 +#endif
676  
677         netdev->watchdog_timeo = AT_TX_WATCHDOG;
678         atl1e_set_ethtool_ops(netdev);
679 --- a/drivers/net/atl1c/atl1c_main.c
680 +++ b/drivers/net/atl1c/atl1c_main.c
681 @@ -2534,6 +2534,7 @@ static void atl1c_shutdown(struct pci_de
682         atl1c_suspend(pdev, PMSG_SUSPEND);
683  }
684  
685 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
686  static const struct net_device_ops atl1c_netdev_ops = {
687         .ndo_open               = atl1c_open,
688         .ndo_stop               = atl1c_close,
689 @@ -2550,6 +2551,7 @@ static const struct net_device_ops atl1c
690         .ndo_poll_controller    = atl1c_netpoll,
691  #endif
692  };
693 +#endif
694  
695  static int atl1c_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
696  {
697 @@ -2557,7 +2559,23 @@ static int atl1c_init_netdev(struct net_
698         pci_set_drvdata(pdev, netdev);
699  
700         netdev->irq  = pdev->irq;
701 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
702         netdev->netdev_ops = &atl1c_netdev_ops;
703 +#else
704 +       netdev->change_mtu = atl1c_change_mtu;
705 +       netdev->hard_start_xmit = atl1c_xmit_frame;
706 +       netdev->open = atl1c_open;
707 +       netdev->stop = atl1c_close;
708 +       netdev->tx_timeout = atl1c_tx_timeout;
709 +       netdev->set_mac_address = atl1c_set_mac_addr;
710 +       netdev->do_ioctl = atl1c_ioctl;
711 +       netdev->get_stats = atl1c_get_stats;
712 +       netdev->set_multicast_list = atl1c_set_multi;
713 +       netdev->vlan_rx_register = atl1c_vlan_rx_register;
714 +#ifdef CONFIG_NET_POLL_CONTROLLER
715 +       netdev->poll_controller = atl1c_netpoll;
716 +#endif
717 +#endif
718         netdev->watchdog_timeo = AT_TX_WATCHDOG;
719         atl1c_set_ethtool_ops(netdev);
720  
721 --- a/drivers/net/atlx/atl1.c
722 +++ b/drivers/net/atlx/atl1.c
723 @@ -2878,6 +2878,7 @@ static void atl1_poll_controller(struct 
724  }
725  #endif
726  
727 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
728  static const struct net_device_ops atl1_netdev_ops = {
729         .ndo_open               = atl1_open,
730         .ndo_stop               = atl1_close,
731 @@ -2893,6 +2894,7 @@ static const struct net_device_ops atl1_
732         .ndo_poll_controller    = atl1_poll_controller,
733  #endif
734  };
735 +#endif
736  
737  /*
738   * atl1_probe - Device Initialization Routine
739 @@ -2981,7 +2983,22 @@ static int __devinit atl1_probe(struct p
740         adapter->mii.phy_id_mask = 0x1f;
741         adapter->mii.reg_num_mask = 0x1f;
742  
743 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
744         netdev->netdev_ops = &atl1_netdev_ops;
745 +#else
746 +       netdev->change_mtu = atl1_change_mtu;
747 +       netdev->hard_start_xmit = atl1_xmit_frame;
748 +       netdev->open = atl1_open;
749 +       netdev->stop = atl1_close;
750 +       netdev->tx_timeout = atlx_tx_timeout;
751 +       netdev->set_mac_address = atl1_set_mac;
752 +       netdev->do_ioctl = atlx_ioctl;
753 +       netdev->set_multicast_list = atlx_set_multi;
754 +       netdev->vlan_rx_register = atlx_vlan_rx_register;
755 +#ifdef CONFIG_NET_POLL_CONTROLLER
756 +       netdev->poll_controller = atl1_poll_controller;
757 +#endif
758 +#endif
759         netdev->watchdog_timeo = 5 * HZ;
760  
761         netdev->ethtool_ops = &atl1_ethtool_ops;
762 --- a/drivers/net/atlx/atl2.c
763 +++ b/drivers/net/atlx/atl2.c
764 @@ -1306,6 +1306,7 @@ static void atl2_poll_controller(struct 
765  #endif
766  
767  
768 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
769  static const struct net_device_ops atl2_netdev_ops = {
770         .ndo_open               = atl2_open,
771         .ndo_stop               = atl2_close,
772 @@ -1321,6 +1322,7 @@ static const struct net_device_ops atl2_
773         .ndo_poll_controller    = atl2_poll_controller,
774  #endif
775  };
776 +#endif
777  
778  /*
779   * atl2_probe - Device Initialization Routine
780 @@ -1395,7 +1397,22 @@ static int __devinit atl2_probe(struct p
781  
782         atl2_setup_pcicmd(pdev);
783  
784 +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29))
785         netdev->netdev_ops = &atl2_netdev_ops;
786 +#else
787 +       netdev->change_mtu = atl2_change_mtu;
788 +       netdev->hard_start_xmit = atl2_xmit_frame;
789 +       netdev->open = atl2_open;
790 +       netdev->stop = atl2_close;
791 +       netdev->tx_timeout = atl2_tx_timeout;
792 +       netdev->set_mac_address = atl2_set_mac;
793 +       netdev->do_ioctl = atl2_ioctl;
794 +       netdev->set_multicast_list = atl2_set_multi;
795 +       netdev->vlan_rx_register = atl2_vlan_rx_register;
796 +#ifdef CONFIG_NET_POLL_CONTROLLER
797 +       netdev->poll_controller = atl2_poll_controller;
798 +#endif
799 +#endif
800         atl2_set_ethtool_ops(netdev);
801         netdev->watchdog_timeo = 5 * HZ;
802         strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);