rtl8192eu: Fix more sparse errors

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2013-06-20 10:13:14 -05:00
parent 7e778fc0be
commit 5c8ff88003
13 changed files with 171 additions and 285 deletions

View file

@ -88,7 +88,7 @@ static void update_BCNTIM(_adapter *padapter)
//update TIM IE //update TIM IE
if (true) { if (true) {
u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL; u8 *p, *dst_ie, *premainder_ie=NULL, *pbackup_remainder_ie=NULL;
u16 tim_bitmap_le; __le16 tim_bitmap_le;
uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen; uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);

View file

@ -1546,7 +1546,7 @@ int nat25_handle_frame(_adapter *priv, struct sk_buff *skb)
skb_push(skb, 4); skb_push(skb, 4);
for (i=0; i<6; i++) for (i=0; i<6; i++)
*((unsigned short *)(skb->data+i*2)) = *((unsigned short *)(skb->data+4+i*2)); *((unsigned short *)(skb->data+i*2)) = *((unsigned short *)(skb->data+4+i*2));
*((unsigned short *)(skb->data+ETH_ALEN*2)) = __constant_htons(ETH_P_8021Q); *((__be16 *)(skb->data+ETH_ALEN*2)) = __constant_htons(ETH_P_8021Q);
*((unsigned short *)(skb->data+ETH_ALEN*2+2)) = vlan_hdr; *((unsigned short *)(skb->data+ETH_ALEN*2+2)) = vlan_hdr;
} }

View file

@ -418,20 +418,20 @@ _func_enter_;
ie += sz; ie += sz;
//beacon interval : 2bytes //beacon interval : 2bytes
*(u16*)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);//BCN_INTERVAL; *(__le16*)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);//BCN_INTERVAL;
sz += 2; sz += 2;
ie += 2; ie += 2;
//capability info //capability info
*(u16*)ie = 0; *(u16*)ie = 0;
*(u16*)ie |= cpu_to_le16(cap_IBSS); *(__le16*)ie |= cpu_to_le16(cap_IBSS);
if (pregistrypriv->preamble == PREAMBLE_SHORT) if (pregistrypriv->preamble == PREAMBLE_SHORT)
*(u16*)ie |= cpu_to_le16(cap_ShortPremble); *(__le16*)ie |= cpu_to_le16(cap_ShortPremble);
if (pdev_network->Privacy) if (pdev_network->Privacy)
*(u16*)ie |= cpu_to_le16(cap_Privacy); *(__le16*)ie |= cpu_to_le16(cap_Privacy);
sz += 2; sz += 2;
ie += 2; ie += 2;
@ -502,6 +502,7 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
{ {
int len; int len;
u16 val16; u16 val16;
__le16 le_tmp;
unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01}; unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01};
u8 *pbuf = pie; u8 *pbuf = pie;
int limit_new = limit; int limit_new = limit;
@ -519,9 +520,9 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)
} }
//check version... //check version...
_rtw_memcpy((u8 *)&val16, (pbuf + 6), sizeof(val16)); _rtw_memcpy((u8 *)&le_tmp, (pbuf + 6), sizeof(val16));
val16 = le16_to_cpu(val16); val16 = le16_to_cpu(le_tmp);
if (val16 != 0x0001) if (val16 != 0x0001)
goto check_next_ie; goto check_next_ie;
@ -1805,15 +1806,15 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork)
{ {
unsigned short cap = 0; unsigned short cap = 0;
u8 bencrypt = 0; u8 bencrypt = 0;
//u8 wpa_ie[255],rsn_ie[255]; __le16 le_tmp;
u16 wpa_len=0,rsn_len=0; u16 wpa_len=0,rsn_len=0;
struct HT_info_element *pht_info = NULL; struct HT_info_element *pht_info = NULL;
struct rtw_ieee80211_ht_cap *pht_cap = NULL; struct rtw_ieee80211_ht_cap *pht_cap = NULL;
unsigned int len; unsigned int len;
unsigned char *p; unsigned char *p;
_rtw_memcpy((u8 *)&cap, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); _rtw_memcpy((u8 *)&le_tmp, rtw_get_capability_from_ie(pnetwork->network.IEs), 2);
cap = le16_to_cpu(cap); cap = le16_to_cpu(le_tmp);
if (cap & WLAN_CAPABILITY_PRIVACY) { if (cap & WLAN_CAPABILITY_PRIVACY) {
bencrypt = 1; bencrypt = 1;
pnetwork->network.Privacy = 1; pnetwork->network.Privacy = 1;
@ -1935,12 +1936,9 @@ int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8* category, u8 *act
fc = le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)frame)->frame_ctl); fc = le16_to_cpu(((struct rtw_ieee80211_hdr_3addr *)frame)->frame_ctl);
if ((fc & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)) if ((fc & (RTW_IEEE80211_FCTL_FTYPE|RTW_IEEE80211_FCTL_STYPE)) !=
!= (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION) (RTW_IEEE80211_FTYPE_MGMT|RTW_IEEE80211_STYPE_ACTION))
)
{
return false; return false;
}
c = frame_body[0]; c = frame_body[0];

View file

