]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: cfg80211: provide HT/VHT operation for AP beacon
authorJohannes Berg <johannes.berg@intel.com>
Wed, 15 Apr 2026 12:42:15 +0000 (14:42 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 28 Apr 2026 07:29:02 +0000 (09:29 +0200)
In addition to providing HE/EHT/UHR operation, also check
and provide HT/VHT operation, so that drivers have it and
can use it, e.g. to correctly calculate station bandwidth.

Reviewed-by: Miriam Rachel Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20260415144514.32ad98454543.Ia9692671b699164edcc0bdaf4fdbdbefc50b18f8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/cfg80211.h
net/wireless/nl80211.c

index 7070e577342b28c98de0bb56681c386069fd78ab..a40ab36b8edb06b5de80e2710b28beec0eef6574 100644 (file)
@@ -1398,6 +1398,8 @@ struct cfg80211_rnr_elems {
  *     attribute is present in beacon data or not.
  * @ht_required: stations must support HT
  * @vht_required: stations must support VHT
+ * @ht_oper: HT operation element (or %NULL if HT isn't enabled)
+ * @vht_oper: VHT operation element (or %NULL if VHT isn't enabled)
  * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
  * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)
  * @uhr_oper: UHR operation (or %NULL if UHR isn't enabled)
@@ -1427,6 +1429,8 @@ struct cfg80211_beacon_data {
        bool he_bss_color_valid;
 
        bool ht_required, vht_required;
+       const struct ieee80211_ht_operation *ht_oper;
+       const struct ieee80211_vht_operation *vht_oper;
        const struct ieee80211_he_operation *he_oper;
        const struct ieee80211_eht_operation *eht_oper;
        const struct ieee80211_uhr_operation *uhr_oper;
index a4dbe6ff0045e6bb421699e267da26b60bee7d6d..056c779fdb5638e4b7a15b4abda6fdfdb90fc588 100644 (file)
@@ -6730,6 +6730,24 @@ static int nl80211_calculate_ap_operation(struct genl_info *info,
                }
        }
 
+       op = cfg80211_find_elem(WLAN_EID_HT_OPERATION, ies, ies_len);
+       if (op) {
+               if (op->datalen < sizeof(*bcn->ht_oper)) {
+                       GENL_SET_ERR_MSG(info, "bad HT operation in beacon");
+                       return -EINVAL;
+               }
+               bcn->ht_oper = (void *)op->data;
+       }
+
+       op = cfg80211_find_elem(WLAN_EID_VHT_OPERATION, ies, ies_len);
+       if (op) {
+               if (op->datalen < sizeof(*bcn->vht_oper)) {
+                       GENL_SET_ERR_MSG(info, "bad VHT operation in beacon");
+                       return -EINVAL;
+               }
+               bcn->vht_oper = (void *)op->data;
+       }
+
        op = cfg80211_find_ext_elem(WLAN_EID_EXT_EHT_OPERATION, ies, ies_len);
        if (op) {
                if (!ieee80211_eht_oper_size_ok(op->data + 1,