diff options
author | Eliad Peller <eliad@wizery.com> | 2011-10-05 05:55:45 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-10-07 01:32:37 -0400 |
commit | 536129c8ad35de87ff2f864f205a54ac32bfebcc (patch) | |
tree | 0d9b40906e00bf2a11a692262d1094161d770e63 /drivers | |
parent | cdf09495588fda7e9c15c25bc20cb828e07be314 (diff) |
wl12xx: move bss_type into wlvif
move bss_type into the per-interface data, rather than
being global.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/wl12xx/cmd.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/debugfs.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/event.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/init.c | 10 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/main.c | 109 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/rx.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/scan.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/scan.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/tx.c | 86 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/tx.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl12xx.h | 3 |
11 files changed, 141 insertions, 101 deletions
diff --git a/drivers/net/wireless/wl12xx/cmd.c b/drivers/net/wireless/wl12xx/cmd.c index b9bb76b22f58..096a713a8c94 100644 --- a/drivers/net/wireless/wl12xx/cmd.c +++ b/drivers/net/wireless/wl12xx/cmd.c | |||
@@ -1042,7 +1042,7 @@ int wl12xx_cmd_build_null_data(struct wl1271 *wl, struct wl12xx_vif *wlvif) | |||
1042 | int ret = -ENOMEM; | 1042 | int ret = -ENOMEM; |
1043 | 1043 | ||
1044 | 1044 | ||
1045 | if (wl->bss_type == BSS_TYPE_IBSS) { | 1045 | if (wlvif->bss_type == BSS_TYPE_IBSS) { |
1046 | size = sizeof(struct wl12xx_null_data_template); | 1046 | size = sizeof(struct wl12xx_null_data_template); |
1047 | ptr = NULL; | 1047 | ptr = NULL; |
1048 | } else { | 1048 | } else { |
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index 620acbfd9ec3..8f88ad6496f9 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -350,7 +350,6 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf, | |||
350 | DRIVER_STATE_PRINT_INT(rx_counter); | 350 | DRIVER_STATE_PRINT_INT(rx_counter); |
351 | DRIVER_STATE_PRINT_INT(session_counter); | 351 | DRIVER_STATE_PRINT_INT(session_counter); |
352 | DRIVER_STATE_PRINT_INT(state); | 352 | DRIVER_STATE_PRINT_INT(state); |
353 | DRIVER_STATE_PRINT_INT(bss_type); | ||
354 | DRIVER_STATE_PRINT_INT(channel); | 353 | DRIVER_STATE_PRINT_INT(channel); |
355 | DRIVER_STATE_PRINT_INT(band); | 354 | DRIVER_STATE_PRINT_INT(band); |
356 | DRIVER_STATE_PRINT_INT(beacon_int); | 355 | DRIVER_STATE_PRINT_INT(beacon_int); |
diff --git a/drivers/net/wireless/wl12xx/event.c b/drivers/net/wireless/wl12xx/event.c index 30d05fd24672..072addc0bffc 100644 --- a/drivers/net/wireless/wl12xx/event.c +++ b/drivers/net/wireless/wl12xx/event.c | |||
@@ -178,9 +178,9 @@ static void wl1271_event_rssi_trigger(struct wl1271 *wl, | |||
178 | wl->last_rssi_event = event; | 178 | wl->last_rssi_event = event; |
179 | } | 179 | } |
180 | 180 | ||
181 | static void wl1271_stop_ba_event(struct wl1271 *wl) | 181 | static void wl1271_stop_ba_event(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
182 | { | 182 | { |
183 | if (wl->bss_type != BSS_TYPE_AP_BSS) { | 183 | if (wlvif->bss_type != BSS_TYPE_AP_BSS) { |
184 | if (!wl->ba_rx_bitmap) | 184 | if (!wl->ba_rx_bitmap) |
185 | return; | 185 | return; |
186 | ieee80211_stop_rx_ba_session(wl->vif, wl->ba_rx_bitmap, | 186 | ieee80211_stop_rx_ba_session(wl->vif, wl->ba_rx_bitmap, |
@@ -229,7 +229,7 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) | |||
229 | int ret; | 229 | int ret; |
230 | u32 vector; | 230 | u32 vector; |
231 | bool beacon_loss = false; | 231 | bool beacon_loss = false; |
232 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 232 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
233 | bool disconnect_sta = false; | 233 | bool disconnect_sta = false; |
234 | unsigned long sta_bitmap = 0; | 234 | unsigned long sta_bitmap = 0; |
235 | 235 | ||
@@ -263,7 +263,7 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) | |||
263 | } | 263 | } |
264 | 264 | ||
265 | if (vector & SOFT_GEMINI_SENSE_EVENT_ID && | 265 | if (vector & SOFT_GEMINI_SENSE_EVENT_ID && |
266 | wl->bss_type == BSS_TYPE_STA_BSS) | 266 | wlvif->bss_type == BSS_TYPE_STA_BSS) |
267 | wl12xx_event_soft_gemini_sense(wl, | 267 | wl12xx_event_soft_gemini_sense(wl, |
268 | mbox->soft_gemini_sense_info); | 268 | mbox->soft_gemini_sense_info); |
269 | 269 | ||
@@ -306,7 +306,7 @@ static int wl1271_event_process(struct wl1271 *wl, struct event_mailbox *mbox) | |||
306 | wl->ba_allowed = !!mbox->rx_ba_allowed; | 306 | wl->ba_allowed = !!mbox->rx_ba_allowed; |
307 | 307 | ||
308 | if (wl->vif && !wl->ba_allowed) | 308 | if (wl->vif && !wl->ba_allowed) |
309 | wl1271_stop_ba_event(wl); | 309 | wl1271_stop_ba_event(wl, wlvif); |
310 | } | 310 | } |
311 | 311 | ||
312 | if ((vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID) && !is_ap) { | 312 | if ((vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID) && !is_ap) { |
diff --git a/drivers/net/wireless/wl12xx/init.c b/drivers/net/wireless/wl12xx/init.c index ed27c5f06bb2..e54cc693ff69 100644 --- a/drivers/net/wireless/wl12xx/init.c +++ b/drivers/net/wireless/wl12xx/init.c | |||
@@ -478,7 +478,7 @@ int wl1271_init_ap_rates(struct wl1271 *wl, struct wl12xx_vif *wlvif) | |||
478 | return 0; | 478 | return 0; |
479 | } | 479 | } |
480 | 480 | ||
481 | static int wl1271_set_ba_policies(struct wl1271 *wl) | 481 | static int wl1271_set_ba_policies(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
482 | { | 482 | { |
483 | /* Reset the BA RX indicators */ | 483 | /* Reset the BA RX indicators */ |
484 | wl->ba_rx_bitmap = 0; | 484 | wl->ba_rx_bitmap = 0; |
@@ -486,8 +486,8 @@ static int wl1271_set_ba_policies(struct wl1271 *wl) | |||
486 | wl->ba_rx_session_count = 0; | 486 | wl->ba_rx_session_count = 0; |
487 | 487 | ||
488 | /* BA is supported in STA/AP modes */ | 488 | /* BA is supported in STA/AP modes */ |
489 | if (wl->bss_type != BSS_TYPE_AP_BSS && | 489 | if (wlvif->bss_type != BSS_TYPE_AP_BSS && |
490 | wl->bss_type != BSS_TYPE_STA_BSS) { | 490 | wlvif->bss_type != BSS_TYPE_STA_BSS) { |
491 | wl->ba_support = false; | 491 | wl->ba_support = false; |
492 | return 0; | 492 | return 0; |
493 | } | 493 | } |
@@ -572,7 +572,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) | |||
572 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | 572 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); |
573 | struct conf_tx_ac_category *conf_ac; | 573 | struct conf_tx_ac_category *conf_ac; |
574 | struct conf_tx_tid *conf_tid; | 574 | struct conf_tx_tid *conf_tid; |
575 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 575 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
576 | 576 | ||
577 | int ret, i; | 577 | int ret, i; |
578 | 578 | ||
@@ -635,7 +635,7 @@ int wl1271_init_vif_specific(struct wl1271 *wl, struct ieee80211_vif *vif) | |||
635 | return ret; | 635 | return ret; |
636 | 636 | ||
637 | /* Configure initiator BA sessions policies */ | 637 | /* Configure initiator BA sessions policies */ |
638 | ret = wl1271_set_ba_policies(wl); | 638 | ret = wl1271_set_ba_policies(wl, wlvif); |
639 | if (ret < 0) | 639 | if (ret < 0) |
640 | return ret; | 640 | return ret; |
641 | 641 | ||
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index d19c3fe34860..5b13af0f8e8e 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -377,6 +377,7 @@ static char *fwlog_param; | |||
377 | static bool bug_on_recovery; | 377 | static bool bug_on_recovery; |
378 | 378 | ||
379 | static void __wl1271_op_remove_interface(struct wl1271 *wl, | 379 | static void __wl1271_op_remove_interface(struct wl1271 *wl, |
380 | struct ieee80211_vif *vif, | ||
380 | bool reset_tx_queues); | 381 | bool reset_tx_queues); |
381 | static void wl1271_free_ap_keys(struct wl1271 *wl); | 382 | static void wl1271_free_ap_keys(struct wl1271 *wl); |
382 | 383 | ||
@@ -844,6 +845,8 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl, | |||
844 | static void wl12xx_fw_status(struct wl1271 *wl, | 845 | static void wl12xx_fw_status(struct wl1271 *wl, |
845 | struct wl12xx_fw_status *status) | 846 | struct wl12xx_fw_status *status) |
846 | { | 847 | { |
848 | struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ | ||
849 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
847 | struct timespec ts; | 850 | struct timespec ts; |
848 | u32 old_tx_blk_count = wl->tx_blocks_available; | 851 | u32 old_tx_blk_count = wl->tx_blocks_available; |
849 | int avail, freed_blocks; | 852 | int avail, freed_blocks; |
@@ -898,7 +901,7 @@ static void wl12xx_fw_status(struct wl1271 *wl, | |||
898 | clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); | 901 | clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); |
899 | 902 | ||
900 | /* for AP update num of allocated TX blocks per link and ps status */ | 903 | /* for AP update num of allocated TX blocks per link and ps status */ |
901 | if (wl->bss_type == BSS_TYPE_AP_BSS) | 904 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) |
902 | wl12xx_irq_update_links_status(wl, status); | 905 | wl12xx_irq_update_links_status(wl, status); |
903 | 906 | ||
904 | /* update the host-chipset time offset */ | 907 | /* update the host-chipset time offset */ |
@@ -1004,7 +1007,7 @@ irqreturn_t wl1271_irq(int irq, void *cookie) | |||
1004 | * In order to avoid starvation of the TX path, | 1007 | * In order to avoid starvation of the TX path, |
1005 | * call the work function directly. | 1008 | * call the work function directly. |
1006 | */ | 1009 | */ |
1007 | wl1271_tx_work_locked(wl); | 1010 | wl1271_tx_work_locked(wl, wl->vif); |
1008 | } else { | 1011 | } else { |
1009 | spin_unlock_irqrestore(&wl->wl_lock, flags); | 1012 | spin_unlock_irqrestore(&wl->wl_lock, flags); |
1010 | } | 1013 | } |
@@ -1251,7 +1254,7 @@ static void wl1271_recovery_work(struct work_struct *work) | |||
1251 | } | 1254 | } |
1252 | 1255 | ||
1253 | /* reboot the chipset */ | 1256 | /* reboot the chipset */ |
1254 | __wl1271_op_remove_interface(wl, false); | 1257 | __wl1271_op_remove_interface(wl, wl->vif, false); |
1255 | 1258 | ||
1256 | clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags); | 1259 | clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags); |
1257 | 1260 | ||
@@ -1389,8 +1392,6 @@ int wl1271_plt_start(struct wl1271 *wl) | |||
1389 | goto out; | 1392 | goto out; |
1390 | } | 1393 | } |
1391 | 1394 | ||
1392 | wl->bss_type = BSS_TYPE_STA_BSS; | ||
1393 | |||
1394 | while (retries) { | 1395 | while (retries) { |
1395 | retries--; | 1396 | retries--; |
1396 | ret = wl1271_chip_wakeup(wl); | 1397 | ret = wl1271_chip_wakeup(wl); |
@@ -1482,6 +1483,8 @@ int wl1271_plt_stop(struct wl1271 *wl) | |||
1482 | static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 1483 | static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
1483 | { | 1484 | { |
1484 | struct wl1271 *wl = hw->priv; | 1485 | struct wl1271 *wl = hw->priv; |
1486 | struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb); | ||
1487 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(control->control.vif); | ||
1485 | unsigned long flags; | 1488 | unsigned long flags; |
1486 | int q, mapping; | 1489 | int q, mapping; |
1487 | u8 hlid = 0; | 1490 | u8 hlid = 0; |
@@ -1489,13 +1492,13 @@ static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | |||
1489 | mapping = skb_get_queue_mapping(skb); | 1492 | mapping = skb_get_queue_mapping(skb); |
1490 | q = wl1271_tx_get_queue(mapping); | 1493 | q = wl1271_tx_get_queue(mapping); |
1491 | 1494 | ||
1492 | if (wl->bss_type == BSS_TYPE_AP_BSS) | 1495 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) |
1493 | hlid = wl12xx_tx_get_hlid_ap(wl, skb); | 1496 | hlid = wl12xx_tx_get_hlid_ap(wl, skb); |
1494 | 1497 | ||
1495 | spin_lock_irqsave(&wl->wl_lock, flags); | 1498 | spin_lock_irqsave(&wl->wl_lock, flags); |
1496 | 1499 | ||
1497 | /* queue the packet */ | 1500 | /* queue the packet */ |
1498 | if (wl->bss_type == BSS_TYPE_AP_BSS) { | 1501 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) { |
1499 | if (!wl1271_is_active_sta(wl, hlid)) { | 1502 | if (!wl1271_is_active_sta(wl, hlid)) { |
1500 | wl1271_debug(DEBUG_TX, "DROP skb hlid %d q %d", | 1503 | wl1271_debug(DEBUG_TX, "DROP skb hlid %d q %d", |
1501 | hlid, q); | 1504 | hlid, q); |
@@ -1552,7 +1555,7 @@ int wl1271_tx_dummy_packet(struct wl1271 *wl) | |||
1552 | 1555 | ||
1553 | /* The FW is low on RX memory blocks, so send the dummy packet asap */ | 1556 | /* The FW is low on RX memory blocks, so send the dummy packet asap */ |
1554 | if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags)) | 1557 | if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags)) |
1555 | wl1271_tx_work_locked(wl); | 1558 | wl1271_tx_work_locked(wl, wl->vif); |
1556 | 1559 | ||
1557 | /* | 1560 | /* |
1558 | * If the FW TX is busy, TX work will be scheduled by the threaded | 1561 | * If the FW TX is busy, TX work will be scheduled by the threaded |
@@ -1686,9 +1689,9 @@ out_unlock: | |||
1686 | static int wl1271_configure_suspend(struct wl1271 *wl, | 1689 | static int wl1271_configure_suspend(struct wl1271 *wl, |
1687 | struct wl12xx_vif *wlvif) | 1690 | struct wl12xx_vif *wlvif) |
1688 | { | 1691 | { |
1689 | if (wl->bss_type == BSS_TYPE_STA_BSS) | 1692 | if (wlvif->bss_type == BSS_TYPE_STA_BSS) |
1690 | return wl1271_configure_suspend_sta(wl, wlvif); | 1693 | return wl1271_configure_suspend_sta(wl, wlvif); |
1691 | if (wl->bss_type == BSS_TYPE_AP_BSS) | 1694 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) |
1692 | return wl1271_configure_suspend_ap(wl); | 1695 | return wl1271_configure_suspend_ap(wl); |
1693 | return 0; | 1696 | return 0; |
1694 | } | 1697 | } |
@@ -1697,8 +1700,8 @@ static void wl1271_configure_resume(struct wl1271 *wl, | |||
1697 | struct wl12xx_vif *wlvif) | 1700 | struct wl12xx_vif *wlvif) |
1698 | { | 1701 | { |
1699 | int ret; | 1702 | int ret; |
1700 | bool is_sta = wl->bss_type == BSS_TYPE_STA_BSS; | 1703 | bool is_sta = wlvif->bss_type == BSS_TYPE_STA_BSS; |
1701 | bool is_ap = wl->bss_type == BSS_TYPE_AP_BSS; | 1704 | bool is_ap = wlvif->bss_type == BSS_TYPE_AP_BSS; |
1702 | 1705 | ||
1703 | if (!is_sta && !is_ap) | 1706 | if (!is_sta && !is_ap) |
1704 | return; | 1707 | return; |
@@ -1820,9 +1823,9 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1820 | wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); | 1823 | wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); |
1821 | } | 1824 | } |
1822 | 1825 | ||
1823 | static u8 wl12xx_get_role_type(struct wl1271 *wl) | 1826 | static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
1824 | { | 1827 | { |
1825 | switch (wl->bss_type) { | 1828 | switch (wlvif->bss_type) { |
1826 | case BSS_TYPE_AP_BSS: | 1829 | case BSS_TYPE_AP_BSS: |
1827 | if (wl->p2p) | 1830 | if (wl->p2p) |
1828 | return WL1271_ROLE_P2P_GO; | 1831 | return WL1271_ROLE_P2P_GO; |
@@ -1839,13 +1842,14 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl) | |||
1839 | return WL1271_ROLE_IBSS; | 1842 | return WL1271_ROLE_IBSS; |
1840 | 1843 | ||
1841 | default: | 1844 | default: |
1842 | wl1271_error("invalid bss_type: %d", wl->bss_type); | 1845 | wl1271_error("invalid bss_type: %d", wlvif->bss_type); |
1843 | } | 1846 | } |
1844 | return WL12XX_INVALID_ROLE_TYPE; | 1847 | return WL12XX_INVALID_ROLE_TYPE; |
1845 | } | 1848 | } |
1846 | 1849 | ||
1847 | static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif) | 1850 | static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif) |
1848 | { | 1851 | { |
1852 | wlvif->bss_type = MAX_BSS_TYPE; | ||
1849 | wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; | 1853 | wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; |
1850 | wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC; | 1854 | wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC; |
1851 | wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; | 1855 | wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; |
@@ -1856,6 +1860,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1856 | { | 1860 | { |
1857 | struct wl1271 *wl = hw->priv; | 1861 | struct wl1271 *wl = hw->priv; |
1858 | struct wiphy *wiphy = hw->wiphy; | 1862 | struct wiphy *wiphy = hw->wiphy; |
1863 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
1859 | int retries = WL1271_BOOT_RETRIES; | 1864 | int retries = WL1271_BOOT_RETRIES; |
1860 | int ret = 0; | 1865 | int ret = 0; |
1861 | u8 role_type; | 1866 | u8 role_type; |
@@ -1871,7 +1876,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1871 | ret = -EBUSY; | 1876 | ret = -EBUSY; |
1872 | goto out; | 1877 | goto out; |
1873 | } | 1878 | } |
1874 | wl12xx_init_vif_data(wl12xx_vif_to_data(vif)); | 1879 | wl12xx_init_vif_data(wlvif); |
1875 | 1880 | ||
1876 | /* | 1881 | /* |
1877 | * in some very corner case HW recovery scenarios its possible to | 1882 | * in some very corner case HW recovery scenarios its possible to |
@@ -1888,25 +1893,25 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1888 | wl->p2p = 1; | 1893 | wl->p2p = 1; |
1889 | /* fall-through */ | 1894 | /* fall-through */ |
1890 | case NL80211_IFTYPE_STATION: | 1895 | case NL80211_IFTYPE_STATION: |
1891 | wl->bss_type = BSS_TYPE_STA_BSS; | 1896 | wlvif->bss_type = BSS_TYPE_STA_BSS; |
1892 | wl->set_bss_type = BSS_TYPE_STA_BSS; | 1897 | wl->set_bss_type = BSS_TYPE_STA_BSS; |
1893 | break; | 1898 | break; |
1894 | case NL80211_IFTYPE_ADHOC: | 1899 | case NL80211_IFTYPE_ADHOC: |
1895 | wl->bss_type = BSS_TYPE_IBSS; | 1900 | wlvif->bss_type = BSS_TYPE_IBSS; |
1896 | wl->set_bss_type = BSS_TYPE_STA_BSS; | 1901 | wl->set_bss_type = BSS_TYPE_STA_BSS; |
1897 | break; | 1902 | break; |
1898 | case NL80211_IFTYPE_P2P_GO: | 1903 | case NL80211_IFTYPE_P2P_GO: |
1899 | wl->p2p = 1; | 1904 | wl->p2p = 1; |
1900 | /* fall-through */ | 1905 | /* fall-through */ |
1901 | case NL80211_IFTYPE_AP: | 1906 | case NL80211_IFTYPE_AP: |
1902 | wl->bss_type = BSS_TYPE_AP_BSS; | 1907 | wlvif->bss_type = BSS_TYPE_AP_BSS; |
1903 | break; | 1908 | break; |
1904 | default: | 1909 | default: |
1905 | ret = -EOPNOTSUPP; | 1910 | ret = -EOPNOTSUPP; |
1906 | goto out; | 1911 | goto out; |
1907 | } | 1912 | } |
1908 | 1913 | ||
1909 | role_type = wl12xx_get_role_type(wl); | 1914 | role_type = wl12xx_get_role_type(wl, wlvif); |
1910 | if (role_type == WL12XX_INVALID_ROLE_TYPE) { | 1915 | if (role_type == WL12XX_INVALID_ROLE_TYPE) { |
1911 | ret = -EINVAL; | 1916 | ret = -EINVAL; |
1912 | goto out; | 1917 | goto out; |
@@ -1938,8 +1943,8 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1938 | if (ret < 0) | 1943 | if (ret < 0) |
1939 | goto irq_disable; | 1944 | goto irq_disable; |
1940 | 1945 | ||
1941 | if (wl->bss_type == BSS_TYPE_STA_BSS || | 1946 | if (wlvif->bss_type == BSS_TYPE_STA_BSS || |
1942 | wl->bss_type == BSS_TYPE_IBSS) { | 1947 | wlvif->bss_type == BSS_TYPE_IBSS) { |
1943 | /* | 1948 | /* |
1944 | * The device role is a special role used for | 1949 | * The device role is a special role used for |
1945 | * rx and tx frames prior to association (as | 1950 | * rx and tx frames prior to association (as |
@@ -2020,8 +2025,10 @@ out: | |||
2020 | } | 2025 | } |
2021 | 2026 | ||
2022 | static void __wl1271_op_remove_interface(struct wl1271 *wl, | 2027 | static void __wl1271_op_remove_interface(struct wl1271 *wl, |
2028 | struct ieee80211_vif *vif, | ||
2023 | bool reset_tx_queues) | 2029 | bool reset_tx_queues) |
2024 | { | 2030 | { |
2031 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
2025 | int ret, i; | 2032 | int ret, i; |
2026 | 2033 | ||
2027 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); | 2034 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); |
@@ -2037,7 +2044,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, | |||
2037 | mutex_unlock(&wl_list_mutex); | 2044 | mutex_unlock(&wl_list_mutex); |
2038 | 2045 | ||
2039 | /* enable dyn ps just in case (if left on due to fw crash etc) */ | 2046 | /* enable dyn ps just in case (if left on due to fw crash etc) */ |
2040 | if (wl->bss_type == BSS_TYPE_STA_BSS) | 2047 | if (wlvif->bss_type == BSS_TYPE_STA_BSS) |
2041 | ieee80211_enable_dyn_ps(wl->vif); | 2048 | ieee80211_enable_dyn_ps(wl->vif); |
2042 | 2049 | ||
2043 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { | 2050 | if (wl->scan.state != WL1271_SCAN_STATE_IDLE) { |
@@ -2054,7 +2061,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, | |||
2054 | if (ret < 0) | 2061 | if (ret < 0) |
2055 | goto deinit; | 2062 | goto deinit; |
2056 | 2063 | ||
2057 | if (wl->bss_type == BSS_TYPE_STA_BSS) { | 2064 | if (wlvif->bss_type == BSS_TYPE_STA_BSS) { |
2058 | ret = wl12xx_cmd_role_disable(wl, &wl->dev_role_id); | 2065 | ret = wl12xx_cmd_role_disable(wl, &wl->dev_role_id); |
2059 | if (ret < 0) | 2066 | if (ret < 0) |
2060 | goto deinit; | 2067 | goto deinit; |
@@ -2100,7 +2107,6 @@ deinit: | |||
2100 | 2107 | ||
2101 | memset(wl->ssid, 0, IEEE80211_MAX_SSID_LEN + 1); | 2108 | memset(wl->ssid, 0, IEEE80211_MAX_SSID_LEN + 1); |
2102 | wl->ssid_len = 0; | 2109 | wl->ssid_len = 0; |
2103 | wl->bss_type = MAX_BSS_TYPE; | ||
2104 | wl->set_bss_type = MAX_BSS_TYPE; | 2110 | wl->set_bss_type = MAX_BSS_TYPE; |
2105 | wl->p2p = 0; | 2111 | wl->p2p = 0; |
2106 | wl->band = IEEE80211_BAND_2GHZ; | 2112 | wl->band = IEEE80211_BAND_2GHZ; |
@@ -2169,7 +2175,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, | |||
2169 | */ | 2175 | */ |
2170 | if (wl->vif) { | 2176 | if (wl->vif) { |
2171 | WARN_ON(wl->vif != vif); | 2177 | WARN_ON(wl->vif != vif); |
2172 | __wl1271_op_remove_interface(wl, true); | 2178 | __wl1271_op_remove_interface(wl, vif, true); |
2173 | } | 2179 | } |
2174 | 2180 | ||
2175 | mutex_unlock(&wl->mutex); | 2181 | mutex_unlock(&wl->mutex); |
@@ -2180,7 +2186,7 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif, | |||
2180 | bool set_assoc) | 2186 | bool set_assoc) |
2181 | { | 2187 | { |
2182 | int ret; | 2188 | int ret; |
2183 | bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); | 2189 | bool is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); |
2184 | 2190 | ||
2185 | /* | 2191 | /* |
2186 | * One of the side effects of the JOIN command is that is clears | 2192 | * One of the side effects of the JOIN command is that is clears |
@@ -2364,7 +2370,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2364 | goto out; | 2370 | goto out; |
2365 | } | 2371 | } |
2366 | 2372 | ||
2367 | is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 2373 | is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
2368 | 2374 | ||
2369 | ret = wl1271_ps_elp_wakeup(wl); | 2375 | ret = wl1271_ps_elp_wakeup(wl); |
2370 | if (ret < 0) | 2376 | if (ret < 0) |
@@ -2375,7 +2381,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
2375 | ((wl->band != conf->channel->band) || | 2381 | ((wl->band != conf->channel->band) || |
2376 | (wl->channel != channel))) { | 2382 | (wl->channel != channel))) { |
2377 | /* send all pending packets */ | 2383 | /* send all pending packets */ |
2378 | wl1271_tx_work_locked(wl); | 2384 | wl1271_tx_work_locked(wl, vif); |
2379 | wl->band = conf->channel->band; | 2385 | wl->band = conf->channel->band; |
2380 | wl->channel = channel; | 2386 | wl->channel = channel; |
2381 | 2387 | ||
@@ -2536,6 +2542,9 @@ static void wl1271_op_configure_filter(struct ieee80211_hw *hw, | |||
2536 | { | 2542 | { |
2537 | struct wl1271_filter_params *fp = (void *)(unsigned long)multicast; | 2543 | struct wl1271_filter_params *fp = (void *)(unsigned long)multicast; |
2538 | struct wl1271 *wl = hw->priv; | 2544 | struct wl1271 *wl = hw->priv; |
2545 | struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ | ||
2546 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
2547 | |||
2539 | int ret; | 2548 | int ret; |
2540 | 2549 | ||
2541 | wl1271_debug(DEBUG_MAC80211, "mac80211 configure filter changed %x" | 2550 | wl1271_debug(DEBUG_MAC80211, "mac80211 configure filter changed %x" |
@@ -2553,7 +2562,7 @@ static void wl1271_op_configure_filter(struct ieee80211_hw *hw, | |||
2553 | if (ret < 0) | 2562 | if (ret < 0) |
2554 | goto out; | 2563 | goto out; |
2555 | 2564 | ||
2556 | if (wl->bss_type != BSS_TYPE_AP_BSS) { | 2565 | if (wlvif->bss_type != BSS_TYPE_AP_BSS) { |
2557 | if (*total & FIF_ALLMULTI) | 2566 | if (*total & FIF_ALLMULTI) |
2558 | ret = wl1271_acx_group_address_tbl(wl, false, NULL, 0); | 2567 | ret = wl1271_acx_group_address_tbl(wl, false, NULL, 0); |
2559 | else if (fp) | 2568 | else if (fp) |
@@ -2673,12 +2682,13 @@ out: | |||
2673 | return ret; | 2682 | return ret; |
2674 | } | 2683 | } |
2675 | 2684 | ||
2676 | static int wl1271_set_key(struct wl1271 *wl, u16 action, u8 id, u8 key_type, | 2685 | static int wl1271_set_key(struct wl1271 *wl, struct wl12xx_vif *wlvif, |
2686 | u16 action, u8 id, u8 key_type, | ||
2677 | u8 key_size, const u8 *key, u32 tx_seq_32, | 2687 | u8 key_size, const u8 *key, u32 tx_seq_32, |
2678 | u16 tx_seq_16, struct ieee80211_sta *sta) | 2688 | u16 tx_seq_16, struct ieee80211_sta *sta) |
2679 | { | 2689 | { |
2680 | int ret; | 2690 | int ret; |
2681 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 2691 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
2682 | 2692 | ||
2683 | if (is_ap) { | 2693 | if (is_ap) { |
2684 | struct wl1271_station *wl_sta; | 2694 | struct wl1271_station *wl_sta; |
@@ -2774,6 +2784,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2774 | struct ieee80211_key_conf *key_conf) | 2784 | struct ieee80211_key_conf *key_conf) |
2775 | { | 2785 | { |
2776 | struct wl1271 *wl = hw->priv; | 2786 | struct wl1271 *wl = hw->priv; |
2787 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
2777 | int ret; | 2788 | int ret; |
2778 | u32 tx_seq_32 = 0; | 2789 | u32 tx_seq_32 = 0; |
2779 | u16 tx_seq_16 = 0; | 2790 | u16 tx_seq_16 = 0; |
@@ -2833,7 +2844,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2833 | 2844 | ||
2834 | switch (cmd) { | 2845 | switch (cmd) { |
2835 | case SET_KEY: | 2846 | case SET_KEY: |
2836 | ret = wl1271_set_key(wl, KEY_ADD_OR_REPLACE, | 2847 | ret = wl1271_set_key(wl, wlvif, KEY_ADD_OR_REPLACE, |
2837 | key_conf->keyidx, key_type, | 2848 | key_conf->keyidx, key_type, |
2838 | key_conf->keylen, key_conf->key, | 2849 | key_conf->keylen, key_conf->key, |
2839 | tx_seq_32, tx_seq_16, sta); | 2850 | tx_seq_32, tx_seq_16, sta); |
@@ -2844,7 +2855,7 @@ static int wl1271_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
2844 | break; | 2855 | break; |
2845 | 2856 | ||
2846 | case DISABLE_KEY: | 2857 | case DISABLE_KEY: |
2847 | ret = wl1271_set_key(wl, KEY_REMOVE, | 2858 | ret = wl1271_set_key(wl, wlvif, KEY_REMOVE, |
2848 | key_conf->keyidx, key_type, | 2859 | key_conf->keyidx, key_type, |
2849 | key_conf->keylen, key_conf->key, | 2860 | key_conf->keylen, key_conf->key, |
2850 | 0, 0, sta); | 2861 | 0, 0, sta); |
@@ -2966,6 +2977,7 @@ static int wl1271_op_sched_scan_start(struct ieee80211_hw *hw, | |||
2966 | struct ieee80211_sched_scan_ies *ies) | 2977 | struct ieee80211_sched_scan_ies *ies) |
2967 | { | 2978 | { |
2968 | struct wl1271 *wl = hw->priv; | 2979 | struct wl1271 *wl = hw->priv; |
2980 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
2969 | int ret; | 2981 | int ret; |
2970 | 2982 | ||
2971 | wl1271_debug(DEBUG_MAC80211, "wl1271_op_sched_scan_start"); | 2983 | wl1271_debug(DEBUG_MAC80211, "wl1271_op_sched_scan_start"); |
@@ -2976,11 +2988,11 @@ static int wl1271_op_sched_scan_start(struct ieee80211_hw *hw, | |||
2976 | if (ret < 0) | 2988 | if (ret < 0) |
2977 | goto out; | 2989 | goto out; |
2978 | 2990 | ||
2979 | ret = wl1271_scan_sched_scan_config(wl, req, ies); | 2991 | ret = wl1271_scan_sched_scan_config(wl, wlvif, req, ies); |
2980 | if (ret < 0) | 2992 | if (ret < 0) |
2981 | goto out_sleep; | 2993 | goto out_sleep; |
2982 | 2994 | ||
2983 | ret = wl1271_scan_sched_scan_start(wl); | 2995 | ret = wl1271_scan_sched_scan_start(wl, wlvif); |
2984 | if (ret < 0) | 2996 | if (ret < 0) |
2985 | goto out_sleep; | 2997 | goto out_sleep; |
2986 | 2998 | ||
@@ -3225,7 +3237,7 @@ static int wl1271_bss_beacon_info_changed(struct wl1271 *wl, | |||
3225 | u32 changed) | 3237 | u32 changed) |
3226 | { | 3238 | { |
3227 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | 3239 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); |
3228 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 3240 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
3229 | int ret = 0; | 3241 | int ret = 0; |
3230 | 3242 | ||
3231 | if ((changed & BSS_CHANGED_BEACON_INT)) { | 3243 | if ((changed & BSS_CHANGED_BEACON_INT)) { |
@@ -3387,7 +3399,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, | |||
3387 | { | 3399 | { |
3388 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | 3400 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); |
3389 | bool do_join = false, set_assoc = false; | 3401 | bool do_join = false, set_assoc = false; |
3390 | bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS); | 3402 | bool is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); |
3391 | bool ibss_joined = false; | 3403 | bool ibss_joined = false; |
3392 | u32 sta_rate_set = 0; | 3404 | u32 sta_rate_set = 0; |
3393 | int ret; | 3405 | int ret; |
@@ -3623,7 +3635,7 @@ sta_not_found: | |||
3623 | 3635 | ||
3624 | if (changed & BSS_CHANGED_ARP_FILTER) { | 3636 | if (changed & BSS_CHANGED_ARP_FILTER) { |
3625 | __be32 addr = bss_conf->arp_addr_list[0]; | 3637 | __be32 addr = bss_conf->arp_addr_list[0]; |
3626 | WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS); | 3638 | WARN_ON(wlvif->bss_type != BSS_TYPE_STA_BSS); |
3627 | 3639 | ||
3628 | if (bss_conf->arp_addr_cnt == 1 && | 3640 | if (bss_conf->arp_addr_cnt == 1 && |
3629 | bss_conf->arp_filter_enabled) { | 3641 | bss_conf->arp_filter_enabled) { |
@@ -3742,7 +3754,8 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
3742 | u32 changed) | 3754 | u32 changed) |
3743 | { | 3755 | { |
3744 | struct wl1271 *wl = hw->priv; | 3756 | struct wl1271 *wl = hw->priv; |
3745 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 3757 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); |
3758 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); | ||
3746 | int ret; | 3759 | int ret; |
3747 | 3760 | ||
3748 | wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed 0x%x", | 3761 | wl1271_debug(DEBUG_MAC80211, "mac80211 bss info changed 0x%x", |
@@ -3933,6 +3946,7 @@ static int wl1271_op_sta_add(struct ieee80211_hw *hw, | |||
3933 | struct ieee80211_sta *sta) | 3946 | struct ieee80211_sta *sta) |
3934 | { | 3947 | { |
3935 | struct wl1271 *wl = hw->priv; | 3948 | struct wl1271 *wl = hw->priv; |
3949 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
3936 | int ret = 0; | 3950 | int ret = 0; |
3937 | u8 hlid; | 3951 | u8 hlid; |
3938 | 3952 | ||
@@ -3941,7 +3955,7 @@ static int wl1271_op_sta_add(struct ieee80211_hw *hw, | |||
3941 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 3955 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
3942 | goto out; | 3956 | goto out; |
3943 | 3957 | ||
3944 | if (wl->bss_type != BSS_TYPE_AP_BSS) | 3958 | if (wlvif->bss_type != BSS_TYPE_AP_BSS) |
3945 | goto out; | 3959 | goto out; |
3946 | 3960 | ||
3947 | wl1271_debug(DEBUG_MAC80211, "mac80211 add sta %d", (int)sta->aid); | 3961 | wl1271_debug(DEBUG_MAC80211, "mac80211 add sta %d", (int)sta->aid); |
@@ -3983,6 +3997,7 @@ static int wl1271_op_sta_remove(struct ieee80211_hw *hw, | |||
3983 | struct ieee80211_sta *sta) | 3997 | struct ieee80211_sta *sta) |
3984 | { | 3998 | { |
3985 | struct wl1271 *wl = hw->priv; | 3999 | struct wl1271 *wl = hw->priv; |
4000 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
3986 | struct wl1271_station *wl_sta; | 4001 | struct wl1271_station *wl_sta; |
3987 | int ret = 0, id; | 4002 | int ret = 0, id; |
3988 | 4003 | ||
@@ -3991,7 +4006,7 @@ static int wl1271_op_sta_remove(struct ieee80211_hw *hw, | |||
3991 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 4006 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
3992 | goto out; | 4007 | goto out; |
3993 | 4008 | ||
3994 | if (wl->bss_type != BSS_TYPE_AP_BSS) | 4009 | if (wlvif->bss_type != BSS_TYPE_AP_BSS) |
3995 | goto out; | 4010 | goto out; |
3996 | 4011 | ||
3997 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove sta %d", (int)sta->aid); | 4012 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove sta %d", (int)sta->aid); |
@@ -4026,6 +4041,7 @@ static int wl1271_op_ampdu_action(struct ieee80211_hw *hw, | |||
4026 | u8 buf_size) | 4041 | u8 buf_size) |
4027 | { | 4042 | { |
4028 | struct wl1271 *wl = hw->priv; | 4043 | struct wl1271 *wl = hw->priv; |
4044 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
4029 | int ret; | 4045 | int ret; |
4030 | u8 hlid, *ba_bitmap; | 4046 | u8 hlid, *ba_bitmap; |
4031 | 4047 | ||
@@ -4043,10 +4059,10 @@ static int wl1271_op_ampdu_action(struct ieee80211_hw *hw, | |||
4043 | goto out; | 4059 | goto out; |
4044 | } | 4060 | } |
4045 | 4061 | ||
4046 | if (wl->bss_type == BSS_TYPE_STA_BSS) { | 4062 | if (wlvif->bss_type == BSS_TYPE_STA_BSS) { |
4047 | hlid = wl->sta_hlid; | 4063 | hlid = wl->sta_hlid; |
4048 | ba_bitmap = &wl->ba_rx_bitmap; | 4064 | ba_bitmap = &wl->ba_rx_bitmap; |
4049 | } else if (wl->bss_type == BSS_TYPE_AP_BSS) { | 4065 | } else if (wlvif->bss_type == BSS_TYPE_AP_BSS) { |
4050 | struct wl1271_station *wl_sta; | 4066 | struct wl1271_station *wl_sta; |
4051 | 4067 | ||
4052 | wl_sta = (struct wl1271_station *)sta->drv_priv; | 4068 | wl_sta = (struct wl1271_station *)sta->drv_priv; |
@@ -4197,10 +4213,6 @@ static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) | |||
4197 | 4213 | ||
4198 | /* packets are considered pending if in the TX queue or the FW */ | 4214 | /* packets are considered pending if in the TX queue or the FW */ |
4199 | ret = (wl1271_tx_total_queue_count(wl) > 0) || (wl->tx_frames_cnt > 0); | 4215 | ret = (wl1271_tx_total_queue_count(wl) > 0) || (wl->tx_frames_cnt > 0); |
4200 | |||
4201 | /* the above is appropriate for STA mode for PS purposes */ | ||
4202 | WARN_ON(wl->bss_type != BSS_TYPE_STA_BSS); | ||
4203 | |||
4204 | out: | 4216 | out: |
4205 | mutex_unlock(&wl->mutex); | 4217 | mutex_unlock(&wl->mutex); |
4206 | 4218 | ||
@@ -4846,7 +4858,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void) | |||
4846 | wl->flags = 0; | 4858 | wl->flags = 0; |
4847 | wl->sg_enabled = true; | 4859 | wl->sg_enabled = true; |
4848 | wl->hw_pg_ver = -1; | 4860 | wl->hw_pg_ver = -1; |
4849 | wl->bss_type = MAX_BSS_TYPE; | ||
4850 | wl->set_bss_type = MAX_BSS_TYPE; | 4861 | wl->set_bss_type = MAX_BSS_TYPE; |
4851 | wl->last_tx_hlid = 0; | 4862 | wl->last_tx_hlid = 0; |
4852 | wl->ap_ps_map = 0; | 4863 | wl->ap_ps_map = 0; |
diff --git a/drivers/net/wireless/wl12xx/rx.c b/drivers/net/wireless/wl12xx/rx.c index dee4cfe9ccc1..9cfa0b25a6f8 100644 --- a/drivers/net/wireless/wl12xx/rx.c +++ b/drivers/net/wireless/wl12xx/rx.c | |||
@@ -185,6 +185,8 @@ static int wl1271_rx_handle_data(struct wl1271 *wl, u8 *data, u32 length, | |||
185 | void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status) | 185 | void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status) |
186 | { | 186 | { |
187 | struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; | 187 | struct wl1271_acx_mem_map *wl_mem_map = wl->target_mem_map; |
188 | struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ | ||
189 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
188 | u32 buf_size; | 190 | u32 buf_size; |
189 | u32 fw_rx_counter = status->fw_rx_counter & NUM_RX_PKT_DESC_MOD_MASK; | 191 | u32 fw_rx_counter = status->fw_rx_counter & NUM_RX_PKT_DESC_MOD_MASK; |
190 | u32 drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK; | 192 | u32 drv_rx_counter = wl->rx_counter & NUM_RX_PKT_DESC_MOD_MASK; |
@@ -192,7 +194,7 @@ void wl12xx_rx(struct wl1271 *wl, struct wl12xx_fw_status *status) | |||
192 | u32 mem_block; | 194 | u32 mem_block; |
193 | u32 pkt_length; | 195 | u32 pkt_length; |
194 | u32 pkt_offset; | 196 | u32 pkt_offset; |
195 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 197 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
196 | bool had_data = false; | 198 | bool had_data = false; |
197 | bool unaligned = false; | 199 | bool unaligned = false; |
198 | 200 | ||
diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index a8576181ab7f..197d2c2b1e74 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c | |||
@@ -34,6 +34,7 @@ void wl1271_scan_complete_work(struct work_struct *work) | |||
34 | { | 34 | { |
35 | struct delayed_work *dwork; | 35 | struct delayed_work *dwork; |
36 | struct wl1271 *wl; | 36 | struct wl1271 *wl; |
37 | struct wl12xx_vif *wlvif; | ||
37 | int ret; | 38 | int ret; |
38 | bool is_sta, is_ibss; | 39 | bool is_sta, is_ibss; |
39 | 40 | ||
@@ -50,6 +51,8 @@ void wl1271_scan_complete_work(struct work_struct *work) | |||
50 | if (wl->scan.state == WL1271_SCAN_STATE_IDLE) | 51 | if (wl->scan.state == WL1271_SCAN_STATE_IDLE) |
51 | goto out; | 52 | goto out; |
52 | 53 | ||
54 | wlvif = wl12xx_vif_to_data(wl->scan_vif); | ||
55 | |||
53 | wl->scan.state = WL1271_SCAN_STATE_IDLE; | 56 | wl->scan.state = WL1271_SCAN_STATE_IDLE; |
54 | memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); | 57 | memset(wl->scan.scanned_ch, 0, sizeof(wl->scan.scanned_ch)); |
55 | wl->scan.req = NULL; | 58 | wl->scan.req = NULL; |
@@ -65,8 +68,8 @@ void wl1271_scan_complete_work(struct work_struct *work) | |||
65 | } | 68 | } |
66 | 69 | ||
67 | /* return to ROC if needed */ | 70 | /* return to ROC if needed */ |
68 | is_sta = (wl->bss_type == BSS_TYPE_STA_BSS); | 71 | is_sta = (wlvif->bss_type == BSS_TYPE_STA_BSS); |
69 | is_ibss = (wl->bss_type == BSS_TYPE_IBSS); | 72 | is_ibss = (wlvif->bss_type == BSS_TYPE_IBSS); |
70 | if (((is_sta && !test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) || | 73 | if (((is_sta && !test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) || |
71 | (is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) && | 74 | (is_ibss && !test_bit(WL1271_FLAG_IBSS_JOINED, &wl->flags))) && |
72 | !test_bit(wl->dev_role_id, wl->roc_map)) { | 75 | !test_bit(wl->dev_role_id, wl->roc_map)) { |
@@ -589,6 +592,7 @@ out: | |||
589 | } | 592 | } |
590 | 593 | ||
591 | int wl1271_scan_sched_scan_config(struct wl1271 *wl, | 594 | int wl1271_scan_sched_scan_config(struct wl1271 *wl, |
595 | struct wl12xx_vif *wlvif, | ||
592 | struct cfg80211_sched_scan_request *req, | 596 | struct cfg80211_sched_scan_request *req, |
593 | struct ieee80211_sched_scan_ies *ies) | 597 | struct ieee80211_sched_scan_ies *ies) |
594 | { | 598 | { |
@@ -671,14 +675,14 @@ out: | |||
671 | return ret; | 675 | return ret; |
672 | } | 676 | } |
673 | 677 | ||
674 | int wl1271_scan_sched_scan_start(struct wl1271 *wl) | 678 | int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif) |
675 | { | 679 | { |
676 | struct wl1271_cmd_sched_scan_start *start; | 680 | struct wl1271_cmd_sched_scan_start *start; |
677 | int ret = 0; | 681 | int ret = 0; |
678 | 682 | ||
679 | wl1271_debug(DEBUG_CMD, "cmd periodic scan start"); | 683 | wl1271_debug(DEBUG_CMD, "cmd periodic scan start"); |
680 | 684 | ||
681 | if (wl->bss_type != BSS_TYPE_STA_BSS) | 685 | if (wlvif->bss_type != BSS_TYPE_STA_BSS) |
682 | return -EOPNOTSUPP; | 686 | return -EOPNOTSUPP; |
683 | 687 | ||
684 | if (!test_bit(WL1271_FLAG_IDLE, &wl->flags)) | 688 | if (!test_bit(WL1271_FLAG_IDLE, &wl->flags)) |
diff --git a/drivers/net/wireless/wl12xx/scan.h b/drivers/net/wireless/wl12xx/scan.h index 15177bdfb542..a7ed43dc08c9 100644 --- a/drivers/net/wireless/wl12xx/scan.h +++ b/drivers/net/wireless/wl12xx/scan.h | |||
@@ -36,9 +36,10 @@ int wl1271_scan_build_probe_req(struct wl1271 *wl, | |||
36 | void wl1271_scan_stm(struct wl1271 *wl, struct ieee80211_vif *vif); | 36 | void wl1271_scan_stm(struct wl1271 *wl, struct ieee80211_vif *vif); |
37 | void wl1271_scan_complete_work(struct work_struct *work); | 37 | void wl1271_scan_complete_work(struct work_struct *work); |
38 | int wl1271_scan_sched_scan_config(struct wl1271 *wl, | 38 | int wl1271_scan_sched_scan_config(struct wl1271 *wl, |
39 | struct wl12xx_vif *wlvif, | ||
39 | struct cfg80211_sched_scan_request *req, | 40 | struct cfg80211_sched_scan_request *req, |
40 | struct ieee80211_sched_scan_ies *ies); | 41 | struct ieee80211_sched_scan_ies *ies); |
41 | int wl1271_scan_sched_scan_start(struct wl1271 *wl); | 42 | int wl1271_scan_sched_scan_start(struct wl1271 *wl, struct wl12xx_vif *wlvif); |
42 | void wl1271_scan_sched_scan_stop(struct wl1271 *wl); | 43 | void wl1271_scan_sched_scan_stop(struct wl1271 *wl); |
43 | void wl1271_scan_sched_scan_results(struct wl1271 *wl); | 44 | void wl1271_scan_sched_scan_results(struct wl1271 *wl); |
44 | 45 | ||
diff --git a/drivers/net/wireless/wl12xx/tx.c b/drivers/net/wireless/wl12xx/tx.c index bad9e29d49b0..5561ec2d4b4f 100644 --- a/drivers/net/wireless/wl12xx/tx.c +++ b/drivers/net/wireless/wl12xx/tx.c | |||
@@ -32,10 +32,11 @@ | |||
32 | #include "tx.h" | 32 | #include "tx.h" |
33 | #include "event.h" | 33 | #include "event.h" |
34 | 34 | ||
35 | static int wl1271_set_default_wep_key(struct wl1271 *wl, u8 id) | 35 | static int wl1271_set_default_wep_key(struct wl1271 *wl, |
36 | struct wl12xx_vif *wlvif, u8 id) | ||
36 | { | 37 | { |
37 | int ret; | 38 | int ret; |
38 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 39 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
39 | 40 | ||
40 | if (is_ap) | 41 | if (is_ap) |
41 | ret = wl12xx_cmd_set_default_wep_key(wl, id, | 42 | ret = wl12xx_cmd_set_default_wep_key(wl, id, |
@@ -178,14 +179,17 @@ u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb) | |||
178 | } | 179 | } |
179 | } | 180 | } |
180 | 181 | ||
181 | static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct sk_buff *skb) | 182 | static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct ieee80211_vif *vif, |
183 | struct sk_buff *skb) | ||
182 | { | 184 | { |
183 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 185 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
186 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
187 | |||
184 | 188 | ||
185 | if (wl12xx_is_dummy_packet(wl, skb)) | 189 | if (wl12xx_is_dummy_packet(wl, skb)) |
186 | return wl->system_hlid; | 190 | return wl->system_hlid; |
187 | 191 | ||
188 | if (wl->bss_type == BSS_TYPE_AP_BSS) | 192 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) |
189 | return wl12xx_tx_get_hlid_ap(wl, skb); | 193 | return wl12xx_tx_get_hlid_ap(wl, skb); |
190 | 194 | ||
191 | wl1271_tx_update_filters(wl, skb); | 195 | wl1271_tx_update_filters(wl, skb); |
@@ -208,9 +212,11 @@ static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl, | |||
208 | return ALIGN(packet_length, WL1271_TX_ALIGN_TO); | 212 | return ALIGN(packet_length, WL1271_TX_ALIGN_TO); |
209 | } | 213 | } |
210 | 214 | ||
211 | static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, | 215 | static int wl1271_tx_allocate(struct wl1271 *wl, struct ieee80211_vif *vif, |
212 | u32 buf_offset, u8 hlid) | 216 | struct sk_buff *skb, u32 extra, u32 buf_offset, |
217 | u8 hlid) | ||
213 | { | 218 | { |
219 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
214 | struct wl1271_tx_hw_descr *desc; | 220 | struct wl1271_tx_hw_descr *desc; |
215 | u32 total_len = skb->len + sizeof(struct wl1271_tx_hw_descr) + extra; | 221 | u32 total_len = skb->len + sizeof(struct wl1271_tx_hw_descr) + extra; |
216 | u32 len; | 222 | u32 len; |
@@ -257,7 +263,7 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, | |||
257 | ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); | 263 | ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); |
258 | wl->tx_allocated_pkts[ac]++; | 264 | wl->tx_allocated_pkts[ac]++; |
259 | 265 | ||
260 | if (wl->bss_type == BSS_TYPE_AP_BSS && | 266 | if (wlvif->bss_type == BSS_TYPE_AP_BSS && |
261 | hlid >= WL1271_AP_STA_HLID_START) | 267 | hlid >= WL1271_AP_STA_HLID_START) |
262 | wl->links[hlid].allocated_pkts++; | 268 | wl->links[hlid].allocated_pkts++; |
263 | 269 | ||
@@ -273,10 +279,11 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra, | |||
273 | return ret; | 279 | return ret; |
274 | } | 280 | } |
275 | 281 | ||
276 | static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | 282 | static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct ieee80211_vif *vif, |
277 | u32 extra, struct ieee80211_tx_info *control, | 283 | struct sk_buff *skb, u32 extra, |
278 | u8 hlid) | 284 | struct ieee80211_tx_info *control, u8 hlid) |
279 | { | 285 | { |
286 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
280 | struct timespec ts; | 287 | struct timespec ts; |
281 | struct wl1271_tx_hw_descr *desc; | 288 | struct wl1271_tx_hw_descr *desc; |
282 | int aligned_len, ac, rate_idx; | 289 | int aligned_len, ac, rate_idx; |
@@ -298,7 +305,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | |||
298 | hosttime = (timespec_to_ns(&ts) >> 10); | 305 | hosttime = (timespec_to_ns(&ts) >> 10); |
299 | desc->start_time = cpu_to_le32(hosttime - wl->time_offset); | 306 | desc->start_time = cpu_to_le32(hosttime - wl->time_offset); |
300 | 307 | ||
301 | if (wl->bss_type != BSS_TYPE_AP_BSS) | 308 | if (wlvif->bss_type != BSS_TYPE_AP_BSS) |
302 | desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU); | 309 | desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU); |
303 | else | 310 | else |
304 | desc->life_time = cpu_to_le16(TX_HW_AP_MODE_PKT_LIFETIME_TU); | 311 | desc->life_time = cpu_to_le16(TX_HW_AP_MODE_PKT_LIFETIME_TU); |
@@ -324,8 +331,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, | |||
324 | } | 331 | } |
325 | 332 | ||
326 | desc->hlid = hlid; | 333 | desc->hlid = hlid; |
327 | 334 | if (wlvif->bss_type != BSS_TYPE_AP_BSS) { | |
328 | if (wl->bss_type != BSS_TYPE_AP_BSS) { | ||
329 | /* if the packets are destined for AP (have a STA entry) | 335 | /* if the packets are destined for AP (have a STA entry) |
330 | send them with AP rate policies, otherwise use default | 336 | send them with AP rate policies, otherwise use default |
331 | basic rates */ | 337 | basic rates */ |
@@ -383,16 +389,27 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb, | |||
383 | u32 buf_offset) | 389 | u32 buf_offset) |
384 | { | 390 | { |
385 | struct ieee80211_tx_info *info; | 391 | struct ieee80211_tx_info *info; |
392 | struct ieee80211_vif *vif; | ||
393 | struct wl12xx_vif *wlvif; | ||
386 | u32 extra = 0; | 394 | u32 extra = 0; |
387 | int ret = 0; | 395 | int ret = 0; |
388 | u32 total_len; | 396 | u32 total_len; |
389 | u8 hlid; | 397 | u8 hlid; |
398 | bool is_dummy; | ||
390 | 399 | ||
391 | if (!skb) | 400 | if (!skb) |
392 | return -EINVAL; | 401 | return -EINVAL; |
393 | 402 | ||
394 | info = IEEE80211_SKB_CB(skb); | 403 | info = IEEE80211_SKB_CB(skb); |
395 | 404 | ||
405 | /* TODO: handle dummy packets on multi-vifs */ | ||
406 | is_dummy = wl12xx_is_dummy_packet(wl, skb); | ||
407 | if (is_dummy) | ||
408 | info->control.vif = wl->vif; | ||
409 | |||
410 | vif = info->control.vif; | ||
411 | wlvif = wl12xx_vif_to_data(vif); | ||
412 | |||
396 | if (info->control.hw_key && | 413 | if (info->control.hw_key && |
397 | info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) | 414 | info->control.hw_key->cipher == WLAN_CIPHER_SUITE_TKIP) |
398 | extra = WL1271_TKIP_IV_SPACE; | 415 | extra = WL1271_TKIP_IV_SPACE; |
@@ -406,26 +423,25 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb, | |||
406 | (cipher == WLAN_CIPHER_SUITE_WEP104); | 423 | (cipher == WLAN_CIPHER_SUITE_WEP104); |
407 | 424 | ||
408 | if (unlikely(is_wep && wl->default_key != idx)) { | 425 | if (unlikely(is_wep && wl->default_key != idx)) { |
409 | ret = wl1271_set_default_wep_key(wl, idx); | 426 | ret = wl1271_set_default_wep_key(wl, wlvif, idx); |
410 | if (ret < 0) | 427 | if (ret < 0) |
411 | return ret; | 428 | return ret; |
412 | wl->default_key = idx; | 429 | wl->default_key = idx; |
413 | } | 430 | } |
414 | } | 431 | } |
415 | 432 | hlid = wl1271_tx_get_hlid(wl, vif, skb); | |
416 | hlid = wl1271_tx_get_hlid(wl, skb); | ||
417 | if (hlid == WL12XX_INVALID_LINK_ID) { | 433 | if (hlid == WL12XX_INVALID_LINK_ID) { |
418 | wl1271_error("invalid hlid. dropping skb 0x%p", skb); | 434 | wl1271_error("invalid hlid. dropping skb 0x%p", skb); |
419 | return -EINVAL; | 435 | return -EINVAL; |
420 | } | 436 | } |
421 | 437 | ||
422 | ret = wl1271_tx_allocate(wl, skb, extra, buf_offset, hlid); | 438 | ret = wl1271_tx_allocate(wl, vif, skb, extra, buf_offset, hlid); |
423 | if (ret < 0) | 439 | if (ret < 0) |
424 | return ret; | 440 | return ret; |
425 | 441 | ||
426 | wl1271_tx_fill_hdr(wl, skb, extra, info, hlid); | 442 | wl1271_tx_fill_hdr(wl, vif, skb, extra, info, hlid); |
427 | 443 | ||
428 | if (wl->bss_type == BSS_TYPE_AP_BSS) { | 444 | if (wlvif->bss_type == BSS_TYPE_AP_BSS && !is_dummy) { |
429 | wl1271_tx_ap_update_inconnection_sta(wl, skb); | 445 | wl1271_tx_ap_update_inconnection_sta(wl, skb); |
430 | wl1271_tx_regulate_link(wl, hlid); | 446 | wl1271_tx_regulate_link(wl, hlid); |
431 | } | 447 | } |
@@ -444,7 +460,7 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb, | |||
444 | memset(wl->aggr_buf + buf_offset + skb->len, 0, total_len - skb->len); | 460 | memset(wl->aggr_buf + buf_offset + skb->len, 0, total_len - skb->len); |
445 | 461 | ||
446 | /* Revert side effects in the dummy packet skb, so it can be reused */ | 462 | /* Revert side effects in the dummy packet skb, so it can be reused */ |
447 | if (wl12xx_is_dummy_packet(wl, skb)) | 463 | if (is_dummy) |
448 | skb_pull(skb, sizeof(struct wl1271_tx_hw_descr)); | 464 | skb_pull(skb, sizeof(struct wl1271_tx_hw_descr)); |
449 | 465 | ||
450 | return total_len; | 466 | return total_len; |
@@ -586,12 +602,13 @@ static struct sk_buff *wl1271_ap_skb_dequeue(struct wl1271 *wl) | |||
586 | return skb; | 602 | return skb; |
587 | } | 603 | } |
588 | 604 | ||
589 | static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl) | 605 | static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl, |
606 | struct wl12xx_vif *wlvif) | ||
590 | { | 607 | { |
591 | unsigned long flags; | 608 | unsigned long flags; |
592 | struct sk_buff *skb = NULL; | 609 | struct sk_buff *skb = NULL; |
593 | 610 | ||
594 | if (wl->bss_type == BSS_TYPE_AP_BSS) | 611 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) |
595 | skb = wl1271_ap_skb_dequeue(wl); | 612 | skb = wl1271_ap_skb_dequeue(wl); |
596 | else | 613 | else |
597 | skb = wl1271_sta_skb_dequeue(wl); | 614 | skb = wl1271_sta_skb_dequeue(wl); |
@@ -610,15 +627,17 @@ static struct sk_buff *wl1271_skb_dequeue(struct wl1271 *wl) | |||
610 | return skb; | 627 | return skb; |
611 | } | 628 | } |
612 | 629 | ||
613 | static void wl1271_skb_queue_head(struct wl1271 *wl, struct sk_buff *skb) | 630 | static void wl1271_skb_queue_head(struct wl1271 *wl, struct ieee80211_vif *vif, |
631 | struct sk_buff *skb) | ||
614 | { | 632 | { |
633 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
615 | unsigned long flags; | 634 | unsigned long flags; |
616 | int q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); | 635 | int q = wl1271_tx_get_queue(skb_get_queue_mapping(skb)); |
617 | 636 | ||
618 | if (wl12xx_is_dummy_packet(wl, skb)) { | 637 | if (wl12xx_is_dummy_packet(wl, skb)) { |
619 | set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); | 638 | set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); |
620 | } else if (wl->bss_type == BSS_TYPE_AP_BSS) { | 639 | } else if (wlvif->bss_type == BSS_TYPE_AP_BSS) { |
621 | u8 hlid = wl1271_tx_get_hlid(wl, skb); | 640 | u8 hlid = wl1271_tx_get_hlid(wl, vif, skb); |
622 | skb_queue_head(&wl->links[hlid].tx_queue[q], skb); | 641 | skb_queue_head(&wl->links[hlid].tx_queue[q], skb); |
623 | 642 | ||
624 | /* make sure we dequeue the same packet next time */ | 643 | /* make sure we dequeue the same packet next time */ |
@@ -639,19 +658,20 @@ static bool wl1271_tx_is_data_present(struct sk_buff *skb) | |||
639 | return ieee80211_is_data_present(hdr->frame_control); | 658 | return ieee80211_is_data_present(hdr->frame_control); |
640 | } | 659 | } |
641 | 660 | ||
642 | void wl1271_tx_work_locked(struct wl1271 *wl) | 661 | void wl1271_tx_work_locked(struct wl1271 *wl, struct ieee80211_vif *vif) |
643 | { | 662 | { |
663 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
644 | struct sk_buff *skb; | 664 | struct sk_buff *skb; |
645 | u32 buf_offset = 0; | 665 | u32 buf_offset = 0; |
646 | bool sent_packets = false; | 666 | bool sent_packets = false; |
647 | bool had_data = false; | 667 | bool had_data = false; |
648 | bool is_ap = (wl->bss_type == BSS_TYPE_AP_BSS); | 668 | bool is_ap = (wlvif->bss_type == BSS_TYPE_AP_BSS); |
649 | int ret; | 669 | int ret; |
650 | 670 | ||
651 | if (unlikely(wl->state == WL1271_STATE_OFF)) | 671 | if (unlikely(wl->state == WL1271_STATE_OFF)) |
652 | return; | 672 | return; |
653 | 673 | ||
654 | while ((skb = wl1271_skb_dequeue(wl))) { | 674 | while ((skb = wl1271_skb_dequeue(wl, wlvif))) { |
655 | if (wl1271_tx_is_data_present(skb)) | 675 | if (wl1271_tx_is_data_present(skb)) |
656 | had_data = true; | 676 | had_data = true; |
657 | 677 | ||
@@ -661,7 +681,7 @@ void wl1271_tx_work_locked(struct wl1271 *wl) | |||
661 | * Aggregation buffer is full. | 681 | * Aggregation buffer is full. |
662 | * Flush buffer and try again. | 682 | * Flush buffer and try again. |
663 | */ | 683 | */ |
664 | wl1271_skb_queue_head(wl, skb); | 684 | wl1271_skb_queue_head(wl, vif, skb); |
665 | wl1271_write(wl, WL1271_SLV_MEM_DATA, wl->aggr_buf, | 685 | wl1271_write(wl, WL1271_SLV_MEM_DATA, wl->aggr_buf, |
666 | buf_offset, true); | 686 | buf_offset, true); |
667 | sent_packets = true; | 687 | sent_packets = true; |
@@ -672,7 +692,7 @@ void wl1271_tx_work_locked(struct wl1271 *wl) | |||
672 | * Firmware buffer is full. | 692 | * Firmware buffer is full. |
673 | * Queue back last skb, and stop aggregating. | 693 | * Queue back last skb, and stop aggregating. |
674 | */ | 694 | */ |
675 | wl1271_skb_queue_head(wl, skb); | 695 | wl1271_skb_queue_head(wl, vif, skb); |
676 | /* No work left, avoid scheduling redundant tx work */ | 696 | /* No work left, avoid scheduling redundant tx work */ |
677 | set_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); | 697 | set_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); |
678 | goto out_ack; | 698 | goto out_ack; |
@@ -726,7 +746,7 @@ void wl1271_tx_work(struct work_struct *work) | |||
726 | if (ret < 0) | 746 | if (ret < 0) |
727 | goto out; | 747 | goto out; |
728 | 748 | ||
729 | wl1271_tx_work_locked(wl); | 749 | wl1271_tx_work_locked(wl, wl->vif); |
730 | 750 | ||
731 | wl1271_ps_elp_sleep(wl); | 751 | wl1271_ps_elp_sleep(wl); |
732 | out: | 752 | out: |
@@ -888,12 +908,14 @@ void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid) | |||
888 | /* caller must hold wl->mutex and TX must be stopped */ | 908 | /* caller must hold wl->mutex and TX must be stopped */ |
889 | void wl1271_tx_reset(struct wl1271 *wl, bool reset_tx_queues) | 909 | void wl1271_tx_reset(struct wl1271 *wl, bool reset_tx_queues) |
890 | { | 910 | { |
911 | struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ | ||
912 | struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); | ||
891 | int i; | 913 | int i; |
892 | struct sk_buff *skb; | 914 | struct sk_buff *skb; |
893 | struct ieee80211_tx_info *info; | 915 | struct ieee80211_tx_info *info; |
894 | 916 | ||
895 | /* TX failure */ | 917 | /* TX failure */ |
896 | if (wl->bss_type == BSS_TYPE_AP_BSS) { | 918 | if (wlvif->bss_type == BSS_TYPE_AP_BSS) { |
897 | for (i = 0; i < AP_MAX_LINKS; i++) { | 919 | for (i = 0; i < AP_MAX_LINKS; i++) { |
898 | wl1271_free_sta(wl, i); | 920 | wl1271_free_sta(wl, i); |
899 | wl1271_tx_reset_link_queues(wl, i); | 921 | wl1271_tx_reset_link_queues(wl, i); |
diff --git a/drivers/net/wireless/wl12xx/tx.h b/drivers/net/wireless/wl12xx/tx.h index dc4f09adf088..ba9403a45404 100644 --- a/drivers/net/wireless/wl12xx/tx.h +++ b/drivers/net/wireless/wl12xx/tx.h | |||
@@ -204,7 +204,7 @@ static inline int wl1271_tx_total_queue_count(struct wl1271 *wl) | |||
204 | } | 204 | } |
205 | 205 | ||
206 | void wl1271_tx_work(struct work_struct *work); | 206 | void wl1271_tx_work(struct work_struct *work); |
207 | void wl1271_tx_work_locked(struct wl1271 *wl); | 207 | void wl1271_tx_work_locked(struct wl1271 *wl, struct ieee80211_vif *vif); |
208 | void wl1271_tx_complete(struct wl1271 *wl); | 208 | void wl1271_tx_complete(struct wl1271 *wl); |
209 | void wl1271_tx_reset(struct wl1271 *wl, bool reset_tx_queues); | 209 | void wl1271_tx_reset(struct wl1271 *wl, bool reset_tx_queues); |
210 | void wl1271_tx_flush(struct wl1271 *wl); | 210 | void wl1271_tx_flush(struct wl1271 *wl); |
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h index 44a5daeff07e..97ed19c67695 100644 --- a/drivers/net/wireless/wl12xx/wl12xx.h +++ b/drivers/net/wireless/wl12xx/wl12xx.h | |||
@@ -400,7 +400,6 @@ struct wl1271 { | |||
400 | s8 hw_pg_ver; | 400 | s8 hw_pg_ver; |
401 | 401 | ||
402 | u8 mac_addr[ETH_ALEN]; | 402 | u8 mac_addr[ETH_ALEN]; |
403 | u8 bss_type; | ||
404 | u8 set_bss_type; | 403 | u8 set_bss_type; |
405 | u8 p2p; /* we are using p2p role */ | 404 | u8 p2p; /* we are using p2p role */ |
406 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; | 405 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; |
@@ -630,6 +629,8 @@ struct wl1271_station { | |||
630 | }; | 629 | }; |
631 | 630 | ||
632 | struct wl12xx_vif { | 631 | struct wl12xx_vif { |
632 | u8 bss_type; | ||
633 | |||
633 | u32 basic_rate_set; | 634 | u32 basic_rate_set; |
634 | 635 | ||
635 | /* | 636 | /* |