wifi: mac80211: take EML/MLD capa from assoc response
authorJohannes Berg <johannes.berg@intel.com>
Tue, 2 Jan 2024 19:35:43 +0000 (21:35 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 26 Jan 2024 08:39:49 +0000 (09:39 +0100)
The association response is more likely to be correct
than a random scan result, which really also should be
correct, but we generally prefer to take data from the
association response, so do that here as well.

Also reset the data so it doesn't hang around from an
old connection to a non-MLO connection, drivers would
hopefully not look at it, but less surprise this way.

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/20240102213313.1d10f1d1dbab.I545e955675e2269a52496a22ae7822d95b40235e@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c

index fba596d..576ba6b 100644 (file)
@@ -3086,9 +3086,14 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        memset(sdata->vif.bss_conf.tx_pwr_env, 0,
               sizeof(sdata->vif.bss_conf.tx_pwr_env));
 
+       sdata->vif.cfg.eml_cap = 0;
+       sdata->vif.cfg.eml_med_sync_delay = 0;
+       sdata->vif.cfg.mld_capa_op = 0;
+
        memset(&sdata->u.mgd.ttlm_info, 0,
               sizeof(sdata->u.mgd.ttlm_info));
        wiphy_delayed_work_cancel(sdata->local->hw.wiphy, &ifmgd->ttlm_work);
+
        wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
                                  &ifmgd->neg_ttlm_timeout_work);
        ieee80211_vif_set_links(sdata, 0, 0);
@@ -4981,16 +4986,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
                    eht_ml_elem &&
                    ieee80211_mle_type_ok(eht_ml_elem->data + 1,
                                          IEEE80211_ML_CONTROL_TYPE_BASIC,
-                                         eht_ml_elem->datalen - 1)) {
+                                         eht_ml_elem->datalen - 1))
                        supports_mlo = true;
-
-                       sdata->vif.cfg.eml_cap =
-                               ieee80211_mle_get_eml_cap(eht_ml_elem->data + 1);
-                       sdata->vif.cfg.eml_med_sync_delay =
-                               ieee80211_mle_get_eml_med_sync_delay(eht_ml_elem->data + 1);
-                       sdata->vif.cfg.mld_capa_op =
-                               ieee80211_mle_get_mld_capa_op(eht_ml_elem->data + 1);
-               }
        }
 
        /* Allow VHT if at least one channel on the sband supports 80 MHz */
@@ -5432,6 +5429,13 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
                                           assoc_data->ap_addr);
                                goto abandon_assoc;
                        }
+
+                       sdata->vif.cfg.eml_cap =
+                               ieee80211_mle_get_eml_cap((const void *)elems->ml_basic);
+                       sdata->vif.cfg.eml_med_sync_delay =
+                               ieee80211_mle_get_eml_med_sync_delay((const void *)elems->ml_basic);
+                       sdata->vif.cfg.mld_capa_op =
+                               ieee80211_mle_get_mld_capa_op((const void *)elems->ml_basic);
                }
 
                sdata->vif.cfg.aid = aid;