mac80211: tell driver when dtim change detected
PATCH v2 1/1 mac80211: tell driver when dtim change detected
From: Wey-Yi Guy <[email protected]>
In current implementation, mac80211 send dtim_period update to driver during association, but if no NetworkManager or similar application perform scan operation, plus tim_ie is not part of probe response; mac80211 will not get beacon with dtim information later, then mac80211 will not pass the information to driver for update.
Call ieee80211_hw_config() with IEEE80211_CONF_CHANGE_PS flag set to allow driver make correct dtim adjustment if dtim_period change detected. Also perform recalc_ps operation if needed.
---
v2: move the function to ieee80211_rx_bss_info() to make sure only call
when needed
--- net/mac80211/mlme.c | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)
net/mac80211/mlme.c +20 -1
@@ -1157,6 +1157,23 @@ static bool ieee80211_assoc_success(struct ieee80211_work *wk, } +static void ieee80211_update_dtim (struct ieee80211_sub_if_data *sdata, +struct ieee80211_local *local, +struct ieee80211_bss *bss) +{ +if (!(local->hw.flags &IEEE80211_HW_SUPPORTS_PS )) +return ; + +if (sdata->vif.type ==NL80211_IFTYPE_STATION && + sdata->vif.bss_conf.dtim_period != bss->dtim_period) { + sdata->vif.bss_conf.dtim_period = bss->dtim_period; +ieee80211_hw_config (local,IEEE80211_CONF_CHANGE_PS ); +mutex_lock (&local->iflist_mtx); +ieee80211_recalc_ps (local,-1 ); +mutex_unlock (&local->iflist_mtx); + } +} + static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt, size_t len,
@@ -1181,8 +1198,10 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata, bss =ieee80211_bss_info_update (local, rx_status, mgmt, len, elems, channel, beacon); -if (bss) +if (bss) {ieee80211_rx_bss_put (local, bss); +ieee80211_update_dtim (sdata, local, bss); + }if (!sdata->u.mgd.associated)return ;
Signature · 1 line
1.5.6.3
Johannes Berg
maintainernet/mac80211/mlme.c
Quoted 2 lines · On Thu, 2010-01-21 at 12:31 -0800, [email protected] wrote:
net/mac80211/mlme.c +0
-0
This is all in mlme.c, so ...
net/mac80211/mlme.c static bool ieee80211_assoc_success(struct ieee80211_work *wk, · line 1167
Quoted 8 lines
net/mac80211/mlme.c +8
-0+static void ieee80211_update_dtim (struct ieee80211_sub_if_data *sdata, +struct ieee80211_local *local, +struct ieee80211_bss *bss) +{ +if (!(local->hw.flags &IEEE80211_HW_SUPPORTS_PS )) +return ; + + if (sdata->vif.type == NL80211_IFTYPE_STATION &&
I don't think you need this check?
net/mac80211/mlme.c static bool ieee80211_assoc_success(struct ieee80211_work *wk, · line 1173
Quoted 6 lines
net/mac80211/mlme.c +6
-0+ sdata->vif.bss_conf.dtim_period != bss->dtim_period) { + sdata->vif.bss_conf.dtim_period = bss->dtim_period; +ieee80211_hw_config (local,IEEE80211_CONF_CHANGE_PS ); +mutex_lock (&local->iflist_mtx); +ieee80211_recalc_ps (local,-1 ); +mutex_unlock (&local->iflist_mtx);
And afaict recalc_ps() will call hw_config() if appropriate.
johannes
Quoted 7 lines · Johannes Berg
net/mac80211/mlme.c
Quoted 2 lines · On Thu, 2010-01-21 at 12:31 -0800, [email protected] wrote:
net/mac80211/mlme.c +0
-0This is all in
mlme.c, so ...
Quoted 10 lines
net/mac80211/mlme.c static bool ieee80211_assoc_success(struct ieee80211_work *wk, · line 1167
Quoted 8 lines
net/mac80211/mlme.c +8
-0+static void ieee80211_update_dtim (struct ieee80211_sub_if_data *sdata, +struct ieee80211_local *local, +struct ieee80211_bss *bss) +{ +if (!(local->hw.flags &IEEE80211_HW_SUPPORTS_PS )) +return ; + + if (sdata->vif.type == NL80211_IFTYPE_STATION &&I don't think you need this check?
yes, that make sense.
Quoted 10 lines
net/mac80211/mlme.c static bool ieee80211_assoc_success(struct ieee80211_work *wk, · line 1173
Quoted 7 lines
net/mac80211/mlme.c +6
-0+ sdata->vif.bss_conf.dtim_period != bss->dtim_period) { + sdata->vif.bss_conf.dtim_period = bss->dtim_period; +ieee80211_hw_config (local,IEEE80211_CONF_CHANGE_PS ); +mutex_lock (&local->iflist_mtx); +ieee80211_recalc_ps (local,-1 ); +mutex_unlock (&local->iflist_mtx);And afaict
recalc_ps()will callhw_config()if appropriate.
That is the part I am not sure, so I call the hw_config manually, since you confirm hw_config will happen, then there is no point to call first
I will make those changes and submit again
Wey