diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/wl1271_main.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_main.c | 59 |
1 files changed, 25 insertions, 34 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c index 7a73aaadd04c..775b1e82ca81 100644 --- a/drivers/net/wireless/wl12xx/wl1271_main.c +++ b/drivers/net/wireless/wl12xx/wl1271_main.c | |||
@@ -777,7 +777,20 @@ out: | |||
777 | static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) | 777 | static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb) |
778 | { | 778 | { |
779 | struct wl1271 *wl = hw->priv; | 779 | struct wl1271 *wl = hw->priv; |
780 | struct ieee80211_conf *conf = &hw->conf; | ||
781 | struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); | ||
782 | struct ieee80211_sta *sta = txinfo->control.sta; | ||
783 | unsigned long flags; | ||
780 | 784 | ||
785 | /* peek into the rates configured in the STA entry */ | ||
786 | spin_lock_irqsave(&wl->wl_lock, flags); | ||
787 | if (sta && sta->supp_rates[conf->channel->band] != wl->sta_rate_set) { | ||
788 | wl->sta_rate_set = sta->supp_rates[conf->channel->band]; | ||
789 | set_bit(WL1271_FLAG_STA_RATES_CHANGED, &wl->flags); | ||
790 | } | ||
791 | spin_unlock_irqrestore(&wl->wl_lock, flags); | ||
792 | |||
793 | /* queue the packet */ | ||
781 | skb_queue_tail(&wl->tx_queue, skb); | 794 | skb_queue_tail(&wl->tx_queue, skb); |
782 | 795 | ||
783 | /* | 796 | /* |
@@ -1004,7 +1017,6 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1004 | wl->elp = false; | 1017 | wl->elp = false; |
1005 | wl->psm = 0; | 1018 | wl->psm = 0; |
1006 | wl->psm_entry_retry = 0; | 1019 | wl->psm_entry_retry = 0; |
1007 | wl->associated = false; | ||
1008 | wl->tx_queue_stopped = false; | 1020 | wl->tx_queue_stopped = false; |
1009 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; | 1021 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; |
1010 | wl->tx_blocks_available = 0; | 1022 | wl->tx_blocks_available = 0; |
@@ -1016,6 +1028,9 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1016 | wl->time_offset = 0; | 1028 | wl->time_offset = 0; |
1017 | wl->session_counter = 0; | 1029 | wl->session_counter = 0; |
1018 | wl->joined = false; | 1030 | wl->joined = false; |
1031 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; | ||
1032 | wl->sta_rate_set = 0; | ||
1033 | wl->flags = 0; | ||
1019 | 1034 | ||
1020 | for (i = 0; i < NUM_TX_QUEUES; i++) | 1035 | for (i = 0; i < NUM_TX_QUEUES; i++) |
1021 | wl->tx_blocks_freed[i] = 0; | 1036 | wl->tx_blocks_freed[i] = 0; |
@@ -1212,8 +1227,9 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1212 | wl1271_join_channel(wl, channel); | 1227 | wl1271_join_channel(wl, channel); |
1213 | 1228 | ||
1214 | if (conf->flags & IEEE80211_CONF_IDLE) { | 1229 | if (conf->flags & IEEE80211_CONF_IDLE) { |
1215 | wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC; | 1230 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; |
1216 | wl1271_acx_rate_policies(wl, CONF_TX_RATE_MASK_BASIC); | 1231 | wl->sta_rate_set = 0; |
1232 | wl1271_acx_rate_policies(wl); | ||
1217 | } | 1233 | } |
1218 | } | 1234 | } |
1219 | 1235 | ||
@@ -1229,7 +1245,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed) | |||
1229 | * If we're not, we'll enter it when joining an SSID, | 1245 | * If we're not, we'll enter it when joining an SSID, |
1230 | * through the bss_info_changed() hook. | 1246 | * through the bss_info_changed() hook. |
1231 | */ | 1247 | */ |
1232 | if (wl->associated) { | 1248 | if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { |
1233 | wl1271_info("psm enabled"); | 1249 | wl1271_info("psm enabled"); |
1234 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE); | 1250 | ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE); |
1235 | } | 1251 | } |
@@ -1522,22 +1538,6 @@ out: | |||
1522 | return ret; | 1538 | return ret; |
1523 | } | 1539 | } |
1524 | 1540 | ||
1525 | static u32 wl1271_enabled_rates_get(struct wl1271 *wl, u64 basic_rate_set) | ||
1526 | { | ||
1527 | struct ieee80211_supported_band *band; | ||
1528 | u32 enabled_rates = 0; | ||
1529 | int bit; | ||
1530 | |||
1531 | band = wl->hw->wiphy->bands[wl->band]; | ||
1532 | for (bit = 0; bit < band->n_bitrates; bit++) { | ||
1533 | if (basic_rate_set & 0x1) | ||
1534 | enabled_rates |= band->bitrates[bit].hw_value; | ||
1535 | basic_rate_set >>= 1; | ||
1536 | } | ||
1537 | |||
1538 | return enabled_rates; | ||
1539 | } | ||
1540 | |||
1541 | static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | 1541 | static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, |
1542 | struct ieee80211_vif *vif, | 1542 | struct ieee80211_vif *vif, |
1543 | struct ieee80211_bss_conf *bss_conf, | 1543 | struct ieee80211_bss_conf *bss_conf, |
@@ -1616,7 +1616,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1616 | if (changed & BSS_CHANGED_ASSOC) { | 1616 | if (changed & BSS_CHANGED_ASSOC) { |
1617 | if (bss_conf->assoc) { | 1617 | if (bss_conf->assoc) { |
1618 | wl->aid = bss_conf->aid; | 1618 | wl->aid = bss_conf->aid; |
1619 | wl->associated = true; | 1619 | set_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); |
1620 | 1620 | ||
1621 | /* | 1621 | /* |
1622 | * with wl1271, we don't need to update the | 1622 | * with wl1271, we don't need to update the |
@@ -1641,7 +1641,7 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1641 | } | 1641 | } |
1642 | } else { | 1642 | } else { |
1643 | /* use defaults when not associated */ | 1643 | /* use defaults when not associated */ |
1644 | wl->associated = false; | 1644 | clear_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags); |
1645 | wl->aid = 0; | 1645 | wl->aid = 0; |
1646 | } | 1646 | } |
1647 | 1647 | ||
@@ -1676,17 +1676,6 @@ static void wl1271_op_bss_info_changed(struct ieee80211_hw *hw, | |||
1676 | } | 1676 | } |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | if (changed & BSS_CHANGED_BASIC_RATES) { | ||
1680 | wl->basic_rate_set = wl1271_enabled_rates_get( | ||
1681 | wl, bss_conf->basic_rates); | ||
1682 | |||
1683 | ret = wl1271_acx_rate_policies(wl, wl->basic_rate_set); | ||
1684 | if (ret < 0) { | ||
1685 | wl1271_warning("Set rate policies failed %d", ret); | ||
1686 | goto out_sleep; | ||
1687 | } | ||
1688 | } | ||
1689 | |||
1690 | out_sleep: | 1679 | out_sleep: |
1691 | wl1271_ps_elp_sleep(wl); | 1680 | wl1271_ps_elp_sleep(wl); |
1692 | 1681 | ||
@@ -1969,14 +1958,16 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
1969 | wl->psm = 0; | 1958 | wl->psm = 0; |
1970 | wl->psm_requested = false; | 1959 | wl->psm_requested = false; |
1971 | wl->psm_entry_retry = 0; | 1960 | wl->psm_entry_retry = 0; |
1972 | wl->associated = false; | ||
1973 | wl->tx_queue_stopped = false; | 1961 | wl->tx_queue_stopped = false; |
1974 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; | 1962 | wl->power_level = WL1271_DEFAULT_POWER_LEVEL; |
1975 | wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC; | 1963 | wl->basic_rate_set = CONF_TX_RATE_MASK_BASIC; |
1964 | wl->rate_set = CONF_TX_RATE_MASK_BASIC; | ||
1965 | wl->sta_rate_set = 0; | ||
1976 | wl->band = IEEE80211_BAND_2GHZ; | 1966 | wl->band = IEEE80211_BAND_2GHZ; |
1977 | wl->vif = NULL; | 1967 | wl->vif = NULL; |
1978 | wl->joined = false; | 1968 | wl->joined = false; |
1979 | wl->gpio_power = false; | 1969 | wl->gpio_power = false; |
1970 | wl->flags = 0; | ||
1980 | 1971 | ||
1981 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) | 1972 | for (i = 0; i < ACX_TX_DESCRIPTORS; i++) |
1982 | wl->tx_frames[i] = NULL; | 1973 | wl->tx_frames[i] = NULL; |