Lines Matching defs:sdata
40 struct ieee80211_sub_if_data *sdata =
41 from_timer(sdata, t, u.mesh.housekeeping_timer);
42 struct ieee80211_local *local = sdata->local;
43 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
47 ieee80211_queue_work(&local->hw, &sdata->work);
53 * @sdata: local mesh subif
59 bool mesh_matches_local(struct ieee80211_sub_if_data *sdata,
62 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
87 sband = ieee80211_get_sband(sdata);
91 ieee80211_sta_get_rates(sdata, ie, sband->band,
94 if (sdata->vif.bss_conf.basic_rates != basic_rates)
97 cfg80211_chandef_create(&sta_chan_def, sdata->vif.bss_conf.chandef.chan,
104 ieee80211_chandef_vht_oper(&sdata->local->hw, vht_cap_info,
107 ieee80211_chandef_he_6ghz_oper(sdata, ie->he_operation, &sta_chan_def);
109 if (!cfg80211_chandef_compatible(&sdata->vif.bss_conf.chandef,
130 * @sdata: mesh interface in which mesh beacons are going to be updated
134 u32 mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
145 free_plinks = mesh_plink_availables(sdata);
147 if (free_plinks != sdata->u.mesh.accepting_plinks) {
148 sdata->u.mesh.accepting_plinks = free_plinks;
162 struct ieee80211_sub_if_data *sdata = sta->sdata;
166 ieee80211_mbss_info_change_notify(sdata, changed);
169 int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
173 sdata->u.mesh.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL);
174 if (!sdata->u.mesh.rmc)
176 sdata->u.mesh.rmc->idx_mask = RMC_BUCKETS - 1;
178 INIT_HLIST_HEAD(&sdata->u.mesh.rmc->bucket[i]);
182 void mesh_rmc_free(struct ieee80211_sub_if_data *sdata)
184 struct mesh_rmc *rmc = sdata->u.mesh.rmc;
189 if (!sdata->u.mesh.rmc)
200 sdata->u.mesh.rmc = NULL;
206 * @sdata: interface
216 int mesh_rmc_check(struct ieee80211_sub_if_data *sdata,
219 struct mesh_rmc *rmc = sdata->u.mesh.rmc;
254 int mesh_add_meshconf_ie(struct ieee80211_sub_if_data *sdata,
257 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
303 int mesh_add_meshid_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
305 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
320 static int mesh_add_awake_window_ie(struct ieee80211_sub_if_data *sdata,
323 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
343 int mesh_add_vendor_ies(struct ieee80211_sub_if_data *sdata,
346 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
367 int mesh_add_rsn_ie(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
369 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
390 static int mesh_add_ds_params_ie(struct ieee80211_sub_if_data *sdata,
401 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
417 int mesh_add_ht_cap_ie(struct ieee80211_sub_if_data *sdata,
423 sband = ieee80211_get_sband(sdata);
432 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
433 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
434 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
446 int mesh_add_ht_oper_ie(struct ieee80211_sub_if_data *sdata,
449 struct ieee80211_local *local = sdata->local;
457 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
473 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
474 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
475 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
482 ieee80211_ie_build_ht_oper(pos, ht_cap, &sdata->vif.bss_conf.chandef,
483 sdata->vif.bss_conf.ht_operation_mode,
489 int mesh_add_vht_cap_ie(struct ieee80211_sub_if_data *sdata,
495 sband = ieee80211_get_sband(sdata);
504 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
505 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
506 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
518 int mesh_add_vht_oper_ie(struct ieee80211_sub_if_data *sdata,
521 struct ieee80211_local *local = sdata->local;
529 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
545 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
546 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
547 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
555 &sdata->vif.bss_conf.chandef);
560 int mesh_add_he_cap_ie(struct ieee80211_sub_if_data *sdata,
567 sband = ieee80211_get_sband(sdata);
574 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
575 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
576 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
588 int mesh_add_he_oper_ie(struct ieee80211_sub_if_data *sdata,
596 sband = ieee80211_get_sband(sdata);
602 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_20_NOHT ||
603 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_5 ||
604 sdata->vif.bss_conf.chandef.width == NL80211_CHAN_WIDTH_10)
608 if (sdata->vif.bss_conf.chandef.chan->band == NL80211_BAND_6GHZ)
615 ieee80211_ie_build_he_oper(pos, &sdata->vif.bss_conf.chandef);
620 int mesh_add_he_6ghz_cap_ie(struct ieee80211_sub_if_data *sdata,
626 sband = ieee80211_get_sband(sdata);
636 ieee80211_ie_build_he_6ghz_cap(sdata, skb);
642 struct ieee80211_sub_if_data *sdata =
643 from_timer(sdata, t, u.mesh.mesh_path_timer);
645 ieee80211_queue_work(&sdata->local->hw, &sdata->work);
650 struct ieee80211_sub_if_data *sdata =
651 from_timer(sdata, t, u.mesh.mesh_path_root_timer);
652 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
656 ieee80211_queue_work(&sdata->local->hw, &sdata->work);
703 * @sdata: mesh interface to be used
713 unsigned int ieee80211_new_mesh_header(struct ieee80211_sub_if_data *sdata,
722 meshhdr->ttl = sdata->u.mesh.mshcfg.dot11MeshTTL;
725 put_unaligned(cpu_to_le32(sdata->u.mesh.mesh_seqnum), &meshhdr->seqnum);
726 sdata->u.mesh.mesh_seqnum++;
742 static void ieee80211_mesh_housekeeping(struct ieee80211_sub_if_data *sdata)
744 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
748 ieee80211_sta_expire(sdata, ifmsh->mshcfg.plink_timeout * HZ);
749 mesh_path_expire(sdata);
751 changed = mesh_accept_plinks_update(sdata);
752 ieee80211_mbss_info_change_notify(sdata, changed);
759 static void ieee80211_mesh_rootpath(struct ieee80211_sub_if_data *sdata)
761 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
764 mesh_path_tx_root_frame(sdata);
787 struct ieee80211_sub_if_data *sdata;
790 sdata = container_of(ifmsh, struct ieee80211_sub_if_data, u.mesh);
792 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
796 ie_len_he_cap = ieee80211_ie_len_he_cap(sdata,
841 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
842 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
843 ieee80211_mps_set_frame_flags(sdata, NULL, (void *) mgmt);
845 cpu_to_le16(sdata->vif.bss_conf.beacon_int);
847 sdata->u.mesh.security ? WLAN_CAPABILITY_PRIVACY : 0);
918 if (ieee80211_add_srates_ie(sdata, skb, true, band) ||
919 mesh_add_ds_params_ie(sdata, skb))
929 if (ieee80211_add_ext_srates_ie(sdata, skb, true, band) ||
930 mesh_add_rsn_ie(sdata, skb) ||
931 mesh_add_ht_cap_ie(sdata, skb) ||
932 mesh_add_ht_oper_ie(sdata, skb) ||
933 mesh_add_meshid_ie(sdata, skb) ||
934 mesh_add_meshconf_ie(sdata, skb) ||
935 mesh_add_awake_window_ie(sdata, skb) ||
936 mesh_add_vht_cap_ie(sdata, skb) ||
937 mesh_add_vht_oper_ie(sdata, skb) ||
938 mesh_add_he_cap_ie(sdata, skb, ie_len_he_cap) ||
939 mesh_add_he_oper_ie(sdata, skb) ||
940 mesh_add_he_6ghz_cap_ie(sdata, skb) ||
941 mesh_add_vendor_ies(sdata, skb))
959 ieee80211_mesh_rebuild_beacon(struct ieee80211_sub_if_data *sdata)
964 old_bcn = rcu_dereference_protected(sdata->u.mesh.beacon,
965 lockdep_is_held(&sdata->wdev.mtx));
966 ret = ieee80211_mesh_build_beacon(&sdata->u.mesh);
976 void ieee80211_mbss_info_change_notify(struct ieee80211_sub_if_data *sdata,
979 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
990 ieee80211_queue_work(&sdata->local->hw, &sdata->work);
993 int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
995 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
996 struct ieee80211_local *local = sdata->local;
1015 ieee80211_queue_work(&local->hw, &sdata->work);
1016 sdata->vif.bss_conf.ht_operation_mode =
1018 sdata->vif.bss_conf.enable_beacon = true;
1020 changed |= ieee80211_mps_local_status_update(sdata);
1023 ieee80211_stop_mesh(sdata);
1027 ieee80211_recalc_dtim(local, sdata);
1028 ieee80211_bss_info_change_notify(sdata, changed);
1030 netif_carrier_on(sdata->dev);
1034 void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
1036 struct ieee80211_local *local = sdata->local;
1037 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1040 netif_carrier_off(sdata->dev);
1043 sta_info_flush(sdata);
1044 ieee80211_free_keys(sdata, true);
1045 mesh_path_flush_by_iface(sdata);
1049 sdata->vif.bss_conf.enable_beacon = false;
1050 sdata->beacon_rate_set = false;
1051 clear_bit(SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, &sdata->state);
1052 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
1056 lockdep_is_held(&sdata->wdev.mtx));
1064 del_timer_sync(&sdata->u.mesh.housekeeping_timer);
1065 del_timer_sync(&sdata->u.mesh.mesh_path_root_timer);
1066 del_timer_sync(&sdata->u.mesh.mesh_path_timer);
1077 static void ieee80211_mesh_csa_mark_radar(struct ieee80211_sub_if_data *sdata)
1084 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
1085 &sdata->vif.bss_conf.chandef,
1088 cfg80211_radar_event(sdata->local->hw.wiphy,
1089 &sdata->vif.bss_conf.chandef, GFP_ATOMIC);
1093 ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
1098 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1103 sdata_assert_lock(sdata);
1105 sband = ieee80211_get_sband(sdata);
1110 switch (sdata->vif.bss_conf.chandef.width) {
1129 err = ieee80211_parse_ch_switch_ie(sdata, elems, sband->band,
1131 sta_flags, sdata->vif.addr,
1142 ieee80211_mesh_csa_mark_radar(sdata);
1147 if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, ¶ms.chandef,
1149 !cfg80211_reg_can_beacon(sdata->local->hw.wiphy, ¶ms.chandef,
1151 sdata_info(sdata,
1153 sdata->vif.addr,
1161 err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
1167 sdata_info(sdata,
1169 sdata->vif.addr,
1180 &sdata->vif.bss_conf.chandef)) {
1181 mcsa_dbg(sdata,
1186 mcsa_dbg(sdata,
1203 if (ieee80211_channel_switch(sdata->local->hw.wiphy, sdata->dev,
1211 ieee80211_mesh_rx_probe_req(struct ieee80211_sub_if_data *sdata,
1214 struct ieee80211_local *local = sdata->local;
1215 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1235 if ((!ether_addr_equal(mgmt->da, sdata->vif.addr) &&
1264 ieee80211_tx_skb(sdata, presp);
1269 static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
1275 struct ieee80211_local *local = sdata->local;
1276 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1285 !ether_addr_equal(mgmt->da, sdata->vif.addr))
1297 (elems.rsn && sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) ||
1298 (!elems.rsn && sdata->u.mesh.security != IEEE80211_MESH_SEC_NONE))
1311 if (mesh_matches_local(sdata, &elems)) {
1312 mpl_dbg(sdata, "rssi_threshold=%d,rx_status->signal=%d\n",
1313 sdata->u.mesh.mshcfg.rssi_threshold, rx_status->signal);
1314 if (!sdata->u.mesh.user_mpm ||
1315 sdata->u.mesh.mshcfg.rssi_threshold == 0 ||
1316 sdata->u.mesh.mshcfg.rssi_threshold < rx_status->signal)
1317 mesh_neighbour_update(sdata, mgmt->sa, &elems,
1321 !sdata->vif.csa_active)
1322 ieee80211_mesh_process_chnswitch(sdata, &elems, true);
1326 ifmsh->sync_ops->rx_bcn_presp(sdata,
1330 int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata)
1332 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1343 lockdep_is_held(&sdata->wdev.mtx));
1347 ret = ieee80211_mesh_rebuild_beacon(sdata);
1353 mcsa_dbg(sdata, "complete switching to center freq %d MHz",
1354 sdata->vif.bss_conf.chandef.chan->center_freq);
1358 int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
1361 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1365 lockdep_assert_held(&sdata->wdev.mtx);
1377 ret = ieee80211_mesh_rebuild_beacon(sdata);
1388 static int mesh_fwd_csa_frame(struct ieee80211_sub_if_data *sdata,
1394 struct ieee80211_local *local = sdata->local;
1408 memcpy(mgmt_fwd->sa, sdata->vif.addr, ETH_ALEN);
1409 memcpy(mgmt_fwd->bssid, sdata->vif.addr, ETH_ALEN);
1411 ieee80211_tx_skb(sdata, skb);
1415 static void mesh_rx_csa_frame(struct ieee80211_sub_if_data *sdata,
1418 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1435 if (!mesh_matches_local(sdata, &elems))
1448 if (!sdata->vif.csa_active &&
1449 !ieee80211_mesh_process_chnswitch(sdata, &elems, false)) {
1450 mcsa_dbg(sdata, "Failed to process CSA action frame");
1456 if (mesh_fwd_csa_frame(sdata, mgmt, len, &elems) < 0)
1457 mcsa_dbg(sdata, "Failed to forward the CSA frame");
1461 static void ieee80211_mesh_rx_mgmt_action(struct ieee80211_sub_if_data *sdata,
1472 mesh_rx_plink_frame(sdata, mgmt, len, rx_status);
1478 mesh_rx_path_sel_frame(sdata, mgmt, len);
1481 mesh_rx_csa_frame(sdata, mgmt, len);
1486 void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
1493 sdata_lock(sdata);
1496 if (!sdata->u.mesh.mesh_id_len)
1506 ieee80211_mesh_rx_bcn_presp(sdata, stype, mgmt, skb->len,
1510 ieee80211_mesh_rx_probe_req(sdata, mgmt, skb->len);
1513 ieee80211_mesh_rx_mgmt_action(sdata, mgmt, skb->len, rx_status);
1517 sdata_unlock(sdata);
1520 static void mesh_bss_info_changed(struct ieee80211_sub_if_data *sdata)
1522 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1531 if (sdata->vif.bss_conf.enable_beacon &&
1536 if (ieee80211_mesh_rebuild_beacon(sdata))
1539 ieee80211_bss_info_change_notify(sdata, changed);
1542 void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata)
1544 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1546 sdata_lock(sdata);
1549 if (!sdata->u.mesh.mesh_id_len)
1555 mesh_path_start_discovery(sdata);
1558 ieee80211_mesh_housekeeping(sdata);
1561 ieee80211_mesh_rootpath(sdata);
1564 mesh_sync_adjust_tsf(sdata);
1567 mesh_bss_info_changed(sdata);
1569 sdata_unlock(sdata);
1573 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
1575 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
1583 mesh_rmc_init(sdata);
1591 mesh_pathtbl_init(sdata);
1602 sdata->vif.bss_conf.bssid = zero_addr;
1605 void ieee80211_mesh_teardown_sdata(struct ieee80211_sub_if_data *sdata)
1607 mesh_rmc_free(sdata);
1608 mesh_pathtbl_unregister(sdata);