@ -1123,9 +1123,9 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
#ifdef CONFIG_AP_MODE #ifdef CONFIG_AP_MODE
_irqL irqL; _irqL irqL;
unsigned int auth_mode, ie_len; unsigned int auth_mode, ie_len;
__le16 seq; u16 seq;
unsigned char *sa, *p; unsigned char *sa, *p;
__le16 algorithm; u16 algorithm;
int status; int status;
static struct sta_info stat; static struct sta_info stat;
struct sta_info *pstat=NULL; struct sta_info *pstat=NULL;
@ -1154,19 +1154,17 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
sa = GetAddr2Ptr(pframe); sa = GetAddr2Ptr(pframe);
auth_mode = psecuritypriv->dot11AuthAlgrthm; auth_mode = psecuritypriv->dot11AuthAlgrthm;
seq = cpu_to_le16(*(u16*)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + 2)); seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + 2));
algorithm = cpu_to_le16(*(u16*)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN)); algorithm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN));
DBG_88E("auth alg=%x, seq=%X\n", algorithm, seq); DBG_88E("auth alg=%x, seq=%X\n", algorithm, seq);
if (auth_mode == 2 && if (auth_mode == 2 && psecuritypriv->dot11PrivacyAlgrthm != _WEP40_ &&
psecuritypriv->dot11PrivacyAlgrthm != _WEP40_ &&
psecuritypriv->dot11PrivacyAlgrthm != _WEP104_) psecuritypriv->dot11PrivacyAlgrthm != _WEP104_)
auth_mode = 0; auth_mode = 0;
if ((algorithm > 0 && auth_mode == 0) || // rx a shared-key auth but shared not enabled if ((algorithm > 0 && auth_mode == 0) || // rx a shared-key auth but shared not enabled
(algorithm == 0 && auth_mode == 1) ) // rx a open-system auth but shared-key is enabled (algorithm == 0 && auth_mode == 1)) { // rx a open-system auth but shared-key is enabled
{
DBG_88E("auth rejected due to bad alg [alg=%d, auth_mib=%d] %02X%02X%02X%02X%02X%02X\n", DBG_88E("auth rejected due to bad alg [alg=%d, auth_mib=%d] %02X%02X%02X%02X%02X%02X\n",
algorithm, auth_mode, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]); algorithm, auth_mode, sa[0], sa[1], sa[2], sa[3], sa[4], sa[5]);
@ -1175,20 +1173,17 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
goto auth_fail; goto auth_fail;
} }
if (rtw_access_ctrl(padapter, sa) == false) if (rtw_access_ctrl(padapter, sa) == false) {
{
status = _STATS_UNABLE_HANDLE_STA_; status = _STATS_UNABLE_HANDLE_STA_;
goto auth_fail; goto auth_fail;
} }
pstat = rtw_get_stainfo(pstapriv, sa); pstat = rtw_get_stainfo(pstapriv, sa);
if (pstat == NULL) if (pstat == NULL) {
{
// allocate a new one // allocate a new one
DBG_88E("going to alloc stainfo for sa=%pM\n", sa); DBG_88E("going to alloc stainfo for sa=%pM\n", sa);
pstat = rtw_alloc_stainfo(pstapriv, sa); pstat = rtw_alloc_stainfo(pstapriv, sa);
if (pstat == NULL) if (pstat == NULL) {
{
DBG_88E(" Exceed the upper limit of supported clients...\n"); DBG_88E(" Exceed the upper limit of supported clients...\n");
status = _STATS_UNABLE_HANDLE_STA_; status = _STATS_UNABLE_HANDLE_STA_;
goto auth_fail; goto auth_fail;
@ -1197,12 +1192,9 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
pstat->state = WIFI_FW_AUTH_NULL; pstat->state = WIFI_FW_AUTH_NULL;
pstat->auth_seq = 0; pstat->auth_seq = 0;
} } else {
else
{
_enter_critical_bh(&pstapriv->asoc_list_lock, &irqL); _enter_critical_bh(&pstapriv->asoc_list_lock, &irqL);
if (rtw_is_list_empty(&pstat->asoc_list)==false) if (rtw_is_list_empty(&pstat->asoc_list)==false) {
{
rtw_list_delete(&pstat->asoc_list); rtw_list_delete(&pstat->asoc_list);
pstapriv->asoc_list_cnt--; pstapriv->asoc_list_cnt--;
if (pstat->expire_to > 0) if (pstat->expire_to > 0)
@ -1238,15 +1230,12 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
if (algorithm==0 && (auth_mode == 0 || auth_mode == 2)) if (algorithm==0 && (auth_mode == 0 || auth_mode == 2))
{ {
if (seq == 1) if (seq == 1) {
{
pstat->state &= ~WIFI_FW_AUTH_NULL; pstat->state &= ~WIFI_FW_AUTH_NULL;
pstat->state |= WIFI_FW_AUTH_SUCCESS; pstat->state |= WIFI_FW_AUTH_SUCCESS;
pstat->expire_to = pstapriv->assoc_to; pstat->expire_to = pstapriv->assoc_to;
pstat->authalg = le16_to_cpu(algorithm); pstat->authalg = algorithm;
} } else {
else
{
DBG_88E("(2)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", DBG_88E("(2)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n",
seq, pstat->auth_seq+1); seq, pstat->auth_seq+1);
status = _STATS_OUT_OF_AUTH_SEQ_; status = _STATS_OUT_OF_AUTH_SEQ_;
@ -1255,48 +1244,39 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
} }
else // shared system or auto authentication else // shared system or auto authentication
{ {
if (seq == 1) if (seq == 1) {
{
//prepare for the challenging txt... //prepare for the challenging txt...
//get_random_bytes((void *)pstat->chg_txt, 128);//TODO: //get_random_bytes((void *)pstat->chg_txt, 128);//TODO:
pstat->state &= ~WIFI_FW_AUTH_NULL; pstat->state &= ~WIFI_FW_AUTH_NULL;
pstat->state |= WIFI_FW_AUTH_STATE; pstat->state |= WIFI_FW_AUTH_STATE;
pstat->authalg = le16_to_cpu(algorithm); pstat->authalg = algorithm;
pstat->auth_seq = 2; pstat->auth_seq = 2;
} } else if (seq == 3) {
else if (seq == 3)
{
//checking for challenging txt... //checking for challenging txt...
DBG_88E("checking for challenging txt...\n"); DBG_88E("checking for challenging txt...\n");
p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_ , _CHLGETXT_IE_, (int *)&ie_len, p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_ , _CHLGETXT_IE_, (int *)&ie_len,
len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4); len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4);
if ((p==NULL) || (ie_len<=0)) if ((p==NULL) || (ie_len<=0)) {
{
DBG_88E("auth rejected because challenge failure!(1)\n"); DBG_88E("auth rejected because challenge failure!(1)\n");
status = _STATS_CHALLENGE_FAIL_; status = _STATS_CHALLENGE_FAIL_;
goto auth_fail; goto auth_fail;
} }
if (_rtw_memcmp((void *)(p + 2), pstat->chg_txt, 128)) if (_rtw_memcmp((void *)(p + 2), pstat->chg_txt, 128)) {
{
pstat->state &= (~WIFI_FW_AUTH_STATE); pstat->state &= (~WIFI_FW_AUTH_STATE);
pstat->state |= WIFI_FW_AUTH_SUCCESS; pstat->state |= WIFI_FW_AUTH_SUCCESS;
// challenging txt is correct... // challenging txt is correct...
pstat->expire_to = pstapriv->assoc_to; pstat->expire_to = pstapriv->assoc_to;
} } else {
else
{
DBG_88E("auth rejected because challenge failure!\n"); DBG_88E("auth rejected because challenge failure!\n");
status = _STATS_CHALLENGE_FAIL_; status = _STATS_CHALLENGE_FAIL_;
goto auth_fail; goto auth_fail;
} }
} } else {
else
{
DBG_88E("(3)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n", DBG_88E("(3)auth rejected because out of seq [rx_seq=%d, exp_seq=%d]!\n",
seq, pstat->auth_seq+1); seq, pstat->auth_seq+1);
status = _STATS_OUT_OF_AUTH_SEQ_; status = _STATS_OUT_OF_AUTH_SEQ_;
@ -1304,7 +1284,6 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
} }
} }
// Now, we are going to issue_auth... // Now, we are going to issue_auth...
pstat->auth_seq = seq + 1; pstat->auth_seq = seq + 1;
@ -1315,7 +1294,6 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame)
if (pstat->state & WIFI_FW_AUTH_SUCCESS) if (pstat->state & WIFI_FW_AUTH_SUCCESS)
pstat->auth_seq = 0; pstat->auth_seq = 0;
return _SUCCESS; return _SUCCESS;
auth_fail: auth_fail:
@ -1358,12 +1336,11 @@ unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame)
offset = (GetPrivacy(pframe))? 4: 0; offset = (GetPrivacy(pframe))? 4: 0;
algthm = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset)); algthm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset));
seq = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2)); seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2));
status = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4)); status = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4));
if (status != 0) if (status != 0) {
{
DBG_88E("clnt auth fail, status: %d\n", status); DBG_88E("clnt auth fail, status: %d\n", status);
if (status == 13)//&& pmlmeinfo->auth_algo == dot11AuthAlgrthm_Auto) if (status == 13)//&& pmlmeinfo->auth_algo == dot11AuthAlgrthm_Auto)
{ {
@ -2078,8 +2055,8 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
_cancel_timer_ex(&pmlmeext->link_timer); _cancel_timer_ex(&pmlmeext->link_timer);
//status //status
if ((status = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN + 2))) > 0) status = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 2));
{ if (status > 0) {
DBG_88E("assoc reject, status code: %d\n", status); DBG_88E("assoc reject, status code: %d\n", status);
pmlmeinfo->state = WIFI_FW_NULL_STATE; pmlmeinfo->state = WIFI_FW_NULL_STATE;
res = -4; res = -4;
@ -2087,54 +2064,44 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame)
} }
//get capabilities //get capabilities
pmlmeinfo->capability = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); pmlmeinfo->capability = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN));
//set slot time //set slot time
pmlmeinfo->slotTime = (pmlmeinfo->capability & BIT(10))? 9: 20; pmlmeinfo->slotTime = (pmlmeinfo->capability & BIT(10))? 9: 20;
//AID //AID
res = pmlmeinfo->aid = (int)(le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN + 4))&0x3fff); res = pmlmeinfo->aid = (int)(le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 4))&0x3fff);
//following are moved to join event callback function //following are moved to join event callback function
//to handle HT, WMM, rate adaptive, update MAC reg //to handle HT, WMM, rate adaptive, update MAC reg
//for not to handle the synchronous IO in the tasklet //for not to handle the synchronous IO in the tasklet
for (i = (6 + WLAN_HDR_A3_LEN); i < pkt_len;) for (i = (6 + WLAN_HDR_A3_LEN); i < pkt_len;) {
{
pIE = (PNDIS_802_11_VARIABLE_IEs)(pframe + i); pIE = (PNDIS_802_11_VARIABLE_IEs)(pframe + i);
switch (pIE->ElementID) switch (pIE->ElementID) {
{
case _VENDOR_SPECIFIC_IE_: case _VENDOR_SPECIFIC_IE_:
if (_rtw_memcmp(pIE->data, WMM_PARA_OUI, 6)) //WMM if (_rtw_memcmp(pIE->data, WMM_PARA_OUI, 6)) //WMM
{
WMM_param_handler(padapter, pIE); WMM_param_handler(padapter, pIE);
}
#if defined(CONFIG_P2P) && defined(CONFIG_WFD) #if defined(CONFIG_P2P) && defined(CONFIG_WFD)
else if ( _rtw_memcmp(pIE->data, WFD_OUI, 4)) //WFD else if ( _rtw_memcmp(pIE->data, WFD_OUI, 4)) { //WFD
{
DBG_88E( "[%s] Found WFD IE\n", __func__ ); DBG_88E( "[%s] Found WFD IE\n", __func__ );
WFD_info_handler( padapter, pIE ); WFD_info_handler( padapter, pIE );
} }
#endif #endif
break; break;
#ifdef CONFIG_WAPI_SUPPORT #ifdef CONFIG_WAPI_SUPPORT
case _WAPI_IE_: case _WAPI_IE_:
pWapiIE = pIE; pWapiIE = pIE;
break; break;
#endif #endif
case _HT_CAPABILITY_IE_: //HT caps case _HT_CAPABILITY_IE_: //HT caps
HT_caps_handler(padapter, pIE); HT_caps_handler(padapter, pIE);
break; break;
case _HT_EXTRA_INFO_IE_: //HT info case _HT_EXTRA_INFO_IE_: //HT info
HT_info_handler(padapter, pIE); HT_info_handler(padapter, pIE);
break; break;
case _ERPINFO_IE_: case _ERPINFO_IE_:
ERP_IE_handler(padapter, pIE); ERP_IE_handler(padapter, pIE);
default: default:
break; break;
} }
@ -2187,7 +2154,7 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame)
} }
#endif //CONFIG_P2P #endif //CONFIG_P2P
reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN));
DBG_88E("%s Reason code(%d)\n", __func__,reason); DBG_88E("%s Reason code(%d)\n", __func__,reason);
@ -5787,51 +5754,37 @@ unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame)
if (category != RTW_WLAN_CATEGORY_P2P) if (category != RTW_WLAN_CATEGORY_P2P)
return _SUCCESS; return _SUCCESS;
if ( cpu_to_be32( *( ( u32* ) ( frame_body + 1 ) ) ) != P2POUI ) if (be32_to_cpu(*((__be32 * )(frame_body + 1))) != P2POUI)
return _SUCCESS; return _SUCCESS;
#ifdef CONFIG_IOCTL_CFG80211 #ifdef CONFIG_IOCTL_CFG80211
if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled) if (wdev_to_priv(padapter->rtw_wdev)->p2p_enabled) {
{
rtw_cfg80211_rx_action_p2p(padapter, pframe, len); rtw_cfg80211_rx_action_p2p(padapter, pframe, len);
return _SUCCESS; return _SUCCESS;
} } else
else
#endif //CONFIG_IOCTL_CFG80211 #endif //CONFIG_IOCTL_CFG80211
{ {
len -= sizeof(struct rtw_ieee80211_hdr_3addr); len -= sizeof(struct rtw_ieee80211_hdr_3addr);
OUI_Subtype = frame_body[5]; OUI_Subtype = frame_body[5];
dialogToken = frame_body[6]; dialogToken = frame_body[6];
switch (OUI_Subtype) switch (OUI_Subtype) {
{
case P2P_NOTICE_OF_ABSENCE: case P2P_NOTICE_OF_ABSENCE:
break; break;
case P2P_PRESENCE_REQUEST: case P2P_PRESENCE_REQUEST:
process_p2p_presence_req(pwdinfo, pframe, len); process_p2p_presence_req(pwdinfo, pframe, len);
break; break;
case P2P_PRESENCE_RESPONSE: case P2P_PRESENCE_RESPONSE:
break; break;
case P2P_GO_DISC_REQUEST: case P2P_GO_DISC_REQUEST:
break; break;
default: default:
break; break;
} }
} }
#endif //CONFIG_P2P #endif //CONFIG_P2P
return _SUCCESS; return _SUCCESS;
} }
unsigned int OnAction(_adapter *padapter, union recv_frame *precv_frame) unsigned int OnAction(_adapter *padapter, union recv_frame *precv_frame)

