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 /drivers/net/wireless/b43 | |
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>
Diffstat (limited to 'drivers/net/wireless/b43')
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 5 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/b43/xmit.c | 6 |
3 files changed, 11 insertions, 13 deletions
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)); |