Lines Matching refs:sdata

49 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);  in ieee80211_change_mtu()  local
51 meshhdrlen = (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) ? 5 : 0; in ieee80211_change_mtu()
69 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); in ieee80211_change_mac() local
73 if (ieee80211_sdata_running(sdata)) in ieee80211_change_mac()
79 memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); in ieee80211_change_mac()
98 static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata, in ieee80211_check_concurrent_iface() argument
101 struct ieee80211_local *local = sdata->local; in ieee80211_check_concurrent_iface()
103 struct net_device *dev = sdata->dev; in ieee80211_check_concurrent_iface()
145 sdata->bss = &nsdata->u.ap; in ieee80211_check_concurrent_iface()
152 void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, in ieee80211_adjust_monitor_flags() argument
155 struct ieee80211_local *local = sdata->local; in ieee80211_adjust_monitor_flags()
156 u32 flags = sdata->u.mntr_flags; in ieee80211_adjust_monitor_flags()
179 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); in ieee80211_do_open() local
180 struct ieee80211_local *local = sdata->local; in ieee80211_do_open()
186 switch (sdata->vif.type) { in ieee80211_do_open()
188 if (!is_valid_ether_addr(sdata->u.wds.remote_addr)) in ieee80211_do_open()
192 if (!sdata->bss) in ieee80211_do_open()
194 list_add(&sdata->u.vlan.list, &sdata->bss->vlans); in ieee80211_do_open()
197 sdata->bss = &sdata->u.ap; in ieee80211_do_open()
244 switch (sdata->vif.type) { in ieee80211_do_open()
249 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { in ieee80211_do_open()
261 ieee80211_adjust_monitor_flags(sdata, 1); in ieee80211_do_open()
268 res = drv_add_interface(local, &sdata->vif); in ieee80211_do_open()
273 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_do_open()
278 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { in ieee80211_do_open()
282 changed |= ieee80211_reset_erp_info(sdata); in ieee80211_do_open()
283 ieee80211_bss_info_change_notify(sdata, changed); in ieee80211_do_open()
285 if (sdata->vif.type == NL80211_IFTYPE_STATION) in ieee80211_do_open()
291 set_bit(SDATA_STATE_RUNNING, &sdata->state); in ieee80211_do_open()
293 if (sdata->vif.type == NL80211_IFTYPE_WDS) { in ieee80211_do_open()
295 sta = sta_info_alloc(sdata, sdata->u.wds.remote_addr, in ieee80211_do_open()
319 if (sdata->flags & IEEE80211_SDATA_ALLMULTI) in ieee80211_do_open()
322 if (sdata->flags & IEEE80211_SDATA_PROMISC) in ieee80211_do_open()
339 ieee80211_set_wmm_default(sdata); in ieee80211_do_open()
348 drv_remove_interface(local, &sdata->vif); in ieee80211_do_open()
353 sdata->bss = NULL; in ieee80211_do_open()
354 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_do_open()
355 list_del(&sdata->u.vlan.list); in ieee80211_do_open()
356 clear_bit(SDATA_STATE_RUNNING, &sdata->state); in ieee80211_do_open()
362 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); in ieee80211_open() local
370 err = ieee80211_check_concurrent_iface(sdata, sdata->vif.type); in ieee80211_open()
377 static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, in ieee80211_do_stop() argument
380 struct ieee80211_local *local = sdata->local; in ieee80211_do_stop()
387 if (local->scan_sdata == sdata) in ieee80211_do_stop()
390 clear_bit(SDATA_STATE_RUNNING, &sdata->state); in ieee80211_do_stop()
395 netif_tx_stop_all_queues(sdata->dev); in ieee80211_do_stop()
400 ieee80211_work_purge(sdata); in ieee80211_do_stop()
416 sta_info_flush(local, sdata); in ieee80211_do_stop()
424 if (sdata->flags & IEEE80211_SDATA_ALLMULTI) in ieee80211_do_stop()
427 if (sdata->flags & IEEE80211_SDATA_PROMISC) in ieee80211_do_stop()
430 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_do_stop()
433 } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC) { in ieee80211_do_stop()
437 netif_addr_lock_bh(sdata->dev); in ieee80211_do_stop()
439 __hw_addr_unsync(&local->mc_list, &sdata->dev->mc, in ieee80211_do_stop()
440 sdata->dev->addr_len); in ieee80211_do_stop()
442 netif_addr_unlock_bh(sdata->dev); in ieee80211_do_stop()
450 if (sdata->vif.type == NL80211_IFTYPE_AP) { in ieee80211_do_stop()
452 struct beacon_data *old_beacon = sdata->u.ap.beacon; in ieee80211_do_stop()
455 ieee80211_bss_info_change_notify(sdata, in ieee80211_do_stop()
459 rcu_assign_pointer(sdata->u.ap.beacon, NULL); in ieee80211_do_stop()
464 while ((skb = skb_dequeue(&sdata->u.ap.ps_bc_buf))) { in ieee80211_do_stop()
470 list_for_each_entry_safe(vlan, tmpsdata, &sdata->u.ap.vlans, in ieee80211_do_stop()
473 WARN_ON(!list_empty(&sdata->u.ap.vlans)); in ieee80211_do_stop()
479 switch (sdata->vif.type) { in ieee80211_do_stop()
481 list_del(&sdata->u.vlan.list); in ieee80211_do_stop()
485 if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { in ieee80211_do_stop()
496 ieee80211_adjust_monitor_flags(sdata, -1); in ieee80211_do_stop()
500 flush_work(&sdata->work); in ieee80211_do_stop()
508 skb_queue_purge(&sdata->skb_queue); in ieee80211_do_stop()
514 if (sdata->vif.type == NL80211_IFTYPE_MESH_POINT) in ieee80211_do_stop()
515 ieee80211_bss_info_change_notify(sdata, in ieee80211_do_stop()
522 ieee80211_free_keys(sdata); in ieee80211_do_stop()
525 drv_remove_interface(local, &sdata->vif); in ieee80211_do_stop()
528 sdata->bss = NULL; in ieee80211_do_stop()
560 if (info->control.vif == &sdata->vif) { in ieee80211_do_stop()
571 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); in ieee80211_stop() local
573 ieee80211_do_stop(sdata, true); in ieee80211_stop()
580 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); in ieee80211_set_multicast_list() local
581 struct ieee80211_local *local = sdata->local; in ieee80211_set_multicast_list()
586 sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI); in ieee80211_set_multicast_list()
587 sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC); in ieee80211_set_multicast_list()
594 sdata->flags ^= IEEE80211_SDATA_ALLMULTI; in ieee80211_set_multicast_list()
602 sdata->flags ^= IEEE80211_SDATA_PROMISC; in ieee80211_set_multicast_list()
616 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); in ieee80211_teardown_sdata() local
617 struct ieee80211_local *local = sdata->local; in ieee80211_teardown_sdata()
622 ieee80211_free_keys(sdata); in ieee80211_teardown_sdata()
624 ieee80211_debugfs_remove_netdev(sdata); in ieee80211_teardown_sdata()
627 __skb_queue_purge(&sdata->fragments[i].skb_list); in ieee80211_teardown_sdata()
628 sdata->fragment_next = 0; in ieee80211_teardown_sdata()
630 if (ieee80211_vif_is_mesh(&sdata->vif)) in ieee80211_teardown_sdata()
631 mesh_rmc_free(sdata); in ieee80211_teardown_sdata()
633 flushed = sta_info_flush(local, sdata); in ieee80211_teardown_sdata()
657 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); in ieee80211_monitor_select_queue() local
658 struct ieee80211_local *local = sdata->local; in ieee80211_monitor_select_queue()
707 struct ieee80211_sub_if_data *sdata = in ieee80211_iface_work() local
709 struct ieee80211_local *local = sdata->local; in ieee80211_iface_work()
714 if (!ieee80211_sdata_running(sdata)) in ieee80211_iface_work()
729 while ((skb = skb_dequeue(&sdata->skb_queue))) { in ieee80211_iface_work()
734 ieee80211_start_tx_ba_cb(&sdata->vif, ra_tid->ra, in ieee80211_iface_work()
738 ieee80211_stop_tx_ba_cb(&sdata->vif, ra_tid->ra, in ieee80211_iface_work()
745 sta = sta_info_get_bss(sdata, mgmt->sa); in ieee80211_iface_work()
757 ieee80211_process_delba(sdata, sta, in ieee80211_iface_work()
786 sta = sta_info_get_bss(sdata, mgmt->sa); in ieee80211_iface_work()
797 } else switch (sdata->vif.type) { in ieee80211_iface_work()
799 ieee80211_sta_rx_queued_mgmt(sdata, skb); in ieee80211_iface_work()
802 ieee80211_ibss_rx_queued_mgmt(sdata, skb); in ieee80211_iface_work()
805 if (!ieee80211_vif_is_mesh(&sdata->vif)) in ieee80211_iface_work()
807 ieee80211_mesh_rx_queued_mgmt(sdata, skb); in ieee80211_iface_work()
818 switch (sdata->vif.type) { in ieee80211_iface_work()
820 ieee80211_sta_work(sdata); in ieee80211_iface_work()
823 ieee80211_ibss_work(sdata); in ieee80211_iface_work()
826 if (!ieee80211_vif_is_mesh(&sdata->vif)) in ieee80211_iface_work()
828 ieee80211_mesh_work(sdata); in ieee80211_iface_work()
839 static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, in ieee80211_setup_sdata() argument
843 memset(&sdata->u, 0, sizeof(sdata->u)); in ieee80211_setup_sdata()
846 sdata->vif.type = type; in ieee80211_setup_sdata()
847 sdata->vif.p2p = false; in ieee80211_setup_sdata()
848 sdata->dev->netdev_ops = &ieee80211_dataif_ops; in ieee80211_setup_sdata()
849 sdata->wdev.iftype = type; in ieee80211_setup_sdata()
851 sdata->control_port_protocol = cpu_to_be16(ETH_P_PAE); in ieee80211_setup_sdata()
852 sdata->control_port_no_encrypt = false; in ieee80211_setup_sdata()
855 sdata->dev->type = ARPHRD_ETHER; in ieee80211_setup_sdata()
857 skb_queue_head_init(&sdata->skb_queue); in ieee80211_setup_sdata()
858 INIT_WORK(&sdata->work, ieee80211_iface_work); in ieee80211_setup_sdata()
863 sdata->vif.type = type; in ieee80211_setup_sdata()
864 sdata->vif.p2p = true; in ieee80211_setup_sdata()
867 skb_queue_head_init(&sdata->u.ap.ps_bc_buf); in ieee80211_setup_sdata()
868 INIT_LIST_HEAD(&sdata->u.ap.vlans); in ieee80211_setup_sdata()
872 sdata->vif.type = type; in ieee80211_setup_sdata()
873 sdata->vif.p2p = true; in ieee80211_setup_sdata()
876 ieee80211_sta_setup_sdata(sdata); in ieee80211_setup_sdata()
879 ieee80211_ibss_setup_sdata(sdata); in ieee80211_setup_sdata()
882 if (ieee80211_vif_is_mesh(&sdata->vif)) in ieee80211_setup_sdata()
883 ieee80211_mesh_init_sdata(sdata); in ieee80211_setup_sdata()
886 sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP; in ieee80211_setup_sdata()
887 sdata->dev->netdev_ops = &ieee80211_monitorif_ops; in ieee80211_setup_sdata()
888 sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | in ieee80211_setup_sdata()
900 ieee80211_debugfs_add_netdev(sdata); in ieee80211_setup_sdata()
903 static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata, in ieee80211_runtime_change_iftype() argument
906 struct ieee80211_local *local = sdata->local; in ieee80211_runtime_change_iftype()
916 switch (sdata->vif.type) { in ieee80211_runtime_change_iftype()
954 ret = ieee80211_check_concurrent_iface(sdata, internal_type); in ieee80211_runtime_change_iftype()
958 ieee80211_do_stop(sdata, false); in ieee80211_runtime_change_iftype()
960 ieee80211_teardown_sdata(sdata->dev); in ieee80211_runtime_change_iftype()
962 ret = drv_change_interface(local, sdata, internal_type, p2p); in ieee80211_runtime_change_iftype()
964 type = sdata->vif.type; in ieee80211_runtime_change_iftype()
966 ieee80211_setup_sdata(sdata, type); in ieee80211_runtime_change_iftype()
968 err = ieee80211_do_open(sdata->dev, false); in ieee80211_runtime_change_iftype()
974 int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, in ieee80211_if_change_type() argument
981 if (type == ieee80211_vif_type_p2p(&sdata->vif)) in ieee80211_if_change_type()
985 if (sdata->local->oper_channel->flags & IEEE80211_CHAN_NO_IBSS && in ieee80211_if_change_type()
989 if (ieee80211_sdata_running(sdata)) { in ieee80211_if_change_type()
990 ret = ieee80211_runtime_change_iftype(sdata, type); in ieee80211_if_change_type()
995 ieee80211_teardown_sdata(sdata->dev); in ieee80211_if_change_type()
996 ieee80211_setup_sdata(sdata, type); in ieee80211_if_change_type()
1000 sdata->vif.bss_conf.basic_rates = in ieee80211_if_change_type()
1001 ieee80211_mandatory_rates(sdata->local, in ieee80211_if_change_type()
1002 sdata->local->hw.conf.channel->band); in ieee80211_if_change_type()
1003 sdata->drop_unencrypted = 0; in ieee80211_if_change_type()
1005 sdata->u.mgd.use_4addr = false; in ieee80211_if_change_type()
1014 struct ieee80211_sub_if_data *sdata; in ieee80211_assign_perm_addr() local
1037 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_assign_perm_addr()
1038 if (sdata->vif.type != NL80211_IFTYPE_AP) in ieee80211_assign_perm_addr()
1040 memcpy(dev->perm_addr, sdata->vif.addr, ETH_ALEN); in ieee80211_assign_perm_addr()
1050 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_assign_perm_addr()
1052 sdata->vif.addr, ETH_ALEN) == 0) { in ieee80211_assign_perm_addr()
1101 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_assign_perm_addr()
1102 if (memcmp(tmp_addr, sdata->vif.addr, in ieee80211_assign_perm_addr()
1127 struct ieee80211_sub_if_data *sdata = NULL; in ieee80211_if_add() local
1132 ndev = alloc_netdev_mq(sizeof(*sdata) + local->hw.vif_data_size, in ieee80211_if_add()
1156 sdata = netdev_priv(ndev); in ieee80211_if_add()
1157 ndev->ieee80211_ptr = &sdata->wdev; in ieee80211_if_add()
1158 memcpy(sdata->vif.addr, ndev->dev_addr, ETH_ALEN); in ieee80211_if_add()
1159 memcpy(sdata->name, ndev->name, IFNAMSIZ); in ieee80211_if_add()
1162 sdata->wdev.wiphy = local->hw.wiphy; in ieee80211_if_add()
1163 sdata->local = local; in ieee80211_if_add()
1164 sdata->dev = ndev; in ieee80211_if_add()
1166 sdata->arp_filter_state = true; in ieee80211_if_add()
1170 skb_queue_head_init(&sdata->fragments[i].skb_list); in ieee80211_if_add()
1172 INIT_LIST_HEAD(&sdata->key_list); in ieee80211_if_add()
1177 sdata->rc_rateidx_mask[i] = in ieee80211_if_add()
1182 ieee80211_setup_sdata(sdata, type); in ieee80211_if_add()
1187 sdata->u.mgd.use_4addr = params->use_4addr; in ieee80211_if_add()
1195 list_add_tail_rcu(&sdata->list, &local->interfaces); in ieee80211_if_add()
1208 void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata) in ieee80211_if_remove() argument
1212 mutex_lock(&sdata->local->iflist_mtx); in ieee80211_if_remove()
1213 list_del_rcu(&sdata->list); in ieee80211_if_remove()
1214 mutex_unlock(&sdata->local->iflist_mtx); in ieee80211_if_remove()
1217 unregister_netdevice(sdata->dev); in ieee80211_if_remove()
1226 struct ieee80211_sub_if_data *sdata, *tmp; in ieee80211_remove_interfaces() local
1232 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { in ieee80211_remove_interfaces()
1233 list_del(&sdata->list); in ieee80211_remove_interfaces()
1235 unregister_netdevice_queue(sdata->dev, &unreg_list); in ieee80211_remove_interfaces()
1273 struct ieee80211_sub_if_data *sdata; in __ieee80211_recalc_idle() local
1285 list_for_each_entry(sdata, &local->interfaces, list) { in __ieee80211_recalc_idle()
1286 if (!ieee80211_sdata_running(sdata)) { in __ieee80211_recalc_idle()
1287 sdata->vif.bss_conf.idle = true; in __ieee80211_recalc_idle()
1291 sdata->old_idle = sdata->vif.bss_conf.idle; in __ieee80211_recalc_idle()
1294 if (sdata->vif.type == NL80211_IFTYPE_STATION && in __ieee80211_recalc_idle()
1295 !sdata->u.mgd.associated) { in __ieee80211_recalc_idle()
1296 sdata->vif.bss_conf.idle = true; in __ieee80211_recalc_idle()
1300 if (sdata->vif.type == NL80211_IFTYPE_ADHOC && in __ieee80211_recalc_idle()
1301 !sdata->u.ibss.ssid_len) { in __ieee80211_recalc_idle()
1302 sdata->vif.bss_conf.idle = true; in __ieee80211_recalc_idle()
1311 wk->sdata->vif.bss_conf.idle = false; in __ieee80211_recalc_idle()
1322 list_for_each_entry(sdata, &local->interfaces, list) { in __ieee80211_recalc_idle()
1323 if (sdata->old_idle == sdata->vif.bss_conf.idle) in __ieee80211_recalc_idle()
1325 if (!ieee80211_sdata_running(sdata)) in __ieee80211_recalc_idle()
1327 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE); in __ieee80211_recalc_idle()
1372 struct ieee80211_sub_if_data *sdata; in netdev_notify() local
1383 sdata = IEEE80211_DEV_TO_SUB_IF(dev); in netdev_notify()
1385 memcpy(sdata->name, dev->name, IFNAMSIZ); in netdev_notify()
1387 ieee80211_debugfs_rename_netdev(sdata); in netdev_notify()