Commit bdd7bd16 authored by Blaise Gassend's avatar Blaise Gassend Committed by John W. Linville

mac80211_hwsim: Incorporate txpower into rssi

Up to now mac80211_hwsim has been reporting an rssi of -50. This patch
improves the model slightly by returning txpower-50. This makes it
easy to stimulate tests that need to see a varying rssi.
Signed-off-by: default avatarBlaise Gassend <blaise@willowgarage.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 19999792
...@@ -309,6 +309,8 @@ struct mac80211_hwsim_data { ...@@ -309,6 +309,8 @@ struct mac80211_hwsim_data {
*/ */
u64 group; u64 group;
struct dentry *debugfs_group; struct dentry *debugfs_group;
int power_level;
}; };
...@@ -497,7 +499,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, ...@@ -497,7 +499,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
rx_status.band = data->channel->band; rx_status.band = data->channel->band;
rx_status.rate_idx = info->control.rates[0].idx; rx_status.rate_idx = info->control.rates[0].idx;
/* TODO: simulate real signal strength (and optional packet loss) */ /* TODO: simulate real signal strength (and optional packet loss) */
rx_status.signal = -50; rx_status.signal = data->power_level - 50;
if (data->ps != PS_DISABLED) if (data->ps != PS_DISABLED)
hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM); hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PM);
...@@ -698,6 +700,7 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed) ...@@ -698,6 +700,7 @@ static int mac80211_hwsim_config(struct ieee80211_hw *hw, u32 changed)
data->idle = !!(conf->flags & IEEE80211_CONF_IDLE); data->idle = !!(conf->flags & IEEE80211_CONF_IDLE);
data->channel = conf->channel; data->channel = conf->channel;
data->power_level = conf->power_level;
if (!data->started || !data->beacon_int) if (!data->started || !data->beacon_int)
del_timer(&data->beacon_timer); del_timer(&data->beacon_timer);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment