diff options
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/base.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/base.c | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c index b9f93fbd9728..7f783d9462aa 100644 --- a/drivers/net/wireless/ath/ath5k/base.c +++ b/drivers/net/wireless/ath/ath5k/base.c | |||
@@ -549,7 +549,7 @@ static void ath_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | |||
549 | /* Calculate combined mode - when APs are active, operate in AP mode. | 549 | /* Calculate combined mode - when APs are active, operate in AP mode. |
550 | * Otherwise use the mode of the new interface. This can currently | 550 | * Otherwise use the mode of the new interface. This can currently |
551 | * only deal with combinations of APs and STAs. Only one ad-hoc | 551 | * only deal with combinations of APs and STAs. Only one ad-hoc |
552 | * interfaces is allowed above. | 552 | * interfaces is allowed. |
553 | */ | 553 | */ |
554 | if (avf->opmode == NL80211_IFTYPE_AP) | 554 | if (avf->opmode == NL80211_IFTYPE_AP) |
555 | iter_data->opmode = NL80211_IFTYPE_AP; | 555 | iter_data->opmode = NL80211_IFTYPE_AP; |
@@ -558,14 +558,6 @@ static void ath_vif_iter(void *data, u8 *mac, struct ieee80211_vif *vif) | |||
558 | iter_data->opmode = avf->opmode; | 558 | iter_data->opmode = avf->opmode; |
559 | } | 559 | } |
560 | 560 | ||
561 | static void ath_do_set_opmode(struct ath5k_softc *sc) | ||
562 | { | ||
563 | struct ath5k_hw *ah = sc->ah; | ||
564 | ath5k_hw_set_opmode(ah, sc->opmode); | ||
565 | ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "mode setup opmode %d (%s)\n", | ||
566 | sc->opmode, ath_opmode_to_string(sc->opmode)); | ||
567 | } | ||
568 | |||
569 | static void ath5k_update_bssid_mask_and_opmode(struct ath5k_softc *sc, | 561 | static void ath5k_update_bssid_mask_and_opmode(struct ath5k_softc *sc, |
570 | struct ieee80211_vif *vif) | 562 | struct ieee80211_vif *vif) |
571 | { | 563 | { |
@@ -595,7 +587,9 @@ static void ath5k_update_bssid_mask_and_opmode(struct ath5k_softc *sc, | |||
595 | /* Nothing active, default to station mode */ | 587 | /* Nothing active, default to station mode */ |
596 | sc->opmode = NL80211_IFTYPE_STATION; | 588 | sc->opmode = NL80211_IFTYPE_STATION; |
597 | 589 | ||
598 | ath_do_set_opmode(sc); | 590 | ath5k_hw_set_opmode(sc->ah, sc->opmode); |
591 | ATH5K_DBG(sc, ATH5K_DEBUG_MODE, "mode setup opmode %d (%s)\n", | ||
592 | sc->opmode, ath_opmode_to_string(sc->opmode)); | ||
599 | 593 | ||
600 | if (iter_data.need_set_hw_addr && iter_data.found_active) | 594 | if (iter_data.need_set_hw_addr && iter_data.found_active) |
601 | ath5k_hw_set_lladdr(sc->ah, iter_data.active_mac); | 595 | ath5k_hw_set_lladdr(sc->ah, iter_data.active_mac); |
@@ -1307,8 +1301,7 @@ ath5k_update_beacon_rssi(struct ath5k_softc *sc, struct sk_buff *skb, int rssi) | |||
1307 | memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) != 0) | 1301 | memcmp(mgmt->bssid, common->curbssid, ETH_ALEN) != 0) |
1308 | return; | 1302 | return; |
1309 | 1303 | ||
1310 | ah->ah_beacon_rssi_avg = ath5k_moving_average(ah->ah_beacon_rssi_avg, | 1304 | ewma_add(&ah->ah_beacon_rssi_avg, rssi); |
1311 | rssi); | ||
1312 | 1305 | ||
1313 | /* in IBSS mode we should keep RSSI statistics per neighbour */ | 1306 | /* in IBSS mode we should keep RSSI statistics per neighbour */ |
1314 | /* le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS */ | 1307 | /* le16_to_cpu(mgmt->u.beacon.capab_info) & WLAN_CAPABILITY_IBSS */ |
@@ -2562,6 +2555,7 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan) | |||
2562 | ah->ah_cal_next_full = jiffies; | 2555 | ah->ah_cal_next_full = jiffies; |
2563 | ah->ah_cal_next_ani = jiffies; | 2556 | ah->ah_cal_next_ani = jiffies; |
2564 | ah->ah_cal_next_nf = jiffies; | 2557 | ah->ah_cal_next_nf = jiffies; |
2558 | ewma_init(&ah->ah_beacon_rssi_avg, 1000, 8); | ||
2565 | 2559 | ||
2566 | /* | 2560 | /* |
2567 | * Change channels and update the h/w rate map if we're switching; | 2561 | * Change channels and update the h/w rate map if we're switching; |
@@ -3413,6 +3407,36 @@ static int ath5k_conf_tx(struct ieee80211_hw *hw, u16 queue, | |||
3413 | return ret; | 3407 | return ret; |
3414 | } | 3408 | } |
3415 | 3409 | ||
3410 | static int ath5k_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant) | ||
3411 | { | ||
3412 | struct ath5k_softc *sc = hw->priv; | ||
3413 | |||
3414 | if (tx_ant == 1 && rx_ant == 1) | ||
3415 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_A); | ||
3416 | else if (tx_ant == 2 && rx_ant == 2) | ||
3417 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_FIXED_B); | ||
3418 | else if ((tx_ant & 3) == 3 && (rx_ant & 3) == 3) | ||
3419 | ath5k_hw_set_antenna_mode(sc->ah, AR5K_ANTMODE_DEFAULT); | ||
3420 | else | ||
3421 | return -EINVAL; | ||
3422 | return 0; | ||
3423 | } | ||
3424 | |||
3425 | static int ath5k_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant) | ||
3426 | { | ||
3427 | struct ath5k_softc *sc = hw->priv; | ||
3428 | |||
3429 | switch (sc->ah->ah_ant_mode) { | ||
3430 | case AR5K_ANTMODE_FIXED_A: | ||
3431 | *tx_ant = 1; *rx_ant = 1; break; | ||
3432 | case AR5K_ANTMODE_FIXED_B: | ||
3433 | *tx_ant = 2; *rx_ant = 2; break; | ||
3434 | case AR5K_ANTMODE_DEFAULT: | ||
3435 | *tx_ant = 3; *rx_ant = 3; break; | ||
3436 | } | ||
3437 | return 0; | ||
3438 | } | ||
3439 | |||
3416 | static const struct ieee80211_ops ath5k_hw_ops = { | 3440 | static const struct ieee80211_ops ath5k_hw_ops = { |
3417 | .tx = ath5k_tx, | 3441 | .tx = ath5k_tx, |
3418 | .start = ath5k_start, | 3442 | .start = ath5k_start, |
@@ -3433,6 +3457,8 @@ static const struct ieee80211_ops ath5k_hw_ops = { | |||
3433 | .sw_scan_start = ath5k_sw_scan_start, | 3457 | .sw_scan_start = ath5k_sw_scan_start, |
3434 | .sw_scan_complete = ath5k_sw_scan_complete, | 3458 | .sw_scan_complete = ath5k_sw_scan_complete, |
3435 | .set_coverage_class = ath5k_set_coverage_class, | 3459 | .set_coverage_class = ath5k_set_coverage_class, |
3460 | .set_antenna = ath5k_set_antenna, | ||
3461 | .get_antenna = ath5k_get_antenna, | ||
3436 | }; | 3462 | }; |
3437 | 3463 | ||
3438 | /********************\ | 3464 | /********************\ |