On Sat, 2021-03-06 at 08:20 -0800, greearb@xxxxxxxxxxxxxxx wrote: > > + /* Apply overrides as needed. */ > + if (ifmgd->flags & IEEE80211_STA_DISABLE_TWT) { > + if (ext_capa) { > + if (ext_capa && ext_capa->datalen > 10) { > + ext_capa->data[9] &= ~(WLAN_EXT_CAPA10_TWT_RESPONDER_SUPPORT); So apart from the useless code (checking "ext_capa" twice, unnecessary nested ifs, unnecessary parentheses), this can already be done entirely by userspace, since it controls the ext capa we send. > > -static bool ieee80211_twt_req_supported(const struct sta_info *sta, > +static bool ieee80211_twt_req_supported(struct ieee80211_sub_if_data *sdata, > + const struct sta_info *sta, > const struct ieee802_11_elems *elems) > This code here seems possibly wrong anyway since it doesn't take local capabilities into account, maybe it should, and then these changes wouldn't be necessary? > + /* Apply overrides as needed. */ > + if (ifmgd->flags & IEEE80211_STA_DISABLE_TWT) { > + struct ieee80211_he_cap_elem *hec; > + hec = (struct ieee80211_he_cap_elem *)(pos); > + hec->mac_cap_info[0] &= ~(IEEE80211_HE_MAC_CAP0_TWT_REQ); > + hec->mac_cap_info[0] &= ~(IEEE80211_HE_MAC_CAP0_TWT_RES); > + } Wait, we actually have TWT capability *twice*, once in HE and once in extended capabilities?! Fun. But for this shouldn't we have the more general "HE capability override" stuff that we have also for HT and VHT?