cfg80211/mac80211: Notify proper sta opmode change value
Subsystems (2)
cover cfg80211/mac80211: Notify proper sta opmode change value
Currently bw and smps_mode are u8 type value in sta_opmode_info structure. This values filled in mac80211 from ieee80211_sta_rx_bandwidth and ieee80211_smps_mode. These enum values are specific to mac80211 and userspace/cfg80211 doesn't know about that. This patchset change its data type in the sta_opmode_info structure and mapping from mac80211 specific enum to nl80211 enum value.
Tamizh chelvam (3):
cfg80211: fix data type of sta_opmode_info parameter
mac80211: Use proper smps_mode enum in sta opmode event
mac80211: Use proper chan_width enum in sta opmode event
include/net/cfg80211.h | 8 ++++---- net/mac80211/ht.c | 15 +++++++++++++++ net/mac80211/ieee80211_i.h | 4 ++++ net/mac80211/rx.c | 6 ++++-- net/mac80211/vht.c | 32 +++++++++++++++++++++++++++++++- 5 files changed, 58 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/3 cfg80211: fix data type of sta_opmode_info parameter
Currently bw and smps_mode are u8 type value in sta_opmode_info structure. This values filled in mac80211 from ieee80211_sta_rx_bandwidth and ieee80211_smps_mode. These enum values are specific to mac80211 and userspace/cfg80211 doesn't know about that. This will lead to incorrect result/assumption by the user space application.
Change bw and smps_mode parameters to their respective enums in nl80211.
--- include/net/cfg80211.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/net/cfg80211.h +4 -4
@@ -3572,15 +3572,15 @@ enum wiphy_opmode_flag {/** * struct sta_opmode_info - Station's ht/vht operation mode information * @changed: contains value from &enum wiphy_opmode_flag -* @smps_mode: New SMPS mode of a station -* @bw: new max bandwidth value of a station +* @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station +* @bw: new max bandwidth value from &enum nl80211_chan_width of a station * @rx_nss: new rx_nss value of a station */ struct sta_opmode_info {u32 changed; -u8 smps_mode; -u8 bw; +enum nl80211_smps_mode smps_mode; +enum nl80211_chan_width bw;u8 rx_nss; };
Signature · 1 line
1.9.1
PATCH 2/3 mac80211: Use proper smps_mode enum in sta opmode event
In reply to Tamizh chelvamSMPS_MODE change value notified via nl80211 contains mac80211 specific value(ieee80211_smps_mode) and user space application will not know those values. This patch add support to map the mac80211 enum value to nl80211_smps_mode which will be understood by the userspace application.
--- net/mac80211/ht.c | 15 +++++++++++++++ net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/rx.c | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-)
net/mac80211/ht.c +15 -0
@@ -466,6 +466,21 @@ void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,__ieee80211_stop_tx_ba_session (sta, tid,AGG_STOP_PEER_REQUEST ); } +enum nl80211_smps_mode +ieee80211_smps_mode_to_smps_mode (enum ieee80211_smps_mode smps) +{ +switch (smps) { +case IEEE80211_SMPS_OFF : +return NL80211_SMPS_OFF ; +case IEEE80211_SMPS_STATIC : +return NL80211_SMPS_STATIC ; +case IEEE80211_SMPS_DYNAMIC : +return NL80211_SMPS_DYNAMIC ; +default : +return NL80211_SMPS_OFF ; + } +} +int ieee80211_send_smps_action (struct ieee80211_sub_if_data *sdata,enum ieee80211_smps_mode smps,const u8 *da,const u8 *bssid)
net/mac80211/ieee80211_i.h +2 -0
@@ -1788,6 +1788,8 @@ void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,void ieee80211_release_reorder_timeout (struct sta_info *sta,int tid);u8 ieee80211_mcs_to_chains (const struct ieee80211_mcs_info *mcs); +enum nl80211_smps_mode +ieee80211_smps_mode_to_smps_mode (enum ieee80211_smps_mode smps);/* VHT */ void
net/mac80211/rx.c +2 -1
@@ -2883,7 +2883,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,if (rx->sta->sta.smps_mode == smps_mode) goto handled; rx->sta->sta.smps_mode = smps_mode; - sta_opmode.smps_mode = smps_mode; + sta_opmode.smps_mode = +ieee80211_smps_mode_to_smps_mode (smps_mode); sta_opmode.changed =STA_OPMODE_SMPS_MODE_CHANGED ; sband = rx->local->hw.wiphy->bands[status->band];
Signature · 1 line
1.9.1
PATCH 3/3 mac80211: Use proper chan_width enum in sta opmode event
In reply to Tamizh chelvamBandwidth change value reported via nl80211 contains mac80211 specific enum value(ieee80211_sta_rx_bw) and which is not understand by userspace application. Map the mac80211 specific value to nl80211_chan_width enum value to avoid using wrong value in the userspace application. And used station's ht/vht capability to map IEEE80211_STA_RX_BW_20 and IEEE80211_STA_RX_BW_160 with proper nl80211 value.
--- net/mac80211/ieee80211_i.h | 2 ++ net/mac80211/rx.c | 3 ++- net/mac80211/vht.c | 32 +++++++++++++++++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-)
net/mac80211/ieee80211_i.h +2 -0
@@ -1816,6 +1816,8 @@ void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, struct ieee80211_sta_vht_cap *vht_cap);void ieee80211_get_vht_mask_from_cap (__le16 vht_cap,u16 vht_mask[NL80211_VHT_NSS_MAX ]); +enum nl80211_chan_width +ieee80211_sta_rx_bw_to_chan_width (struct sta_info *sta);/* Spectrum management */ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
net/mac80211/rx.c +2 -1
@@ -2922,7 +2922,8 @@ static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata, rx->sta->sta.bandwidth = new_bw; sband = rx->local->hw.wiphy->bands[status->band]; - sta_opmode.bw = new_bw; + sta_opmode.bw = +ieee80211_sta_rx_bw_to_chan_width (rx->sta); sta_opmode.changed =STA_OPMODE_MAX_BW_CHANGED ; rate_control_rate_update(local, sband, rx->sta,
net/mac80211/vht.c +31 -1
@@ -358,6 +358,36 @@ enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta)return NL80211_CHAN_WIDTH_80 ; } +enum nl80211_chan_width +ieee80211_sta_rx_bw_to_chan_width (struct sta_info *sta) +{ +enum ieee80211_sta_rx_bandwidth cur_bw = sta->sta.bandwidth; +struct ieee80211_sta_vht_cap *vht_cap = &sta->sta.vht_cap; +u32 cap_width; + +switch (cur_bw) { +case IEEE80211_STA_RX_BW_20 : +if (!sta->sta.ht_cap.ht_supported) +return NL80211_CHAN_WIDTH_20_NOHT ; +else +return NL80211_CHAN_WIDTH_20 ; +case IEEE80211_STA_RX_BW_40 : +return NL80211_CHAN_WIDTH_40 ; +case IEEE80211_STA_RX_BW_80 : +return NL80211_CHAN_WIDTH_80 ; +case IEEE80211_STA_RX_BW_160 : + cap_width = + vht_cap->cap &IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK ; + +if (cap_width ==IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ ) +return NL80211_CHAN_WIDTH_160 ; + +return NL80211_CHAN_WIDTH_80P80 ; +default : +return NL80211_CHAN_WIDTH_20 ; + } +} +enum ieee80211_sta_rx_bandwidth ieee80211_chan_width_to_rx_bw (enum nl80211_chan_width width) {
@@ -484,7 +514,7 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, new_bw =ieee80211_sta_cur_vht_bw (sta);if (new_bw != sta->sta.bandwidth) { sta->sta.bandwidth = new_bw; - sta_opmode.bw = new_bw; + sta_opmode.bw =ieee80211_sta_rx_bw_to_chan_width (sta); changed |=IEEE80211_RC_BW_CHANGED ; sta_opmode.changed |=STA_OPMODE_MAX_BW_CHANGED ; }
Signature · 1 line
1.9.1