aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath9k/main.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez <lrodriguez@atheros.com>2009-09-10 12:22:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-07 16:39:25 -0400
commit1510718d0fd6e20803aac95fe1d8a44846098a34 (patch)
tree924cfeb647beae71e2d56f10bb6bf15f246b42fc /drivers/net/wireless/ath/ath9k/main.c
parent3453ad8839ca91e1c11211d4d87dc3657c5a2b44 (diff)
atheros/ath9k: move macaddr, curaid, curbssid and bssidmask to common
These are common amongst ath9k and ath5k, so put them into the common structure and make ath9k to use it. ar9170 can use macaddr, and curbssid. We'll change ath5k and ar9170 separately. Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index f2c1feb7d491..a96350d2aace 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -976,13 +976,14 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
976 struct ieee80211_bss_conf *bss_conf) 976 struct ieee80211_bss_conf *bss_conf)
977{ 977{
978 struct ath_hw *ah = sc->sc_ah; 978 struct ath_hw *ah = sc->sc_ah;
979 struct ath_common *common = ath9k_hw_common(ah);
979 980
980 if (bss_conf->assoc) { 981 if (bss_conf->assoc) {
981 DPRINTF(ah, ATH_DBG_CONFIG, "Bss Info ASSOC %d, bssid: %pM\n", 982 DPRINTF(ah, ATH_DBG_CONFIG, "Bss Info ASSOC %d, bssid: %pM\n",
982 bss_conf->aid, sc->curbssid); 983 bss_conf->aid, common->curbssid);
983 984
984 /* New association, store aid */ 985 /* New association, store aid */
985 sc->curaid = bss_conf->aid; 986 common->curaid = bss_conf->aid;
986 ath9k_hw_write_associd(ah); 987 ath9k_hw_write_associd(ah);
987 988
988 /* 989 /*
@@ -1001,7 +1002,7 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
1001 ath_start_ani(sc); 1002 ath_start_ani(sc);
1002 } else { 1003 } else {
1003 DPRINTF(ah, ATH_DBG_CONFIG, "Bss Info DISASSOC\n"); 1004 DPRINTF(ah, ATH_DBG_CONFIG, "Bss Info DISASSOC\n");
1004 sc->curaid = 0; 1005 common->curaid = 0;
1005 /* Stop ANI */ 1006 /* Stop ANI */
1006 del_timer_sync(&sc->ani.timer); 1007 del_timer_sync(&sc->ani.timer);
1007 } 1008 }
@@ -1497,6 +1498,7 @@ static int ath_init_btcoex_timer(struct ath_softc *sc)
1497static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid) 1498static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)
1498{ 1499{
1499 struct ath_hw *ah = NULL; 1500 struct ath_hw *ah = NULL;
1501 struct ath_common *common;
1500 int r = 0, i; 1502 int r = 0, i;
1501 int csz = 0; 1503 int csz = 0;
1502 int qnum; 1504 int qnum;
@@ -1675,8 +1677,10 @@ static int ath_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid)
1675 ath9k_hw_setcapability(ah, ATH9K_CAP_DIVERSITY, 1, true, NULL); 1677 ath9k_hw_setcapability(ah, ATH9K_CAP_DIVERSITY, 1, true, NULL);
1676 sc->rx.defant = ath9k_hw_getdefantenna(ah); 1678 sc->rx.defant = ath9k_hw_getdefantenna(ah);
1677 1679
1680 common = ath9k_hw_common(ah);
1681
1678 if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) 1682 if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
1679 memcpy(sc->bssidmask, ath_bcast_mac, ETH_ALEN); 1683 memcpy(common->bssidmask, ath_bcast_mac, ETH_ALEN);
1680 1684
1681 sc->beacon.slottime = ATH9K_SLOT_TIME_9; /* default to short slot time */ 1685 sc->beacon.slottime = ATH9K_SLOT_TIME_9; /* default to short slot time */
1682 1686
@@ -1780,6 +1784,7 @@ void ath_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
1780int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid) 1784int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid)
1781{ 1785{
1782 struct ieee80211_hw *hw = sc->hw; 1786 struct ieee80211_hw *hw = sc->hw;
1787 struct ath_common *common;
1783 struct ath_hw *ah; 1788 struct ath_hw *ah;
1784 int error = 0, i; 1789 int error = 0, i;
1785 struct ath_regulatory *reg; 1790 struct ath_regulatory *reg;
@@ -1791,19 +1796,20 @@ int ath_init_device(u16 devid, struct ath_softc *sc, u16 subsysid)
1791 return error; 1796 return error;
1792 1797
1793 ah = sc->sc_ah; 1798 ah = sc->sc_ah;
1799 common = ath9k_hw_common(ah);
1794 1800
1795 /* get mac address from hardware and set in mac80211 */ 1801 /* get mac address from hardware and set in mac80211 */
1796 1802
1797 SET_IEEE80211_PERM_ADDR(hw, ah->macaddr); 1803 SET_IEEE80211_PERM_ADDR(hw, common->macaddr);
1798 1804
1799 ath_set_hw_capab(sc, hw); 1805 ath_set_hw_capab(sc, hw);
1800 1806
1801 error = ath_regd_init(&sc->common.regulatory, sc->hw->wiphy, 1807 error = ath_regd_init(&common->regulatory, sc->hw->wiphy,
1802 ath9k_reg_notifier); 1808 ath9k_reg_notifier);
1803 if (error) 1809 if (error)
1804 return error; 1810 return error;
1805 1811
1806 reg = &sc->common.regulatory; 1812 reg = &common->regulatory;
1807 1813
1808 if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) { 1814 if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
1809 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap); 1815 setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
@@ -2785,6 +2791,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2785 struct ath_wiphy *aphy = hw->priv; 2791 struct ath_wiphy *aphy = hw->priv;
2786 struct ath_softc *sc = aphy->sc; 2792 struct ath_softc *sc = aphy->sc;
2787 struct ath_hw *ah = sc->sc_ah; 2793 struct ath_hw *ah = sc->sc_ah;
2794 struct ath_common *common = ath9k_hw_common(ah);
2788 struct ath_vif *avp = (void *)vif->drv_priv; 2795 struct ath_vif *avp = (void *)vif->drv_priv;
2789 u32 rfilt = 0; 2796 u32 rfilt = 0;
2790 int error, i; 2797 int error, i;
@@ -2800,8 +2807,8 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2800 ah->opmode != NL80211_IFTYPE_AP) { 2807 ah->opmode != NL80211_IFTYPE_AP) {
2801 ah->opmode = NL80211_IFTYPE_STATION; 2808 ah->opmode = NL80211_IFTYPE_STATION;
2802 ath9k_hw_setopmode(ah); 2809 ath9k_hw_setopmode(ah);
2803 memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN); 2810 memcpy(common->curbssid, common->macaddr, ETH_ALEN);
2804 sc->curaid = 0; 2811 common->curaid = 0;
2805 ath9k_hw_write_associd(ah); 2812 ath9k_hw_write_associd(ah);
2806 /* Request full reset to get hw opmode changed properly */ 2813 /* Request full reset to get hw opmode changed properly */
2807 sc->sc_flags |= SC_OP_FULL_RESET; 2814 sc->sc_flags |= SC_OP_FULL_RESET;
@@ -2814,9 +2821,9 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2814 case NL80211_IFTYPE_ADHOC: 2821 case NL80211_IFTYPE_ADHOC:
2815 case NL80211_IFTYPE_MESH_POINT: 2822 case NL80211_IFTYPE_MESH_POINT:
2816 /* Set BSSID */ 2823 /* Set BSSID */
2817 memcpy(sc->curbssid, bss_conf->bssid, ETH_ALEN); 2824 memcpy(common->curbssid, bss_conf->bssid, ETH_ALEN);
2818 memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN); 2825 memcpy(avp->bssid, bss_conf->bssid, ETH_ALEN);
2819 sc->curaid = 0; 2826 common->curaid = 0;
2820 ath9k_hw_write_associd(ah); 2827 ath9k_hw_write_associd(ah);
2821 2828
2822 /* Set aggregation protection mode parameters */ 2829 /* Set aggregation protection mode parameters */
@@ -2824,7 +2831,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2824 2831
2825 DPRINTF(sc->sc_ah, ATH_DBG_CONFIG, 2832 DPRINTF(sc->sc_ah, ATH_DBG_CONFIG,
2826 "RX filter 0x%x bssid %pM aid 0x%x\n", 2833 "RX filter 0x%x bssid %pM aid 0x%x\n",
2827 rfilt, sc->curbssid, sc->curaid); 2834 rfilt, common->curbssid, common->curaid);
2828 2835
2829 /* need to reconfigure the beacon */ 2836 /* need to reconfigure the beacon */
2830 sc->sc_flags &= ~SC_OP_BEACONS ; 2837 sc->sc_flags &= ~SC_OP_BEACONS ;
@@ -2863,7 +2870,7 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
2863 if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i)) 2870 if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i))
2864 ath9k_hw_keysetmac(sc->sc_ah, 2871 ath9k_hw_keysetmac(sc->sc_ah,
2865 (u16)i, 2872 (u16)i,
2866 sc->curbssid); 2873 common->curbssid);
2867 } 2874 }
2868 2875
2869 /* Only legacy IBSS for now */ 2876 /* Only legacy IBSS for now */