diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2007-12-18 19:31:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:36 -0500 |
commit | 32bfd35d4b63bd63de4bb0d791ef049c3c868726 (patch) | |
tree | c1c213a35a00bcbe71a2ecc6521e19dec66cf6eb | |
parent | f653211197f3841f383fa9757ef8ce182c6cf627 (diff) |
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 <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
29 files changed, 205 insertions, 174 deletions
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c index 14d90a9409aa..79796186713e 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) | |||
1312 | return 0; | 1312 | return 0; |
1313 | } | 1313 | } |
1314 | 1314 | ||
1315 | static int adm8211_config_interface(struct ieee80211_hw *dev, int if_id, | 1315 | static int adm8211_config_interface(struct ieee80211_hw *dev, |
1316 | struct ieee80211_vif *vif, | ||
1316 | struct ieee80211_if_conf *conf) | 1317 | struct ieee80211_if_conf *conf) |
1317 | { | 1318 | { |
1318 | struct adm8211_priv *priv = dev->priv; | 1319 | struct adm8211_priv *priv = dev->priv; |
diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c index d3d37282f3dc..742616a03d5f 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, | |||
178 | struct ieee80211_if_init_conf *conf); | 178 | struct ieee80211_if_init_conf *conf); |
179 | static int ath5k_config(struct ieee80211_hw *hw, | 179 | static int ath5k_config(struct ieee80211_hw *hw, |
180 | struct ieee80211_conf *conf); | 180 | struct ieee80211_conf *conf); |
181 | static int ath5k_config_interface(struct ieee80211_hw *hw, int if_id, | 181 | static int ath5k_config_interface(struct ieee80211_hw *hw, |
182 | struct ieee80211_vif *vif, | ||
182 | struct ieee80211_if_conf *conf); | 183 | struct ieee80211_if_conf *conf); |
183 | static void ath5k_configure_filter(struct ieee80211_hw *hw, | 184 | static void ath5k_configure_filter(struct ieee80211_hw *hw, |
184 | unsigned int changed_flags, | 185 | unsigned int changed_flags, |
@@ -2498,12 +2499,12 @@ static int ath5k_add_interface(struct ieee80211_hw *hw, | |||
2498 | int ret; | 2499 | int ret; |
2499 | 2500 | ||
2500 | mutex_lock(&sc->lock); | 2501 | mutex_lock(&sc->lock); |
2501 | if (sc->iface_id) { | 2502 | if (sc->vif) { |
2502 | ret = 0; | 2503 | ret = 0; |
2503 | goto end; | 2504 | goto end; |
2504 | } | 2505 | } |
2505 | 2506 | ||
2506 | sc->iface_id = conf->if_id; | 2507 | sc->vif = conf->vif; |
2507 | 2508 | ||
2508 | switch (conf->type) { | 2509 | switch (conf->type) { |
2509 | case IEEE80211_IF_TYPE_STA: | 2510 | case IEEE80211_IF_TYPE_STA: |
@@ -2528,10 +2529,10 @@ ath5k_remove_interface(struct ieee80211_hw *hw, | |||
2528 | struct ath5k_softc *sc = hw->priv; | 2529 | struct ath5k_softc *sc = hw->priv; |
2529 | 2530 | ||
2530 | mutex_lock(&sc->lock); | 2531 | mutex_lock(&sc->lock); |
2531 | if (sc->iface_id != conf->if_id) | 2532 | if (sc->vif != conf->vif) |
2532 | goto end; | 2533 | goto end; |
2533 | 2534 | ||
2534 | sc->iface_id = 0; | 2535 | sc->vif = NULL; |
2535 | end: | 2536 | end: |
2536 | mutex_unlock(&sc->lock); | 2537 | mutex_unlock(&sc->lock); |
2537 | } | 2538 | } |
@@ -2549,7 +2550,7 @@ ath5k_config(struct ieee80211_hw *hw, | |||
2549 | } | 2550 | } |
2550 | 2551 | ||
2551 | static int | 2552 | static int |
2552 | ath5k_config_interface(struct ieee80211_hw *hw, int if_id, | 2553 | ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
2553 | struct ieee80211_if_conf *conf) | 2554 | struct ieee80211_if_conf *conf) |
2554 | { | 2555 | { |
2555 | struct ath5k_softc *sc = hw->priv; | 2556 | struct ath5k_softc *sc = hw->priv; |
@@ -2560,7 +2561,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, int if_id, | |||
2560 | * be set to mac80211's value at ath5k_config(). */ | 2561 | * be set to mac80211's value at ath5k_config(). */ |
2561 | sc->bintval = 1000 * 1000 / 1024; | 2562 | sc->bintval = 1000 * 1000 / 1024; |
2562 | mutex_lock(&sc->lock); | 2563 | mutex_lock(&sc->lock); |
2563 | if (sc->iface_id != if_id) { | 2564 | if (sc->vif != vif) { |
2564 | ret = -EIO; | 2565 | ret = -EIO; |
2565 | goto unlock; | 2566 | goto unlock; |
2566 | } | 2567 | } |
diff --git a/drivers/net/wireless/ath5k/base.h b/drivers/net/wireless/ath5k/base.h index 927d67db3dc2..7ba2223d2247 100644 --- a/drivers/net/wireless/ath5k/base.h +++ b/drivers/net/wireless/ath5k/base.h | |||
@@ -123,7 +123,7 @@ struct ath5k_softc { | |||
123 | unsigned int curmode; /* current phy mode */ | 123 | unsigned int curmode; /* current phy mode */ |
124 | struct ieee80211_channel *curchan; /* current h/w channel */ | 124 | struct ieee80211_channel *curchan; /* current h/w channel */ |
125 | 125 | ||
126 | int iface_id; /* add/remove_interface id */ | 126 | struct ieee80211_vif *vif; |
127 | 127 | ||
128 | struct { | 128 | struct { |
129 | u8 rxflags; /* radiotap rx flags */ | 129 | u8 rxflags; /* radiotap rx flags */ |
diff --git a/drivers/net/wireless/ath5k/hw.c b/drivers/net/wireless/ath5k/hw.c index 5623d7dc738e..3b9336387df0 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, | |||
533 | * ieee80211_duration() for a brief description of | 533 | * ieee80211_duration() for a brief description of |
534 | * what rate we should choose to TX ACKs. */ | 534 | * what rate we should choose to TX ACKs. */ |
535 | tx_time = ieee80211_generic_frame_duration(sc->hw, | 535 | tx_time = ieee80211_generic_frame_duration(sc->hw, |
536 | sc->iface_id, 10, control_rate->rate_kbps/100); | 536 | sc->vif, 10, control_rate->rate_kbps/100); |
537 | 537 | ||
538 | ath5k_hw_reg_write(ah, tx_time, reg); | 538 | ath5k_hw_reg_write(ah, tx_time, reg); |
539 | 539 | ||
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index 5a1a790a105b..82bff51d5595 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -625,10 +625,7 @@ struct b43_wl { | |||
625 | * at a time. General information about this interface follows. | 625 | * at a time. General information about this interface follows. |
626 | */ | 626 | */ |
627 | 627 | ||
628 | /* Opaque ID of the operating interface from the ieee80211 | 628 | struct ieee80211_vif *vif; |
629 | * subsystem. Do not modify. | ||
630 | */ | ||
631 | int if_id; | ||
632 | /* The MAC address of the operating interface. */ | 629 | /* The MAC address of the operating interface. */ |
633 | u8 mac_addr[ETH_ALEN]; | 630 | u8 mac_addr[ETH_ALEN]; |
634 | /* Current BSSID */ | 631 | /* Current BSSID */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index ea63a9928803..af3d24c559c0 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, | |||
1169 | plcp.data = 0; | 1169 | plcp.data = 0; |
1170 | b43_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); | 1170 | b43_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); |
1171 | dur = ieee80211_generic_frame_duration(dev->wl->hw, | 1171 | dur = ieee80211_generic_frame_duration(dev->wl->hw, |
1172 | dev->wl->if_id, size, | 1172 | dev->wl->vif, size, |
1173 | B43_RATE_TO_BASE100KBPS(rate)); | 1173 | B43_RATE_TO_BASE100KBPS(rate)); |
1174 | /* Write PLCP in two parts and timing for packet transfer */ | 1174 | /* Write PLCP in two parts and timing for packet transfer */ |
1175 | tmp = le32_to_cpu(plcp.data); | 1175 | tmp = le32_to_cpu(plcp.data); |
@@ -1226,7 +1226,7 @@ static u8 *b43_generate_probe_resp(struct b43_wldev *dev, | |||
1226 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1226 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1227 | IEEE80211_STYPE_PROBE_RESP); | 1227 | IEEE80211_STYPE_PROBE_RESP); |
1228 | dur = ieee80211_generic_frame_duration(dev->wl->hw, | 1228 | dur = ieee80211_generic_frame_duration(dev->wl->hw, |
1229 | dev->wl->if_id, *dest_size, | 1229 | dev->wl->vif, *dest_size, |
1230 | B43_RATE_TO_BASE100KBPS(rate)); | 1230 | B43_RATE_TO_BASE100KBPS(rate)); |
1231 | hdr->duration_id = dur; | 1231 | hdr->duration_id = dur; |
1232 | 1232 | ||
@@ -2928,7 +2928,7 @@ static void b43_op_configure_filter(struct ieee80211_hw *hw, | |||
2928 | } | 2928 | } |
2929 | 2929 | ||
2930 | static int b43_op_config_interface(struct ieee80211_hw *hw, | 2930 | static int b43_op_config_interface(struct ieee80211_hw *hw, |
2931 | int if_id, | 2931 | struct ieee80211_vif *vif, |
2932 | struct ieee80211_if_conf *conf) | 2932 | struct ieee80211_if_conf *conf) |
2933 | { | 2933 | { |
2934 | struct b43_wl *wl = hw_to_b43_wl(hw); | 2934 | struct b43_wl *wl = hw_to_b43_wl(hw); |
@@ -2939,7 +2939,7 @@ static int b43_op_config_interface(struct ieee80211_hw *hw, | |||
2939 | return -ENODEV; | 2939 | return -ENODEV; |
2940 | mutex_lock(&wl->mutex); | 2940 | mutex_lock(&wl->mutex); |
2941 | spin_lock_irqsave(&wl->irq_lock, flags); | 2941 | spin_lock_irqsave(&wl->irq_lock, flags); |
2942 | B43_WARN_ON(wl->if_id != if_id); | 2942 | B43_WARN_ON(wl->vif != vif); |
2943 | if (conf->bssid) | 2943 | if (conf->bssid) |
2944 | memcpy(wl->bssid, conf->bssid, ETH_ALEN); | 2944 | memcpy(wl->bssid, conf->bssid, ETH_ALEN); |
2945 | else | 2945 | else |
@@ -3445,7 +3445,7 @@ static int b43_op_add_interface(struct ieee80211_hw *hw, | |||
3445 | 3445 | ||
3446 | dev = wl->current_dev; | 3446 | dev = wl->current_dev; |
3447 | wl->operating = 1; | 3447 | wl->operating = 1; |
3448 | wl->if_id = conf->if_id; | 3448 | wl->vif = conf->vif; |
3449 | wl->if_type = conf->type; | 3449 | wl->if_type = conf->type; |
3450 | memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); | 3450 | memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); |
3451 | 3451 | ||
@@ -3473,7 +3473,8 @@ static void b43_op_remove_interface(struct ieee80211_hw *hw, | |||
3473 | mutex_lock(&wl->mutex); | 3473 | mutex_lock(&wl->mutex); |
3474 | 3474 | ||
3475 | B43_WARN_ON(!wl->operating); | 3475 | B43_WARN_ON(!wl->operating); |
3476 | B43_WARN_ON(wl->if_id != conf->if_id); | 3476 | B43_WARN_ON(wl->vif != conf->vif); |
3477 | wl->vif = NULL; | ||
3477 | 3478 | ||
3478 | wl->operating = 0; | 3479 | wl->operating = 0; |
3479 | 3480 | ||
diff --git a/drivers/net/wireless/b43/xmit.c b/drivers/net/wireless/b43/xmit.c index 419aca1fc4fe..5014213b7752 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, | |||
221 | } else { | 221 | } else { |
222 | int fbrate_base100kbps = B43_RATE_TO_BASE100KBPS(rate_fb); | 222 | int fbrate_base100kbps = B43_RATE_TO_BASE100KBPS(rate_fb); |
223 | txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, | 223 | txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, |
224 | dev->wl->if_id, | 224 | txctl->vif, |
225 | fragment_len, | 225 | fragment_len, |
226 | fbrate_base100kbps); | 226 | fbrate_base100kbps); |
227 | } | 227 | } |
@@ -312,7 +312,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, | |||
312 | rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); | 312 | rts_rate_fb_ofdm = b43_is_ofdm_rate(rts_rate_fb); |
313 | 313 | ||
314 | if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { | 314 | if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { |
315 | ieee80211_ctstoself_get(dev->wl->hw, dev->wl->if_id, | 315 | ieee80211_ctstoself_get(dev->wl->hw, txctl->vif, |
316 | fragment_data, fragment_len, | 316 | fragment_data, fragment_len, |
317 | txctl, | 317 | txctl, |
318 | (struct ieee80211_cts *)(txhdr-> | 318 | (struct ieee80211_cts *)(txhdr-> |
@@ -320,7 +320,7 @@ static void generate_txhdr_fw4(struct b43_wldev *dev, | |||
320 | mac_ctl |= B43_TX4_MAC_SENDCTS; | 320 | mac_ctl |= B43_TX4_MAC_SENDCTS; |
321 | len = sizeof(struct ieee80211_cts); | 321 | len = sizeof(struct ieee80211_cts); |
322 | } else { | 322 | } else { |
323 | ieee80211_rts_get(dev->wl->hw, dev->wl->if_id, | 323 | ieee80211_rts_get(dev->wl->hw, txctl->vif, |
324 | fragment_data, fragment_len, txctl, | 324 | fragment_data, fragment_len, txctl, |
325 | (struct ieee80211_rts *)(txhdr-> | 325 | (struct ieee80211_rts *)(txhdr-> |
326 | rts_frame)); | 326 | rts_frame)); |
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index e4de437b7896..8352a4e1cfc9 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h | |||
@@ -577,10 +577,7 @@ struct b43legacy_wl { | |||
577 | * at a time. General information about this interface follows. | 577 | * at a time. General information about this interface follows. |
578 | */ | 578 | */ |
579 | 579 | ||
580 | /* Opaque ID of the operating interface from the ieee80211 | 580 | struct ieee80211_vif *vif; |
581 | * subsystem. Do not modify. | ||
582 | */ | ||
583 | int if_id; | ||
584 | /* MAC address (can be NULL). */ | 581 | /* MAC address (can be NULL). */ |
585 | u8 mac_addr[ETH_ALEN]; | 582 | u8 mac_addr[ETH_ALEN]; |
586 | /* Current BSSID (can be NULL). */ | 583 | /* Current BSSID (can be NULL). */ |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 575fd9a5874d..2d5735ddad8c 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, | |||
976 | plcp.data = 0; | 976 | plcp.data = 0; |
977 | b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); | 977 | b43legacy_generate_plcp_hdr(&plcp, size + FCS_LEN, rate); |
978 | dur = ieee80211_generic_frame_duration(dev->wl->hw, | 978 | dur = ieee80211_generic_frame_duration(dev->wl->hw, |
979 | dev->wl->if_id, | 979 | dev->wl->vif, |
980 | size, | 980 | size, |
981 | B43legacy_RATE_TO_100KBPS(rate)); | 981 | B43legacy_RATE_TO_100KBPS(rate)); |
982 | /* Write PLCP in two parts and timing for packet transfer */ | 982 | /* Write PLCP in two parts and timing for packet transfer */ |
@@ -1042,7 +1042,7 @@ static u8 *b43legacy_generate_probe_resp(struct b43legacy_wldev *dev, | |||
1042 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | | 1042 | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT | |
1043 | IEEE80211_STYPE_PROBE_RESP); | 1043 | IEEE80211_STYPE_PROBE_RESP); |
1044 | dur = ieee80211_generic_frame_duration(dev->wl->hw, | 1044 | dur = ieee80211_generic_frame_duration(dev->wl->hw, |
1045 | dev->wl->if_id, | 1045 | dev->wl->vif, |
1046 | *dest_size, | 1046 | *dest_size, |
1047 | B43legacy_RATE_TO_100KBPS(rate)); | 1047 | B43legacy_RATE_TO_100KBPS(rate)); |
1048 | hdr->duration_id = dur; | 1048 | hdr->duration_id = dur; |
@@ -2647,7 +2647,7 @@ static void b43legacy_op_configure_filter(struct ieee80211_hw *hw, | |||
2647 | } | 2647 | } |
2648 | 2648 | ||
2649 | static int b43legacy_op_config_interface(struct ieee80211_hw *hw, | 2649 | static int b43legacy_op_config_interface(struct ieee80211_hw *hw, |
2650 | int if_id, | 2650 | struct ieee80211_vif *vif, |
2651 | struct ieee80211_if_conf *conf) | 2651 | struct ieee80211_if_conf *conf) |
2652 | { | 2652 | { |
2653 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); | 2653 | struct b43legacy_wl *wl = hw_to_b43legacy_wl(hw); |
@@ -2658,7 +2658,7 @@ static int b43legacy_op_config_interface(struct ieee80211_hw *hw, | |||
2658 | return -ENODEV; | 2658 | return -ENODEV; |
2659 | mutex_lock(&wl->mutex); | 2659 | mutex_lock(&wl->mutex); |
2660 | spin_lock_irqsave(&wl->irq_lock, flags); | 2660 | spin_lock_irqsave(&wl->irq_lock, flags); |
2661 | B43legacy_WARN_ON(wl->if_id != if_id); | 2661 | B43legacy_WARN_ON(wl->vif != vif); |
2662 | if (conf->bssid) | 2662 | if (conf->bssid) |
2663 | memcpy(wl->bssid, conf->bssid, ETH_ALEN); | 2663 | memcpy(wl->bssid, conf->bssid, ETH_ALEN); |
2664 | else | 2664 | else |
@@ -3177,7 +3177,7 @@ static int b43legacy_op_add_interface(struct ieee80211_hw *hw, | |||
3177 | 3177 | ||
3178 | dev = wl->current_dev; | 3178 | dev = wl->current_dev; |
3179 | wl->operating = 1; | 3179 | wl->operating = 1; |
3180 | wl->if_id = conf->if_id; | 3180 | wl->vif = conf->vif; |
3181 | wl->if_type = conf->type; | 3181 | wl->if_type = conf->type; |
3182 | memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); | 3182 | memcpy(wl->mac_addr, conf->mac_addr, ETH_ALEN); |
3183 | 3183 | ||
@@ -3205,7 +3205,8 @@ static void b43legacy_op_remove_interface(struct ieee80211_hw *hw, | |||
3205 | mutex_lock(&wl->mutex); | 3205 | mutex_lock(&wl->mutex); |
3206 | 3206 | ||
3207 | B43legacy_WARN_ON(!wl->operating); | 3207 | B43legacy_WARN_ON(!wl->operating); |
3208 | B43legacy_WARN_ON(wl->if_id != conf->if_id); | 3208 | B43legacy_WARN_ON(wl->vif != conf->vif); |
3209 | wl->vif = NULL; | ||
3209 | 3210 | ||
3210 | wl->operating = 0; | 3211 | wl->operating = 0; |
3211 | 3212 | ||
diff --git a/drivers/net/wireless/b43legacy/xmit.c b/drivers/net/wireless/b43legacy/xmit.c index fa095d43237f..e20c552442d5 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, | |||
223 | } else { | 223 | } else { |
224 | int fbrate_base100kbps = B43legacy_RATE_TO_100KBPS(rate_fb); | 224 | int fbrate_base100kbps = B43legacy_RATE_TO_100KBPS(rate_fb); |
225 | txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, | 225 | txhdr->dur_fb = ieee80211_generic_frame_duration(dev->wl->hw, |
226 | dev->wl->if_id, | 226 | txctl->vif, |
227 | fragment_len, | 227 | fragment_len, |
228 | fbrate_base100kbps); | 228 | fbrate_base100kbps); |
229 | } | 229 | } |
@@ -312,7 +312,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, | |||
312 | 312 | ||
313 | if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { | 313 | if (txctl->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) { |
314 | ieee80211_ctstoself_get(dev->wl->hw, | 314 | ieee80211_ctstoself_get(dev->wl->hw, |
315 | dev->wl->if_id, | 315 | txctl->vif, |
316 | fragment_data, | 316 | fragment_data, |
317 | fragment_len, txctl, | 317 | fragment_len, txctl, |
318 | (struct ieee80211_cts *) | 318 | (struct ieee80211_cts *) |
@@ -321,7 +321,7 @@ static void generate_txhdr_fw3(struct b43legacy_wldev *dev, | |||
321 | len = sizeof(struct ieee80211_cts); | 321 | len = sizeof(struct ieee80211_cts); |
322 | } else { | 322 | } else { |
323 | ieee80211_rts_get(dev->wl->hw, | 323 | ieee80211_rts_get(dev->wl->hw, |
324 | dev->wl->if_id, | 324 | txctl->vif, |
325 | fragment_data, fragment_len, txctl, | 325 | fragment_data, fragment_len, txctl, |
326 | (struct ieee80211_rts *) | 326 | (struct ieee80211_rts *) |
327 | (txhdr->rts_frame)); | 327 | (txhdr->rts_frame)); |
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index e97f1fb48b97..20b925f57e35 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -863,7 +863,7 @@ struct iwl3945_priv { | |||
863 | u32 timestamp1; | 863 | u32 timestamp1; |
864 | u16 beacon_int; | 864 | u16 beacon_int; |
865 | struct iwl3945_driver_hw_info hw_setting; | 865 | struct iwl3945_driver_hw_info hw_setting; |
866 | int interface_id; | 866 | struct ieee80211_vif *vif; |
867 | 867 | ||
868 | /* Current association information needed to configure the | 868 | /* Current association information needed to configure the |
869 | * hardware */ | 869 | * hardware */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h index 241f4448a4ad..aad7f70bab76 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.h +++ b/drivers/net/wireless/iwlwifi/iwl-4965.h | |||
@@ -1212,7 +1212,7 @@ struct iwl4965_priv { | |||
1212 | u32 timestamp1; | 1212 | u32 timestamp1; |
1213 | u16 beacon_int; | 1213 | u16 beacon_int; |
1214 | struct iwl4965_driver_hw_info hw_setting; | 1214 | struct iwl4965_driver_hw_info hw_setting; |
1215 | int interface_id; | 1215 | struct ieee80211_vif *vif; |
1216 | 1216 | ||
1217 | /* Current association information needed to configure the | 1217 | /* Current association information needed to configure the |
1218 | * hardware */ | 1218 | * hardware */ |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index b662ff3b9141..1830e13d5cfd 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, | |||
2767 | goto drop_unlock; | 2767 | goto drop_unlock; |
2768 | } | 2768 | } |
2769 | 2769 | ||
2770 | if (!priv->interface_id) { | 2770 | if (!priv->vif) { |
2771 | IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); | 2771 | IWL_DEBUG_DROP("Dropping - !priv->vif\n"); |
2772 | goto drop_unlock; | 2772 | goto drop_unlock; |
2773 | } | 2773 | } |
2774 | 2774 | ||
@@ -3549,7 +3549,7 @@ static void iwl3945_bg_beacon_update(struct work_struct *work) | |||
3549 | struct sk_buff *beacon; | 3549 | struct sk_buff *beacon; |
3550 | 3550 | ||
3551 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | 3551 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ |
3552 | beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); | 3552 | beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); |
3553 | 3553 | ||
3554 | if (!beacon) { | 3554 | if (!beacon) { |
3555 | IWL_ERROR("update beacon failed\n"); | 3555 | IWL_ERROR("update beacon failed\n"); |
@@ -6780,7 +6780,7 @@ static void iwl3945_bg_post_associate(struct work_struct *data) | |||
6780 | 6780 | ||
6781 | mutex_lock(&priv->mutex); | 6781 | mutex_lock(&priv->mutex); |
6782 | 6782 | ||
6783 | if (!priv->interface_id || !priv->is_open) { | 6783 | if (!priv->vif || !priv->is_open) { |
6784 | mutex_unlock(&priv->mutex); | 6784 | mutex_unlock(&priv->mutex); |
6785 | return; | 6785 | return; |
6786 | } | 6786 | } |
@@ -6981,15 +6981,15 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw, | |||
6981 | unsigned long flags; | 6981 | unsigned long flags; |
6982 | DECLARE_MAC_BUF(mac); | 6982 | DECLARE_MAC_BUF(mac); |
6983 | 6983 | ||
6984 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 6984 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); |
6985 | 6985 | ||
6986 | if (priv->interface_id) { | 6986 | if (priv->vif) { |
6987 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 6987 | IWL_DEBUG_MAC80211("leave - vif != NULL\n"); |
6988 | return -EOPNOTSUPP; | 6988 | return -EOPNOTSUPP; |
6989 | } | 6989 | } |
6990 | 6990 | ||
6991 | spin_lock_irqsave(&priv->lock, flags); | 6991 | spin_lock_irqsave(&priv->lock, flags); |
6992 | priv->interface_id = conf->if_id; | 6992 | priv->vif = conf->vif; |
6993 | 6993 | ||
6994 | spin_unlock_irqrestore(&priv->lock, flags); | 6994 | spin_unlock_irqrestore(&priv->lock, flags); |
6995 | 6995 | ||
@@ -7157,7 +7157,8 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv) | |||
7157 | * clear sta table, add BCAST sta... */ | 7157 | * clear sta table, add BCAST sta... */ |
7158 | } | 7158 | } |
7159 | 7159 | ||
7160 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, | 7160 | static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, |
7161 | struct ieee80211_vif *vif, | ||
7161 | struct ieee80211_if_conf *conf) | 7162 | struct ieee80211_if_conf *conf) |
7162 | { | 7163 | { |
7163 | struct iwl3945_priv *priv = hw->priv; | 7164 | struct iwl3945_priv *priv = hw->priv; |
@@ -7179,7 +7180,6 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7179 | 7180 | ||
7180 | mutex_lock(&priv->mutex); | 7181 | mutex_lock(&priv->mutex); |
7181 | 7182 | ||
7182 | IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); | ||
7183 | if (conf->bssid) | 7183 | if (conf->bssid) |
7184 | IWL_DEBUG_MAC80211("bssid: %s\n", | 7184 | IWL_DEBUG_MAC80211("bssid: %s\n", |
7185 | print_mac(mac, conf->bssid)); | 7185 | print_mac(mac, conf->bssid)); |
@@ -7196,8 +7196,8 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7196 | return 0; | 7196 | return 0; |
7197 | } | 7197 | } |
7198 | 7198 | ||
7199 | if (priv->interface_id != if_id) { | 7199 | if (priv->vif != vif) { |
7200 | IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); | 7200 | IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); |
7201 | mutex_unlock(&priv->mutex); | 7201 | mutex_unlock(&priv->mutex); |
7202 | return 0; | 7202 | return 0; |
7203 | } | 7203 | } |
@@ -7295,8 +7295,8 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw, | |||
7295 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7295 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7296 | iwl3945_commit_rxon(priv); | 7296 | iwl3945_commit_rxon(priv); |
7297 | } | 7297 | } |
7298 | if (priv->interface_id == conf->if_id) { | 7298 | if (priv->vif == conf->vif) { |
7299 | priv->interface_id = 0; | 7299 | priv->vif = NULL; |
7300 | memset(priv->bssid, 0, ETH_ALEN); | 7300 | memset(priv->bssid, 0, ETH_ALEN); |
7301 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | 7301 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); |
7302 | priv->essid_len = 0; | 7302 | priv->essid_len = 0; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index ce0574b087fb..52eb37f4ac78 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, | |||
2897 | goto drop_unlock; | 2897 | goto drop_unlock; |
2898 | } | 2898 | } |
2899 | 2899 | ||
2900 | if (!priv->interface_id) { | 2900 | if (!priv->vif) { |
2901 | IWL_DEBUG_DROP("Dropping - !priv->interface_id\n"); | 2901 | IWL_DEBUG_DROP("Dropping - !priv->vif\n"); |
2902 | goto drop_unlock; | 2902 | goto drop_unlock; |
2903 | } | 2903 | } |
2904 | 2904 | ||
@@ -3893,7 +3893,7 @@ static void iwl4965_bg_beacon_update(struct work_struct *work) | |||
3893 | struct sk_buff *beacon; | 3893 | struct sk_buff *beacon; |
3894 | 3894 | ||
3895 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ | 3895 | /* Pull updated AP beacon from mac80211. will fail if not in AP mode */ |
3896 | beacon = ieee80211_beacon_get(priv->hw, priv->interface_id, NULL); | 3896 | beacon = ieee80211_beacon_get(priv->hw, priv->vif, NULL); |
3897 | 3897 | ||
3898 | if (!beacon) { | 3898 | if (!beacon) { |
3899 | IWL_ERROR("update beacon failed\n"); | 3899 | IWL_ERROR("update beacon failed\n"); |
@@ -7214,7 +7214,7 @@ static void iwl4965_bg_post_associate(struct work_struct *data) | |||
7214 | 7214 | ||
7215 | mutex_lock(&priv->mutex); | 7215 | mutex_lock(&priv->mutex); |
7216 | 7216 | ||
7217 | if (!priv->interface_id || !priv->is_open) { | 7217 | if (!priv->vif || !priv->is_open) { |
7218 | mutex_unlock(&priv->mutex); | 7218 | mutex_unlock(&priv->mutex); |
7219 | return; | 7219 | return; |
7220 | } | 7220 | } |
@@ -7425,15 +7425,15 @@ static int iwl4965_mac_add_interface(struct ieee80211_hw *hw, | |||
7425 | unsigned long flags; | 7425 | unsigned long flags; |
7426 | DECLARE_MAC_BUF(mac); | 7426 | DECLARE_MAC_BUF(mac); |
7427 | 7427 | ||
7428 | IWL_DEBUG_MAC80211("enter: id %d, type %d\n", conf->if_id, conf->type); | 7428 | IWL_DEBUG_MAC80211("enter: type %d\n", conf->type); |
7429 | 7429 | ||
7430 | if (priv->interface_id) { | 7430 | if (priv->vif) { |
7431 | IWL_DEBUG_MAC80211("leave - interface_id != 0\n"); | 7431 | IWL_DEBUG_MAC80211("leave - vif != NULL\n"); |
7432 | return 0; | 7432 | return 0; |
7433 | } | 7433 | } |
7434 | 7434 | ||
7435 | spin_lock_irqsave(&priv->lock, flags); | 7435 | spin_lock_irqsave(&priv->lock, flags); |
7436 | priv->interface_id = conf->if_id; | 7436 | priv->vif = conf->vif; |
7437 | 7437 | ||
7438 | spin_unlock_irqrestore(&priv->lock, flags); | 7438 | spin_unlock_irqrestore(&priv->lock, flags); |
7439 | 7439 | ||
@@ -7617,7 +7617,8 @@ static void iwl4965_config_ap(struct iwl4965_priv *priv) | |||
7617 | * clear sta table, add BCAST sta... */ | 7617 | * clear sta table, add BCAST sta... */ |
7618 | } | 7618 | } |
7619 | 7619 | ||
7620 | static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, | 7620 | static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, |
7621 | struct ieee80211_vif *vif, | ||
7621 | struct ieee80211_if_conf *conf) | 7622 | struct ieee80211_if_conf *conf) |
7622 | { | 7623 | { |
7623 | struct iwl4965_priv *priv = hw->priv; | 7624 | struct iwl4965_priv *priv = hw->priv; |
@@ -7637,7 +7638,6 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7637 | 7638 | ||
7638 | mutex_lock(&priv->mutex); | 7639 | mutex_lock(&priv->mutex); |
7639 | 7640 | ||
7640 | IWL_DEBUG_MAC80211("enter: interface id %d\n", if_id); | ||
7641 | if (conf->bssid) | 7641 | if (conf->bssid) |
7642 | IWL_DEBUG_MAC80211("bssid: %s\n", | 7642 | IWL_DEBUG_MAC80211("bssid: %s\n", |
7643 | print_mac(mac, conf->bssid)); | 7643 | print_mac(mac, conf->bssid)); |
@@ -7654,8 +7654,8 @@ static int iwl4965_mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
7654 | return 0; | 7654 | return 0; |
7655 | } | 7655 | } |
7656 | 7656 | ||
7657 | if (priv->interface_id != if_id) { | 7657 | if (priv->vif != vif) { |
7658 | IWL_DEBUG_MAC80211("leave - interface_id != if_id\n"); | 7658 | IWL_DEBUG_MAC80211("leave - priv->vif != vif\n"); |
7659 | mutex_unlock(&priv->mutex); | 7659 | mutex_unlock(&priv->mutex); |
7660 | return 0; | 7660 | return 0; |
7661 | } | 7661 | } |
@@ -7753,8 +7753,8 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, | |||
7753 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; | 7753 | priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; |
7754 | iwl4965_commit_rxon(priv); | 7754 | iwl4965_commit_rxon(priv); |
7755 | } | 7755 | } |
7756 | if (priv->interface_id == conf->if_id) { | 7756 | if (priv->vif == conf->vif) { |
7757 | priv->interface_id = 0; | 7757 | priv->vif = NULL; |
7758 | memset(priv->bssid, 0, ETH_ALEN); | 7758 | memset(priv->bssid, 0, ETH_ALEN); |
7759 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); | 7759 | memset(priv->essid, 0, IW_ESSID_MAX_SIZE); |
7760 | priv->essid_len = 0; | 7760 | priv->essid_len = 0; |
diff --git a/drivers/net/wireless/p54common.c b/drivers/net/wireless/p54common.c index 9660fdd873ac..5cda49aff3a8 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) | |||
854 | return ret; | 854 | return ret; |
855 | } | 855 | } |
856 | 856 | ||
857 | static int p54_config_interface(struct ieee80211_hw *dev, int if_id, | 857 | static int p54_config_interface(struct ieee80211_hw *dev, |
858 | struct ieee80211_vif *vif, | ||
858 | struct ieee80211_if_conf *conf) | 859 | struct ieee80211_if_conf *conf) |
859 | { | 860 | { |
860 | struct p54_common *priv = dev->priv; | 861 | struct p54_common *priv = dev->priv; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 5fb9734ade85..94a8a7ce5382 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -372,7 +372,7 @@ struct interface { | |||
372 | * to us by the 80211 stack, and is used to request | 372 | * to us by the 80211 stack, and is used to request |
373 | * new beacons. | 373 | * new beacons. |
374 | */ | 374 | */ |
375 | int id; | 375 | struct ieee80211_vif *id; |
376 | 376 | ||
377 | /* | 377 | /* |
378 | * Current working type (IEEE80211_IF_TYPE_*). | 378 | * Current working type (IEEE80211_IF_TYPE_*). |
@@ -929,7 +929,8 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
929 | void rt2x00mac_remove_interface(struct ieee80211_hw *hw, | 929 | void rt2x00mac_remove_interface(struct ieee80211_hw *hw, |
930 | struct ieee80211_if_init_conf *conf); | 930 | struct ieee80211_if_init_conf *conf); |
931 | int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 931 | int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); |
932 | int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, | 932 | int rt2x00mac_config_interface(struct ieee80211_hw *hw, |
933 | struct ieee80211_vif *vif, | ||
933 | struct ieee80211_if_conf *conf); | 934 | struct ieee80211_if_conf *conf); |
934 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, | 935 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, |
935 | struct ieee80211_low_level_stats *stats); | 936 | struct ieee80211_low_level_stats *stats); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index e99d167d7df6..1d67bcd46bcb 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, | |||
181 | is_interface_present(intf)) | 181 | is_interface_present(intf)) |
182 | return -ENOBUFS; | 182 | return -ENOBUFS; |
183 | 183 | ||
184 | intf->id = conf->if_id; | 184 | intf->id = conf->vif; |
185 | intf->type = conf->type; | 185 | intf->type = conf->type; |
186 | if (conf->type == IEEE80211_IF_TYPE_AP) | 186 | if (conf->type == IEEE80211_IF_TYPE_AP) |
187 | memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN); | 187 | memcpy(&intf->bssid, conf->mac_addr, ETH_ALEN); |
@@ -265,7 +265,8 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | |||
265 | } | 265 | } |
266 | EXPORT_SYMBOL_GPL(rt2x00mac_config); | 266 | EXPORT_SYMBOL_GPL(rt2x00mac_config); |
267 | 267 | ||
268 | int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, | 268 | int rt2x00mac_config_interface(struct ieee80211_hw *hw, |
269 | struct ieee80211_vif *vif, | ||
269 | struct ieee80211_if_conf *conf) | 270 | struct ieee80211_if_conf *conf) |
270 | { | 271 | { |
271 | struct rt2x00_dev *rt2x00dev = hw->priv; | 272 | struct rt2x00_dev *rt2x00dev = hw->priv; |
diff --git a/drivers/net/wireless/rtl8180.h b/drivers/net/wireless/rtl8180.h index 0b333cacbd85..2cbfe3c8081f 100644 --- a/drivers/net/wireless/rtl8180.h +++ b/drivers/net/wireless/rtl8180.h | |||
@@ -90,8 +90,8 @@ struct rtl8180_priv { | |||
90 | /* common between rtl818x drivers */ | 90 | /* common between rtl818x drivers */ |
91 | struct rtl818x_csr __iomem *map; | 91 | struct rtl818x_csr __iomem *map; |
92 | const struct rtl818x_rf_ops *rf; | 92 | const struct rtl818x_rf_ops *rf; |
93 | struct ieee80211_vif *vif; | ||
93 | int mode; | 94 | int mode; |
94 | int if_id; | ||
95 | 95 | ||
96 | /* rtl8180 driver specific */ | 96 | /* rtl8180 driver specific */ |
97 | spinlock_t lock; | 97 | spinlock_t lock; |
diff --git a/drivers/net/wireless/rtl8180_dev.c b/drivers/net/wireless/rtl8180_dev.c index 4b7b032c194a..07f37b0ccf91 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, | |||
236 | kmemdup(control, sizeof(*control), GFP_ATOMIC); | 236 | kmemdup(control, sizeof(*control), GFP_ATOMIC); |
237 | 237 | ||
238 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) | 238 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) |
239 | rts_duration = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); | 239 | rts_duration = ieee80211_rts_duration(dev, priv->vif, skb->len, |
240 | control); | ||
240 | 241 | ||
241 | if (!priv->r8185) { | 242 | if (!priv->r8185) { |
242 | unsigned int remainder; | 243 | unsigned int remainder; |
@@ -638,6 +639,8 @@ static int rtl8180_add_interface(struct ieee80211_hw *dev, | |||
638 | return -EOPNOTSUPP; | 639 | return -EOPNOTSUPP; |
639 | } | 640 | } |
640 | 641 | ||
642 | priv->vif = conf->vif; | ||
643 | |||
641 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); | 644 | rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG); |
642 | rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], | 645 | rtl818x_iowrite32(priv, (__le32 __iomem *)&priv->map->MAC[0], |
643 | cpu_to_le32(*(u32 *)conf->mac_addr)); | 646 | cpu_to_le32(*(u32 *)conf->mac_addr)); |
@@ -653,6 +656,7 @@ static void rtl8180_remove_interface(struct ieee80211_hw *dev, | |||
653 | { | 656 | { |
654 | struct rtl8180_priv *priv = dev->priv; | 657 | struct rtl8180_priv *priv = dev->priv; |
655 | priv->mode = IEEE80211_IF_TYPE_MNTR; | 658 | priv->mode = IEEE80211_IF_TYPE_MNTR; |
659 | priv->vif = NULL; | ||
656 | } | 660 | } |
657 | 661 | ||
658 | static int rtl8180_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) | 662 | 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) | |||
664 | return 0; | 668 | return 0; |
665 | } | 669 | } |
666 | 670 | ||
667 | static int rtl8180_config_interface(struct ieee80211_hw *dev, int if_id, | 671 | static int rtl8180_config_interface(struct ieee80211_hw *dev, |
672 | struct ieee80211_vif *vif, | ||
668 | struct ieee80211_if_conf *conf) | 673 | struct ieee80211_if_conf *conf) |
669 | { | 674 | { |
670 | struct rtl8180_priv *priv = dev->priv; | 675 | struct rtl8180_priv *priv = dev->priv; |
671 | int i; | 676 | int i; |
672 | 677 | ||
673 | priv->if_id = if_id; | ||
674 | |||
675 | for (i = 0; i < ETH_ALEN; i++) | 678 | for (i = 0; i < ETH_ALEN; i++) |
676 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); | 679 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); |
677 | 680 | ||
diff --git a/drivers/net/wireless/rtl8187.h b/drivers/net/wireless/rtl8187.h index 26a4f1097b4a..8680a0b6433c 100644 --- a/drivers/net/wireless/rtl8187.h +++ b/drivers/net/wireless/rtl8187.h | |||
@@ -65,8 +65,8 @@ struct rtl8187_priv { | |||
65 | /* common between rtl818x drivers */ | 65 | /* common between rtl818x drivers */ |
66 | struct rtl818x_csr *map; | 66 | struct rtl818x_csr *map; |
67 | const struct rtl818x_rf_ops *rf; | 67 | const struct rtl818x_rf_ops *rf; |
68 | struct ieee80211_vif *vif; | ||
68 | int mode; | 69 | int mode; |
69 | int if_id; | ||
70 | 70 | ||
71 | /* rtl8187 specific */ | 71 | /* rtl8187 specific */ |
72 | struct ieee80211_channel channels[14]; | 72 | struct ieee80211_channel channels[14]; |
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c index 8dab25a65990..0d71716d750d 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, | |||
150 | flags |= RTL8187_TX_FLAG_MORE_FRAG; | 150 | flags |= RTL8187_TX_FLAG_MORE_FRAG; |
151 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { | 151 | if (control->flags & IEEE80211_TXCTL_USE_RTS_CTS) { |
152 | flags |= RTL8187_TX_FLAG_RTS; | 152 | flags |= RTL8187_TX_FLAG_RTS; |
153 | rts_dur = ieee80211_rts_duration(dev, priv->if_id, skb->len, control); | 153 | rts_dur = ieee80211_rts_duration(dev, priv->vif, |
154 | skb->len, control); | ||
154 | } | 155 | } |
155 | if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) | 156 | if (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) |
156 | flags |= RTL8187_TX_FLAG_CTS; | 157 | flags |= RTL8187_TX_FLAG_CTS; |
@@ -560,14 +561,13 @@ static int rtl8187_config(struct ieee80211_hw *dev, struct ieee80211_conf *conf) | |||
560 | return 0; | 561 | return 0; |
561 | } | 562 | } |
562 | 563 | ||
563 | static int rtl8187_config_interface(struct ieee80211_hw *dev, int if_id, | 564 | static int rtl8187_config_interface(struct ieee80211_hw *dev, |
565 | struct ieee80211_vif *vif, | ||
564 | struct ieee80211_if_conf *conf) | 566 | struct ieee80211_if_conf *conf) |
565 | { | 567 | { |
566 | struct rtl8187_priv *priv = dev->priv; | 568 | struct rtl8187_priv *priv = dev->priv; |
567 | int i; | 569 | int i; |
568 | 570 | ||
569 | priv->if_id = if_id; | ||
570 | |||
571 | for (i = 0; i < ETH_ALEN; i++) | 571 | for (i = 0; i < ETH_ALEN; i++) |
572 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); | 572 | rtl818x_iowrite8(priv, &priv->map->BSSID[i], conf->bssid[i]); |
573 | 573 | ||
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 7b8693050480..3409cf97f5f8 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) | |||
733 | return zd_chip_set_channel(&mac->chip, conf->channel); | 733 | return zd_chip_set_channel(&mac->chip, conf->channel); |
734 | } | 734 | } |
735 | 735 | ||
736 | static int zd_op_config_interface(struct ieee80211_hw *hw, int if_id, | 736 | static int zd_op_config_interface(struct ieee80211_hw *hw, |
737 | struct ieee80211_vif *vif, | ||
737 | struct ieee80211_if_conf *conf) | 738 | struct ieee80211_if_conf *conf) |
738 | { | 739 | { |
739 | struct zd_mac *mac = zd_hw_mac(hw); | 740 | struct zd_mac *mac = zd_hw_mac(hw); |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index be2a383b4776..24a8ad3f5073 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -280,6 +280,7 @@ struct ieee80211_low_level_stats { | |||
280 | * the hardware to use given values (depending on what is supported). */ | 280 | * the hardware to use given values (depending on what is supported). */ |
281 | 281 | ||
282 | struct ieee80211_tx_control { | 282 | struct ieee80211_tx_control { |
283 | struct ieee80211_vif *vif; | ||
283 | int tx_rate; /* Transmit rate, given as the hw specific value for the | 284 | int tx_rate; /* Transmit rate, given as the hw specific value for the |
284 | * rate (from struct ieee80211_rate) */ | 285 | * rate (from struct ieee80211_rate) */ |
285 | int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw | 286 | int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw |
@@ -332,7 +333,6 @@ struct ieee80211_tx_control { | |||
332 | * packet dropping when probing higher rates, if hw | 333 | * packet dropping when probing higher rates, if hw |
333 | * supports multiple retry rates. -1 = not used */ | 334 | * supports multiple retry rates. -1 = not used */ |
334 | int type; /* internal */ | 335 | int type; /* internal */ |
335 | int ifindex; /* internal */ | ||
336 | }; | 336 | }; |
337 | 337 | ||
338 | 338 | ||
@@ -530,13 +530,25 @@ enum ieee80211_if_types { | |||
530 | }; | 530 | }; |
531 | 531 | ||
532 | /** | 532 | /** |
533 | * struct ieee80211_vif - per-interface data | ||
534 | * | ||
535 | * Data in this structure is continually present for driver | ||
536 | * use during the life of a virtual interface. | ||
537 | * | ||
538 | * @drv_priv: data area for driver use, will always be aligned to | ||
539 | * sizeof(void *). | ||
540 | */ | ||
541 | struct ieee80211_vif { | ||
542 | /* must be last */ | ||
543 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | ||
544 | }; | ||
545 | |||
546 | /** | ||
533 | * struct ieee80211_if_init_conf - initial configuration of an interface | 547 | * struct ieee80211_if_init_conf - initial configuration of an interface |
534 | * | 548 | * |
535 | * @if_id: internal interface ID. This number has no particular meaning to | 549 | * @vif: pointer to a driver-use per-interface structure. The pointer |
536 | * drivers and the only allowed usage is to pass it to | 550 | * itself is also used for various functions including |
537 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc() functions. | 551 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). |
538 | * This field is not valid for monitor interfaces | ||
539 | * (interfaces of %IEEE80211_IF_TYPE_MNTR type). | ||
540 | * @type: one of &enum ieee80211_if_types constants. Determines the type of | 552 | * @type: one of &enum ieee80211_if_types constants. Determines the type of |
541 | * added/removed interface. | 553 | * added/removed interface. |
542 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | 554 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid |
@@ -553,8 +565,8 @@ enum ieee80211_if_types { | |||
553 | * in pure monitor mode. | 565 | * in pure monitor mode. |
554 | */ | 566 | */ |
555 | struct ieee80211_if_init_conf { | 567 | struct ieee80211_if_init_conf { |
556 | int if_id; | ||
557 | enum ieee80211_if_types type; | 568 | enum ieee80211_if_types type; |
569 | struct ieee80211_vif *vif; | ||
558 | void *mac_addr; | 570 | void *mac_addr; |
559 | }; | 571 | }; |
560 | 572 | ||
@@ -757,6 +769,9 @@ enum ieee80211_hw_flags { | |||
757 | * @rate_control_algorithm: rate control algorithm for this hardware. | 769 | * @rate_control_algorithm: rate control algorithm for this hardware. |
758 | * If unset (NULL), the default algorithm will be used. Must be | 770 | * If unset (NULL), the default algorithm will be used. Must be |
759 | * set before calling ieee80211_register_hw(). | 771 | * set before calling ieee80211_register_hw(). |
772 | * | ||
773 | * @vif_data_size: size (in bytes) of the drv_priv data area | ||
774 | * within &struct ieee80211_vif. | ||
760 | */ | 775 | */ |
761 | struct ieee80211_hw { | 776 | struct ieee80211_hw { |
762 | struct ieee80211_conf conf; | 777 | struct ieee80211_conf conf; |
@@ -767,6 +782,7 @@ struct ieee80211_hw { | |||
767 | u32 flags; | 782 | u32 flags; |
768 | unsigned int extra_tx_headroom; | 783 | unsigned int extra_tx_headroom; |
769 | int channel_change_time; | 784 | int channel_change_time; |
785 | int vif_data_size; | ||
770 | u8 queues; | 786 | u8 queues; |
771 | s8 max_rssi; | 787 | s8 max_rssi; |
772 | s8 max_signal; | 788 | s8 max_signal; |
@@ -1076,7 +1092,8 @@ struct ieee80211_ops { | |||
1076 | struct ieee80211_if_init_conf *conf); | 1092 | struct ieee80211_if_init_conf *conf); |
1077 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 1093 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); |
1078 | int (*config_interface)(struct ieee80211_hw *hw, | 1094 | int (*config_interface)(struct ieee80211_hw *hw, |
1079 | int if_id, struct ieee80211_if_conf *conf); | 1095 | struct ieee80211_vif *vif, |
1096 | struct ieee80211_if_conf *conf); | ||
1080 | void (*configure_filter)(struct ieee80211_hw *hw, | 1097 | void (*configure_filter)(struct ieee80211_hw *hw, |
1081 | unsigned int changed_flags, | 1098 | unsigned int changed_flags, |
1082 | unsigned int *total_flags, | 1099 | unsigned int *total_flags, |
@@ -1094,7 +1111,7 @@ struct ieee80211_ops { | |||
1094 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); | 1111 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); |
1095 | int (*set_retry_limit)(struct ieee80211_hw *hw, | 1112 | int (*set_retry_limit)(struct ieee80211_hw *hw, |
1096 | u32 short_retry, u32 long_retr); | 1113 | u32 short_retry, u32 long_retr); |
1097 | void (*sta_notify)(struct ieee80211_hw *hw, int if_id, | 1114 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1098 | enum sta_notify_cmd, const u8 *addr); | 1115 | enum sta_notify_cmd, const u8 *addr); |
1099 | void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, | 1116 | void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, |
1100 | int cts_protection, int preamble); | 1117 | int cts_protection, int preamble); |
@@ -1309,7 +1326,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
1309 | /** | 1326 | /** |
1310 | * ieee80211_beacon_get - beacon generation function | 1327 | * ieee80211_beacon_get - beacon generation function |
1311 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1328 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1312 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1329 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1313 | * @control: will be filled with information needed to send this beacon. | 1330 | * @control: will be filled with information needed to send this beacon. |
1314 | * | 1331 | * |
1315 | * If the beacon frames are generated by the host system (i.e., not in | 1332 | * 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, | |||
1320 | * is responsible of freeing it. | 1337 | * is responsible of freeing it. |
1321 | */ | 1338 | */ |
1322 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1339 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, |
1323 | int if_id, | 1340 | struct ieee80211_vif *vif, |
1324 | struct ieee80211_tx_control *control); | 1341 | struct ieee80211_tx_control *control); |
1325 | 1342 | ||
1326 | /** | 1343 | /** |
1327 | * ieee80211_rts_get - RTS frame generation function | 1344 | * ieee80211_rts_get - RTS frame generation function |
1328 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1345 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1329 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1346 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1330 | * @frame: pointer to the frame that is going to be protected by the RTS. | 1347 | * @frame: pointer to the frame that is going to be protected by the RTS. |
1331 | * @frame_len: the frame length (in octets). | 1348 | * @frame_len: the frame length (in octets). |
1332 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1349 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -1337,7 +1354,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1337 | * the next RTS frame from the 802.11 code. The low-level is responsible | 1354 | * the next RTS frame from the 802.11 code. The low-level is responsible |
1338 | * for calling this function before and RTS frame is needed. | 1355 | * for calling this function before and RTS frame is needed. |
1339 | */ | 1356 | */ |
1340 | void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | 1357 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1341 | const void *frame, size_t frame_len, | 1358 | const void *frame, size_t frame_len, |
1342 | const struct ieee80211_tx_control *frame_txctl, | 1359 | const struct ieee80211_tx_control *frame_txctl, |
1343 | struct ieee80211_rts *rts); | 1360 | struct ieee80211_rts *rts); |
@@ -1345,7 +1362,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | |||
1345 | /** | 1362 | /** |
1346 | * ieee80211_rts_duration - Get the duration field for an RTS frame | 1363 | * ieee80211_rts_duration - Get the duration field for an RTS frame |
1347 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1364 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1348 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1365 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1349 | * @frame_len: the length of the frame that is going to be protected by the RTS. | 1366 | * @frame_len: the length of the frame that is going to be protected by the RTS. |
1350 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1367 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
1351 | * | 1368 | * |
@@ -1353,14 +1370,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | |||
1353 | * the duration field, the low-level driver uses this function to receive | 1370 | * the duration field, the low-level driver uses this function to receive |
1354 | * the duration field value in little-endian byteorder. | 1371 | * the duration field value in little-endian byteorder. |
1355 | */ | 1372 | */ |
1356 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | 1373 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, |
1357 | size_t frame_len, | 1374 | struct ieee80211_vif *vif, size_t frame_len, |
1358 | const struct ieee80211_tx_control *frame_txctl); | 1375 | const struct ieee80211_tx_control *frame_txctl); |
1359 | 1376 | ||
1360 | /** | 1377 | /** |
1361 | * ieee80211_ctstoself_get - CTS-to-self frame generation function | 1378 | * ieee80211_ctstoself_get - CTS-to-self frame generation function |
1362 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1379 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1363 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1380 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1364 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. | 1381 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. |
1365 | * @frame_len: the frame length (in octets). | 1382 | * @frame_len: the frame length (in octets). |
1366 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1383 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -1371,7 +1388,8 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | |||
1371 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible | 1388 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible |
1372 | * for calling this function before and CTS-to-self frame is needed. | 1389 | * for calling this function before and CTS-to-self frame is needed. |
1373 | */ | 1390 | */ |
1374 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | 1391 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, |
1392 | struct ieee80211_vif *vif, | ||
1375 | const void *frame, size_t frame_len, | 1393 | const void *frame, size_t frame_len, |
1376 | const struct ieee80211_tx_control *frame_txctl, | 1394 | const struct ieee80211_tx_control *frame_txctl, |
1377 | struct ieee80211_cts *cts); | 1395 | struct ieee80211_cts *cts); |
@@ -1379,7 +1397,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | |||
1379 | /** | 1397 | /** |
1380 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame | 1398 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame |
1381 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1399 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1382 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1400 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1383 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. | 1401 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. |
1384 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1402 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
1385 | * | 1403 | * |
@@ -1387,28 +1405,30 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | |||
1387 | * the duration field, the low-level driver uses this function to receive | 1405 | * the duration field, the low-level driver uses this function to receive |
1388 | * the duration field value in little-endian byteorder. | 1406 | * the duration field value in little-endian byteorder. |
1389 | */ | 1407 | */ |
1390 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, | 1408 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, |
1409 | struct ieee80211_vif *vif, | ||
1391 | size_t frame_len, | 1410 | size_t frame_len, |
1392 | const struct ieee80211_tx_control *frame_txctl); | 1411 | const struct ieee80211_tx_control *frame_txctl); |
1393 | 1412 | ||
1394 | /** | 1413 | /** |
1395 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame | 1414 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame |
1396 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1415 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1397 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1416 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1398 | * @frame_len: the length of the frame. | 1417 | * @frame_len: the length of the frame. |
1399 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. | 1418 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. |
1400 | * | 1419 | * |
1401 | * Calculate the duration field of some generic frame, given its | 1420 | * Calculate the duration field of some generic frame, given its |
1402 | * length and transmission rate (in 100kbps). | 1421 | * length and transmission rate (in 100kbps). |
1403 | */ | 1422 | */ |
1404 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, | 1423 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, |
1424 | struct ieee80211_vif *vif, | ||
1405 | size_t frame_len, | 1425 | size_t frame_len, |
1406 | int rate); | 1426 | int rate); |
1407 | 1427 | ||
1408 | /** | 1428 | /** |
1409 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames | 1429 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames |
1410 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 1430 | * @hw: pointer as obtained from ieee80211_alloc_hw(). |
1411 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1431 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1412 | * @control: will be filled with information needed to send returned frame. | 1432 | * @control: will be filled with information needed to send returned frame. |
1413 | * | 1433 | * |
1414 | * Function for accessing buffered broadcast and multicast frames. If | 1434 | * 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, | |||
1427 | * use common code for all beacons. | 1447 | * use common code for all beacons. |
1428 | */ | 1448 | */ |
1429 | struct sk_buff * | 1449 | struct sk_buff * |
1430 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | 1450 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1431 | struct ieee80211_tx_control *control); | 1451 | struct ieee80211_tx_control *control); |
1432 | 1452 | ||
1433 | /** | 1453 | /** |
@@ -1517,7 +1537,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw); | |||
1517 | */ | 1537 | */ |
1518 | void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, | 1538 | void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, |
1519 | void (*iterator)(void *data, u8 *mac, | 1539 | void (*iterator)(void *data, u8 *mac, |
1520 | int if_id), | 1540 | struct ieee80211_vif *vif), |
1521 | void *data); | 1541 | void *data); |
1522 | 1542 | ||
1523 | #endif /* MAC80211_H */ | 1543 | #endif /* MAC80211_H */ |
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 4807e5215a79..42c27089f006 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -243,7 +243,7 @@ static int ieee80211_open(struct net_device *dev) | |||
243 | sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; | 243 | sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; |
244 | /* fall through */ | 244 | /* fall through */ |
245 | default: | 245 | default: |
246 | conf.if_id = dev->ifindex; | 246 | conf.vif = &sdata->vif; |
247 | conf.type = sdata->type; | 247 | conf.type = sdata->type; |
248 | conf.mac_addr = dev->dev_addr; | 248 | conf.mac_addr = dev->dev_addr; |
249 | res = local->ops->add_interface(local_to_hw(local), &conf); | 249 | res = local->ops->add_interface(local_to_hw(local), &conf); |
@@ -378,7 +378,7 @@ static int ieee80211_stop(struct net_device *dev) | |||
378 | sdata->u.sta.extra_ie_len = 0; | 378 | sdata->u.sta.extra_ie_len = 0; |
379 | /* fall through */ | 379 | /* fall through */ |
380 | default: | 380 | default: |
381 | conf.if_id = dev->ifindex; | 381 | conf.vif = &sdata->vif; |
382 | conf.type = sdata->type; | 382 | conf.type = sdata->type; |
383 | conf.mac_addr = dev->dev_addr; | 383 | conf.mac_addr = dev->dev_addr; |
384 | /* disable all keys for as long as this netdev is down */ | 384 | /* disable all keys for as long as this netdev is down */ |
@@ -515,7 +515,7 @@ static int __ieee80211_if_config(struct net_device *dev, | |||
515 | conf.beacon_control = control; | 515 | conf.beacon_control = control; |
516 | } | 516 | } |
517 | return local->ops->config_interface(local_to_hw(local), | 517 | return local->ops->config_interface(local_to_hw(local), |
518 | dev->ifindex, &conf); | 518 | &sdata->vif, &conf); |
519 | } | 519 | } |
520 | 520 | ||
521 | int ieee80211_if_config(struct net_device *dev) | 521 | int ieee80211_if_config(struct net_device *dev) |
@@ -527,11 +527,13 @@ int ieee80211_if_config_beacon(struct net_device *dev) | |||
527 | { | 527 | { |
528 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 528 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
529 | struct ieee80211_tx_control control; | 529 | struct ieee80211_tx_control control; |
530 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
530 | struct sk_buff *skb; | 531 | struct sk_buff *skb; |
531 | 532 | ||
532 | if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) | 533 | if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) |
533 | return 0; | 534 | return 0; |
534 | skb = ieee80211_beacon_get(local_to_hw(local), dev->ifindex, &control); | 535 | skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif, |
536 | &control); | ||
535 | if (!skb) | 537 | if (!skb) |
536 | return -ENOMEM; | 538 | return -ENOMEM; |
537 | return __ieee80211_if_config(dev, skb, &control); | 539 | return __ieee80211_if_config(dev, skb, &control); |
@@ -736,7 +738,7 @@ static void ieee80211_remove_tx_extra(struct ieee80211_local *local, | |||
736 | struct ieee80211_tx_packet_data *pkt_data; | 738 | struct ieee80211_tx_packet_data *pkt_data; |
737 | 739 | ||
738 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; | 740 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; |
739 | pkt_data->ifindex = control->ifindex; | 741 | pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex; |
740 | pkt_data->flags = 0; | 742 | pkt_data->flags = 0; |
741 | if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) | 743 | if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) |
742 | pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; | 744 | pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index b898b316bda1..c551a7f379e0 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -387,8 +387,16 @@ struct ieee80211_sub_if_data { | |||
387 | struct dentry *default_key; | 387 | struct dentry *default_key; |
388 | } debugfs; | 388 | } debugfs; |
389 | #endif | 389 | #endif |
390 | /* must be last, dynamically sized area in this! */ | ||
391 | struct ieee80211_vif vif; | ||
390 | }; | 392 | }; |
391 | 393 | ||
394 | static inline | ||
395 | struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) | ||
396 | { | ||
397 | return container_of(p, struct ieee80211_sub_if_data, vif); | ||
398 | } | ||
399 | |||
392 | #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev) | 400 | #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev) |
393 | 401 | ||
394 | enum { | 402 | enum { |
diff --git a/net/mac80211/ieee80211_iface.c b/net/mac80211/ieee80211_iface.c index 7cfd8660b231..b72066378805 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, | |||
47 | int ret; | 47 | int ret; |
48 | 48 | ||
49 | ASSERT_RTNL(); | 49 | ASSERT_RTNL(); |
50 | ndev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), | 50 | ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size, |
51 | name, ieee80211_if_setup); | 51 | name, ieee80211_if_setup); |
52 | if (!ndev) | 52 | if (!ndev) |
53 | return -ENOMEM; | 53 | return -ENOMEM; |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 1257c7aab2a5..32e241764725 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, | |||
177 | list_add(&sta->list, &local->sta_list); | 177 | list_add(&sta->list, &local->sta_list); |
178 | local->num_sta++; | 178 | local->num_sta++; |
179 | sta_info_hash_add(local, sta); | 179 | sta_info_hash_add(local, sta); |
180 | if (local->ops->sta_notify) | 180 | if (local->ops->sta_notify) { |
181 | local->ops->sta_notify(local_to_hw(local), dev->ifindex, | 181 | struct ieee80211_sub_if_data *sdata; |
182 | STA_NOTIFY_ADD, addr); | 182 | |
183 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
184 | if (sdata->type == IEEE80211_IF_TYPE_VLAN) | ||
185 | sdata = sdata->u.vlan.ap; | ||
186 | |||
187 | local->ops->sta_notify(local_to_hw(local), &sdata->vif, | ||
188 | STA_NOTIFY_ADD, addr); | ||
189 | } | ||
183 | write_unlock_bh(&local->sta_lock); | 190 | write_unlock_bh(&local->sta_lock); |
184 | 191 | ||
185 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 192 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
@@ -247,9 +254,17 @@ void sta_info_free(struct sta_info *sta) | |||
247 | ieee80211_key_free(sta->key); | 254 | ieee80211_key_free(sta->key); |
248 | sta->key = NULL; | 255 | sta->key = NULL; |
249 | 256 | ||
250 | if (local->ops->sta_notify) | 257 | if (local->ops->sta_notify) { |
251 | local->ops->sta_notify(local_to_hw(local), sta->dev->ifindex, | 258 | struct ieee80211_sub_if_data *sdata; |
252 | STA_NOTIFY_REMOVE, sta->addr); | 259 | |
260 | sdata = IEEE80211_DEV_TO_SUB_IF(sta->dev); | ||
261 | |||
262 | if (sdata->type == IEEE80211_IF_TYPE_VLAN) | ||
263 | sdata = sdata->u.vlan.ap; | ||
264 | |||
265 | local->ops->sta_notify(local_to_hw(local), &sdata->vif, | ||
266 | STA_NOTIFY_REMOVE, sta->addr); | ||
267 | } | ||
253 | 268 | ||
254 | rate_control_remove_sta_debugfs(sta); | 269 | rate_control_remove_sta_debugfs(sta); |
255 | ieee80211_sta_debugfs_remove(sta); | 270 | ieee80211_sta_debugfs_remove(sta); |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index f6194167253d..1b772ee2fe14 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -999,9 +999,7 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | |||
999 | return TXRX_CONTINUE; | 999 | return TXRX_CONTINUE; |
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | /* Device in tx->dev has a reference added; use dev_put(tx->dev) when | 1002 | /* |
1003 | * finished with it. | ||
1004 | * | ||
1005 | * NB: @tx is uninitialised when passed in here | 1003 | * NB: @tx is uninitialised when passed in here |
1006 | */ | 1004 | */ |
1007 | static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | 1005 | static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, |
@@ -1022,6 +1020,7 @@ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, | |||
1022 | return -ENODEV; | 1020 | return -ENODEV; |
1023 | /* initialises tx with control */ | 1021 | /* initialises tx with control */ |
1024 | __ieee80211_tx_prepare(tx, skb, dev, control); | 1022 | __ieee80211_tx_prepare(tx, skb, dev, control); |
1023 | dev_put(dev); | ||
1025 | return 0; | 1024 | return 0; |
1026 | } | 1025 | } |
1027 | 1026 | ||
@@ -1252,7 +1251,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1252 | } | 1251 | } |
1253 | } | 1252 | } |
1254 | 1253 | ||
1255 | control.ifindex = odev->ifindex; | 1254 | control.vif = &osdata->vif; |
1256 | control.type = osdata->type; | 1255 | control.type = osdata->type; |
1257 | if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS) | 1256 | if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS) |
1258 | control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS; | 1257 | control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS; |
@@ -1691,7 +1690,8 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local, | |||
1691 | read_unlock_bh(&local->sta_lock); | 1690 | read_unlock_bh(&local->sta_lock); |
1692 | } | 1691 | } |
1693 | 1692 | ||
1694 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, | 1693 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, |
1694 | struct ieee80211_vif *vif, | ||
1695 | struct ieee80211_tx_control *control) | 1695 | struct ieee80211_tx_control *control) |
1696 | { | 1696 | { |
1697 | struct ieee80211_local *local = hw_to_local(hw); | 1697 | 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, | |||
1703 | u8 *b_head, *b_tail; | 1703 | u8 *b_head, *b_tail; |
1704 | int bh_len, bt_len; | 1704 | int bh_len, bt_len; |
1705 | 1705 | ||
1706 | bdev = dev_get_by_index(&init_net, if_id); | 1706 | sdata = vif_to_sdata(vif); |
1707 | if (bdev) { | 1707 | bdev = sdata->dev; |
1708 | sdata = IEEE80211_DEV_TO_SUB_IF(bdev); | 1708 | ap = &sdata->u.ap; |
1709 | ap = &sdata->u.ap; | ||
1710 | dev_put(bdev); | ||
1711 | } | ||
1712 | 1709 | ||
1713 | if (!ap || sdata->type != IEEE80211_IF_TYPE_AP || | 1710 | if (!ap || sdata->type != IEEE80211_IF_TYPE_AP || |
1714 | !ap->beacon_head) { | 1711 | !ap->beacon_head) { |
1715 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1712 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1716 | if (net_ratelimit()) | 1713 | if (net_ratelimit()) |
1717 | printk(KERN_DEBUG "no beacon data avail for idx=%d " | 1714 | printk(KERN_DEBUG "no beacon data avail for %s\n", |
1718 | "(%s)\n", if_id, bdev ? bdev->name : "N/A"); | 1715 | bdev->name); |
1719 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 1716 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
1720 | return NULL; | 1717 | return NULL; |
1721 | } | 1718 | } |
@@ -1771,7 +1768,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, int if_id, | |||
1771 | } | 1768 | } |
1772 | EXPORT_SYMBOL(ieee80211_beacon_get); | 1769 | EXPORT_SYMBOL(ieee80211_beacon_get); |
1773 | 1770 | ||
1774 | void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | 1771 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1775 | const void *frame, size_t frame_len, | 1772 | const void *frame, size_t frame_len, |
1776 | const struct ieee80211_tx_control *frame_txctl, | 1773 | const struct ieee80211_tx_control *frame_txctl, |
1777 | struct ieee80211_rts *rts) | 1774 | struct ieee80211_rts *rts) |
@@ -1781,13 +1778,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | |||
1781 | 1778 | ||
1782 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS; | 1779 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS; |
1783 | rts->frame_control = cpu_to_le16(fctl); | 1780 | rts->frame_control = cpu_to_le16(fctl); |
1784 | rts->duration = ieee80211_rts_duration(hw, if_id, frame_len, frame_txctl); | 1781 | rts->duration = ieee80211_rts_duration(hw, vif, frame_len, |
1782 | frame_txctl); | ||
1785 | memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); | 1783 | memcpy(rts->ra, hdr->addr1, sizeof(rts->ra)); |
1786 | memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); | 1784 | memcpy(rts->ta, hdr->addr2, sizeof(rts->ta)); |
1787 | } | 1785 | } |
1788 | EXPORT_SYMBOL(ieee80211_rts_get); | 1786 | EXPORT_SYMBOL(ieee80211_rts_get); |
1789 | 1787 | ||
1790 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | 1788 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1791 | const void *frame, size_t frame_len, | 1789 | const void *frame, size_t frame_len, |
1792 | const struct ieee80211_tx_control *frame_txctl, | 1790 | const struct ieee80211_tx_control *frame_txctl, |
1793 | struct ieee80211_cts *cts) | 1791 | struct ieee80211_cts *cts) |
@@ -1797,13 +1795,15 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | |||
1797 | 1795 | ||
1798 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS; | 1796 | fctl = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS; |
1799 | cts->frame_control = cpu_to_le16(fctl); | 1797 | cts->frame_control = cpu_to_le16(fctl); |
1800 | cts->duration = ieee80211_ctstoself_duration(hw, if_id, frame_len, frame_txctl); | 1798 | cts->duration = ieee80211_ctstoself_duration(hw, vif, |
1799 | frame_len, frame_txctl); | ||
1801 | memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); | 1800 | memcpy(cts->ra, hdr->addr1, sizeof(cts->ra)); |
1802 | } | 1801 | } |
1803 | EXPORT_SYMBOL(ieee80211_ctstoself_get); | 1802 | EXPORT_SYMBOL(ieee80211_ctstoself_get); |
1804 | 1803 | ||
1805 | struct sk_buff * | 1804 | struct sk_buff * |
1806 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | 1805 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, |
1806 | struct ieee80211_vif *vif, | ||
1807 | struct ieee80211_tx_control *control) | 1807 | struct ieee80211_tx_control *control) |
1808 | { | 1808 | { |
1809 | struct ieee80211_local *local = hw_to_local(hw); | 1809 | struct ieee80211_local *local = hw_to_local(hw); |
@@ -1816,12 +1816,9 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | |||
1816 | struct ieee80211_sub_if_data *sdata; | 1816 | struct ieee80211_sub_if_data *sdata; |
1817 | struct ieee80211_if_ap *bss = NULL; | 1817 | struct ieee80211_if_ap *bss = NULL; |
1818 | 1818 | ||
1819 | bdev = dev_get_by_index(&init_net, if_id); | 1819 | sdata = vif_to_sdata(vif); |
1820 | if (bdev) { | 1820 | bdev = sdata->dev; |
1821 | sdata = IEEE80211_DEV_TO_SUB_IF(bdev); | 1821 | |
1822 | bss = &sdata->u.ap; | ||
1823 | dev_put(bdev); | ||
1824 | } | ||
1825 | if (!bss || sdata->type != IEEE80211_IF_TYPE_AP || !bss->beacon_head) | 1822 | if (!bss || sdata->type != IEEE80211_IF_TYPE_AP || !bss->beacon_head) |
1826 | return NULL; | 1823 | return NULL; |
1827 | 1824 | ||
@@ -1857,7 +1854,6 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | |||
1857 | if (res == TXRX_DROP || res == TXRX_QUEUED) | 1854 | if (res == TXRX_DROP || res == TXRX_QUEUED) |
1858 | break; | 1855 | break; |
1859 | } | 1856 | } |
1860 | dev_put(tx.dev); | ||
1861 | skb = tx.skb; /* handlers are allowed to change skb */ | 1857 | skb = tx.skb; /* handlers are allowed to change skb */ |
1862 | 1858 | ||
1863 | if (res == TXRX_DROP) { | 1859 | if (res == TXRX_DROP) { |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index adb85dd5098d..15503ca3e945 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, | |||
302 | } | 302 | } |
303 | 303 | ||
304 | /* Exported duration function for driver use */ | 304 | /* Exported duration function for driver use */ |
305 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, | 305 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, |
306 | struct ieee80211_vif *vif, | ||
306 | size_t frame_len, int rate) | 307 | size_t frame_len, int rate) |
307 | { | 308 | { |
308 | struct ieee80211_local *local = hw_to_local(hw); | 309 | struct ieee80211_local *local = hw_to_local(hw); |
309 | struct net_device *bdev = dev_get_by_index(&init_net, if_id); | 310 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
310 | struct ieee80211_sub_if_data *sdata; | ||
311 | u16 dur; | 311 | u16 dur; |
312 | int erp; | 312 | int erp; |
313 | 313 | ||
314 | if (unlikely(!bdev)) | ||
315 | return 0; | ||
316 | |||
317 | sdata = IEEE80211_DEV_TO_SUB_IF(bdev); | ||
318 | erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); | 314 | erp = ieee80211_is_erp_rate(hw->conf.phymode, rate); |
319 | dur = ieee80211_frame_duration(local, frame_len, rate, | 315 | dur = ieee80211_frame_duration(local, frame_len, rate, |
320 | erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); | 316 | erp, sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE); |
321 | 317 | ||
322 | dev_put(bdev); | ||
323 | return cpu_to_le16(dur); | 318 | return cpu_to_le16(dur); |
324 | } | 319 | } |
325 | EXPORT_SYMBOL(ieee80211_generic_frame_duration); | 320 | EXPORT_SYMBOL(ieee80211_generic_frame_duration); |
326 | 321 | ||
327 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | 322 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, |
328 | size_t frame_len, | 323 | struct ieee80211_vif *vif, size_t frame_len, |
329 | const struct ieee80211_tx_control *frame_txctl) | 324 | const struct ieee80211_tx_control *frame_txctl) |
330 | { | 325 | { |
331 | struct ieee80211_local *local = hw_to_local(hw); | 326 | struct ieee80211_local *local = hw_to_local(hw); |
332 | struct ieee80211_rate *rate; | 327 | struct ieee80211_rate *rate; |
333 | struct net_device *bdev = dev_get_by_index(&init_net, if_id); | 328 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
334 | struct ieee80211_sub_if_data *sdata; | ||
335 | int short_preamble; | 329 | int short_preamble; |
336 | int erp; | 330 | int erp; |
337 | u16 dur; | 331 | u16 dur; |
338 | 332 | ||
339 | if (unlikely(!bdev)) | ||
340 | return 0; | ||
341 | |||
342 | sdata = IEEE80211_DEV_TO_SUB_IF(bdev); | ||
343 | short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; | 333 | short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; |
344 | 334 | ||
345 | rate = frame_txctl->rts_rate; | 335 | rate = frame_txctl->rts_rate; |
@@ -355,27 +345,22 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | |||
355 | dur += ieee80211_frame_duration(local, 10, rate->rate, | 345 | dur += ieee80211_frame_duration(local, 10, rate->rate, |
356 | erp, short_preamble); | 346 | erp, short_preamble); |
357 | 347 | ||
358 | dev_put(bdev); | ||
359 | return cpu_to_le16(dur); | 348 | return cpu_to_le16(dur); |
360 | } | 349 | } |
361 | EXPORT_SYMBOL(ieee80211_rts_duration); | 350 | EXPORT_SYMBOL(ieee80211_rts_duration); |
362 | 351 | ||
363 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, | 352 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, |
353 | struct ieee80211_vif *vif, | ||
364 | size_t frame_len, | 354 | size_t frame_len, |
365 | const struct ieee80211_tx_control *frame_txctl) | 355 | const struct ieee80211_tx_control *frame_txctl) |
366 | { | 356 | { |
367 | struct ieee80211_local *local = hw_to_local(hw); | 357 | struct ieee80211_local *local = hw_to_local(hw); |
368 | struct ieee80211_rate *rate; | 358 | struct ieee80211_rate *rate; |
369 | struct net_device *bdev = dev_get_by_index(&init_net, if_id); | 359 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
370 | struct ieee80211_sub_if_data *sdata; | ||
371 | int short_preamble; | 360 | int short_preamble; |
372 | int erp; | 361 | int erp; |
373 | u16 dur; | 362 | u16 dur; |
374 | 363 | ||
375 | if (unlikely(!bdev)) | ||
376 | return 0; | ||
377 | |||
378 | sdata = IEEE80211_DEV_TO_SUB_IF(bdev); | ||
379 | short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; | 364 | short_preamble = sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE; |
380 | 365 | ||
381 | rate = frame_txctl->rts_rate; | 366 | rate = frame_txctl->rts_rate; |
@@ -390,7 +375,6 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, | |||
390 | erp, short_preamble); | 375 | erp, short_preamble); |
391 | } | 376 | } |
392 | 377 | ||
393 | dev_put(bdev); | ||
394 | return cpu_to_le16(dur); | 378 | return cpu_to_le16(dur); |
395 | } | 379 | } |
396 | EXPORT_SYMBOL(ieee80211_ctstoself_duration); | 380 | EXPORT_SYMBOL(ieee80211_ctstoself_duration); |
@@ -475,10 +459,11 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw) | |||
475 | } | 459 | } |
476 | EXPORT_SYMBOL(ieee80211_wake_queues); | 460 | EXPORT_SYMBOL(ieee80211_wake_queues); |
477 | 461 | ||
478 | void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, | 462 | void ieee80211_iterate_active_interfaces( |
479 | void (*iterator)(void *data, u8 *mac, | 463 | struct ieee80211_hw *hw, |
480 | int if_id), | 464 | void (*iterator)(void *data, u8 *mac, |
481 | void *data) | 465 | struct ieee80211_vif *vif), |
466 | void *data) | ||
482 | { | 467 | { |
483 | struct ieee80211_local *local = hw_to_local(hw); | 468 | struct ieee80211_local *local = hw_to_local(hw); |
484 | struct ieee80211_sub_if_data *sdata; | 469 | struct ieee80211_sub_if_data *sdata; |
@@ -501,7 +486,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, | |||
501 | continue; | 486 | continue; |
502 | if (netif_running(sdata->dev)) | 487 | if (netif_running(sdata->dev)) |
503 | iterator(data, sdata->dev->dev_addr, | 488 | iterator(data, sdata->dev->dev_addr, |
504 | sdata->dev->ifindex); | 489 | &sdata->vif); |
505 | } | 490 | } |
506 | 491 | ||
507 | rcu_read_unlock(); | 492 | rcu_read_unlock(); |