Lines Matching full:local
45 struct net_device * hostap_add_interface(struct local_info *local, in hostap_add_interface() argument
60 iface->local = local; in hostap_add_interface()
62 list_add(&iface->list, &local->hostap_interfaces); in hostap_add_interface()
64 mdev = local->dev; in hostap_add_interface()
71 hostap_setup_dev(dev, local, type); in hostap_add_interface()
112 if (dev == iface->local->ddev) in hostap_remove_interface()
113 iface->local->ddev = NULL; in hostap_remove_interface()
114 else if (dev == iface->local->apdev) in hostap_remove_interface()
115 iface->local->apdev = NULL; in hostap_remove_interface()
116 else if (dev == iface->local->stadev) in hostap_remove_interface()
117 iface->local->stadev = NULL; in hostap_remove_interface()
138 int prism2_wds_add(local_info_t *local, u8 *remote_addr, in prism2_wds_add() argument
146 read_lock_bh(&local->iface_lock); in prism2_wds_add()
147 list_for_each(ptr, &local->hostap_interfaces) { in prism2_wds_add()
162 read_unlock_bh(&local->iface_lock); in prism2_wds_add()
164 local->dev->name, empty->dev->name); in prism2_wds_add()
167 read_unlock_bh(&local->iface_lock); in prism2_wds_add()
172 hostap_add_sta(local->ap, remote_addr); in prism2_wds_add()
175 if (local->wds_connections >= local->wds_max_connections) in prism2_wds_add()
179 if (strlen(local->dev->name) >= IFNAMSIZ - 5) { in prism2_wds_add()
181 local->dev->name); in prism2_wds_add()
185 dev = hostap_add_interface(local, HOSTAP_INTERFACE_WDS, rtnl_locked, in prism2_wds_add()
186 local->ddev->name, "wds%d"); in prism2_wds_add()
193 local->wds_connections++; in prism2_wds_add()
199 int prism2_wds_del(local_info_t *local, u8 *remote_addr, in prism2_wds_del() argument
206 write_lock_irqsave(&local->iface_lock, flags); in prism2_wds_del()
207 list_for_each(ptr, &local->hostap_interfaces) { in prism2_wds_del()
219 write_unlock_irqrestore(&local->iface_lock, flags); in prism2_wds_del()
226 local->wds_connections--; in prism2_wds_del()
234 u16 hostap_tx_callback_register(local_info_t *local, in hostap_tx_callback_register() argument
248 spin_lock_irqsave(&local->lock, flags); in hostap_tx_callback_register()
249 entry->idx = local->tx_callback ? local->tx_callback->idx + 1 : 1; in hostap_tx_callback_register()
250 entry->next = local->tx_callback; in hostap_tx_callback_register()
251 local->tx_callback = entry; in hostap_tx_callback_register()
252 spin_unlock_irqrestore(&local->lock, flags); in hostap_tx_callback_register()
258 int hostap_tx_callback_unregister(local_info_t *local, u16 idx) in hostap_tx_callback_unregister() argument
263 spin_lock_irqsave(&local->lock, flags); in hostap_tx_callback_unregister()
264 cb = local->tx_callback; in hostap_tx_callback_unregister()
271 local->tx_callback = cb->next; in hostap_tx_callback_unregister()
276 spin_unlock_irqrestore(&local->lock, flags); in hostap_tx_callback_unregister()
288 return iface->local->func->set_rid(dev, rid, &tmp, 2); in hostap_set_word()
306 return iface->local->func->set_rid(dev, rid, &buf, MAX_SSID_LEN + 2); in hostap_set_string()
310 u16 hostap_get_porttype(local_info_t *local) in hostap_get_porttype() argument
312 if (local->iw_mode == IW_MODE_ADHOC && local->pseudo_adhoc) in hostap_get_porttype()
314 if (local->iw_mode == IW_MODE_ADHOC) in hostap_get_porttype()
316 if (local->iw_mode == IW_MODE_INFRA) in hostap_get_porttype()
318 if (local->iw_mode == IW_MODE_REPEAT) in hostap_get_porttype()
320 if (local->iw_mode == IW_MODE_MONITOR) in hostap_get_porttype()
326 int hostap_set_encryption(local_info_t *local) in hostap_set_encryption() argument
333 idx = local->crypt_info.tx_keyidx; in hostap_set_encryption()
334 if (local->crypt_info.crypt[idx] == NULL || in hostap_set_encryption()
335 local->crypt_info.crypt[idx]->ops == NULL) in hostap_set_encryption()
337 else if (strcmp(local->crypt_info.crypt[idx]->ops->name, "WEP") == 0) in hostap_set_encryption()
342 if (local->func->get_rid(local->dev, HFA384X_RID_CNFWEPFLAGS, &val, 2, in hostap_set_encryption()
350 if (encrypt_type != NONE || local->privacy_invoked) in hostap_set_encryption()
355 if (local->open_wep || encrypt_type == NONE || in hostap_set_encryption()
356 ((local->ieee_802_1x || local->wpa) && local->host_decrypt)) in hostap_set_encryption()
361 if ((encrypt_type != NONE || local->privacy_invoked) && in hostap_set_encryption()
362 (encrypt_type == OTHER || local->host_encrypt)) in hostap_set_encryption()
366 if ((encrypt_type != NONE || local->privacy_invoked) && in hostap_set_encryption()
367 (encrypt_type == OTHER || local->host_decrypt)) in hostap_set_encryption()
373 hostap_set_word(local->dev, HFA384X_RID_CNFWEPFLAGS, val)) { in hostap_set_encryption()
385 len = local->crypt_info.crypt[idx]->ops->get_key(keybuf, sizeof(keybuf), NULL, in hostap_set_encryption()
386 local->crypt_info.crypt[idx]->priv); in hostap_set_encryption()
392 if (local->crypt_info.crypt[i]) { in hostap_set_encryption()
393 (void) local->crypt_info.crypt[i]->ops->get_key( in hostap_set_encryption()
395 NULL, local->crypt_info.crypt[i]->priv); in hostap_set_encryption()
397 if (local->func->set_rid(local->dev, in hostap_set_encryption()
405 if (hostap_set_word(local->dev, HFA384X_RID_CNFWEPDEFAULTKEYID, idx)) { in hostap_set_encryption()
413 printk(KERN_DEBUG "%s: encryption setup failed\n", local->dev->name); in hostap_set_encryption()
418 int hostap_set_antsel(local_info_t *local) in hostap_set_antsel() argument
423 if (local->antsel_tx != HOSTAP_ANTSEL_DO_NOT_TOUCH && in hostap_set_antsel()
424 local->func->cmd(local->dev, HFA384X_CMDCODE_READMIF, in hostap_set_antsel()
428 switch (local->antsel_tx) { in hostap_set_antsel()
439 if (local->func->cmd(local->dev, HFA384X_CMDCODE_WRITEMIF, in hostap_set_antsel()
442 local->dev->name); in hostap_set_antsel()
447 if (local->antsel_rx != HOSTAP_ANTSEL_DO_NOT_TOUCH && in hostap_set_antsel()
448 local->func->cmd(local->dev, HFA384X_CMDCODE_READMIF, in hostap_set_antsel()
452 switch (local->antsel_rx) { in hostap_set_antsel()
463 if (local->func->cmd(local->dev, HFA384X_CMDCODE_WRITEMIF, in hostap_set_antsel()
466 local->dev->name); in hostap_set_antsel()
475 int hostap_set_roaming(local_info_t *local) in hostap_set_roaming() argument
479 switch (local->host_roaming) { in hostap_set_roaming()
492 return hostap_set_word(local->dev, HFA384X_RID_CNFROAMINGMODE, val); in hostap_set_roaming()
496 int hostap_set_auth_algs(local_info_t *local) in hostap_set_auth_algs() argument
498 int val = local->auth_algs; in hostap_set_auth_algs()
504 if (local->sta_fw_ver < PRISM2_FW_VER(0,7,0) && in hostap_set_auth_algs()
508 if (hostap_set_word(local->dev, HFA384X_RID_CNFAUTHENTICATION, val)) { in hostap_set_auth_algs()
510 "failed\n", local->dev->name, local->auth_algs); in hostap_set_auth_algs()
601 local_info_t *local; in prism2_close() local
606 local = iface->local; in prism2_close()
608 if (dev == local->ddev) { in prism2_close()
609 prism2_sta_deauth(local, WLAN_REASON_DEAUTH_LEAVING); in prism2_close()
612 if (!local->hostapd && dev == local->dev && in prism2_close()
613 (!local->func->card_present || local->func->card_present(local)) && in prism2_close()
614 local->hw_ready && local->ap && local->iw_mode == IW_MODE_MASTER) in prism2_close()
615 hostap_deauth_all_stas(dev, local->ap, 1); in prism2_close()
618 if (dev == local->dev) { in prism2_close()
619 local->func->hw_shutdown(dev, HOSTAP_HW_ENABLE_CMDCOMPL); in prism2_close()
627 cancel_work_sync(&local->reset_queue); in prism2_close()
628 cancel_work_sync(&local->set_multicast_list_queue); in prism2_close()
629 cancel_work_sync(&local->set_tim_queue); in prism2_close()
631 cancel_work_sync(&local->info_queue); in prism2_close()
633 cancel_work_sync(&local->comms_qual_update); in prism2_close()
635 module_put(local->hw_module); in prism2_close()
637 local->num_dev_open--; in prism2_close()
639 if (dev != local->dev && local->dev->flags & IFF_UP && in prism2_close()
640 local->master_dev_auto_open && local->num_dev_open == 1) { in prism2_close()
644 dev_close(local->dev); in prism2_close()
654 local_info_t *local; in prism2_open() local
659 local = iface->local; in prism2_open()
661 if (local->no_pri) { in prism2_open()
667 if ((local->func->card_present && !local->func->card_present(local)) || in prism2_open()
668 local->hw_downloading) in prism2_open()
671 if (!try_module_get(local->hw_module)) in prism2_open()
673 local->num_dev_open++; in prism2_open()
675 if (!local->dev_enabled && local->func->hw_enable(dev, 1)) { in prism2_open()
681 if (!local->dev_enabled) in prism2_open()
682 prism2_callback(local, PRISM2_CALLBACK_ENABLE); in prism2_open()
683 local->dev_enabled = 1; in prism2_open()
685 if (dev != local->dev && !(local->dev->flags & IFF_UP)) { in prism2_open()
688 local->master_dev_auto_open = 1; in prism2_open()
689 dev_open(local->dev, NULL); in prism2_open()
702 local_info_t *local; in prism2_set_mac_address() local
707 local = iface->local; in prism2_set_mac_address()
709 if (local->func->set_rid(dev, HFA384X_RID_CNFOWNMACADDR, addr->sa_data, in prism2_set_mac_address()
710 ETH_ALEN) < 0 || local->func->reset_port(dev)) in prism2_set_mac_address()
713 read_lock_bh(&local->iface_lock); in prism2_set_mac_address()
714 list_for_each(ptr, &local->hostap_interfaces) { in prism2_set_mac_address()
718 eth_hw_addr_set(local->dev, addr->sa_data); in prism2_set_mac_address()
719 read_unlock_bh(&local->iface_lock); in prism2_set_mac_address()
729 local_info_t *local = in hostap_set_multicast_list_queue() local
731 struct net_device *dev = local->dev; in hostap_set_multicast_list_queue()
734 local->is_promisc)) { in hostap_set_multicast_list_queue()
736 dev->name, local->is_promisc ? "en" : "dis"); in hostap_set_multicast_list_queue()
749 local_info_t *local; in hostap_set_multicast_list()
752 local = iface->local; in hostap_set_multicast_list()
754 local->is_promisc = 1; in hostap_set_multicast_list()
756 local->is_promisc = 0; in hostap_set_multicast_list()
759 schedule_work(&local->set_multicast_list_queue); in hostap_set_multicast_list()
767 local_info_t *local; in prism2_tx_timeout() local
771 local = iface->local; in prism2_tx_timeout()
774 netif_stop_queue(local->dev); in prism2_tx_timeout()
776 local->func->read_regs(dev, ®s); in prism2_tx_timeout()
782 local->func->schedule_reset(local); in prism2_tx_timeout()
833 void hostap_setup_dev(struct net_device *dev, local_info_t *local, in hostap_setup_dev() argument
869 dev->mtu = local->mtu; in hostap_setup_dev()
876 static int hostap_enable_hostapd(local_info_t *local, int rtnl_locked) in hostap_enable_hostapd() argument
878 struct net_device *dev = local->dev; in hostap_enable_hostapd()
880 if (local->apdev) in hostap_enable_hostapd()
885 local->apdev = hostap_add_interface(local, HOSTAP_INTERFACE_AP, in hostap_enable_hostapd()
886 rtnl_locked, local->ddev->name, in hostap_enable_hostapd()
888 if (local->apdev == NULL) in hostap_enable_hostapd()
895 static int hostap_disable_hostapd(local_info_t *local, int rtnl_locked) in hostap_disable_hostapd() argument
897 struct net_device *dev = local->dev; in hostap_disable_hostapd()
901 hostap_remove_interface(local->apdev, rtnl_locked, 1); in hostap_disable_hostapd()
902 local->apdev = NULL; in hostap_disable_hostapd()
908 static int hostap_enable_hostapd_sta(local_info_t *local, int rtnl_locked) in hostap_enable_hostapd_sta() argument
910 struct net_device *dev = local->dev; in hostap_enable_hostapd_sta()
912 if (local->stadev) in hostap_enable_hostapd_sta()
917 local->stadev = hostap_add_interface(local, HOSTAP_INTERFACE_STA, in hostap_enable_hostapd_sta()
918 rtnl_locked, local->ddev->name, in hostap_enable_hostapd_sta()
920 if (local->stadev == NULL) in hostap_enable_hostapd_sta()
927 static int hostap_disable_hostapd_sta(local_info_t *local, int rtnl_locked) in hostap_disable_hostapd_sta() argument
929 struct net_device *dev = local->dev; in hostap_disable_hostapd_sta()
933 hostap_remove_interface(local->stadev, rtnl_locked, 1); in hostap_disable_hostapd_sta()
934 local->stadev = NULL; in hostap_disable_hostapd_sta()
940 int hostap_set_hostapd(local_info_t *local, int val, int rtnl_locked) in hostap_set_hostapd() argument
947 if (local->hostapd == val) in hostap_set_hostapd()
951 ret = hostap_enable_hostapd(local, rtnl_locked); in hostap_set_hostapd()
953 local->hostapd = 1; in hostap_set_hostapd()
955 local->hostapd = 0; in hostap_set_hostapd()
956 ret = hostap_disable_hostapd(local, rtnl_locked); in hostap_set_hostapd()
958 local->hostapd = 1; in hostap_set_hostapd()
965 int hostap_set_hostapd_sta(local_info_t *local, int val, int rtnl_locked) in hostap_set_hostapd_sta() argument
972 if (local->hostapd_sta == val) in hostap_set_hostapd_sta()
976 ret = hostap_enable_hostapd_sta(local, rtnl_locked); in hostap_set_hostapd_sta()
978 local->hostapd_sta = 1; in hostap_set_hostapd_sta()
980 local->hostapd_sta = 0; in hostap_set_hostapd_sta()
981 ret = hostap_disable_hostapd_sta(local, rtnl_locked); in hostap_set_hostapd_sta()
983 local->hostapd_sta = 1; in hostap_set_hostapd_sta()
994 local_info_t *local; in prism2_update_comms_qual() local
999 local = iface->local; in prism2_update_comms_qual()
1000 if (!local->sta_fw_ver) in prism2_update_comms_qual()
1002 else if (local->sta_fw_ver >= PRISM2_FW_VER(1,3,1)) { in prism2_update_comms_qual()
1003 if (local->func->get_rid(local->dev, in prism2_update_comms_qual()
1006 local->comms_qual = (s16) le16_to_cpu(sq.comm_qual); in prism2_update_comms_qual()
1007 local->avg_signal = (s16) le16_to_cpu(sq.signal_level); in prism2_update_comms_qual()
1008 local->avg_noise = (s16) le16_to_cpu(sq.noise_level); in prism2_update_comms_qual()
1009 local->last_comms_qual_update = jiffies; in prism2_update_comms_qual()
1013 if (local->func->get_rid(local->dev, HFA384X_RID_COMMSQUALITY, in prism2_update_comms_qual()
1015 local->comms_qual = le16_to_cpu(sq.comm_qual); in prism2_update_comms_qual()
1016 local->avg_signal = HFA384X_LEVEL_TO_dBm( in prism2_update_comms_qual()
1018 local->avg_noise = HFA384X_LEVEL_TO_dBm( in prism2_update_comms_qual()
1020 local->last_comms_qual_update = jiffies; in prism2_update_comms_qual()
1029 int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, in prism2_sta_send_mgmt() argument
1035 struct net_device *dev = local->dev; in prism2_sta_send_mgmt()
1063 int prism2_sta_deauth(local_info_t *local, u16 reason) in prism2_sta_deauth() argument
1069 if (local->iw_mode != IW_MODE_INFRA || in prism2_sta_deauth()
1070 is_zero_ether_addr(local->bssid) || in prism2_sta_deauth()
1071 ether_addr_equal(local->bssid, "\x44\x44\x44\x44\x44\x44")) in prism2_sta_deauth()
1074 ret = prism2_sta_send_mgmt(local, local->bssid, IEEE80211_STYPE_DEAUTH, in prism2_sta_deauth()
1077 wireless_send_event(local->dev, SIOCGIWAP, &wrqu, NULL); in prism2_sta_deauth()