aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/main.c
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-10-05 05:55:43 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-07 01:32:35 -0400
commitd2d66c56cf6c8727662aa321991f791604c22094 (patch)
tree3e916d6cd0c36cf1761a18ee82f724413229cdf9 /drivers/net/wireless/wl12xx/main.c
parent30d0c8fd5b87d1c5486705d6420545a21533e115 (diff)
wl12xx: move basic_rate into wlvif
move basic_rate 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/net/wireless/wl12xx/main.c')
-rw-r--r--drivers/net/wireless/wl12xx/main.c47
1 files changed, 27 insertions, 20 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 195dcbdf1fc7..8863ea542ea6 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1609,7 +1609,8 @@ static struct notifier_block wl1271_dev_notifier = {
1609}; 1609};
1610 1610
1611#ifdef CONFIG_PM 1611#ifdef CONFIG_PM
1612static int wl1271_configure_suspend_sta(struct wl1271 *wl) 1612static int wl1271_configure_suspend_sta(struct wl1271 *wl,
1613 struct wl12xx_vif *wlvif)
1613{ 1614{
1614 int ret = 0; 1615 int ret = 0;
1615 1616
@@ -1628,7 +1629,7 @@ static int wl1271_configure_suspend_sta(struct wl1271 *wl)
1628 1629
1629 wl->ps_compl = &compl; 1630 wl->ps_compl = &compl;
1630 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 1631 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
1631 wl->basic_rate, true); 1632 wlvif->basic_rate, true);
1632 if (ret < 0) 1633 if (ret < 0)
1633 goto out_sleep; 1634 goto out_sleep;
1634 1635
@@ -1682,16 +1683,18 @@ out_unlock:
1682 1683
1683} 1684}
1684 1685
1685static int wl1271_configure_suspend(struct wl1271 *wl) 1686static int wl1271_configure_suspend(struct wl1271 *wl,
1687 struct wl12xx_vif *wlvif)
1686{ 1688{
1687 if (wl->bss_type == BSS_TYPE_STA_BSS) 1689 if (wl->bss_type == BSS_TYPE_STA_BSS)
1688 return wl1271_configure_suspend_sta(wl); 1690 return wl1271_configure_suspend_sta(wl, wlvif);
1689 if (wl->bss_type == BSS_TYPE_AP_BSS) 1691 if (wl->bss_type == BSS_TYPE_AP_BSS)
1690 return wl1271_configure_suspend_ap(wl); 1692 return wl1271_configure_suspend_ap(wl);
1691 return 0; 1693 return 0;
1692} 1694}
1693 1695
1694static void wl1271_configure_resume(struct wl1271 *wl) 1696static void wl1271_configure_resume(struct wl1271 *wl,
1697 struct wl12xx_vif *wlvif)
1695{ 1698{
1696 int ret; 1699 int ret;
1697 bool is_sta = wl->bss_type == BSS_TYPE_STA_BSS; 1700 bool is_sta = wl->bss_type == BSS_TYPE_STA_BSS;
@@ -1709,7 +1712,7 @@ static void wl1271_configure_resume(struct wl1271 *wl)
1709 /* exit psm if it wasn't configured */ 1712 /* exit psm if it wasn't configured */
1710 if (!test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) 1713 if (!test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags))
1711 wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 1714 wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
1712 wl->basic_rate, true); 1715 wlvif->basic_rate, true);
1713 } else if (is_ap) { 1716 } else if (is_ap) {
1714 wl1271_acx_beacon_filter_opt(wl, false); 1717 wl1271_acx_beacon_filter_opt(wl, false);
1715 } 1718 }
@@ -1723,13 +1726,15 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
1723 struct cfg80211_wowlan *wow) 1726 struct cfg80211_wowlan *wow)
1724{ 1727{
1725 struct wl1271 *wl = hw->priv; 1728 struct wl1271 *wl = hw->priv;
1729 struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
1730 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1726 int ret; 1731 int ret;
1727 1732
1728 wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); 1733 wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow);
1729 WARN_ON(!wow || !wow->any); 1734 WARN_ON(!wow || !wow->any);
1730 1735
1731 wl->wow_enabled = true; 1736 wl->wow_enabled = true;
1732 ret = wl1271_configure_suspend(wl); 1737 ret = wl1271_configure_suspend(wl, wlvif);
1733 if (ret < 0) { 1738 if (ret < 0) {
1734 wl1271_warning("couldn't prepare device to suspend"); 1739 wl1271_warning("couldn't prepare device to suspend");
1735 return ret; 1740 return ret;
@@ -1760,6 +1765,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
1760static int wl1271_op_resume(struct ieee80211_hw *hw) 1765static int wl1271_op_resume(struct ieee80211_hw *hw)
1761{ 1766{
1762 struct wl1271 *wl = hw->priv; 1767 struct wl1271 *wl = hw->priv;
1768 struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */
1769 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1763 unsigned long flags; 1770 unsigned long flags;
1764 bool run_irq_work = false; 1771 bool run_irq_work = false;
1765 1772
@@ -1783,7 +1790,7 @@ static int wl1271_op_resume(struct ieee80211_hw *hw)
1783 wl1271_irq(0, wl); 1790 wl1271_irq(0, wl);
1784 wl1271_enable_interrupts(wl); 1791 wl1271_enable_interrupts(wl);
1785 } 1792 }
1786 wl1271_configure_resume(wl); 1793 wl1271_configure_resume(wl, wlvif);
1787 wl->wow_enabled = false; 1794 wl->wow_enabled = false;
1788 1795
1789 return 0; 1796 return 0;
@@ -1840,6 +1847,7 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl)
1840static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif) 1847static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif)
1841{ 1848{
1842 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; 1849 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
1850 wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC;
1843 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; 1851 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC;
1844} 1852}
1845 1853
@@ -2214,7 +2222,7 @@ static int wl1271_join(struct wl1271 *wl, struct wl12xx_vif *wlvif,
2214 if (ret < 0) 2222 if (ret < 0)
2215 goto out; 2223 goto out;
2216 2224
2217 ret = wl1271_cmd_build_klv_null_data(wl); 2225 ret = wl12xx_cmd_build_klv_null_data(wl, wlvif);
2218 if (ret < 0) 2226 if (ret < 0)
2219 goto out; 2227 goto out;
2220 2228
@@ -2384,7 +2392,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2384 if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) 2392 if (!test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
2385 wl1271_set_band_rate(wl, wlvif); 2393 wl1271_set_band_rate(wl, wlvif);
2386 2394
2387 wl->basic_rate = 2395 wlvif->basic_rate =
2388 wl1271_tx_min_rate_get(wl, 2396 wl1271_tx_min_rate_get(wl,
2389 wlvif->basic_rate_set); 2397 wlvif->basic_rate_set);
2390 ret = wl1271_acx_sta_rate_policies(wl, wlvif); 2398 ret = wl1271_acx_sta_rate_policies(wl, wlvif);
@@ -2450,7 +2458,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2450 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) { 2458 if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags)) {
2451 wl1271_debug(DEBUG_PSM, "psm enabled"); 2459 wl1271_debug(DEBUG_PSM, "psm enabled");
2452 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE, 2460 ret = wl1271_ps_set_mode(wl, STATION_POWER_SAVE_MODE,
2453 wl->basic_rate, true); 2461 wlvif->basic_rate, true);
2454 } 2462 }
2455 } else if (!(conf->flags & IEEE80211_CONF_PS) && 2463 } else if (!(conf->flags & IEEE80211_CONF_PS) &&
2456 test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) { 2464 test_bit(WL1271_FLAG_PSM_REQUESTED, &wl->flags)) {
@@ -2460,7 +2468,7 @@ static int wl1271_op_config(struct ieee80211_hw *hw, u32 changed)
2460 2468
2461 if (test_bit(WL1271_FLAG_PSM, &wl->flags)) 2469 if (test_bit(WL1271_FLAG_PSM, &wl->flags))
2462 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE, 2470 ret = wl1271_ps_set_mode(wl, STATION_ACTIVE_MODE,
2463 wl->basic_rate, true); 2471 wlvif->basic_rate, true);
2464 } 2472 }
2465 2473
2466 if (conf->power_level != wl->power_level) { 2474 if (conf->power_level != wl->power_level) {
@@ -3311,7 +3319,7 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
3311 3319
3312 wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates, 3320 wlvif->basic_rate_set = wl1271_tx_enabled_rates_get(wl, rates,
3313 wl->band); 3321 wl->band);
3314 wl->basic_rate = wl1271_tx_min_rate_get(wl, 3322 wlvif->basic_rate = wl1271_tx_min_rate_get(wl,
3315 wlvif->basic_rate_set); 3323 wlvif->basic_rate_set);
3316 3324
3317 ret = wl1271_init_ap_rates(wl, wlvif); 3325 ret = wl1271_init_ap_rates(wl, wlvif);
@@ -3450,7 +3458,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
3450 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN); 3458 memcpy(wl->bssid, bss_conf->bssid, ETH_ALEN);
3451 3459
3452 if (!is_zero_ether_addr(wl->bssid)) { 3460 if (!is_zero_ether_addr(wl->bssid)) {
3453 ret = wl1271_cmd_build_null_data(wl); 3461 ret = wl12xx_cmd_build_null_data(wl, wlvif);
3454 if (ret < 0) 3462 if (ret < 0)
3455 goto out; 3463 goto out;
3456 3464
@@ -3498,7 +3506,7 @@ sta_not_found:
3498 wlvif->basic_rate_set = 3506 wlvif->basic_rate_set =
3499 wl1271_tx_enabled_rates_get(wl, rates, 3507 wl1271_tx_enabled_rates_get(wl, rates,
3500 wl->band); 3508 wl->band);
3501 wl->basic_rate = 3509 wlvif->basic_rate =
3502 wl1271_tx_min_rate_get(wl, 3510 wl1271_tx_min_rate_get(wl,
3503 wlvif->basic_rate_set); 3511 wlvif->basic_rate_set);
3504 if (sta_rate_set) 3512 if (sta_rate_set)
@@ -3552,7 +3560,7 @@ sta_not_found:
3552 3560
3553 /* revert back to minimum rates for the current band */ 3561 /* revert back to minimum rates for the current band */
3554 wl1271_set_band_rate(wl, wlvif); 3562 wl1271_set_band_rate(wl, wlvif);
3555 wl->basic_rate = 3563 wlvif->basic_rate =
3556 wl1271_tx_min_rate_get(wl, 3564 wl1271_tx_min_rate_get(wl,
3557 wlvif->basic_rate_set); 3565 wlvif->basic_rate_set);
3558 ret = wl1271_acx_sta_rate_policies(wl, wlvif); 3566 ret = wl1271_acx_sta_rate_policies(wl, wlvif);
@@ -3608,7 +3616,7 @@ sta_not_found:
3608 wlvif->basic_rate_set = 3616 wlvif->basic_rate_set =
3609 wl1271_tx_enabled_rates_get(wl, rates, 3617 wl1271_tx_enabled_rates_get(wl, rates,
3610 wl->band); 3618 wl->band);
3611 wl->basic_rate = 3619 wlvif->basic_rate =
3612 wl1271_tx_min_rate_get(wl, 3620 wl1271_tx_min_rate_get(wl,
3613 wlvif->basic_rate_set); 3621 wlvif->basic_rate_set);
3614 3622
@@ -3636,7 +3644,7 @@ sta_not_found:
3636 * isn't being set (when sending), so we have to 3644 * isn't being set (when sending), so we have to
3637 * reconfigure the template upon every ip change. 3645 * reconfigure the template upon every ip change.
3638 */ 3646 */
3639 ret = wl1271_cmd_build_arp_rsp(wl, addr); 3647 ret = wl1271_cmd_build_arp_rsp(wl, wlvif, addr);
3640 if (ret < 0) { 3648 if (ret < 0) {
3641 wl1271_warning("build arp rsp failed: %d", ret); 3649 wl1271_warning("build arp rsp failed: %d", ret);
3642 goto out; 3650 goto out;
@@ -3689,7 +3697,7 @@ sta_not_found:
3689 3697
3690 mode = STATION_POWER_SAVE_MODE; 3698 mode = STATION_POWER_SAVE_MODE;
3691 ret = wl1271_ps_set_mode(wl, mode, 3699 ret = wl1271_ps_set_mode(wl, mode,
3692 wl->basic_rate, 3700 wlvif->basic_rate,
3693 true); 3701 true);
3694 if (ret < 0) 3702 if (ret < 0)
3695 goto out; 3703 goto out;
@@ -4844,7 +4852,6 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
4844 wl->rx_counter = 0; 4852 wl->rx_counter = 0;
4845 wl->psm_entry_retry = 0; 4853 wl->psm_entry_retry = 0;
4846 wl->power_level = WL1271_DEFAULT_POWER_LEVEL; 4854 wl->power_level = WL1271_DEFAULT_POWER_LEVEL;
4847 wl->basic_rate = CONF_TX_RATE_MASK_BASIC;
4848 wl->band = IEEE80211_BAND_2GHZ; 4855 wl->band = IEEE80211_BAND_2GHZ;
4849 wl->vif = NULL; 4856 wl->vif = NULL;
4850 wl->flags = 0; 4857 wl->flags = 0;