Lines Matching full:local
49 struct net_device * hostap_add_interface(struct local_info *local, in hostap_add_interface() argument
64 iface->local = local; in hostap_add_interface()
66 list_add(&iface->list, &local->hostap_interfaces); in hostap_add_interface()
68 mdev = local->dev; in hostap_add_interface()
75 hostap_setup_dev(dev, local, type); in hostap_add_interface()
116 if (dev == iface->local->ddev) in hostap_remove_interface()
117 iface->local->ddev = NULL; in hostap_remove_interface()
118 else if (dev == iface->local->apdev) in hostap_remove_interface()
119 iface->local->apdev = NULL; in hostap_remove_interface()
120 else if (dev == iface->local->stadev) in hostap_remove_interface()
121 iface->local->stadev = NULL; in hostap_remove_interface()
142 int prism2_wds_add(local_info_t *local, u8 *remote_addr, in prism2_wds_add() argument
150 read_lock_bh(&local->iface_lock); in prism2_wds_add()
151 list_for_each(ptr, &local->hostap_interfaces) { in prism2_wds_add()
167 read_unlock_bh(&local->iface_lock); in prism2_wds_add()
169 local->dev->name, empty->dev->name); in prism2_wds_add()
172 read_unlock_bh(&local->iface_lock); in prism2_wds_add()
177 hostap_add_sta(local->ap, remote_addr); in prism2_wds_add()
180 if (local->wds_connections >= local->wds_max_connections) in prism2_wds_add()
184 if (strlen(local->dev->name) >= IFNAMSIZ - 5) { in prism2_wds_add()
186 local->dev->name); in prism2_wds_add()
190 dev = hostap_add_interface(local, HOSTAP_INTERFACE_WDS, rtnl_locked, in prism2_wds_add()
191 local->ddev->name, "wds%d"); in prism2_wds_add()
198 local->wds_connections++; in prism2_wds_add()
204 int prism2_wds_del(local_info_t *local, u8 *remote_addr, in prism2_wds_del() argument
211 write_lock_irqsave(&local->iface_lock, flags); in prism2_wds_del()
212 list_for_each(ptr, &local->hostap_interfaces) { in prism2_wds_del()
225 write_unlock_irqrestore(&local->iface_lock, flags); in prism2_wds_del()
232 local->wds_connections--; in prism2_wds_del()
240 u16 hostap_tx_callback_register(local_info_t *local, in hostap_tx_callback_register() argument
255 spin_lock_irqsave(&local->lock, flags); in hostap_tx_callback_register()
256 entry->idx = local->tx_callback ? local->tx_callback->idx + 1 : 1; in hostap_tx_callback_register()
257 entry->next = local->tx_callback; in hostap_tx_callback_register()
258 local->tx_callback = entry; in hostap_tx_callback_register()
259 spin_unlock_irqrestore(&local->lock, flags); in hostap_tx_callback_register()
265 int hostap_tx_callback_unregister(local_info_t *local, u16 idx) in hostap_tx_callback_unregister() argument
270 spin_lock_irqsave(&local->lock, flags); in hostap_tx_callback_unregister()
271 cb = local->tx_callback; in hostap_tx_callback_unregister()
278 local->tx_callback = cb->next; in hostap_tx_callback_unregister()
283 spin_unlock_irqrestore(&local->lock, flags); in hostap_tx_callback_unregister()
295 return iface->local->func->set_rid(dev, rid, &tmp, 2); in hostap_set_word()
313 return iface->local->func->set_rid(dev, rid, &buf, MAX_SSID_LEN + 2); in hostap_set_string()
317 u16 hostap_get_porttype(local_info_t *local) in hostap_get_porttype() argument
319 if (local->iw_mode == IW_MODE_ADHOC && local->pseudo_adhoc) in hostap_get_porttype()
321 if (local->iw_mode == IW_MODE_ADHOC) in hostap_get_porttype()
323 if (local->iw_mode == IW_MODE_INFRA) in hostap_get_porttype()
325 if (local->iw_mode == IW_MODE_REPEAT) in hostap_get_porttype()
327 if (local->iw_mode == IW_MODE_MONITOR) in hostap_get_porttype()
333 int hostap_set_encryption(local_info_t *local) in hostap_set_encryption() argument
340 idx = local->crypt_info.tx_keyidx; in hostap_set_encryption()
341 if (local->crypt_info.crypt[idx] == NULL || in hostap_set_encryption()
342 local->crypt_info.crypt[idx]->ops == NULL) in hostap_set_encryption()
344 else if (strcmp(local->crypt_info.crypt[idx]->ops->name, "WEP") == 0) in hostap_set_encryption()
349 if (local->func->get_rid(local->dev, HFA384X_RID_CNFWEPFLAGS, &val, 2, in hostap_set_encryption()
357 if (encrypt_type != NONE || local->privacy_invoked) in hostap_set_encryption()
362 if (local->open_wep || encrypt_type == NONE || in hostap_set_encryption()
363 ((local->ieee_802_1x || local->wpa) && local->host_decrypt)) in hostap_set_encryption()
368 if ((encrypt_type != NONE || local->privacy_invoked) && in hostap_set_encryption()
369 (encrypt_type == OTHER || local->host_encrypt)) in hostap_set_encryption()
373 if ((encrypt_type != NONE || local->privacy_invoked) && in hostap_set_encryption()
374 (encrypt_type == OTHER || local->host_decrypt)) in hostap_set_encryption()
380 hostap_set_word(local->dev, HFA384X_RID_CNFWEPFLAGS, val)) { in hostap_set_encryption()
392 len = local->crypt_info.crypt[idx]->ops->get_key(keybuf, sizeof(keybuf), NULL, in hostap_set_encryption()
393 local->crypt_info.crypt[idx]->priv); in hostap_set_encryption()
399 if (local->crypt_info.crypt[i]) { in hostap_set_encryption()
400 (void) local->crypt_info.crypt[i]->ops->get_key( in hostap_set_encryption()
402 NULL, local->crypt_info.crypt[i]->priv); in hostap_set_encryption()
404 if (local->func->set_rid(local->dev, in hostap_set_encryption()
412 if (hostap_set_word(local->dev, HFA384X_RID_CNFWEPDEFAULTKEYID, idx)) { in hostap_set_encryption()
420 printk(KERN_DEBUG "%s: encryption setup failed\n", local->dev->name); in hostap_set_encryption()
425 int hostap_set_antsel(local_info_t *local) in hostap_set_antsel() argument
430 if (local->antsel_tx != HOSTAP_ANTSEL_DO_NOT_TOUCH && in hostap_set_antsel()
431 local->func->cmd(local->dev, HFA384X_CMDCODE_READMIF, in hostap_set_antsel()
435 switch (local->antsel_tx) { in hostap_set_antsel()
446 if (local->func->cmd(local->dev, HFA384X_CMDCODE_WRITEMIF, in hostap_set_antsel()
449 local->dev->name); in hostap_set_antsel()
454 if (local->antsel_rx != HOSTAP_ANTSEL_DO_NOT_TOUCH && in hostap_set_antsel()
455 local->func->cmd(local->dev, HFA384X_CMDCODE_READMIF, in hostap_set_antsel()
459 switch (local->antsel_rx) { in hostap_set_antsel()
470 if (local->func->cmd(local->dev, HFA384X_CMDCODE_WRITEMIF, in hostap_set_antsel()
473 local->dev->name); in hostap_set_antsel()
482 int hostap_set_roaming(local_info_t *local) in hostap_set_roaming() argument
486 switch (local->host_roaming) { in hostap_set_roaming()
499 return hostap_set_word(local->dev, HFA384X_RID_CNFROAMINGMODE, val); in hostap_set_roaming()
503 int hostap_set_auth_algs(local_info_t *local) in hostap_set_auth_algs() argument
505 int val = local->auth_algs; in hostap_set_auth_algs()
511 if (local->sta_fw_ver < PRISM2_FW_VER(0,7,0) && in hostap_set_auth_algs()
515 if (hostap_set_word(local->dev, HFA384X_RID_CNFAUTHENTICATION, val)) { in hostap_set_auth_algs()
517 "failed\n", local->dev->name, local->auth_algs); in hostap_set_auth_algs()
608 local_info_t *local; in prism2_close() local
613 local = iface->local; in prism2_close()
615 if (dev == local->ddev) { in prism2_close()
616 prism2_sta_deauth(local, WLAN_REASON_DEAUTH_LEAVING); in prism2_close()
619 if (!local->hostapd && dev == local->dev && in prism2_close()
620 (!local->func->card_present || local->func->card_present(local)) && in prism2_close()
621 local->hw_ready && local->ap && local->iw_mode == IW_MODE_MASTER) in prism2_close()
622 hostap_deauth_all_stas(dev, local->ap, 1); in prism2_close()
625 if (dev == local->dev) { in prism2_close()
626 local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); in prism2_close()
634 cancel_work_sync(&local->reset_queue); in prism2_close()
635 cancel_work_sync(&local->set_multicast_list_queue); in prism2_close()
636 cancel_work_sync(&local->set_tim_queue); in prism2_close()
638 cancel_work_sync(&local->info_queue); in prism2_close()
640 cancel_work_sync(&local->comms_qual_update); in prism2_close()
642 module_put(local->hw_module); in prism2_close()
644 local->num_dev_open--; in prism2_close()
646 if (dev != local->dev && local->dev->flags & IFF_UP && in prism2_close()
647 local->master_dev_auto_open && local->num_dev_open == 1) { in prism2_close()
651 dev_close(local->dev); in prism2_close()
661 local_info_t *local; in prism2_open() local
666 local = iface->local; in prism2_open()
668 if (local->no_pri) { in prism2_open()
674 if ((local->func->card_present && !local->func->card_present(local)) || in prism2_open()
675 local->hw_downloading) in prism2_open()
678 if (!try_module_get(local->hw_module)) in prism2_open()
680 local->num_dev_open++; in prism2_open()
682 if (!local->dev_enabled && local->func->hw_enable(dev, 1)) { in prism2_open()
688 if (!local->dev_enabled) in prism2_open()
689 prism2_callback(local, PRISM2_CALLBACK_ENABLE); in prism2_open()
690 local->dev_enabled = 1; in prism2_open()
692 if (dev != local->dev && !(local->dev->flags & IFF_UP)) { in prism2_open()
695 local->master_dev_auto_open = 1; in prism2_open()
696 dev_open(local->dev); in prism2_open()
709 local_info_t *local; in prism2_set_mac_address() local
714 local = iface->local; in prism2_set_mac_address()
716 if (local->func->set_rid(dev, HFA384X_RID_CNFOWNMACADDR, addr->sa_data, in prism2_set_mac_address()
717 ETH_ALEN) < 0 || local->func->reset_port(dev)) in prism2_set_mac_address()
720 read_lock_bh(&local->iface_lock); in prism2_set_mac_address()
721 list_for_each(ptr, &local->hostap_interfaces) { in prism2_set_mac_address()
725 memcpy(local->dev->dev_addr, addr->sa_data, ETH_ALEN); in prism2_set_mac_address()
726 read_unlock_bh(&local->iface_lock); in prism2_set_mac_address()
736 local_info_t *local = in hostap_set_multicast_list_queue() local
738 struct net_device *dev = local->dev; in hostap_set_multicast_list_queue()
741 local->is_promisc)) { in hostap_set_multicast_list_queue()
743 dev->name, local->is_promisc ? "en" : "dis"); in hostap_set_multicast_list_queue()
756 local_info_t *local; in hostap_set_multicast_list()
759 local = iface->local; in hostap_set_multicast_list()
761 local->is_promisc = 1; in hostap_set_multicast_list()
763 local->is_promisc = 0; in hostap_set_multicast_list()
766 schedule_work(&local->set_multicast_list_queue); in hostap_set_multicast_list()
784 local_info_t *local; in prism2_tx_timeout() local
788 local = iface->local; in prism2_tx_timeout()
791 netif_stop_queue(local->dev); in prism2_tx_timeout()
793 local->func->read_regs(dev, ®s); in prism2_tx_timeout()
799 local->func->schedule_reset(local); in prism2_tx_timeout()
851 void hostap_setup_dev(struct net_device *dev, local_info_t *local, in hostap_setup_dev() argument
885 dev->mtu = local->mtu; in hostap_setup_dev()
892 static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) in hostap_enable_hostapd() argument
894 struct net_device *dev = local->dev; in hostap_enable_hostapd()
896 if (local->apdev) in hostap_enable_hostapd()
901 local->apdev = hostap_add_interface(local, HOSTAP_INTERFACE_AP, in hostap_enable_hostapd()
902 rtnl_locked, local->ddev->name, in hostap_enable_hostapd()
904 if (local->apdev == NULL) in hostap_enable_hostapd()
911 static int hostap_disable_hostapd(local_info_t *local, int rtnl_locked) in hostap_disable_hostapd() argument
913 struct net_device *dev = local->dev; in hostap_disable_hostapd()
917 hostap_remove_interface(local->apdev, rtnl_locked, 1); in hostap_disable_hostapd()
918 local->apdev = NULL; in hostap_disable_hostapd()
924 static int hostap_enable_hostapd_sta(local_info_t *local, int rtnl_locked) in hostap_enable_hostapd_sta() argument
926 struct net_device *dev = local->dev; in hostap_enable_hostapd_sta()
928 if (local->stadev) in hostap_enable_hostapd_sta()
933 local->stadev = hostap_add_interface(local, HOSTAP_INTERFACE_STA, in hostap_enable_hostapd_sta()
934 rtnl_locked, local->ddev->name, in hostap_enable_hostapd_sta()
936 if (local->stadev == NULL) in hostap_enable_hostapd_sta()
943 static int hostap_disable_hostapd_sta(local_info_t *local, int rtnl_locked) in hostap_disable_hostapd_sta() argument
945 struct net_device *dev = local->dev; in hostap_disable_hostapd_sta()
949 hostap_remove_interface(local->stadev, rtnl_locked, 1); in hostap_disable_hostapd_sta()
950 local->stadev = NULL; in hostap_disable_hostapd_sta()
956 int hostap_set_hostapd(local_info_t *local, int val, int rtnl_locked) in hostap_set_hostapd() argument
963 if (local->hostapd == val) in hostap_set_hostapd()
967 ret = hostap_enable_hostapd(local, rtnl_locked); in hostap_set_hostapd()
969 local->hostapd = 1; in hostap_set_hostapd()
971 local->hostapd = 0; in hostap_set_hostapd()
972 ret = hostap_disable_hostapd(local, rtnl_locked); in hostap_set_hostapd()
974 local->hostapd = 1; in hostap_set_hostapd()
981 int hostap_set_hostapd_sta(local_info_t *local, int val, int rtnl_locked) in hostap_set_hostapd_sta() argument
988 if (local->hostapd_sta == val) in hostap_set_hostapd_sta()
992 ret = hostap_enable_hostapd_sta(local, rtnl_locked); in hostap_set_hostapd_sta()
994 local->hostapd_sta = 1; in hostap_set_hostapd_sta()
996 local->hostapd_sta = 0; in hostap_set_hostapd_sta()
997 ret = hostap_disable_hostapd_sta(local, rtnl_locked); in hostap_set_hostapd_sta()
999 local->hostapd_sta = 1; in hostap_set_hostapd_sta()
1010 local_info_t *local; in prism2_update_comms_qual() local
1015 local = iface->local; in prism2_update_comms_qual()
1016 if (!local->sta_fw_ver) in prism2_update_comms_qual()
1018 else if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) { in prism2_update_comms_qual()
1019 if (local->func->get_rid(local->dev, in prism2_update_comms_qual()
1022 local->comms_qual = (s16) le16_to_cpu(sq.comm_qual); in prism2_update_comms_qual()
1023 local->avg_signal = (s16) le16_to_cpu(sq.signal_level); in prism2_update_comms_qual()
1024 local->avg_noise = (s16) le16_to_cpu(sq.noise_level); in prism2_update_comms_qual()
1025 local->last_comms_qual_update = jiffies; in prism2_update_comms_qual()
1029 if (local->func->get_rid(local->dev, HFA384X_RID_COMMSQUALITY, in prism2_update_comms_qual()
1031 local->comms_qual = le16_to_cpu(sq.comm_qual); in prism2_update_comms_qual()
1032 local->avg_signal = HFA384X_LEVEL_TO_dBm( in prism2_update_comms_qual()
1034 local->avg_noise = HFA384X_LEVEL_TO_dBm( in prism2_update_comms_qual()
1036 local->last_comms_qual_update = jiffies; in prism2_update_comms_qual()
1045 int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, in prism2_sta_send_mgmt() argument
1051 struct net_device *dev = local->dev; in prism2_sta_send_mgmt()
1081 int prism2_sta_deauth(local_info_t *local, u16 reason) in prism2_sta_deauth() argument
1087 if (local->iw_mode != IW_MODE_INFRA || in prism2_sta_deauth()
1088 memcmp(local->bssid, "\x00\x00\x00\x00\x00\x00", ETH_ALEN) == 0 || in prism2_sta_deauth()
1089 memcmp(local->bssid, "\x44\x44\x44\x44\x44\x44", ETH_ALEN) == 0) in prism2_sta_deauth()
1092 ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH, in prism2_sta_deauth()
1095 wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); in prism2_sta_deauth()