]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
wifi: mac80211: track changes in AP's TPE
authorJohannes Berg <johannes.berg@intel.com>
Mon, 6 May 2024 19:37:57 +0000 (21:37 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 23 May 2024 08:35:07 +0000 (10:35 +0200)
If the TPE (transmit power envelope) is changed, detect and
report that to the driver.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20240506214536.103dda923f45.I990877e409ab8eade9ed7c172272e0cae57256cf@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/mlme.c

index a4efbfb8d796f9e410e855dd7ab159a7246ca2db..a59eacfe04804a6ad1a688af4f282397b5e5e084 100644 (file)
@@ -362,6 +362,7 @@ struct ieee80211_vif_chanctx_switch {
  *     status changed.
  * @BSS_CHANGED_MLD_VALID_LINKS: MLD valid links status changed.
  * @BSS_CHANGED_MLD_TTLM: negotiated TID to link mapping was changed
+ * @BSS_CHANGED_TPE: transmit power envelope changed
  */
 enum ieee80211_bss_change {
        BSS_CHANGED_ASSOC               = 1<<0,
@@ -398,6 +399,7 @@ enum ieee80211_bss_change {
        BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = 1<<31,
        BSS_CHANGED_MLD_VALID_LINKS     = BIT_ULL(33),
        BSS_CHANGED_MLD_TTLM            = BIT_ULL(34),
+       BSS_CHANGED_TPE                 = BIT_ULL(35),
 
        /* when adding here, make sure to change ieee80211_reconfig */
 };
index ed9851faac05829f7b8757169428c2d510ffa90e..08c0999746fb5569586b6abada250ccd23f23bb0 100644 (file)
@@ -973,6 +973,7 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
        struct ieee80211_channel *channel = link->conf->chanreq.oper.chan;
        struct ieee80211_sub_if_data *sdata = link->sdata;
        struct ieee80211_chan_req chanreq = {};
+       struct cfg80211_chan_def ap_chandef;
        enum ieee80211_conn_mode ap_mode;
        u32 vht_cap_info = 0;
        u16 ht_opmode;
@@ -988,7 +989,7 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
 
        ap_mode = ieee80211_determine_ap_chan(sdata, channel, vht_cap_info,
                                              elems, true, &link->u.mgd.conn,
-                                             &chanreq.ap);
+                                             &ap_chandef);
 
        if (ap_mode != link->u.mgd.conn.mode) {
                link_info(link,
@@ -998,7 +999,8 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
                return -EINVAL;
        }
 
-       chanreq.oper = chanreq.ap;
+       chanreq.ap = ap_chandef;
+       chanreq.oper = ap_chandef;
        if (link->u.mgd.conn.mode < IEEE80211_CONN_MODE_EHT ||
            sdata->vif.driver_flags & IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW)
                chanreq.ap.chan = NULL;
@@ -1026,6 +1028,16 @@ static int ieee80211_config_bw(struct ieee80211_link_data *link,
                        ieee80211_min_bw_limit_from_chandef(&chanreq.oper))
                ieee80211_chandef_downgrade(&chanreq.oper, NULL);
 
+       if (ap_chandef.chan->band == NL80211_BAND_6GHZ &&
+           link->u.mgd.conn.mode >= IEEE80211_CONN_MODE_HE) {
+               ieee80211_rearrange_tpe(&elems->tpe, &ap_chandef,
+                                       &chanreq.oper);
+               if (memcmp(&link->conf->tpe, &elems->tpe, sizeof(elems->tpe))) {
+                       link->conf->tpe = elems->tpe;
+                       *changed |= BSS_CHANGED_TPE;
+               }
+       }
+
        if (ieee80211_chanreq_identical(&chanreq, &link->conf->chanreq))
                return 0;