mac80211: Use proper smps_mode enum in sta opmode event
authortamizhr@codeaurora.org <tamizhr@codeaurora.org>
Tue, 27 Mar 2018 13:46:16 +0000 (19:16 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 29 Mar 2018 08:19:55 +0000 (10:19 +0200)
SMPS_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.

Signed-off-by: Tamizh chelvam <tamizhr@codeaurora.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/ht.c
net/mac80211/ieee80211_i.h
net/mac80211/rx.c

index d7523530d3f80cb1b64a7f7a3b530460ef71fc5e..c78036a0ac94905d50d60abc786206c874630004 100644 (file)
@@ -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)
index ae9c33cd8adaab4a235e3710026faf437a92fc0a..9237ffb4e986029593dd5ba9dcd8b96636dbbdbc 100644 (file)
@@ -1788,6 +1788,8 @@ void ieee80211_tx_ba_session_handle_start(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
index 27bb1f0b5e52ec8880cb3397ac857e2f08432e4f..f8c69acfda487825ae965e85ee1196113430b793 100644 (file)
@@ -2883,7 +2883,8 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
                        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];