mac80211: add more HT/VHT/HE state logging
authorJohannes Berg <johannes.berg@intel.com>
Tue, 30 Nov 2021 11:16:59 +0000 (13:16 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 20 Dec 2021 09:39:36 +0000 (10:39 +0100)
Add more logging in places that affect HT/VHT/HE state, so
things get easier to debug.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20211130131608.ac51d574458c.If197b45c5b31d2fbd254fa12c2d7c736f304d4ae@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c

index 4dbed5061ade15adf5bb8696ce93446e03f41d09..0a854ca6aa588363545aff107543826fbfceb057 100644 (file)
@@ -164,12 +164,15 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
        chandef->freq1_offset = channel->freq_offset;
 
        if (channel->band == NL80211_BAND_6GHZ) {
-               if (!ieee80211_chandef_he_6ghz_oper(sdata, he_oper, chandef))
+               if (!ieee80211_chandef_he_6ghz_oper(sdata, he_oper, chandef)) {
+                       mlme_dbg(sdata,
+                                "bad 6 GHz operation, disabling HT/VHT/HE\n");
                        ret = IEEE80211_STA_DISABLE_HT |
                              IEEE80211_STA_DISABLE_VHT |
                              IEEE80211_STA_DISABLE_HE;
-               else
+               } else {
                        ret = 0;
+               }
                vht_chandef = *chandef;
                goto out;
        } else if (sband->band == NL80211_BAND_S1GHZ) {
@@ -190,6 +193,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
        ieee80211_apply_htcap_overrides(sdata, &sta_ht_cap);
 
        if (!ht_oper || !sta_ht_cap.ht_supported) {
+               mlme_dbg(sdata, "HT operation missing / HT not supported\n");
                ret = IEEE80211_STA_DISABLE_HT |
                      IEEE80211_STA_DISABLE_VHT |
                      IEEE80211_STA_DISABLE_HE;
@@ -223,6 +227,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
        if (sta_ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
                ieee80211_chandef_ht_oper(ht_oper, chandef);
        } else {
+               mlme_dbg(sdata, "40 MHz not supported\n");
                /* 40 MHz (and 80 MHz) must be supported for VHT */
                ret = IEEE80211_STA_DISABLE_VHT;
                /* also mark 40 MHz disabled */
@@ -231,6 +236,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
        }
 
        if (!vht_oper || !sband->vht_cap.vht_supported) {
+               mlme_dbg(sdata, "VHT operation missing / VHT not supported\n");
                ret = IEEE80211_STA_DISABLE_VHT;
                goto out;
        }
@@ -253,7 +259,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
                                                &vht_chandef)) {
                        if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HE))
                                sdata_info(sdata,
-                                          "HE AP VHT information is invalid, disable HE\n");
+                                          "HE AP VHT information is invalid, disabling HE\n");
                        ret = IEEE80211_STA_DISABLE_HE;
                        goto out;
                }
@@ -263,7 +269,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
                                               &vht_chandef)) {
                if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
                        sdata_info(sdata,
-                                  "AP VHT information is invalid, disable VHT\n");
+                                  "AP VHT information is invalid, disabling VHT\n");
                ret = IEEE80211_STA_DISABLE_VHT;
                goto out;
        }
@@ -271,7 +277,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
        if (!cfg80211_chandef_valid(&vht_chandef)) {
                if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
                        sdata_info(sdata,
-                                  "AP VHT information is invalid, disable VHT\n");
+                                  "AP VHT information is invalid, disabling VHT\n");
                ret = IEEE80211_STA_DISABLE_VHT;
                goto out;
        }
@@ -284,7 +290,7 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
        if (!cfg80211_chandef_compatible(chandef, &vht_chandef)) {
                if (!(ifmgd->flags & IEEE80211_STA_DISABLE_VHT))
                        sdata_info(sdata,
-                                  "AP VHT information doesn't match HT, disable VHT\n");
+                                  "AP VHT information doesn't match HT, disabling VHT\n");
                ret = IEEE80211_STA_DISABLE_VHT;
                goto out;
        }
@@ -5036,19 +5042,23 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
 
        /* disable HT/VHT/HE if we don't support them */
        if (!sband->ht_cap.ht_supported && !is_6ghz) {
+               mlme_dbg(sdata, "HT not supported, disabling HT/VHT/HE\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_HT;
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
        }
 
        if (!sband->vht_cap.vht_supported && is_5ghz) {
+               mlme_dbg(sdata, "VHT not supported, disabling VHT/HE\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
        }
 
        if (!ieee80211_get_he_iftype_cap(sband,
-                                        ieee80211_vif_type_p2p(&sdata->vif)))
+                                        ieee80211_vif_type_p2p(&sdata->vif))) {
+               mlme_dbg(sdata, "HE not supported, disabling it\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
+       }
 
        if (!(ifmgd->flags & IEEE80211_STA_DISABLE_HT) && !is_6ghz) {
                ht_oper = elems->ht_operation;
@@ -5072,6 +5082,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
                }
 
                if (!elems->vht_cap_elem) {
+                       sdata_info(sdata,
+                                  "bad VHT capabilities, disabling VHT\n");
                        ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
                        vht_oper = NULL;
                }
@@ -5119,8 +5131,10 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
                break;
        }
 
-       if (!have_80mhz)
+       if (!have_80mhz) {
+               sdata_info(sdata, "80 MHz not supported, disabling VHT\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
+       }
 
        if (sband->band == NL80211_BAND_S1GHZ) {
                s1g_oper = elems->s1g_oper;
@@ -5684,12 +5698,14 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
        else if (!is_6ghz)
                ifmgd->flags |= IEEE80211_STA_DISABLE_HT;
        vht_elem = ieee80211_bss_get_elem(req->bss, WLAN_EID_VHT_CAPABILITY);
-       if (vht_elem && vht_elem->datalen >= sizeof(struct ieee80211_vht_cap))
+       if (vht_elem && vht_elem->datalen >= sizeof(struct ieee80211_vht_cap)) {
                memcpy(&assoc_data->ap_vht_cap, vht_elem->data,
                       sizeof(struct ieee80211_vht_cap));
-       else if (is_5ghz)
+       } else if (is_5ghz) {
+               sdata_info(sdata, "VHT capa missing/short, disabling VHT/HE\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT |
                                IEEE80211_STA_DISABLE_HE;
+       }
        rcu_read_unlock();
 
        if (WARN((sdata->vif.driver_flags & IEEE80211_VIF_SUPPORTS_UAPSD) &&
@@ -5763,16 +5779,21 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
        }
 
        if (req->flags & ASSOC_REQ_DISABLE_HT) {
+               mlme_dbg(sdata, "HT disabled by flag, disabling HT/VHT/HE\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_HT;
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
        }
 
-       if (req->flags & ASSOC_REQ_DISABLE_VHT)
+       if (req->flags & ASSOC_REQ_DISABLE_VHT) {
+               mlme_dbg(sdata, "VHT disabled by flag, disabling VHT\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
+       }
 
-       if (req->flags & ASSOC_REQ_DISABLE_HE)
+       if (req->flags & ASSOC_REQ_DISABLE_HE) {
+               mlme_dbg(sdata, "HE disabled by flag, disabling VHT\n");
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
+       }
 
        err = ieee80211_prep_connection(sdata, req->bss, true, override);
        if (err)