wifi: mac80211: add a flag to disallow puncturing
authorJohannes Berg <johannes.berg@intel.com>
Mon, 11 Dec 2023 07:05:23 +0000 (09:05 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 12 Dec 2023 09:37:00 +0000 (10:37 +0100)
There may be cases where puncturing isn't possible, and
a connection needs to be downgraded. Add a hardware flag
to support this.

This is likely temporary: it seems we will need to move
puncturing to the chandef/channel context.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://msgid.link/20231211085121.c1e89ea55e93.I37b8ca0ee64d5d7699e351785a9010afc106da3c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/debugfs.c
net/mac80211/mlme.c

index aa8e1055fc3a848f637d0c0efd511bbf43caacda..77a71b1396b1952b16526ae5626611718db7e94a 100644 (file)
@@ -2686,6 +2686,9 @@ struct ieee80211_txq {
  * @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting
  *     multicast frames on all links, mac80211 should not do that.
  *
+ * @IEEE80211_HW_DISALLOW_PUNCTURING: HW requires disabling puncturing in EHT
+ *     and connecting with a lower bandwidth instead
+ *
  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
  */
 enum ieee80211_hw_flags {
@@ -2743,6 +2746,7 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP,
        IEEE80211_HW_DETECTS_COLOR_COLLISION,
        IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX,
+       IEEE80211_HW_DISALLOW_PUNCTURING,
 
        /* keep last, obviously */
        NUM_IEEE80211_HW_FLAGS
index b575ae90e57f86d514a0eddd9c2a482f3c6a80fb..74be49191e70439e7b2bfa4ef8ba97d6fa00c6d8 100644 (file)
@@ -497,6 +497,7 @@ static const char *hw_flag_names[] = {
        FLAG(SUPPORTS_CONC_MON_RX_DECAP),
        FLAG(DETECTS_COLOR_COLLISION),
        FLAG(MLO_MCAST_MULTI_LINK_TX),
+       FLAG(DISALLOW_PUNCTURING),
 #undef FLAG
 };
 
index 887b496f2b81ed6bffa96d62adae8c1b4119935f..2b1b64eb82f71040933162b67561c63b5f84ffd5 100644 (file)
@@ -135,6 +135,7 @@ ieee80211_handle_puncturing_bitmap(struct ieee80211_link_data *link,
                                   u16 bitmap, u64 *changed)
 {
        struct cfg80211_chan_def *chandef = &link->conf->chandef;
+       struct ieee80211_local *local = link->sdata->local;
        u16 extracted;
        u64 _changed = 0;
 
@@ -147,7 +148,9 @@ ieee80211_handle_puncturing_bitmap(struct ieee80211_link_data *link,
                                                         bitmap);
 
                if (cfg80211_valid_disable_subchannel_bitmap(&bitmap,
-                                                            chandef))
+                                                            chandef) &&
+                   !(bitmap && ieee80211_hw_check(&local->hw,
+                                                  DISALLOW_PUNCTURING)))
                        break;
                link->u.mgd.conn_flags |=
                        ieee80211_chandef_downgrade(chandef);
@@ -5682,6 +5685,7 @@ static bool ieee80211_config_puncturing(struct ieee80211_link_data *link,
                                        const struct ieee80211_eht_operation *eht_oper,
                                        u64 *changed)
 {
+       struct ieee80211_local *local = link->sdata->local;
        u16 bitmap = 0, extracted;
 
        if ((eht_oper->params & IEEE80211_EHT_OPER_INFO_PRESENT) &&
@@ -5713,6 +5717,9 @@ static bool ieee80211_config_puncturing(struct ieee80211_link_data *link,
                return false;
        }
 
+       if (bitmap && ieee80211_hw_check(&local->hw, DISALLOW_PUNCTURING))
+               return false;
+
        ieee80211_handle_puncturing_bitmap(link, eht_oper, bitmap, changed);
        return true;
 }
@@ -7584,7 +7591,8 @@ ieee80211_setup_assoc_link(struct ieee80211_sub_if_data *sdata,
 
                        bitmap = get_unaligned_le16(disable_subchannel_bitmap);
                        if (cfg80211_valid_disable_subchannel_bitmap(&bitmap,
-                                                                    &link->conf->chandef))
+                                                                    &link->conf->chandef) &&
+                           !(bitmap && ieee80211_hw_check(&local->hw, DISALLOW_PUNCTURING)))
                                ieee80211_handle_puncturing_bitmap(link,
                                                                   eht_oper,
                                                                   bitmap,