void prism2_roamed(wlandevice_t *wlandev) { cfg80211_roamed(wlandev->netdev, NULL, wlandev->bssid, NULL, 0, NULL, 0, GFP_KERNEL); }
void prism2_roamed(struct wlandevice *wlandev) { struct cfg80211_roam_info roam_info = { .bssid = wlandev->bssid, }; cfg80211_roamed(wlandev->netdev, &roam_info, GFP_KERNEL); } /* Structures for declaring wiphy interface */ static const struct cfg80211_ops prism2_usb_cfg_ops = { .change_virtual_intf = prism2_change_virtual_intf, .add_key = prism2_add_key, .get_key = prism2_get_key, .del_key = prism2_del_key, .set_default_key = prism2_set_default_key, .get_station = prism2_get_station, .scan = prism2_scan, .set_wiphy_params = prism2_set_wiphy_params, .connect = prism2_connect, .disconnect = prism2_disconnect, .join_ibss = prism2_join_ibss, .leave_ibss = prism2_leave_ibss, .set_tx_power = prism2_set_tx_power, .get_tx_power = prism2_get_tx_power, }; /* Functions to create/free wiphy interface */ static struct wiphy *wlan_create_wiphy(struct device *dev, struct wlandevice *wlandev) { struct wiphy *wiphy; struct prism2_wiphy_private *priv; wiphy = wiphy_new(&prism2_usb_cfg_ops, sizeof(*priv)); if (!wiphy) return NULL; priv = wiphy_priv(wiphy); priv->wlandev = wlandev; memcpy(priv->channels, prism2_channels, sizeof(prism2_channels)); memcpy(priv->rates, prism2_rates, sizeof(prism2_rates)); priv->band.channels = priv->channels; priv->band.n_channels = ARRAY_SIZE(prism2_channels); priv->band.bitrates = priv->rates; priv->band.n_bitrates = ARRAY_SIZE(prism2_rates); priv->band.band = NL80211_BAND_2GHZ; priv->band.ht_cap.ht_supported = false; wiphy->bands[NL80211_BAND_2GHZ] = &priv->band; set_wiphy_dev(wiphy, dev); wiphy->privid = prism2_wiphy_privid; wiphy->max_scan_ssids = 1; wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; wiphy->n_cipher_suites = PRISM2_NUM_CIPHER_SUITES; wiphy->cipher_suites = prism2_cipher_suites; if (wiphy_register(wiphy) < 0) { wiphy_free(wiphy); return NULL; } return wiphy; } static void wlan_free_wiphy(struct wiphy *wiphy) { wiphy_unregister(wiphy); wiphy_free(wiphy); }
void ath6kl_cfg80211_connect_event(struct ath6kl *ar, u16 channel, u8 *bssid, u16 listen_intvl, u16 beacon_intvl, enum network_type nw_type, u8 beacon_ie_len, u8 assoc_req_len, u8 assoc_resp_len, u8 *assoc_info) { struct ieee80211_channel *chan; /* capinfo + listen interval */ u8 assoc_req_ie_offset = sizeof(u16) + sizeof(u16); /* capinfo + status code + associd */ u8 assoc_resp_ie_offset = sizeof(u16) + sizeof(u16) + sizeof(u16); u8 *assoc_req_ie = assoc_info + beacon_ie_len + assoc_req_ie_offset; u8 *assoc_resp_ie = assoc_info + beacon_ie_len + assoc_req_len + assoc_resp_ie_offset; assoc_req_len -= assoc_req_ie_offset; assoc_resp_len -= assoc_resp_ie_offset; /* * Store Beacon interval here; DTIM period will be available only once * a Beacon frame from the AP is seen. */ ar->assoc_bss_beacon_int = beacon_intvl; clear_bit(DTIM_PERIOD_AVAIL, &ar->flag); if (nw_type & ADHOC_NETWORK) { if (ar->wdev->iftype != NL80211_IFTYPE_ADHOC) { ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: ath6k not in ibss mode\n", __func__); return; } } if (nw_type & INFRA_NETWORK) { if (ar->wdev->iftype != NL80211_IFTYPE_STATION && ar->wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) { ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: ath6k not in station mode\n", __func__); return; } } chan = ieee80211_get_channel(ar->wdev->wiphy, (int) channel); if (nw_type & ADHOC_NETWORK) { cfg80211_ibss_joined(ar->net_dev, bssid, GFP_KERNEL); return; } if (ath6kl_add_bss_if_needed(ar, bssid, chan, assoc_info, beacon_ie_len) < 0) { ath6kl_err("could not add cfg80211 bss entry for " "connect/roamed notification\n"); return; } if (ar->sme_state == SME_CONNECTING) { /* inform connect result to cfg80211 */ ar->sme_state = SME_CONNECTED; cfg80211_connect_result(ar->net_dev, bssid, assoc_req_ie, assoc_req_len, assoc_resp_ie, assoc_resp_len, WLAN_STATUS_SUCCESS, GFP_KERNEL); } else if (ar->sme_state == SME_CONNECTED) { /* inform roam event to cfg80211 */ cfg80211_roamed(ar->net_dev, chan, bssid, assoc_req_ie, assoc_req_len, assoc_resp_ie, assoc_resp_len, GFP_KERNEL); } }