diff options
Diffstat (limited to 'drivers/staging/ath6kl/os/linux/cfg80211.c')
-rw-r--r-- | drivers/staging/ath6kl/os/linux/cfg80211.c | 311 |
1 files changed, 165 insertions, 146 deletions
diff --git a/drivers/staging/ath6kl/os/linux/cfg80211.c b/drivers/staging/ath6kl/os/linux/cfg80211.c index 7269d0a1d618..bcca39418f90 100644 --- a/drivers/staging/ath6kl/os/linux/cfg80211.c +++ b/drivers/staging/ath6kl/os/linux/cfg80211.c @@ -136,7 +136,7 @@ ieee80211_supported_band ar6k_band_5ghz = { }; static int -ar6k_set_wpa_version(AR_SOFTC_T *ar, enum nl80211_wpa_versions wpa_version) +ar6k_set_wpa_version(struct ar6_softc *ar, enum nl80211_wpa_versions wpa_version) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: %u\n", __func__, wpa_version)); @@ -153,11 +153,11 @@ ar6k_set_wpa_version(AR_SOFTC_T *ar, enum nl80211_wpa_versions wpa_version) return -ENOTSUPP; } - return A_OK; + return 0; } static int -ar6k_set_auth_type(AR_SOFTC_T *ar, enum nl80211_auth_type auth_type) +ar6k_set_auth_type(struct ar6_softc *ar, enum nl80211_auth_type auth_type) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: 0x%x\n", __func__, auth_type)); @@ -179,15 +179,15 @@ ar6k_set_auth_type(AR_SOFTC_T *ar, enum nl80211_auth_type auth_type) return -ENOTSUPP; } - return A_OK; + return 0; } static int -ar6k_set_cipher(AR_SOFTC_T *ar, A_UINT32 cipher, A_BOOL ucast) +ar6k_set_cipher(struct ar6_softc *ar, u32 cipher, bool ucast) { - A_UINT8 *ar_cipher = ucast ? &ar->arPairwiseCrypto : + u8 *ar_cipher = ucast ? &ar->arPairwiseCrypto : &ar->arGroupCrypto; - A_UINT8 *ar_cipher_len = ucast ? &ar->arPairwiseCryptoLen : + u8 *ar_cipher_len = ucast ? &ar->arPairwiseCryptoLen : &ar->arGroupCryptoLen; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, @@ -221,11 +221,11 @@ ar6k_set_cipher(AR_SOFTC_T *ar, A_UINT32 cipher, A_BOOL ucast) return -ENOTSUPP; } - return A_OK; + return 0; } static void -ar6k_set_key_mgmt(AR_SOFTC_T *ar, A_UINT32 key_mgmt) +ar6k_set_key_mgmt(struct ar6_softc *ar, u32 key_mgmt) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: 0x%x\n", __func__, key_mgmt)); @@ -244,12 +244,13 @@ static int ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_connect_params *sme) { - AR_SOFTC_T *ar = ar6k_priv(dev); - A_STATUS status; + struct ar6_softc *ar = ar6k_priv(dev); + int status; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); + ar->smeState = SME_CONNECTING; - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready yet\n", __func__)); return -EIO; } @@ -269,7 +270,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, return -EINVAL; } - if(ar->arSkipScan == TRUE && + if(ar->arSkipScan == true && ((sme->channel && sme->channel->center_freq == 0) || (sme->bssid && !sme->bssid[0] && !sme->bssid[1] && !sme->bssid[2] && !sme->bssid[3] && !sme->bssid[4] && !sme->bssid[5]))) @@ -302,28 +303,28 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, } } - if(ar->arConnected == TRUE && + if(ar->arConnected == true && ar->arSsidLen == sme->ssid_len && - !A_MEMCMP(ar->arSsid, sme->ssid, ar->arSsidLen)) { - reconnect_flag = TRUE; + !memcmp(ar->arSsid, sme->ssid, ar->arSsidLen)) { + reconnect_flag = true; status = wmi_reconnect_cmd(ar->arWmi, ar->arReqBssid, ar->arChannelHint); up(&ar->arSem); - if (status != A_OK) { + if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_reconnect_cmd failed\n", __func__)); return -EIO; } return 0; } else if(ar->arSsidLen == sme->ssid_len && - !A_MEMCMP(ar->arSsid, sme->ssid, ar->arSsidLen)) { - wmi_disconnect_cmd(ar->arWmi); + !memcmp(ar->arSsid, sme->ssid, ar->arSsidLen)) { + ar6000_disconnect(ar); } A_MEMZERO(ar->arSsid, sizeof(ar->arSsid)); ar->arSsidLen = sme->ssid_len; - A_MEMCPY(ar->arSsid, sme->ssid, sme->ssid_len); + memcpy(ar->arSsid, sme->ssid, sme->ssid_len); if(sme->channel){ ar->arChannelHint = sme->channel->center_freq; @@ -331,8 +332,8 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid)); if(sme->bssid){ - if(A_MEMCMP(&sme->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) { - A_MEMCPY(ar->arReqBssid, sme->bssid, sizeof(ar->arReqBssid)); + if(memcmp(&sme->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) { + memcpy(ar->arReqBssid, sme->bssid, sizeof(ar->arReqBssid)); } } @@ -364,7 +365,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, key = &ar->keys[sme->key_idx]; key->key_len = sme->key_len; - A_MEMCPY(key->key, sme->key, key->key_len); + memcpy(key->key, sme->key, key->key_len); key->cipher = ar->arPairwiseCrypto; ar->arDefTxKeyIndex = sme->key_idx; @@ -378,7 +379,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, } if (!ar->arUserBssFilter) { - if (wmi_bssfilter_cmd(ar->arWmi, ALL_BSS_FILTER, 0) != A_OK) { + if (wmi_bssfilter_cmd(ar->arWmi, ALL_BSS_FILTER, 0) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Couldn't set bss filtering\n", __func__)); up(&ar->arSem); return -EIO; @@ -410,7 +411,7 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, ar->arSsidLen = 0; AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Invalid request\n", __func__)); return -ENOENT; - } else if (status != A_OK) { + } else if (status) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_connect_cmd failed\n", __func__)); return -EIO; } @@ -422,37 +423,37 @@ ar6k_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, } ar->arConnectCtrlFlags &= ~CONNECT_DO_WPA_OFFLOAD; - ar->arConnectPending = TRUE; + ar->arConnectPending = true; return 0; } void -ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, - A_UINT8 *bssid, A_UINT16 listenInterval, - A_UINT16 beaconInterval,NETWORK_TYPE networkType, - A_UINT8 beaconIeLen, A_UINT8 assocReqLen, - A_UINT8 assocRespLen, A_UINT8 *assocInfo) +ar6k_cfg80211_connect_event(struct ar6_softc *ar, u16 channel, + u8 *bssid, u16 listenInterval, + u16 beaconInterval,NETWORK_TYPE networkType, + u8 beaconIeLen, u8 assocReqLen, + u8 assocRespLen, u8 *assocInfo) { - A_UINT16 size = 0; - A_UINT16 capability = 0; + u16 size = 0; + u16 capability = 0; struct cfg80211_bss *bss = NULL; struct ieee80211_mgmt *mgmt = NULL; struct ieee80211_channel *ibss_channel = NULL; s32 signal = 50 * 100; - A_UINT8 ie_buf_len = 0; + u8 ie_buf_len = 0; unsigned char ie_buf[256]; unsigned char *ptr_ie_buf = ie_buf; unsigned char *ieeemgmtbuf = NULL; - A_UINT8 source_mac[ATH_MAC_LEN]; + u8 source_mac[ATH_MAC_LEN]; - A_UINT8 assocReqIeOffset = sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16); /* listen interval */ - A_UINT8 assocRespIeOffset = sizeof(A_UINT16) + /* capinfo*/ - sizeof(A_UINT16) + /* status Code */ - sizeof(A_UINT16); /* associd */ - A_UINT8 *assocReqIe = assocInfo + beaconIeLen + assocReqIeOffset; - A_UINT8 *assocRespIe = assocInfo + beaconIeLen + assocReqLen + assocRespIeOffset; + u8 assocReqIeOffset = sizeof(u16) + /* capinfo*/ + sizeof(u16); /* listen interval */ + u8 assocRespIeOffset = sizeof(u16) + /* capinfo*/ + sizeof(u16) + /* status Code */ + sizeof(u16); /* associd */ + u8 *assocReqIe = assocInfo + beaconIeLen + assocReqIeOffset; + u8 *assocRespIe = assocInfo + beaconIeLen + assocReqLen + assocRespIeOffset; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); @@ -492,7 +493,7 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, if(ptr_ie_buf) { *ptr_ie_buf++ = WLAN_EID_SSID; *ptr_ie_buf++ = ar->arSsidLen; - A_MEMCPY(ptr_ie_buf, ar->arSsid, ar->arSsidLen); + memcpy(ptr_ie_buf, ar->arSsid, ar->arSsidLen); ptr_ie_buf +=ar->arSsidLen; *ptr_ie_buf++ = WLAN_EID_IBSS_PARAMS; @@ -510,11 +511,11 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, if(WEP_CRYPT == ar->arPairwiseCrypto) { capability |= IEEE80211_CAPINFO_PRIVACY; } - A_MEMCPY(source_mac, ar->arNetDev->dev_addr, ATH_MAC_LEN); + memcpy(source_mac, ar->arNetDev->dev_addr, ATH_MAC_LEN); ptr_ie_buf = ie_buf; } else { - capability = *(A_UINT16 *)(&assocInfo[beaconIeLen]); - A_MEMCPY(source_mac, bssid, ATH_MAC_LEN); + capability = *(u16 *)(&assocInfo[beaconIeLen]); + memcpy(source_mac, bssid, ATH_MAC_LEN); ptr_ie_buf = assocReqIe; ie_buf_len = assocReqLen; } @@ -533,12 +534,12 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, A_MEMZERO(ieeemgmtbuf, size); mgmt = (struct ieee80211_mgmt *)ieeemgmtbuf; mgmt->frame_control = (IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); - A_MEMCPY(mgmt->da, bcast_mac, ATH_MAC_LEN); - A_MEMCPY(mgmt->sa, source_mac, ATH_MAC_LEN); - A_MEMCPY(mgmt->bssid, bssid, ATH_MAC_LEN); + memcpy(mgmt->da, bcast_mac, ATH_MAC_LEN); + memcpy(mgmt->sa, source_mac, ATH_MAC_LEN); + memcpy(mgmt->bssid, bssid, ATH_MAC_LEN); mgmt->u.beacon.beacon_int = beaconInterval; mgmt->u.beacon.capab_info = capability; - A_MEMCPY(mgmt->u.beacon.variable, ptr_ie_buf, ie_buf_len); + memcpy(mgmt->u.beacon.variable, ptr_ie_buf, ie_buf_len); ibss_channel = ieee80211_get_channel(ar->wdev->wiphy, (int)channel); @@ -560,8 +561,9 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, return; } - if (FALSE == ar->arConnected) { + if (false == ar->arConnected) { /* inform connect result to cfg80211 */ + ar->smeState = SME_DISCONNECTED; cfg80211_connect_result(ar->arNetDev, bssid, assocReqIe, assocReqLen, assocRespIe, assocRespLen, @@ -577,13 +579,13 @@ ar6k_cfg80211_connect_event(AR_SOFTC_T *ar, A_UINT16 channel, static int ar6k_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, - A_UINT16 reason_code) + u16 reason_code) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: reason=%u\n", __func__, reason_code)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -604,11 +606,11 @@ ar6k_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, } reconnect_flag = 0; - wmi_disconnect_cmd(ar->arWmi); + ar6000_disconnect(ar); A_MEMZERO(ar->arSsid, sizeof(ar->arSsid)); ar->arSsidLen = 0; - if (ar->arSkipScan == FALSE) { + if (ar->arSkipScan == false) { A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid)); } @@ -618,9 +620,9 @@ ar6k_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, } void -ar6k_cfg80211_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, - A_UINT8 *bssid, A_UINT8 assocRespLen, - A_UINT8 *assocInfo, A_UINT16 protocolReasonStatus) +ar6k_cfg80211_disconnect_event(struct ar6_softc *ar, u8 reason, + u8 *bssid, u8 assocRespLen, + u8 *assocInfo, u16 protocolReasonStatus) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: reason=%u\n", __func__, reason)); @@ -644,18 +646,28 @@ ar6k_cfg80211_disconnect_event(AR_SOFTC_T *ar, A_UINT8 reason, } } - if(FALSE == ar->arConnected) { + if(true == ar->arConnectPending) { if(NO_NETWORK_AVAIL == reason) { /* connect cmd failed */ - cfg80211_connect_result(ar->arNetDev, bssid, - NULL, 0, - NULL, 0, - WLAN_STATUS_UNSPECIFIED_FAILURE, - GFP_KERNEL); + wmi_disconnect_cmd(ar->arWmi); + } else if (reason == DISCONNECT_CMD) { + /* connection loss due to disconnect cmd or low rssi */ + ar->arConnectPending = false; + if (ar->smeState == SME_CONNECTING) { + cfg80211_connect_result(ar->arNetDev, bssid, + NULL, 0, + NULL, 0, + WLAN_STATUS_UNSPECIFIED_FAILURE, + GFP_KERNEL); + } else { + cfg80211_disconnected(ar->arNetDev, reason, NULL, 0, GFP_KERNEL); + } + ar->smeState = SME_DISCONNECTED; } } else { - /* connection loss due to disconnect cmd or low rssi */ - cfg80211_disconnected(ar->arNetDev, reason, NULL, 0, GFP_KERNEL); + if (reason != DISCONNECT_CMD) { + wmi_disconnect_cmd(ar->arWmi); + } } } @@ -663,7 +675,7 @@ void ar6k_cfg80211_scan_node(void *arg, bss_t *ni) { struct wiphy *wiphy = (struct wiphy *)arg; - A_UINT16 size; + u16 size; unsigned char *ieeemgmtbuf = NULL; struct ieee80211_mgmt *mgmt; struct ieee80211_channel *channel; @@ -700,10 +712,10 @@ ar6k_cfg80211_scan_node(void *arg, bss_t *ni) cfg80211 needs it, for time being just filling the da, sa and bssid fields alone. */ mgmt = (struct ieee80211_mgmt *)ieeemgmtbuf; - A_MEMCPY(mgmt->da, bcast_mac, ATH_MAC_LEN); - A_MEMCPY(mgmt->sa, ni->ni_macaddr, ATH_MAC_LEN); - A_MEMCPY(mgmt->bssid, ni->ni_macaddr, ATH_MAC_LEN); - A_MEMCPY(ieeemgmtbuf + offsetof(struct ieee80211_mgmt, u), + memcpy(mgmt->da, bcast_mac, ATH_MAC_LEN); + memcpy(mgmt->sa, ni->ni_macaddr, ATH_MAC_LEN); + memcpy(mgmt->bssid, ni->ni_macaddr, ATH_MAC_LEN); + memcpy(ieeemgmtbuf + offsetof(struct ieee80211_mgmt, u), ni->ni_buf, ni->ni_framelen); freq = cie->ie_chan; @@ -724,13 +736,13 @@ static int ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_scan_request *request) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev); int ret = 0; - A_BOOL forceFgScan = FALSE; + u32 forceFgScan = 0; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -743,7 +755,7 @@ ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, if (!ar->arUserBssFilter) { if (wmi_bssfilter_cmd(ar->arWmi, (ar->arConnected ? ALL_BUT_BSS_FILTER : ALL_BSS_FILTER), - 0) != A_OK) { + 0) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Couldn't set bss filtering\n", __func__)); return -EIO; } @@ -751,25 +763,25 @@ ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, if(request->n_ssids && request->ssids[0].ssid_len) { - A_UINT8 i; + u8 i; - if(request->n_ssids > MAX_PROBED_SSID_INDEX) { - request->n_ssids = MAX_PROBED_SSID_INDEX; + if(request->n_ssids > (MAX_PROBED_SSID_INDEX - 1)) { + request->n_ssids = MAX_PROBED_SSID_INDEX - 1; } for (i = 0; i < request->n_ssids; i++) { - wmi_probedSsid_cmd(ar->arWmi, i, SPECIFIC_SSID_FLAG, + wmi_probedSsid_cmd(ar->arWmi, i+1, SPECIFIC_SSID_FLAG, request->ssids[i].ssid_len, request->ssids[i].ssid); } } if(ar->arConnected) { - forceFgScan = TRUE; + forceFgScan = 1; } - if(wmi_startscan_cmd(ar->arWmi, WMI_LONG_SCAN, forceFgScan, FALSE, \ - 0, 0, 0, NULL) != A_OK) { + if(wmi_startscan_cmd(ar->arWmi, WMI_LONG_SCAN, forceFgScan, false, \ + 0, 0, 0, NULL) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_startscan_cmd failed\n", __func__)); ret = -EIO; } @@ -780,7 +792,7 @@ ar6k_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, } void -ar6k_cfg80211_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status) +ar6k_cfg80211_scanComplete_event(struct ar6_softc *ar, int status) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: status %d\n", __func__, status)); @@ -791,14 +803,14 @@ ar6k_cfg80211_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status) wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy); cfg80211_scan_done(ar->scan_request, - (status & A_ECANCELED) ? true : false); + ((status & A_ECANCELED) || (status & A_EBUSY)) ? true : false); if(ar->scan_request->n_ssids && ar->scan_request->ssids[0].ssid_len) { - A_UINT8 i; + u8 i; for (i = 0; i < ar->scan_request->n_ssids; i++) { - wmi_probedSsid_cmd(ar->arWmi, i, DISABLE_SSID_FLAG, + wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG, 0, NULL); } } @@ -808,18 +820,18 @@ ar6k_cfg80211_scanComplete_event(AR_SOFTC_T *ar, A_STATUS status) static int ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr, + u8 key_index, bool pairwise, const u8 *mac_addr, struct key_params *params) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev); struct ar_key *key = NULL; - A_UINT8 key_usage; - A_UINT8 key_type; - A_STATUS status = 0; + u8 key_usage; + u8 key_type; + int status = 0; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s:\n", __func__)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -850,9 +862,9 @@ ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, return -EINVAL; key->key_len = params->key_len; - A_MEMCPY(key->key, params->key, key->key_len); + memcpy(key->key, params->key, key->key_len); key->seq_len = params->seq_len; - A_MEMCPY(key->seq, params->seq, key->seq_len); + memcpy(key->seq, params->seq, key->seq_len); key->cipher = params->cipher; } @@ -889,10 +901,10 @@ ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, ar->arDefTxKeyIndex = key_index; status = wmi_addKey_cmd(ar->arWmi, ar->arDefTxKeyIndex, key_type, key_usage, key->key_len, key->seq, key->key, KEY_OP_INIT_VAL, - (A_UINT8*)mac_addr, SYNC_BOTH_WMIFLAG); + (u8 *)mac_addr, SYNC_BOTH_WMIFLAG); - if(status != A_OK) { + if (status) { return -EIO; } @@ -901,13 +913,13 @@ ar6k_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, static int ar6k_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr) + u8 key_index, bool pairwise, const u8 *mac_addr) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -936,17 +948,17 @@ ar6k_cfg80211_del_key(struct wiphy *wiphy, struct net_device *ndev, static int ar6k_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index, bool pairwise, const A_UINT8 *mac_addr, + u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie, void (*callback)(void *cookie, struct key_params*)) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev); struct ar_key *key = NULL; struct key_params params; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -978,15 +990,16 @@ ar6k_cfg80211_get_key(struct wiphy *wiphy, struct net_device *ndev, static int ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index) + u8 key_index, bool unicast, bool multicast) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev); struct ar_key *key = NULL; - A_STATUS status = A_OK; + int status = 0; + u8 key_usage; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1011,11 +1024,16 @@ ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev, ar->arDefTxKeyIndex = key_index; key = &ar->keys[ar->arDefTxKeyIndex]; + key_usage = GROUP_USAGE; + if (WEP_CRYPT == ar->arPairwiseCrypto) { + key_usage |= TX_USAGE; + } + status = wmi_addKey_cmd(ar->arWmi, ar->arDefTxKeyIndex, - ar->arPairwiseCrypto, GROUP_USAGE | TX_USAGE, + ar->arPairwiseCrypto, key_usage, key->key_len, key->seq, key->key, KEY_OP_INIT_VAL, NULL, SYNC_BOTH_WMIFLAG); - if (status != A_OK) { + if (status) { return -EIO; } @@ -1024,13 +1042,13 @@ ar6k_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *ndev, static int ar6k_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, struct net_device *ndev, - A_UINT8 key_index) + u8 key_index) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(ndev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(ndev); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: index %d\n", __func__, key_index)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1045,7 +1063,7 @@ ar6k_cfg80211_set_default_mgmt_key(struct wiphy *wiphy, struct net_device *ndev, } void -ar6k_cfg80211_tkip_micerr_event(AR_SOFTC_T *ar, A_UINT8 keyid, A_BOOL ismcast) +ar6k_cfg80211_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast) { AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: keyid %d, ismcast %d\n", __func__, keyid, ismcast)); @@ -1056,13 +1074,13 @@ ar6k_cfg80211_tkip_micerr_event(AR_SOFTC_T *ar, A_UINT8 keyid, A_BOOL ismcast) } static int -ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, A_UINT32 changed) +ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)wiphy_priv(wiphy); + struct ar6_softc *ar = (struct ar6_softc *)wiphy_priv(wiphy); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: changed 0x%x\n", __func__, changed)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1073,7 +1091,7 @@ ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, A_UINT32 changed) } if (changed & WIPHY_PARAM_RTS_THRESHOLD) { - if (wmi_set_rts_cmd(ar->arWmi,wiphy->rts_threshold) != A_OK){ + if (wmi_set_rts_cmd(ar->arWmi,wiphy->rts_threshold) != 0){ AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_set_rts_cmd failed\n", __func__)); return -EIO; } @@ -1084,7 +1102,7 @@ ar6k_cfg80211_set_wiphy_params(struct wiphy *wiphy, A_UINT32 changed) static int ar6k_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, - const A_UINT8 *peer, + const u8 *peer, const struct cfg80211_bitrate_mask *mask) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Setting rates: Not supported\n")); @@ -1095,12 +1113,12 @@ ar6k_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, static int ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum nl80211_tx_power_setting type, int dbm) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)wiphy_priv(wiphy); - A_UINT8 ar_dbm; + struct ar6_softc *ar = (struct ar6_softc *)wiphy_priv(wiphy); + u8 ar_dbm; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type 0x%x, dbm %d\n", __func__, type, dbm)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1110,13 +1128,13 @@ ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum nl80211_tx_power_setting typ return -EIO; } - ar->arTxPwrSet = FALSE; + ar->arTxPwrSet = false; switch(type) { case NL80211_TX_POWER_AUTOMATIC: return 0; case NL80211_TX_POWER_LIMITED: ar->arTxPwr = ar_dbm = dbm; - ar->arTxPwrSet = TRUE; + ar->arTxPwrSet = true; break; default: AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type 0x%x not supported\n", __func__, type)); @@ -1131,11 +1149,11 @@ ar6k_cfg80211_set_txpower(struct wiphy *wiphy, enum nl80211_tx_power_setting typ static int ar6k_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)wiphy_priv(wiphy); + struct ar6_softc *ar = (struct ar6_softc *)wiphy_priv(wiphy); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1145,10 +1163,10 @@ ar6k_cfg80211_get_txpower(struct wiphy *wiphy, int *dbm) return -EIO; } - if((ar->arConnected == TRUE)) { + if((ar->arConnected == true)) { ar->arTxPwr = 0; - if(wmi_get_txPwr_cmd(ar->arWmi) != A_OK) { + if(wmi_get_txPwr_cmd(ar->arWmi) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_get_txPwr_cmd failed\n", __func__)); return -EIO; } @@ -1170,12 +1188,12 @@ ar6k_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, bool pmgmt, int timeout) { - AR_SOFTC_T *ar = ar6k_priv(dev); + struct ar6_softc *ar = ar6k_priv(dev); WMI_POWER_MODE_CMD pwrMode; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: pmgmt %d, timeout %d\n", __func__, pmgmt, timeout)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1193,7 +1211,7 @@ ar6k_cfg80211_set_power_mgmt(struct wiphy *wiphy, pwrMode.powerMode = REC_POWER; } - if(wmi_powermode_cmd(ar->arWmi, pwrMode.powerMode) != A_OK) { + if(wmi_powermode_cmd(ar->arWmi, pwrMode.powerMode) != 0) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wmi_powermode_cmd failed\n", __func__)); return -EIO; } @@ -1201,7 +1219,7 @@ ar6k_cfg80211_set_power_mgmt(struct wiphy *wiphy, return 0; } -static int +static struct net_device * ar6k_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name, enum nl80211_iftype type, u32 *flags, struct vif_params *params) @@ -1212,7 +1230,7 @@ ar6k_cfg80211_add_virtual_intf(struct wiphy *wiphy, char *name, /* Multiple virtual interface is not supported. * The default interface supports STA and IBSS type */ - return -EOPNOTSUPP; + return ERR_PTR(-EOPNOTSUPP); } static int @@ -1232,12 +1250,12 @@ ar6k_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { - AR_SOFTC_T *ar = ar6k_priv(ndev); + struct ar6_softc *ar = ar6k_priv(ndev); struct wireless_dev *wdev = ar->wdev; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: type %u\n", __func__, type)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1268,12 +1286,12 @@ static int ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ibss_params *ibss_param) { - AR_SOFTC_T *ar = ar6k_priv(dev); - A_STATUS status; + struct ar6_softc *ar = ar6k_priv(dev); + int status; AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1289,7 +1307,7 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, } ar->arSsidLen = ibss_param->ssid_len; - A_MEMCPY(ar->arSsid, ibss_param->ssid, ar->arSsidLen); + memcpy(ar->arSsid, ibss_param->ssid, ar->arSsidLen); if(ibss_param->channel) { ar->arChannelHint = ibss_param->channel->center_freq; @@ -1303,8 +1321,8 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, A_MEMZERO(ar->arReqBssid, sizeof(ar->arReqBssid)); if(ibss_param->bssid) { - if(A_MEMCMP(&ibss_param->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) { - A_MEMCPY(ar->arReqBssid, ibss_param->bssid, sizeof(ar->arReqBssid)); + if(memcmp(&ibss_param->bssid, bcast_mac, AR6000_ETH_ADDR_LEN)) { + memcpy(ar->arReqBssid, ibss_param->bssid, sizeof(ar->arReqBssid)); } } @@ -1335,6 +1353,7 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, ar->arSsidLen, ar->arSsid, ar->arReqBssid, ar->arChannelHint, ar->arConnectCtrlFlags); + ar->arConnectPending = true; return 0; } @@ -1342,11 +1361,11 @@ ar6k_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, static int ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) { - AR_SOFTC_T *ar = (AR_SOFTC_T *)ar6k_priv(dev); + struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__)); - if(ar->arWmiReady == FALSE) { + if(ar->arWmiReady == false) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Wmi not ready\n", __func__)); return -EIO; } @@ -1356,7 +1375,7 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) return -EIO; } - wmi_disconnect_cmd(ar->arWmi); + ar6000_disconnect(ar); A_MEMZERO(ar->arSsid, sizeof(ar->arSsid)); ar->arSsidLen = 0; @@ -1365,7 +1384,7 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) static const -A_UINT32 cipher_suites[] = { +u32 cipher_suites[] = { WLAN_CIPHER_SUITE_WEP40, WLAN_CIPHER_SUITE_WEP104, WLAN_CIPHER_SUITE_TKIP, @@ -1410,7 +1429,7 @@ ar6k_cfg80211_init(struct device *dev) } /* create a new wiphy for use with cfg80211 */ - wdev->wiphy = wiphy_new(&ar6k_cfg80211_ops, sizeof(AR_SOFTC_T)); + wdev->wiphy = wiphy_new(&ar6k_cfg80211_ops, sizeof(struct ar6_softc)); if(!wdev->wiphy) { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: Couldn't allocate wiphy device\n", __func__)); @@ -1444,7 +1463,7 @@ ar6k_cfg80211_init(struct device *dev) } void -ar6k_cfg80211_deinit(AR_SOFTC_T *ar) +ar6k_cfg80211_deinit(struct ar6_softc *ar) { struct wireless_dev *wdev = ar->wdev; |