From 03bffc1341c757e4b15a5a6058ad624e28b4801e Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Tue, 4 Dec 2007 20:33:40 +0100 Subject: wireless: make drivers include the TSF RX flag where appropriate These drivers pass full mactime information to the stack, make them indicate this via the new RX_FLAG_TSFT to get mac80211 to show this information in monitor mode. Signed-off-by: Johannes Berg Signed-off-by: John W. Linville Signed-off-by: David S. Miller --- drivers/net/wireless/b43legacy/xmit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/net/wireless/b43legacy/xmit.c') diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index fa1e65687a6..b71cc949f7d 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c @@ -532,6 +532,7 @@ void b43legacy_rx(struct b43legacy_wldev *dev, status.rate = b43legacy_plcp_get_bitrate_cck(plcp); status.antenna = !!(phystat0 & B43legacy_RX_PHYST0_ANT); status.mactime = mactime; + status.flag |= RX_FLAG_TSFT; chanid = (chanstat & B43legacy_RX_CHAN_ID) >> B43legacy_RX_CHAN_ID_SHIFT; -- cgit v1.2.3-70-g09d2 From 0a6e1bee5770a6d4c4569a4720614402ab5f9d7a Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 6 Nov 2007 22:48:12 +0100 Subject: b43legacy: use the retry limits provided by mac80211 Use the retry limits provided by mac80211. The patch to b43 by Michael Buesch has been ported to b43legacy. Signed-off-by: Stefano Brivio Signed-off-by: John W. Linville --- drivers/net/wireless/b43legacy/main.c | 79 ++++++++++++++++++++++------------- drivers/net/wireless/b43legacy/xmit.c | 3 +- 2 files changed, 52 insertions(+), 30 deletions(-) (limited to 'drivers/net/wireless/b43legacy/xmit.c') diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index af75f41668c..c9fe09dda94 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c @@ -75,14 +75,6 @@ module_param_named(bad_frames_preempt, modparam_bad_frames_preempt, int, 0444); MODULE_PARM_DESC(bad_frames_preempt, "enable(1) / disable(0) Bad Frames" " Preemption"); -static int modparam_short_retry = B43legacy_DEFAULT_SHORT_RETRY_LIMIT; -module_param_named(short_retry, modparam_short_retry, int, 0444); -MODULE_PARM_DESC(short_retry, "Short-Retry-Limit (0 - 15)"); - -static int modparam_long_retry = B43legacy_DEFAULT_LONG_RETRY_LIMIT; -module_param_named(long_retry, modparam_long_retry, int, 0444); -MODULE_PARM_DESC(long_retry, "Long-Retry-Limit (0 - 15)"); - static char modparam_fwpostfix[16]; module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); MODULE_PARM_DESC(fwpostfix, "Postfix for the firmware files to load."); @@ -2930,6 +2922,20 @@ static void b43legacy_imcfglo_timeouts_workaround(struct b43legacy_wldev *dev) #endif /* CONFIG_SSB_DRIVER_PCICORE */ } +/* Write the short and long frame retry limit values. */ +static void b43legacy_set_retry_limits(struct b43legacy_wldev *dev, + unsigned int short_retry, + unsigned int long_retry) +{ + /* The retry limit is a 4-bit counter. Enforce this to avoid overflowing + * the chip-internal counter. */ + short_retry = min(short_retry, (unsigned int)0xF); + long_retry = min(long_retry, (unsigned int)0xF); + + b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0006, short_retry); + b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, 0x0007, long_retry); +} + /* Shutdown a wireless core */ /* Locking: wl->mutex */ static void b43legacy_wireless_core_exit(struct b43legacy_wldev *dev) @@ -3067,16 +3073,9 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev) } b43legacy_hf_write(dev, hf); - /* Short/Long Retry Limit. - * The retry-limit is a 4-bit counter. Enforce this to avoid overflowing - * the chip-internal counter. - */ - tmp = limit_value(modparam_short_retry, 0, 0xF); - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, - 0x0006, tmp); - tmp = limit_value(modparam_long_retry, 0, 0xF); - b43legacy_shm_write16(dev, B43legacy_SHM_WIRELESS, - 0x0007, tmp); + b43legacy_set_retry_limits(dev, + B43legacy_DEFAULT_SHORT_RETRY_LIMIT, + B43legacy_DEFAULT_LONG_RETRY_LIMIT); b43legacy_shm_write16(dev, B43legacy_SHM_SHARED, 0x0044, 3); @@ -3253,19 +3252,41 @@ static void b43legacy_stop(struct ieee80211_hw *hw) mutex_unlock(&wl->mutex); } +static int b43legacy_op_set_retry_limit(struct ieee80211_hw *hw, + u32 short_retry_limit, + u32 long_retry_limit) +{ + struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); + struct b43legacy_wldev *dev; + int err = 0; + + mutex_lock(&wl->mutex); + dev = wl->current_dev; + if (unlikely(!dev || + (b43legacy_status(dev) < B43legacy_STAT_INITIALIZED))) { + err = -ENODEV; + goto out_unlock; + } + b43legacy_set_retry_limits(dev, short_retry_limit, long_retry_limit); +out_unlock: + mutex_unlock(&wl->mutex); + + return err; +} static const struct ieee80211_ops b43legacy_hw_ops = { - .tx = b43legacy_tx, - .conf_tx = b43legacy_conf_tx, - .add_interface = b43legacy_add_interface, - .remove_interface = b43legacy_remove_interface, - .config = b43legacy_dev_config, - .config_interface = b43legacy_config_interface, - .configure_filter = b43legacy_configure_filter, - .get_stats = b43legacy_get_stats, - .get_tx_stats = b43legacy_get_tx_stats, - .start = b43legacy_start, - .stop = b43legacy_stop, + .tx = b43legacy_tx, + .conf_tx = b43legacy_conf_tx, + .add_interface = b43legacy_add_interface, + .remove_interface = b43legacy_remove_interface, + .config = b43legacy_dev_config, + .config_interface = b43legacy_config_interface, + .configure_filter = b43legacy_configure_filter, + .get_stats = b43legacy_get_stats, + .get_tx_stats = b43legacy_get_tx_stats, + .start = b43legacy_start, + .stop = b43legacy_stop, + .set_retry_limit = b43legacy_op_set_retry_limit, }; /* Hard-reset the chip. Do not call this directly. diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index b71cc949f7d..d558a3a7cbf 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c @@ -290,6 +290,8 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, mac_ctl |= B43legacy_TX4_MAC_STMSDU; if (rate_fb_ofdm) mac_ctl |= B43legacy_TX4_MAC_FALLBACKOFDM; + if (txctl->flags & IEEE80211_TXCTL_LONG_RETRY_LIMIT) + mac_ctl |= B43legacy_TX4_MAC_LONGFRAME; /* Generate the RTS or CTS-to-self frame */ if ((txctl->flags & IEEE80211_TXCTL_USE_RTS_CTS) || @@ -335,7 +337,6 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, len, rts_rate_fb); hdr = (struct ieee80211_hdr *)(&txhdr->rts_frame); txhdr->rts_dur_fb = hdr->duration_id; - mac_ctl |= B43legacy_TX4_MAC_LONGFRAME; } /* Magic cookie */ -- cgit v1.2.3-70-g09d2 From 1f21ad2a4f7f66855dae600ddd635ff5fb299bbd Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 6 Nov 2007 22:49:20 +0100 Subject: b43/b43legacy: fix my copyright notices Fix my copyright notices in b43 and b43legacy. Signed-off-by: Stefano Brivio Cc: Michael Buesch Signed-off-by: John W. Linville --- drivers/net/wireless/b43/leds.c | 2 +- drivers/net/wireless/b43/lo.c | 2 +- drivers/net/wireless/b43/main.c | 2 +- drivers/net/wireless/b43/main.h | 2 +- drivers/net/wireless/b43/phy.c | 2 +- drivers/net/wireless/b43/tables.c | 2 +- drivers/net/wireless/b43/wa.c | 5 +---- drivers/net/wireless/b43/xmit.c | 2 +- drivers/net/wireless/b43legacy/ilt.c | 2 +- drivers/net/wireless/b43legacy/leds.c | 2 +- drivers/net/wireless/b43legacy/main.c | 2 +- drivers/net/wireless/b43legacy/main.h | 2 +- drivers/net/wireless/b43legacy/phy.c | 2 +- drivers/net/wireless/b43legacy/phy.h | 2 +- drivers/net/wireless/b43legacy/radio.c | 2 +- drivers/net/wireless/b43legacy/radio.h | 2 +- drivers/net/wireless/b43legacy/xmit.c | 2 +- 17 files changed, 17 insertions(+), 20 deletions(-) (limited to 'drivers/net/wireless/b43legacy/xmit.c') diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c index 6c0e2b9f776..e04eba1f930 100644 --- a/drivers/net/wireless/b43/leds.c +++ b/drivers/net/wireless/b43/leds.c @@ -4,7 +4,7 @@ LED control Copyright (c) 2005 Martin Langer , - Copyright (c) 2005 Stefano Brivio + Copyright (c) 2005 Stefano Brivio Copyright (c) 2005-2007 Michael Buesch Copyright (c) 2005 Danny van Dyk Copyright (c) 2005 Andreas Jaggi diff --git a/drivers/net/wireless/b43/lo.c b/drivers/net/wireless/b43/lo.c index b14a1753a0d..0a50fd584c1 100644 --- a/drivers/net/wireless/b43/lo.c +++ b/drivers/net/wireless/b43/lo.c @@ -5,7 +5,7 @@ G PHY LO (LocalOscillator) Measuring and Control routines Copyright (c) 2005 Martin Langer , - Copyright (c) 2005, 2006 Stefano Brivio + Copyright (c) 2005, 2006 Stefano Brivio Copyright (c) 2005-2007 Michael Buesch Copyright (c) 2005, 2006 Danny van Dyk Copyright (c) 2005, 2006 Andreas Jaggi diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 979e82267d0..72321d802f1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c @@ -3,7 +3,7 @@ Broadcom B43 wireless driver Copyright (c) 2005 Martin Langer - Copyright (c) 2005 Stefano Brivio + Copyright (c) 2005 Stefano Brivio Copyright (c) 2005, 2006 Michael Buesch Copyright (c) 2005 Danny van Dyk Copyright (c) 2005 Andreas Jaggi diff --git a/drivers/net/wireless/b43/main.h b/drivers/net/wireless/b43/main.h index 08e2e56e48f..a8503ef4ebc 100644 --- a/drivers/net/wireless/b43/main.h +++ b/drivers/net/wireless/b43/main.h @@ -3,7 +3,7 @@ Broadcom B43 wireless driver Copyright (c) 2005 Martin Langer , - Stefano Brivio + Stefano Brivio Michael Buesch Danny van Dyk Andreas Jaggi diff --git a/drivers/net/wireless/b43/phy.c b/drivers/net/wireless/b43/phy.c index cc0208e27b9..7eb71d73663 100644 --- a/drivers/net/wireless/b43/phy.c +++ b/drivers/net/wireless/b43/phy.c @@ -3,7 +3,7 @@ Broadcom B43 wireless driver Copyright (c) 2005 Martin Langer , - Copyright (c) 2005, 2006 Stefano Brivio + Copyright (c) 2005-2007 Stefano Brivio Copyright (c) 2005, 2006 Michael Buesch Copyright (c) 2005, 2006 Danny van Dyk Copyright (c) 2005, 2006 Andreas Jaggi diff --git a/drivers/net/wireless/b43/tables.c b/drivers/net/wireless/b43/tables.c index 0ac8653767b..be9c7eb94ac 100644 --- a/drivers/net/wireless/b43/tables.c +++ b/drivers/net/wireless/b43/tables.c @@ -3,7 +3,7 @@ Broadcom B43 wireless driver Copyright (c) 2005 Martin Langer , - Copyright (c) 2005 Stefano Brivio + Copyright (c) 2005-2007 Stefano Brivio Copyright (c) 2006, 2006 Michael Buesch Copyright (c) 2005 Danny van Dyk Copyright (c) 2005 Andreas Jaggi diff --git a/drivers/net/wireless/b43/wa.c b/drivers/net/wireless/b43/wa.c index 2ccbdc09f49..b70992aa66b 100644 --- a/drivers/net/wireless/b43/wa.c +++ b/drivers/net/wireless/b43/wa.c @@ -4,11 +4,8 @@ PHY workarounds. - Copyright (c) 2005 Martin Langer , - Copyright (c) 2005-2007 Stefano Brivio + Copyright (c) 2005-2007 Stefano Brivio Copyright (c) 2005-2007 Michael Buesch - Copyright (c) 2005, 2006 Danny van Dyk - Copyright (c) 2005, 2006 Andreas Jaggi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 3659438e637..d36603d499f 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c @@ -5,7 +5,7 @@ Transmission (TX/RX) related functions. Copyright (C) 2005 Martin Langer - Copyright (C) 2005 Stefano Brivio + Copyright (C) 2005 Stefano Brivio Copyright (C) 2005, 2006 Michael Buesch Copyright (C) 2005 Danny van Dyk Copyright (C) 2005 Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/ilt.c b/drivers/net/wireless/b43legacy/ilt.c index 247fc780ffd..a849078aea6 100644 --- a/drivers/net/wireless/b43legacy/ilt.c +++ b/drivers/net/wireless/b43legacy/ilt.c @@ -3,7 +3,7 @@ Broadcom B43legacy wireless driver Copyright (c) 2005 Martin Langer , - Stefano Brivio + Stefano Brivio Michael Buesch Danny van Dyk Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/leds.c b/drivers/net/wireless/b43legacy/leds.c index 9ef284fda80..b4319c99cf7 100644 --- a/drivers/net/wireless/b43legacy/leds.c +++ b/drivers/net/wireless/b43legacy/leds.c @@ -4,7 +4,7 @@ LED control Copyright (c) 2005 Martin Langer , - Copyright (c) 2005 Stefano Brivio + Copyright (c) 2005 Stefano Brivio Copyright (c) 2005-2007 Michael Buesch Copyright (c) 2005 Danny van Dyk Copyright (c) 2005 Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 2b888960c3d..e545f79ac74 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c @@ -3,7 +3,7 @@ * Broadcom B43legacy wireless driver * * Copyright (c) 2005 Martin Langer - * Copyright (c) 2005 Stefano Brivio + * Copyright (c) 2005-2007 Stefano Brivio * Copyright (c) 2005, 2006 Michael Buesch * Copyright (c) 2005 Danny van Dyk * Copyright (c) 2005 Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/main.h b/drivers/net/wireless/b43legacy/main.h index 68435c50d8e..1f0e2e379b0 100644 --- a/drivers/net/wireless/b43legacy/main.h +++ b/drivers/net/wireless/b43legacy/main.h @@ -3,7 +3,7 @@ Broadcom B43legacy wireless driver Copyright (c) 2005 Martin Langer , - Copyright (c) 2005 Stefano Brivio + Copyright (c) 2005 Stefano Brivio Copyright (c) 2005, 2006 Michael Buesch Copyright (c) 2005 Danny van Dyk Copyright (c) 2005 Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c index 491e518e4ae..d121fae53aa 100644 --- a/drivers/net/wireless/b43legacy/phy.c +++ b/drivers/net/wireless/b43legacy/phy.c @@ -3,7 +3,7 @@ Broadcom B43legacy wireless driver Copyright (c) 2005 Martin Langer , - Stefano Brivio + Stefano Brivio Michael Buesch Danny van Dyk Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/phy.h b/drivers/net/wireless/b43legacy/phy.h index f11b4271714..efa4c5c54a8 100644 --- a/drivers/net/wireless/b43legacy/phy.h +++ b/drivers/net/wireless/b43legacy/phy.h @@ -3,7 +3,7 @@ Broadcom B43legacy wireless driver Copyright (c) 2005 Martin Langer , - Stefano Brivio + Stefano Brivio Michael Buesch Danny van Dyk Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/radio.c b/drivers/net/wireless/b43legacy/radio.c index 1dc351ca883..ccdb6fc8932 100644 --- a/drivers/net/wireless/b43legacy/radio.c +++ b/drivers/net/wireless/b43legacy/radio.c @@ -3,7 +3,7 @@ Broadcom B43legacy wireless driver Copyright (c) 2005 Martin Langer , - Stefano Brivio + Stefano Brivio Michael Buesch Danny van Dyk Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/radio.h b/drivers/net/wireless/b43legacy/radio.h index ad90d9c0346..ec4de2811c5 100644 --- a/drivers/net/wireless/b43legacy/radio.h +++ b/drivers/net/wireless/b43legacy/radio.h @@ -3,7 +3,7 @@ Broadcom B43legacy wireless driver Copyright (c) 2005 Martin Langer , - Stefano Brivio + Stefano Brivio Michael Buesch Danny van Dyk Andreas Jaggi diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index d558a3a7cbf..23496f45a4d 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c @@ -5,7 +5,7 @@ Transmission (TX/RX) related functions. Copyright (C) 2005 Martin Langer - Copyright (C) 2005 Stefano Brivio + Copyright (C) 2005 Stefano Brivio Copyright (C) 2005, 2006 Michael Buesch Copyright (C) 2005 Danny van Dyk Copyright (C) 2005 Andreas Jaggi -- cgit v1.2.3-70-g09d2 From 7797aa384870e3bb5bfd3b6a0eae61e7c7a4c993 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Fri, 9 Nov 2007 16:57:34 -0600 Subject: b43legacy: Convert to use of the new SPROM structure The b43legacy driver is modified to use the new SPROM structure. Signed-off-by: Larry Finger Signed-off-by: John W. Linville --- drivers/net/wireless/b43legacy/leds.c | 8 +++---- drivers/net/wireless/b43legacy/main.c | 20 +++++++++--------- drivers/net/wireless/b43legacy/phy.c | 38 ++++++++++++++++++---------------- drivers/net/wireless/b43legacy/radio.c | 12 +++++------ drivers/net/wireless/b43legacy/xmit.c | 2 +- 5 files changed, 41 insertions(+), 39 deletions(-) (limited to 'drivers/net/wireless/b43legacy/xmit.c') diff --git a/drivers/net/wireless/b43legacy/leds.c b/drivers/net/wireless/b43legacy/leds.c index b4319c99cf7..f0affb78100 100644 --- a/drivers/net/wireless/b43legacy/leds.c +++ b/drivers/net/wireless/b43legacy/leds.c @@ -189,10 +189,10 @@ void b43legacy_leds_init(struct b43legacy_wldev *dev) enum b43legacy_led_behaviour behaviour; bool activelow; - sprom[0] = bus->sprom.r1.gpio0; - sprom[1] = bus->sprom.r1.gpio1; - sprom[2] = bus->sprom.r1.gpio2; - sprom[3] = bus->sprom.r1.gpio3; + sprom[0] = bus->sprom.gpio0; + sprom[1] = bus->sprom.gpio1; + sprom[2] = bus->sprom.gpio2; + sprom[3] = bus->sprom.gpio3; for (i = 0; i < 4; i++) { if (sprom[i] == 0xFF) { diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index e545f79ac74..1a8b6761907 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c @@ -1745,7 +1745,7 @@ static int b43legacy_gpio_init(struct b43legacy_wldev *dev) mask |= 0x0060; set |= 0x0060; } - if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_PACTRL) { + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL) { b43legacy_write16(dev, B43legacy_MMIO_GPIO_MASK, b43legacy_read16(dev, B43legacy_MMIO_GPIO_MASK) @@ -2122,7 +2122,7 @@ static void b43legacy_periodic_every120sec(struct b43legacy_wldev *dev) static void b43legacy_periodic_every60sec(struct b43legacy_wldev *dev) { b43legacy_phy_lo_mark_all_unused(dev); - if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_RSSI) { + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI) { b43legacy_mac_suspend(dev); b43legacy_calc_nrssi_slope(dev); b43legacy_mac_enable(dev); @@ -3064,7 +3064,7 @@ static int b43legacy_wireless_core_init(struct b43legacy_wldev *dev) hf |= B43legacy_HF_SYMW; if (phy->rev == 1) hf |= B43legacy_HF_GDCW; - if (sprom->r1.boardflags_lo & B43legacy_BFL_PACTRL) + if (sprom->boardflags_lo & B43legacy_BFL_PACTRL) hf |= B43legacy_HF_OFDMPABOOST; } else if (phy->type == B43legacy_PHYTYPE_B) { hf |= B43legacy_HF_SYMW; @@ -3556,12 +3556,12 @@ static void b43legacy_sprom_fixup(struct ssb_bus *bus) if (bus->boardinfo.vendor == PCI_VENDOR_ID_APPLE && bus->boardinfo.type == 0x4E && bus->boardinfo.rev > 0x40) - bus->sprom.r1.boardflags_lo |= B43legacy_BFL_PACTRL; + bus->sprom.boardflags_lo |= B43legacy_BFL_PACTRL; /* Convert Antennagain values to Q5.2 */ - if (bus->sprom.r1.antenna_gain_bg == 0xFF) - bus->sprom.r1.antenna_gain_bg = 2; /* if unset, use 2 dBm */ - bus->sprom.r1.antenna_gain_bg <<= 2; + if (bus->sprom.antenna_gain_bg == 0xFF) + bus->sprom.antenna_gain_bg = 2; /* if unset, use 2 dBm */ + bus->sprom.antenna_gain_bg <<= 2; } static void b43legacy_wireless_exit(struct ssb_device *dev, @@ -3596,10 +3596,10 @@ static int b43legacy_wireless_init(struct ssb_device *dev) hw->max_noise = -110; hw->queues = 1; /* FIXME: hardware has more queues */ SET_IEEE80211_DEV(hw, dev->dev); - if (is_valid_ether_addr(sprom->r1.et1mac)) - SET_IEEE80211_PERM_ADDR(hw, sprom->r1.et1mac); + if (is_valid_ether_addr(sprom->et1mac)) + SET_IEEE80211_PERM_ADDR(hw, sprom->et1mac); else - SET_IEEE80211_PERM_ADDR(hw, sprom->r1.il0mac); + SET_IEEE80211_PERM_ADDR(hw, sprom->il0mac); /* Get and initialize struct b43legacy_wl */ wl = hw_to_b43legacy_wl(hw); diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c index d121fae53aa..9d527e6d6ce 100644 --- a/drivers/net/wireless/b43legacy/phy.c +++ b/drivers/net/wireless/b43legacy/phy.c @@ -441,7 +441,7 @@ static void b43legacy_phy_inita(struct b43legacy_wldev *dev) might_sleep(); b43legacy_phy_setupg(dev); - if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_PACTRL) + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL) b43legacy_phy_write(dev, 0x046E, 0x03CF); } @@ -543,7 +543,7 @@ static void b43legacy_phy_initb4(struct b43legacy_wldev *dev) if (phy->radio_ver == 0x2050) b43legacy_phy_write(dev, 0x002A, 0x88C2); b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF); - if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_RSSI) { + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI) { b43legacy_calc_nrssi_slope(dev); b43legacy_calc_nrssi_threshold(dev); } @@ -699,7 +699,7 @@ static void b43legacy_phy_initb6(struct b43legacy_wldev *dev) b43legacy_radio_write16(dev, 0x005A, 0x0088); b43legacy_radio_write16(dev, 0x005B, 0x006B); b43legacy_radio_write16(dev, 0x005C, 0x000F); - if (dev->dev->bus->sprom.r1.boardflags_lo & 0x8000) { + if (dev->dev->bus->sprom.boardflags_lo & 0x8000) { b43legacy_radio_write16(dev, 0x005D, 0x00FA); b43legacy_radio_write16(dev, 0x005E, 0x00D8); } else { @@ -797,7 +797,7 @@ static void b43legacy_phy_initb6(struct b43legacy_wldev *dev) b43legacy_phy_write(dev, 0x0062, 0x0007); b43legacy_radio_init2050(dev); b43legacy_phy_lo_g_measure(dev); - if (dev->dev->bus->sprom.r1.boardflags_lo & + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI) { b43legacy_calc_nrssi_slope(dev); b43legacy_calc_nrssi_threshold(dev); @@ -921,7 +921,7 @@ static void b43legacy_calc_loopback_gain(struct b43legacy_wldev *dev) b43legacy_phy_read(dev, 0x0811) | 0x0100); b43legacy_phy_write(dev, 0x0812, b43legacy_phy_read(dev, 0x0812) & 0xCFFF); - if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_EXTLNA) { + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_EXTLNA) { if (phy->rev >= 7) { b43legacy_phy_write(dev, 0x0811, b43legacy_phy_read(dev, 0x0811) @@ -1072,7 +1072,7 @@ static void b43legacy_phy_initg(struct b43legacy_wldev *dev) b43legacy_phy_write(dev, 0x0036, (b43legacy_phy_read(dev, 0x0036) & 0x0FFF) | (phy->txctl2 << 12)); - if (dev->dev->bus->sprom.r1.boardflags_lo & + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL) b43legacy_phy_write(dev, 0x002E, 0x8075); else @@ -1087,7 +1087,7 @@ static void b43legacy_phy_initg(struct b43legacy_wldev *dev) b43legacy_phy_write(dev, 0x080F, 0x8078); } - if (!(dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_RSSI)) { + if (!(dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI)) { /* The specs state to update the NRSSI LT with * the value 0x7FFFFFFF here. I think that is some weird * compiler optimization in the original driver. @@ -1838,9 +1838,9 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) estimated_pwr = b43legacy_phy_estimate_power_out(dev, average); - max_pwr = dev->dev->bus->sprom.r1.maxpwr_bg; + max_pwr = dev->dev->bus->sprom.maxpwr_bg; - if ((dev->dev->bus->sprom.r1.boardflags_lo + if ((dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL) && (phy->type == B43legacy_PHYTYPE_G)) max_pwr -= 0x3; @@ -1848,7 +1848,7 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) b43legacywarn(dev->wl, "Invalid max-TX-power value in SPROM." "\n"); max_pwr = 74; /* fake it */ - dev->dev->bus->sprom.r1.maxpwr_bg = max_pwr; + dev->dev->bus->sprom.maxpwr_bg = max_pwr; } /* Use regulatory information to get the maximum power. @@ -1858,7 +1858,8 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) * and 1.5 dBm (a safety factor??). The result is in Q5.2 format * which accounts for the factor of 4 */ #define REG_MAX_PWR 20 - max_pwr = min(REG_MAX_PWR * 4 - dev->dev->bus->sprom.r1.antenna_gain_bg + max_pwr = min(REG_MAX_PWR * 4 + - dev->dev->bus->sprom.antenna_gain_bg - 0x6, max_pwr); /* find the desired power in Q5.2 - power_level is in dBm @@ -1918,7 +1919,7 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev) txpower = 3; radio_attenuation += 2; baseband_attenuation += 2; - } else if (dev->dev->bus->sprom.r1.boardflags_lo + } else if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL) { baseband_attenuation += 4 * (radio_attenuation - 2); @@ -2000,9 +2001,9 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev) B43legacy_WARN_ON(!(phy->type == B43legacy_PHYTYPE_B || phy->type == B43legacy_PHYTYPE_G)); - pab0 = (s16)(dev->dev->bus->sprom.r1.pa0b0); - pab1 = (s16)(dev->dev->bus->sprom.r1.pa0b1); - pab2 = (s16)(dev->dev->bus->sprom.r1.pa0b2); + pab0 = (s16)(dev->dev->bus->sprom.pa0b0); + pab1 = (s16)(dev->dev->bus->sprom.pa0b1); + pab2 = (s16)(dev->dev->bus->sprom.pa0b2); if ((dev->dev->bus->chip_id == 0x4301) && (phy->radio_ver != 0x2050)) { phy->idle_tssi = 0x34; @@ -2013,9 +2014,10 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev) if (pab0 != 0 && pab1 != 0 && pab2 != 0 && pab0 != -1 && pab1 != -1 && pab2 != -1) { /* The pabX values are set in SPROM. Use them. */ - if ((s8)dev->dev->bus->sprom.r1.itssi_bg != 0 && - (s8)dev->dev->bus->sprom.r1.itssi_bg != -1) - phy->idle_tssi = (s8)(dev->dev->bus->sprom.r1.itssi_bg); + if ((s8)dev->dev->bus->sprom.itssi_bg != 0 && + (s8)dev->dev->bus->sprom.itssi_bg != -1) + phy->idle_tssi = (s8)(dev->dev->bus->sprom. + itssi_bg); else phy->idle_tssi = 62; dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); diff --git a/drivers/net/wireless/b43legacy/radio.c b/drivers/net/wireless/b43legacy/radio.c index ccdb6fc8932..1a72eb0f8f6 100644 --- a/drivers/net/wireless/b43legacy/radio.c +++ b/drivers/net/wireless/b43legacy/radio.c @@ -827,7 +827,7 @@ void b43legacy_calc_nrssi_threshold(struct b43legacy_wldev *dev) case B43legacy_PHYTYPE_B: { if (phy->radio_ver != 0x2050) return; - if (!(dev->dev->bus->sprom.r1.boardflags_lo & + if (!(dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI)) return; @@ -857,7 +857,7 @@ void b43legacy_calc_nrssi_threshold(struct b43legacy_wldev *dev) } case B43legacy_PHYTYPE_G: if (!phy->gmode || - !(dev->dev->bus->sprom.r1.boardflags_lo & + !(dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI)) { tmp16 = b43legacy_nrssi_hw_read(dev, 0x20); if (tmp16 >= 0x20) @@ -1406,7 +1406,7 @@ static u16 b43legacy_get_812_value(struct b43legacy_wldev *dev, u8 lpd) if (!phy->gmode) return 0; if (!has_loopback_gain(phy)) { - if (phy->rev < 7 || !(dev->dev->bus->sprom.r1.boardflags_lo + if (phy->rev < 7 || !(dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_EXTLNA)) { switch (lpd) { case LPD(0, 1, 1): @@ -1459,7 +1459,7 @@ static u16 b43legacy_get_812_value(struct b43legacy_wldev *dev, u8 lpd) } loop_or = (loop << 8) | extern_lna_control; - if (phy->rev >= 7 && dev->dev->bus->sprom.r1.boardflags_lo + if (phy->rev >= 7 && dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_EXTLNA) { if (extern_lna_control) loop_or |= 0x8000; @@ -1550,7 +1550,7 @@ u16 b43legacy_radio_init2050(struct b43legacy_wldev *dev) b43legacy_get_812_value(dev, LPD(0, 1, 1))); if (phy->rev < 7 || - !(dev->dev->bus->sprom.r1.boardflags_lo + !(dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_EXTLNA)) b43legacy_phy_write(dev, 0x0811, 0x01B3); else @@ -1786,7 +1786,7 @@ int b43legacy_radio_selectchannel(struct b43legacy_wldev *dev, channel2freq_bg(channel)); if (channel == 14) { - if (dev->dev->bus->sprom.r1.country_code == 5) /* JAPAN) */ + if (dev->dev->bus->sprom.country_code == 5) /* JAPAN) */ b43legacy_shm_write32(dev, B43legacy_SHM_SHARED, B43legacy_UCODEFLAGS_OFFSET, b43legacy_shm_read32(dev, diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index 23496f45a4d..c24399dc0ed 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c @@ -379,7 +379,7 @@ static s8 b43legacy_rssi_postprocess(struct b43legacy_wldev *dev, else tmp -= 3; } else { - if (dev->dev->bus->sprom.r1.boardflags_lo + if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI) { if (in_rssi > 63) in_rssi = 63; -- cgit v1.2.3-70-g09d2 From c0ddd04d55e0a4d1506b6b8a4eb9e2b62f3aa41d Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Mon, 21 Jan 2008 13:41:18 -0500 Subject: wireless: cleanup some merge errors Signed-off-by: John W. Linville --- drivers/net/wireless/b43/xmit.c | 20 ++++++++++++++++++-- drivers/net/wireless/b43legacy/xmit.c | 20 ++++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/b43legacy/xmit.c') diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index a455a6beac4..e60e54d59ab 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c @@ -525,8 +525,24 @@ void b43_rx(struct b43_wldev *dev, struct sk_buff *skb, const void *_rxhdr) else status.rate = b43_plcp_get_bitrate_cck(plcp); status.antenna = !!(phystat0 & B43_RX_PHYST0_ANT); - status.mactime = mactime; - status.flag |= RX_FLAG_TSFT; + + /* + * If monitors are present get full 64-bit timestamp. This + * code assumes we get to process the packet within 16 bits + * of timestamp, i.e. about 65 milliseconds after the PHY + * received the first symbol. + */ + if (dev->wl->radiotap_enabled) { + u16 low_mactime_now; + + b43_tsf_read(dev, &status.mactime); + low_mactime_now = status.mactime; + status.mactime = status.mactime & ~0xFFFFULL; + status.mactime += mactime; + if (low_mactime_now <= mactime) + status.mactime -= 0x10000; + status.flag |= RX_FLAG_TSFT; + } chanid = (chanstat & B43_RX_CHAN_ID) >> B43_RX_CHAN_ID_SHIFT; switch (chanstat & B43_RX_CHAN_PHYTYPE) { diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index c24399dc0ed..fa095d43237 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c @@ -532,8 +532,24 @@ void b43legacy_rx(struct b43legacy_wldev *dev, else status.rate = b43legacy_plcp_get_bitrate_cck(plcp); status.antenna = !!(phystat0 & B43legacy_RX_PHYST0_ANT); - status.mactime = mactime; - status.flag |= RX_FLAG_TSFT; + + /* + * If monitors are present get full 64-bit timestamp. This + * code assumes we get to process the packet within 16 bits + * of timestamp, i.e. about 65 milliseconds after the PHY + * received the first symbol. + */ + if (dev->wl->radiotap_enabled) { + u16 low_mactime_now; + + b43legacy_tsf_read(dev, &status.mactime); + low_mactime_now = status.mactime; + status.mactime = status.mactime & ~0xFFFFULL; + status.mactime += mactime; + if (low_mactime_now <= mactime) + status.mactime -= 0x10000; + status.flag |= RX_FLAG_TSFT; + } chanid = (chanstat & B43legacy_RX_CHAN_ID) >> B43legacy_RX_CHAN_ID_SHIFT; -- cgit v1.2.3-70-g09d2 From 32bfd35d4b63bd63de4bb0d791ef049c3c868726 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Wed, 19 Dec 2007 01:31:26 +0100 Subject: mac80211: dont use interface indices in drivers This patch gets rid of the if_id stuff where possible in favour of a new per-virtual-interface structure "struct ieee80211_vif". This structure is located at the end of the per-interface structure and contains a variable length driver-use data area. This has two advantages: * removes the need to look up interfaces by if_id, this is better for working with network namespaces and performance * allows drivers to store and retrieve per-interface data without having to allocate own lists/hash tables Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- drivers/net/wireless/adm8211.c | 3 +- drivers/net/wireless/ath5k/base.c | 15 ++++--- drivers/net/wireless/ath5k/base.h | 2 +- drivers/net/wireless/ath5k/hw.c | 2 +- drivers/net/wireless/b43/b43.h | 5 +-- drivers/net/wireless/b43/main.c | 13 +++--- drivers/net/wireless/b43/xmit.c | 6 +-- drivers/net/wireless/b43legacy/b43legacy.h | 5 +-- drivers/net/wireless/b43legacy/main.c | 13 +++--- drivers/net/wireless/b43legacy/xmit.c | 6 +-- drivers/net/wireless/iwlwifi/iwl-3945.h | 2 +- drivers/net/wireless/iwlwifi/iwl-4965.h | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 28 ++++++------ drivers/net/wireless/iwlwifi/iwl4965-base.c | 28 ++++++------ drivers/net/wireless/p54common.c | 3 +- drivers/net/wireless/rt2x00/rt2x00.h | 5 ++- drivers/net/wireless/rt2x00/rt2x00mac.c | 5 ++- drivers/net/wireless/rtl8180.h | 2 +- drivers/net/wireless/rtl8180_dev.c | 11 +++-- drivers/net/wireless/rtl8187.h | 2 +- drivers/net/wireless/rtl8187_dev.c | 8 ++-- drivers/net/wireless/zd1211rw/zd_mac.c | 3 +- include/net/mac80211.h | 70 ++++++++++++++++++----------- net/mac80211/ieee80211.c | 12 ++--- net/mac80211/ieee80211_i.h | 8 ++++ net/mac80211/ieee80211_iface.c | 2 +- net/mac80211/sta_info.c | 27 ++++++++--- net/mac80211/tx.c | 46 +++++++++---------- net/mac80211/util.c | 45 +++++++------------ 29 files changed, 205 insertions(+), 174 deletions(-) (limited to 'drivers/net/wireless/b43legacy/xmit.c') diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index 14d90a9409a..79796186713 100644 --- a/drivers/net/wireless/adm8211.c +++ b/drivers/net/wireless/adm8211.c @@ -1312,7 +1312,8 @@ static int adm8211_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return 0; } -static int adm8211_config_interface(struct ieee80211_hw *dev, int if_id, +static int adm8211_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct adm8211_priv *priv = dev->priv; diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index d3d37282f3d..742616a03d5 100644 --- a/drivers/net/wireless/ath5k/base.c +++ b/drivers/net/wireless/ath5k/base.c @@ -178,7 +178,8 @@ static void ath5k_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf); static int ath5k_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); -static int ath5k_config_interface(struct ieee80211_hw *hw, int if_id, +static int ath5k_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf); static void ath5k_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, @@ -2498,12 +2499,12 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, int ret; mutex_lock(&sc->lock); - if (sc->iface_id) { + if (sc->vif) { ret = 0; goto end; } - sc->iface_id = conf->if_id; + sc->vif = conf->vif; switch (conf->type) { case IEEE80211_IF_TYPE_STA: @@ -2528,10 +2529,10 @@ ath5k_remove_interface(struct ieee80211_hw *hw, struct ath5k_softc *sc = hw->priv; mutex_lock(&sc->lock); - if (sc->iface_id != conf->if_id) + if (sc->vif != conf->vif) goto end; - sc->iface_id = 0; + sc->vif = NULL; end: mutex_unlock(&sc->lock); } @@ -2549,7 +2550,7 @@ ath5k_config(struct ieee80211_hw *hw, } static int -ath5k_config_interface(struct ieee80211_hw *hw, int if_id, +ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct ath5k_softc *sc = hw->priv; @@ -2560,7 +2561,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, int if_id, * be set to mac80211's value at ath5k_config(). */ sc->bintval = 1000 * 1000 / 1024; mutex_lock(&sc->lock); - if (sc->iface_id != if_id) { + if (sc->vif != vif) { ret = -EIO; goto unlock; } diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h index 927d67db3dc..7ba2223d224 100644 --- a/drivers/net/wireless/ath5k/base.h +++ b/drivers/net/wireless/ath5k/base.h @@ -123,7 +123,7 @@ struct ath5k_softc { unsigned int curmode; /* current phy mode */ struct ieee80211_channel *curchan; /* current h/w channel */ - int iface_id; /* add/remove_interface id */ + struct ieee80211_vif *vif; struct { u8 rxflags; /* radiotap rx flags */ diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c index 5623d7dc738..3b9336387df 100644 --- a/drivers/net/wireless/ath5k/hw.c +++ b/drivers/net/wireless/ath5k/hw.c @@ -533,7 +533,7 @@ static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah, * ieee80211_duration() for a brief description of * what rate we should choose to TX ACKs. */ tx_time = ieee80211_generic_frame_duration(sc->hw, - sc->iface_id, 10, control_rate->rate_kbps/100); + sc->vif, 10, control_rate->rate_kbps/100); ath5k_hw_reg_write(ah, tx_time, reg); diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 5a1a790a105..82bff51d559 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h @@ -625,10 +625,7 @@ struct b43_wl { * at a time. General information about this interface follows. */ - /* Opaque ID of the operating interface from the ieee80211 - * subsystem. Do not modify. - */ - int if_id; + struct ieee80211_vif *vif; /* The MAC address of the operating interface. */ u8 mac_addr[ETH_ALEN]; /* Current BSSID */ diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index ea63a992880..af3d24c559c 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c @@ -1169,7 +1169,7 @@ static void b43_write_probe_resp_plcp(struct b43_wldev *dev, plcp.data = 0; b43_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, size, + dev->wl->vif, size, B43_RATE_TO_BASE100KBPS(rate)); /* Write PLCP in two parts and timing for packet transfer */ tmp = le32_to_cpu(plcp.data); @@ -1226,7 +1226,7 @@ static u8 *b43_generate_probe_resp(struct b43_wldev *dev, hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, *dest_size, + dev->wl->vif, *dest_size, B43_RATE_TO_BASE100KBPS(rate)); hdr->duration_id = dur; @@ -2928,7 +2928,7 @@ static void b43_op_configure_filter(struct ieee80211_hw *hw, } static int b43_op_config_interface(struct ieee80211_hw *hw, - int if_id, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct b43_wl *wl = hw_to_b43_wl(hw); @@ -2939,7 +2939,7 @@ static int b43_op_config_interface(struct ieee80211_hw *hw, return -ENODEV; mutex_lock(&wl->mutex); spin_lock_irqsave(&wl->irq_lock, flags); - B43_WARN_ON(wl->if_id != if_id); + B43_WARN_ON(wl->vif != vif); if (conf->bssid) memcpy(wl->bssid, conf->bssid, ETH_ALEN); else @@ -3445,7 +3445,7 @@ static int b43_op_add_interface(struct ieee80211_hw *hw, dev = wl->current_dev; wl->operating = 1; - wl->if_id = conf->if_id; + wl->vif = conf->vif; wl->if_type = conf->type; memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); @@ -3473,7 +3473,8 @@ static void b43_op_remove_interface(struct ieee80211_hw *hw, mutex_lock(&wl->mutex); B43_WARN_ON(!wl->operating); - B43_WARN_ON(wl->if_id != conf->if_id); + B43_WARN_ON(wl->vif != conf->vif); + wl->vif = NULL; wl->operating = 0; diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 419aca1fc4f..5014213b775 100644 --- a/drivers/net/wireless/b43/xmit.c +++ b/drivers/net/wireless/b43/xmit.c @@ -221,7 +221,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, } else { int fbrate_base100kbps = B43_RATE_TO_BASE100KBPS(rate_fb); txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_len, fbrate_base100kbps); } @@ -312,7 +312,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { - ieee80211_ctstoself_get(dev->wl->hw, dev->wl->if_id, + ieee80211_ctstoself_get(dev->wl->hw, txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_cts *)(txhdr-> @@ -320,7 +320,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, mac_ctl |= B43_TX4_MAC_SENDCTS; len = sizeof(struct ieee80211_cts); } else { - ieee80211_rts_get(dev->wl->hw, dev->wl->if_id, + ieee80211_rts_get(dev->wl->hw, txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_rts *)(txhdr-> rts_frame)); diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index e4de437b789..8352a4e1cfc 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h @@ -577,10 +577,7 @@ struct b43legacy_wl { * at a time. General information about this interface follows. */ - /* Opaque ID of the operating interface from the ieee80211 - * subsystem. Do not modify. - */ - int if_id; + struct ieee80211_vif *vif; /* MAC address (can be NULL). */ u8 mac_addr[ETH_ALEN]; /* Current BSSID (can be NULL). */ diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 575fd9a5874..2d5735ddad8 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c @@ -976,7 +976,7 @@ static void b43legacy_write_probe_resp_plcp(struct b43legacy_wldev *dev, plcp.data = 0; b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + dev->wl->vif, size, B43legacy_RATE_TO_100KBPS(rate)); /* Write PLCP in two parts and timing for packet transfer */ @@ -1042,7 +1042,7 @@ static u8 *b43legacy_generate_probe_resp(struct b43legacy_wldev *dev, hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP); dur = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + dev->wl->vif, *dest_size, B43legacy_RATE_TO_100KBPS(rate)); hdr->duration_id = dur; @@ -2647,7 +2647,7 @@ static void b43legacy_op_configure_filter(struct ieee80211_hw *hw, } static int b43legacy_op_config_interface(struct ieee80211_hw *hw, - int if_id, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); @@ -2658,7 +2658,7 @@ static int b43legacy_op_config_interface(struct ieee80211_hw *hw, return -ENODEV; mutex_lock(&wl->mutex); spin_lock_irqsave(&wl->irq_lock, flags); - B43legacy_WARN_ON(wl->if_id != if_id); + B43legacy_WARN_ON(wl->vif != vif); if (conf->bssid) memcpy(wl->bssid, conf->bssid, ETH_ALEN); else @@ -3177,7 +3177,7 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw, dev = wl->current_dev; wl->operating = 1; - wl->if_id = conf->if_id; + wl->vif = conf->vif; wl->if_type = conf->type; memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); @@ -3205,7 +3205,8 @@ static void b43legacy_op_remove_interface(struct ieee80211_hw *hw, mutex_lock(&wl->mutex); B43legacy_WARN_ON(!wl->operating); - B43legacy_WARN_ON(wl->if_id != conf->if_id); + B43legacy_WARN_ON(wl->vif != conf->vif); + wl->vif = NULL; wl->operating = 0; diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index fa095d43237..e20c552442d 100644 --- a/drivers/net/wireless/b43legacy/xmit.c +++ b/drivers/net/wireless/b43legacy/xmit.c @@ -223,7 +223,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, } else { int fbrate_base100kbps = B43legacy_RATE_TO_100KBPS(rate_fb); txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_len, fbrate_base100kbps); } @@ -312,7 +312,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { ieee80211_ctstoself_get(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_cts *) @@ -321,7 +321,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, len = sizeof(struct ieee80211_cts); } else { ieee80211_rts_get(dev->wl->hw, - dev->wl->if_id, + txctl->vif, fragment_data, fragment_len, txctl, (struct ieee80211_rts *) (txhdr->rts_frame)); diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index e97f1fb48b9..20b925f57e3 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h @@ -863,7 +863,7 @@ struct iwl3945_priv { u32 timestamp1; u16 beacon_int; struct iwl3945_driver_hw_info hw_setting; - int interface_id; + struct ieee80211_vif *vif; /* Current association information needed to configure the * hardware */ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 241f4448a4a..aad7f70bab7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h @@ -1212,7 +1212,7 @@ struct iwl4965_priv { u32 timestamp1; u16 beacon_int; struct iwl4965_driver_hw_info hw_setting; - int interface_id; + struct ieee80211_vif *vif; /* Current association information needed to configure the * hardware */ diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b662ff3b914..1830e13d5cf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c @@ -2767,8 +2767,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, goto drop_unlock; } - if (!priv->interface_id) { - IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); + if (!priv->vif) { + IWL_DEBUG_DROP("Dropping - !priv->vif\n"); goto drop_unlock; } @@ -3549,7 +3549,7 @@ static void iwl3945_bg_beacon_update(struct work_struct *work) struct sk_buff *beacon; /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ - beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); + beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); if (!beacon) { IWL_ERROR("update beacon failed\n"); @@ -6780,7 +6780,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data) mutex_lock(&priv->mutex); - if (!priv->interface_id || !priv->is_open) { + if (!priv->vif || !priv->is_open) { mutex_unlock(&priv->mutex); return; } @@ -6981,15 +6981,15 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, unsigned long flags; DECLARE_MAC_BUF(mac); - IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); + IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); - if (priv->interface_id) { - IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); + if (priv->vif) { + IWL_DEBUG_MAC80211("leave - vif != NULL\n"); return -EOPNOTSUPP; } spin_lock_irqsave(&priv->lock, flags); - priv->interface_id = conf->if_id; + priv->vif = conf->vif; spin_unlock_irqrestore(&priv->lock, flags); @@ -7157,7 +7157,8 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv) * clear sta table, add BCAST sta... */ } -static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, +static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct iwl3945_priv *priv = hw->priv; @@ -7179,7 +7180,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, mutex_lock(&priv->mutex); - IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); if (conf->bssid) IWL_DEBUG_MAC80211("bssid: %s\n", print_mac(mac, conf->bssid)); @@ -7196,8 +7196,8 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, return 0; } - if (priv->interface_id != if_id) { - IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); + if (priv->vif != vif) { + IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); mutex_unlock(&priv->mutex); return 0; } @@ -7295,8 +7295,8 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; iwl3945_commit_rxon(priv); } - if (priv->interface_id == conf->if_id) { - priv->interface_id = 0; + if (priv->vif == conf->vif) { + priv->vif = NULL; memset(priv->bssid, 0, ETH_ALEN); memset(priv->essid, 0, IW_ESSID_MAX_SIZE); priv->essid_len = 0; diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index ce0574b087f..52eb37f4ac7 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -2897,8 +2897,8 @@ static int iwl4965_tx_skb(struct iwl4965_priv *priv, goto drop_unlock; } - if (!priv->interface_id) { - IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); + if (!priv->vif) { + IWL_DEBUG_DROP("Dropping - !priv->vif\n"); goto drop_unlock; } @@ -3893,7 +3893,7 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) struct sk_buff *beacon; /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ - beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); + beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); if (!beacon) { IWL_ERROR("update beacon failed\n"); @@ -7214,7 +7214,7 @@ static void iwl4965_bg_post_associate(struct work_struct *data) mutex_lock(&priv->mutex); - if (!priv->interface_id || !priv->is_open) { + if (!priv->vif || !priv->is_open) { mutex_unlock(&priv->mutex); return; } @@ -7425,15 +7425,15 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, unsigned long flags; DECLARE_MAC_BUF(mac); - IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); + IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); - if (priv->interface_id) { - IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); + if (priv->vif) { + IWL_DEBUG_MAC80211("leave - vif != NULL\n"); return 0; } spin_lock_irqsave(&priv->lock, flags); - priv->interface_id = conf->if_id; + priv->vif = conf->vif; spin_unlock_irqrestore(&priv->lock, flags); @@ -7617,7 +7617,8 @@ static void iwl4965_config_ap(struct iwl4965_priv *priv) * clear sta table, add BCAST sta... */ } -static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, +static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct iwl4965_priv *priv = hw->priv; @@ -7637,7 +7638,6 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, mutex_lock(&priv->mutex); - IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); if (conf->bssid) IWL_DEBUG_MAC80211("bssid: %s\n", print_mac(mac, conf->bssid)); @@ -7654,8 +7654,8 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, return 0; } - if (priv->interface_id != if_id) { - IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); + if (priv->vif != vif) { + IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); mutex_unlock(&priv->mutex); return 0; } @@ -7753,8 +7753,8 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; iwl4965_commit_rxon(priv); } - if (priv->interface_id == conf->if_id) { - priv->interface_id = 0; + if (priv->vif == conf->vif) { + priv->vif = NULL; memset(priv->bssid, 0, ETH_ALEN); memset(priv->essid, 0, IW_ESSID_MAX_SIZE); priv->essid_len = 0; diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c index 9660fdd873a..5cda49aff3a 100644 --- a/drivers/net/wireless/p54common.c +++ b/drivers/net/wireless/p54common.c @@ -854,7 +854,8 @@ static int p54_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return ret; } -static int p54_config_interface(struct ieee80211_hw *dev, int if_id, +static int p54_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct p54_common *priv = dev->priv; diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 5fb9734ade8..94a8a7ce538 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h @@ -372,7 +372,7 @@ struct interface { * to us by the 80211 stack, and is used to request * new beacons. */ - int id; + struct ieee80211_vif *id; /* * Current working type (IEEE80211_IF_TYPE_*). @@ -929,7 +929,8 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, void rt2x00mac_remove_interface(struct ieee80211_hw *hw, struct ieee80211_if_init_conf *conf); int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); -int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, +int rt2x00mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf); int rt2x00mac_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats); diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index e99d167d7df..1d67bcd46bc 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c @@ -181,7 +181,7 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, is_interface_present(intf)) return -ENOBUFS; - intf->id = conf->if_id; + intf->id = conf->vif; intf->type = conf->type; if (conf->type == IEEE80211_IF_TYPE_AP) memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN); @@ -265,7 +265,8 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) } EXPORT_SYMBOL_GPL(rt2x00mac_config); -int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, +int rt2x00mac_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct rt2x00_dev *rt2x00dev = hw->priv; diff --git a/drivers/net/wireless/rtl8180.h b/drivers/net/wireless/rtl8180.h index 0b333cacbd8..2cbfe3c8081 100644 --- a/drivers/net/wireless/rtl8180.h +++ b/drivers/net/wireless/rtl8180.h @@ -90,8 +90,8 @@ struct rtl8180_priv { /* common between rtl818x drivers */ struct rtl818x_csr __iomem *map; const struct rtl818x_rf_ops *rf; + struct ieee80211_vif *vif; int mode; - int if_id; /* rtl8180 driver specific */ spinlock_t lock; diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c index 4b7b032c194..07f37b0ccf9 100644 --- a/drivers/net/wireless/rtl8180_dev.c +++ b/drivers/net/wireless/rtl8180_dev.c @@ -236,7 +236,8 @@ static int rtl8180_tx(struct ieee80211_hw *dev, struct sk_buff *skb, kmemdup(control, sizeof(*control), GFP_ATOMIC); if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) - rts_duration = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); + rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, + control); if (!priv->r8185) { unsigned int remainder; @@ -638,6 +639,8 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev, return -EOPNOTSUPP; } + priv->vif = conf->vif; + rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], cpu_to_le32(*(u32 *)conf->mac_addr)); @@ -653,6 +656,7 @@ static void rtl8180_remove_interface(struct ieee80211_hw *dev, { struct rtl8180_priv *priv = dev->priv; priv->mode = IEEE80211_IF_TYPE_MNTR; + priv->vif = NULL; } static int rtl8180_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) @@ -664,14 +668,13 @@ static int rtl8180_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return 0; } -static int rtl8180_config_interface(struct ieee80211_hw *dev, int if_id, +static int rtl8180_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct rtl8180_priv *priv = dev->priv; int i; - priv->if_id = if_id; - for (i = 0; i < ETH_ALEN; i++) rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); diff --git a/drivers/net/wireless/rtl8187.h b/drivers/net/wireless/rtl8187.h index 26a4f1097b4..8680a0b6433 100644 --- a/drivers/net/wireless/rtl8187.h +++ b/drivers/net/wireless/rtl8187.h @@ -65,8 +65,8 @@ struct rtl8187_priv { /* common between rtl818x drivers */ struct rtl818x_csr *map; const struct rtl818x_rf_ops *rf; + struct ieee80211_vif *vif; int mode; - int if_id; /* rtl8187 specific */ struct ieee80211_channel channels[14]; diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index 8dab25a6599..0d71716d750 100644 --- a/drivers/net/wireless/rtl8187_dev.c +++ b/drivers/net/wireless/rtl8187_dev.c @@ -150,7 +150,8 @@ static int rtl8187_tx(struct ieee80211_hw *dev, struct sk_buff *skb, flags |= RTL8187_TX_FLAG_MORE_FRAG; if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { flags |= RTL8187_TX_FLAG_RTS; - rts_dur = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); + rts_dur = ieee80211_rts_duration(dev, priv->vif, + skb->len, control); } if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) flags |= RTL8187_TX_FLAG_CTS; @@ -560,14 +561,13 @@ static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) return 0; } -static int rtl8187_config_interface(struct ieee80211_hw *dev, int if_id, +static int rtl8187_config_interface(struct ieee80211_hw *dev, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct rtl8187_priv *priv = dev->priv; int i; - priv->if_id = if_id; - for (i = 0; i < ETH_ALEN; i++) rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 7b869305048..3409cf97f5f 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -733,7 +733,8 @@ static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) return zd_chip_set_channel(&mac->chip, conf->channel); } -static int zd_op_config_interface(struct ieee80211_hw *hw, int if_id, +static int zd_op_config_interface(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_if_conf *conf) { struct zd_mac *mac = zd_hw_mac(hw); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index be2a383b477..24a8ad3f507 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -280,6 +280,7 @@ struct ieee80211_low_level_stats { * the hardware to use given values (depending on what is supported). */ struct ieee80211_tx_control { + struct ieee80211_vif *vif; int tx_rate; /* Transmit rate, given as the hw specific value for the * rate (from struct ieee80211_rate) */ int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw @@ -332,7 +333,6 @@ struct ieee80211_tx_control { * packet dropping when probing higher rates, if hw * supports multiple retry rates. -1 = not used */ int type; /* internal */ - int ifindex; /* internal */ }; @@ -529,14 +529,26 @@ enum ieee80211_if_types { IEEE80211_IF_TYPE_VLAN, }; +/** + * struct ieee80211_vif - per-interface data + * + * Data in this structure is continually present for driver + * use during the life of a virtual interface. + * + * @drv_priv: data area for driver use, will always be aligned to + * sizeof(void *). + */ +struct ieee80211_vif { + /* must be last */ + u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); +}; + /** * struct ieee80211_if_init_conf - initial configuration of an interface * - * @if_id: internal interface ID. This number has no particular meaning to - * drivers and the only allowed usage is to pass it to - * ieee80211_beacon_get() and ieee80211_get_buffered_bc() functions. - * This field is not valid for monitor interfaces - * (interfaces of %IEEE80211_IF_TYPE_MNTR type). + * @vif: pointer to a driver-use per-interface structure. The pointer + * itself is also used for various functions including + * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). * @type: one of &enum ieee80211_if_types constants. Determines the type of * added/removed interface. * @mac_addr: pointer to MAC address of the interface. This pointer is valid @@ -553,8 +565,8 @@ enum ieee80211_if_types { * in pure monitor mode. */ struct ieee80211_if_init_conf { - int if_id; enum ieee80211_if_types type; + struct ieee80211_vif *vif; void *mac_addr; }; @@ -757,6 +769,9 @@ enum ieee80211_hw_flags { * @rate_control_algorithm: rate control algorithm for this hardware. * If unset (NULL), the default algorithm will be used. Must be * set before calling ieee80211_register_hw(). + * + * @vif_data_size: size (in bytes) of the drv_priv data area + * within &struct ieee80211_vif. */ struct ieee80211_hw { struct ieee80211_conf conf; @@ -767,6 +782,7 @@ struct ieee80211_hw { u32 flags; unsigned int extra_tx_headroom; int channel_change_time; + int vif_data_size; u8 queues; s8 max_rssi; s8 max_signal; @@ -1076,7 +1092,8 @@ struct ieee80211_ops { struct ieee80211_if_init_conf *conf); int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); int (*config_interface)(struct ieee80211_hw *hw, - int if_id, struct ieee80211_if_conf *conf); + struct ieee80211_vif *vif, + struct ieee80211_if_conf *conf); void (*configure_filter)(struct ieee80211_hw *hw, unsigned int changed_flags, unsigned int *total_flags, @@ -1094,7 +1111,7 @@ struct ieee80211_ops { int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); int (*set_retry_limit)(struct ieee80211_hw *hw, u32 short_retry, u32 long_retr); - void (*sta_notify)(struct ieee80211_hw *hw, int if_id, + void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, enum sta_notify_cmd, const u8 *addr); void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, int cts_protection, int preamble); @@ -1309,7 +1326,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, /** * ieee80211_beacon_get - beacon generation function * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @control: will be filled with information needed to send this beacon. * * If the beacon frames are generated by the host system (i.e., not in @@ -1320,13 +1337,13 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, * is responsible of freeing it. */ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, - int if_id, + struct ieee80211_vif *vif, struct ieee80211_tx_control *control); /** * ieee80211_rts_get - RTS frame generation function * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame: pointer to the frame that is going to be protected by the RTS. * @frame_len: the frame length (in octets). * @frame_txctl: &struct ieee80211_tx_control of the frame. @@ -1337,7 +1354,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, * the next RTS frame from the 802.11 code. The low-level is responsible * for calling this function before and RTS frame is needed. */ -void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_rts *rts); @@ -1345,7 +1362,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, /** * ieee80211_rts_duration - Get the duration field for an RTS frame * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame_len: the length of the frame that is going to be protected by the RTS. * @frame_txctl: &struct ieee80211_tx_control of the frame. * @@ -1353,14 +1370,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, * the duration field, the low-level driver uses this function to receive * the duration field value in little-endian byteorder. */ -__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, - size_t frame_len, +__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl); /** * ieee80211_ctstoself_get - CTS-to-self frame generation function * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame: pointer to the frame that is going to be protected by the CTS-to-self. * @frame_len: the frame length (in octets). * @frame_txctl: &struct ieee80211_tx_control of the frame. @@ -1371,7 +1388,8 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, * the next CTS-to-self frame from the 802.11 code. The low-level is responsible * for calling this function before and CTS-to-self frame is needed. */ -void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_ctstoself_get(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_cts *cts); @@ -1379,7 +1397,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, /** * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. * @frame_txctl: &struct ieee80211_tx_control of the frame. * @@ -1387,28 +1405,30 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, * the duration field, the low-level driver uses this function to receive * the duration field value in little-endian byteorder. */ -__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl); /** * ieee80211_generic_frame_duration - Calculate the duration field for a frame * @hw: pointer obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @frame_len: the length of the frame. * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. * * Calculate the duration field of some generic frame, given its * length and transmission rate (in 100kbps). */ -__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, int rate); /** * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames * @hw: pointer as obtained from ieee80211_alloc_hw(). - * @if_id: interface ID from &struct ieee80211_if_init_conf. + * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. * @control: will be filled with information needed to send returned frame. * * Function for accessing buffered broadcast and multicast frames. If @@ -1427,7 +1447,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, * use common code for all beacons. */ struct sk_buff * -ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, +ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_tx_control *control); /** @@ -1517,7 +1537,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw); */ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, void (*iterator)(void *data, u8 *mac, - int if_id), + struct ieee80211_vif *vif), void *data); #endif /* MAC80211_H */ diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 4807e5215a7..42c27089f00 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c @@ -243,7 +243,7 @@ static int ieee80211_open(struct net_device *dev) sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; /* fall through */ default: - conf.if_id = dev->ifindex; + conf.vif = &sdata->vif; conf.type = sdata->type; conf.mac_addr = dev->dev_addr; res = local->ops->add_interface(local_to_hw(local), &conf); @@ -378,7 +378,7 @@ static int ieee80211_stop(struct net_device *dev) sdata->u.sta.extra_ie_len = 0; /* fall through */ default: - conf.if_id = dev->ifindex; + conf.vif = &sdata->vif; conf.type = sdata->type; conf.mac_addr = dev->dev_addr; /* disable all keys for as long as this netdev is down */ @@ -515,7 +515,7 @@ static int __ieee80211_if_config(struct net_device *dev, conf.beacon_control = control; } return local->ops->config_interface(local_to_hw(local), - dev->ifindex, &conf); + &sdata->vif, &conf); } int ieee80211_if_config(struct net_device *dev) @@ -527,11 +527,13 @@ int ieee80211_if_config_beacon(struct net_device *dev) { struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_tx_control control; + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct sk_buff *skb; if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) return 0; - skb = ieee80211_beacon_get(local_to_hw(local), dev->ifindex, &control); + skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif, + &control); if (!skb) return -ENOMEM; return __ieee80211_if_config(dev, skb, &control); @@ -736,7 +738,7 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local, struct ieee80211_tx_packet_data *pkt_data; pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; - pkt_data->ifindex = control->ifindex; + pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex; pkt_data->flags = 0; if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index b898b316bda..c551a7f379e 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -387,8 +387,16 @@ struct ieee80211_sub_if_data { struct dentry *default_key; } debugfs; #endif + /* must be last, dynamically sized area in this! */ + struct ieee80211_vif vif; }; +static inline +struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) +{ + return container_of(p, struct ieee80211_sub_if_data, vif); +} + #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev) enum { diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c index 7cfd8660b23..b7206637880 100644 --- a/net/mac80211/ieee80211_iface.c +++ b/net/mac80211/ieee80211_iface.c @@ -47,7 +47,7 @@ int ieee80211_if_add(struct net_device *dev, const char *name, int ret; ASSERT_RTNL(); - ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), + ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, name, ieee80211_if_setup); if (!ndev) return -ENOMEM; diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 1257c7aab2a..32e24176472 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -177,9 +177,16 @@ struct sta_info * sta_info_add(struct ieee80211_local *local, list_add(&sta->list, &local->sta_list); local->num_sta++; sta_info_hash_add(local, sta); - if (local->ops->sta_notify) - local->ops->sta_notify(local_to_hw(local), dev->ifindex, - STA_NOTIFY_ADD, addr); + if (local->ops->sta_notify) { + struct ieee80211_sub_if_data *sdata; + + sdata = IEEE80211_DEV_TO_SUB_IF(dev); + if (sdata->type == IEEE80211_IF_TYPE_VLAN) + sdata = sdata->u.vlan.ap; + + local->ops->sta_notify(local_to_hw(local), &sdata->vif, + STA_NOTIFY_ADD, addr); + } write_unlock_bh(&local->sta_lock); #ifdef CONFIG_MAC80211_VERBOSE_DEBUG @@ -247,9 +254,17 @@ void sta_info_free(struct sta_info *sta) ieee80211_key_free(sta->key); sta->key = NULL; - if (local->ops->sta_notify) - local->ops->sta_notify(local_to_hw(local), sta->dev->ifindex, - STA_NOTIFY_REMOVE, sta->addr); + if (local->ops->sta_notify) { + struct ieee80211_sub_if_data *sdata; + + sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); + + if (sdata->type == IEEE80211_IF_TYPE_VLAN) + sdata = sdata->u.vlan.ap; + + local->ops->sta_notify(local_to_hw(local), &sdata->vif, + STA_NOTIFY_REMOVE, sta->addr); + } rate_control_remove_sta_debugfs(sta); ieee80211_sta_debugfs_remove(sta); diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index f6194167253..1b772ee2fe1 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -999,9 +999,7 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, return TXRX_CONTINUE; } -/* Device in tx->dev has a reference added; use dev_put(tx->dev) when - * finished with it. - * +/* * NB: @tx is uninitialised when passed in here */ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, @@ -1022,6 +1020,7 @@ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, return -ENODEV; /* initialises tx with control */ __ieee80211_tx_prepare(tx, skb, dev, control); + dev_put(dev); return 0; } @@ -1252,7 +1251,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, } } - control.ifindex = odev->ifindex; + control.vif = &osdata->vif; control.type = osdata->type; if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS) control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS; @@ -1691,7 +1690,8 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local, read_unlock_bh(&local->sta_lock); } -struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, +struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_tx_control *control) { struct ieee80211_local *local = hw_to_local(hw); @@ -1703,19 +1703,16 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, u8 *b_head, *b_tail; int bh_len, bt_len; - bdev = dev_get_by_index(&init_net, if_id); - if (bdev) { - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); - ap = &sdata->u.ap; - dev_put(bdev); - } + sdata = vif_to_sdata(vif); + bdev = sdata->dev; + ap = &sdata->u.ap; if (!ap || sdata->type != IEEE80211_IF_TYPE_AP || !ap->beacon_head) { #ifdef CONFIG_MAC80211_VERBOSE_DEBUG if (net_ratelimit()) - printk(KERN_DEBUG "no beacon data avail for idx=%d " - "(%s)\n", if_id, bdev ? bdev->name : "N/A"); + printk(KERN_DEBUG "no beacon data avail for %s\n", + bdev->name); #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ return NULL; } @@ -1771,7 +1768,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, } EXPORT_SYMBOL(ieee80211_beacon_get); -void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_rts *rts) @@ -1781,13 +1778,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS; rts->frame_control = cpu_to_le16(fctl); - rts->duration = ieee80211_rts_duration(hw, if_id, frame_len, frame_txctl); + rts->duration = ieee80211_rts_duration(hw, vif, frame_len, + frame_txctl); memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); } EXPORT_SYMBOL(ieee80211_rts_get); -void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, +void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const void *frame, size_t frame_len, const struct ieee80211_tx_control *frame_txctl, struct ieee80211_cts *cts) @@ -1797,13 +1795,15 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS; cts->frame_control = cpu_to_le16(fctl); - cts->duration = ieee80211_ctstoself_duration(hw, if_id, frame_len, frame_txctl); + cts->duration = ieee80211_ctstoself_duration(hw, vif, + frame_len, frame_txctl); memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); } EXPORT_SYMBOL(ieee80211_ctstoself_get); struct sk_buff * -ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, +ieee80211_get_buffered_bc(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, struct ieee80211_tx_control *control) { struct ieee80211_local *local = hw_to_local(hw); @@ -1816,12 +1816,9 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, struct ieee80211_sub_if_data *sdata; struct ieee80211_if_ap *bss = NULL; - bdev = dev_get_by_index(&init_net, if_id); - if (bdev) { - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); - bss = &sdata->u.ap; - dev_put(bdev); - } + sdata = vif_to_sdata(vif); + bdev = sdata->dev; + if (!bss || sdata->type != IEEE80211_IF_TYPE_AP || !bss->beacon_head) return NULL; @@ -1857,7 +1854,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, if (res == TXRX_DROP || res == TXRX_QUEUED) break; } - dev_put(tx.dev); skb = tx.skb; /* handlers are allowed to change skb */ if (res == TXRX_DROP) { diff --git a/net/mac80211/util.c b/net/mac80211/util.c index adb85dd5098..15503ca3e94 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -302,44 +302,34 @@ int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, } /* Exported duration function for driver use */ -__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, int rate) { struct ieee80211_local *local = hw_to_local(hw); - struct net_device *bdev = dev_get_by_index(&init_net, if_id); - struct ieee80211_sub_if_data *sdata; + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); u16 dur; int erp; - if (unlikely(!bdev)) - return 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); dur = ieee80211_frame_duration(local, frame_len, rate, erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); - dev_put(bdev); return cpu_to_le16(dur); } EXPORT_SYMBOL(ieee80211_generic_frame_duration); -__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, - size_t frame_len, +__le16 ieee80211_rts_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl) { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_rate *rate; - struct net_device *bdev = dev_get_by_index(&init_net, if_id); - struct ieee80211_sub_if_data *sdata; + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); int short_preamble; int erp; u16 dur; - if (unlikely(!bdev)) - return 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; rate = frame_txctl->rts_rate; @@ -355,27 +345,22 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, dur += ieee80211_frame_duration(local, 10, rate->rate, erp, short_preamble); - dev_put(bdev); return cpu_to_le16(dur); } EXPORT_SYMBOL(ieee80211_rts_duration); -__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, +__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, size_t frame_len, const struct ieee80211_tx_control *frame_txctl) { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_rate *rate; - struct net_device *bdev = dev_get_by_index(&init_net, if_id); - struct ieee80211_sub_if_data *sdata; + struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); int short_preamble; int erp; u16 dur; - if (unlikely(!bdev)) - return 0; - - sdata = IEEE80211_DEV_TO_SUB_IF(bdev); short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; rate = frame_txctl->rts_rate; @@ -390,7 +375,6 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, erp, short_preamble); } - dev_put(bdev); return cpu_to_le16(dur); } EXPORT_SYMBOL(ieee80211_ctstoself_duration); @@ -475,10 +459,11 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw) } EXPORT_SYMBOL(ieee80211_wake_queues); -void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, - void (*iterator)(void *data, u8 *mac, - int if_id), - void *data) +void ieee80211_iterate_active_interfaces( + struct ieee80211_hw *hw, + void (*iterator)(void *data, u8 *mac, + struct ieee80211_vif *vif), + void *data) { struct ieee80211_local *local = hw_to_local(hw); struct ieee80211_sub_if_data *sdata; @@ -501,7 +486,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, continue; if (netif_running(sdata->dev)) iterator(data, sdata->dev->dev_addr, - sdata->dev->ifindex); + &sdata->vif); } rcu_read_unlock(); -- cgit v1.2.3-70-g09d2