[PATCH] [qos-scripts] Reload IMQ only when needed
[openwrt.git] / package / madwifi / patches / 432-backport_oops.patch
1 Convert to net_device_ops for Linux 2.6.29+
2 http://madwifi-project.org/changeset/4005
3 --- a/ath/if_ath.c
4 +++ b/ath/if_ath.c
5 @@ -566,6 +566,20 @@ static inline int rate_factor(int mode)
6
7 /* Initialize ath_softc structure */
8
9 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
10 +static const struct net_device_ops ath_netdev_ops = {
11 + .ndo_open = ath_init,
12 + .ndo_stop = ath_stop,
13 + .ndo_start_xmit = ath_hardstart,
14 + .ndo_tx_timeout = ath_tx_timeout,
15 + .ndo_set_multicast_list = ath_mode_init,
16 + .ndo_do_ioctl = ath_ioctl,
17 + .ndo_get_stats = ath_getstats,
18 + .ndo_set_mac_address = ath_set_mac_address,
19 + .ndo_change_mtu = ath_change_mtu,
20 +};
21 +#endif
22 +
23 int
24 ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
25 {
26 @@ -865,16 +879,20 @@ ath_attach(u_int16_t devid, struct net_d
27 }
28
29 /* NB: ether_setup is done by bus-specific code */
30 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
31 dev->open = ath_init;
32 dev->stop = ath_stop;
33 dev->hard_start_xmit = ath_hardstart;
34 dev->tx_timeout = ath_tx_timeout;
35 - dev->watchdog_timeo = 5 * HZ;
36 dev->set_multicast_list = ath_mode_init;
37 dev->do_ioctl = ath_ioctl;
38 dev->get_stats = ath_getstats;
39 dev->set_mac_address = ath_set_mac_address;
40 dev->change_mtu = ath_change_mtu;
41 +#else
42 + dev->netdev_ops = &ath_netdev_ops;
43 +#endif
44 + dev->watchdog_timeo = 5 * HZ;
45 dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
47 netif_napi_add(dev, &sc->sc_napi, ath_rx_poll, 64);
48 @@ -12726,8 +12744,13 @@ ath_rcv_dev_event(struct notifier_block
49 struct net_device *dev = (struct net_device *)ptr;
50 struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
51
52 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
53 if (!dev || !sc || dev->open != &ath_init)
54 return 0;
55 +#else
56 + if (!dev || !sc || dev->netdev_ops->ndo_open != &ath_init)
57 + return 0;
58 +#endif
59
60 switch (event) {
61 case NETDEV_CHANGENAME:
62 --- a/net80211/ieee80211.c
63 +++ b/net80211/ieee80211.c
64 @@ -450,6 +450,17 @@ ieee80211_ifdetach(struct ieee80211com *
65 }
66 EXPORT_SYMBOL(ieee80211_ifdetach);
67
68 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
69 +static const struct net_device_ops ieee80211_netdev_ops = {
70 + .ndo_get_stats = ieee80211_getstats,
71 + .ndo_open = ieee80211_open,
72 + .ndo_stop = ieee80211_stop,
73 + .ndo_start_xmit = ieee80211_hardstart,
74 + .ndo_set_multicast_list = ieee80211_set_multicast_list,
75 + .ndo_change_mtu = ieee80211_change_mtu,
76 +};
77 +#endif
78 +
79 int
80 ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
81 const char *name, int opmode, int flags, struct ieee80211vap *master)
82 @@ -470,12 +481,16 @@ ieee80211_vap_setup(struct ieee80211com
83 } else
84 strncpy(dev->name, name, sizeof(dev->name));
85 }
86 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
87
88 dev->get_stats = ieee80211_getstats;
89 dev->open = ieee80211_open;
90 dev->stop = ieee80211_stop;
91 dev->hard_start_xmit = ieee80211_hardstart;
92 dev->set_multicast_list = ieee80211_set_multicast_list;
93 +#else
94 + dev->netdev_ops = &ieee80211_netdev_ops;
95 +#endif
96 #if 0
97 dev->set_mac_address = ieee80211_set_mac_address;
98 #endif
99 @@ -1823,7 +1838,11 @@ ieee80211_set_multicast_list(struct net_
100 IEEE80211_UNLOCK_IRQ(ic);
101
102 /* XXX: Merge multicast list into parent device */
103 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
104 parent->set_multicast_list(ic->ic_dev);
105 +#else
106 + parent->netdev_ops->ndo_set_multicast_list(ic->ic_dev);
107 +#endif
108 }
109
110 void
111 --- a/net80211/ieee80211_linux.c
112 +++ b/net80211/ieee80211_linux.c
113 @@ -984,8 +984,14 @@ ieee80211_rcv_dev_event(struct notifier_
114 void *ptr)
115 {
116 struct net_device *dev = (struct net_device *) ptr;
117 +
118 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
119 if (!dev || dev->open != &ieee80211_open)
120 return 0;
121 +#else
122 + if (!dev || dev->netdev_ops->ndo_open != &ieee80211_open)
123 + return 0;
124 +#endif
125
126 switch (event) {
127 case NETDEV_CHANGENAME:
This page took 0.043443 seconds and 5 git commands to generate.