From 7b59aa12dbab86bd8d48485edeb1a9fd6ac3b979 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Fri, 2 Aug 2013 12:12:37 -0500 Subject: [PATCH] rtl8188eu: Fix checkpatch errors in core/rtw_wlan_util.c Signed-off-by: Larry Finger --- core/rtw_wlan_util.c | 1235 +++++++++++++++------------------------ include/osdep_service.h | 82 +-- 2 files changed, 512 insertions(+), 805 deletions(-) diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 85ee7ca..f0eb7d6 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -23,7 +23,6 @@ #include #include - static unsigned char ARTHEROS_OUI1[] = {0x00, 0x03, 0x7f}; static unsigned char ARTHEROS_OUI2[] = {0x00, 0x13, 0x74}; @@ -40,12 +39,6 @@ static unsigned char EPIGRAM_OUI[] = {0x00, 0x90, 0x4c}; unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20}; -extern unsigned char MCS_rate_2R[16]; -extern unsigned char MCS_rate_1R[16]; -extern unsigned char RTW_WPA_OUI[]; -extern unsigned char WPA_TKIP_CIPHER[4]; -extern unsigned char RSN_TKIP_CIPHER[4]; - #define R2T_PHY_DELAY (0) /* define WAIT_FOR_BCN_TO_M (3000) */ @@ -69,30 +62,25 @@ static u8 rtw_basic_rate_mix[7] = { IEEE80211_OFDM_RATE_24MB|IEEE80211_BASIC_RATE_MASK }; - int cckrates_included(unsigned char *rate, int ratelen) { int i; - for (i = 0; i < ratelen; i++) - { - if ( (((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || - (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22) ) - return true; + for (i = 0; i < ratelen; i++) { + if ((((rate[i]) & 0x7f) == 2) || (((rate[i]) & 0x7f) == 4) || + (((rate[i]) & 0x7f) == 11) || (((rate[i]) & 0x7f) == 22)) + return true; } - return false; - } int cckratesonly_included(unsigned char *rate, int ratelen) { int i; - for (i = 0; i < ratelen; i++) - { - if ( (((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && - (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22) ) + for (i = 0; i < ratelen; i++) { + if ((((rate[i]) & 0x7f) != 2) && (((rate[i]) & 0x7f) != 4) && + (((rate[i]) & 0x7f) != 11) && (((rate[i]) & 0x7f) != 22)) return false; } @@ -103,37 +91,33 @@ unsigned char networktype_to_raid(unsigned char network_type) { unsigned char raid; - switch (network_type) - { - case WIRELESS_11B: - raid = RATR_INX_WIRELESS_B; - break; - case WIRELESS_11A: - case WIRELESS_11G: - raid = RATR_INX_WIRELESS_G; - break; - case WIRELESS_11BG: - raid = RATR_INX_WIRELESS_GB; - break; - case WIRELESS_11_24N: - case WIRELESS_11_5N: - raid = RATR_INX_WIRELESS_N; - break; - case WIRELESS_11A_5N: - case WIRELESS_11G_24N: - raid = RATR_INX_WIRELESS_NG; - break; - case WIRELESS_11BG_24N: - raid = RATR_INX_WIRELESS_NGB; - break; - default: - raid = RATR_INX_WIRELESS_GB; - break; - + switch (network_type) { + case WIRELESS_11B: + raid = RATR_INX_WIRELESS_B; + break; + case WIRELESS_11A: + case WIRELESS_11G: + raid = RATR_INX_WIRELESS_G; + break; + case WIRELESS_11BG: + raid = RATR_INX_WIRELESS_GB; + break; + case WIRELESS_11_24N: + case WIRELESS_11_5N: + raid = RATR_INX_WIRELESS_N; + break; + case WIRELESS_11A_5N: + case WIRELESS_11G_24N: + raid = RATR_INX_WIRELESS_NG; + break; + case WIRELESS_11BG_24N: + raid = RATR_INX_WIRELESS_NGB; + break; + default: + raid = RATR_INX_WIRELESS_GB; + break; } - return raid; - } u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen) @@ -142,125 +126,87 @@ u8 judge_network_type(struct adapter *padapter, unsigned char *rate, int ratelen struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - - if (pmlmeext->cur_channel > 14) - { + if (pmlmeext->cur_channel > 14) { if (pmlmeinfo->HT_enable) - { network_type = WIRELESS_11_5N; - } network_type |= WIRELESS_11A; - } - else - { + } else { if (pmlmeinfo->HT_enable) - { network_type = WIRELESS_11_24N; - } if ((cckratesonly_included(rate, ratelen)) == true) - { network_type |= WIRELESS_11B; - } else if ((cckrates_included(rate, ratelen)) == true) - { network_type |= WIRELESS_11BG; - } else - { network_type |= WIRELESS_11G; - } } - return network_type; } -unsigned char ratetbl_val_2wifirate(unsigned char rate); unsigned char ratetbl_val_2wifirate(unsigned char rate) { unsigned char val = 0; - switch (rate & 0x7f) - { - case 0: - val = IEEE80211_CCK_RATE_1MB; - break; - - case 1: - val = IEEE80211_CCK_RATE_2MB; - break; - - case 2: - val = IEEE80211_CCK_RATE_5MB; - break; - - case 3: - val = IEEE80211_CCK_RATE_11MB; - break; - - case 4: - val = IEEE80211_OFDM_RATE_6MB; - break; - - case 5: - val = IEEE80211_OFDM_RATE_9MB; - break; - - case 6: - val = IEEE80211_OFDM_RATE_12MB; - break; - - case 7: - val = IEEE80211_OFDM_RATE_18MB; - break; - - case 8: - val = IEEE80211_OFDM_RATE_24MB; - break; - - case 9: - val = IEEE80211_OFDM_RATE_36MB; - break; - - case 10: - val = IEEE80211_OFDM_RATE_48MB; - break; - - case 11: - val = IEEE80211_OFDM_RATE_54MB; - break; - + switch (rate & 0x7f) { + case 0: + val = IEEE80211_CCK_RATE_1MB; + break; + case 1: + val = IEEE80211_CCK_RATE_2MB; + break; + case 2: + val = IEEE80211_CCK_RATE_5MB; + break; + case 3: + val = IEEE80211_CCK_RATE_11MB; + break; + case 4: + val = IEEE80211_OFDM_RATE_6MB; + break; + case 5: + val = IEEE80211_OFDM_RATE_9MB; + break; + case 6: + val = IEEE80211_OFDM_RATE_12MB; + break; + case 7: + val = IEEE80211_OFDM_RATE_18MB; + break; + case 8: + val = IEEE80211_OFDM_RATE_24MB; + break; + case 9: + val = IEEE80211_OFDM_RATE_36MB; + break; + case 10: + val = IEEE80211_OFDM_RATE_48MB; + break; + case 11: + val = IEEE80211_OFDM_RATE_54MB; + break; } - return val; - } -int is_basicrate(struct adapter *padapter, unsigned char rate); int is_basicrate(struct adapter *padapter, unsigned char rate) { int i; unsigned char val; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - for (i = 0; i < NumRates; i++) - { + for (i = 0; i < NumRates; i++) { val = pmlmeext->basicrate[i]; - if ((val != 0xff) && (val != 0xfe)) - { + if ((val != 0xff) && (val != 0xfe)) { if (rate == ratetbl_val_2wifirate(val)) - { return true; - } } } - return false; } -unsigned int ratetbl2rateset(struct adapter *padapter, unsigned char *rateset); unsigned int ratetbl2rateset(struct adapter *padapter, unsigned char *rateset) { int i; @@ -268,29 +214,23 @@ unsigned int ratetbl2rateset(struct adapter *padapter, unsigned char *rateset) unsigned int len = 0; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - for (i = 0; i < NumRates; i++) - { + for (i = 0; i < NumRates; i++) { rate = pmlmeext->datarate[i]; - switch (rate) - { - case 0xff: - return len; + switch (rate) { + case 0xff: + return len; + case 0xfe: + continue; + default: + rate = ratetbl_val_2wifirate(rate); - case 0xfe: - continue; + if (is_basicrate(padapter, rate) == true) + rate |= IEEE80211_BASIC_RATE_MASK; - default: - rate = ratetbl_val_2wifirate(rate); - - if (is_basicrate(padapter, rate) == true) - { - rate |= IEEE80211_BASIC_RATE_MASK; - } - - rateset[len] = rate; - len++; - break; + rateset[len] = rate; + len++; + break; } } return len; @@ -305,14 +245,14 @@ void get_rate_set(struct adapter *padapter, unsigned char *pbssrate, int *bssrat _rtw_memcpy(pbssrate, supportedrates, *bssrate_len); } -void UpdateBrateTbl(struct adapter * Adapter, u8 *mBratesOS) +void UpdateBrateTbl(struct adapter *Adapter, u8 *mbrate) { u8 i; u8 rate; /* 1M, 2M, 5.5M, 11M, 6M, 12M, 24M are mandatory. */ for (i = 0; i < NDIS_802_11_LENGTH_RATES_EX; i++) { - rate = mBratesOS[i] & 0x7f; + rate = mbrate[i] & 0x7f; switch (rate) { case IEEE80211_CCK_RATE_1MB: case IEEE80211_CCK_RATE_2MB: @@ -321,7 +261,7 @@ void UpdateBrateTbl(struct adapter * Adapter, u8 *mBratesOS) case IEEE80211_OFDM_RATE_6MB: case IEEE80211_OFDM_RATE_12MB: case IEEE80211_OFDM_RATE_24MB: - mBratesOS[i] |= IEEE80211_BASIC_RATE_MASK; + mbrate[i] |= IEEE80211_BASIC_RATE_MASK; break; } } @@ -332,39 +272,36 @@ void UpdateBrateTblForSoftAP(u8 *bssrateset, u32 bssratelen) u8 i; u8 rate; - for (i=0;imlmeextpriv; - if ( padapter->bNotifyChannelChange ) - { - DBG_88E( "[%s] ch = %d, offset = %d, bwmode = %d\n", __func__, channel, channel_offset, bwmode ); - } + if (padapter->bNotifyChannelChange) + DBG_88E("[%s] ch = %d, offset = %d, bwmode = %d\n", __func__, channel, channel_offset, bwmode); - if ((bwmode == HT_CHANNEL_WIDTH_20)||(channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)) - { + if ((bwmode == HT_CHANNEL_WIDTH_20) || + (channel_offset == HAL_PRIME_CHNL_OFFSET_DONT_CARE)) { /* SelectChannel(padapter, channel); */ center_ch = channel; - } - else - { + } else { /* switch to the proper channel */ - if (channel_offset == HAL_PRIME_CHNL_OFFSET_LOWER) - { + if (channel_offset == HAL_PRIME_CHNL_OFFSET_LOWER) { /* SelectChannel(padapter, channel + 2); */ center_ch = channel + 2; - } - else - { + } else { /* SelectChannel(padapter, channel - 2); */ center_ch = channel - 2; } @@ -479,22 +409,16 @@ void set_channel_bwmode(struct adapter *padapter, unsigned char channel, unsigne int get_bsstype(unsigned short capability) { if (capability & BIT(0)) - { return WIFI_FW_AP_STATE; - } else if (capability & BIT(1)) - { return WIFI_FW_ADHOC_STATE; - } else - { return 0; - } } __inline u8 *get_my_bssid(struct wlan_bssid_ex *pnetwork) { - return (pnetwork->MacAddress); + return pnetwork->MacAddress; } u16 get_beacon_interval(struct wlan_bssid_ex *bss) @@ -503,7 +427,6 @@ u16 get_beacon_interval(struct wlan_bssid_ex *bss) _rtw_memcpy((unsigned char *)&val, rtw_get_beacon_interval_from_ie(bss->IEs), 2); return le16_to_cpu(val); - } int is_client_associated_to_ap(struct adapter *padapter) @@ -518,13 +441,9 @@ int is_client_associated_to_ap(struct adapter *padapter) pmlmeinfo = &(pmlmeext->mlmext_info); if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)) - { return true; - } else - { return _FAIL; - } } int is_client_associated_to_ibss(struct adapter *padapter) @@ -533,13 +452,9 @@ int is_client_associated_to_ibss(struct adapter *padapter) struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); if ((pmlmeinfo->state & WIFI_FW_ASSOC_SUCCESS) && ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE)) - { return true; - } else - { return _FAIL; - } } int is_IBSS_empty(struct adapter *padapter) @@ -548,38 +463,24 @@ int is_IBSS_empty(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) - { + for (i = IBSS_START_MAC_ID; i < NUM_STA; i++) { if (pmlmeinfo->FW_sta_info[i].status == 1) - { return _FAIL; - } } - return true; - } unsigned int decide_wait_for_beacon_timeout(unsigned int bcn_interval) { if ((bcn_interval << 2) < WAIT_FOR_BCN_TO_MIN) - { return WAIT_FOR_BCN_TO_MIN; - } else if ((bcn_interval << 2) > WAIT_FOR_BCN_TO_MAX) - { return WAIT_FOR_BCN_TO_MAX; - } else - { - return ((bcn_interval << 2)); - } + return bcn_interval << 2; } -void CAM_empty_entry( - struct adapter * Adapter, - u8 ucIndex -) +void CAM_empty_entry(struct adapter *Adapter, u8 ucIndex) { rtw_hal_set_hwreg(Adapter, HW_VAR_CAM_EMPTY_ENTRY, (u8 *)(&ucIndex)); } @@ -597,45 +498,32 @@ void write_cam(struct adapter *padapter, u8 entry, u16 ctrl, u8 *mac, u8 *key) addr = entry << 3; - for (j = 5; j >= 0; j--) - { - switch (j) - { - case 0: - val = (ctrl | (mac[0] << 16) | (mac[1] << 24) ); - break; - - case 1: - val = (mac[2] | ( mac[3] << 8) | (mac[4] << 16) | (mac[5] << 24)); - break; - - default: - i = (j - 2) << 2; - val = (key[i] | (key[i+1] << 8) | (key[i+2] << 16) | (key[i+3] << 24)); - break; - + for (j = 5; j >= 0; j--) { + switch (j) { + case 0: + val = (ctrl | (mac[0] << 16) | (mac[1] << 24)); + break; + case 1: + val = (mac[2] | (mac[3] << 8) | (mac[4] << 16) | (mac[5] << 24)); + break; + default: + i = (j - 2) << 2; + val = (key[i] | (key[i+1] << 8) | (key[i+2] << 16) | (key[i+3] << 24)); + break; } cam_val[0] = val; cam_val[1] = addr + (unsigned int)j; rtw_hal_set_hwreg(padapter, HW_VAR_CAM_WRITE, (u8 *)cam_val); - - /* rtw_write32(padapter, WCAMI, val); */ - - /* cmd = CAM_POLLINIG | CAM_WRITE | (addr + j); */ - /* rtw_write32(padapter, RWCAM, cmd); */ - - /* DBG_88E("%s=> cam write: %x, %x\n",__func__, cmd, val); */ - } - } void clear_cam_entry(struct adapter *padapter, u8 entry) { unsigned char null_sta[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; - unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00,0x00, 0x00, 0x00, 0x00}; + unsigned char null_key[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; write_cam(padapter, entry, 0, null_sta, null_key); } @@ -646,10 +534,8 @@ int allocate_fw_sta_entry(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) - { - if (pmlmeinfo->FW_sta_info[mac_id].status == 0) - { + for (mac_id = IBSS_START_MAC_ID; mac_id < NUM_STA; mac_id++) { + if (pmlmeinfo->FW_sta_info[mac_id].status == 0) { pmlmeinfo->FW_sta_info[mac_id].status = 1; pmlmeinfo->FW_sta_info[mac_id].retry = 0; break; @@ -669,15 +555,14 @@ void flush_all_cam_entry(struct adapter *padapter) _rtw_memset((u8 *)(pmlmeinfo->FW_sta_info), 0, sizeof(pmlmeinfo->FW_sta_info)); } -int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie * pIE) +int WMM_param_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) { /* struct registry_priv *pregpriv = &padapter->registrypriv; */ struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if (pmlmepriv->qospriv.qos_option==0) - { + if (pmlmepriv->qospriv.qos_option == 0) { pmlmeinfo->WMM_enable = 0; return _FAIL; } @@ -706,7 +591,7 @@ void WMMOnAssocRsp(struct adapter *padapter) acm_mask = 0; - if ( pmlmeext->cur_wireless_mode == WIRELESS_11B) + if (pmlmeext->cur_wireless_mode == WIRELESS_11B) aSifsTime = 10; else aSifsTime = 16; @@ -725,29 +610,25 @@ void WMMOnAssocRsp(struct adapter *padapter) acParm = AIFS | (ECWMin << 8) | (ECWMax << 12) | (TXOP << 16); switch (ACI) { - case 0x0: - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acParm)); - acm_mask |= (ACM? BIT(1):0); - edca[XMIT_BE_QUEUE] = acParm; - break; - - case 0x1: - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acParm)); - /* acm_mask |= (ACM? BIT(0):0); */ - edca[XMIT_BK_QUEUE] = acParm; - break; - - case 0x2: - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acParm)); - acm_mask |= (ACM? BIT(2):0); - edca[XMIT_VI_QUEUE] = acParm; - break; - - case 0x3: - rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acParm)); - acm_mask |= (ACM? BIT(3):0); - edca[XMIT_VO_QUEUE] = acParm; - break; + case 0x0: + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acParm)); + acm_mask |= (ACM ? BIT(1) : 0); + edca[XMIT_BE_QUEUE] = acParm; + break; + case 0x1: + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acParm)); + edca[XMIT_BK_QUEUE] = acParm; + break; + case 0x2: + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VI, (u8 *)(&acParm)); + acm_mask |= (ACM ? BIT(2) : 0); + edca[XMIT_VI_QUEUE] = acParm; + break; + case 0x3: + rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_VO, (u8 *)(&acParm)); + acm_mask |= (ACM ? BIT(3) : 0); + edca[XMIT_VO_QUEUE] = acParm; + break; } DBG_88E("WMM(%x): %x, %x\n", ACI, ACM, acParm); @@ -760,29 +641,22 @@ void WMMOnAssocRsp(struct adapter *padapter) inx[0] = 0; inx[1] = 1; inx[2] = 2; inx[3] = 3; - if (pregpriv->wifi_spec==1) - { + if (pregpriv->wifi_spec == 1) { u32 j, tmp, change_inx; /* entry indx: 0->vo, 1->vi, 2->be, 3->bk. */ - for (i=0; i<4; i++) - { - for (j=i+1; j<4; j++) - { + for (i = 0; i < 4; i++) { + for (j = i+1; j < 4; j++) { /* compare CW and AIFS */ - if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) - { + if ((edca[j] & 0xFFFF) < (edca[i] & 0xFFFF)) { change_inx = true; - } - else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF)) - { + } else if ((edca[j] & 0xFFFF) == (edca[i] & 0xFFFF)) { /* compare TXOP */ if ((edca[j] >> 16) > (edca[i] >> 16)) change_inx = true; } - if (change_inx) - { + if (change_inx) { tmp = edca[i]; edca[i] = edca[j]; edca[j] = tmp; @@ -797,7 +671,7 @@ void WMMOnAssocRsp(struct adapter *padapter) } } - for (i=0; i<4; i++) { + for (i = 0; i < 4; i++) { pxmitpriv->wmm_para_seq[i] = inx[i]; DBG_88E("wmm_para_seq(%d): %d\n", i, pxmitpriv->wmm_para_seq[i]); } @@ -805,7 +679,7 @@ void WMMOnAssocRsp(struct adapter *padapter) return; } -static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var_ie * pIE) +static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) { unsigned char new_bwmode; unsigned char new_ch_offset; @@ -819,41 +693,35 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var if (!pIE) return; - if (phtpriv->ht_option == false) return; + if (!phtpriv) + return; if (pIE->Length > sizeof(struct HT_info_element)) return; pHT_info = (struct HT_info_element *)pIE->data; - if ((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable ) - { + if ((pHT_info->infos[0] & BIT(2)) && pregistrypriv->cbw40_enable) { new_bwmode = HT_CHANNEL_WIDTH_40; - switch (pHT_info->infos[0] & 0x3) - { - case 1: - new_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; - break; - - case 3: - new_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; - break; - - default: - new_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; - break; + switch (pHT_info->infos[0] & 0x3) { + case 1: + new_ch_offset = HAL_PRIME_CHNL_OFFSET_LOWER; + break; + case 3: + new_ch_offset = HAL_PRIME_CHNL_OFFSET_UPPER; + break; + default: + new_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; + break; } - } - else - { + } else { new_bwmode = HT_CHANNEL_WIDTH_20; new_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; } - - if ((new_bwmode!= pmlmeext->cur_bwmode) || (new_ch_offset!=pmlmeext->cur_ch_offset)) - { + if ((new_bwmode != pmlmeext->cur_bwmode) || + (new_ch_offset != pmlmeext->cur_ch_offset)) { pmlmeinfo->bwmode_updated = true; pmlmeext->cur_bwmode = new_bwmode; @@ -861,36 +729,27 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var /* update HT info also */ HT_info_handler(padapter, pIE); - } - else - { + } else { pmlmeinfo->bwmode_updated = false; } - - if (true == pmlmeinfo->bwmode_updated) - { + if (pmlmeinfo->bwmode_updated) { struct sta_info *psta; struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); struct sta_priv *pstapriv = &padapter->stapriv; /* set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */ - /* update ap's stainfo */ psta = rtw_get_stainfo(pstapriv, cur_network->MacAddress); - if (psta) - { + if (psta) { struct ht_priv *phtpriv_sta = &psta->htpriv; - if (phtpriv_sta->ht_option) - { + if (phtpriv_sta->ht_option) { /* bwmode */ phtpriv_sta->bwmode = pmlmeext->cur_bwmode; phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; - } - else - { + } else { phtpriv_sta->bwmode = HT_CHANNEL_WIDTH_20; phtpriv_sta->ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE; } @@ -898,7 +757,7 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var } } -void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie * pIE) +void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) { unsigned int i; u8 rf_type; @@ -909,40 +768,29 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie * pIE) struct ht_priv *phtpriv = &pmlmepriv->htpriv; struct registry_priv *pregistrypriv = &padapter->registrypriv; - if (pIE==NULL) return; + if (pIE == NULL) + return; - if (phtpriv->ht_option == false) return; + if (!phtpriv->ht_option) + return; pmlmeinfo->HT_caps_enable = 1; - for (i = 0; i < (pIE->Length); i++) - { - if (i != 2) - { - /* Commented by Albert 2010/07/12 */ + for (i = 0; i < (pIE->Length); i++) { + if (i != 2) { /* Got the endian issue here. */ pmlmeinfo->HT_caps.u.HT_cap[i] &= (pIE->data[i]); - } - else - { + } else { /* modify from fw by Thomas 2010/11/17 */ if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3) > (pIE->data[i] & 0x3)) - { max_AMPDU_len = (pIE->data[i] & 0x3); - } else - { max_AMPDU_len = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x3); - } if ((pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c) > (pIE->data[i] & 0x1c)) - { min_MPDU_spacing = (pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para & 0x1c); - } else - { min_MPDU_spacing = (pIE->data[i] & 0x1c); - } pmlmeinfo->HT_caps.u.HT_cap_element.AMPDU_para = max_AMPDU_len | min_MPDU_spacing; } @@ -960,17 +808,18 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie * pIE) return; } -void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie * pIE) +void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct ht_priv *phtpriv = &pmlmepriv->htpriv; - if (pIE==NULL) return; - - if (phtpriv->ht_option == false) return; + if (pIE == NULL) + return; + if (!phtpriv->ht_option) + return; if (pIE->Length > sizeof(struct HT_info_element)) return; @@ -990,14 +839,10 @@ void HTOnAssocRsp(struct adapter *padapter) DBG_88E("%s\n", __func__); - if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) - { + if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) { pmlmeinfo->HT_enable = 1; - } - else - { + } else { pmlmeinfo->HT_enable = 0; - /* set_channel_bwmode(padapter, pmlmeext->cur_channel, pmlmeext->cur_ch_offset, pmlmeext->cur_bwmode); */ return; } @@ -1015,12 +860,12 @@ void HTOnAssocRsp(struct adapter *padapter) rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len)); } -void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie * pIE) +void ERP_IE_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if (pIE->Length>1) + if (pIE->Length > 1) return; pmlmeinfo->ERP_enable = 1; @@ -1033,47 +878,35 @@ void VCS_update(struct adapter *padapter, struct sta_info *psta) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - switch (pregpriv->vrtl_carrier_sense)/* 0:off 1:on 2:auto */ - { - case 0: /* off */ - psta->rtsen = 0; + switch (pregpriv->vrtl_carrier_sense) { /* 0:off 1:on 2:auto */ + case 0: /* off */ + psta->rtsen = 0; + psta->cts2self = 0; + break; + case 1: /* on */ + if (pregpriv->vcs_type == 1) { /* 1:RTS/CTS 2:CTS to self */ + psta->rtsen = 1; psta->cts2self = 0; - break; - - case 1: /* on */ - if (pregpriv->vcs_type == 1) /* 1:RTS/CTS 2:CTS to self */ - { + } else { + psta->rtsen = 0; + psta->cts2self = 1; + } + break; + case 2: /* auto */ + default: + if ((pmlmeinfo->ERP_enable) && (pmlmeinfo->ERP_IE & BIT(1))) { + if (pregpriv->vcs_type == 1) { psta->rtsen = 1; psta->cts2self = 0; - } - else - { + } else { psta->rtsen = 0; psta->cts2self = 1; } - break; - - case 2: /* auto */ - default: - if ((pmlmeinfo->ERP_enable) && (pmlmeinfo->ERP_IE & BIT(1))) - { - if (pregpriv->vcs_type == 1) - { - psta->rtsen = 1; - psta->cts2self = 0; - } - else - { - psta->rtsen = 0; - psta->cts2self = 1; - } - } - else - { - psta->rtsen = 0; - psta->cts2self = 0; - } - break; + } else { + psta->rtsen = 0; + psta->cts2self = 0; + } + break; } } @@ -1083,8 +916,8 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) unsigned char *p; unsigned short val16, subtype; struct wlan_network *cur_network = &(Adapter->mlmepriv.cur_network); - /* u8 wpa_ie[255],rsn_ie[255]; */ - u16 wpa_len=0,rsn_len=0; + /* u8 wpa_ie[255], rsn_ie[255]; */ + u16 wpa_len = 0, rsn_len = 0; u8 encryp_protocol = 0; struct wlan_bssid_ex *bssid; int group_cipher = 0, pairwise_cipher = 0, is_8021x = 0; @@ -1092,7 +925,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) u32 wpa_ielen = 0; u8 *pbssid = GetAddr3Ptr(pframe); u32 hidden_ssid = 0; - u8 cur_network_type, network_type=0; + u8 cur_network_type, network_type = 0; struct HT_info_element *pht_info = NULL; struct rtw_ieee80211_ht_cap *pht_cap = NULL; u32 bcn_channel; @@ -1111,7 +944,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) if (_rtw_memcmp(cur_network->network.MacAddress, pbssid, 6) == false) { DBG_88E("Oops: rtw_check_network_encrypt linked but recv other bssid bcn\n%pM %pM\n", - (pbssid), (cur_network->network.MacAddress)); + (pbssid), (cur_network->network.MacAddress)); return true; } @@ -1119,7 +952,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) subtype = GetFrameSubType(pframe) >> 4; - if (subtype==WIFI_BEACON) + if (subtype == WIFI_BEACON) bssid->Reserved[0] = 1; bssid->Length = sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + len; @@ -1131,33 +964,31 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) /* check bw and channel offset */ /* parsing HT_CAP_IE */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); - if (p && len>0) { - pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2); - ht_cap_info = pht_cap->cap_info; + if (p && len > 0) { + pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2); + ht_cap_info = pht_cap->cap_info; } else { - ht_cap_info = 0; + ht_cap_info = 0; } /* parsing HT_INFO_IE */ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); - if (p && len>0) { + if (p && len > 0) { pht_info = (struct HT_info_element *)(p + 2); ht_info_infos_0 = pht_info->infos[0]; } else { ht_info_infos_0 = 0; } if (ht_cap_info != cur_network->BcnInfo.ht_cap_info || - ((ht_info_infos_0&0x03) != (cur_network->BcnInfo.ht_info_infos_0&0x03))) { + ((ht_info_infos_0&0x03) != (cur_network->BcnInfo.ht_info_infos_0&0x03))) { DBG_88E("%s bcn now: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, - ht_cap_info, ht_info_infos_0); + ht_cap_info, ht_info_infos_0); DBG_88E("%s bcn link: ht_cap_info:%x ht_info_infos_0:%x\n", __func__, - cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0); + cur_network->BcnInfo.ht_cap_info, cur_network->BcnInfo.ht_info_infos_0); DBG_88E("%s bw mode change, disconnect\n", __func__); - { - /* bcn_info_update */ - cur_network->BcnInfo.ht_cap_info = ht_cap_info; - cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0; - /* to do : need to check that whether modify related register of BB or not */ - } + /* bcn_info_update */ + cur_network->BcnInfo.ht_cap_info = ht_cap_info; + cur_network->BcnInfo.ht_info_infos_0 = ht_info_infos_0; + /* to do : need to check that whether modify related register of BB or not */ /* goto _mismatch; */ } @@ -1176,12 +1007,13 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } if (bcn_channel != Adapter->mlmeextpriv.cur_channel) { DBG_88E("%s beacon channel:%d cur channel:%d disconnect\n", __func__, - bcn_channel, Adapter->mlmeextpriv.cur_channel); + bcn_channel, Adapter->mlmeextpriv.cur_channel); goto _mismatch; } /* checking SSID */ - if ((p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_)) == NULL) { + p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); + if (p == NULL) { DBG_88E("%s marc: cannot find SSID for survey event\n", __func__); hidden_ssid = true; } else { @@ -1196,13 +1028,13 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) bssid->Ssid.Ssid[0] = '\0'; } - RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_,("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d " + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("%s bssid.Ssid.Ssid:%s bssid.Ssid.SsidLength:%d " "cur_network->network.Ssid.Ssid:%s len:%d\n", __func__, bssid->Ssid.Ssid, bssid->Ssid.SsidLength, cur_network->network.Ssid.Ssid, cur_network->network.Ssid.SsidLength)); - if (_rtw_memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) == false || - bssid->Ssid.SsidLength != cur_network->network.Ssid.SsidLength) { + if (!_rtw_memcmp(bssid->Ssid.Ssid, cur_network->network.Ssid.Ssid, 32) || + bssid->Ssid.SsidLength != cur_network->network.Ssid.SsidLength) { if (bssid->Ssid.Ssid[0] != '\0' && bssid->Ssid.SsidLength != 0) { /* not hidden ssid */ DBG_88E("%s(), SSID is not match return FAIL\n", __func__); goto _mismatch; @@ -1217,15 +1049,15 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) else bssid->Privacy = 0; - RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_, - ("%s(): cur_network->network.Privacy is %d, bssid.Privacy is %d\n", - __func__, cur_network->network.Privacy,bssid->Privacy)); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, + ("%s(): cur_network->network.Privacy is %d, bssid.Privacy is %d\n", + __func__, cur_network->network.Privacy, bssid->Privacy)); if (cur_network->network.Privacy != bssid->Privacy) { - DBG_88E("%s(), privacy is not match return FAIL\n",__func__); + DBG_88E("%s(), privacy is not match return FAIL\n", __func__); goto _mismatch; } - rtw_get_sec_ie(bssid->IEs, bssid->IELength, NULL,&rsn_len,NULL,&wpa_len); + rtw_get_sec_ie(bssid->IEs, bssid->IELength, NULL, &rsn_len, NULL, &wpa_len); if (rsn_len > 0) { encryp_protocol = ENCRYP_PROTOCOL_WPA2; @@ -1237,41 +1069,41 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) } if (cur_network->BcnInfo.encryp_protocol != encryp_protocol) { - DBG_88E("%s(): enctyp is not match ,return FAIL\n",__func__); + DBG_88E("%s(): enctyp is not match , return FAIL\n", __func__); goto _mismatch; } if (encryp_protocol == ENCRYP_PROTOCOL_WPA || encryp_protocol == ENCRYP_PROTOCOL_WPA2) { pbuf = rtw_get_wpa_ie(&bssid->IEs[12], &wpa_ielen, bssid->IELength-12); - if (pbuf && (wpa_ielen>0)) { + if (pbuf && (wpa_ielen > 0)) { if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is_8021x)) { - RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_, - ("%s pnetwork->pairwise_cipher: %d, group_cipher is %d, is_8021x is %d\n", __func__, - pairwise_cipher, group_cipher, is_8021x)); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, + ("%s pnetwork->pairwise_cipher: %d, group_cipher is %d, is_8021x is %d\n", __func__, + pairwise_cipher, group_cipher, is_8021x)); } } else { pbuf = rtw_get_wpa2_ie(&bssid->IEs[12], &wpa_ielen, bssid->IELength-12); - if (pbuf && (wpa_ielen>0)) { + if (pbuf && (wpa_ielen > 0)) { if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is_8021x)) { - RT_TRACE(_module_rtl871x_mlme_c_,_drv_info_, - ("%s pnetwork->pairwise_cipher: %d, pnetwork->group_cipher is %d, is_802x is %d\n", - __func__, pairwise_cipher, group_cipher, is_8021x)); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, + ("%s pnetwork->pairwise_cipher: %d, pnetwork->group_cipher is %d, is_802x is %d\n", + __func__, pairwise_cipher, group_cipher, is_8021x)); } } } - RT_TRACE(_module_rtl871x_mlme_c_,_drv_err_, - ("%s cur_network->group_cipher is %d: %d\n",__func__, cur_network->BcnInfo.group_cipher, group_cipher)); + RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, + ("%s cur_network->group_cipher is %d: %d\n", __func__, cur_network->BcnInfo.group_cipher, group_cipher)); if (pairwise_cipher != cur_network->BcnInfo.pairwise_cipher || group_cipher != cur_network->BcnInfo.group_cipher) { - DBG_88E("%s pairwise_cipher(%x:%x) or group_cipher(%x:%x) is not match ,return FAIL\n",__func__, - pairwise_cipher, cur_network->BcnInfo.pairwise_cipher, - group_cipher, cur_network->BcnInfo.group_cipher); + DBG_88E("%s pairwise_cipher(%x:%x) or group_cipher(%x:%x) is not match , return FAIL\n", __func__, + pairwise_cipher, cur_network->BcnInfo.pairwise_cipher, + group_cipher, cur_network->BcnInfo.group_cipher); goto _mismatch; } if (is_8021x != cur_network->BcnInfo.is_8021x) { - DBG_88E("%s authentication is not match ,return FAIL\n", __func__); + DBG_88E("%s authentication is not match , return FAIL\n", __func__); goto _mismatch; } } @@ -1290,27 +1122,24 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru { unsigned int i; unsigned int len; - struct ndis_802_11_var_ie * pIE; + struct ndis_802_11_var_ie *pIE; len = pkt_len - (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN); - for (i = 0; i < len;) - { + for (i = 0; i < len;) { pIE = (struct ndis_802_11_var_ie *)(pframe + (_BEACON_IE_OFFSET_ + WLAN_HDR_A3_LEN) + i); - switch (pIE->ElementID) - { - case _HT_EXTRA_INFO_IE_: /* HT info */ - /* HT_info_handler(padapter, pIE); */ - bwmode_update_check(padapter, pIE); - break; - - case _ERPINFO_IE_: - ERP_IE_handler(padapter, pIE); - VCS_update(padapter, psta); - break; - default: - break; + switch (pIE->ElementID) { + case _HT_EXTRA_INFO_IE_: /* HT info */ + /* HT_info_handler(padapter, pIE); */ + bwmode_update_check(padapter, pIE); + break; + case _ERPINFO_IE_: + ERP_IE_handler(padapter, pIE); + VCS_update(padapter, psta); + break; + default: + break; } i += (pIE->Length + 2); @@ -1320,187 +1149,142 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru unsigned int is_ap_in_tkip(struct adapter *padapter) { u32 i; - struct ndis_802_11_var_ie * pIE; + struct ndis_802_11_var_ie *pIE; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); - if (rtw_get_capability((struct wlan_bssid_ex *)cur_network) & WLAN_CAPABILITY_PRIVACY) - { - for (i = sizeof(struct ndis_802_11_fixed_ie); i < pmlmeinfo->network.IELength;) - { + if (rtw_get_capability((struct wlan_bssid_ex *)cur_network) & WLAN_CAPABILITY_PRIVACY) { + for (i = sizeof(struct ndis_802_11_fixed_ie); i < pmlmeinfo->network.IELength;) { pIE = (struct ndis_802_11_var_ie *)(pmlmeinfo->network.IEs + i); - switch (pIE->ElementID) - { - case _VENDOR_SPECIFIC_IE_: - if ((_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) && (_rtw_memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4))) - { - return true; - } - break; - - case _RSN_IE_2_: - if (_rtw_memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4)) - { - return true; - } - - default: - break; + switch (pIE->ElementID) { + case _VENDOR_SPECIFIC_IE_: + if ((_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) && (_rtw_memcmp((pIE->data + 12), WPA_TKIP_CIPHER, 4))) + return true; + break; + case _RSN_IE_2_: + if (_rtw_memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4)) + return true; + default: + break; } i += (pIE->Length + 2); } - + return false; + } else { return false; } - else - { - return false; - } - } -unsigned int should_forbid_n_rate(struct adapter * padapter) +unsigned int should_forbid_n_rate(struct adapter *padapter) { u32 i; - struct ndis_802_11_var_ie * pIE; + struct ndis_802_11_var_ie *pIE; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct wlan_bssid_ex *cur_network = &pmlmepriv->cur_network.network; - if (rtw_get_capability((struct wlan_bssid_ex *)cur_network) & WLAN_CAPABILITY_PRIVACY) - { - for (i = sizeof(struct ndis_802_11_fixed_ie); i < cur_network->IELength;) - { + if (rtw_get_capability((struct wlan_bssid_ex *)cur_network) & WLAN_CAPABILITY_PRIVACY) { + for (i = sizeof(struct ndis_802_11_fixed_ie); i < cur_network->IELength;) { pIE = (struct ndis_802_11_var_ie *)(cur_network->IEs + i); - switch (pIE->ElementID) - { - case _VENDOR_SPECIFIC_IE_: - if (_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4) && - ((_rtw_memcmp((pIE->data + 12), WPA_CIPHER_SUITE_CCMP, 4)) || - (_rtw_memcmp((pIE->data + 16), WPA_CIPHER_SUITE_CCMP, 4)))) - return false; - break; - - case _RSN_IE_2_: - if ((_rtw_memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP, 4)) || - (_rtw_memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP, 4))) + switch (pIE->ElementID) { + case _VENDOR_SPECIFIC_IE_: + if (_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4) && + ((_rtw_memcmp((pIE->data + 12), WPA_CIPHER_SUITE_CCMP, 4)) || + (_rtw_memcmp((pIE->data + 16), WPA_CIPHER_SUITE_CCMP, 4)))) return false; - - default: - break; + break; + case _RSN_IE_2_: + if ((_rtw_memcmp((pIE->data + 8), RSN_CIPHER_SUITE_CCMP, 4)) || + (_rtw_memcmp((pIE->data + 12), RSN_CIPHER_SUITE_CCMP, 4))) + return false; + default: + break; } i += (pIE->Length + 2); } return true; - } - else - { + } else { return false; } - } - unsigned int is_ap_in_wep(struct adapter *padapter) { u32 i; - struct ndis_802_11_var_ie * pIE; + struct ndis_802_11_var_ie *pIE; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wlan_bssid_ex *cur_network = &(pmlmeinfo->network); - if (rtw_get_capability((struct wlan_bssid_ex *)cur_network) & WLAN_CAPABILITY_PRIVACY) - { - for (i = sizeof(struct ndis_802_11_fixed_ie); i < pmlmeinfo->network.IELength;) - { + if (rtw_get_capability((struct wlan_bssid_ex *)cur_network) & WLAN_CAPABILITY_PRIVACY) { + for (i = sizeof(struct ndis_802_11_fixed_ie); i < pmlmeinfo->network.IELength;) { pIE = (struct ndis_802_11_var_ie *)(pmlmeinfo->network.IEs + i); - switch (pIE->ElementID) - { - case _VENDOR_SPECIFIC_IE_: - if (_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) - return false; - break; - - case _RSN_IE_2_: + switch (pIE->ElementID) { + case _VENDOR_SPECIFIC_IE_: + if (_rtw_memcmp(pIE->data, RTW_WPA_OUI, 4)) return false; - - default: - break; + break; + case _RSN_IE_2_: + return false; + default: + break; } - i += (pIE->Length + 2); } - return true; - } - else - { + } else { return false; } - } -int wifirate2_ratetbl_inx(unsigned char rate); int wifirate2_ratetbl_inx(unsigned char rate) { int inx = 0; rate = rate & 0x7f; - switch (rate) - { - case 54*2: - inx = 11; - break; - - case 48*2: - inx = 10; - break; - - case 36*2: - inx = 9; - break; - - case 24*2: - inx = 8; - break; - - case 18*2: - inx = 7; - break; - - case 12*2: - inx = 6; - break; - - case 9*2: - inx = 5; - break; - - case 6*2: - inx = 4; - break; - - case 11*2: - inx = 3; - break; - case 11: - inx = 2; - break; - - case 2*2: - inx = 1; - break; - - case 1*2: - inx = 0; - break; - + switch (rate) { + case 54*2: + inx = 11; + break; + case 48*2: + inx = 10; + break; + case 36*2: + inx = 9; + break; + case 24*2: + inx = 8; + break; + case 18*2: + inx = 7; + break; + case 12*2: + inx = 6; + break; + case 9*2: + inx = 5; + break; + case 6*2: + inx = 4; + break; + case 11*2: + inx = 3; + break; + case 11: + inx = 2; + break; + case 2*2: + inx = 1; + break; + case 1*2: + inx = 0; + break; } return inx; } @@ -1510,14 +1294,11 @@ unsigned int update_basic_rate(unsigned char *ptn, unsigned int ptn_sz) unsigned int i, num_of_rate; unsigned int mask = 0; - num_of_rate = (ptn_sz > NumRates)? NumRates: ptn_sz; + num_of_rate = (ptn_sz > NumRates) ? NumRates : ptn_sz; - for (i = 0; i < num_of_rate; i++) - { + for (i = 0; i < num_of_rate; i++) { if ((*(ptn + i)) & 0x80) - { mask |= 0x1 << wifirate2_ratetbl_inx(*(ptn + i)); - } } return mask; } @@ -1527,13 +1308,10 @@ unsigned int update_supported_rate(unsigned char *ptn, unsigned int ptn_sz) unsigned int i, num_of_rate; unsigned int mask = 0; - num_of_rate = (ptn_sz > NumRates)? NumRates: ptn_sz; + num_of_rate = (ptn_sz > NumRates) ? NumRates : ptn_sz; for (i = 0; i < num_of_rate; i++) - { mask |= 0x1 << wifirate2_ratetbl_inx(*(ptn + i)); - } - return mask; } @@ -1558,7 +1336,7 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps) if ((pmlmeinfo->assoc_AP_vendor == HT_IOT_PEER_RALINK)) return _FAIL; - bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40)? 6: 5; + bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40) ? 6 : 5; if (__le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info) & (0x1 << bit_offset)) return _SUCCESS; @@ -1569,21 +1347,17 @@ int support_short_GI(struct adapter *padapter, struct HT_caps_element *pHT_caps) unsigned char get_highest_rate_idx(u32 mask) { int i; - unsigned char rate_idx=0; + unsigned char rate_idx = 0; - for (i=27; i>=0; i--) - { - if (mask & BIT(i)) - { + for (i = 27; i >= 0; i--) { + if (mask & BIT(i)) { rate_idx = i; break; } } - return rate_idx; } -unsigned char get_highest_mcs_rate(struct HT_caps_element *pHT_caps); unsigned char get_highest_mcs_rate(struct HT_caps_element *pHT_caps) { int i, mcs_rate; @@ -1591,22 +1365,16 @@ unsigned char get_highest_mcs_rate(struct HT_caps_element *pHT_caps) mcs_rate = (pHT_caps->u.HT_cap_element.MCS_rate[0] | (pHT_caps->u.HT_cap_element.MCS_rate[1] << 8)); for (i = 15; i >= 0; i--) - { if (mcs_rate & (0x1 << i)) - { break; - } - } - return i; } void Update_RA_Entry(struct adapter *padapter, u32 mac_id) { - rtw_hal_update_ra_mask(padapter, mac_id,0); + rtw_hal_update_ra_mask(padapter, mac_id, 0); } -void enable_rate_adaptive(struct adapter *padapter, u32 mac_id); void enable_rate_adaptive(struct adapter *padapter, u32 mac_id) { Update_RA_Entry(padapter, mac_id); @@ -1623,7 +1391,7 @@ void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode) { unsigned char supported_rates[NDIS_802_11_LENGTH_RATES_EX]; #ifdef CONFIG_P2P - struct wifidirect_info* pwdinfo = &padapter->wdinfo; + struct wifidirect_info *pwdinfo = &padapter->wdinfo; /* Added by Albert 2011/03/22 */ /* In the P2P mode, the driver should not support the b mode. */ @@ -1651,87 +1419,68 @@ void update_tx_basic_rate(struct adapter *padapter, u8 wirelessmode) unsigned char check_assoc_AP(u8 *pframe, uint len) { - unsigned int i; - struct ndis_802_11_var_ie * pIE; + unsigned int i; + struct ndis_802_11_var_ie *pIE; u8 epigram_vendor_flag; u8 ralink_vendor_flag; epigram_vendor_flag = 0; ralink_vendor_flag = 0; - for (i = sizeof(struct ndis_802_11_fixed_ie); i < len;) - { + for (i = sizeof(struct ndis_802_11_fixed_ie); i < len;) { pIE = (struct ndis_802_11_var_ie *)(pframe + i); - switch (pIE->ElementID) - { - case _VENDOR_SPECIFIC_IE_: - if ((_rtw_memcmp(pIE->data, ARTHEROS_OUI1, 3)) || (_rtw_memcmp(pIE->data, ARTHEROS_OUI2, 3))) - { - DBG_88E("link to Artheros AP\n"); - return HT_IOT_PEER_ATHEROS; + switch (pIE->ElementID) { + case _VENDOR_SPECIFIC_IE_: + if ((_rtw_memcmp(pIE->data, ARTHEROS_OUI1, 3)) || + (_rtw_memcmp(pIE->data, ARTHEROS_OUI2, 3))) { + DBG_88E("link to Artheros AP\n"); + return HT_IOT_PEER_ATHEROS; + } else if ((_rtw_memcmp(pIE->data, BROADCOM_OUI1, 3)) || + (_rtw_memcmp(pIE->data, BROADCOM_OUI2, 3)) || + (_rtw_memcmp(pIE->data, BROADCOM_OUI2, 3))) { + DBG_88E("link to Broadcom AP\n"); + return HT_IOT_PEER_BROADCOM; + } else if (_rtw_memcmp(pIE->data, MARVELL_OUI, 3)) { + DBG_88E("link to Marvell AP\n"); + return HT_IOT_PEER_MARVELL; + } else if (_rtw_memcmp(pIE->data, RALINK_OUI, 3)) { + if (!ralink_vendor_flag) { + ralink_vendor_flag = 1; + } else { + DBG_88E("link to Ralink AP\n"); + return HT_IOT_PEER_RALINK; } - else if ((_rtw_memcmp(pIE->data, BROADCOM_OUI1, 3)) - || (_rtw_memcmp(pIE->data, BROADCOM_OUI2, 3)) - || (_rtw_memcmp(pIE->data, BROADCOM_OUI2, 3))) - { - DBG_88E("link to Broadcom AP\n"); - return HT_IOT_PEER_BROADCOM; + } else if (_rtw_memcmp(pIE->data, CISCO_OUI, 3)) { + DBG_88E("link to Cisco AP\n"); + return HT_IOT_PEER_CISCO; + } else if (_rtw_memcmp(pIE->data, REALTEK_OUI, 3)) { + DBG_88E("link to Realtek 96B\n"); + return HT_IOT_PEER_REALTEK; + } else if (_rtw_memcmp(pIE->data, AIRGOCAP_OUI, 3)) { + DBG_88E("link to Airgo Cap\n"); + return HT_IOT_PEER_AIRGO; + } else if (_rtw_memcmp(pIE->data, EPIGRAM_OUI, 3)) { + epigram_vendor_flag = 1; + if (ralink_vendor_flag) { + DBG_88E("link to Tenda W311R AP\n"); + return HT_IOT_PEER_TENDA; + } else { + DBG_88E("Capture EPIGRAM_OUI\n"); } - else if (_rtw_memcmp(pIE->data, MARVELL_OUI, 3)) - { - DBG_88E("link to Marvell AP\n"); - return HT_IOT_PEER_MARVELL; - } - else if (_rtw_memcmp(pIE->data, RALINK_OUI, 3)) - { - if (!ralink_vendor_flag) { - ralink_vendor_flag = 1; - } else { - DBG_88E("link to Ralink AP\n"); - return HT_IOT_PEER_RALINK; - } - } - else if (_rtw_memcmp(pIE->data, CISCO_OUI, 3)) - { - DBG_88E("link to Cisco AP\n"); - return HT_IOT_PEER_CISCO; - } - else if (_rtw_memcmp(pIE->data, REALTEK_OUI, 3)) - { - DBG_88E("link to Realtek 96B\n"); - return HT_IOT_PEER_REALTEK; - } - else if (_rtw_memcmp(pIE->data, AIRGOCAP_OUI,3)) - { - DBG_88E("link to Airgo Cap\n"); - return HT_IOT_PEER_AIRGO; - } - else if (_rtw_memcmp(pIE->data, EPIGRAM_OUI, 3)) - { - epigram_vendor_flag = 1; - if (ralink_vendor_flag) { - DBG_88E("link to Tenda W311R AP\n"); - return HT_IOT_PEER_TENDA; - } else { - DBG_88E("Capture EPIGRAM_OUI\n"); - } - } - else - { - break; - } - - default: + } else { break; - } + } + default: + break; + } i += (pIE->Length + 2); } if (ralink_vendor_flag && !epigram_vendor_flag) { DBG_88E("link to Ralink AP\n"); return HT_IOT_PEER_RALINK; - } else if (ralink_vendor_flag && epigram_vendor_flag){ + } else if (ralink_vendor_flag && epigram_vendor_flag) { DBG_88E("link to Tenda W311R AP\n"); return HT_IOT_PEER_TENDA; } else { @@ -1745,34 +1494,31 @@ void update_IOT_info(struct adapter *padapter) struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - switch (pmlmeinfo->assoc_AP_vendor) - { - case HT_IOT_PEER_MARVELL: - pmlmeinfo->turboMode_cts2self = 1; - pmlmeinfo->turboMode_rtsen = 0; - break; - - case HT_IOT_PEER_RALINK: - pmlmeinfo->turboMode_cts2self = 0; - pmlmeinfo->turboMode_rtsen = 1; - /* disable high power */ - Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); - break; - case HT_IOT_PEER_REALTEK: - /* rtw_write16(padapter, 0x4cc, 0xffff); */ - /* rtw_write16(padapter, 0x546, 0x01c0); */ - /* disable high power */ - Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); - break; - default: - pmlmeinfo->turboMode_cts2self = 0; - pmlmeinfo->turboMode_rtsen = 1; - break; + switch (pmlmeinfo->assoc_AP_vendor) { + case HT_IOT_PEER_MARVELL: + pmlmeinfo->turboMode_cts2self = 1; + pmlmeinfo->turboMode_rtsen = 0; + break; + case HT_IOT_PEER_RALINK: + pmlmeinfo->turboMode_cts2self = 0; + pmlmeinfo->turboMode_rtsen = 1; + /* disable high power */ + Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); + break; + case HT_IOT_PEER_REALTEK: + /* rtw_write16(padapter, 0x4cc, 0xffff); */ + /* rtw_write16(padapter, 0x546, 0x01c0); */ + /* disable high power */ + Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false); + break; + default: + pmlmeinfo->turboMode_cts2self = 0; + pmlmeinfo->turboMode_rtsen = 1; + break; } - } -void update_capinfo(struct adapter * Adapter, u16 updateCap) +void update_capinfo(struct adapter *Adapter, u16 updateCap) { struct mlme_ext_priv *pmlmeext = &Adapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -1780,66 +1526,42 @@ void update_capinfo(struct adapter * Adapter, u16 updateCap) /* Check preamble mode, 2005.01.06, by rcnjko. */ /* Mark to update preamble value forever, 2008.03.18 by lanhsin */ - /* if ( pMgntInfo->RegPreambleMode == PREAMBLE_AUTO ) */ - { - if (updateCap & cShortPreamble) - { /* Short Preamble */ - if (pmlmeinfo->preamble_mode != PREAMBLE_SHORT) /* PREAMBLE_LONG or PREAMBLE_AUTO */ - { - ShortPreamble = true; - pmlmeinfo->preamble_mode = PREAMBLE_SHORT; - rtw_hal_set_hwreg( Adapter, HW_VAR_ACK_PREAMBLE, (u8 *)&ShortPreamble ); - } + if (updateCap & cShortPreamble) { /* Short Preamble */ + if (pmlmeinfo->preamble_mode != PREAMBLE_SHORT) { /* PREAMBLE_LONG or PREAMBLE_AUTO */ + ShortPreamble = true; + pmlmeinfo->preamble_mode = PREAMBLE_SHORT; + rtw_hal_set_hwreg(Adapter, HW_VAR_ACK_PREAMBLE, (u8 *)&ShortPreamble); } - else - { /* Long Preamble */ - if (pmlmeinfo->preamble_mode != PREAMBLE_LONG) /* PREAMBLE_SHORT or PREAMBLE_AUTO */ - { - ShortPreamble = false; - pmlmeinfo->preamble_mode = PREAMBLE_LONG; - rtw_hal_set_hwreg( Adapter, HW_VAR_ACK_PREAMBLE, (u8 *)&ShortPreamble ); - } + } else { /* Long Preamble */ + if (pmlmeinfo->preamble_mode != PREAMBLE_LONG) { /* PREAMBLE_SHORT or PREAMBLE_AUTO */ + ShortPreamble = false; + pmlmeinfo->preamble_mode = PREAMBLE_LONG; + rtw_hal_set_hwreg(Adapter, HW_VAR_ACK_PREAMBLE, (u8 *)&ShortPreamble); } } - if ( updateCap & cIBSS ) { + if (updateCap & cIBSS) { /* Filen: See 802.11-2007 p.91 */ pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; - } - else - { - /* Filen: See 802.11-2007 p.90 */ - if ( pmlmeext->cur_wireless_mode & (WIRELESS_11G | WIRELESS_11_24N)) - { - if ( (updateCap & cShortSlotTime) /* && (!(pMgntInfo->pHTInfo->RT2RT_HT_Mode & RT_HT_CAP_USE_LONG_PREAMBLE)) */) - { /* Short Slot Time */ + } else { /* Filen: See 802.11-2007 p.90 */ + if (pmlmeext->cur_wireless_mode & (WIRELESS_11G | WIRELESS_11_24N)) { + if (updateCap & cShortSlotTime) { /* Short Slot Time */ if (pmlmeinfo->slotTime != SHORT_SLOT_TIME) - { pmlmeinfo->slotTime = SHORT_SLOT_TIME; - } - } - else - { /* Long Slot Time */ + } else { /* Long Slot Time */ if (pmlmeinfo->slotTime != NON_SHORT_SLOT_TIME) - { pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; - } } - } - else if ( pmlmeext->cur_wireless_mode & (WIRELESS_11A | WIRELESS_11_5N)) - { + } else if (pmlmeext->cur_wireless_mode & (WIRELESS_11A | WIRELESS_11_5N)) { pmlmeinfo->slotTime = SHORT_SLOT_TIME; - } - else - { + } else { /* B Mode */ pmlmeinfo->slotTime = NON_SHORT_SLOT_TIME; } } - rtw_hal_set_hwreg( Adapter, HW_VAR_SLOT_TIME, &pmlmeinfo->slotTime ); - + rtw_hal_set_hwreg(Adapter, HW_VAR_SLOT_TIME, &pmlmeinfo->slotTime); } void update_wireless_mode(struct adapter *padapter) @@ -1856,42 +1578,29 @@ void update_wireless_mode(struct adapter *padapter) if ((pmlmeinfo->HT_info_enable) && (pmlmeinfo->HT_caps_enable)) pmlmeinfo->HT_enable = 1; - if (pmlmeext->cur_channel > 14) - { + if (pmlmeext->cur_channel > 14) { if (pmlmeinfo->HT_enable) - { network_type = WIRELESS_11_5N; - } network_type |= WIRELESS_11A; - } - else - { + } else { if (pmlmeinfo->HT_enable) - { network_type = WIRELESS_11_24N; - } if ((cckratesonly_included(rate, ratelen)) == true) - { network_type |= WIRELESS_11B; - } else if ((cckrates_included(rate, ratelen)) == true) - { network_type |= WIRELESS_11BG; - } else - { network_type |= WIRELESS_11G; - } } pmlmeext->cur_wireless_mode = network_type & padapter->registrypriv.wireless_mode; - SIFS_Timer = 0x0a0a0808; /* 0x0808 -> for CCK, 0x0a0a -> for OFDM */ - /* change this value if having IOT issues. */ + SIFS_Timer = 0x0a0a0808;/* 0x0808 -> for CCK, 0x0a0a -> for OFDM */ + /* change this value if having IOT issues. */ - padapter->HalFunc.SetHwRegHandler( padapter, HW_VAR_RESP_SIFS, (u8 *)&SIFS_Timer); + padapter->HalFunc.SetHwRegHandler(padapter, HW_VAR_RESP_SIFS, (u8 *)&SIFS_Timer); if (pmlmeext->cur_wireless_mode & WIRELESS_11B) update_mgnt_tx_rate(padapter, IEEE80211_CCK_RATE_1MB); @@ -1904,42 +1613,34 @@ void update_bmc_sta_support_rate(struct adapter *padapter, u32 mac_id) struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - if (pmlmeext->cur_wireless_mode & WIRELESS_11B) - { + if (pmlmeext->cur_wireless_mode & WIRELESS_11B) { /* Only B, B/G, and B/G/N AP could use CCK rate */ _rtw_memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_cck, 4); - } - else - { + } else { _rtw_memcpy((pmlmeinfo->FW_sta_info[mac_id].SupportedRates), rtw_basic_rate_ofdm, 4); } } -int update_sta_support_rate(struct adapter *padapter, u8* pvar_ie, uint var_ie_len, int cam_idx) +int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_len, int cam_idx) { unsigned int ie_len; - struct ndis_802_11_var_ie * pIE; + struct ndis_802_11_var_ie *pIE; int supportRateNum = 0; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); pIE = (struct ndis_802_11_var_ie *)rtw_get_ie(pvar_ie, _SUPPORTEDRATES_IE_, &ie_len, var_ie_len); if (pIE == NULL) - { return _FAIL; - } _rtw_memcpy(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates, pIE->data, ie_len); supportRateNum = ie_len; pIE = (struct ndis_802_11_var_ie *)rtw_get_ie(pvar_ie, _EXT_SUPPORTEDRATES_IE_, &ie_len, var_ie_len); if (pIE) - { _rtw_memcpy((pmlmeinfo->FW_sta_info[cam_idx].SupportedRates + supportRateNum), pIE->data, ie_len); - } return _SUCCESS; - } void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) @@ -1949,7 +1650,7 @@ void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) u16 param; struct recv_reorder_ctrl *preorder_ctrl; struct sta_priv *pstapriv = &padapter->stapriv; - struct ADDBA_request *preq = (struct ADDBA_request*)paddba_req; + struct ADDBA_request *preq = (struct ADDBA_request *)paddba_req; struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -1960,17 +1661,17 @@ void process_addba_req(struct adapter *padapter, u8 *paddba_req, u8 *addr) tid = (param>>2)&0x0f; preorder_ctrl = &psta->recvreorder_ctrl[tid]; preorder_ctrl->indicate_seq = 0xffff; - preorder_ctrl->enable =(pmlmeinfo->bAcceptAddbaReq == true)? true :false; + preorder_ctrl->enable = (pmlmeinfo->bAcceptAddbaReq) ? true : false; } } void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) { - u8* pIE; + u8 *pIE; __le32 *pbuf; pIE = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); - pbuf = (__le32*)pIE; + pbuf = (__le32 *)pIE; pmlmeext->TSFValue = le32_to_cpu(*(pbuf+1)); @@ -1989,7 +1690,7 @@ void beacon_timing_control(struct adapter *padapter) rtw_hal_bcn_related_reg_setting(padapter); } -static struct adapter *pbuddy_padapter = NULL; +static struct adapter *pbuddy_padapter; int rtw_handle_dualmac(struct adapter *adapter, bool init) { @@ -1999,15 +1700,15 @@ int rtw_handle_dualmac(struct adapter *adapter, bool init) if (init) { if (pbuddy_padapter == NULL) { pbuddy_padapter = adapter; - DBG_88E("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n",__func__); + DBG_88E("%s(): pbuddy_padapter == NULL, Set pbuddy_padapter\n", __func__); } else { adapter->pbuddy_adapter = pbuddy_padapter; pbuddy_padapter->pbuddy_adapter = adapter; /* clear global value */ pbuddy_padapter = NULL; - DBG_88E("%s(): pbuddy_padapter exist, Exchange Information\n",__func__); + DBG_88E("%s(): pbuddy_padapter exist, Exchange Information\n", __func__); } - }else { + } else { pbuddy_padapter = NULL; } exit: diff --git a/include/osdep_service.h b/include/osdep_service.h index 2819e19..760a787 100644 --- a/include/osdep_service.h +++ b/include/osdep_service.h @@ -337,13 +337,19 @@ enum { MEM_STAT_RX_FREE }; +extern unsigned char MCS_rate_2R[16]; +extern unsigned char MCS_rate_1R[16]; +extern unsigned char RTW_WPA_OUI[]; +extern unsigned char WPA_TKIP_CIPHER[4]; +extern unsigned char RSN_TKIP_CIPHER[4]; + #define rtw_update_mem_stat(flag, sz) do {} while (0) -extern u8* _rtw_vmalloc(u32 sz); -extern u8* _rtw_zvmalloc(u32 sz); -extern void _rtw_vmfree(u8 *pbuf, u32 sz); -extern u8* _rtw_zmalloc(u32 sz); -extern u8* _rtw_malloc(u32 sz); -extern void _rtw_mfree(u8 *pbuf, u32 sz); +extern u8 *_rtw_vmalloc(u32 sz); +extern u8 *_rtw_zvmalloc(u32 sz); +extern void _rtw_vmfree(u8 *pbuf, u32 sz); +extern u8 *_rtw_zmalloc(u32 sz); +extern u8 *_rtw_malloc(u32 sz); +extern void _rtw_mfree(u8 *pbuf, u32 sz); #define rtw_vmalloc(sz) _rtw_vmalloc((sz)) #define rtw_zvmalloc(sz) _rtw_zvmalloc((sz)) #define rtw_vmfree(pbuf, sz) _rtw_vmfree((pbuf), (sz)) @@ -351,47 +357,47 @@ extern void _rtw_mfree(u8 *pbuf, u32 sz); #define rtw_zmalloc(sz) _rtw_zmalloc((sz)) #define rtw_mfree(pbuf, sz) _rtw_mfree((pbuf), (sz)) -extern void* rtw_malloc2d(int h, int w, int size); -extern void rtw_mfree2d(void *pbuf, int h, int w, int size); +extern void *rtw_malloc2d(int h, int w, int size); +extern void rtw_mfree2d(void *pbuf, int h, int w, int size); -extern void _rtw_memcpy(void* dec, void* sour, u32 sz); -extern int _rtw_memcmp(void *dst, void *src, u32 sz); -extern void _rtw_memset(void *pbuf, int c, u32 sz); +extern void _rtw_memcpy(void *dec, void *sour, u32 sz); +extern int _rtw_memcmp(void *dst, void *src, u32 sz); +extern void _rtw_memset(void *pbuf, int c, u32 sz); -extern void _rtw_init_listhead(struct list_head *list); -extern u32 rtw_is_list_empty(struct list_head *phead); -extern void rtw_list_insert_head(struct list_head *plist, struct list_head *phead); -extern void rtw_list_insert_tail(struct list_head *plist, struct list_head *phead); -extern void rtw_list_delete(struct list_head *plist); +extern void _rtw_init_listhead(struct list_head *list); +extern u32 rtw_is_list_empty(struct list_head *phead); +extern void rtw_list_insert_head(struct list_head *plist, struct list_head *phead); +extern void rtw_list_insert_tail(struct list_head *plist, struct list_head *phead); +extern void rtw_list_delete(struct list_head *plist); -extern void _rtw_init_sema(struct semaphore *sema, int init_val); -extern void _rtw_free_sema(struct semaphore *sema); -extern void _rtw_up_sema(struct semaphore *sema); -extern u32 _rtw_down_sema(struct semaphore *sema); -extern void _rtw_mutex_init(struct mutex *pmutex); -extern void _rtw_mutex_free(struct mutex *pmutex); -extern void _rtw_spinlock_init(spinlock_t *plock); -extern void _rtw_spinlock_free(spinlock_t *plock); +extern void _rtw_init_sema(struct semaphore *sema, int init_val); +extern void _rtw_free_sema(struct semaphore *sema); +extern void _rtw_up_sema(struct semaphore *sema); +extern u32 _rtw_down_sema(struct semaphore *sema); +extern void _rtw_mutex_init(struct mutex *pmutex); +extern void _rtw_mutex_free(struct mutex *pmutex); +extern void _rtw_spinlock_init(spinlock_t *plock); +extern void _rtw_spinlock_free(spinlock_t *plock); -extern void _rtw_init_queue(struct __queue *pqueue); -extern u32 _rtw_queue_empty(struct __queue *pqueue); -extern u32 rtw_end_of_queue_search(struct list_head *queue, struct list_head *pelement); +extern void _rtw_init_queue(struct __queue *pqueue); +extern u32 _rtw_queue_empty(struct __queue *pqueue); +extern u32 rtw_end_of_queue_search(struct list_head *queue, struct list_head *pelement); -extern u32 rtw_get_current_time(void); -extern u32 rtw_systime_to_ms(u32 systime); -extern u32 rtw_ms_to_systime(u32 ms); -extern s32 rtw_get_passing_time_ms(u32 start); -extern s32 rtw_get_time_interval_ms(u32 start, u32 end); +extern u32 rtw_get_current_time(void); +extern u32 rtw_systime_to_ms(u32 systime); +extern u32 rtw_ms_to_systime(u32 ms); +extern s32 rtw_get_passing_time_ms(u32 start); +extern s32 rtw_get_time_interval_ms(u32 start, u32 end); -extern void rtw_sleep_schedulable(int ms); +extern void rtw_sleep_schedulable(int ms); -extern void rtw_msleep_os(int ms); -extern void rtw_usleep_os(int us); +extern void rtw_msleep_os(int ms); +extern void rtw_usleep_os(int us); -extern u32 rtw_atoi(u8* s); +extern u32 rtw_atoi(u8 *s); -extern void rtw_mdelay_os(int ms); -extern void rtw_udelay_os(int us); +extern void rtw_mdelay_os(int ms); +extern void rtw_udelay_os(int us); extern void rtw_yield_os(void);