View file

@ -727,6 +727,7 @@ union recv_frame * portctrl(_adapter *adapter,union recv_frame * precv_frame)
u16 ether_type=0; u16 ether_type=0;
u16 eapol_type = 0x888e;//for Funia BD's WPA issue u16 eapol_type = 0x888e;//for Funia BD's WPA issue
struct rx_pkt_attrib *pattrib; struct rx_pkt_attrib *pattrib;
__be16 be_tmp;
_func_enter_; _func_enter_;
@ -756,8 +757,8 @@ _func_enter_;
//get ether_type //get ether_type
ptr=ptr+pfhdr->attrib.hdrlen+pfhdr->attrib.iv_len+LLC_HEADER_SIZE; ptr=ptr+pfhdr->attrib.hdrlen+pfhdr->attrib.iv_len+LLC_HEADER_SIZE;
_rtw_memcpy(&ether_type,ptr, 2); _rtw_memcpy(&be_tmp, ptr, 2);
ether_type= ntohs((unsigned short )ether_type); ether_type= ntohs(be_tmp);
if (ether_type == eapol_type) { if (ether_type == eapol_type) {
prtnframe=precv_frame; prtnframe=precv_frame;
@ -2159,6 +2160,7 @@ sint wlanhdr_to_ethhdr ( union recv_frame *precvframe)
{ {
sint rmv_len; sint rmv_len;
u16 eth_type, len; u16 eth_type, len;
__be16 be_tmp;
u8 bsnaphdr; u8 bsnaphdr;
u8 *psnap_type; u8 *psnap_type;
struct ieee80211_snap_hdr *psnap; struct ieee80211_snap_hdr *psnap;
@ -2187,8 +2189,7 @@ _func_enter_;
_rtw_memcmp(psnap, rtw_bridge_tunnel_header, SNAP_SIZE)){ _rtw_memcmp(psnap, rtw_bridge_tunnel_header, SNAP_SIZE)){
/* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */ /* remove RFC1042 or Bridge-Tunnel encapsulation and replace EtherType */
bsnaphdr = true; bsnaphdr = true;
} } else {
else {
/* Leave Ethernet header part of hdr and full payload */ /* Leave Ethernet header part of hdr and full payload */
bsnaphdr = false; bsnaphdr = false;
} }
@ -2198,12 +2199,11 @@ _func_enter_;
RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x ===\n\n", pattrib->hdrlen, pattrib->iv_len)); RT_TRACE(_module_rtl871x_recv_c_,_drv_info_,("\n===pattrib->hdrlen: %x, pattrib->iv_len:%x ===\n\n", pattrib->hdrlen, pattrib->iv_len));
_rtw_memcpy(&eth_type, ptr+rmv_len, 2); _rtw_memcpy(&be_tmp, ptr+rmv_len, 2);
eth_type= ntohs((u16)eth_type); //pattrib->ether_type eth_type = ntohs(be_tmp); //pattrib->ether_type
pattrib->eth_type = eth_type; pattrib->eth_type = eth_type;
if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)) if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true)) {
{
ptr += rmv_len ; ptr += rmv_len ;
*ptr = 0x87; *ptr = 0x87;
*(ptr+1) = 0x12; *(ptr+1) = 0x12;
@ -2222,8 +2222,8 @@ _func_enter_;
_rtw_memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN); _rtw_memcpy(ptr+ETH_ALEN, pattrib->src, ETH_ALEN);
if (!bsnaphdr) { if (!bsnaphdr) {
len = htons(len); be_tmp = htons(len);
_rtw_memcpy(ptr+12, &len, 2); _rtw_memcpy(ptr+12, &be_tmp, 2);
} }
_func_exit_; _func_exit_;
@ -2240,11 +2240,10 @@ sint wlanhdr_to_ethhdr ( union recv_frame *precvframe)
u8 bsnaphdr; u8 bsnaphdr;
u8 *psnap_type; u8 *psnap_type;
struct ieee80211_snap_hdr *psnap; struct ieee80211_snap_hdr *psnap;
__be16 be_tmp;
sint ret=_SUCCESS; sint ret=_SUCCESS;
_adapter *adapter =precvframe->u.hdr.adapter; _adapter *adapter =precvframe->u.hdr.adapter;
struct mlme_priv *pmlmepriv = &adapter->mlmepriv; struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
u8 *ptr = get_recvframe_data(precvframe); // point to frame_ctrl field u8 *ptr = get_recvframe_data(precvframe); // point to frame_ctrl field
struct rx_pkt_attrib *pattrib = & precvframe->u.hdr.attrib; struct rx_pkt_attrib *pattrib = & precvframe->u.hdr.attrib;
struct _vlan *pvlan = NULL; struct _vlan *pvlan = NULL;
@ -2286,8 +2285,8 @@ _func_enter_;
ptr += rmv_len ; ptr += rmv_len ;
_rtw_memcpy(&eth_type, ptr, 2); _rtw_memcpy(&be_tmp, ptr, 2);
eth_type= ntohs((unsigned short )eth_type); //pattrib->ether_type eth_type= ntohs(be_tmp); //pattrib->ether_type
ptr +=2; ptr +=2;
if (pattrib->encrypt){ if (pattrib->encrypt){
@ -2679,7 +2678,6 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
while (a_len > ETH_HLEN) { while (a_len > ETH_HLEN) {
/* Offset 12 denote 2 mac address */ /* Offset 12 denote 2 mac address */
//nSubframe_Length = ntohs(*((u16*)(pdata + 12)));
nSubframe_Length = RTW_GET_BE16(pdata + 12); nSubframe_Length = RTW_GET_BE16(pdata + 12);
if ( a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length) ) { if ( a_len < (ETHERNET_HEADER_SIZE + nSubframe_Length) ) {
@ -2762,7 +2760,6 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
#ifndef PLATFORM_FREEBSD #ifndef PLATFORM_FREEBSD
sub_skb = subframes[i]; sub_skb = subframes[i];
/* convert hdr + possible LLC headers into Ethernet header */ /* convert hdr + possible LLC headers into Ethernet header */
//eth_type = ntohs(*(u16*)&sub_skb->data[6]);
eth_type = RTW_GET_BE16(&sub_skb->data[6]); eth_type = RTW_GET_BE16(&sub_skb->data[6]);
if (sub_skb->len >= 8 && if (sub_skb->len >= 8 &&
((_rtw_memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) && ((_rtw_memcmp(sub_skb->data, rtw_rfc1042_header, SNAP_SIZE) &&
@ -2773,7 +2770,7 @@ static int amsdu_to_msdu(_adapter *padapter, union recv_frame *prframe)
_rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN); _rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->src, ETH_ALEN);
_rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN); _rtw_memcpy(skb_push(sub_skb, ETH_ALEN), pattrib->dst, ETH_ALEN);
} else { } else {
u16 len; __be16 len;
/* Leave Ethernet header part of hdr and full payload */ /* Leave Ethernet header part of hdr and full payload */
len = htons(sub_skb->len); len = htons(sub_skb->len);
_rtw_memcpy(skb_push(sub_skb, 2), &len, 2); _rtw_memcpy(skb_push(sub_skb, 2), &len, 2);

View file

@ -139,21 +139,20 @@ exit:
_func_exit_; _func_exit_;
} }
static u32 getcrc32(u8 *buf, sint len) static __le32 getcrc32(u8 *buf, sint len)
{ {
u8 *p; u8 *p;
u32 crc; u32 crc;
_func_enter_; _func_enter_;
if (bcrc32initialized == 0) crc32_init(); if (bcrc32initialized == 0)
crc32_init();
crc = 0xffffffff; /* preload shift register, per CRC-32 spec */ crc = 0xffffffff; /* preload shift register, per CRC-32 spec */
for (p = buf; len > 0; ++p, --len) for (p = buf; len > 0; ++p, --len)
{
crc = crc32_table[ (crc ^ *p) & 0xff] ^ (crc >> 8); crc = crc32_table[ (crc ^ *p) & 0xff] ^ (crc >> 8);
}
_func_exit_; _func_exit_;
return ~crc; /* transmit complement, per CRC-32 spec */ return cpu_to_le32(~crc); /* transmit complement, per CRC-32 spec */
} }
@ -212,7 +211,7 @@ _func_enter_;
length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len; length=pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len- pattrib->icv_len;
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length)); *((__le32 *)crc) = getcrc32(payload,length);
arcfour_init(&mycontext, wepkey,3+keylength); arcfour_init(&mycontext, wepkey,3+keylength);
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
@ -222,7 +221,7 @@ _func_enter_;
else else
{ {
length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length)); *((__le32 *)crc) = getcrc32(payload,length);
arcfour_init(&mycontext, wepkey,3+keylength); arcfour_init(&mycontext, wepkey,3+keylength);
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
arcfour_encrypt(&mycontext, payload+length, crc, 4); arcfour_encrypt(&mycontext, payload+length, crc, 4);
@ -272,7 +271,7 @@ _func_enter_;
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
//calculate icv and compare the icv //calculate icv and compare the icv
*((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); *((__le32 *)crc) = getcrc32(payload, length - 4);
if (crc[3] != payload[length-1] || if (crc[3] != payload[length-1] ||
crc[2] != payload[length-2] || crc[2] != payload[length-2] ||
@ -724,7 +723,7 @@ _func_enter_;
RT_TRACE(_module_rtl871x_security_c_, _drv_info_, RT_TRACE(_module_rtl871x_security_c_, _drv_info_,
("pattrib->iv_len =%x, pattrib->icv_len =%x\n", ("pattrib->iv_len =%x, pattrib->icv_len =%x\n",
pattrib->iv_len,pattrib->icv_len)); pattrib->iv_len,pattrib->icv_len));
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/ *((__le32 *)crc) = getcrc32(payload,length);/* modified by Amy*/
arcfour_init(&mycontext, rc4key,16); arcfour_init(&mycontext, rc4key,16);
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
@ -733,7 +732,7 @@ _func_enter_;
} }
else{ else{
length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ; length=pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len ;
*((__le32 *)crc)=cpu_to_le32(getcrc32(payload,length));/* modified by Amy*/ *((__le32 *)crc) = getcrc32(payload,length);/* modified by Amy*/
arcfour_init(&mycontext,rc4key,16); arcfour_init(&mycontext,rc4key,16);
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
arcfour_encrypt(&mycontext, payload+length, crc, 4); arcfour_encrypt(&mycontext, payload+length, crc, 4);
@ -825,7 +824,7 @@ _func_enter_;
arcfour_init(&mycontext, rc4key,16); arcfour_init(&mycontext, rc4key,16);
arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload, payload, length);
*((u32 *)crc) = le32_to_cpu(getcrc32(payload, length-4)); *((__le32 *)crc) = getcrc32(payload, length-4);
if (crc[3] != payload[length-1] || if (crc[3] != payload[length-1] ||
crc[2] != payload[length-2] || crc[2] != payload[length-2] ||

View file

@ -623,7 +623,7 @@ __inline u8 *get_my_bssid(WLAN_BSSID_EX *pnetwork)
u16 get_beacon_interval(WLAN_BSSID_EX *bss) u16 get_beacon_interval(WLAN_BSSID_EX *bss)
{ {
unsigned short val; __le16 val;
_rtw_memcpy((unsigned char *)&val, rtw_get_beacon_interval_from_ie(bss->IEs), 2); _rtw_memcpy((unsigned char *)&val, rtw_get_beacon_interval_from_ie(bss->IEs), 2);
return le16_to_cpu(val); return le16_to_cpu(val);
@ -921,8 +921,7 @@ void WMMOnAssocRsp(_adapter *padapter)
struct xmit_priv *pxmitpriv = &padapter->xmitpriv; struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
struct registry_priv *pregpriv = &padapter->registrypriv; struct registry_priv *pregpriv = &padapter->registrypriv;
if (pmlmeinfo->WMM_enable == 0) if (pmlmeinfo->WMM_enable == 0) {
{
padapter->mlmepriv.acm_mask = 0; padapter->mlmepriv.acm_mask = 0;
return; return;
} }
@ -934,8 +933,7 @@ void WMMOnAssocRsp(_adapter *padapter)
else else
aSifsTime = 16; aSifsTime = 16;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++) {
{
ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03; ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03;
ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01; ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01;
@ -948,8 +946,7 @@ void WMMOnAssocRsp(_adapter *padapter)
acParm = AIFS | (ECWMin << 8) | (ECWMax << 12) | (TXOP << 16); acParm = AIFS | (ECWMin << 8) | (ECWMax << 12) | (TXOP << 16);
switch (ACI) switch (ACI) {
{
case 0x0: case 0x0:
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acParm)); rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BE, (u8 *)(&acParm));
acm_mask |= (ACM? BIT(1):0); acm_mask |= (ACM? BIT(1):0);
@ -1180,23 +1177,13 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
} }
} }
// Commented by Albert 2010/07/12
// Have to handle the endian issue after copying.
// HT_ext_caps didn't be used yet.
pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = le16_to_cpu( pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info );
pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps = le16_to_cpu( pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps );
rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type));
//update the MCS rates //update the MCS rates
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++) {
{ if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) {
if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R))
{
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
} } else {
else
{
#ifdef CONFIG_DISABLE_MCS13TO15 #ifdef CONFIG_DISABLE_MCS13TO15
if (pmlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40 && (pregistrypriv->wifi_spec!=1)) if (pmlmeext->cur_bwmode == HT_CHANNEL_WIDTH_40 && (pregistrypriv->wifi_spec!=1))
pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R_MCS13TO15_OFF[i]; pmlmeinfo->HT_caps.u.HT_cap_element.MCS_rate[i] &= MCS_rate_2R_MCS13TO15_OFF[i];
@ -1207,9 +1194,7 @@ void HT_caps_handler(_adapter *padapter, PNDIS_802_11_VARIABLE_IEs pIE)
#endif //CONFIG_DISABLE_MCS13TO15 #endif //CONFIG_DISABLE_MCS13TO15
} }
#ifdef RTL8192C_RECONFIG_TO_1T1R #ifdef RTL8192C_RECONFIG_TO_1T1R
{
pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i];
}
#endif #endif
} }
#endif //CONFIG_80211N_HT #endif //CONFIG_80211N_HT
@ -1878,15 +1863,11 @@ int support_short_GI(_adapter *padapter, struct HT_caps_element *pHT_caps)
bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40)? 6: 5; bit_offset = (pmlmeext->cur_bwmode & HT_CHANNEL_WIDTH_40)? 6: 5;
if (pHT_caps->u.HT_cap_element.HT_caps_info & (0x1 << bit_offset)) if (__le16_to_cpu(pHT_caps->u.HT_cap_element.HT_caps_info) & (0x1 << bit_offset))
{
return _SUCCESS; return _SUCCESS;
}
else else
{
return _FAIL; return _FAIL;
} }
}
unsigned char get_highest_rate_idx(u32 mask) unsigned char get_highest_rate_idx(u32 mask)
{ {
@ -2317,10 +2298,10 @@ void process_addba_req(_adapter *padapter, u8 *paddba_req, u8 *addr)
void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len)
{ {
u8* pIE; u8* pIE;
u32 *pbuf; __le32 *pbuf;
pIE = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); pIE = pframe + sizeof(struct rtw_ieee80211_hdr_3addr);
pbuf = (u32*)pIE; pbuf = (__le32*)pIE;
pmlmeext->TSFValue = le32_to_cpu(*(pbuf+1)); pmlmeext->TSFValue = le32_to_cpu(*(pbuf+1));

View file

@ -353,14 +353,14 @@ void rtw_hal_write_bbreg(_adapter *padapter, u32 RegAddr, u32 BitMask, u32 Data)
padapter->HalFunc.write_bbreg(padapter, RegAddr, BitMask, Data); padapter->HalFunc.write_bbreg(padapter, RegAddr, BitMask, Data);
} }
u32 rtw_hal_read_rfreg(_adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask) u32 rtw_hal_read_rfreg(_adapter *padapter, RF_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask)
{ {
u32 data = 0; u32 data = 0;
if ( padapter->HalFunc.read_rfreg) if ( padapter->HalFunc.read_rfreg)
data = padapter->HalFunc.read_rfreg(padapter, eRFPath, RegAddr, BitMask); data = padapter->HalFunc.read_rfreg(padapter, eRFPath, RegAddr, BitMask);
return data; return data;
} }
void rtw_hal_write_rfreg(_adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask, u32 Data) void rtw_hal_write_rfreg(_adapter *padapter, RF_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask, u32 Data)
{ {
if (padapter->HalFunc.write_rfreg) if (padapter->HalFunc.write_rfreg)
padapter->HalFunc.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data); padapter->HalFunc.write_rfreg(padapter, eRFPath, RegAddr, BitMask, Data);

View file

@ -661,13 +661,8 @@ phy_RFSerialWrite(
* Return: u4Byte Readback value * Return: u4Byte Readback value
* Note: This function is equal to "GetRFRegSetting" in PHY programming guide * Note: This function is equal to "GetRFRegSetting" in PHY programming guide
*/ */
u32 u32 rtl8188e_PHY_QueryRFReg(PADAPTER Adapter, RF_RADIO_PATH_E eRFPath,
rtl8188e_PHY_QueryRFReg( u32 RegAddr, u32 BitMask)
PADAPTER Adapter,
RF_RADIO_PATH_E eRFPath,
u32 RegAddr,
u32 BitMask
)
{ {
u32 Original_Value, Readback_Value, BitShift; u32 Original_Value, Readback_Value, BitShift;
//HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); //HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);

View file

@ -221,15 +221,8 @@ void rtl8188e_PHY_SetBBReg( PADAPTER Adapter,
u32 RegAddr, u32 RegAddr,
u32 BitMask, u32 BitMask,
u32 Data ); u32 Data );
u32 rtl8188e_PHY_QueryRFReg( PADAPTER Adapter, u32 rtl8188e_PHY_QueryRFReg(PADAPTER Adapter, RF_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask);
RF_RADIO_PATH_E eRFPath, void rtl8188e_PHY_SetRFReg(PADAPTER Adapter, RF_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask, u32 Data);
u32 RegAddr,
u32 BitMask );
void rtl8188e_PHY_SetRFReg( PADAPTER Adapter,
RF_RADIO_PATH_E eRFPath,
u32 RegAddr,
u32 BitMask,
u32 Data );
// //
// Initialization related function // Initialization related function

View file

@ -23,11 +23,7 @@
#include <drv_conf.h> #include <drv_conf.h>
#include <osdep_service.h> #include <osdep_service.h>
#include <drv_types.h> #include <drv_types.h>
#include <Hal8188EPhyCfg.h>
#ifdef CONFIG_PCI_HCI
#include <pci_hal.h>
#endif
enum RTL871X_HCI_TYPE { enum RTL871X_HCI_TYPE {
RTW_PCIE = BIT0, RTW_PCIE = BIT0,
@ -428,8 +424,8 @@ void rtw_hal_bcn_related_reg_setting(_adapter *padapter);
u32 rtw_hal_read_bbreg(_adapter *padapter, u32 RegAddr, u32 BitMask); u32 rtw_hal_read_bbreg(_adapter *padapter, u32 RegAddr, u32 BitMask);
void rtw_hal_write_bbreg(_adapter *padapter, u32 RegAddr, u32 BitMask, u32 Data); void rtw_hal_write_bbreg(_adapter *padapter, u32 RegAddr, u32 BitMask, u32 Data);
u32 rtw_hal_read_rfreg(_adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask); u32 rtw_hal_read_rfreg(_adapter *padapter, RF_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask);
void rtw_hal_write_rfreg(_adapter *padapter, u32 eRFPath, u32 RegAddr, u32 BitMask, u32 Data); void rtw_hal_write_rfreg(_adapter *padapter, RF_RADIO_PATH_E eRFPath, u32 RegAddr, u32 BitMask, u32 Data);
s32 rtw_hal_interrupt_handler(_adapter *padapter); s32 rtw_hal_interrupt_handler(_adapter *padapter);

View file

@ -354,9 +354,9 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(type); \ *(__le16 *)(pbuf) |= cpu_to_le16(type); \
} while (0) } while (0)
#define GetSequence(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) >> 4) #define GetSequence(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 22)) >> 4)
#define GetFragNum(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & 0x0f) #define GetFragNum(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 22)) & 0x0f)
#define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22))) #define GetTupleCache(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 22)))
@ -385,7 +385,7 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf); \ *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf); \
} while (0) } while (0)
#define GetPriority(pbuf) ((le16_to_cpu(*(unsigned short *)(pbuf))) & 0xf) #define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf)
#define SetEOSP(pbuf, eosp) \ #define SetEOSP(pbuf, eosp) \
do { \ do { \
@ -397,18 +397,20 @@ enum WIFI_REG_DOMAIN {
*(__le16 *)(pbuf) |= cpu_to_le16( (ack & 3) << 5); \ *(__le16 *)(pbuf) |= cpu_to_le16( (ack & 3) << 5); \
} while (0) } while (0)
#define GetAckpolicy(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 5) & 0x3) #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3)
#define GetAMsdu(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 7) & 0x1) #define GetAMsdu(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 7) & 0x1)
#define SetAMsdu(pbuf, amsdu) \ #define SetAMsdu(pbuf, amsdu) \
do { \ do { \
*(__le16 *)(pbuf) |= cpu_to_le16( (amsdu & 1) << 7); \ *(__le16 *)(pbuf) |= cpu_to_le16( (amsdu & 1) << 7); \
} while (0) } while (0)
#define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 2)) & 0x3fff) #define GetAid(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 2)) & 0x3fff)
#define GetTid(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + (((GetToDs(pbuf)<<1)|GetFrDs(pbuf))==3?30:24))) & 0x000f) #define GetTid(pbuf) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + \
(((GetToDs(pbuf)<<1) | GetFrDs(pbuf)) == 3 ? \
30 : 24))) & 0x000f)
#define GetAddr1Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 4)) #define GetAddr1Ptr(pbuf) ((unsigned char *)((SIZE_PTR)(pbuf) + 4))
@ -733,7 +735,7 @@ struct AC_param
{ {
unsigned char ACI_AIFSN; unsigned char ACI_AIFSN;
unsigned char CW; unsigned char CW;
unsigned short TXOP_limit; __le16 TXOP_limit;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct WMM_para_element struct WMM_para_element
@ -806,7 +808,7 @@ struct AC_param
{ {
unsigned char ACI_AIFSN; unsigned char ACI_AIFSN;
unsigned char CW; unsigned char CW;
unsigned short TXOP_limit; __le16 TXOP_limit;
}; };
struct WMM_para_element struct WMM_para_element

View file

@ -300,6 +300,7 @@ static char *translate_scan(_adapter *padapter,
{ {
struct iw_event iwe; struct iw_event iwe;
u16 cap; u16 cap;
__le16 le_tmp;
u32 ht_ielen = 0; u32 ht_ielen = 0;
char custom[MAX_CUSTOM_LEN]; char custom[MAX_CUSTOM_LEN];
char *p; char *p;
@ -469,10 +470,9 @@ static char *translate_scan(_adapter *padapter,
/* Add mode */ /* Add mode */
iwe.cmd = SIOCGIWMODE; iwe.cmd = SIOCGIWMODE;
_rtw_memcpy((u8 *)&cap, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); _rtw_memcpy((u8 *)&le_tmp, rtw_get_capability_from_ie(pnetwork->network.IEs), 2);
cap = le16_to_cpu(le_tmp);
cap = le16_to_cpu(cap);
if (cap & (WLAN_CAPABILITY_IBSS |WLAN_CAPABILITY_BSS)){ if (cap & (WLAN_CAPABILITY_IBSS |WLAN_CAPABILITY_BSS)){
if (cap & WLAN_CAPABILITY_BSS) if (cap & WLAN_CAPABILITY_BSS)
@ -1829,29 +1829,22 @@ static int rtw_wx_set_mlme(struct net_device *dev,
DBG_88E("%s\n", __func__); DBG_88E("%s\n", __func__);
reason = cpu_to_le16(mlme->reason_code); reason = mlme->reason_code;
DBG_88E("%s, cmd=%d, reason=%d\n", __func__, mlme->cmd, reason); DBG_88E("%s, cmd=%d, reason=%d\n", __func__, mlme->cmd, reason);
switch (mlme->cmd) {
switch (mlme->cmd)
{
case IW_MLME_DEAUTH: case IW_MLME_DEAUTH:
if (!rtw_set_802_11_disassociate(padapter)) if (!rtw_set_802_11_disassociate(padapter))
ret = -1; ret = -1;
break; break;
case IW_MLME_DISASSOC: case IW_MLME_DISASSOC:
if (!rtw_set_802_11_disassociate(padapter)) if (!rtw_set_802_11_disassociate(padapter))
ret = -1; ret = -1;
break; break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return ret; return ret;
} }
@ -4530,40 +4523,30 @@ static int rtw_p2p_get_wps_configmethod(struct net_device *dev,
{ {
u8 *wpsie; u8 *wpsie;
uint wpsie_len = 0; uint wpsie_len = 0;
__be16 be_tmp;
// The mac address is matched. // The mac address is matched.
if ((wpsie=rtw_get_wps_ie(&pnetwork->network.IEs[ 12 ], pnetwork->network.IELength - 12, NULL, &wpsie_len))) {
if ((wpsie=rtw_get_wps_ie(&pnetwork->network.IEs[ 12 ], pnetwork->network.IELength - 12, NULL, &wpsie_len))) rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, (u8*) &be_tmp, &attr_contentlen);
{ if (attr_contentlen) {
rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_CONF_METHOD, (u8*) &attr_content, &attr_contentlen); attr_content = be16_to_cpu(be_tmp);
if (attr_contentlen)
{
attr_content = be16_to_cpu(attr_content);
sprintf(attr_content_str, "\n\nM=%.4d", attr_content); sprintf(attr_content_str, "\n\nM=%.4d", attr_content);
blnMatch = 1; blnMatch = 1;
} }
} }
break; break;
} }
plist = get_next(plist); plist = get_next(plist);
} }
_exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL);
if (!blnMatch) if (!blnMatch)
{
sprintf(attr_content_str, "\n\nM=0000"); sprintf(attr_content_str, "\n\nM=0000");
}
if (copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17)) { if (copy_to_user(wrqu->data.pointer, attr_content_str, 6 + 17))
return -EFAULT; return -EFAULT;
}
return ret; return ret;
} }
#ifdef CONFIG_WFD #ifdef CONFIG_WFD
@ -4796,9 +4779,10 @@ static int rtw_p2p_get_device_type(struct net_device *dev,
rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_PRIMARY_DEV_TYPE, dev_type, &dev_type_len); rtw_get_wps_attr_content(wpsie, wpsie_len, WPS_ATTR_PRIMARY_DEV_TYPE, dev_type, &dev_type_len);
if (dev_type_len) { if (dev_type_len) {
u16 type = 0; u16 type = 0;
__be16 be_tmp;
memcpy(&type, dev_type, 2); memcpy(&be_tmp, dev_type, 2);
type = be16_to_cpu(type); type = be16_to_cpu(be_tmp);
sprintf(dev_type_str, "\n\nN=%.2d", type); sprintf(dev_type_str, "\n\nN=%.2d", type);
blnMatch = 1; blnMatch = 1;
} }
@ -6169,28 +6153,19 @@ static int rtw_p2p_get2(struct net_device *dev,
DBG_88E("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer); DBG_88E("[%s] extra = %s\n", __func__, (char *)wrqu->data.pointer);
if (!memcmp(extra, "wpsCM=", 6)) if (!memcmp(extra, "wpsCM=", 6)) {
{
wrqu->data.length -= 6; wrqu->data.length -= 6;
rtw_p2p_get_wps_configmethod(dev, info, wrqu, &extra[6]); rtw_p2p_get_wps_configmethod(dev, info, wrqu, &extra[6]);
} } else if (!memcmp(extra, "devN=", 5)) {
else if (!memcmp(extra, "devN=", 5))
{
wrqu->data.length -= 5; wrqu->data.length -= 5;
rtw_p2p_get_device_name(dev, info, wrqu, &extra[5]); rtw_p2p_get_device_name(dev, info, wrqu, &extra[5]);
} } else if (!memcmp(extra, "dev_type=", 9)) {
else if (!memcmp(extra, "dev_type=", 9))
{
wrqu->data.length -= 9; wrqu->data.length -= 9;
rtw_p2p_get_device_type(dev, info, wrqu, &extra[9]); rtw_p2p_get_device_type(dev, info, wrqu, &extra[9]);
} } else if (!memcmp(extra, "go_devadd=", 10)) {
else if (!memcmp(extra, "go_devadd=", 10))
{
wrqu->data.length -= 10; wrqu->data.length -= 10;
rtw_p2p_get_go_device_address(dev, info, wrqu, &extra[10]); rtw_p2p_get_go_device_address(dev, info, wrqu, &extra[10]);
} } else if (!memcmp(extra, "InvProc=", 8)) {
else if (!memcmp(extra, "InvProc=", 8))
{
wrqu->data.length -= 8; wrqu->data.length -= 8;
rtw_p2p_get_invitation_procedure(dev, info, wrqu, &extra[8]); rtw_p2p_get_invitation_procedure(dev, info, wrqu, &extra[8]);
} }
@ -6198,7 +6173,6 @@ static int rtw_p2p_get2(struct net_device *dev,
#endif //CONFIG_P2P #endif //CONFIG_P2P
return ret; return ret;
} }
static int rtw_cta_test_start(struct net_device *dev, static int rtw_cta_test_start(struct net_device *dev,
@ -6348,7 +6322,6 @@ static void rf_reg_dump(_adapter *padapter)
printk("\nRF_Path(%x)\n",path); printk("\nRF_Path(%x)\n",path);
for (i=0;i<0x100;i++) for (i=0;i<0x100;i++)
{ {
//value = PHY_QueryRFReg(padapter, (RF_RADIO_PATH_E)path,i, bMaskDWord);
value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff);
if (j%4==1) printk("0x%02x ",i); if (j%4==1) printk("0x%02x ",i);
printk(" 0x%08x ",value); printk(" 0x%08x ",value);
@ -10530,7 +10503,6 @@ static int rtw_mp_dump(struct net_device *dev,
for (i = 0; i < 0x34; i++) for (i = 0; i < 0x34; i++)
#endif #endif
{ {
//value = PHY_QueryRFReg(padapter, (RF_RADIO_PATH_E)path,i, bMaskDWord);
value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff); value = rtw_hal_read_rfreg(padapter, path, i, 0xffffffff);
if (j%4==1) DBG_88E("0x%02x ",i); if (j%4==1) DBG_88E("0x%02x ",i);
DBG_88E(" 0x%08x ",value); DBG_88E(" 0x%08x ",value);