rt2x00: Implement get_survey callback for rt2800
Implement the get_survey callback to allow user space to read statistics about the current channel condition. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
committed by
John W. Linville
parent
38c8a566fc
commit
977206d79f
@ -1625,6 +1625,13 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
|
||||
}
|
||||
|
||||
msleep(1);
|
||||
|
||||
/*
|
||||
* Clear channel statistic counters
|
||||
*/
|
||||
rt2800_register_read(rt2x00dev, CH_IDLE_STA, ®);
|
||||
rt2800_register_read(rt2x00dev, CH_BUSY_STA, ®);
|
||||
rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, ®);
|
||||
}
|
||||
|
||||
static void rt2800_config_txpower(struct rt2x00_dev *rt2x00dev,
|
||||
@ -2259,6 +2266,17 @@ static int rt2800_init_registers(struct rt2x00_dev *rt2x00dev)
|
||||
rt2x00_set_field32(®, INT_TIMER_CFG_PRE_TBTT_TIMER, 6 << 4);
|
||||
rt2800_register_write(rt2x00dev, INT_TIMER_CFG, reg);
|
||||
|
||||
/*
|
||||
* Set up channel statistics timer
|
||||
*/
|
||||
rt2800_register_read(rt2x00dev, CH_TIME_CFG, ®);
|
||||
rt2x00_set_field32(®, CH_TIME_CFG_EIFS_BUSY, 1);
|
||||
rt2x00_set_field32(®, CH_TIME_CFG_NAV_BUSY, 1);
|
||||
rt2x00_set_field32(®, CH_TIME_CFG_RX_BUSY, 1);
|
||||
rt2x00_set_field32(®, CH_TIME_CFG_TX_BUSY, 1);
|
||||
rt2x00_set_field32(®, CH_TIME_CFG_TMR_EN, 1);
|
||||
rt2800_register_write(rt2x00dev, CH_TIME_CFG, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3539,6 +3557,37 @@ int rt2800_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2800_ampdu_action);
|
||||
|
||||
int rt2800_get_survey(struct ieee80211_hw *hw, int idx,
|
||||
struct survey_info *survey)
|
||||
{
|
||||
struct rt2x00_dev *rt2x00dev = hw->priv;
|
||||
struct ieee80211_conf *conf = &hw->conf;
|
||||
u32 idle, busy, busy_ext;
|
||||
|
||||
if (idx != 0)
|
||||
return -ENOENT;
|
||||
|
||||
survey->channel = conf->channel;
|
||||
|
||||
rt2800_register_read(rt2x00dev, CH_IDLE_STA, &idle);
|
||||
rt2800_register_read(rt2x00dev, CH_BUSY_STA, &busy);
|
||||
rt2800_register_read(rt2x00dev, CH_BUSY_STA_SEC, &busy_ext);
|
||||
|
||||
if (idle || busy) {
|
||||
survey->filled = SURVEY_INFO_CHANNEL_TIME |
|
||||
SURVEY_INFO_CHANNEL_TIME_BUSY |
|
||||
SURVEY_INFO_CHANNEL_TIME_EXT_BUSY;
|
||||
|
||||
survey->channel_time = (idle + busy) / 1000;
|
||||
survey->channel_time_busy = busy / 1000;
|
||||
survey->channel_time_ext_busy = busy_ext / 1000;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(rt2800_get_survey);
|
||||
|
||||
MODULE_AUTHOR(DRV_PROJECT ", Bartlomiej Zolnierkiewicz");
|
||||
MODULE_VERSION(DRV_VERSION);
|
||||
MODULE_DESCRIPTION("Ralink RT2800 library");
|
||||
|
Reference in New Issue
Block a user