ieee80211_configure_filter(local);
 }
 
+static void ieee80211_mesh_csa_mark_radar(struct ieee80211_sub_if_data *sdata)
+{
+       int err;
+
+       /* if the current channel is a DFS channel, mark the channel as
+        * unavailable.
+        */
+       err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
+                                           &sdata->vif.bss_conf.chandef,
+                                           NL80211_IFTYPE_MESH_POINT);
+       if (err > 0)
+               cfg80211_radar_event(sdata->local->hw.wiphy,
+                                    &sdata->vif.bss_conf.chandef, GFP_ATOMIC);
+}
+
 static bool
 ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
                                 struct ieee802_11_elems *elems, bool beacon)
        if (err)
                return false;
 
+       /* Mark the channel unavailable if the reason for the switch is
+        * regulatory.
+        */
+       if (csa_ie.reason_code == WLAN_REASON_MESH_CHAN_REGULATORY)
+               ieee80211_mesh_csa_mark_radar(sdata);
+
        params.chandef = csa_ie.chandef;
        params.count = csa_ie.count;
 
 
                csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags;
                csa_ie->pre_value = le16_to_cpu(
                                elems->mesh_chansw_params_ie->mesh_pre_value);
+
+               if (elems->mesh_chansw_params_ie->mesh_flags &
+                               WLAN_EID_CHAN_SWITCH_PARAM_REASON)
+                       csa_ie->reason_code = le16_to_cpu(
+                               elems->mesh_chansw_params_ie->mesh_reason);
        }
 
        new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);