]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - net/mac80211/mesh.c
Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel...
[karo-tx-linux.git] / net / mac80211 / mesh.c
index 6e7b6a07b7d536a64f7e9ec296adf2bbba8d961c..737e1f082b0ddd55e03b30bf215a5fbb68943143 100644 (file)
@@ -63,6 +63,7 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
        u32 basic_rates = 0;
        struct cfg80211_chan_def sta_chan_def;
+       struct ieee80211_supported_band *sband;
 
        /*
         * As support for each feature is added, check for matching
@@ -83,7 +84,11 @@ bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
             (ifmsh->mesh_auth_id == ie->mesh_config->meshconf_auth)))
                return false;
 
-       ieee80211_sta_get_rates(sdata, ie, ieee80211_get_sdata_band(sdata),
+       sband = ieee80211_get_sband(sdata);
+       if (!sband)
+               return false;
+
+       ieee80211_sta_get_rates(sdata, ie, sband->band,
                                &basic_rates);
 
        if (sdata->vif.bss_conf.basic_rates != basic_rates)
@@ -399,12 +404,13 @@ static int mesh_add_ds_params_ie(struct ieee80211_sub_if_data *sdata,
 int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata,
                       struct sk_buff *skb)
 {
-       struct ieee80211_local *local = sdata->local;
-       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_supported_band *sband;
        u8 *pos;
 
-       sband = local->hw.wiphy->bands[band];
+       sband = ieee80211_get_sband(sdata);
+       if (!sband)
+               return -EINVAL;
+
        if (!sband->ht_cap.ht_supported ||
            sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
            sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
@@ -462,12 +468,13 @@ int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,
 int mesh_add_vht_cap_ie(struct ieee80211_sub_if_data *sdata,
                        struct sk_buff *skb)
 {
-       struct ieee80211_local *local = sdata->local;
-       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
        struct ieee80211_supported_band *sband;
        u8 *pos;
 
-       sband = local->hw.wiphy->bands[band];
+       sband = ieee80211_get_sband(sdata);
+       if (!sband)
+               return -EINVAL;
+
        if (!sband->vht_cap.vht_supported ||
            sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
            sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
@@ -916,12 +923,16 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
        struct cfg80211_csa_settings params;
        struct ieee80211_csa_ie csa_ie;
        struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
-       enum nl80211_band band = ieee80211_get_sdata_band(sdata);
+       struct ieee80211_supported_band *sband;
        int err;
        u32 sta_flags;
 
        sdata_assert_lock(sdata);
 
+       sband = ieee80211_get_sband(sdata);
+       if (!sband)
+               return false;
+
        sta_flags = IEEE80211_STA_DISABLE_VHT;
        switch (sdata->vif.bss_conf.chandef.width) {
        case NL80211_CHAN_WIDTH_20_NOHT:
@@ -935,7 +946,7 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
 
        memset(&params, 0, sizeof(params));
        memset(&csa_ie, 0, sizeof(csa_ie));
-       err = ieee80211_parse_ch_switch_ie(sdata, elems, band,
+       err = ieee80211_parse_ch_switch_ie(sdata, elems, sband->band,
                                           sta_flags, sdata->vif.addr,
                                           &csa_ie);
        if (err < 0)
@@ -1100,8 +1111,14 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
        if (!channel || channel->flags & IEEE80211_CHAN_DISABLED)
                return;
 
-       if (mesh_matches_local(sdata, &elems))
-               mesh_neighbour_update(sdata, mgmt->sa, &elems);
+       if (mesh_matches_local(sdata, &elems)) {
+               mpl_dbg(sdata, "rssi_threshold=%d,rx_status->signal=%d\n",
+                       sdata->u.mesh.mshcfg.rssi_threshold, rx_status->signal);
+               if (!sdata->u.mesh.user_mpm ||
+                   sdata->u.mesh.mshcfg.rssi_threshold == 0 ||
+                   sdata->u.mesh.mshcfg.rssi_threshold < rx_status->signal)
+                       mesh_neighbour_update(sdata, mgmt->sa, &elems);
+       }
 
        if (ifmsh->sync_ops)
                ifmsh->sync_ops->rx_bcn_presp(sdata,