diff options
author | Eliad Peller <eliad@wizery.com> | 2011-08-14 06:17:08 -0400 |
---|---|---|
committer | Luciano Coelho <coelho@ti.com> | 2011-08-22 05:35:24 -0400 |
commit | b78b47eb73fcf4f04226ab8014aa8dadf11675d9 (patch) | |
tree | b4ffbd7b9459890d959ff7b4be35f25be5b83b28 /drivers/net/wireless/wl12xx/main.c | |
parent | c690ec816f9fa2ab2b6200c5b79b6933acca49a4 (diff) |
wl12xx: enable/disable role on interface add/remove
According to the new multi-role flow, we have to enable the
role before using (starting) it, and disable it on cleanup
(after it's no longer needed).
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.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c index 4689d0bccf6d..3e77f59e3397 100644 --- a/drivers/net/wireless/wl12xx/main.c +++ b/drivers/net/wireless/wl12xx/main.c | |||
@@ -1779,6 +1779,21 @@ static void wl1271_op_stop(struct ieee80211_hw *hw) | |||
1779 | wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); | 1779 | wl1271_debug(DEBUG_MAC80211, "mac80211 stop"); |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | static u8 wl12xx_get_role_type(struct wl1271 *wl) | ||
1783 | { | ||
1784 | switch (wl->bss_type) { | ||
1785 | case BSS_TYPE_AP_BSS: | ||
1786 | return WL1271_ROLE_AP; | ||
1787 | |||
1788 | case BSS_TYPE_STA_BSS: | ||
1789 | return WL1271_ROLE_STA; | ||
1790 | |||
1791 | default: | ||
1792 | wl1271_error("invalid bss_type: %d", wl->bss_type); | ||
1793 | } | ||
1794 | return WL12XX_INVALID_ROLE_TYPE; | ||
1795 | } | ||
1796 | |||
1782 | static int wl1271_op_add_interface(struct ieee80211_hw *hw, | 1797 | static int wl1271_op_add_interface(struct ieee80211_hw *hw, |
1783 | struct ieee80211_vif *vif) | 1798 | struct ieee80211_vif *vif) |
1784 | { | 1799 | { |
@@ -1786,6 +1801,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1786 | struct wiphy *wiphy = hw->wiphy; | 1801 | struct wiphy *wiphy = hw->wiphy; |
1787 | int retries = WL1271_BOOT_RETRIES; | 1802 | int retries = WL1271_BOOT_RETRIES; |
1788 | int ret = 0; | 1803 | int ret = 0; |
1804 | u8 role_type; | ||
1789 | bool booted = false; | 1805 | bool booted = false; |
1790 | 1806 | ||
1791 | wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", | 1807 | wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", |
@@ -1826,6 +1842,11 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1826 | goto out; | 1842 | goto out; |
1827 | } | 1843 | } |
1828 | 1844 | ||
1845 | role_type = wl12xx_get_role_type(wl); | ||
1846 | if (role_type == WL12XX_INVALID_ROLE_TYPE) { | ||
1847 | ret = -EINVAL; | ||
1848 | goto out; | ||
1849 | } | ||
1829 | memcpy(wl->mac_addr, vif->addr, ETH_ALEN); | 1850 | memcpy(wl->mac_addr, vif->addr, ETH_ALEN); |
1830 | 1851 | ||
1831 | if (wl->state != WL1271_STATE_OFF) { | 1852 | if (wl->state != WL1271_STATE_OFF) { |
@@ -1845,6 +1866,10 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, | |||
1845 | if (ret < 0) | 1866 | if (ret < 0) |
1846 | goto power_off; | 1867 | goto power_off; |
1847 | 1868 | ||
1869 | ret = wl12xx_cmd_role_enable(wl, role_type, &wl->role_id); | ||
1870 | if (ret < 0) | ||
1871 | goto irq_disable; | ||
1872 | |||
1848 | ret = wl1271_hw_init(wl); | 1873 | ret = wl1271_hw_init(wl); |
1849 | if (ret < 0) | 1874 | if (ret < 0) |
1850 | goto irq_disable; | 1875 | goto irq_disable; |
@@ -1909,6 +1934,7 @@ out: | |||
1909 | static void __wl1271_op_remove_interface(struct wl1271 *wl, | 1934 | static void __wl1271_op_remove_interface(struct wl1271 *wl, |
1910 | bool reset_tx_queues) | 1935 | bool reset_tx_queues) |
1911 | { | 1936 | { |
1937 | int ret; | ||
1912 | 1938 | ||
1913 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); | 1939 | wl1271_debug(DEBUG_MAC80211, "mac80211 remove interface"); |
1914 | 1940 | ||
@@ -1933,6 +1959,21 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, | |||
1933 | ieee80211_scan_completed(wl->hw, true); | 1959 | ieee80211_scan_completed(wl->hw, true); |
1934 | } | 1960 | } |
1935 | 1961 | ||
1962 | if (!test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags)) { | ||
1963 | /* disable active roles */ | ||
1964 | ret = wl1271_ps_elp_wakeup(wl); | ||
1965 | if (ret < 0) | ||
1966 | goto deinit; | ||
1967 | |||
1968 | ret = wl12xx_cmd_role_disable(wl, &wl->role_id); | ||
1969 | if (ret < 0) | ||
1970 | goto deinit; | ||
1971 | |||
1972 | wl1271_ps_elp_sleep(wl); | ||
1973 | } | ||
1974 | deinit: | ||
1975 | wl->sta_hlid = WL12XX_INVALID_LINK_ID; | ||
1976 | |||
1936 | /* | 1977 | /* |
1937 | * this must be before the cancel_work calls below, so that the work | 1978 | * this must be before the cancel_work calls below, so that the work |
1938 | * functions don't perform further work. | 1979 | * functions don't perform further work. |