@@ -688,7 +688,7 @@ ieee80211_mesh_build_beacon(struct ieee80211_if_mesh *ifmsh)
688688 * pos ++ = csa -> settings .count ;
689689 * pos ++ = WLAN_EID_CHAN_SWITCH_PARAM ;
690690 * pos ++ = 6 ;
691- if (ifmsh -> chsw_init ) {
691+ if (ifmsh -> csa_role == IEEE80211_MESH_CSA_ROLE_INIT ) {
692692 * pos ++ = ifmsh -> mshcfg .dot11MeshTTL ;
693693 * pos |= WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR ;
694694 } else {
@@ -859,19 +859,11 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
859859{
860860 struct cfg80211_csa_settings params ;
861861 struct ieee80211_csa_ie csa_ie ;
862- struct ieee80211_chanctx_conf * chanctx_conf ;
863- struct ieee80211_chanctx * chanctx ;
864862 struct ieee80211_if_mesh * ifmsh = & sdata -> u .mesh ;
865863 enum ieee80211_band band = ieee80211_get_sdata_band (sdata );
866- int err , num_chanctx ;
864+ int err ;
867865 u32 sta_flags ;
868866
869- if (sdata -> vif .csa_active )
870- return true;
871-
872- if (!ifmsh -> mesh_id )
873- return false;
874-
875867 sta_flags = IEEE80211_STA_DISABLE_VHT ;
876868 switch (sdata -> vif .bss_conf .chandef .width ) {
877869 case NL80211_CHAN_WIDTH_20_NOHT :
@@ -896,10 +888,6 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
896888 params .chandef = csa_ie .chandef ;
897889 params .count = csa_ie .count ;
898890
899- if (sdata -> vif .bss_conf .chandef .chan -> band !=
900- params .chandef .chan -> band )
901- return false;
902-
903891 if (!cfg80211_chandef_usable (sdata -> local -> hw .wiphy , & params .chandef ,
904892 IEEE80211_CHAN_DISABLED )) {
905893 sdata_info (sdata ,
@@ -922,24 +910,12 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
922910 return false;
923911 }
924912
925- rcu_read_lock ();
926- chanctx_conf = rcu_dereference (sdata -> vif .chanctx_conf );
927- if (!chanctx_conf )
928- goto failed_chswitch ;
929-
930- /* don't handle for multi-VIF cases */
931- chanctx = container_of (chanctx_conf , struct ieee80211_chanctx , conf );
932- if (chanctx -> refcount > 1 )
933- goto failed_chswitch ;
934-
935- num_chanctx = 0 ;
936- list_for_each_entry_rcu (chanctx , & sdata -> local -> chanctx_list , list )
937- num_chanctx ++ ;
938-
939- if (num_chanctx > 1 )
940- goto failed_chswitch ;
941-
942- rcu_read_unlock ();
913+ if (cfg80211_chandef_identical (& params .chandef ,
914+ & sdata -> vif .bss_conf .chandef )) {
915+ mcsa_dbg (sdata ,
916+ "received csa with an identical chandef, ignoring\n" );
917+ return true;
918+ }
943919
944920 mcsa_dbg (sdata ,
945921 "received channel switch announcement to go to channel %d MHz\n" ,
@@ -953,30 +929,16 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
953929 ifmsh -> pre_value = csa_ie .pre_value ;
954930 }
955931
956- if (ifmsh -> chsw_ttl < ifmsh -> mshcfg .dot11MeshTTL ) {
957- if (ieee80211_mesh_csa_beacon (sdata , & params , false) < 0 )
958- return false;
959- } else {
932+ if (ifmsh -> chsw_ttl >= ifmsh -> mshcfg .dot11MeshTTL )
960933 return false;
961- }
962-
963- sdata -> csa_radar_required = params .radar_required ;
964-
965- if (params .block_tx )
966- ieee80211_stop_queues_by_reason (& sdata -> local -> hw ,
967- IEEE80211_MAX_QUEUE_MAP ,
968- IEEE80211_QUEUE_STOP_REASON_CSA );
969934
970- sdata -> csa_chandef = params .chandef ;
971- sdata -> vif .csa_active = true;
935+ ifmsh -> csa_role = IEEE80211_MESH_CSA_ROLE_REPEATER ;
972936
973- ieee80211_bss_info_change_notify (sdata , err );
974- drv_channel_switch_beacon (sdata , & params .chandef );
937+ if (ieee80211_channel_switch (sdata -> local -> hw .wiphy , sdata -> dev ,
938+ & params ) < 0 )
939+ return false;
975940
976941 return true;
977- failed_chswitch :
978- rcu_read_unlock ();
979- return false;
980942}
981943
982944static void
@@ -1086,7 +1048,8 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
10861048 ifmsh -> sync_ops -> rx_bcn_presp (sdata ,
10871049 stype , mgmt , & elems , rx_status );
10881050
1089- if (!ifmsh -> chsw_init )
1051+ if (ifmsh -> csa_role != IEEE80211_MESH_CSA_ROLE_INIT &&
1052+ !sdata -> vif .csa_active )
10901053 ieee80211_mesh_process_chnswitch (sdata , & elems , true);
10911054}
10921055
@@ -1097,7 +1060,7 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata)
10971060 int ret = 0 ;
10981061
10991062 /* Reset the TTL value and Initiator flag */
1100- ifmsh -> chsw_init = false ;
1063+ ifmsh -> csa_role = IEEE80211_MESH_CSA_ROLE_NONE ;
11011064 ifmsh -> chsw_ttl = 0 ;
11021065
11031066 /* Remove the CSA and MCSP elements from the beacon */
@@ -1210,7 +1173,8 @@ static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,
12101173
12111174 ifmsh -> pre_value = pre_value ;
12121175
1213- if (!ieee80211_mesh_process_chnswitch (sdata , & elems , false)) {
1176+ if (!sdata -> vif .csa_active &&
1177+ !ieee80211_mesh_process_chnswitch (sdata , & elems , false)) {
12141178 mcsa_dbg (sdata , "Failed to process CSA action frame" );
12151179 return ;
12161180 }
@@ -1365,7 +1329,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
13651329 mesh_rmc_init (sdata );
13661330 ifmsh -> last_preq = jiffies ;
13671331 ifmsh -> next_perr = jiffies ;
1368- ifmsh -> chsw_init = false ;
1332+ ifmsh -> csa_role = IEEE80211_MESH_CSA_ROLE_NONE ;
13691333 /* Allocate all mesh structures when creating the first mesh interface. */
13701334 if (!mesh_allocated )
13711335 ieee80211s_init ();
0 commit comments