Skip to content

Commit ff84e7b

Browse files
tamizhr@codeaurora.orgjmberg-intel
authored andcommitted
mac80211: Add support to notify ht/vht opmode modification.
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]> Signed-off-by: Johannes Berg <[email protected]>
1 parent 466b993 commit ff84e7b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

net/mac80211/rx.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2848,6 +2848,7 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
28482848
case WLAN_HT_ACTION_SMPS: {
28492849
struct ieee80211_supported_band *sband;
28502850
enum ieee80211_smps_mode smps_mode;
2851+
struct sta_opmode_info sta_opmode = {};
28512852

28522853
/* convert to HT capability */
28532854
switch (mgmt->u.action.u.ht_smps.smps_control) {
@@ -2868,17 +2869,24 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
28682869
if (rx->sta->sta.smps_mode == smps_mode)
28692870
goto handled;
28702871
rx->sta->sta.smps_mode = smps_mode;
2872+
sta_opmode.smps_mode = smps_mode;
2873+
sta_opmode.changed = STA_OPMODE_SMPS_MODE_CHANGED;
28712874

28722875
sband = rx->local->hw.wiphy->bands[status->band];
28732876

28742877
rate_control_rate_update(local, sband, rx->sta,
28752878
IEEE80211_RC_SMPS_CHANGED);
2879+
cfg80211_sta_opmode_change_notify(sdata->dev,
2880+
rx->sta->addr,
2881+
&sta_opmode,
2882+
GFP_KERNEL);
28762883
goto handled;
28772884
}
28782885
case WLAN_HT_ACTION_NOTIFY_CHANWIDTH: {
28792886
struct ieee80211_supported_band *sband;
28802887
u8 chanwidth = mgmt->u.action.u.ht_notify_cw.chanwidth;
28812888
enum ieee80211_sta_rx_bandwidth max_bw, new_bw;
2889+
struct sta_opmode_info sta_opmode = {};
28822890

28832891
/* If it doesn't support 40 MHz it can't change ... */
28842892
if (!(rx->sta->sta.ht_cap.cap &
@@ -2899,9 +2907,15 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
28992907

29002908
rx->sta->sta.bandwidth = new_bw;
29012909
sband = rx->local->hw.wiphy->bands[status->band];
2910+
sta_opmode.bw = new_bw;
2911+
sta_opmode.changed = STA_OPMODE_MAX_BW_CHANGED;
29022912

29032913
rate_control_rate_update(local, sband, rx->sta,
29042914
IEEE80211_RC_BW_CHANGED);
2915+
cfg80211_sta_opmode_change_notify(sdata->dev,
2916+
rx->sta->addr,
2917+
&sta_opmode,
2918+
GFP_KERNEL);
29052919
goto handled;
29062920
}
29072921
default:

net/mac80211/vht.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
447447
enum nl80211_band band)
448448
{
449449
enum ieee80211_sta_rx_bandwidth new_bw;
450+
struct sta_opmode_info sta_opmode = {};
450451
u32 changed = 0;
451452
u8 nss;
452453

@@ -460,7 +461,9 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
460461

461462
if (sta->sta.rx_nss != nss) {
462463
sta->sta.rx_nss = nss;
464+
sta_opmode.rx_nss = nss;
463465
changed |= IEEE80211_RC_NSS_CHANGED;
466+
sta_opmode.changed |= STA_OPMODE_N_SS_CHANGED;
464467
}
465468

466469
switch (opmode & IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK) {
@@ -481,9 +484,15 @@ u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
481484
new_bw = ieee80211_sta_cur_vht_bw(sta);
482485
if (new_bw != sta->sta.bandwidth) {
483486
sta->sta.bandwidth = new_bw;
487+
sta_opmode.bw = new_bw;
484488
changed |= IEEE80211_RC_BW_CHANGED;
489+
sta_opmode.changed |= STA_OPMODE_MAX_BW_CHANGED;
485490
}
486491

492+
if (sta_opmode.changed)
493+
cfg80211_sta_opmode_change_notify(sdata->dev, sta->addr,
494+
&sta_opmode, GFP_KERNEL);
495+
487496
return changed;
488497
}
489498

0 commit comments

Comments
 (0)