From: Tamizh chelvam <[email protected]>

This will add support to send an event to a userspace application
whenever station advertise its ht/vht opmode modification through
an action frame.

Signed-off-by: Tamizh chelvam <[email protected]>
---
 net/mac80211/rx.c  | 15 +++++++++++++++
 net/mac80211/vht.c | 11 +++++++++++
 2 files changed, 26 insertions(+)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index fd58061..60ec460 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2873,6 +2873,14 @@ static void ieee80211_process_sa_query_req(struct 
ieee80211_sub_if_data *sdata,
 
                        rate_control_rate_update(local, sband, rx->sta,
                                                 IEEE80211_RC_SMPS_CHANGED);
+                       cfg80211_sta_opmode_change_notify(
+                                               sdata->dev,
+                                               rx->sta->addr,
+                                               SMPS_MODE_CHANGED,
+                                               smps_mode,
+                                               rx->sta->sta.bandwidth,
+                                               rx->sta->sta.rx_nss,
+                                               GFP_KERNEL);
                        goto handled;
                }
                case WLAN_HT_ACTION_NOTIFY_CHANWIDTH: {
@@ -2902,6 +2910,13 @@ static void ieee80211_process_sa_query_req(struct 
ieee80211_sub_if_data *sdata,
 
                        rate_control_rate_update(local, sband, rx->sta,
                                                 IEEE80211_RC_BW_CHANGED);
+                       cfg80211_sta_opmode_change_notify(
+                                               sdata->dev,
+                                               rx->sta->addr,
+                                               MAX_BW_CHANGED,
+                                               rx->sta->sta.smps_mode,
+                                               new_bw, rx->sta->sta.rx_nss,
+                                               GFP_KERNEL);
                        goto handled;
                }
                default:
diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index b9276ac..f1d7dce 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -447,6 +447,7 @@ u32 __ieee80211_vht_handle_opmode(struct 
ieee80211_sub_if_data *sdata,
                                  enum nl80211_band band)
 {
        enum ieee80211_sta_rx_bandwidth new_bw;
+       u8 opmode_changed = 0;
        u32 changed = 0;
        u8 nss;
 
@@ -461,6 +462,7 @@ u32 __ieee80211_vht_handle_opmode(struct 
ieee80211_sub_if_data *sdata,
        if (sta->sta.rx_nss != nss) {
                sta->sta.rx_nss = nss;
                changed |= IEEE80211_RC_NSS_CHANGED;
+               opmode_changed |= N_SS_CHANGED;
        }
 
        switch (opmode & IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK) {
@@ -482,8 +484,17 @@ u32 __ieee80211_vht_handle_opmode(struct 
ieee80211_sub_if_data *sdata,
        if (new_bw != sta->sta.bandwidth) {
                sta->sta.bandwidth = new_bw;
                changed |= IEEE80211_RC_BW_CHANGED;
+               opmode_changed |= MAX_BW_CHANGED;
        }
 
+       if (opmode_changed)
+               cfg80211_sta_opmode_change_notify(sdata->dev, sta->addr,
+                                                 opmode_changed,
+                                                 sta->sta.smps_mode,
+                                                 sta->sta.bandwidth,
+                                                 sta->sta.rx_nss,
+                                                 GFP_KERNEL);
+
        return changed;
 }
 
-- 
1.9.1

Reply via email to