madwifi: add better hw detection, use a power offset for setting/getting tx power...
[openwrt/svn-archive/archive.git] / package / madwifi / patches / 430-use_netdev_priv.patch
1 --- a/ath/ath_wprobe.c
2 +++ b/ath/ath_wprobe.c
3 @@ -119,7 +119,7 @@ ath_wprobe_sync(struct wprobe_iface *dev
4 struct ath_vap *avp = container_of(dev, struct ath_vap, av_wpif);
5 struct ieee80211vap *vap = &avp->av_vap;
6 struct ieee80211com *ic = vap->iv_ic;
7 - struct ath_softc *sc = ic->ic_dev->priv;
8 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
9 struct ath_hal *ah = sc->sc_ah;
10 u32 cc, busy, rx, tx;
11 s16 noise;
12 @@ -192,7 +192,7 @@ ath_lookup_rateval(struct ieee80211_node
13 {
14 struct ieee80211vap *vap = ni->ni_vap;
15 struct ieee80211com *ic = vap->iv_ic;
16 - struct ath_softc *sc = ic->ic_dev->priv;
17 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
18 const HAL_RATE_TABLE *rt = sc->sc_currates;
19
20 if ((!rt) || (rate < 0) || (rate >= ARRAY_SIZE(sc->sc_hwmap)))
21 --- a/ath/if_ath_ahb.c
22 +++ b/ath/if_ath_ahb.c
23 @@ -203,7 +203,7 @@ static int ahb_wmac_probe(struct platfor
24 if (!dev)
25 return -ENOMEM;
26
27 - sc = dev->priv;
28 + sc = netdev_priv(dev);
29 sc->aps_sc.sc_dev = dev;
30
31 dev->irq = platform_get_irq(pdev, 0);
32 @@ -300,7 +300,7 @@ init_ath_wmac(u_int16_t devid, u_int16_t
33 printk(KERN_ERR "%s: no memory for device state\n", dev_info);
34 goto bad2;
35 }
36 - sc = dev->priv;
37 + sc = netdev_priv(dev);
38 sc->aps_sc.sc_dev = dev;
39
40 /*
41 --- a/ath/if_ath.c
42 +++ b/ath/if_ath.c
43 @@ -569,7 +569,7 @@ static inline int rate_factor(int mode)
44 int
45 ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
46 {
47 - struct ath_softc *sc = dev->priv;
48 + struct ath_softc *sc = netdev_priv(dev);
49 struct ieee80211com *ic = &sc->sc_ic;
50 struct ieee80211vap *vap;
51 struct ath_hal *ah;
52 @@ -1206,7 +1206,7 @@ bad:
53 int
54 ath_detach(struct net_device *dev)
55 {
56 - struct ath_softc *sc = dev->priv;
57 + struct ath_softc *sc = netdev_priv(dev);
58 struct ath_hal *ah = sc->sc_ah;
59
60 HAL_INT tmp;
61 @@ -1266,7 +1266,7 @@ static struct ieee80211vap *
62 ath_vap_create(struct ieee80211com *ic, const char *name,
63 int opmode, int flags, struct net_device *mdev, struct ieee80211vap *master)
64 {
65 - struct ath_softc *sc = ic->ic_dev->priv;
66 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
67 struct ath_hal *ah = sc->sc_ah;
68 struct net_device *dev;
69 struct ath_vap *avp;
70 @@ -1344,7 +1344,7 @@ ath_vap_create(struct ieee80211com *ic,
71 return NULL;
72 }
73
74 - avp = dev->priv;
75 + avp = netdev_priv(dev);
76 ieee80211_vap_setup(ic, dev, name, opmode, flags, master);
77 /* override with driver methods */
78 vap = &avp->av_vap;
79 @@ -1571,7 +1571,7 @@ static void
80 ath_vap_delete(struct ieee80211vap *vap)
81 {
82 struct net_device *dev = vap->iv_ic->ic_dev;
83 - struct ath_softc *sc = dev->priv;
84 + struct ath_softc *sc = netdev_priv(dev);
85 struct ath_hal *ah = sc->sc_ah;
86 struct ath_vap *avp = ATH_VAP(vap);
87 int decrease = 1;
88 @@ -1673,7 +1673,7 @@ void
89 ath_suspend(struct net_device *dev)
90 {
91 #ifdef AR_DEBUG
92 - struct ath_softc *sc = dev->priv;
93 + struct ath_softc *sc = netdev_priv(dev);
94 #endif
95
96 DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
97 @@ -1684,7 +1684,7 @@ void
98 ath_resume(struct net_device *dev)
99 {
100 #ifdef AR_DEBUG
101 - struct ath_softc *sc = dev->priv;
102 + struct ath_softc *sc = netdev_priv(dev);
103 #endif
104
105 DPRINTF(sc, ATH_DEBUG_ANY, "flags=%x\n", dev->flags);
106 @@ -2248,7 +2248,7 @@ ath_intr(int irq, void *dev_id, struct p
107 #endif
108 {
109 struct net_device *dev = dev_id;
110 - struct ath_softc *sc = dev->priv;
111 + struct ath_softc *sc = netdev_priv(dev);
112 struct ath_hal *ah = sc->sc_ah;
113 u_int64_t hw_tsf = 0;
114 HAL_INT status;
115 @@ -2469,7 +2469,7 @@ static void
116 ath_fatal_tasklet(TQUEUE_ARG data)
117 {
118 struct net_device *dev = (struct net_device *)data;
119 - struct ath_softc *sc = dev->priv;
120 + struct ath_softc *sc = netdev_priv(dev);
121
122 EPRINTF(sc, "Hardware error; resetting.\n");
123 ath_reset(dev);
124 @@ -2479,7 +2479,7 @@ static void
125 ath_rxorn_tasklet(TQUEUE_ARG data)
126 {
127 struct net_device *dev = (struct net_device *)data;
128 - struct ath_softc *sc = dev->priv;
129 + struct ath_softc *sc = netdev_priv(dev);
130
131 EPRINTF(sc, "Receive FIFO overrun; resetting.\n");
132 ath_reset(dev);
133 @@ -2489,7 +2489,7 @@ static void
134 ath_bmiss_tasklet(TQUEUE_ARG data)
135 {
136 struct net_device *dev = (struct net_device *)data;
137 - struct ath_softc *sc = dev->priv;
138 + struct ath_softc *sc = netdev_priv(dev);
139
140 if (time_before(jiffies, sc->sc_ic.ic_bmiss_guard)) {
141 /* Beacon miss interrupt occured too short after last beacon
142 @@ -2568,7 +2568,7 @@ done:
143 static int
144 ath_init(struct net_device *dev)
145 {
146 - struct ath_softc *sc = dev->priv;
147 + struct ath_softc *sc = netdev_priv(dev);
148 struct ieee80211com *ic = &sc->sc_ic;
149 struct ath_hal *ah = sc->sc_ah;
150 HAL_STATUS status;
151 @@ -2693,7 +2693,7 @@ done:
152 static int
153 ath_stop_locked(struct net_device *dev)
154 {
155 - struct ath_softc *sc = dev->priv;
156 + struct ath_softc *sc = netdev_priv(dev);
157 struct ieee80211com *ic = &sc->sc_ic;
158 struct ath_hal *ah = sc->sc_ah;
159
160 @@ -2778,7 +2778,7 @@ static void ath_set_beacon_cal(struct at
161 static int
162 ath_stop(struct net_device *dev)
163 {
164 - struct ath_softc *sc = dev->priv;
165 + struct ath_softc *sc = netdev_priv(dev);
166 int error;
167
168 ATH_LOCK(sc);
169 @@ -2998,7 +2998,7 @@ ath_fetch_idle_time(struct ath_softc *sc
170 static int
171 ath_reset(struct net_device *dev)
172 {
173 - struct ath_softc *sc = dev->priv;
174 + struct ath_softc *sc = netdev_priv(dev);
175 struct ieee80211com *ic = &sc->sc_ic;
176 struct ath_hal *ah = sc->sc_ah;
177 struct ieee80211_channel *c;
178 @@ -3164,7 +3164,7 @@ dot11_to_ratecode(struct ath_softc *sc,
179 static int
180 ath_tx_startraw(struct net_device *dev, struct ath_buf *bf, struct sk_buff *skb)
181 {
182 - struct ath_softc *sc = dev->priv;
183 + struct ath_softc *sc = netdev_priv(dev);
184 struct ath_hal *ah = sc->sc_ah;
185 struct ieee80211_phy_params *ph = (struct ieee80211_phy_params *)
186 (SKB_CB(skb) + 1); /* NB: SKB_CB casts to CB struct*. */
187 @@ -3477,7 +3477,7 @@ _take_txbuf(struct ath_softc *sc, int fo
188 static int
189 ath_hardstart(struct sk_buff *skb, struct net_device *dev)
190 {
191 - struct ath_softc *sc = dev->priv;
192 + struct ath_softc *sc = netdev_priv(dev);
193 struct ieee80211_node *ni = NULL;
194 struct ath_buf *bf = NULL;
195 ath_bufhead bf_head;
196 @@ -3792,7 +3792,7 @@ static int
197 ath_mgtstart(struct ieee80211com *ic, struct sk_buff *skb)
198 {
199 struct net_device *dev = ic->ic_dev;
200 - struct ath_softc *sc = dev->priv;
201 + struct ath_softc *sc = netdev_priv(dev);
202 struct ath_buf *bf = NULL;
203 int error;
204
205 @@ -4151,7 +4151,7 @@ static ieee80211_keyix_t
206 ath_key_alloc(struct ieee80211vap *vap, const struct ieee80211_key *k)
207 {
208 struct net_device *dev = vap->iv_ic->ic_dev;
209 - struct ath_softc *sc = dev->priv;
210 + struct ath_softc *sc = netdev_priv(dev);
211
212 /*
213 * Group key allocation must be handled specially for
214 @@ -4216,7 +4216,7 @@ ath_key_delete(struct ieee80211vap *vap,
215 struct ieee80211_node *ninfo)
216 {
217 struct net_device *dev = vap->iv_ic->ic_dev;
218 - struct ath_softc *sc = dev->priv;
219 + struct ath_softc *sc = netdev_priv(dev);
220 struct ath_hal *ah = sc->sc_ah;
221 struct ieee80211_node *ni = NULL;
222 const struct ieee80211_cipher *cip = k->wk_cipher;
223 @@ -4292,14 +4292,14 @@ ath_key_set(struct ieee80211vap *vap, co
224 const u_int8_t mac[IEEE80211_ADDR_LEN])
225 {
226 struct net_device *dev = vap->iv_ic->ic_dev;
227 - struct ath_softc *sc = dev->priv;
228 + struct ath_softc *sc = netdev_priv(dev);
229
230 return ath_keyset(sc, k, mac, vap->iv_bss);
231 }
232
233 static void ath_poll_disable(struct net_device *dev)
234 {
235 - struct ath_softc *sc = dev->priv;
236 + struct ath_softc *sc = netdev_priv(dev);
237
238 /*
239 * XXX Using in_softirq is not right since we might
240 @@ -4317,7 +4317,7 @@ static void ath_poll_disable(struct net_
241
242 static void ath_poll_enable(struct net_device *dev)
243 {
244 - struct ath_softc *sc = dev->priv;
245 + struct ath_softc *sc = netdev_priv(dev);
246
247 /* NB: see above */
248 if (!in_softirq()) {
249 @@ -4343,7 +4343,7 @@ ath_key_update_begin(struct ieee80211vap
250 {
251 struct net_device *dev = vap->iv_ic->ic_dev;
252 #ifdef AR_DEBUG
253 - struct ath_softc *sc = dev->priv;
254 + struct ath_softc *sc = netdev_priv(dev);
255 #endif
256
257 DPRINTF(sc, ATH_DEBUG_KEYCACHE, "Begin\n");
258 @@ -4361,7 +4361,7 @@ ath_key_update_end(struct ieee80211vap *
259 {
260 struct net_device *dev = vap->iv_ic->ic_dev;
261 #ifdef AR_DEBUG
262 - struct ath_softc *sc = dev->priv;
263 + struct ath_softc *sc = netdev_priv(dev);
264 #endif
265
266 DPRINTF(sc, ATH_DEBUG_KEYCACHE, "End\n");
267 @@ -4454,7 +4454,7 @@ ath_merge_mcast(struct ath_softc *sc, u_
268 static void
269 ath_mode_init(struct net_device *dev)
270 {
271 - struct ath_softc *sc = dev->priv;
272 + struct ath_softc *sc = netdev_priv(dev);
273 struct ath_hal *ah = sc->sc_ah;
274 u_int32_t rfilt, mfilt[2];
275
276 @@ -4540,7 +4540,7 @@ ath_set_timing(struct ath_softc *sc)
277 static void
278 ath_updateslot(struct net_device *dev)
279 {
280 - struct ath_softc *sc = dev->priv;
281 + struct ath_softc *sc = netdev_priv(dev);
282 struct ieee80211com *ic = &sc->sc_ic;
283
284 /*
285 @@ -4570,7 +4570,7 @@ ath_beacon_dturbo_config(struct ieee8021
286 (vap->iv_bss && (vap->iv_bss->ni_ath_flags & (IEEE80211_ATHC_TURBOP)) == \
287 (IEEE80211_ATHC_TURBOP))
288 struct ieee80211com *ic = vap->iv_ic;
289 - struct ath_softc *sc = ic->ic_dev->priv;
290 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
291
292 if (ic->ic_opmode == IEEE80211_M_HOSTAP && IS_CAPABLE(vap)) {
293
294 @@ -4618,7 +4618,7 @@ static void
295 ath_beacon_dturbo_update(struct ieee80211vap *vap, int *needmark, u_int8_t dtim)
296 {
297 struct ieee80211com *ic = vap->iv_ic;
298 - struct ath_softc *sc = ic->ic_dev->priv;
299 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
300 u_int32_t bss_traffic;
301
302 if (sc->sc_ignore_ar) {
303 @@ -4759,7 +4759,7 @@ static void
304 ath_turbo_switch_mode(unsigned long data)
305 {
306 struct net_device *dev = (struct net_device *)data;
307 - struct ath_softc *sc = dev->priv;
308 + struct ath_softc *sc = netdev_priv(dev);
309 struct ieee80211com *ic = &sc->sc_ic;
310 unsigned int newflags;
311
312 @@ -5438,7 +5438,7 @@ static void
313 ath_bstuck_tasklet(TQUEUE_ARG data)
314 {
315 struct net_device *dev = (struct net_device *)data;
316 - struct ath_softc *sc = dev->priv;
317 + struct ath_softc *sc = netdev_priv(dev);
318 /*
319 * XXX:if the bmisscount is cleared while the
320 * tasklet execution is pending, the following
321 @@ -5891,7 +5891,7 @@ ath_node_alloc_debug(struct ieee80211vap
322 ath_node_alloc(struct ieee80211vap *vap)
323 #endif
324 {
325 - struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
326 + struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
327 const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space;
328 struct ath_node *an = kmalloc(space, GFP_ATOMIC);
329 if (an != NULL) {
330 @@ -5927,7 +5927,7 @@ ath_node_cleanup(struct ieee80211_node *
331 #endif
332 {
333 struct ieee80211com *ic = ni->ni_ic;
334 - struct ath_softc *sc = ni->ni_ic->ic_dev->priv;
335 + struct ath_softc *sc = netdev_priv(ni->ni_ic->ic_dev);
336 struct ath_node *an = ATH_NODE(ni);
337 struct ath_buf *bf;
338
339 @@ -5985,7 +5985,7 @@ ath_node_free_debug(struct ieee80211_nod
340 ath_node_free(struct ieee80211_node *ni)
341 #endif
342 {
343 - struct ath_softc *sc = ni->ni_ic->ic_dev->priv;
344 + struct ath_softc *sc = netdev_priv(ni->ni_ic->ic_dev);
345
346 #ifdef IEEE80211_DEBUG_REFCNT
347 sc->sc_node_free_debug(ni, func, line);
348 @@ -6033,7 +6033,7 @@ ath_node_move_data(const struct ieee8021
349 #ifdef NOT_YET
350 struct ath_txq *txq = NULL;
351 struct ieee80211com *ic = ni->ni_ic;
352 - struct ath_softc *sc = ic->ic_dev->priv;
353 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
354 struct ath_buf *bf, *prev, *bf_tmp, *bf_tmp1;
355 struct ath_hal *ah = sc->sc_ah;
356 struct sk_buff *skb = NULL;
357 @@ -6553,7 +6553,7 @@ static void
358 ath_capture(struct net_device *dev, const struct ath_buf *bf,
359 struct sk_buff *skb, u_int64_t tsf, unsigned int tx)
360 {
361 - struct ath_softc *sc = dev->priv;
362 + struct ath_softc *sc = netdev_priv(dev);
363 struct ieee80211com *ic = &sc->sc_ic;
364 struct sk_buff *tskb = NULL;
365
366 @@ -6613,7 +6613,7 @@ static void
367 ath_recv_mgmt(struct ieee80211vap * vap, struct ieee80211_node *ni_or_null,
368 struct sk_buff *skb, int subtype, int rssi, u_int64_t rtsf)
369 {
370 - struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
371 + struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
372 #ifdef AR_DEBUG
373 struct ieee80211_frame *wh = (struct ieee80211_frame *)skb->data;
374 #endif
375 @@ -6780,7 +6780,7 @@ ath_rx_poll(struct net_device *dev, int
376 struct net_device *dev = sc->sc_dev;
377 int rx_limit = budget;
378 #else
379 - struct ath_softc *sc = dev->priv;
380 + struct ath_softc *sc = netdev_priv(dev);
381 int rx_limit = min(dev->quota, *budget);
382 #endif
383 struct ath_buf *bf;
384 @@ -7302,7 +7302,7 @@ static void ath_grppoll_start(struct iee
385 struct sk_buff *skb = NULL;
386 struct ath_buf *bf, *head = NULL;
387 struct ieee80211com *ic = vap->iv_ic;
388 - struct ath_softc *sc = ic->ic_dev->priv;
389 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
390 struct ath_hal *ah = sc->sc_ah;
391 u_int8_t rate;
392 unsigned int ctsrate = 0, ctsduration = 0;
393 @@ -7520,7 +7520,7 @@ static void ath_grppoll_start(struct iee
394 static void ath_grppoll_stop(struct ieee80211vap *vap)
395 {
396 struct ieee80211com *ic = vap->iv_ic;
397 - struct ath_softc *sc = ic->ic_dev->priv;
398 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
399 struct ath_hal *ah = sc->sc_ah;
400 struct ath_txq *txq = &sc->sc_grpplq;
401 struct ath_buf *bf;
402 @@ -7732,7 +7732,7 @@ ath_txq_update(struct ath_softc *sc, str
403 static int
404 ath_wme_update(struct ieee80211com *ic)
405 {
406 - struct ath_softc *sc = ic->ic_dev->priv;
407 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
408
409 if (sc->sc_uapsdq)
410 ath_txq_update(sc, sc->sc_uapsdq, WME_AC_VO);
411 @@ -7751,7 +7751,7 @@ ath_uapsd_flush(struct ieee80211_node *n
412 {
413 struct ath_node *an = ATH_NODE(ni);
414 struct ath_buf *bf;
415 - struct ath_softc *sc = ni->ni_ic->ic_dev->priv;
416 + struct ath_softc *sc = netdev_priv(ni->ni_ic->ic_dev);
417 struct ath_txq *txq;
418
419 ATH_NODE_UAPSD_LOCK_IRQ(an);
420 @@ -7942,7 +7942,7 @@ ath_tx_start(struct net_device *dev, str
421 struct ath_buf *bf, struct sk_buff *skb, int nextfraglen)
422 {
423 #define MIN(a,b) ((a) < (b) ? (a) : (b))
424 - struct ath_softc *sc = dev->priv;
425 + struct ath_softc *sc = netdev_priv(dev);
426 struct ieee80211com *ic = ni->ni_ic;
427 struct ieee80211vap *vap = ni->ni_vap;
428 struct ath_hal *ah = sc->sc_ah;
429 @@ -8851,7 +8851,7 @@ static void
430 ath_tx_tasklet_q0(TQUEUE_ARG data)
431 {
432 struct net_device *dev = (struct net_device *)data;
433 - struct ath_softc *sc = dev->priv;
434 + struct ath_softc *sc = netdev_priv(dev);
435 unsigned long flags;
436
437 process_tx_again:
438 @@ -8882,7 +8882,7 @@ static void
439 ath_tx_tasklet_q0123(TQUEUE_ARG data)
440 {
441 struct net_device *dev = (struct net_device *)data;
442 - struct ath_softc *sc = dev->priv;
443 + struct ath_softc *sc = netdev_priv(dev);
444 unsigned long flags;
445
446 process_tx_again:
447 @@ -8927,7 +8927,7 @@ static void
448 ath_tx_tasklet(TQUEUE_ARG data)
449 {
450 struct net_device *dev = (struct net_device *)data;
451 - struct ath_softc *sc = dev->priv;
452 + struct ath_softc *sc = netdev_priv(dev);
453 unsigned int i;
454 unsigned long flags;
455
456 @@ -8955,7 +8955,7 @@ process_tx_again:
457 static void
458 ath_tx_timeout(struct net_device *dev)
459 {
460 - struct ath_softc *sc = dev->priv;
461 + struct ath_softc *sc = netdev_priv(dev);
462
463 if (ath_chan_unavail(sc))
464 return;
465 @@ -9363,7 +9363,7 @@ static void
466 ath_calibrate(unsigned long arg)
467 {
468 struct net_device *dev = (struct net_device *)arg;
469 - struct ath_softc *sc = dev->priv;
470 + struct ath_softc *sc = netdev_priv(dev);
471 struct ath_hal *ah = sc->sc_ah;
472 struct ieee80211com *ic = &sc->sc_ic;
473 /* u_int32_t nchans; */
474 @@ -9438,7 +9438,7 @@ static void
475 ath_scan_start(struct ieee80211com *ic)
476 {
477 struct net_device *dev = ic->ic_dev;
478 - struct ath_softc *sc = dev->priv;
479 + struct ath_softc *sc = netdev_priv(dev);
480 struct ath_hal *ah = sc->sc_ah;
481 u_int32_t rfilt;
482
483 @@ -9458,7 +9458,7 @@ static void
484 ath_scan_end(struct ieee80211com *ic)
485 {
486 struct net_device *dev = ic->ic_dev;
487 - struct ath_softc *sc = dev->priv;
488 + struct ath_softc *sc = netdev_priv(dev);
489 struct ath_hal *ah = sc->sc_ah;
490 u_int32_t rfilt;
491
492 @@ -9476,7 +9476,7 @@ static void
493 ath_set_channel(struct ieee80211com *ic)
494 {
495 struct net_device *dev = ic->ic_dev;
496 - struct ath_softc *sc = dev->priv;
497 + struct ath_softc *sc = netdev_priv(dev);
498
499 (void) ath_chan_set(sc, ic->ic_curchan);
500 ic->ic_channoise = ath_hal_get_channel_noise(sc->sc_ah, &(sc->sc_curchan));
501 @@ -9493,7 +9493,7 @@ ath_set_channel(struct ieee80211com *ic)
502 static void
503 ath_set_coverageclass(struct ieee80211com *ic)
504 {
505 - struct ath_softc *sc = ic->ic_dev->priv;
506 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
507
508 sc->sc_coverage = ic->ic_coverageclass * 3;
509 ath_set_timing(sc);
510 @@ -9504,7 +9504,7 @@ ath_set_coverageclass(struct ieee80211co
511 static u_int
512 ath_mhz2ieee(struct ieee80211com *ic, u_int freq, u_int flags)
513 {
514 - struct ath_softc *sc = ic->ic_dev->priv;
515 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
516
517 return (ath_hal_mhz2ieee(sc->sc_ah, freq, flags));
518 }
519 @@ -9519,7 +9519,7 @@ ath_newstate(struct ieee80211vap *vap, e
520 struct ath_vap *avp = ATH_VAP(vap);
521 struct ieee80211com *ic = vap->iv_ic;
522 struct net_device *dev = ic->ic_dev;
523 - struct ath_softc *sc = dev->priv;
524 + struct ath_softc *sc = netdev_priv(dev);
525 struct ath_hal *ah = sc->sc_ah;
526 struct ieee80211_node *ni, *wds_ni;
527 unsigned int i;
528 @@ -9959,7 +9959,7 @@ ath_setup_comp(struct ieee80211_node *ni
529 {
530 #define IEEE80211_KEY_XR (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV)
531 struct ieee80211vap *vap = ni->ni_vap;
532 - struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
533 + struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
534 struct ath_node *an = ATH_NODE(ni);
535 ieee80211_keyix_t keyix;
536
537 @@ -10013,7 +10013,7 @@ static void
538 ath_setup_stationkey(struct ieee80211_node *ni)
539 {
540 struct ieee80211vap *vap = ni->ni_vap;
541 - struct ath_softc *sc = vap->iv_ic->ic_dev->priv;
542 + struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
543 ieee80211_keyix_t keyix;
544
545 keyix = ath_key_alloc(vap, &ni->ni_ucastkey);
546 @@ -10174,7 +10174,7 @@ ath_newassoc(struct ieee80211_node *ni,
547 {
548 struct ieee80211com *ic = ni->ni_ic;
549 struct ieee80211vap *vap = ni->ni_vap;
550 - struct ath_softc *sc = ic->ic_dev->priv;
551 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
552
553 sc->sc_rc->ops->newassoc(sc, ATH_NODE(ni), isnew);
554 ath_wprobe_node_join(ni->ni_vap, ni);
555 @@ -10205,7 +10205,7 @@ ath_newassoc(struct ieee80211_node *ni,
556 static int
557 ath_getchannels(struct net_device *dev)
558 {
559 - struct ath_softc *sc = dev->priv;
560 + struct ath_softc *sc = netdev_priv(dev);
561 struct ieee80211com *ic = &sc->sc_ic;
562 struct ath_hal *ah = sc->sc_ah;
563 HAL_CHANNEL *chans;
564 @@ -10482,7 +10482,7 @@ ath_update_txpow(struct ath_softc *sc)
565 static int
566 ath_xr_rate_setup(struct net_device *dev)
567 {
568 - struct ath_softc *sc = dev->priv;
569 + struct ath_softc *sc = netdev_priv(dev);
570 struct ath_hal *ah = sc->sc_ah;
571 struct ieee80211com *ic = &sc->sc_ic;
572 const HAL_RATE_TABLE *rt;
573 @@ -10513,7 +10513,7 @@ ath_xr_rate_setup(struct net_device *dev
574 static int
575 ath_rate_setup(struct net_device *dev, u_int mode)
576 {
577 - struct ath_softc *sc = dev->priv;
578 + struct ath_softc *sc = netdev_priv(dev);
579 struct ath_hal *ah = sc->sc_ah;
580 struct ieee80211com *ic = &sc->sc_ic;
581 const HAL_RATE_TABLE *rt;
582 @@ -10760,7 +10760,7 @@ ath_printtxbuf(const struct ath_buf *bf,
583 {
584 const struct ath_tx_status *ts = &bf->bf_dsstatus.ds_txstat;
585 const struct ath_desc *ds = bf->bf_desc;
586 - struct ath_softc *sc = bf->bf_node->ni_ic->ic_dev->priv;
587 + struct ath_softc *sc = netdev_priv(bf->bf_node->ni_ic->ic_dev);
588 u_int8_t status = done ? ts->ts_status : 0;
589
590 DPRINTF(sc, ATH_DEBUG_ANY,
591 @@ -10787,7 +10787,7 @@ ath_printtxbuf(const struct ath_buf *bf,
592 static struct net_device_stats *
593 ath_getstats(struct net_device *dev)
594 {
595 - struct ath_softc *sc = dev->priv;
596 + struct ath_softc *sc = netdev_priv(dev);
597 struct net_device_stats *stats = &sc->sc_devstats;
598
599 /* update according to private statistics */
600 @@ -10810,7 +10810,7 @@ ath_getstats(struct net_device *dev)
601 static int
602 ath_set_mac_address(struct net_device *dev, void *addr)
603 {
604 - struct ath_softc *sc = dev->priv;
605 + struct ath_softc *sc = netdev_priv(dev);
606 struct ieee80211com *ic = &sc->sc_ic;
607 struct ath_hal *ah = sc->sc_ah;
608 struct sockaddr *mac = addr;
609 @@ -10839,7 +10839,7 @@ ath_set_mac_address(struct net_device *d
610 static int
611 ath_change_mtu(struct net_device *dev, int mtu)
612 {
613 - struct ath_softc *sc = dev->priv;
614 + struct ath_softc *sc = netdev_priv(dev);
615 int error = 0;
616
617 if (!(ATH_MIN_MTU < mtu && mtu <= ATH_MAX_MTU)) {
618 @@ -10926,7 +10926,7 @@ bad:
619 static int
620 ath_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
621 {
622 - struct ath_softc *sc = dev->priv;
623 + struct ath_softc *sc = netdev_priv(dev);
624 struct ieee80211com *ic = &sc->sc_ic;
625 int error;
626
627 @@ -11807,7 +11807,7 @@ static void
628 ath_announce(struct net_device *dev)
629 {
630 #define HAL_MODE_DUALBAND (HAL_MODE_11A|HAL_MODE_11B)
631 - struct ath_softc *sc = dev->priv;
632 + struct ath_softc *sc = netdev_priv(dev);
633 struct ath_hal *ah = sc->sc_ah;
634 u_int modes, cc;
635 static const int MLEN = 1024;
636 @@ -11994,7 +11994,7 @@ static void
637 txcont_configure_radio(struct ieee80211com *ic)
638 {
639 struct net_device *dev = ic->ic_dev;
640 - struct ath_softc *sc = dev->priv;
641 + struct ath_softc *sc = netdev_priv(dev);
642 struct ath_hal *ah = sc->sc_ah;
643 struct ieee80211_wme_state *wme = &ic->ic_wme;
644 struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
645 @@ -12268,7 +12268,7 @@ static void
646 txcont_queue_packet(struct ieee80211com *ic, struct ath_txq* txq)
647 {
648 struct net_device *dev = ic->ic_dev;
649 - struct ath_softc *sc = dev->priv;
650 + struct ath_softc *sc = netdev_priv(dev);
651 struct ath_hal *ah = sc->sc_ah;
652 struct ath_buf *bf = NULL;
653 struct sk_buff *skb = NULL;
654 @@ -12401,7 +12401,7 @@ static void
655 txcont_on(struct ieee80211com *ic)
656 {
657 struct net_device *dev = ic->ic_dev;
658 - struct ath_softc *sc = dev->priv;
659 + struct ath_softc *sc = netdev_priv(dev);
660
661 if (IFF_RUNNING != (ic->ic_dev->flags & IFF_RUNNING)) {
662 EPRINTF(sc, "Cannot enable txcont when"
663 @@ -12422,7 +12422,7 @@ static void
664 txcont_off(struct ieee80211com *ic)
665 {
666 struct net_device *dev = ic->ic_dev;
667 - struct ath_softc *sc = dev->priv;
668 + struct ath_softc *sc = netdev_priv(dev);
669
670 if (TAILQ_FIRST(&ic->ic_vaps)->iv_opmode != IEEE80211_M_WDS)
671 sc->sc_beacons = 1;
672 @@ -12436,7 +12436,7 @@ static int
673 ath_get_dfs_testmode(struct ieee80211com *ic)
674 {
675 struct net_device *dev = ic->ic_dev;
676 - struct ath_softc *sc = dev->priv;
677 + struct ath_softc *sc = netdev_priv(dev);
678 return sc->sc_dfs_testmode;
679 }
680
681 @@ -12463,7 +12463,7 @@ static void
682 ath_set_dfs_testmode(struct ieee80211com *ic, int value)
683 {
684 struct net_device *dev = ic->ic_dev;
685 - struct ath_softc *sc = dev->priv;
686 + struct ath_softc *sc = netdev_priv(dev);
687 sc->sc_dfs_testmode = !!value;
688 }
689
690 @@ -12473,7 +12473,7 @@ static int
691 ath_get_txcont(struct ieee80211com *ic)
692 {
693 struct net_device *dev = ic->ic_dev;
694 - struct ath_softc *sc = dev->priv;
695 + struct ath_softc *sc = netdev_priv(dev);
696 return sc->sc_txcont;
697 }
698
699 @@ -12491,7 +12491,7 @@ static void
700 ath_set_txcont_power(struct ieee80211com *ic, unsigned int txpower)
701 {
702 struct net_device *dev = ic->ic_dev;
703 - struct ath_softc *sc = dev->priv;
704 + struct ath_softc *sc = netdev_priv(dev);
705 int new_txcont_power = txpower > IEEE80211_TXPOWER_MAX ?
706 IEEE80211_TXPOWER_MAX : txpower;
707 if (sc->sc_txcont_power != new_txcont_power) {
708 @@ -12509,7 +12509,7 @@ static int
709 ath_get_txcont_power(struct ieee80211com *ic)
710 {
711 struct net_device *dev = ic->ic_dev;
712 - struct ath_softc *sc = dev->priv;
713 + struct ath_softc *sc = netdev_priv(dev);
714 /* VERY conservative default */
715 return sc->sc_txcont_power ? sc->sc_txcont_power : 0;
716 }
717 @@ -12519,7 +12519,7 @@ ath_get_txcont_power(struct ieee80211com
718 ath_set_txcont_rate(struct ieee80211com *ic, unsigned int new_rate)
719 {
720 struct net_device *dev = ic->ic_dev;
721 - struct ath_softc *sc = dev->priv;
722 + struct ath_softc *sc = netdev_priv(dev);
723 if (sc->sc_txcont_rate != new_rate) {
724 /* NOTE: This value is sanity checked and dropped down to
725 * closest rate in txcont_on. */
726 @@ -12536,7 +12536,7 @@ ath_set_txcont_rate(struct ieee80211com
727 ath_get_txcont_rate(struct ieee80211com *ic)
728 {
729 struct net_device *dev = ic->ic_dev;
730 - struct ath_softc *sc = dev->priv;
731 + struct ath_softc *sc = netdev_priv(dev);
732 return sc->sc_txcont_rate ? sc->sc_txcont_rate : 0;
733 }
734
735 @@ -12546,7 +12546,7 @@ static void
736 ath_set_dfs_cac_time(struct ieee80211com *ic, unsigned int time_s)
737 {
738 struct net_device *dev = ic->ic_dev;
739 - struct ath_softc *sc = dev->priv;
740 + struct ath_softc *sc = netdev_priv(dev);
741 sc->sc_dfs_cac_period = time_s;
742 }
743
744 @@ -12556,7 +12556,7 @@ static unsigned int
745 ath_get_dfs_cac_time(struct ieee80211com *ic)
746 {
747 struct net_device *dev = ic->ic_dev;
748 - struct ath_softc *sc = dev->priv;
749 + struct ath_softc *sc = netdev_priv(dev);
750 return sc->sc_dfs_cac_period;
751 }
752
753 @@ -12576,7 +12576,7 @@ static void
754 ath_set_dfs_excl_period(struct ieee80211com *ic, unsigned int time_s)
755 {
756 struct net_device *dev = ic->ic_dev;
757 - struct ath_softc *sc = dev->priv;
758 + struct ath_softc *sc = netdev_priv(dev);
759 sc->sc_dfs_excl_period = time_s;
760 }
761
762 @@ -12585,7 +12585,7 @@ static unsigned int
763 ath_get_dfs_excl_period(struct ieee80211com *ic)
764 {
765 struct net_device *dev = ic->ic_dev;
766 - struct ath_softc *sc = dev->priv;
767 + struct ath_softc *sc = netdev_priv(dev);
768 return sc->sc_dfs_excl_period;
769 }
770
771 @@ -12597,7 +12597,7 @@ static unsigned int
772 ath_test_radar(struct ieee80211com *ic)
773 {
774 struct net_device *dev = ic->ic_dev;
775 - struct ath_softc *sc = dev->priv;
776 + struct ath_softc *sc = netdev_priv(dev);
777 if ((ic->ic_flags & IEEE80211_F_DOTH) && (sc->sc_curchan.privFlags & CHANNEL_DFS))
778 ath_radar_detected(sc, "ath_test_radar from user space");
779 else
780 @@ -12613,7 +12613,7 @@ static unsigned int
781 ath_dump_hal_map(struct ieee80211com *ic)
782 {
783 struct net_device *dev = ic->ic_dev;
784 - struct ath_softc *sc = dev->priv;
785 + struct ath_softc *sc = netdev_priv(dev);
786 ath_hal_dump_map(sc->sc_ah);
787 return 0;
788 }
789 @@ -12721,7 +12721,7 @@ ath_rcv_dev_event(struct notifier_block
790 void *ptr)
791 {
792 struct net_device *dev = (struct net_device *)ptr;
793 - struct ath_softc *sc = (struct ath_softc *)dev->priv;
794 + struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
795
796 if (!dev || !sc || dev->open != &ath_init)
797 return 0;
798 @@ -13456,7 +13456,7 @@ static unsigned int
799 ath_read_register(struct ieee80211com *ic, unsigned int address,
800 unsigned int* value)
801 {
802 - struct ath_softc *sc = ic->ic_dev->priv;
803 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
804 if (address >= MAX_REGISTER_ADDRESS) {
805 IPRINTF(sc, "Illegal Atheros register access "
806 "attempted: 0x%04x >= 0x%04x\n",
807 @@ -13486,7 +13486,7 @@ static unsigned int
808 ath_write_register(struct ieee80211com *ic, unsigned int address,
809 unsigned int value)
810 {
811 - struct ath_softc *sc = ic->ic_dev->priv;
812 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
813 if (address >= MAX_REGISTER_ADDRESS) {
814 IPRINTF(sc, "Illegal Atheros register access "
815 "attempted: 0x%04x >= 0x%04x\n",
816 @@ -13514,7 +13514,7 @@ static void
817 ath_registers_dump(struct ieee80211com *ic)
818 {
819 struct net_device *dev = ic->ic_dev;
820 - struct ath_softc *sc = dev->priv;
821 + struct ath_softc *sc = netdev_priv(dev);
822 ath_ar5212_registers_dump(sc);
823 }
824 #endif /* #ifdef ATH_REVERSE_ENGINEERING */
825 @@ -13526,7 +13526,7 @@ static void
826 ath_registers_mark(struct ieee80211com *ic)
827 {
828 struct net_device *dev = ic->ic_dev;
829 - struct ath_softc *sc = dev->priv;
830 + struct ath_softc *sc = netdev_priv(dev);
831 ath_ar5212_registers_mark(sc);
832 }
833 #endif /* #ifdef ATH_REVERSE_ENGINEERING */
834 @@ -13538,7 +13538,7 @@ static void
835 ath_registers_dump_delta(struct ieee80211com *ic)
836 {
837 struct net_device *dev = ic->ic_dev;
838 - struct ath_softc *sc = dev->priv;
839 + struct ath_softc *sc = netdev_priv(dev);
840 ath_ar5212_registers_dump_delta(sc);
841 }
842 #endif /* #ifdef ATH_REVERSE_ENGINEERING */
843 --- a/ath/if_ath_pci.c
844 +++ b/ath/if_ath_pci.c
845 @@ -226,7 +226,7 @@ ath_pci_probe(struct pci_dev *pdev, cons
846 printk(KERN_ERR "%s: no memory for device state\n", dev_info);
847 goto bad2;
848 }
849 - sc = dev->priv;
850 + sc = netdev_priv(dev);
851 sc->aps_sc.sc_dev = dev;
852 sc->aps_sc.sc_iobase = mem;
853
854 @@ -309,7 +309,7 @@ static void
855 ath_pci_remove(struct pci_dev *pdev)
856 {
857 struct net_device *dev = pci_get_drvdata(pdev);
858 - struct ath_pci_softc *sc = dev->priv;
859 + struct ath_pci_softc *sc = netdev_priv(dev);
860
861 ath_detach(dev);
862 if (dev->irq)
863 @@ -327,7 +327,7 @@ ath_pci_suspend(struct pci_dev *pdev, pm
864 struct net_device *dev = pci_get_drvdata(pdev);
865
866 ath_suspend(dev);
867 - PCI_SAVE_STATE(pdev, ((struct ath_pci_softc *)dev->priv)->aps_pmstate);
868 + PCI_SAVE_STATE(pdev, ((struct ath_pci_softc *)netdev_priv(dev))->aps_pmstate);
869 pci_disable_device(pdev);
870 return pci_set_power_state(pdev, PCI_D3hot);
871 }
872 @@ -344,7 +344,7 @@ ath_pci_resume(struct pci_dev *pdev)
873 return err;
874
875 /* XXX - Should this return nonzero on fail? */
876 - PCI_RESTORE_STATE(pdev, ((struct ath_pci_softc *)dev->priv)->aps_pmstate);
877 + PCI_RESTORE_STATE(pdev, ((struct ath_pci_softc *)netdev_priv(dev))->aps_pmstate);
878
879 err = pci_enable_device(pdev);
880 if (err)
881 --- a/ath/if_ath_radar.c
882 +++ b/ath/if_ath_radar.c
883 @@ -1533,7 +1533,7 @@ static void ath_rp_clear(struct ath_soft
884 static void ath_rp_tasklet(TQUEUE_ARG data)
885 {
886 struct net_device *dev = (struct net_device *) data;
887 - struct ath_softc *sc = dev->priv;
888 + struct ath_softc *sc = netdev_priv(dev);
889
890 if (sc->sc_rp_analyse != NULL)
891 sc->sc_rp_analyse(sc);
892 --- a/ath_rate/amrr/amrr.c
893 +++ b/ath_rate/amrr/amrr.c
894 @@ -298,7 +298,7 @@ ath_rate_ctl_start(struct ath_softc *sc,
895 static void
896 ath_rate_cb(void *arg, struct ieee80211_node *ni)
897 {
898 - ath_rate_update(ni->ni_ic->ic_dev->priv, ni, (long) arg);
899 + ath_rate_update(netdev_priv(ni->ni_ic->ic_dev), ni, (long) arg);
900 }
901
902 /*
903 @@ -308,7 +308,7 @@ static void
904 ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
905 {
906 struct ieee80211com *ic = vap->iv_ic;
907 - struct ath_softc *sc = ic->ic_dev->priv;
908 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
909 struct amrr_softc *asc = (struct amrr_softc *) sc->sc_rc;
910 struct ieee80211_node *ni;
911
912 @@ -420,7 +420,7 @@ static void
913 ath_ratectl(unsigned long data)
914 {
915 struct net_device *dev = (struct net_device *)data;
916 - struct ath_softc *sc = dev->priv;
917 + struct ath_softc *sc = netdev_priv(dev);
918 struct amrr_softc *asc = (struct amrr_softc *)sc->sc_rc;
919 struct ieee80211com *ic = &sc->sc_ic;
920 int interval;
921 --- a/ath_rate/minstrel/minstrel.c
922 +++ b/ath_rate/minstrel/minstrel.c
923 @@ -622,7 +622,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
924 static void
925 ath_rate_cb(void *arg, struct ieee80211_node *ni)
926 {
927 - ath_rate_ctl_reset(ni->ni_ic->ic_dev->priv, ni);
928 + ath_rate_ctl_reset(netdev_priv(ni->ni_ic->ic_dev), ni);
929 }
930
931 /* Reset the rate control state for each 802.11 state transition. */
932 @@ -636,7 +636,7 @@ ath_rate_newstate(struct ieee80211vap *v
933 /* Sync rates for associated stations and neighbors. */
934 ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, NULL);
935 }
936 - ath_rate_newassoc(ic->ic_dev->priv, ATH_NODE(vap->iv_bss), 1);
937 + ath_rate_newassoc(netdev_priv(ic->ic_dev), ATH_NODE(vap->iv_bss), 1);
938 }
939 }
940
941 @@ -822,7 +822,7 @@ ath_proc_read_nodes(struct ieee80211vap
942 unsigned int x = 0;
943 unsigned int this_tp, this_prob, this_eprob;
944 #ifdef AR_DEBUG
945 - struct ath_softc *sc = vap->iv_ic->ic_dev->priv;;
946 + struct ath_softc *sc = netdev_priv(vap->iv_ic->ic_dev);
947 #endif
948
949 IEEE80211_NODE_TABLE_LOCK_IRQ(nt);
950 --- a/ath_rate/onoe/onoe.c
951 +++ b/ath_rate/onoe/onoe.c
952 @@ -281,7 +281,7 @@ ath_rate_ctl_start(struct ath_softc *sc,
953 static void
954 ath_rate_cb(void *arg, struct ieee80211_node *ni)
955 {
956 - ath_rate_update(ni->ni_ic->ic_dev->priv, ni, (long) arg);
957 + ath_rate_update(netdev_priv(ni->ni_ic->ic_dev), ni, (long) arg);
958 }
959
960 /*
961 @@ -291,7 +291,7 @@ static void
962 ath_rate_newstate(struct ieee80211vap *vap, enum ieee80211_state state)
963 {
964 struct ieee80211com *ic = vap->iv_ic;
965 - struct ath_softc *sc = ic->ic_dev->priv;
966 + struct ath_softc *sc = netdev_priv(ic->ic_dev);
967 struct ieee80211_node *ni;
968
969 if (state == IEEE80211_S_INIT)
970 --- a/ath_rate/sample/sample.c
971 +++ b/ath_rate/sample/sample.c
972 @@ -803,7 +803,7 @@ ath_rate_ctl_reset(struct ath_softc *sc,
973 static void
974 ath_rate_cb(void *arg, struct ieee80211_node *ni)
975 {
976 - ath_rate_ctl_reset(ni->ni_ic->ic_dev->priv, ni);
977 + ath_rate_ctl_reset(netdev_priv(ni->ni_ic->ic_dev), ni);
978 }
979
980 /*
981 @@ -821,7 +821,7 @@ ath_rate_newstate(struct ieee80211vap *v
982 */
983 ieee80211_iterate_nodes(&ic->ic_sta, ath_rate_cb, NULL);
984 }
985 - ath_rate_newassoc(ic->ic_dev->priv, ATH_NODE(vap->iv_bss), 1);
986 + ath_rate_newassoc(netdev_priv(ic->ic_dev), ATH_NODE(vap->iv_bss), 1);
987 }
988 }
989
990 --- a/include/compat.h
991 +++ b/include/compat.h
992 @@ -162,6 +162,10 @@ static inline int timeval_compare(struct
993 #define IRQF_SHARED SA_SHIRQ
994 #endif
995
996 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,27)
997 +#define netdev_priv(_netdev) ((_netdev)->priv)
998 +#endif
999 +
1000 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
1001 #define skb_end_pointer(_skb) ((_skb)->end)
1002 #define skb_tail_pointer(_skb) ((_skb)->tail)
1003 --- a/net80211/ieee80211.c
1004 +++ b/net80211/ieee80211.c
1005 @@ -457,7 +457,7 @@ ieee80211_vap_setup(struct ieee80211com
1006 #define IEEE80211_C_OPMODE \
1007 (IEEE80211_C_IBSS | IEEE80211_C_HOSTAP | IEEE80211_C_AHDEMO | \
1008 IEEE80211_C_MONITOR)
1009 - struct ieee80211vap *vap = dev->priv;
1010 + struct ieee80211vap *vap = netdev_priv(dev);
1011 struct net_device *parent = ic->ic_dev;
1012 int err;
1013
1014 @@ -1354,7 +1354,7 @@ media_status(enum ieee80211_opmode opmod
1015 static void
1016 ieee80211com_media_status(struct net_device *dev, struct ifmediareq *imr)
1017 {
1018 - struct ieee80211com *ic = dev->priv; /* XXX */
1019 + struct ieee80211com *ic = netdev_priv(dev); /* XXX */
1020
1021 imr->ifm_status = IFM_AVALID;
1022 if (!TAILQ_EMPTY(&ic->ic_vaps))
1023 @@ -1406,7 +1406,7 @@ media2mode(const struct ifmedia_entry *i
1024 static int
1025 ieee80211com_media_change(struct net_device *dev)
1026 {
1027 - struct ieee80211com *ic = dev->priv; /* XXX */
1028 + struct ieee80211com *ic = netdev_priv(dev); /* XXX */
1029 struct ieee80211vap *vap;
1030 struct ifmedia_entry *ime = ic->ic_media.ifm_cur;
1031 enum ieee80211_phymode newphymode;
1032 @@ -1510,7 +1510,7 @@ checkrate(struct ieee80211com *ic, enum
1033 int
1034 ieee80211_media_change(struct net_device *dev)
1035 {
1036 - struct ieee80211vap *vap = dev->priv;
1037 + struct ieee80211vap *vap = netdev_priv(dev);
1038 struct ieee80211com *ic = vap->iv_ic;
1039 struct ifmedia_entry *ime = vap->iv_media.ifm_cur;
1040 enum ieee80211_phymode newmode;
1041 @@ -1544,7 +1544,7 @@ EXPORT_SYMBOL(ieee80211_media_change);
1042 void
1043 ieee80211_media_status(struct net_device *dev, struct ifmediareq *imr)
1044 {
1045 - struct ieee80211vap *vap = dev->priv;
1046 + struct ieee80211vap *vap = netdev_priv(dev);
1047 struct ieee80211com *ic = vap->iv_ic;
1048 enum ieee80211_phymode mode;
1049 struct ieee80211_rateset *rs;
1050 @@ -1750,7 +1750,7 @@ EXPORT_SYMBOL(ieee80211_media2rate);
1051 static struct net_device_stats *
1052 ieee80211_getstats(struct net_device *dev)
1053 {
1054 - struct ieee80211vap *vap = dev->priv;
1055 + struct ieee80211vap *vap = netdev_priv(dev);
1056 struct net_device_stats *stats = &vap->iv_devstats;
1057
1058 /* XXX: Total guess as to what to count where */
1059 @@ -1789,7 +1789,7 @@ ieee80211_change_mtu(struct net_device *
1060 static void
1061 ieee80211_set_multicast_list(struct net_device *dev)
1062 {
1063 - struct ieee80211vap *vap = dev->priv;
1064 + struct ieee80211vap *vap = netdev_priv(dev);
1065 struct ieee80211com *ic = vap->iv_ic;
1066 struct net_device *parent = ic->ic_dev;
1067
1068 --- a/net80211/ieee80211_linux.c
1069 +++ b/net80211/ieee80211_linux.c
1070 @@ -183,7 +183,7 @@ EXPORT_SYMBOL(ieee80211_getmgtframe);
1071 static void
1072 ieee80211_vlan_register(struct net_device *dev, struct vlan_group *grp)
1073 {
1074 - struct ieee80211vap *vap = dev->priv;
1075 + struct ieee80211vap *vap = netdev_priv(dev);
1076
1077 vap->iv_vlgrp = grp;
1078 }
1079 @@ -194,7 +194,7 @@ ieee80211_vlan_register(struct net_devic
1080 static void
1081 ieee80211_vlan_add_vid(struct net_device *dev, unsigned short vid)
1082 {
1083 - struct ieee80211vap *vap = dev->priv;
1084 + struct ieee80211vap *vap = netdev_priv(dev);
1085
1086 if (vap->iv_vlgrp != NULL)
1087 vap->iv_bss->ni_vlan = vid;
1088 @@ -206,7 +206,7 @@ ieee80211_vlan_add_vid(struct net_device
1089 static void
1090 ieee80211_vlan_kill_vid(struct net_device *dev, unsigned short vid)
1091 {
1092 - struct ieee80211vap *vap = dev->priv;
1093 + struct ieee80211vap *vap = netdev_priv(dev);
1094
1095 if (vap->iv_vlgrp != NULL)
1096 vlan_group_set_device(vap->iv_vlgrp, vid, NULL);
1097 @@ -989,8 +989,8 @@ ieee80211_rcv_dev_event(struct notifier_
1098
1099 switch (event) {
1100 case NETDEV_CHANGENAME:
1101 - ieee80211_virtfs_vdetach(dev->priv);
1102 - ieee80211_virtfs_latevattach(dev->priv);
1103 + ieee80211_virtfs_vdetach(netdev_priv(dev));
1104 + ieee80211_virtfs_latevattach(netdev_priv(dev));
1105 return NOTIFY_DONE;
1106 default:
1107 break;
1108 --- a/net80211/ieee80211_output.c
1109 +++ b/net80211/ieee80211_output.c
1110 @@ -201,7 +201,7 @@ ieee80211_classify(struct ieee80211_node
1111 int
1112 ieee80211_hardstart(struct sk_buff *skb, struct net_device *dev)
1113 {
1114 - struct ieee80211vap *vap = dev->priv;
1115 + struct ieee80211vap *vap = netdev_priv(dev);
1116 struct ieee80211com *ic = vap->iv_ic;
1117 struct net_device *parent = ic->ic_dev;
1118 struct ieee80211_node *ni = NULL;
1119 @@ -317,7 +317,7 @@ bad:
1120 */
1121
1122 void ieee80211_parent_queue_xmit(struct sk_buff *skb) {
1123 - struct ieee80211vap *vap = skb->dev->priv;
1124 + struct ieee80211vap *vap = netdev_priv(skb->dev);
1125
1126 vap->iv_devstats.tx_packets++;
1127 vap->iv_devstats.tx_bytes += skb->len;
1128 --- a/net80211/ieee80211_proto.c
1129 +++ b/net80211/ieee80211_proto.c
1130 @@ -970,7 +970,7 @@ ieee80211_init(struct net_device *dev, i
1131 {
1132 #define IS_RUNNING(_dev) \
1133 ((_dev->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
1134 - struct ieee80211vap *vap = dev->priv;
1135 + struct ieee80211vap *vap = netdev_priv(dev);
1136 struct ieee80211com *ic = vap->iv_ic;
1137 struct net_device *parent = ic->ic_dev;
1138
1139 @@ -1081,7 +1081,7 @@ ieee80211_init(struct net_device *dev, i
1140 int
1141 ieee80211_open(struct net_device *dev)
1142 {
1143 - struct ieee80211vap *vap = dev->priv;
1144 + struct ieee80211vap *vap = netdev_priv(dev);
1145
1146 return ieee80211_init(dev, 0);
1147 }
1148 @@ -1125,7 +1125,7 @@ EXPORT_SYMBOL(ieee80211_start_running);
1149 int
1150 ieee80211_stop(struct net_device *dev)
1151 {
1152 - struct ieee80211vap *vap = dev->priv;
1153 + struct ieee80211vap *vap = netdev_priv(dev);
1154 struct ieee80211com *ic = vap->iv_ic;
1155 struct net_device *parent = ic->ic_dev;
1156 struct ieee80211_node *tni, *ni;
1157 --- a/net80211/ieee80211_wireless.c
1158 +++ b/net80211/ieee80211_wireless.c
1159 @@ -87,7 +87,7 @@ pre_announced_chanswitch(struct net_devi
1160 static int
1161 preempt_scan(struct net_device *dev, int max_grace, int max_wait)
1162 {
1163 - struct ieee80211vap *vap = dev->priv;
1164 + struct ieee80211vap *vap = netdev_priv(dev);
1165 struct ieee80211com *ic = vap->iv_ic;
1166 int total_delay = 0;
1167 int canceled = 0, ready = 0;
1168 @@ -122,7 +122,7 @@ preempt_scan(struct net_device *dev, int
1169 static struct iw_statistics *
1170 ieee80211_iw_getstats(struct net_device *dev)
1171 {
1172 - struct ieee80211vap *vap = dev->priv;
1173 + struct ieee80211vap *vap = netdev_priv(dev);
1174 struct iw_statistics *is = &vap->iv_iwstats;
1175 struct ieee80211com *ic = vap->iv_ic;
1176
1177 @@ -146,7 +146,7 @@ static int
1178 ieee80211_ioctl_giwname(struct net_device *dev, struct iw_request_info *info,
1179 char *name, char *extra)
1180 {
1181 - struct ieee80211vap *vap = dev->priv;
1182 + struct ieee80211vap *vap = netdev_priv(dev);
1183 struct ieee80211_channel *c = vap->iv_ic->ic_curchan;
1184
1185 if (IEEE80211_IS_CHAN_108G(c))
1186 @@ -198,7 +198,7 @@ static int
1187 ieee80211_ioctl_siwencode(struct net_device *dev,
1188 struct iw_request_info *info, struct iw_point *erq, char *keybuf)
1189 {
1190 - struct ieee80211vap *vap = dev->priv;
1191 + struct ieee80211vap *vap = netdev_priv(dev);
1192 int error;
1193 int wepchange = 0;
1194 ieee80211_keyix_t kix;
1195 @@ -306,7 +306,7 @@ static int
1196 ieee80211_ioctl_giwencode(struct net_device *dev, struct iw_request_info *info,
1197 struct iw_point *erq, char *key)
1198 {
1199 - struct ieee80211vap *vap = dev->priv;
1200 + struct ieee80211vap *vap = netdev_priv(dev);
1201 struct ieee80211_key *k;
1202 int error;
1203 ieee80211_keyix_t kix;
1204 @@ -351,7 +351,7 @@ ieee80211_ioctl_siwrate(struct net_devic
1205 IFM_IEEE80211_11A | IFM_IEEE80211_TURBO,
1206 IFM_IEEE80211_11G | IFM_IEEE80211_TURBO,
1207 };
1208 - struct ieee80211vap *vap = dev->priv;
1209 + struct ieee80211vap *vap = netdev_priv(dev);
1210 struct ieee80211com *ic = vap->iv_ic;
1211 struct ifreq ifr;
1212 int rate, retv;
1213 @@ -386,7 +386,7 @@ static int
1214 ieee80211_ioctl_giwrate(struct net_device *dev, struct iw_request_info *info,
1215 struct iw_param *rrq, char *extra)
1216 {
1217 - struct ieee80211vap *vap = dev->priv;
1218 + struct ieee80211vap *vap = netdev_priv(dev);
1219 struct ifmediareq imr;
1220 int rate;
1221
1222 @@ -424,7 +424,7 @@ static int
1223 ieee80211_ioctl_siwrts(struct net_device *dev, struct iw_request_info *info,
1224 struct iw_param *rts, char *extra)
1225 {
1226 - struct ieee80211vap *vap = dev->priv;
1227 + struct ieee80211vap *vap = netdev_priv(dev);
1228 struct ieee80211com *ic = vap->iv_ic;
1229 u16 val;
1230
1231 @@ -447,7 +447,7 @@ static int
1232 ieee80211_ioctl_giwrts(struct net_device *dev, struct iw_request_info *info,
1233 struct iw_param *rts, char *extra)
1234 {
1235 - struct ieee80211vap *vap = dev->priv;
1236 + struct ieee80211vap *vap = netdev_priv(dev);
1237
1238 rts->value = vap->iv_rtsthreshold;
1239 rts->disabled = (rts->value == IEEE80211_RTS_MAX);
1240 @@ -460,7 +460,7 @@ static int
1241 ieee80211_ioctl_siwfrag(struct net_device *dev, struct iw_request_info *info,
1242 struct iw_param *rts, char *extra)
1243 {
1244 - struct ieee80211vap *vap = dev->priv;
1245 + struct ieee80211vap *vap = netdev_priv(dev);
1246 struct ieee80211com *ic = vap->iv_ic;
1247 u16 val;
1248
1249 @@ -483,7 +483,7 @@ static int
1250 ieee80211_ioctl_giwfrag(struct net_device *dev, struct iw_request_info *info,
1251 struct iw_param *rts, char *extra)
1252 {
1253 - struct ieee80211vap *vap = dev->priv;
1254 + struct ieee80211vap *vap = netdev_priv(dev);
1255
1256 rts->value = vap->iv_fragthreshold;
1257 rts->disabled = (rts->value == 2346);
1258 @@ -496,7 +496,7 @@ static int
1259 ieee80211_ioctl_siwap(struct net_device *dev, struct iw_request_info *info,
1260 struct sockaddr *ap_addr, char *extra)
1261 {
1262 - struct ieee80211vap *vap = dev->priv;
1263 + struct ieee80211vap *vap = netdev_priv(dev);
1264
1265 /* NB: should not be set when in AP mode */
1266 if (vap->iv_opmode == IEEE80211_M_HOSTAP)
1267 @@ -532,7 +532,7 @@ static int
1268 ieee80211_ioctl_giwap(struct net_device *dev, struct iw_request_info *info,
1269 struct sockaddr *ap_addr, char *extra)
1270 {
1271 - struct ieee80211vap *vap = dev->priv;
1272 + struct ieee80211vap *vap = netdev_priv(dev);
1273
1274 if (vap->iv_flags & IEEE80211_F_DESBSSID)
1275 IEEE80211_ADDR_COPY(&ap_addr->sa_data, vap->iv_des_bssid);
1276 @@ -553,7 +553,7 @@ static int
1277 ieee80211_ioctl_siwnickn(struct net_device *dev, struct iw_request_info *info,
1278 struct iw_point *data, char *nickname)
1279 {
1280 - struct ieee80211vap *vap = dev->priv;
1281 + struct ieee80211vap *vap = netdev_priv(dev);
1282
1283 if (data->length > IEEE80211_NWID_LEN)
1284 return -E2BIG;
1285 @@ -569,7 +569,7 @@ static int
1286 ieee80211_ioctl_giwnickn(struct net_device *dev, struct iw_request_info *info,
1287 struct iw_point *data, char *nickname)
1288 {
1289 - struct ieee80211vap *vap = dev->priv;
1290 + struct ieee80211vap *vap = netdev_priv(dev);
1291
1292 if (data->length > vap->iv_nicknamelen + 1)
1293 data->length = vap->iv_nicknamelen + 1;
1294 @@ -678,7 +678,7 @@ static int
1295 ieee80211_ioctl_siwfreq(struct net_device *dev, struct iw_request_info *info,
1296 struct iw_freq *freq, char *extra)
1297 {
1298 - struct ieee80211vap *vap = dev->priv;
1299 + struct ieee80211vap *vap = netdev_priv(dev);
1300 struct ieee80211com *ic = vap->iv_ic;
1301 struct ieee80211_channel *c, *c2;
1302 int i;
1303 @@ -767,7 +767,7 @@ static int
1304 ieee80211_ioctl_giwfreq(struct net_device *dev, struct iw_request_info *info,
1305 struct iw_freq *freq, char *extra)
1306 {
1307 - struct ieee80211vap *vap = dev->priv;
1308 + struct ieee80211vap *vap = netdev_priv(dev);
1309 struct ieee80211com *ic = vap->iv_ic;
1310
1311 if (vap->iv_state == IEEE80211_S_RUN &&
1312 @@ -808,7 +808,7 @@ static int
1313 ieee80211_ioctl_siwessid(struct net_device *dev, struct iw_request_info *info,
1314 struct iw_point *data, char *ssid)
1315 {
1316 - struct ieee80211vap *vap = dev->priv;
1317 + struct ieee80211vap *vap = netdev_priv(dev);
1318
1319 if (vap->iv_opmode == IEEE80211_M_WDS)
1320 return -EOPNOTSUPP;
1321 @@ -853,7 +853,7 @@ static int
1322 ieee80211_ioctl_giwessid(struct net_device *dev, struct iw_request_info *info,
1323 struct iw_point *data, char *essid)
1324 {
1325 - struct ieee80211vap *vap = dev->priv;
1326 + struct ieee80211vap *vap = netdev_priv(dev);
1327
1328 if (vap->iv_opmode == IEEE80211_M_WDS)
1329 return -EOPNOTSUPP;
1330 @@ -884,7 +884,7 @@ static int
1331 ieee80211_ioctl_giwrange(struct net_device *dev, struct iw_request_info *info,
1332 struct iw_point *data, char *extra)
1333 {
1334 - struct ieee80211vap *vap = dev->priv;
1335 + struct ieee80211vap *vap = netdev_priv(dev);
1336 struct ieee80211com *ic = vap->iv_ic;
1337 struct ieee80211_node *ni = vap->iv_bss;
1338 struct iw_range *range = (struct iw_range *) extra;
1339 @@ -1034,7 +1034,7 @@ ieee80211_ioctl_setspy(struct net_device
1340 struct iw_point *data, char *extra)
1341 {
1342 /* save the list of node addresses */
1343 - struct ieee80211vap *vap = dev->priv;
1344 + struct ieee80211vap *vap = netdev_priv(dev);
1345 struct sockaddr address[IW_MAX_SPY];
1346 unsigned int number = data->length;
1347 int i;
1348 @@ -1072,7 +1072,7 @@ ieee80211_ioctl_getspy(struct net_device
1349 * locate nodes by mac (ieee80211_find_node()),
1350 * copy out rssi, set updated flag appropriately
1351 */
1352 - struct ieee80211vap *vap = dev->priv;
1353 + struct ieee80211vap *vap = netdev_priv(dev);
1354 struct ieee80211_node_table *nt = &vap->iv_ic->ic_sta;
1355 struct ieee80211_node *ni;
1356 struct ieee80211com *ic = vap->iv_ic;
1357 @@ -1120,7 +1120,7 @@ static int
1358 ieee80211_ioctl_setthrspy(struct net_device *dev, struct iw_request_info *info,
1359 struct iw_point *data, char *extra)
1360 {
1361 - struct ieee80211vap *vap = dev->priv;
1362 + struct ieee80211vap *vap = netdev_priv(dev);
1363 struct iw_thrspy threshold;
1364
1365 if (data->length != 1)
1366 @@ -1157,7 +1157,7 @@ static int
1367 ieee80211_ioctl_getthrspy(struct net_device *dev, struct iw_request_info *info,
1368 struct iw_point *data, char *extra)
1369 {
1370 - struct ieee80211vap *vap = dev->priv;
1371 + struct ieee80211vap *vap = netdev_priv(dev);
1372 struct ieee80211com *ic = vap->iv_ic;
1373 struct iw_thrspy *threshold;
1374
1375 @@ -1178,7 +1178,7 @@ static int
1376 ieee80211_ioctl_siwmode(struct net_device *dev, struct iw_request_info *info,
1377 __u32 *mode, char *extra)
1378 {
1379 - struct ieee80211vap *vap = dev->priv;
1380 + struct ieee80211vap *vap = netdev_priv(dev);
1381 struct ifmediareq imr;
1382 int valid = 0;
1383
1384 @@ -1203,7 +1203,7 @@ static int
1385 ieee80211_ioctl_giwmode(struct net_device *dev, struct iw_request_info *info,
1386 __u32 *mode, char *extra)
1387 {
1388 - struct ieee80211vap *vap = dev->priv;
1389 + struct ieee80211vap *vap = netdev_priv(dev);
1390 struct ifmediareq imr;
1391
1392 memset(&imr, 0, sizeof(imr));
1393 @@ -1226,7 +1226,7 @@ static int
1394 ieee80211_ioctl_siwpower(struct net_device *dev, struct iw_request_info *info,
1395 struct iw_param *wrq, char *extra)
1396 {
1397 - struct ieee80211vap *vap = dev->priv;
1398 + struct ieee80211vap *vap = netdev_priv(dev);
1399 struct ieee80211com *ic = vap->iv_ic;
1400
1401 /* XXX: These values, flags, and caps do not seem to be used elsewhere
1402 @@ -1265,7 +1265,7 @@ static int
1403 ieee80211_ioctl_giwpower(struct net_device *dev, struct iw_request_info *info,
1404 struct iw_param *rrq, char *extra)
1405 {
1406 - struct ieee80211vap *vap = dev->priv;
1407 + struct ieee80211vap *vap = netdev_priv(dev);
1408 struct ieee80211com *ic = vap->iv_ic;
1409
1410 rrq->disabled = (ic->ic_flags & IEEE80211_F_PMGTON) == 0;
1411 @@ -1289,7 +1289,7 @@ static int
1412 ieee80211_ioctl_siwretry(struct net_device *dev, struct iw_request_info *info,
1413 struct iw_param *rrq, char *extra)
1414 {
1415 - struct ieee80211vap *vap = dev->priv;
1416 + struct ieee80211vap *vap = netdev_priv(dev);
1417 struct ieee80211com *ic = vap->iv_ic;
1418
1419 if (rrq->disabled) {
1420 @@ -1321,7 +1321,7 @@ static int
1421 ieee80211_ioctl_giwretry(struct net_device *dev, struct iw_request_info *info,
1422 struct iw_param *rrq, char *extra)
1423 {
1424 - struct ieee80211vap *vap = dev->priv;
1425 + struct ieee80211vap *vap = netdev_priv(dev);
1426
1427 rrq->disabled = (vap->iv_flags & IEEE80211_F_SWRETRY) == 0;
1428 if (!rrq->disabled) {
1429 @@ -1352,7 +1352,7 @@ static int
1430 ieee80211_ioctl_siwtxpow(struct net_device *dev, struct iw_request_info *info,
1431 struct iw_param *rrq, char *extra)
1432 {
1433 - struct ieee80211vap *vap = dev->priv;
1434 + struct ieee80211vap *vap = netdev_priv(dev);
1435 struct ieee80211com *ic = vap->iv_ic;
1436 int fixed, disabled;
1437
1438 @@ -1389,7 +1389,7 @@ ieee80211_get_txcont(struct net_device *
1439 struct iw_request_info *info, void *w, char *extra)
1440 {
1441 int *params = (int*) extra;
1442 - struct ieee80211vap *vap = dev->priv;
1443 + struct ieee80211vap *vap = netdev_priv(dev);
1444 struct ieee80211com *ic = vap->iv_ic;
1445 params[0] = ic->ic_get_txcont(ic);
1446 return 0;
1447 @@ -1400,7 +1400,7 @@ ieee80211_get_dfs_cac_time(struct net_de
1448 struct iw_request_info *info, void *w, char *extra)
1449 {
1450 int *params = (int*) extra;
1451 - struct ieee80211vap *vap = dev->priv;
1452 + struct ieee80211vap *vap = netdev_priv(dev);
1453 struct ieee80211com *ic = vap->iv_ic;
1454 params[0] = ic->ic_get_dfs_cac_time(ic);
1455 return 0;
1456 @@ -1411,7 +1411,7 @@ ieee80211_get_dfs_excl_period(struct net
1457 struct iw_request_info *info, void *w, char *extra)
1458 {
1459 int *params = (int*) extra;
1460 - struct ieee80211vap *vap = dev->priv;
1461 + struct ieee80211vap *vap = netdev_priv(dev);
1462 struct ieee80211com *ic = vap->iv_ic;
1463 params[0] = ic->ic_get_dfs_excl_period(ic);
1464 return 0;
1465 @@ -1421,7 +1421,7 @@ ieee80211_set_dfs_cac_time(struct net_de
1466 struct iw_request_info *info, void *w, char *extra)
1467 {
1468 int *params = (int*) extra;
1469 - struct ieee80211vap *vap = dev->priv;
1470 + struct ieee80211vap *vap = netdev_priv(dev);
1471 struct ieee80211com *ic = vap->iv_ic;
1472 ic->ic_set_dfs_cac_time(ic, params[1]);
1473 return 0;
1474 @@ -1431,7 +1431,7 @@ ieee80211_set_dfs_excl_period (struct n
1475 struct iw_request_info *info, void *w, char *extra)
1476 {
1477 int *params = (int*) extra;
1478 - struct ieee80211vap *vap = dev->priv;
1479 + struct ieee80211vap *vap = netdev_priv(dev);
1480 struct ieee80211com *ic = vap->iv_ic;
1481 ic->ic_set_dfs_excl_period(ic, params[1]);
1482 return 0;
1483 @@ -1442,7 +1442,7 @@ ieee80211_get_dfs_testmode(struct net_de
1484 struct iw_request_info *info, void *w, char *extra)
1485 {
1486 int *params = (int*) extra;
1487 - struct ieee80211vap *vap = dev->priv;
1488 + struct ieee80211vap *vap = netdev_priv(dev);
1489 struct ieee80211com *ic = vap->iv_ic;
1490 params[0] = ic->ic_get_dfs_testmode(ic);
1491 return 0;
1492 @@ -1453,7 +1453,7 @@ ieee80211_get_txcont_rate(struct net_dev
1493 struct iw_request_info *info, void *w, char *extra)
1494 {
1495 int *params = (int*) extra;
1496 - struct ieee80211vap *vap = dev->priv;
1497 + struct ieee80211vap *vap = netdev_priv(dev);
1498 struct ieee80211com *ic = vap->iv_ic;
1499 params[0] = ic->ic_get_txcont_rate(ic);
1500 return 0;
1501 @@ -1464,7 +1464,7 @@ ieee80211_set_txcont(struct net_device *
1502 void *w, char *extra)
1503 {
1504 int *params = (int*) extra;
1505 - struct ieee80211vap *vap = dev->priv;
1506 + struct ieee80211vap *vap = netdev_priv(dev);
1507 struct ieee80211com *ic = vap->iv_ic;
1508 ic->ic_set_txcont(ic, params[1]);
1509 return 0;
1510 @@ -1475,7 +1475,7 @@ ieee80211_set_dfs_testmode(struct net_de
1511 struct iw_request_info *info, void *w, char *extra)
1512 {
1513 int *params = (int*) extra;
1514 - struct ieee80211vap *vap = dev->priv;
1515 + struct ieee80211vap *vap = netdev_priv(dev);
1516 struct ieee80211com *ic = vap->iv_ic;
1517 ic->ic_set_dfs_testmode(ic, params[1]);
1518 return 0;
1519 @@ -1486,7 +1486,7 @@ ieee80211_set_txcont_rate(struct net_dev
1520 struct iw_request_info *info, void *w, char *extra)
1521 {
1522 int *params = (int*) extra;
1523 - struct ieee80211vap *vap = dev->priv;
1524 + struct ieee80211vap *vap = netdev_priv(dev);
1525 struct ieee80211com *ic = vap->iv_ic;
1526 ic->ic_set_txcont_rate(ic, params[1]);
1527 return 0;
1528 @@ -1497,7 +1497,7 @@ ieee80211_set_txcont_power(struct net_de
1529 struct iw_request_info *info, void *w, char *extra)
1530 {
1531 int *params = (int*) extra;
1532 - struct ieee80211vap *vap = dev->priv;
1533 + struct ieee80211vap *vap = netdev_priv(dev);
1534 struct ieee80211com *ic = vap->iv_ic;
1535 ic->ic_set_txcont_power(ic, params[1]);
1536 return 0;
1537 @@ -1508,7 +1508,7 @@ ieee80211_get_txcont_power(struct net_de
1538 struct iw_request_info *info, void *w, char *extra)
1539 {
1540 int *params = (int*) extra;
1541 - struct ieee80211vap *vap = dev->priv;
1542 + struct ieee80211vap *vap = netdev_priv(dev);
1543 struct ieee80211com *ic = vap->iv_ic;
1544 params[0] = ic->ic_get_txcont_power(ic);
1545 return 0;
1546 @@ -1520,7 +1520,7 @@ ieee80211_ioctl_hal_map(struct net_devic
1547 void *w, char *extra)
1548 {
1549 int *params = (int*) extra;
1550 - struct ieee80211vap *vap = dev->priv;
1551 + struct ieee80211vap *vap = netdev_priv(dev);
1552 struct ieee80211com *ic = vap->iv_ic;
1553 params[0] = ic->ic_dump_hal_map(ic);
1554 return 0;
1555 @@ -1532,7 +1532,7 @@ ieee80211_ioctl_radar(struct net_device
1556 void *w, char *extra)
1557 {
1558 int *params = (int*) extra;
1559 - struct ieee80211vap *vap = dev->priv;
1560 + struct ieee80211vap *vap = netdev_priv(dev);
1561 struct ieee80211com *ic = vap->iv_ic;
1562 if (!(ic->ic_flags & IEEE80211_F_DOTH))
1563 return 0;
1564 @@ -1544,7 +1544,7 @@ static int
1565 ieee80211_ioctl_giwtxpow(struct net_device *dev, struct iw_request_info *info,
1566 struct iw_param *rrq, char *extra)
1567 {
1568 - struct ieee80211vap *vap = dev->priv;
1569 + struct ieee80211vap *vap = netdev_priv(dev);
1570 struct ieee80211com *ic = vap->iv_ic;
1571 unsigned int power = ic->ic_txpowlimit;
1572 struct ieee80211_channel *c;
1573 @@ -1572,7 +1572,7 @@ static int
1574 ieee80211_dump_registers(struct net_device *dev, struct iw_request_info *info, void *w, char *extra)
1575 {
1576 unsigned int *params = (unsigned int*) extra;
1577 - struct ieee80211vap *vap = dev->priv;
1578 + struct ieee80211vap *vap = netdev_priv(dev);
1579 struct ieee80211com *ic = vap->iv_ic;
1580 switch (params[1]) {
1581 case 2:
1582 @@ -1595,7 +1595,7 @@ static int
1583 ieee80211_ioctl_writereg(struct net_device *dev, struct iw_request_info *info, void *w, char *extra)
1584 {
1585 unsigned int *params = (unsigned int*) extra;
1586 - struct ieee80211vap *vap = dev->priv;
1587 + struct ieee80211vap *vap = netdev_priv(dev);
1588 struct ieee80211com *ic = vap->iv_ic;
1589 return ic->ic_write_register(ic, params[0], params[1]);
1590 }
1591 @@ -1606,7 +1606,7 @@ static int
1592 ieee80211_ioctl_readreg(struct net_device *dev, struct iw_request_info *info, void *w, char *extra)
1593 {
1594 unsigned int *params = (unsigned int*) extra;
1595 - struct ieee80211vap *vap = dev->priv;
1596 + struct ieee80211vap *vap = netdev_priv(dev);
1597 struct ieee80211com *ic = vap->iv_ic;
1598 return ic->ic_read_register(ic, params[0], &params[0]);
1599 }
1600 @@ -1642,7 +1642,7 @@ static int
1601 ieee80211_ioctl_iwaplist(struct net_device *dev, struct iw_request_info *info,
1602 struct iw_point *data, char *extra)
1603 {
1604 - struct ieee80211vap *vap = dev->priv;
1605 + struct ieee80211vap *vap = netdev_priv(dev);
1606 struct ieee80211com *ic = vap->iv_ic;
1607 struct waplistreq req; /* XXX off stack */
1608
1609 @@ -1664,7 +1664,7 @@ static int
1610 ieee80211_ioctl_siwscan(struct net_device *dev, struct iw_request_info *info,
1611 struct iw_point *data, char *extra)
1612 {
1613 - struct ieee80211vap *vap = dev->priv;
1614 + struct ieee80211vap *vap = netdev_priv(dev);
1615
1616 /*
1617 * XXX don't permit a scan to be started unless we
1618 @@ -1988,7 +1988,7 @@ static int
1619 ieee80211_ioctl_giwscan(struct net_device *dev, struct iw_request_info *info,
1620 struct iw_point *data, char *extra)
1621 {
1622 - struct ieee80211vap *vap = dev->priv;
1623 + struct ieee80211vap *vap = netdev_priv(dev);
1624 struct ieee80211com *ic = vap->iv_ic;
1625 struct iwscanreq req;
1626 int res = 0;
1627 @@ -2089,7 +2089,7 @@ static int
1628 ieee80211_ioctl_setmode(struct net_device *dev, struct iw_request_info *info,
1629 struct iw_point *wri, char *extra)
1630 {
1631 - struct ieee80211vap *vap = dev->priv;
1632 + struct ieee80211vap *vap = netdev_priv(dev);
1633 struct ieee80211com *ic = vap->iv_ic;
1634 struct ifreq ifr;
1635 char s[6]; /* big enough for ``11adt'' */
1636 @@ -2213,10 +2213,10 @@ ieee80211_setathcap(struct ieee80211vap
1637 static int
1638 ieee80211_set_turbo(struct net_device *dev, int flag)
1639 {
1640 - struct ieee80211vap *vap = dev->priv;
1641 + struct ieee80211vap *vap = netdev_priv(dev);
1642 struct ieee80211com *ic = vap->iv_ic;
1643 struct ifreq ifr;
1644 - struct ieee80211vap *tmpvap = dev->priv;
1645 + struct ieee80211vap *tmpvap = netdev_priv(dev);
1646 int nvap = 0;
1647
1648 TAILQ_FOREACH(tmpvap, &ic->ic_vaps, iv_next)
1649 @@ -2237,7 +2237,7 @@ static int
1650 ieee80211_ioctl_setparam(struct net_device *dev, struct iw_request_info *info,
1651 void *w, char *extra)
1652 {
1653 - struct ieee80211vap *vap = dev->priv;
1654 + struct ieee80211vap *vap = netdev_priv(dev);
1655 struct ieee80211com *ic = vap->iv_ic;
1656 struct ieee80211_rsnparms *rsn = &vap->iv_bss->ni_rsn;
1657 unsigned int *i = (unsigned int *) extra;
1658 @@ -2917,7 +2917,7 @@ static int
1659 ieee80211_ioctl_getmode(struct net_device *dev, struct iw_request_info *info,
1660 struct iw_point *wri, char *extra)
1661 {
1662 - struct ieee80211vap *vap = dev->priv;
1663 + struct ieee80211vap *vap = netdev_priv(dev);
1664 struct ieee80211com *ic = vap->iv_ic;
1665 struct ifmediareq imr;
1666
1667 @@ -2955,7 +2955,7 @@ static int
1668 ieee80211_ioctl_getparam(struct net_device *dev, struct iw_request_info *info,
1669 void *w, char *extra)
1670 {
1671 - struct ieee80211vap *vap = dev->priv;
1672 + struct ieee80211vap *vap = netdev_priv(dev);
1673 struct ieee80211com *ic = vap->iv_ic;
1674 struct ieee80211_rsnparms *rsn = &vap->iv_bss->ni_rsn;
1675 unsigned int *param = (unsigned int *) extra;
1676 @@ -3300,7 +3300,7 @@ static int
1677 ieee80211_ioctl_setoptie(struct net_device *dev, struct iw_request_info *info,
1678 struct iw_point *wri, char *extra)
1679 {
1680 - struct ieee80211vap *vap = dev->priv;
1681 + struct ieee80211vap *vap = netdev_priv(dev);
1682 void *ie;
1683
1684 /*
1685 @@ -3334,7 +3334,7 @@ static int
1686 ieee80211_ioctl_getoptie(struct net_device *dev, struct iw_request_info *info,
1687 struct iw_point *wri, char *extra)
1688 {
1689 - struct ieee80211vap *vap = dev->priv;
1690 + struct ieee80211vap *vap = netdev_priv(dev);
1691
1692 if (vap->iv_opt_ie == NULL) {
1693 wri->length = 0;
1694 @@ -3398,7 +3398,7 @@ ieee80211_ioctl_setappiebuf(struct net_d
1695 struct iw_request_info *info,
1696 struct iw_point *data, char *extra)
1697 {
1698 - struct ieee80211vap *vap = dev->priv;
1699 + struct ieee80211vap *vap = netdev_priv(dev);
1700 struct ieee80211req_getset_appiebuf *iebuf =
1701 (struct ieee80211req_getset_appiebuf *)extra;
1702 enum ieee80211_opmode chk_opmode;
1703 @@ -3440,7 +3440,7 @@ static int
1704 ieee80211_ioctl_getappiebuf(struct net_device *dev, struct iw_request_info *info,
1705 struct iw_point *data, char *extra)
1706 {
1707 - struct ieee80211vap *vap = dev->priv;
1708 + struct ieee80211vap *vap = netdev_priv(dev);
1709 struct ieee80211req_getset_appiebuf *iebuf =
1710 (struct ieee80211req_getset_appiebuf *)extra;
1711 int max_iebuf_len;
1712 @@ -3481,7 +3481,7 @@ static int
1713 ieee80211_ioctl_setfilter(struct net_device *dev, struct iw_request_info *info,
1714 void *w, char *extra)
1715 {
1716 - struct ieee80211vap *vap = dev->priv;
1717 + struct ieee80211vap *vap = netdev_priv(dev);
1718 struct ieee80211req_set_filter *app_filter = (struct ieee80211req_set_filter *)extra;
1719
1720 if ((extra == NULL) || (app_filter->app_filterype & ~IEEE80211_FILTER_TYPE_ALL))
1721 @@ -3496,7 +3496,7 @@ static int
1722 ieee80211_ioctl_setkey(struct net_device *dev, struct iw_request_info *info,
1723 void *w, char *extra)
1724 {
1725 - struct ieee80211vap *vap = dev->priv;
1726 + struct ieee80211vap *vap = netdev_priv(dev);
1727 struct ieee80211com *ic = vap->iv_ic;
1728 struct ieee80211req_key *ik = (struct ieee80211req_key *)extra;
1729 struct ieee80211_node *ni;
1730 @@ -3579,7 +3579,7 @@ ieee80211_ioctl_setkey(struct net_device
1731 static int
1732 ieee80211_ioctl_getkey(struct net_device *dev, struct iwreq *iwr)
1733 {
1734 - struct ieee80211vap *vap = dev->priv;
1735 + struct ieee80211vap *vap = netdev_priv(dev);
1736 struct ieee80211com *ic = vap->iv_ic;
1737 struct ieee80211_node *ni;
1738 struct ieee80211req_key ik;
1739 @@ -3640,7 +3640,7 @@ static int
1740 ieee80211_ioctl_delkey(struct net_device *dev, struct iw_request_info *info,
1741 void *w, char *extra)
1742 {
1743 - struct ieee80211vap *vap = dev->priv;
1744 + struct ieee80211vap *vap = netdev_priv(dev);
1745 struct ieee80211com *ic = vap->iv_ic;
1746 struct ieee80211req_del_key *dk = (struct ieee80211req_del_key *)extra;
1747 ieee80211_keyix_t kix;
1748 @@ -3714,7 +3714,7 @@ static int
1749 ieee80211_ioctl_setmlme(struct net_device *dev, struct iw_request_info *info,
1750 void *w, char *extra)
1751 {
1752 - struct ieee80211vap *vap = dev->priv;
1753 + struct ieee80211vap *vap = netdev_priv(dev);
1754 struct ieee80211com *ic = vap->iv_ic;
1755 struct ieee80211req_mlme *mlme = (struct ieee80211req_mlme *)extra;
1756 struct ieee80211_node *ni;
1757 @@ -3817,7 +3817,7 @@ static int
1758 ieee80211_ioctl_wdsaddmac(struct net_device *dev, struct iw_request_info *info,
1759 void *w, char *extra)
1760 {
1761 - struct ieee80211vap *vap = dev->priv;
1762 + struct ieee80211vap *vap = netdev_priv(dev);
1763 struct sockaddr *sa = (struct sockaddr *)extra;
1764 struct ieee80211com *ic = vap->iv_ic;
1765 struct ieee80211vap *avp;
1766 @@ -3846,7 +3846,7 @@ static int
1767 ieee80211_ioctl_wdssetmac(struct net_device *dev, struct iw_request_info *info,
1768 void *w, char *extra)
1769 {
1770 - struct ieee80211vap *vap = dev->priv;
1771 + struct ieee80211vap *vap = netdev_priv(dev);
1772 struct sockaddr *sa = (struct sockaddr *)extra;
1773
1774 if (vap->iv_opmode != IEEE80211_M_WDS)
1775 @@ -3913,7 +3913,7 @@ ieee80211_ioctl_setscanlist(struct net_d
1776 struct iw_request_info *info,
1777 struct iw_point *data, char *extra)
1778 {
1779 - struct ieee80211vap *vap = dev->priv;
1780 + struct ieee80211vap *vap = netdev_priv(dev);
1781 struct ieee80211com *ic = vap->iv_ic;
1782 char *s, *next;
1783 int val = 1;
1784 @@ -3988,7 +3988,7 @@ static int
1785 ieee80211_ioctl_addmac(struct net_device *dev, struct iw_request_info *info,
1786 void *w, char *extra)
1787 {
1788 - struct ieee80211vap *vap = dev->priv;
1789 + struct ieee80211vap *vap = netdev_priv(dev);
1790 struct sockaddr *sa = (struct sockaddr *)extra;
1791 const struct ieee80211_aclator *acl = vap->iv_acl;
1792
1793 @@ -4006,7 +4006,7 @@ static int
1794 ieee80211_ioctl_delmac(struct net_device *dev, struct iw_request_info *info,
1795 void *w, char *extra)
1796 {
1797 - struct ieee80211vap *vap = dev->priv;
1798 + struct ieee80211vap *vap = netdev_priv(dev);
1799 struct sockaddr *sa = (struct sockaddr *)extra;
1800 const struct ieee80211_aclator *acl = vap->iv_acl;
1801
1802 @@ -4024,7 +4024,7 @@ static int
1803 ieee80211_ioctl_setchanlist(struct net_device *dev,
1804 struct iw_request_info *info, void *w, char *extra)
1805 {
1806 - struct ieee80211vap *vap = dev->priv;
1807 + struct ieee80211vap *vap = netdev_priv(dev);
1808 struct ieee80211com *ic = vap->iv_ic;
1809 struct ieee80211req_chanlist *list =
1810 (struct ieee80211req_chanlist *)extra;
1811 @@ -4075,7 +4075,7 @@ static int
1812 ieee80211_ioctl_getchanlist(struct net_device *dev,
1813 struct iw_request_info *info, void *w, char *extra)
1814 {
1815 - struct ieee80211vap *vap = dev->priv;
1816 + struct ieee80211vap *vap = netdev_priv(dev);
1817 struct ieee80211com *ic = vap->iv_ic;
1818
1819 memcpy(extra, ic->ic_chan_active, sizeof(ic->ic_chan_active));
1820 @@ -4096,7 +4096,7 @@ static int
1821 ieee80211_ioctl_getchaninfo(struct net_device *dev,
1822 struct iw_request_info *info, void *w, char *extra)
1823 {
1824 - struct ieee80211vap *vap = dev->priv;
1825 + struct ieee80211vap *vap = netdev_priv(dev);
1826 struct ieee80211com *ic = vap->iv_ic;
1827 struct ieee80211req_chaninfo *chans =
1828 (struct ieee80211req_chaninfo *)extra;
1829 @@ -4143,7 +4143,7 @@ static int
1830 ieee80211_ioctl_setwmmparams(struct net_device *dev,
1831 struct iw_request_info *info, void *w, char *extra)
1832 {
1833 - struct ieee80211vap *vap = dev->priv;
1834 + struct ieee80211vap *vap = netdev_priv(dev);
1835 unsigned int *param = (unsigned int *) extra;
1836 unsigned int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE;
1837 unsigned int bss = param[2];
1838 @@ -4231,7 +4231,7 @@ static int
1839 ieee80211_ioctl_getwmmparams(struct net_device *dev,
1840 struct iw_request_info *info, void *w, char *extra)
1841 {
1842 - struct ieee80211vap *vap = dev->priv;
1843 + struct ieee80211vap *vap = netdev_priv(dev);
1844 unsigned int *param = (unsigned int *) extra;
1845 unsigned int ac = (param[1] < WME_NUM_AC) ? param[1] : WME_AC_BE;
1846 struct ieee80211_wme_state *wme = &vap->iv_ic->ic_wme;
1847 @@ -4266,7 +4266,7 @@ ieee80211_ioctl_getwmmparams(struct net_
1848 static int
1849 ieee80211_ioctl_getwpaie(struct net_device *dev, struct iwreq *iwr)
1850 {
1851 - struct ieee80211vap *vap = dev->priv;
1852 + struct ieee80211vap *vap = netdev_priv(dev);
1853 struct ieee80211com *ic = vap->iv_ic;
1854 struct ieee80211_node *ni;
1855 struct ieee80211req_wpaie wpaie;
1856 @@ -4300,7 +4300,7 @@ ieee80211_ioctl_getwpaie(struct net_devi
1857 static int
1858 ieee80211_ioctl_getstastats(struct net_device *dev, struct iwreq *iwr)
1859 {
1860 - struct ieee80211vap *vap = dev->priv;
1861 + struct ieee80211vap *vap = netdev_priv(dev);
1862 struct ieee80211com *ic = vap->iv_ic;
1863 struct ieee80211_node *ni;
1864 u_int8_t macaddr[IEEE80211_ADDR_LEN];
1865 @@ -4419,7 +4419,7 @@ get_scan_result(void *arg, const struct
1866 static int
1867 ieee80211_ioctl_getscanresults(struct net_device *dev, struct iwreq *iwr)
1868 {
1869 - struct ieee80211vap *vap = dev->priv;
1870 + struct ieee80211vap *vap = netdev_priv(dev);
1871 struct ieee80211com *ic = vap->iv_ic;
1872 struct scanreq req;
1873 int error;
1874 @@ -4582,7 +4582,7 @@ get_sta_info(void *arg, struct ieee80211
1875 static int
1876 ieee80211_ioctl_getstainfo(struct net_device *dev, struct iwreq *iwr)
1877 {
1878 - struct ieee80211vap *vap = dev->priv;
1879 + struct ieee80211vap *vap = netdev_priv(dev);
1880 struct ieee80211com *ic = vap->iv_ic;
1881 struct stainforeq req;
1882 int error;
1883 @@ -4616,7 +4616,7 @@ ieee80211_ioctl_getstainfo(struct net_de
1884
1885 static void
1886 pre_announced_chanswitch(struct net_device *dev, u_int32_t channel, u_int32_t tbtt) {
1887 - struct ieee80211vap *vap = dev->priv;
1888 + struct ieee80211vap *vap = netdev_priv(dev);
1889 struct ieee80211com *ic = vap->iv_ic;
1890 struct ieee80211vap *avp;
1891
1892 @@ -4634,7 +4634,7 @@ static int
1893 ieee80211_ioctl_chanswitch(struct net_device *dev, struct iw_request_info *info,
1894 void *w, char *extra)
1895 {
1896 - struct ieee80211vap *vap = dev->priv;
1897 + struct ieee80211vap *vap = netdev_priv(dev);
1898 struct ieee80211com *ic = vap->iv_ic;
1899 unsigned int *param = (unsigned int *) extra;
1900
1901 @@ -4679,7 +4679,7 @@ static int
1902 ieee80211_ioctl_giwgenie(struct net_device *dev,
1903 struct iw_request_info *info, struct iw_point *out, char *buf)
1904 {
1905 - struct ieee80211vap *vap = dev->priv;
1906 + struct ieee80211vap *vap = netdev_priv(dev);
1907
1908 if (out->length < vap->iv_opt_ie_len)
1909 return -E2BIG;
1910 @@ -5212,7 +5212,7 @@ static int
1911 ieee80211_ioctl_giwencodeext(struct net_device *dev,
1912 struct iw_request_info *info, struct iw_point *erq, char *extra)
1913 {
1914 - struct ieee80211vap *vap = dev->priv;
1915 + struct ieee80211vap *vap = netdev_priv(dev);
1916 struct iw_encode_ext *ext;
1917 struct ieee80211_key *wk;
1918 ieee80211_keyix_t kix;
1919 @@ -5272,7 +5272,7 @@ static int
1920 ieee80211_ioctl_siwencodeext(struct net_device *dev,
1921 struct iw_request_info *info, struct iw_point *erq, char *extra)
1922 {
1923 - struct ieee80211vap *vap = dev->priv;
1924 + struct ieee80211vap *vap = netdev_priv(dev);
1925 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1926 struct ieee80211req_key kr;
1927 ieee80211_keyix_t kix;
1928 @@ -5948,7 +5948,7 @@ static struct iw_handler_def ieee80211_i
1929 static int
1930 ieee80211_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1931 {
1932 - struct ieee80211vap *vap = dev->priv;
1933 + struct ieee80211vap *vap = netdev_priv(dev);
1934 struct ieee80211com *ic = vap->iv_ic;
1935 struct ieee80211_node *ni;
1936