diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800.h | 10 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 49 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 1 |
5 files changed, 63 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800.h b/drivers/net/wireless/rt2x00/rt2800.h index 9dcbf87156b6..03f9fa15e157 100644 --- a/drivers/net/wireless/rt2x00/rt2800.h +++ b/drivers/net/wireless/rt2x00/rt2800.h | |||
@@ -699,8 +699,18 @@ | |||
699 | 699 | ||
700 | /* | 700 | /* |
701 | * CH_TIME_CFG: count as channel busy | 701 | * CH_TIME_CFG: count as channel busy |
702 | * EIFS_BUSY: Count EIFS as channel busy | ||
703 | * NAV_BUSY: Count NAS as channel busy | ||
704 | * RX_BUSY: Count RX as channel busy | ||
705 | * TX_BUSY: Count TX as channel busy | ||
706 | * TMR_EN: Enable channel statistics timer | ||
702 | */ | 707 | */ |
703 | #define CH_TIME_CFG 0x110c | 708 | #define CH_TIME_CFG 0x110c |
709 | #define CH_TIME_CFG_EIFS_BUSY FIELD32(0x00000010) | ||
710 | #define CH_TIME_CFG_NAV_BUSY FIELD32(0x00000008) | ||
711 | #define CH_TIME_CFG_RX_BUSY FIELD32(0x00000004) | ||
712 | #define CH_TIME_CFG_TX_BUSY FIELD32(0x00000002) | ||
713 | #define CH_TIME_CFG_TMR_EN FIELD32(0x00000001) | ||
704 | 714 | ||
705 | /* | 715 | /* |
706 | * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us | 716 | * PBF_LIFE_TIMER: TX/RX MPDU timestamp timer (free run) Unit: 1us |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 9b592d9481b4..b7de1a504480 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -1625,6 +1625,13 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev, | |||
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | msleep(1); | 1627 | msleep(1); |
1628 | |||
1629 | /* | ||
1630 | * Clear channel statistic counters | ||
1631 | */ | ||
1632 | rt2800_register_read(rt2x00dev, CH_IDLE_STA, ®); | ||
1633 | rt2800_register_read(rt2x00dev, CH_BUSY_STA, ®); | ||
1634 | rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, ®); | ||
1628 | } | 1635 | } |
1629 | 1636 | ||
1630 | static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, | 1637 | static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev, |
@@ -2259,6 +2266,17 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev) | |||
2259 | rt2x00_set_field32(®, INT_TIMER_CFG_PRE_TBTT_TIMER, 6 << 4); | 2266 | rt2x00_set_field32(®, INT_TIMER_CFG_PRE_TBTT_TIMER, 6 << 4); |
2260 | rt2800_register_write(rt2x00dev, INT_TIMER_CFG, reg); | 2267 | rt2800_register_write(rt2x00dev, INT_TIMER_CFG, reg); |
2261 | 2268 | ||
2269 | /* | ||
2270 | * Set up channel statistics timer | ||
2271 | */ | ||
2272 | rt2800_register_read(rt2x00dev, CH_TIME_CFG, ®); | ||
2273 | rt2x00_set_field32(®, CH_TIME_CFG_EIFS_BUSY, 1); | ||
2274 | rt2x00_set_field32(®, CH_TIME_CFG_NAV_BUSY, 1); | ||
2275 | rt2x00_set_field32(®, CH_TIME_CFG_RX_BUSY, 1); | ||
2276 | rt2x00_set_field32(®, CH_TIME_CFG_TX_BUSY, 1); | ||
2277 | rt2x00_set_field32(®, CH_TIME_CFG_TMR_EN, 1); | ||
2278 | rt2800_register_write(rt2x00dev, CH_TIME_CFG, reg); | ||
2279 | |||
2262 | return 0; | 2280 | return 0; |
2263 | } | 2281 | } |
2264 | 2282 | ||
@@ -3539,6 +3557,37 @@ int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
3539 | } | 3557 | } |
3540 | EXPORT_SYMBOL_GPL(rt2800_ampdu_action); | 3558 | EXPORT_SYMBOL_GPL(rt2800_ampdu_action); |
3541 | 3559 | ||
3560 | int rt2800_get_survey(struct ieee80211_hw *hw, int idx, | ||
3561 | struct survey_info *survey) | ||
3562 | { | ||
3563 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
3564 | struct ieee80211_conf *conf = &hw->conf; | ||
3565 | u32 idle, busy, busy_ext; | ||
3566 | |||
3567 | if (idx != 0) | ||
3568 | return -ENOENT; | ||
3569 | |||
3570 | survey->channel = conf->channel; | ||
3571 | |||
3572 | rt2800_register_read(rt2x00dev, CH_IDLE_STA, &idle); | ||
3573 | rt2800_register_read(rt2x00dev, CH_BUSY_STA, &busy); | ||
3574 | rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, &busy_ext); | ||
3575 | |||
3576 | if (idle || busy) { | ||
3577 | survey->filled = SURVEY_INFO_CHANNEL_TIME | | ||
3578 | SURVEY_INFO_CHANNEL_TIME_BUSY | | ||
3579 | SURVEY_INFO_CHANNEL_TIME_EXT_BUSY; | ||
3580 | |||
3581 | survey->channel_time = (idle + busy) / 1000; | ||
3582 | survey->channel_time_busy = busy / 1000; | ||
3583 | survey->channel_time_ext_busy = busy_ext / 1000; | ||
3584 | } | ||
3585 | |||
3586 | return 0; | ||
3587 | |||
3588 | } | ||
3589 | EXPORT_SYMBOL_GPL(rt2800_get_survey); | ||
3590 | |||
3542 | MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz"); | 3591 | MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz"); |
3543 | MODULE_VERSION(DRV_VERSION); | 3592 | MODULE_VERSION(DRV_VERSION); |
3544 | MODULE_DESCRIPTION("Ralink RT2800 library"); | 3593 | MODULE_DESCRIPTION("Ralink RT2800 library"); |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.h b/drivers/net/wireless/rt2x00/rt2800lib.h index 81cbc92e7857..e3c995a9dec4 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.h +++ b/drivers/net/wireless/rt2x00/rt2800lib.h | |||
@@ -199,5 +199,7 @@ u64 rt2800_get_tsf(struct ieee80211_hw *hw); | |||
199 | int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 199 | int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
200 | enum ieee80211_ampdu_mlme_action action, | 200 | enum ieee80211_ampdu_mlme_action action, |
201 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); | 201 | struct ieee80211_sta *sta, u16 tid, u16 *ssn); |
202 | int rt2800_get_survey(struct ieee80211_hw *hw, int idx, | ||
203 | struct survey_info *survey); | ||
202 | 204 | ||
203 | #endif /* RT2800LIB_H */ | 205 | #endif /* RT2800LIB_H */ |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index b989b0d3ed49..f5abcc6e86b7 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -944,6 +944,7 @@ static const struct ieee80211_ops rt2800pci_mac80211_ops = { | |||
944 | .rfkill_poll = rt2x00mac_rfkill_poll, | 944 | .rfkill_poll = rt2x00mac_rfkill_poll, |
945 | .ampdu_action = rt2800_ampdu_action, | 945 | .ampdu_action = rt2800_ampdu_action, |
946 | .flush = rt2x00mac_flush, | 946 | .flush = rt2x00mac_flush, |
947 | .get_survey = rt2800_get_survey, | ||
947 | }; | 948 | }; |
948 | 949 | ||
949 | static const struct rt2800_ops rt2800pci_rt2800_ops = { | 950 | static const struct rt2800_ops rt2800pci_rt2800_ops = { |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index 935b76d3ce4f..042e47d92b6e 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -562,6 +562,7 @@ static const struct ieee80211_ops rt2800usb_mac80211_ops = { | |||
562 | .rfkill_poll = rt2x00mac_rfkill_poll, | 562 | .rfkill_poll = rt2x00mac_rfkill_poll, |
563 | .ampdu_action = rt2800_ampdu_action, | 563 | .ampdu_action = rt2800_ampdu_action, |
564 | .flush = rt2x00mac_flush, | 564 | .flush = rt2x00mac_flush, |
565 | .get_survey = rt2800_get_survey, | ||
565 | }; | 566 | }; |
566 | 567 | ||
567 | static const struct rt2800_ops rt2800usb_rt2800_ops = { | 568 | static const struct rt2800_ops rt2800usb_rt2800_ops = { |