f811c5d617b62b45fc87e5b91af28e4bbeb159da
[librecmc/librecmc.git] /
1 From 61403414e1719f929386dda8fb954bb302628ef3 Mon Sep 17 00:00:00 2001
2 From: Johannes Berg <johannes.berg@intel.com>
3 Date: Thu, 4 May 2023 16:45:11 +0300
4 Subject: [PATCH] wifi: mac80211: implement proper AP MLD HW restart
5
6 Previously, I didn't implement restarting here at all if the
7 interface is an MLD, so it only worked for non-MLO. Add the
8 needed code to restart an AP MLD correctly.
9
10 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11 Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
12 Link: https://lore.kernel.org/r/20230504134511.828474-12-gregory.greenman@intel.com
13 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
14 ---
15  net/mac80211/util.c | 44 +++++++++++++++++++++++++++++++++++++++++++-
16  1 file changed, 43 insertions(+), 1 deletion(-)
17
18 --- a/net/mac80211/util.c
19 +++ b/net/mac80211/util.c
20 @@ -2344,6 +2344,35 @@ static int ieee80211_reconfig_nan(struct
21         return 0;
22  }
23  
24 +static void ieee80211_reconfig_ap_links(struct ieee80211_local *local,
25 +                                       struct ieee80211_sub_if_data *sdata,
26 +                                       u32 changed)
27 +{
28 +       int link_id;
29 +
30 +       for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) {
31 +               struct ieee80211_link_data *link;
32 +
33 +               if (!(sdata->vif.active_links & BIT(link_id)))
34 +                       continue;
35 +
36 +               link = sdata_dereference(sdata->link[link_id], sdata);
37 +               if (!link)
38 +                       continue;
39 +
40 +               if (rcu_access_pointer(link->u.ap.beacon))
41 +                       drv_start_ap(local, sdata, link->conf);
42 +
43 +               if (!link->conf->enable_beacon)
44 +                       continue;
45 +
46 +               changed |= BSS_CHANGED_BEACON |
47 +                          BSS_CHANGED_BEACON_ENABLED;
48 +
49 +               ieee80211_link_info_change_notify(sdata, link, changed);
50 +       }
51 +}
52 +
53  int ieee80211_reconfig(struct ieee80211_local *local)
54  {
55         struct ieee80211_hw *hw = &local->hw;
56 @@ -2606,7 +2635,13 @@ int ieee80211_reconfig(struct ieee80211_
57                         changed |= BSS_CHANGED_IBSS;
58                         fallthrough;
59                 case NL80211_IFTYPE_AP:
60 -                       changed |= BSS_CHANGED_SSID | BSS_CHANGED_P2P_PS;
61 +                       changed |= BSS_CHANGED_P2P_PS;
62 +
63 +                       if (sdata->vif.valid_links)
64 +                               ieee80211_vif_cfg_change_notify(sdata,
65 +                                                               BSS_CHANGED_SSID);
66 +                       else
67 +                               changed |= BSS_CHANGED_SSID;
68  
69                         if (sdata->vif.bss_conf.ftm_responder == 1 &&
70                             wiphy_ext_feature_isset(sdata->local->hw.wiphy,
71 @@ -2616,6 +2651,13 @@ int ieee80211_reconfig(struct ieee80211_
72                         if (sdata->vif.type == NL80211_IFTYPE_AP) {
73                                 changed |= BSS_CHANGED_AP_PROBE_RESP;
74  
75 +                               if (sdata->vif.valid_links) {
76 +                                       ieee80211_reconfig_ap_links(local,
77 +                                                                   sdata,
78 +                                                                   changed);
79 +                                       break;
80 +                               }
81 +
82                                 if (rcu_access_pointer(sdata->deflink.u.ap.beacon))
83                                         drv_start_ap(local, sdata,
84                                                      sdata->deflink.conf);