diff --git a/core/rtw_ap.c b/core/rtw_ap.c index cfd839b..b10ea46 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -58,15 +58,9 @@ static void update_BCNTIM(_adapter *padapter) WLAN_BSSID_EX *pnetwork_mlmeext = &(pmlmeinfo->network); unsigned char *pie = pnetwork_mlmeext->IEs; -#if 0 - - - /* update TIM IE */ - /* if(pstapriv->tim_bitmap) */ -#endif if (_TRUE) { 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; tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap); @@ -1102,25 +1096,10 @@ static void update_hw_ht_param(_adapter *padapter) rtw_hal_set_hwreg(padapter, HW_VAR_AMPDU_FACTOR, (u8 *)(&max_AMPDU_len)); - /* */ /* Config SM Power Save setting */ - /* */ - pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2; - if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) { -#if 0 - u8 i; - /* update the MCS rates */ - for (i = 0; i < 16; i++) - pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; -#endif + pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; + if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) RTW_INFO("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __FUNCTION__); - } - - /* */ - /* Config current HT Protection mode. */ - /* */ - /* pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; */ - } static void rtw_ap_check_scan(_adapter *padapter) @@ -1759,19 +1738,19 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) /* Update HT Capabilities Info field */ if (pmlmepriv->htpriv.sgi_20m == _FALSE) - pht_cap->cap_info &= ~(IEEE80211_HT_CAP_SGI_20); + pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_20)); if (pmlmepriv->htpriv.sgi_40m == _FALSE) - pht_cap->cap_info &= ~(IEEE80211_HT_CAP_SGI_40); + pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_40)); if (!TEST_FLAG(pmlmepriv->htpriv.ldpc_cap, LDPC_HT_ENABLE_RX)) - pht_cap->cap_info &= ~(IEEE80211_HT_CAP_LDPC_CODING); + pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_LDPC_CODING)); if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_TX)) - pht_cap->cap_info &= ~(IEEE80211_HT_CAP_TX_STBC); + pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_TX_STBC)); if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_RX)) - pht_cap->cap_info &= ~(IEEE80211_HT_CAP_RX_STBC_3R); + pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_RX_STBC_3R)); /* Update A-MPDU Parameters field */ pht_cap->ampdu_params_info &= ~(IEEE80211_HT_CAP_AMPDU_FACTOR | IEEE80211_HT_CAP_AMPDU_DENSITY); @@ -1995,7 +1974,7 @@ int rtw_check_beacon_data(_adapter *padapter, u8 *pbuf, int len) } #if CONFIG_RTW_MACADDR_ACL -void rtw_macaddr_acl_init(_adapter *adapter) +static void rtw_macaddr_acl_init(_adapter *adapter) { struct sta_priv *stapriv = &adapter->stapriv; struct wlan_acl_pool *acl = &stapriv->acl_list; @@ -2014,7 +1993,7 @@ void rtw_macaddr_acl_init(_adapter *adapter) _exit_critical_bh(&(acl_node_q->lock), &irqL); } -void rtw_macaddr_acl_deinit(_adapter *adapter) +static void rtw_macaddr_acl_deinit(_adapter *adapter) { struct sta_priv *stapriv = &adapter->stapriv; struct wlan_acl_pool *acl = &stapriv->acl_list; @@ -2290,7 +2269,7 @@ int rtw_ap_set_wep_key(_adapter *padapter, u8 *key, u8 keylen, int keyid, u8 set return rtw_ap_set_key(padapter, key, alg, keyid, set_tx); } -u8 rtw_ap_bmc_frames_hdl(_adapter *padapter) +static u8 rtw_ap_bmc_frames_hdl(_adapter *padapter) { #define HIQ_XMIT_COUNTS (6) _irqL irqL; @@ -2577,7 +2556,7 @@ static void update_bcn_htinfo_ie(_adapter *padapter) } /* to update ht_op_mode*/ - *(u16 *)(pht_info->infos + 1) = cpu_to_le16(pmlmepriv->ht_op_mode); + *(__le16 *)(pht_info->infos + 1) = cpu_to_le16(pmlmepriv->ht_op_mode); } @@ -2942,7 +2921,7 @@ int rtw_ht_operation_update(_adapter *padapter) if (pmlmepriv->num_sta_no_ht /*|| (pmlmepriv->ht_op_mode & HT_INFO_OPERATION_MODE_NON_GF_DEVS_PRESENT)*/) new_op_mode = OP_MODE_MIXED; - else if ((phtpriv_ap->ht_cap.cap_info & IEEE80211_HT_CAP_SUP_WIDTH) + else if ((phtpriv_ap->ht_cap.cap_info & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH)) && pmlmepriv->num_sta_ht_20mhz) new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED; else if (ATOMIC_READ(&pmlmepriv->olbc_ht)) @@ -3434,7 +3413,8 @@ void sta_info_update(_adapter *padapter, struct sta_info *psta) psta->htpriv.ht_option = _TRUE; psta->qos_option = 1; - psta->htpriv.smps_cap = (psta->htpriv.ht_cap.cap_info & IEEE80211_HT_CAP_SM_PS) >> 2; + psta->htpriv.smps_cap = (le16_to_cpu(psta->htpriv.ht_cap.cap_info) & + IEEE80211_HT_CAP_SM_PS) >> 2; } else psta->htpriv.ht_option = _FALSE; diff --git a/core/rtw_br_ext.c b/core/rtw_br_ext.c index b3ee178..6bb8065 100644 --- a/core/rtw_br_ext.c +++ b/core/rtw_br_ext.c @@ -1518,11 +1518,11 @@ struct dhcpMessage { void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb) { - if (skb == NULL) + if (!skb) return; if (!priv->ethBrExtInfo.dhcp_bcst_disable) { - unsigned short protocol = *((unsigned short *)(skb->data + 2 * ETH_ALEN)); + __be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN)); if (protocol == __constant_htons(ETH_P_IP)) { /* IP */ struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN); @@ -1556,7 +1556,6 @@ void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb) } } - void *scdb_findEntry(_adapter *priv, unsigned char *macAddr, unsigned char *ipAddr) { diff --git a/core/rtw_cmd.c b/core/rtw_cmd.c index 072d672..e22b24d 100644 --- a/core/rtw_cmd.c +++ b/core/rtw_cmd.c @@ -2114,7 +2114,7 @@ exit: return res; } -u8 _rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, const struct country_chplan *country_ent, u8 swconfig) +static u8 _rtw_set_chplan_cmd(_adapter *adapter, int flags, u8 chplan, const struct country_chplan *country_ent, u8 swconfig) { struct cmd_obj *cmdobj; struct SetChannelPlan_param *parm; @@ -2659,7 +2659,7 @@ void rtw_iface_dynamic_chk_wk_hdl(_adapter *padapter) #endif } -void rtw_dynamic_chk_wk_hdl(_adapter *padapter) +static void rtw_dynamic_chk_wk_hdl(_adapter *padapter) { rtw_mi_dynamic_chk_wk_hdl(padapter); @@ -2819,7 +2819,7 @@ exit: } -void rtw_dm_in_lps_hdl(_adapter *padapter) +static void rtw_dm_in_lps_hdl(_adapter *padapter) { rtw_hal_set_hwreg(padapter, HW_VAR_DM_IN_LPS, NULL); } @@ -2860,7 +2860,7 @@ exit: } -void rtw_lps_change_dtim_hdl(_adapter *padapter, u8 dtim) +static void rtw_lps_change_dtim_hdl(_adapter *padapter, u8 dtim) { struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter); @@ -2942,7 +2942,7 @@ exit: } #if (RATE_ADAPTIVE_SUPPORT == 1) -void rpt_timer_setting_wk_hdl(_adapter *padapter, u16 minRptTime) +static void rpt_timer_setting_wk_hdl(_adapter *padapter, u16 minRptTime) { rtw_hal_set_hwreg(padapter, HW_VAR_RPT_TIMER_SETTING, (u8 *)(&minRptTime)); } @@ -3039,7 +3039,7 @@ exit: } #endif -void rtw_dm_ra_mask_hdl(_adapter *padapter, struct sta_info *psta) +static void rtw_dm_ra_mask_hdl(_adapter *padapter, struct sta_info *psta) { if (psta) set_sta_rate(padapter, psta); @@ -3081,18 +3081,18 @@ exit: } -void power_saving_wk_hdl(_adapter *padapter) +static void power_saving_wk_hdl(_adapter *padapter) { rtw_ps_processor(padapter); } /* add for CONFIG_IEEE80211W, none 11w can use it */ -void reset_securitypriv_hdl(_adapter *padapter) +static void reset_securitypriv_hdl(_adapter *padapter) { rtw_reset_securitypriv(padapter); } -void free_assoc_resources_hdl(_adapter *padapter) +static void free_assoc_resources_hdl(_adapter *padapter) { rtw_free_assoc_resources(padapter, 1); } @@ -3140,12 +3140,11 @@ exit: } #ifdef CONFIG_IOCTL_CFG80211 -static u8 _p2p_roch_cmd(_adapter *adapter - , u64 cookie, struct wireless_dev *wdev - , struct ieee80211_channel *ch, enum nl80211_channel_type ch_type - , unsigned int duration - , u8 flags -) +static u8 _p2p_roch_cmd(_adapter *adapter, u64 cookie, + struct wireless_dev *wdev, + struct ieee80211_channel *ch, + enum nl80211_channel_type ch_type, + unsigned int duration, u8 flags) { struct cmd_obj *cmdobj; struct drvextra_cmd_parm *parm; @@ -4065,7 +4064,7 @@ inline u8 rtw_customer_str_write_cmd(_adapter *adapter, const u8 *cstr) } #endif /* CONFIG_RTW_CUSTOMER_STR */ -u8 rtw_c2h_wk_cmd(PADAPTER padapter, u8 *pbuf, u16 length, u8 type) +static u8 rtw_c2h_wk_cmd(PADAPTER padapter, u8 *pbuf, u16 length, u8 type) { struct cmd_obj *ph2c; struct drvextra_cmd_parm *pdrvextra_cmd_parm; @@ -4183,7 +4182,7 @@ exit: } #endif /* CONFIG_FW_C2H_REG */ -u8 session_tracker_cmd(_adapter *adapter, u8 cmd, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port) +static u8 session_tracker_cmd(_adapter *adapter, u8 cmd, struct sta_info *sta, u8 *local_naddr, u8 *local_port, u8 *remote_naddr, u8 *remote_port) { struct cmd_priv *cmdpriv = &adapter->cmdpriv; struct cmd_obj *cmdobj; @@ -4249,7 +4248,7 @@ inline u8 session_tracker_del_cmd(_adapter *adapter, struct sta_info *sta, u8 *l return session_tracker_cmd(adapter, ST_CMD_DEL, sta, local_naddr, local_port, remote_naddr, remote_port); } -void session_tracker_chk_for_sta(_adapter *adapter, struct sta_info *sta) +static void session_tracker_chk_for_sta(_adapter *adapter, struct sta_info *sta) { struct st_ctl_t *st_ctl = &sta->st_ctl; int i; @@ -4331,7 +4330,7 @@ exit: return; } -void session_tracker_chk_for_adapter(_adapter *adapter) +static void session_tracker_chk_for_adapter(_adapter *adapter) { struct sta_priv *stapriv = &adapter->stapriv; struct sta_info *sta; @@ -4363,7 +4362,7 @@ void session_tracker_chk_for_adapter(_adapter *adapter) #endif } -void session_tracker_cmd_hdl(_adapter *adapter, struct st_cmd_parm *parm) +static void session_tracker_cmd_hdl(_adapter *adapter, struct st_cmd_parm *parm) { u8 cmd = parm->cmd; struct sta_info *sta = parm->sta; diff --git a/core/rtw_debug.c b/core/rtw_debug.c index 5e24787..b7fa138 100644 --- a/core/rtw_debug.c +++ b/core/rtw_debug.c @@ -23,7 +23,7 @@ #include #ifdef CONFIG_RTW_DEBUG -const char *rtw_log_level_str[] = { +static const char *rtw_log_level_str[] = { "_DRV_NONE_ = 0", "_DRV_ALWAYS_ = 1", "_DRV_ERR_ = 2", @@ -382,9 +382,9 @@ void rtw_sink_rtp_seq_dbg(_adapter *adapter, _pkt *pkt) { struct recv_priv *precvpriv = &(adapter->recvpriv); if (precvpriv->sink_udpport > 0) { - if (*((u16 *)((pkt->data) + 0x24)) == cpu_to_be16(precvpriv->sink_udpport)) { + if (*((__be16 *)((pkt->data) + 0x24)) == cpu_to_be16(precvpriv->sink_udpport)) { precvpriv->pre_rtp_rxseq = precvpriv->cur_rtp_rxseq; - precvpriv->cur_rtp_rxseq = be16_to_cpu(*((u16 *)((pkt->data) + 0x2C))); + precvpriv->cur_rtp_rxseq = be16_to_cpu(*((__be16 *)((pkt->data) + 0x2C))); if (precvpriv->pre_rtp_rxseq + 1 != precvpriv->cur_rtp_rxseq) RTW_INFO("%s : RTP Seq num from %d to %d\n", __FUNCTION__, precvpriv->pre_rtp_rxseq, precvpriv->cur_rtp_rxseq); } @@ -1354,10 +1354,10 @@ int proc_get_survey_info(struct seq_file *m, void *v) _enter_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); phead = get_list_head(queue); if (!phead) - return 0; + goto exit; plist = get_next(phead); if (!plist) - return 0; + goto exit; RTW_PRINT_SEL(m, "%5s %-17s %3s %-3s %-4s %-4s %5s %32s %32s\n", "index", "bssid", "ch", "RSSI", "SdBm", "Noise", "age", "flag", "ssid"); while (1) { @@ -1405,6 +1405,7 @@ int proc_get_survey_info(struct seq_file *m, void *v) pnetwork->network.Ssid.Ssid); plist = get_next(plist); } +exit: _exit_critical_bh(&(pmlmepriv->scanned_queue.lock), &irqL); return 0; diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 532b2f6..98758c9 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -442,20 +442,20 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv) ie += sz; /* 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; ie += 2; /* capability info */ - *(u16 *)ie = 0; + *(__le16 *)ie = 0; - *(u16 *)ie |= cpu_to_le16(cap_IBSS); + *(__le16 *)ie |= cpu_to_le16(cap_IBSS); if (pregistrypriv->preamble == PREAMBLE_SHORT) - *(u16 *)ie |= cpu_to_le16(cap_ShortPremble); + *(__le16 *)ie |= cpu_to_le16(cap_ShortPremble); if (pdev_network->Privacy) - *(u16 *)ie |= cpu_to_le16(cap_Privacy); + *(__le16 *)ie |= cpu_to_le16(cap_Privacy); sz += 2; ie += 2; @@ -506,37 +506,28 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv) } #endif /* CONFIG_80211N_HT */ - /* pdev_network->IELength = sz; */ /* update IELength */ - - - /* return _SUCCESS; */ - return sz; - } unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit) { int len; u16 val16; + __le16 leval16; unsigned char wpa_oui_type[] = {0x00, 0x50, 0xf2, 0x01}; u8 *pbuf = pie; int limit_new = limit; while (1) { pbuf = rtw_get_ie(pbuf, _WPA_IE_ID_, &len, limit_new); - if (pbuf) { - /* check if oui matches... */ if (_rtw_memcmp((pbuf + 2), wpa_oui_type, sizeof(wpa_oui_type)) == _FALSE) - goto check_next_ie; - /* check version... */ - _rtw_memcpy((u8 *)&val16, (pbuf + 6), sizeof(val16)); + _rtw_memcpy((u8 *)&leval16, (pbuf + 6), sizeof(val16)); - val16 = le16_to_cpu(val16); + val16 = le16_to_cpu(leval16); if (val16 != 0x0001) goto check_next_ie; @@ -545,7 +536,6 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit) return pbuf; } else { - *wpa_ie_len = 0; return NULL; } @@ -1447,7 +1437,7 @@ void dump_ht_cap_ie_content(void *sel, u8 *buf, u32 buf_len) , HT_SUP_MCS_SET_ARG(HT_CAP_ELE_SUP_MCS_SET(buf))); } -void dump_ht_cap_ie(void *sel, u8 *ie, u32 ie_len) +static void dump_ht_cap_ie(void *sel, u8 *ie, u32 ie_len) { u8 *pos = (u8 *)ie; u16 id; @@ -2487,7 +2477,7 @@ int ieee80211_get_hdrlen(u16 fc) return hdrlen; } -int rtw_get_cipher_info(struct wlan_network *pnetwork) +static int rtw_get_cipher_info(struct wlan_network *pnetwork) { u32 wpa_ielen; unsigned char *pbuf; @@ -2523,6 +2513,7 @@ int rtw_get_cipher_info(struct wlan_network *pnetwork) void rtw_get_bcn_info(struct wlan_network *pnetwork) { unsigned short cap = 0; + __le16 le_cap; u8 bencrypt = 0; /* u8 wpa_ie[255],rsn_ie[255]; */ u16 wpa_len = 0, rsn_len = 0; @@ -2531,8 +2522,8 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) unsigned int len; unsigned char *p; - _rtw_memcpy((u8 *)&cap, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); - cap = le16_to_cpu(cap); + _rtw_memcpy((u8 *)&le_cap, rtw_get_capability_from_ie(pnetwork->network.IEs), 2); + cap = le16_to_cpu(le_cap); if (cap & WLAN_CAPABILITY_PRIVACY) { bencrypt = 1; pnetwork->network.Privacy = 1; diff --git a/core/rtw_io.c b/core/rtw_io.c index 6f0738f..4f2f450 100644 --- a/core/rtw_io.c +++ b/core/rtw_io.c @@ -80,29 +80,28 @@ u8 _rtw_read8(_adapter *adapter, u32 addr) u16 _rtw_read16(_adapter *adapter, u32 addr) { - u16 r_val; + __le16 r_val; /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - u16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); + __le16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); _read16 = pintfhdl->io_ops._read16; r_val = _read16(pintfhdl, addr); - return rtw_le16_to_cpu(r_val); + return le16_to_cpu(r_val); } u32 _rtw_read32(_adapter *adapter, u32 addr) { - u32 r_val; + __le32 r_val; /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - u32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); + __le32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); _read32 = pintfhdl->io_ops._read32; r_val = _read32(pintfhdl, addr); return rtw_le32_to_cpu(r_val); - } int _rtw_write8(_adapter *adapter, u32 addr, u8 val) @@ -123,12 +122,14 @@ int _rtw_write16(_adapter *adapter, u32 addr, u16 val) /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val); + int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, __le16 val); int ret; + __le16 outval; + _write16 = pintfhdl->io_ops._write16; - val = rtw_cpu_to_le16(val); - ret = _write16(pintfhdl, addr, val); + outval = rtw_cpu_to_le16(val); + ret = _write16(pintfhdl, addr, outval); return RTW_STATUS_CODE(ret); } @@ -137,12 +138,14 @@ int _rtw_write32(_adapter *adapter, u32 addr, u32 val) /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val); + int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, __le32 val); int ret; + __le32 outval; + _write32 = pintfhdl->io_ops._write32; - val = rtw_cpu_to_le32(val); - ret = _write32(pintfhdl, addr, val); + outval = rtw_cpu_to_le32(val); + ret = _write32(pintfhdl, addr, outval); return RTW_STATUS_CODE(ret); } @@ -303,11 +306,13 @@ int _rtw_write16_async(_adapter *adapter, u32 addr, u16 val) /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val); + int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, __le16 val); int ret; + __le16 outval; + _write16_async = pintfhdl->io_ops._write16_async; - val = rtw_cpu_to_le16(val); - ret = _write16_async(pintfhdl, addr, val); + outval = rtw_cpu_to_le16(val); + ret = _write16_async(pintfhdl, addr, outval); return RTW_STATUS_CODE(ret); } @@ -316,11 +321,13 @@ int _rtw_write32_async(_adapter *adapter, u32 addr, u32 val) /* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */ struct io_priv *pio_priv = &adapter->iopriv; struct intf_hdl *pintfhdl = &(pio_priv->intf); - int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val); + int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, __le32 val); int ret; + __le32 outval; + _write32_async = pintfhdl->io_ops._write32_async; - val = rtw_cpu_to_le32(val); - ret = _write32_async(pintfhdl, addr, val); + outval = rtw_cpu_to_le32(val); + ret = _write32_async(pintfhdl, addr, outval); return RTW_STATUS_CODE(ret); } diff --git a/core/rtw_mi.c b/core/rtw_mi.c index 7cdb263..1ebff73 100644 --- a/core/rtw_mi.c +++ b/core/rtw_mi.c @@ -33,7 +33,7 @@ void rtw_mi_update_union_chan_inf(_adapter *adapter, u8 ch, u8 offset , u8 bw) } /* Find union about ch, bw, ch_offset of all linked/linking interfaces */ -int _rtw_mi_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset, bool include_self) +static int _rtw_mi_get_ch_setting_union(_adapter *adapter, u8 *ch, u8 *bw, u8 *offset, bool include_self) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); _adapter *iface; @@ -111,7 +111,7 @@ inline int rtw_mi_get_ch_setting_union_no_self(_adapter *adapter, u8 *ch, u8 *bw } /* For now, not return union_ch/bw/offset */ -void _rtw_mi_status(_adapter *adapter, struct mi_state *mstate, bool include_self) +static void _rtw_mi_status(_adapter *adapter, struct mi_state *mstate, bool include_self) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); _adapter *iface; @@ -667,7 +667,7 @@ void rtw_mi_buddy_xmit_tasklet_schedule(_adapter *padapter) } #endif -u8 _rtw_mi_busy_traffic_check(_adapter *padapter, void *data) +static u8 _rtw_mi_busy_traffic_check(_adapter *padapter, void *data) { u32 passtime; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -1118,7 +1118,7 @@ _adapter *rtw_get_iface_by_hwport(_adapter *padapter, u8 hw_port) /*#define CONFIG_SKB_ALLOCATED*/ #define DBG_SKB_PROCESS #ifdef DBG_SKB_PROCESS -void rtw_dbg_skb_process(_adapter *padapter, union recv_frame *precvframe, union recv_frame *pcloneframe) +static void rtw_dbg_skb_process(_adapter *padapter, union recv_frame *precvframe, union recv_frame *pcloneframe) { _pkt *pkt_copy, *pkt_org; diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index f50e88d..e5eea91 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -25,7 +25,7 @@ extern void indicate_wx_scan_complete_event(_adapter *padapter); extern u8 rtw_do_join(_adapter *padapter); -sint _rtw_init_mlme_priv(_adapter *padapter) +static sint _rtw_init_mlme_priv(_adapter *padapter) { sint i; u8 *pbuf; @@ -33,14 +33,6 @@ sint _rtw_init_mlme_priv(_adapter *padapter) struct mlme_priv *pmlmepriv = &padapter->mlmepriv; sint res = _SUCCESS; - - /* We don't need to memset padapter->XXX to zero, because adapter is allocated by rtw_zvmalloc(). */ - /* _rtw_memset((u8 *)pmlmepriv, 0, sizeof(struct mlme_priv)); */ - - - /*qos_priv*/ - /*pmlmepriv->qospriv.qos_option = pregistrypriv->wmm_enable;*/ - /*ht_priv*/ #ifdef CONFIG_80211N_HT pmlmepriv->htpriv.ampdu_enable = _FALSE;/*set to disabled*/ @@ -274,7 +266,7 @@ exit: } #endif /* defined(CONFIG_WFD) && defined(CONFIG_IOCTL_CFG80211) */ -void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) +static void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) { if (NULL == pmlmepriv) { rtw_warn_on(1); @@ -292,7 +284,7 @@ exit: return; } -sint _rtw_enqueue_network(_queue *queue, struct wlan_network *pnetwork) +static sint _rtw_enqueue_network(_queue *queue, struct wlan_network *pnetwork) { _irqL irqL; @@ -553,10 +545,9 @@ u8 *rtw_get_capability_from_ie(u8 *ie) u16 rtw_get_capability(WLAN_BSSID_EX *bss) { - u16 val; + __le16 val; _rtw_memcpy((u8 *)&val, rtw_get_capability_from_ie(bss->IEs), 2); - return le16_to_cpu(val); } @@ -668,18 +659,15 @@ inline int is_same_ess(WLAN_BSSID_EX *a, WLAN_BSSID_EX *b) int is_same_network(WLAN_BSSID_EX *src, WLAN_BSSID_EX *dst, u8 feature) { u16 s_cap, d_cap; - + __le16 le_tmp; if (rtw_bug_check(dst, src, &s_cap, &d_cap) == _FALSE) return _FALSE; - _rtw_memcpy((u8 *)&s_cap, rtw_get_capability_from_ie(src->IEs), 2); - _rtw_memcpy((u8 *)&d_cap, rtw_get_capability_from_ie(dst->IEs), 2); - - - s_cap = le16_to_cpu(s_cap); - d_cap = le16_to_cpu(d_cap); - + _rtw_memcpy((u8 *)&le_tmp, rtw_get_capability_from_ie(src->IEs), 2); + s_cap = le16_to_cpu(le_tmp); + _rtw_memcpy((u8 *)&le_tmp, rtw_get_capability_from_ie(dst->IEs), 2); + d_cap = le16_to_cpu(le_tmp); #ifdef CONFIG_P2P if ((feature == 1) && /* 1: P2P supported */ @@ -696,7 +684,6 @@ int is_same_network(WLAN_BSSID_EX *src, WLAN_BSSID_EX *dst, u8 feature) (d_cap & WLAN_CAPABILITY_IBSS)) && ((s_cap & WLAN_CAPABILITY_BSS) == (d_cap & WLAN_CAPABILITY_BSS))); - } struct wlan_network *_rtw_find_same_network(_queue *scanned_queue, struct wlan_network *network) @@ -1405,7 +1392,7 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv) } -void rtw_reset_rx_info(struct debug_priv *pdbgpriv) +static void rtw_reset_rx_info(struct debug_priv *pdbgpriv) { pdbgpriv->dbg_rx_ampdu_drop_count = 0; pdbgpriv->dbg_rx_ampdu_forced_indicate_count = 0; @@ -1506,8 +1493,6 @@ void rtw_free_assoc_resources(_adapter *adapter, int lock_scanned_queue) adapter->securitypriv.key_mask = 0; rtw_reset_rx_info(pdbgpriv); - - } /* @@ -1940,39 +1925,13 @@ void rtw_joinbss_event_prehandle(_adapter *adapter, u8 *pbuf) struct wlan_network *pcur_wlan = NULL, *ptarget_wlan = NULL; unsigned int the_same_macaddr = _FALSE; - -#ifdef CONFIG_RTL8712 - /* endian_convert */ - pnetwork->join_res = le32_to_cpu(pnetwork->join_res); - pnetwork->network_type = le32_to_cpu(pnetwork->network_type); - pnetwork->network.Length = le32_to_cpu(pnetwork->network.Length); - pnetwork->network.Ssid.SsidLength = le32_to_cpu(pnetwork->network.Ssid.SsidLength); - pnetwork->network.Privacy = le32_to_cpu(pnetwork->network.Privacy); - pnetwork->network.Rssi = le32_to_cpu(pnetwork->network.Rssi); - pnetwork->network.NetworkTypeInUse = le32_to_cpu(pnetwork->network.NetworkTypeInUse) ; - pnetwork->network.Configuration.ATIMWindow = le32_to_cpu(pnetwork->network.Configuration.ATIMWindow); - pnetwork->network.Configuration.BeaconPeriod = le32_to_cpu(pnetwork->network.Configuration.BeaconPeriod); - pnetwork->network.Configuration.DSConfig = le32_to_cpu(pnetwork->network.Configuration.DSConfig); - pnetwork->network.Configuration.FHConfig.DwellTime = le32_to_cpu(pnetwork->network.Configuration.FHConfig.DwellTime); - pnetwork->network.Configuration.FHConfig.HopPattern = le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopPattern); - pnetwork->network.Configuration.FHConfig.HopSet = le32_to_cpu(pnetwork->network.Configuration.FHConfig.HopSet); - pnetwork->network.Configuration.FHConfig.Length = le32_to_cpu(pnetwork->network.Configuration.FHConfig.Length); - pnetwork->network.Configuration.Length = le32_to_cpu(pnetwork->network.Configuration.Length); - pnetwork->network.InfrastructureMode = le32_to_cpu(pnetwork->network.InfrastructureMode); - pnetwork->network.IELength = le32_to_cpu(pnetwork->network.IELength); -#endif - - rtw_get_encrypt_decrypt_from_registrypriv(adapter); - - the_same_macaddr = _rtw_memcmp(pnetwork->network.MacAddress, cur_network->network.MacAddress, ETH_ALEN); pnetwork->network.Length = get_WLAN_BSSID_EX_sz(&pnetwork->network); - if (pnetwork->network.Length > sizeof(WLAN_BSSID_EX)) { - goto ignore_joinbss_callback; - } + if (pnetwork->network.Length > sizeof(WLAN_BSSID_EX)) + return; _enter_critical_bh(&pmlmepriv->lock, &irqL); @@ -2446,7 +2405,7 @@ err_2: } #endif -void rtw_sta_mstatus_disc_rpt(_adapter *adapter, u8 mac_id) +static void rtw_sta_mstatus_disc_rpt(_adapter *adapter, u8 mac_id) { struct macid_ctl_t *macid_ctl = &adapter->dvobj->macid_ctl; @@ -3164,7 +3123,7 @@ int rtw_select_roaming_candidate(struct mlme_priv *mlme) if (mlme->cur_network_scanned == NULL) { rtw_warn_on(1); - goto exit; + return ret; } _enter_critical_bh(&(mlme->scanned_queue.lock), &irqL); @@ -3978,10 +3937,10 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui _rtw_memset(&ht_capie, 0, sizeof(struct rtw_ieee80211_ht_cap)); - ht_capie.cap_info = IEEE80211_HT_CAP_DSSSCCK40; + ht_capie.cap_info = cpu_to_le16(IEEE80211_HT_CAP_DSSSCCK40); if (phtpriv->sgi_20m) - ht_capie.cap_info |= IEEE80211_HT_CAP_SGI_20; + ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_SGI_20); /* Get HT BW */ if (in_ie == NULL) { @@ -4024,23 +3983,23 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui } if ((cbw40_enable == 1) && (operation_bw == CHANNEL_WIDTH_40)) { - ht_capie.cap_info |= IEEE80211_HT_CAP_SUP_WIDTH; + ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH); if (phtpriv->sgi_40m) - ht_capie.cap_info |= IEEE80211_HT_CAP_SGI_40; + ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_SGI_40); } /* todo: disable SM power save mode */ - ht_capie.cap_info |= IEEE80211_HT_CAP_SM_PS; + ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_SM_PS); /* RX LDPC */ if (TEST_FLAG(phtpriv->ldpc_cap, LDPC_HT_ENABLE_RX)) { - ht_capie.cap_info |= IEEE80211_HT_CAP_LDPC_CODING; + ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_LDPC_CODING); RTW_INFO("[HT] Declare supporting RX LDPC\n"); } /* TX STBC */ if (TEST_FLAG(phtpriv->stbc_cap, STBC_HT_ENABLE_TX)) { - ht_capie.cap_info |= IEEE80211_HT_CAP_TX_STBC; + ht_capie.cap_info |= cpu_to_le16(IEEE80211_HT_CAP_TX_STBC); RTW_INFO("[HT] Declare supporting TX STBC\n"); } @@ -4086,13 +4045,11 @@ unsigned int rtw_restructure_ht_ie(_adapter *padapter, u8 *in_ie, u8 *out_ie, ui RTW_WARN("rf_type:%d or rx_nss:%u is not expected\n", rf_type, hal_spec->rx_nss_num); } - { - rtw_hal_get_def_var(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset); - rtw_hal_get_def_var(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz); - if (max_recvbuf_sz - rx_packet_offset >= (8191 - 256)) { - RTW_INFO("%s IEEE80211_HT_CAP_MAX_AMSDU is set\n", __FUNCTION__); - ht_capie.cap_info = ht_capie.cap_info | IEEE80211_HT_CAP_MAX_AMSDU; - } + rtw_hal_get_def_var(padapter, HAL_DEF_RX_PACKET_OFFSET, &rx_packet_offset); + rtw_hal_get_def_var(padapter, HAL_DEF_MAX_RECVBUF_SZ, &max_recvbuf_sz); + if (max_recvbuf_sz - rx_packet_offset >= (8191 - 256)) { + RTW_INFO("%s IEEE80211_HT_CAP_MAX_AMSDU is set\n", __FUNCTION__); + ht_capie.cap_info = ht_capie.cap_info | cpu_to_le16(IEEE80211_HT_CAP_MAX_AMSDU); } /* AMPDU_para [1:0]:Max AMPDU Len => 0:8k , 1:16k, 2:32k, 3:64k @@ -4244,7 +4201,7 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel) /* update cur_bwmode & cur_ch_offset */ if ((cbw40_enable) && - (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & BIT(1)) && + (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & BIT(1)) && (pmlmeinfo->HT_info.infos[0] & BIT(2))) { struct hal_spec_t *hal_spec = GET_HAL_SPEC(padapter); int i; @@ -4301,61 +4258,12 @@ void rtw_update_ht_cap(_adapter *padapter, u8 *pie, uint ie_len, u8 channel) /* */ /* Config SM Power Save setting */ /* */ - pmlmeinfo->SM_PS = (pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info & 0x0C) >> 2; - if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) { -#if 0 - u8 i; - /* update the MCS rates */ - for (i = 0; i < 16; i++) - pmlmeinfo->HT_caps.HT_cap_element.MCS_rate[i] &= MCS_rate_1R[i]; -#endif + pmlmeinfo->SM_PS = (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) & 0x0C) >> 2; + if (pmlmeinfo->SM_PS == WLAN_HT_CAP_SM_PS_STATIC) RTW_INFO("%s(): WLAN_HT_CAP_SM_PS_STATIC\n", __FUNCTION__); - } - /* */ /* Config current HT Protection mode. */ - /* */ pmlmeinfo->HT_protection = pmlmeinfo->HT_info.infos[1] & 0x3; - - - -#if 0 /* move to rtw_update_sta_info_client() */ - /* for A-MPDU Rx reordering buffer control for bmc_sta & sta_info */ - /* if A-MPDU Rx is enabled, reseting rx_ordering_ctrl wstart_b(indicate_seq) to default value=0xffff */ - /* todo: check if AP can send A-MPDU packets */ - bmc_sta = rtw_get_bcmc_stainfo(padapter); - if (bmc_sta) { - for (i = 0; i < 16 ; i++) { - /* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */ - preorder_ctrl = &bmc_sta->recvreorder_ctrl[i]; - preorder_ctrl->enable = _FALSE; - preorder_ctrl->indicate_seq = 0xffff; -#ifdef DBG_RX_SEQ - RTW_INFO("DBG_RX_SEQ %s:%d indicate_seq:%u\n", __FUNCTION__, __LINE__, - preorder_ctrl->indicate_seq); -#endif - preorder_ctrl->wend_b = 0xffff; - preorder_ctrl->wsize_b = 64;/* max_ampdu_sz; */ /* ex. 32(kbytes) -> wsize_b=32 */ - } - } - - psta = rtw_get_stainfo(&padapter->stapriv, pcur_network->network.MacAddress); - if (psta) { - for (i = 0; i < 16 ; i++) { - /* preorder_ctrl = &precvpriv->recvreorder_ctrl[i]; */ - preorder_ctrl = &psta->recvreorder_ctrl[i]; - preorder_ctrl->enable = _FALSE; - preorder_ctrl->indicate_seq = 0xffff; -#ifdef DBG_RX_SEQ - RTW_INFO("DBG_RX_SEQ %s:%d indicate_seq:%u\n", __FUNCTION__, __LINE__, - preorder_ctrl->indicate_seq); -#endif - preorder_ctrl->wend_b = 0xffff; - preorder_ctrl->wsize_b = 64;/* max_ampdu_sz; */ /* ex. 32(kbytes) -> wsize_b=32 */ - } - } -#endif - } #ifdef CONFIG_TDLS @@ -4645,9 +4553,9 @@ static bool wfd_st_match_rule(_adapter *adapter, u8 *local_naddr, u8 *local_port { struct wifi_display_info *wfdinfo = &adapter->wfd_info; - if (ntohs(*((u16 *)local_port)) == wfdinfo->rtsp_ctrlport - || ntohs(*((u16 *)local_port)) == wfdinfo->tdls_rtsp_ctrlport - || ntohs(*((u16 *)remote_port)) == wfdinfo->peer_rtsp_ctrlport) + if (ntohs(*((__be16 *)local_port)) == wfdinfo->rtsp_ctrlport || + ntohs(*((__be16 *)local_port)) == wfdinfo->tdls_rtsp_ctrlport || + ntohs(*((__be16 *)remote_port)) == wfdinfo->peer_rtsp_ctrlport) return _TRUE; return _FALSE; } diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 32928f9..dee4d35 100755 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -26,7 +26,7 @@ #include -struct mlme_handler mlme_sta_tbl[] = { +static struct mlme_handler mlme_sta_tbl[] = { {WIFI_ASSOCREQ, "OnAssocReq", &OnAssocReq}, {WIFI_ASSOCRSP, "OnAssocRsp", &OnAssocRsp}, {WIFI_REASSOCREQ, "OnReAssocReq", &OnAssocReq}, @@ -72,7 +72,7 @@ struct mlme_handler mlme_ap_tbl[] = { }; #endif -struct action_handler OnAction_tbl[] = { +static struct action_handler OnAction_tbl[] = { {RTW_WLAN_CATEGORY_SPECTRUM_MGMT, "ACTION_SPECTRUM_MGMT", on_action_spct}, {RTW_WLAN_CATEGORY_QOS, "ACTION_QOS", &OnAction_qos}, {RTW_WLAN_CATEGORY_DLS, "ACTION_DLS", &OnAction_dls}, @@ -97,7 +97,7 @@ struct action_handler OnAction_tbl[] = { }; -u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; +static u8 null_addr[ETH_ALEN] = {0, 0, 0, 0, 0, 0}; /************************************************** OUI definitions for the vendor specific IE @@ -114,8 +114,6 @@ unsigned char WMM_PARA_OUI[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01}; unsigned char WPA_TKIP_CIPHER[4] = {0x00, 0x50, 0xf2, 0x02}; unsigned char RSN_TKIP_CIPHER[4] = {0x00, 0x0f, 0xac, 0x02}; -extern unsigned char REALTEK_96B_IE[]; - #ifdef LEGACY_CHANNEL_PLAN_REF /******************************************************** ChannelPlan definitions @@ -1143,7 +1141,7 @@ static void init_channel_list(_adapter *padapter, RT_CHANNEL_INFO *channel_set, } -bool rtw_regsty_is_excl_chs(struct registry_priv *regsty, u8 ch) +static bool rtw_regsty_is_excl_chs(struct registry_priv *regsty, u8 ch) { int i; @@ -1416,24 +1414,17 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) } ptable += index; -#if 1 if (psta != NULL) { if (GetRetry(pframe)) { - if (precv_frame->u.hdr.attrib.seq_num == psta->RxMgmtFrameSeqNum) { + if (le16_to_cpu(precv_frame->u.hdr.attrib.seq_num) == psta->RxMgmtFrameSeqNum) { /* drop the duplicate management frame */ pdbgpriv->dbg_rx_dup_mgt_frame_drop_count++; RTW_INFO("Drop duplicate management frame with seq_num = %d.\n", precv_frame->u.hdr.attrib.seq_num); return; } } - psta->RxMgmtFrameSeqNum = precv_frame->u.hdr.attrib.seq_num; + psta->RxMgmtFrameSeqNum = le16_to_cpu(precv_frame->u.hdr.attrib.seq_num); } -#else - - if (GetRetry(pframe)) { - /* return; */ - } -#endif #ifdef CONFIG_AP_MODE switch (get_frame_sub_type(pframe)) { @@ -1483,7 +1474,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame) } #ifdef CONFIG_P2P -u32 p2p_listen_state_process(_adapter *padapter, unsigned char *da) +static u32 p2p_listen_state_process(_adapter *padapter, unsigned char *da) { bool response = _TRUE; @@ -2171,8 +2162,8 @@ unsigned int OnAuth(_adapter *padapter, union recv_frame *precv_frame) offset = 4; } - algorithm = le16_to_cpu(*(u16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset)); - seq = le16_to_cpu(*(u16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2)); + algorithm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset)); + seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2)); RTW_INFO("auth alg=%x, seq=%X\n", algorithm, seq); @@ -2388,9 +2379,9 @@ unsigned int OnAuthClient(_adapter *padapter, union recv_frame *precv_frame) offset = (GetPrivacy(pframe)) ? 4 : 0; - algthm = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset)); - seq = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2)); - status = le16_to_cpu(*(unsigned short *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4)); + algthm = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset)); + seq = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 2)); + status = le16_to_cpu(*(__le16 *)((SIZE_PTR)pframe + WLAN_HDR_A3_LEN + offset + 4)); if (status != 0) { RTW_INFO("clnt auth fail, status: %d\n", status); @@ -2539,8 +2530,8 @@ unsigned int OnAssocReq(_adapter *padapter, union recv_frame *precv_frame) } capab_info = RTW_GET_LE16(pframe + WLAN_HDR_A3_LEN); - /* capab_info = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); */ - /* listen_interval = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN+2)); */ + /* capab_info = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); */ + /* listen_interval = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN+2)); */ listen_interval = RTW_GET_LE16(pframe + WLAN_HDR_A3_LEN + 2); left = pkt_len - (IEEE80211_3ADDR_LEN + ie_offset); @@ -3087,7 +3078,7 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame) _cancel_timer_ex(&pmlmeext->link_timer); /* status */ - status = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN + 2)); + status = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 2)); if (status > 0) { RTW_INFO("assoc reject, status code: %d\n", status); pmlmeinfo->state = WIFI_FW_NULL_STATE; @@ -3096,13 +3087,13 @@ unsigned int OnAssocRsp(_adapter *padapter, union recv_frame *precv_frame) } /* 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 */ pmlmeinfo->slotTime = (pmlmeinfo->capability & BIT(10)) ? 9 : 20; /* 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 */ /* to handle HT, WMM, rate adaptive, update MAC reg */ @@ -3207,7 +3198,7 @@ unsigned int OnDeAuth(_adapter *padapter, union recv_frame *precv_frame) } #endif /* CONFIG_P2P */ - reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); + reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); rtw_lock_rx_suspend_timeout(8000); @@ -3297,7 +3288,7 @@ unsigned int OnDisassoc(_adapter *padapter, union recv_frame *precv_frame) } #endif /* CONFIG_P2P */ - reason = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN)); + reason = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN)); rtw_lock_rx_suspend_timeout(8000); @@ -3350,7 +3341,7 @@ unsigned int OnAtim(_adapter *padapter, union recv_frame *precv_frame) return _SUCCESS; } -unsigned int on_action_spct_ch_switch(_adapter *padapter, struct sta_info *psta, u8 *ies, uint ies_len) +static unsigned int on_action_spct_ch_switch(_adapter *padapter, struct sta_info *psta, u8 *ies, uint ies_len) { unsigned int ret = _FAIL; struct mlme_ext_priv *mlmeext = &padapter->mlmeextpriv; @@ -3947,7 +3938,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_NEGO_REQ; u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 }; u8 wpsielen = 0, p2pielen = 0, i; @@ -3961,7 +3952,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -4008,16 +3999,16 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) /* WPS Section */ wpsielen = 0; /* WPS OUI */ - *(u32 *)(wpsie) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie) = cpu_to_be32(WPSOUI); wpsielen += 4; /* WPS version */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -4025,21 +4016,21 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) /* Device Password ID */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_PWID); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_PWID); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); wpsielen += 2; /* Value: */ if (pwdinfo->ui_got_wps_info == P2P_GOT_WPSINFO_PEER_DISPLAY_PIN) - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_USER_SPEC); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_USER_SPEC); else if (pwdinfo->ui_got_wps_info == P2P_GOT_WPSINFO_SELF_DISPLAY_PIN) - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_REGISTRAR_SPEC); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_REGISTRAR_SPEC); else if (pwdinfo->ui_got_wps_info == P2P_GOT_WPSINFO_PBC) - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_PBC); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_PBC); wpsielen += 2; @@ -4073,7 +4064,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -4092,7 +4083,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_GO_INTENT; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); p2pielen += 2; /* Value: */ @@ -4104,7 +4095,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_CONF_TIMEOUT; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -4117,7 +4108,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_LISTEN_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -4141,16 +4132,16 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_EX_LISTEN_TIMING; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0004); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0004); p2pielen += 2; /* Value: */ /* Availability Period */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); p2pielen += 2; /* Availability Interval */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); p2pielen += 2; @@ -4159,7 +4150,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_INTENDED_IF_ADDR; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); p2pielen += 2; /* Value: */ @@ -4181,12 +4172,12 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) #ifdef CONFIG_CONCURRENT_MODE if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0) - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #endif p2pielen += 2; @@ -4260,7 +4251,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) /* Length: */ /* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -4271,21 +4262,21 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) /* Config Method */ /* This field should be big endian. Noted by P2P specification. */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->supported_wps_cm); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->supported_wps_cm); p2pielen += 2; /* Primary Device Type */ /* Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); p2pielen += 2; /* OUI */ - *(u32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); + *(__be32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); p2pielen += 4; /* Sub Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); p2pielen += 2; /* Number of Secondary Device Types */ @@ -4293,11 +4284,11 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) /* Device Name */ /* Type: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); p2pielen += 2; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -4310,7 +4301,7 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_OPERATING_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -4350,16 +4341,13 @@ void issue_p2p_GO_request(_adapter *padapter, u8 *raddr) dump_mgntframe(padapter, pmgntframe); return; - } - -void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint len, u8 result) +static void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint len, u8 result) { - unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_NEGO_RESP; u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 }; u8 p2pielen = 0, i; @@ -4368,17 +4356,16 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l uint wps_devicepassword_id_len = 0; u8 channel_cnt_24g = 0, channel_cnt_5gl = 0, channel_cnt_5gh; u16 len_channellist_attr = 0; - struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wifidirect_info *pwdinfo = &(padapter->wdinfo); - + __be16 be_tmp; #ifdef CONFIG_WFD u32 wfdielen = 0; #endif @@ -4422,8 +4409,8 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l /* Try to get the device password ID from the WPS IE of group negotiation request frame */ /* WiFi Direct test plan 5.1.15 */ rtw_get_wps_ie(frame_body + _PUBLIC_ACTION_IE_OFFSET_, len - _PUBLIC_ACTION_IE_OFFSET_, wpsie, &wpsielen); - rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8 *) &wps_devicepassword_id, &wps_devicepassword_id_len); - wps_devicepassword_id = be16_to_cpu(wps_devicepassword_id); + rtw_get_wps_attr_content(wpsie, wpsielen, WPS_ATTR_DEVICE_PWID, (u8 *) &be_tmp, &wps_devicepassword_id_len); + wps_devicepassword_id = be16_to_cpu(be_tmp); _rtw_memset(wpsie, 0x00, 255); wpsielen = 0; @@ -4431,16 +4418,16 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l /* WPS Section */ wpsielen = 0; /* WPS OUI */ - *(u32 *)(wpsie) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie) = cpu_to_be32(WPSOUI); wpsielen += 4; /* WPS version */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -4448,20 +4435,20 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l /* Device Password ID */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_PWID); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_PWID); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); wpsielen += 2; /* Value: */ if (wps_devicepassword_id == WPS_DPID_USER_SPEC) - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_REGISTRAR_SPEC); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_REGISTRAR_SPEC); else if (wps_devicepassword_id == WPS_DPID_REGISTRAR_SPEC) - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_USER_SPEC); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_USER_SPEC); else - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_PBC); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_PBC); wpsielen += 2; /* Commented by Kurt 20120113 */ @@ -4478,7 +4465,6 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen); - /* P2P IE Section. */ /* P2P OUI */ @@ -4500,7 +4486,6 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l /* 8. Device Info */ /* 9. Group ID ( Only GO ) */ - /* ToDo: */ /* P2P Status */ @@ -4508,7 +4493,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l p2pie[p2pielen++] = P2P_ATTR_STATUS; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); p2pielen += 2; /* Value: */ @@ -4519,7 +4504,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l p2pie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -4546,7 +4531,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l p2pie[p2pielen++] = P2P_ATTR_GO_INTENT; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); p2pielen += 2; /* Value: */ @@ -4558,13 +4543,12 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l p2pie[p2pielen++] = ((pwdinfo->intent << 1) | BIT(0)); } - /* Configuration Timeout */ /* Type: */ p2pie[p2pielen++] = P2P_ATTR_CONF_TIMEOUT; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -4576,7 +4560,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l p2pie[p2pielen++] = P2P_ATTR_OPERATING_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -4608,7 +4592,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l p2pie[p2pielen++] = P2P_ATTR_INTENDED_IF_ADDR; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); p2pielen += 2; /* Value: */ @@ -4628,11 +4612,11 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l #ifdef CONFIG_CONCURRENT_MODE if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0) - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #endif p2pielen += 2; @@ -4708,7 +4692,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l /* Length: */ /* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -4719,21 +4703,21 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l /* Config Method */ /* This field should be big endian. Noted by P2P specification. */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->supported_wps_cm); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->supported_wps_cm); p2pielen += 2; /* Primary Device Type */ /* Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); p2pielen += 2; /* OUI */ - *(u32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); + *(__be32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); p2pielen += 4; /* Sub Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); p2pielen += 2; /* Number of Secondary Device Types */ @@ -4741,11 +4725,11 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l /* Device Name */ /* Type: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); p2pielen += 2; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -4758,7 +4742,7 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l p2pie[p2pielen++] = P2P_ATTR_GROUP_ID; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN + pwdinfo->nego_ssidlen); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN + pwdinfo->nego_ssidlen); p2pielen += 2; /* Value: */ @@ -4788,12 +4772,12 @@ void issue_p2p_GO_response(_adapter *padapter, u8 *raddr, u8 *frame_body, uint l } -void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) +static void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) { unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_GO_NEGO_CONF; u8 wpsie[255] = { 0x00 }, p2pie[255] = { 0x00 }; u8 wpsielen = 0, p2pielen = 0; @@ -4802,7 +4786,7 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -4869,7 +4853,7 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) p2pie[p2pielen++] = P2P_ATTR_STATUS; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); p2pielen += 2; /* Value: */ @@ -4880,7 +4864,7 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) p2pie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -4899,7 +4883,7 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) p2pie[p2pielen++] = P2P_ATTR_OPERATING_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -4994,7 +4978,7 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) p2pie[p2pielen++] = P2P_ATTR_GROUP_ID; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN + pwdinfo->nego_ssidlen); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN + pwdinfo->nego_ssidlen); p2pielen += 2; /* Value: */ @@ -5025,16 +5009,15 @@ void issue_p2p_GO_confirm(_adapter *padapter, u8 *raddr, u8 result) void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) { - unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; - u8 action = P2P_PUB_ACTION_ACTION; - u32 p2poui = cpu_to_be32(P2POUI); - u8 oui_subtype = P2P_INVIT_REQ; - u8 p2pie[255] = { 0x00 }; - u8 p2pielen = 0, i; - u8 dialogToken = 3; - u8 channel_cnt_24g = 0, channel_cnt_5gl = 0, channel_cnt_5gh = 0; - u16 len_channellist_attr = 0; + u8 action = P2P_PUB_ACTION_ACTION; + __be32 p2poui = cpu_to_be32(P2POUI); + u8 oui_subtype = P2P_INVIT_REQ; + u8 p2pie[255] = { 0x00 }; + u8 p2pielen = 0, i; + u8 dialogToken = 3; + u8 channel_cnt_24g = 0, channel_cnt_5gl = 0, channel_cnt_5gh = 0; + u16 len_channellist_attr = 0; #ifdef CONFIG_WFD u32 wfdielen = 0; #endif @@ -5043,8 +5026,8 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); + __le16 *fctrl; + struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); struct wifidirect_info *pwdinfo = &(padapter->wdinfo); @@ -5107,7 +5090,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_CONF_TIMEOUT; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -5119,7 +5102,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_INVITATION_FLAGS; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); p2pielen += 2; /* Value: */ @@ -5131,7 +5114,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_OPERATING_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -5160,7 +5143,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_GROUP_BSSID; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); p2pielen += 2; /* Value: */ @@ -5184,11 +5167,11 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) #ifdef CONFIG_CONCURRENT_MODE if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0) - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #endif p2pielen += 2; @@ -5259,7 +5242,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) p2pie[p2pielen++] = P2P_ATTR_GROUP_ID; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(6 + pwdinfo->invitereq_info.ssidlen); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(6 + pwdinfo->invitereq_info.ssidlen); p2pielen += 2; /* Value: */ @@ -5279,7 +5262,7 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) /* Length: */ /* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -5289,20 +5272,20 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) /* Config Method */ /* This field should be big endian. Noted by P2P specification. */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_DISPLAY); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_DISPLAY); p2pielen += 2; /* Primary Device Type */ /* Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); p2pielen += 2; /* OUI */ - *(u32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); + *(__be32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); p2pielen += 4; /* Sub Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); p2pielen += 2; /* Number of Secondary Device Types */ @@ -5310,11 +5293,11 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) /* Device Name */ /* Type: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); p2pielen += 2; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -5334,7 +5317,6 @@ void issue_p2p_invitation_request(_adapter *padapter, u8 *raddr) dump_mgntframe(padapter, pmgntframe); return; - } void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken, u8 status_code) @@ -5342,7 +5324,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_INVIT_RESP; u8 p2pie[255] = { 0x00 }; u8 p2pielen = 0, i; @@ -5356,7 +5338,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -5418,7 +5400,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken p2pie[p2pielen++] = P2P_ATTR_STATUS; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0001); p2pielen += 2; /* Value: */ @@ -5435,7 +5417,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken p2pie[p2pielen++] = P2P_ATTR_CONF_TIMEOUT; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -5454,7 +5436,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken p2pie[p2pielen++] = P2P_ATTR_OPERATING_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -5478,7 +5460,7 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken p2pie[p2pielen++] = P2P_ATTR_GROUP_BSSID; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(ETH_ALEN); p2pielen += 2; /* Value: */ @@ -5502,11 +5484,11 @@ void issue_p2p_invitation_response(_adapter *padapter, u8 *raddr, u8 dialogToken #ifdef CONFIG_CONCURRENT_MODE if (rtw_mi_check_status(padapter, MI_LINKED) && padapter->registrypriv.full_ch_in_p2p_handshake == 0) - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(5 + 1); else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #else - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(len_channellist_attr); #endif p2pielen += 2; @@ -5593,7 +5575,7 @@ void issue_p2p_provision_request(_adapter *padapter, u8 *pssid, u8 ussidlen, u8 unsigned char category = RTW_WLAN_CATEGORY_PUBLIC; u8 action = P2P_PUB_ACTION_ACTION; u8 dialogToken = 1; - u32 p2poui = cpu_to_be32(P2POUI); + __be32 p2poui = cpu_to_be32(P2POUI); u8 oui_subtype = P2P_PROVISION_DISC_REQ; u8 wpsie[100] = { 0x00 }; u8 wpsielen = 0; @@ -5606,7 +5588,7 @@ void issue_p2p_provision_request(_adapter *padapter, u8 *pssid, u8 ussidlen, u8 struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -5654,16 +5636,16 @@ void issue_p2p_provision_request(_adapter *padapter, u8 *pssid, u8 ussidlen, u8 wpsielen = 0; /* WPS OUI */ - *(u32 *)(wpsie) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie) = cpu_to_be32(WPSOUI); wpsielen += 4; /* WPS version */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -5671,15 +5653,15 @@ void issue_p2p_provision_request(_adapter *padapter, u8 *pssid, u8 ussidlen, u8 /* Config Method */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); wpsielen += 2; /* Value: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->tx_prov_disc_info.wps_config_method_request); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->tx_prov_disc_info.wps_config_method_request); wpsielen += 2; pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen); @@ -5700,7 +5682,7 @@ void issue_p2p_provision_request(_adapter *padapter, u8 *pssid, u8 ussidlen, u8 } -u8 is_matched_in_profilelist(u8 *peermacaddr, struct profile_info *profileinfo) +static u8 is_matched_in_profilelist(u8 *peermacaddr, struct profile_info *profileinfo) { u8 i, match_result = 0; @@ -5726,7 +5708,7 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned char *mac; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); @@ -5836,16 +5818,16 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) wpsielen = 0; /* WPS OUI */ - *(u32 *)(wpsie) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie) = cpu_to_be32(WPSOUI); wpsielen += 4; /* WPS version */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -5857,23 +5839,23 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) if (_rtw_memcmp(pmlmepriv->sa_ext, zero_array_check, L2SDTA_SERVICE_VE_LEN) == _FALSE || pmlmepriv->num_p2p_sdt != 0) { /* Sec dev type */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_SEC_DEV_TYPE_LIST); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_SEC_DEV_TYPE_LIST); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0008); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0008); wpsielen += 2; /* Value: */ /* Category ID */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_CID_DISPLAYS); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_CID_DISPLAYS); wpsielen += 2; /* OUI */ - *(u32 *)(wpsie + wpsielen) = cpu_to_be32(INTEL_DEV_TYPE_OUI); + *(__be32 *)(wpsie + wpsielen) = cpu_to_be32(INTEL_DEV_TYPE_OUI); wpsielen += 4; - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_SCID_WIDI_CONSUMER_SINK); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_SCID_WIDI_CONSUMER_SINK); wpsielen += 2; if (_rtw_memcmp(pmlmepriv->sa_ext, zero_array_check, L2SDTA_SERVICE_VE_LEN) == _FALSE) { @@ -5886,11 +5868,11 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* WiFi Simple Config State */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_SIMPLE_CONF_STATE); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_SIMPLE_CONF_STATE); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -5898,11 +5880,11 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* Response Type */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_RESP_TYPE); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_RESP_TYPE); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -5910,11 +5892,11 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* UUID-E */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_UUID_E); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_UUID_E); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0010); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0010); wpsielen += 2; /* Value: */ @@ -5927,11 +5909,11 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* Manufacturer */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_MANUFACTURER); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_MANUFACTURER); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0007); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0007); wpsielen += 2; /* Value: */ @@ -5940,11 +5922,11 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* Model Name */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_MODEL_NAME); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_MODEL_NAME); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0006); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0006); wpsielen += 2; /* Value: */ @@ -5953,11 +5935,11 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* Model Number */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_MODEL_NUMBER); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_MODEL_NUMBER); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -5965,11 +5947,11 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* Serial Number */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_SERIAL_NUMBER); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_SERIAL_NUMBER); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(ETH_ALEN); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(ETH_ALEN); wpsielen += 2; /* Value: */ @@ -5978,33 +5960,33 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* Primary Device Type */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_PRIMARY_DEV_TYPE); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_PRIMARY_DEV_TYPE); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0008); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0008); wpsielen += 2; /* Value: */ /* Category ID */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); wpsielen += 2; /* OUI */ - *(u32 *)(wpsie + wpsielen) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie + wpsielen) = cpu_to_be32(WPSOUI); wpsielen += 4; /* Sub Category ID */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); wpsielen += 2; /* Device Name */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->device_name_len); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->device_name_len); wpsielen += 2; /* Value: */ @@ -6013,15 +5995,15 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) /* Config Method */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); wpsielen += 2; /* Value: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->supported_wps_cm); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->supported_wps_cm); wpsielen += 2; @@ -6045,17 +6027,16 @@ void issue_probersp_p2p(_adapter *padapter, unsigned char *da) dump_mgntframe(padapter, pmgntframe); return; - } -int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) +static int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) { int ret = _FAIL; struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned char *mac; unsigned char bssrate[NumRates]; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); @@ -6150,16 +6131,16 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) wpsielen = 0; /* WPS OUI */ - *(u32 *)(wpsie) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie) = cpu_to_be32(WPSOUI); wpsielen += 4; /* WPS version */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_VER1); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0001); wpsielen += 2; /* Value: */ @@ -6168,13 +6149,12 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) if (pmlmepriv->wps_probe_req_ie == NULL) { /* UUID-E */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_UUID_E); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_UUID_E); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0010); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0010); wpsielen += 2; - /* Value: */ if (pwdinfo->external_uuid == 0) { _rtw_memset(wpsie + wpsielen, 0x0, 16); @@ -6185,25 +6165,25 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) /* Config Method */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_CONF_METHOD); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); wpsielen += 2; /* Value: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->supported_wps_cm); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->supported_wps_cm); wpsielen += 2; } /* Device Name */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->device_name_len); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(pwdinfo->device_name_len); wpsielen += 2; /* Value: */ @@ -6212,37 +6192,37 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) /* Primary Device Type */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_PRIMARY_DEV_TYPE); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_PRIMARY_DEV_TYPE); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0008); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0008); wpsielen += 2; /* Value: */ /* Category ID */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_CID_RTK_WIDI); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_CID_RTK_WIDI); wpsielen += 2; /* OUI */ - *(u32 *)(wpsie + wpsielen) = cpu_to_be32(WPSOUI); + *(__be32 *)(wpsie + wpsielen) = cpu_to_be32(WPSOUI); wpsielen += 4; /* Sub Category ID */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_SCID_RTK_DMP); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_PDT_SCID_RTK_DMP); wpsielen += 2; /* Device Password ID */ /* Type: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_PWID); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_ATTR_DEVICE_PWID); wpsielen += 2; /* Length: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(0x0002); wpsielen += 2; /* Value: */ - *(u16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_REGISTRAR_SPEC); /* Registrar-specified */ + *(__be16 *)(wpsie + wpsielen) = cpu_to_be16(WPS_DPID_REGISTRAR_SPEC); /* Registrar-specified */ wpsielen += 2; pframe = rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, wpsielen, (unsigned char *) wpsie, &pattrib->pktlen); @@ -6267,7 +6247,7 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) p2pie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -6285,7 +6265,7 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) p2pie[p2pielen++] = P2P_ATTR_LISTEN_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -6309,16 +6289,16 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) p2pie[p2pielen++] = P2P_ATTR_EX_LISTEN_TIMING; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0004); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0004); p2pielen += 2; /* Value: */ /* Availability Period */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); p2pielen += 2; /* Availability Interval */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); p2pielen += 2; if (rtw_p2p_chk_role(pwdinfo, P2P_ROLE_GO)) { @@ -6327,7 +6307,7 @@ int _issue_probereq_p2p(_adapter *padapter, u8 *da, int wait_ack) p2pie[p2pielen++] = P2P_ATTR_OPERATING_CH; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0005); p2pielen += 2; /* Value: */ @@ -6423,12 +6403,13 @@ exit: #endif /* CONFIG_P2P */ -s32 rtw_action_public_decache(union recv_frame *rframe, u8 token_offset) +static s32 rtw_action_public_decache(union recv_frame *rframe, u8 token_offset) { _adapter *adapter = rframe->u.hdr.adapter; struct mlme_ext_priv *mlmeext = &(adapter->mlmeextpriv); u8 *frame = rframe->u.hdr.rx_data; - u16 seq_ctrl = ((rframe->u.hdr.attrib.seq_num & 0xffff) << 4) | (rframe->u.hdr.attrib.frag_num & 0xf); + u16 seq_ctrl = ((le16_to_cpu(rframe->u.hdr.attrib.seq_num) & 0xffff) << 4) | + ((rframe->u.hdr.attrib.frag_num) & 0xf); u8 token = *(rframe->u.hdr.rx_data + sizeof(struct rtw_ieee80211_hdr_3addr) + token_offset); if (GetRetry(frame)) { @@ -6448,7 +6429,7 @@ s32 rtw_action_public_decache(union recv_frame *rframe, u8 token_offset) return _SUCCESS; } -unsigned int on_action_public_p2p(union recv_frame *precv_frame) +static unsigned int on_action_public_p2p(union recv_frame *precv_frame) { _adapter *padapter = precv_frame->u.hdr.adapter; u8 *pframe = precv_frame->u.hdr.rx_data; @@ -6825,7 +6806,7 @@ exit: return _SUCCESS; } -unsigned int on_action_public_vendor(union recv_frame *precv_frame) +static unsigned int on_action_public_vendor(union recv_frame *precv_frame) { unsigned int ret = _FAIL; u8 *pframe = precv_frame->u.hdr.rx_data; @@ -6846,7 +6827,7 @@ exit: return ret; } -unsigned int on_action_public_default(union recv_frame *precv_frame, u8 action) +static unsigned int on_action_public_default(union recv_frame *precv_frame, u8 action) { unsigned int ret = _FAIL; u8 *pframe = precv_frame->u.hdr.rx_data; @@ -7157,7 +7138,7 @@ unsigned int OnAction_p2p(_adapter *padapter, union recv_frame *precv_frame) if (category != RTW_WLAN_CATEGORY_P2P) return _SUCCESS; - if (cpu_to_be32(*((u32 *)(frame_body + 1))) != P2POUI) + if (be32_to_cpu(*((__be32 *)(frame_body + 1))) != P2POUI) return _SUCCESS; #ifdef CONFIG_IOCTL_CFG80211 @@ -7234,7 +7215,7 @@ unsigned int DoReserved(_adapter *padapter, union recv_frame *precv_frame) return _SUCCESS; } -struct xmit_frame *_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv, bool once) +static struct xmit_frame *_alloc_mgtxmitframe(struct xmit_priv *pxmitpriv, bool once) { struct xmit_frame *pmgntframe; struct xmit_buf *pxmitbuf; @@ -7519,7 +7500,7 @@ s32 dump_mgntframe_and_wait_ack(_adapter *padapter, struct xmit_frame *pmgntfram } -int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) +static int update_hidden_ssid(u8 *ies, u32 ies_len, u8 hidden_ssid_mode) { u8 *ssid_ie; sint ssid_len_ori; @@ -7579,7 +7560,7 @@ void issue_beacon(_adapter *padapter, int timeout_ms) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned int rate_len; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); #if defined(CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) @@ -7691,34 +7672,34 @@ void issue_beacon(_adapter *padapter, int timeout_ms) /* now pframe is end of wsc ie, insert Primary Device Type & Device Name */ /* Primary Device Type */ /* Type: */ - *(u16 *)(pframe + insert_len) = cpu_to_be16(WPS_ATTR_PRIMARY_DEV_TYPE); + *(__be16 *)(pframe + insert_len) = cpu_to_be16(WPS_ATTR_PRIMARY_DEV_TYPE); insert_len += 2; /* Length: */ - *(u16 *)(pframe + insert_len) = cpu_to_be16(0x0008); + *(__be16 *)(pframe + insert_len) = cpu_to_be16(0x0008); insert_len += 2; /* Value: */ /* Category ID */ - *(u16 *)(pframe + insert_len) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); + *(__be16 *)(pframe + insert_len) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); insert_len += 2; /* OUI */ - *(u32 *)(pframe + insert_len) = cpu_to_be32(WPSOUI); + *(__be32 *)(pframe + insert_len) = cpu_to_be32(WPSOUI); insert_len += 4; /* Sub Category ID */ - *(u16 *)(pframe + insert_len) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); + *(__be16 *)(pframe + insert_len) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); insert_len += 2; /* Device Name */ /* Type: */ - *(u16 *)(pframe + insert_len) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); + *(__be16 *)(pframe + insert_len) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); insert_len += 2; /* Length: */ - *(u16 *)(pframe + insert_len) = cpu_to_be16(pwdinfo->device_name_len); + *(__be16 *)(pframe + insert_len) = cpu_to_be16(pwdinfo->device_name_len); insert_len += 2; /* Value: */ @@ -7882,7 +7863,7 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned char *mac, *bssid; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); #if defined(CONFIG_AP_MODE) && defined (CONFIG_NATIVEAP_MLME) @@ -8147,14 +8128,14 @@ void issue_probersp(_adapter *padapter, unsigned char *da, u8 is_valid_p2p_probe } -int _issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 *da, u8 ch, bool append_wps, int wait_ack) +static int _issue_probereq(_adapter *padapter, NDIS_802_11_SSID *pssid, u8 *da, u8 ch, bool append_wps, int wait_ack) { int ret = _FAIL; struct xmit_frame *pmgntframe; struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned char *mac; unsigned char bssrate[NumRates]; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); @@ -8309,13 +8290,14 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; unsigned int val32; unsigned short val16; int use_shared_key = 0; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); + __le16 le_val16; #ifdef CONFIG_RTW_80211R struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); ft_priv *pftpriv = &pmlmepriv->ftpriv; @@ -8354,7 +8336,6 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status if (psta) { /* for AP mode */ #ifdef CONFIG_NATIVEAP_MLME - _rtw_memcpy(pwlanhdr->addr1, psta->hwaddr, ETH_ALEN); _rtw_memcpy(pwlanhdr->addr2, adapter_mac_addr(padapter), ETH_ALEN); _rtw_memcpy(pwlanhdr->addr3, adapter_mac_addr(padapter), ETH_ALEN); @@ -8364,24 +8345,24 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status val16 = (u16)psta->authalg; if (status != _STATS_SUCCESSFUL_) - val16 = 0; + le_val16 = 0; if (val16) { - val16 = cpu_to_le16(val16); + le_val16 = cpu_to_le16(val16); use_shared_key = 1; } - pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned char *)&le_val16, &(pattrib->pktlen)); /* setting auth seq number */ val16 = (u16)psta->auth_seq; - val16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); + le_val16 = cpu_to_le16(val16); + pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&le_val16, &(pattrib->pktlen)); /* setting status code... */ val16 = status; - val16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen)); + le_val16 = cpu_to_le16(val16); + pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&le_val16, &(pattrib->pktlen)); /* added challenging text... */ if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) @@ -8397,14 +8378,14 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status if ((rtw_to_roam(padapter) > 0) && rtw_chk_ft_flags(padapter, RTW_FT_SUPPORTED)) { is_ft_roaming = _TRUE; val16 = 2; /* 2: 802.11R FTAA */ - val16 = cpu_to_le16(val16); + le_val16 = cpu_to_le16(val16); } else #endif { /* setting auth algo number */ val16 = (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) ? 1 : 0; /* 0:OPEN System, 1:Shared key */ if (val16) { - val16 = cpu_to_le16(val16); + le_val16 = cpu_to_le16(val16); use_shared_key = 1; } } @@ -8413,10 +8394,12 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status /* setting IV for auth seq #3 */ if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) { + __le32 le_val32; + /* RTW_INFO("==> iv(%d),key_index(%d)\n",pmlmeinfo->iv,pmlmeinfo->key_index); */ val32 = ((pmlmeinfo->iv++) | (pmlmeinfo->key_index << 30)); - val32 = cpu_to_le32(val32); - pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&val32, &(pattrib->pktlen)); + le_val32 = cpu_to_le32(val32); + pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char *)&le_val32, &(pattrib->pktlen)); pattrib->iv_len = 4; } @@ -8425,14 +8408,14 @@ void issue_auth(_adapter *padapter, struct sta_info *psta, unsigned short status /* setting auth seq number */ val16 = pmlmeinfo->auth_seq; - val16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&val16, &(pattrib->pktlen)); + le_val16 = cpu_to_le16(val16); + pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned char *)&le_val16, &(pattrib->pktlen)); /* setting status code... */ val16 = status; - val16 = cpu_to_le16(val16); - pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&val16, &(pattrib->pktlen)); + le_val16 = cpu_to_le16(val16); + pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char *)&le_val16, &(pattrib->pktlen)); #ifdef CONFIG_RTW_80211R if (is_ft_roaming == _TRUE) { @@ -8487,8 +8470,8 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p struct rtw_ieee80211_hdr *pwlanhdr; struct pkt_attrib *pattrib; unsigned char *pbuf, *pframe; - unsigned short val, ie_status; - unsigned short *fctrl; + unsigned short val; + __le16 *fctrl, le_val; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; @@ -8546,11 +8529,11 @@ void issue_asocrsp(_adapter *padapter, unsigned short status, struct sta_info *p pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_ , (unsigned char *)&val, &(pattrib->pktlen)); - ie_status = cpu_to_le16(status); - pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&ie_status, &(pattrib->pktlen)); + le_val = cpu_to_le16(status); + pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char *)&le_val, &(pattrib->pktlen)); - val = cpu_to_le16(pstat->aid | BIT(14) | BIT(15)); - pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&val, &(pattrib->pktlen)); + le_val = cpu_to_le16(pstat->aid | BIT(14) | BIT(15)); + pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&le_val, &(pattrib->pktlen)); if (pstat->bssratelen <= 8) pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen)); @@ -8707,8 +8690,8 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) struct pkt_attrib *pattrib; unsigned char *pframe, *p; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; - unsigned short val16; + __le16 *fctrl; + __le16 val16; unsigned int i, j, ie_len, index = 0; unsigned char rf_type, bssrate[NumRates], sta_bssrate[NumRates]; PNDIS_802_11_VARIABLE_IEs pIE; @@ -8944,9 +8927,6 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) if (padapter->mlmepriv.htpriv.ht_option == _TRUE) { if (!(is_ap_in_tkip(padapter))) { _rtw_memcpy(&(pmlmeinfo->HT_caps), pIE->data, sizeof(struct HT_caps_element)); - - pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = cpu_to_le16(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info); - pframe = rtw_set_ie(pframe, EID_HTCapability, pIE->Length , (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen)); } } @@ -9019,7 +8999,7 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) p2pie[p2pielen++] = P2P_ATTR_CAPABILITY; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0002); p2pielen += 2; /* Value: */ @@ -9037,16 +9017,16 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) p2pie[p2pielen++] = P2P_ATTR_EX_LISTEN_TIMING; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x0004); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x0004); p2pielen += 2; /* Value: */ /* Availability Period */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); p2pielen += 2; /* Availability Interval */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0xFFFF); p2pielen += 2; /* Device Info */ @@ -9056,7 +9036,7 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) /* Length: */ /* 21->P2P Device Address (6bytes) + Config Methods (2bytes) + Primary Device Type (8bytes) */ /* + NumofSecondDevType (1byte) + WPS Device Name ID field (2bytes) + WPS Device Name Len field (2bytes) */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(21 + pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -9068,23 +9048,23 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) /* This field should be big endian. Noted by P2P specification. */ if ((pwdinfo->ui_got_wps_info == P2P_GOT_WPSINFO_PEER_DISPLAY_PIN) || (pwdinfo->ui_got_wps_info == P2P_GOT_WPSINFO_SELF_DISPLAY_PIN)) - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_DISPLAY); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_DISPLAY); else - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_PBC); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_CONFIG_METHOD_PBC); p2pielen += 2; /* Primary Device Type */ /* Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_CID_MULIT_MEDIA); p2pielen += 2; /* OUI */ - *(u32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); + *(__be32 *)(p2pie + p2pielen) = cpu_to_be32(WPSOUI); p2pielen += 4; /* Sub Category ID */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_PDT_SCID_MEDIA_SERVER); p2pielen += 2; /* Number of Secondary Device Types */ @@ -9092,11 +9072,11 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) /* Device Name */ /* Type: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(WPS_ATTR_DEVICE_NAME); p2pielen += 2; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); + *(__be16 *)(p2pie + p2pielen) = cpu_to_be16(pwdinfo->device_name_len); p2pielen += 2; /* Value: */ @@ -9108,7 +9088,7 @@ void _issue_assocreq(_adapter *padapter, u8 is_reassoc) p2pie[p2pielen++] = P2P_ATTR_INTERFACE; /* Length: */ - *(u16 *)(p2pie + p2pielen) = cpu_to_le16(0x000D); + *(__le16 *)(p2pie + p2pielen) = cpu_to_le16(0x000D); p2pielen += 2; /* Value: */ @@ -9190,7 +9170,7 @@ static int _issue_nulldata(_adapter *padapter, unsigned char *da, unsigned int p struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv; struct mlme_ext_priv *pmlmeext; struct mlme_ext_info *pmlmeinfo; @@ -9378,7 +9358,7 @@ static int _issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid, i struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl, *qc; + __le16 *fctrl, *qc; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -9418,7 +9398,7 @@ static int _issue_qos_nulldata(_adapter *padapter, unsigned char *da, u16 tid, i if (pattrib->mdata) SetMData(fctrl); - qc = (unsigned short *)(pframe + pattrib->hdrlen - 2); + qc = (__le16 *)(pframe + pattrib->hdrlen - 2); SetPriority(qc, tid); @@ -9512,7 +9492,7 @@ static int _issue_deauth(_adapter *padapter, unsigned char *da, unsigned short r struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl, le_reason; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -9561,8 +9541,8 @@ static int _issue_deauth(_adapter *padapter, unsigned char *da, unsigned short r pframe += sizeof(struct rtw_ieee80211_hdr_3addr); pattrib->pktlen = sizeof(struct rtw_ieee80211_hdr_3addr); - reason = cpu_to_le16(reason); - pframe = rtw_set_fixed_ie(pframe, _RSON_CODE_ , (unsigned char *)&reason, &(pattrib->pktlen)); + le_reason = cpu_to_le16(reason); + pframe = rtw_set_fixed_ie(pframe, _RSON_CODE_ , (unsigned char *)&le_reason, &(pattrib->pktlen)); pattrib->last_txcmdsz = pattrib->pktlen; @@ -9649,7 +9629,7 @@ void issue_action_spct_ch_switch(_adapter *padapter, u8 *ra, u8 new_ch, u8 ch_of struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); @@ -9717,7 +9697,7 @@ void issue_action_SA_Query(_adapter *padapter, unsigned char *raddr, unsigned ch struct pkt_attrib *pattrib; u8 *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -9823,7 +9803,7 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, unsigned ch struct pkt_attrib *pattrib; u8 *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - u16 *fctrl; + __le16 *fctrl, le_val; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -9887,13 +9867,13 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, unsigned ch else /* TX AMSDU disabled */ BA_para_set &= ~BIT(0); #endif - BA_para_set = cpu_to_le16(BA_para_set); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen)); + le_val = cpu_to_le16(BA_para_set); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_val)), &(pattrib->pktlen)); /* BA_timeout_value = 0xffff; */ /* max: 65535 TUs(~ 65 ms) */ BA_timeout_value = 5000;/* ~ 5ms */ - BA_timeout_value = cpu_to_le16(BA_timeout_value); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_timeout_value)), &(pattrib->pktlen)); + le_val = cpu_to_le16(BA_timeout_value); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_val)), &(pattrib->pktlen)); /* if ((psta = rtw_get_stainfo(pstapriv, pmlmeinfo->network.MacAddress)) != NULL) */ psta = rtw_get_stainfo(pstapriv, raddr); @@ -9905,16 +9885,17 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, unsigned ch psta->BA_starting_seqctrl[tid & 0x07] = start_seq; BA_starting_seqctrl = start_seq << 4; + } else { + BA_starting_seqctrl = 0; } - - BA_starting_seqctrl = cpu_to_le16(BA_starting_seqctrl); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_starting_seqctrl)), &(pattrib->pktlen)); + le_val = cpu_to_le16(BA_starting_seqctrl); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_val)), &(pattrib->pktlen)); break; case RTW_WLAN_ACTION_ADDBA_RESP: pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen)); - status = cpu_to_le16(status); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen)); + le_val = cpu_to_le16(status); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&le_val), &(pattrib->pktlen)); BA_para_set = le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set); @@ -9931,9 +9912,9 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, unsigned ch BA_para_set |= BIT(0); } - BA_para_set = cpu_to_le16(BA_para_set); + le_val = cpu_to_le16(BA_para_set); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen)); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_val)), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(pmlmeinfo->ADDBA_req.BA_timeout_value)), &(pattrib->pktlen)); break; @@ -9942,10 +9923,10 @@ static int issue_action_ba(_adapter *padapter, unsigned char *raddr, unsigned ch BA_para_set |= (tid << 12) & IEEE80211_DELBA_PARAM_TID_MASK; BA_para_set |= (initiator << 11) & IEEE80211_DELBA_PARAM_INITIATOR_MASK; - BA_para_set = cpu_to_le16(BA_para_set); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(BA_para_set)), &(pattrib->pktlen)); - status = cpu_to_le16(status); - pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(status)), &(pattrib->pktlen)); + le_val = cpu_to_le16(BA_para_set); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_val)), &(pattrib->pktlen)); + le_val = cpu_to_le16(status); + pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&(le_val)), &(pattrib->pktlen)); break; default: break; @@ -10149,7 +10130,7 @@ static void issue_action_BSSCoexistPacket(_adapter *padapter) struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct wlan_network *pnetwork = NULL; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -10291,7 +10272,7 @@ static void issue_action_BSSCoexistPacket(_adapter *padapter) } /* Spatial Multiplexing Powersave (SMPS) action frame */ -int _issue_action_SM_PS(_adapter *padapter , unsigned char *raddr , u8 NewMimoPsMode , u8 wait_ack) +static int _issue_action_SM_PS(_adapter *padapter , unsigned char *raddr , u8 NewMimoPsMode , u8 wait_ack) { int ret = _FAIL; @@ -10302,7 +10283,7 @@ int _issue_action_SM_PS(_adapter *padapter , unsigned char *raddr , u8 NewMimoP struct pkt_attrib *pattrib; unsigned char *pframe; struct rtw_ieee80211_hdr *pwlanhdr; - unsigned short *fctrl; + __le16 *fctrl; struct xmit_priv *pxmitpriv = &(padapter->xmitpriv); struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); @@ -10773,7 +10754,6 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI } _rtw_memcpy(&bssid->Configuration.BeaconPeriod, rtw_get_beacon_interval_from_ie(bssid->IEs), 2); - bssid->Configuration.BeaconPeriod = le32_to_cpu(bssid->Configuration.BeaconPeriod); val16 = rtw_get_capability((WLAN_BSSID_EX *)bssid); @@ -10801,7 +10781,7 @@ u8 collect_bss_info(_adapter *padapter, union recv_frame *precv_frame, WLAN_BSSI struct HT_caps_element *pHT_caps; pHT_caps = (struct HT_caps_element *)(p + 2); - if (pHT_caps->u.HT_cap_element.HT_caps_info & BIT(14)) + if (pHT_caps->u.HT_cap_element.HT_caps_info & cpu_to_le16(BIT(14))) pmlmepriv->num_FortyMHzIntolerant++; } else pmlmepriv->num_sta_no_ht++; @@ -11868,7 +11848,7 @@ static void rtw_mlmeext_disconnect(_adapter *padapter) /* set_opmode_cmd(padapter, infra_client_with_mlme); */ - rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, NULL); rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, null_addr); /* set MSR to no link state->infra. mode */ @@ -12166,7 +12146,7 @@ When station does not receive any packet in MAX_CONTINUAL_NORXPACKET_COUNT*2 sec recipient station will teardown the block ack by issuing DELBA frame. *********************************************************************/ -void rtw_delba_check(_adapter *padapter, struct sta_info *psta, u8 from_timer) +static void rtw_delba_check(_adapter *padapter, struct sta_info *psta, u8 from_timer) { int i = 0; int ret = _SUCCESS; @@ -12204,7 +12184,7 @@ void rtw_delba_check(_adapter *padapter, struct sta_info *psta, u8 from_timer) } } -u8 chk_ap_is_alive(_adapter *padapter, struct sta_info *psta) +static u8 chk_ap_is_alive(_adapter *padapter, struct sta_info *psta) { u8 ret = _FALSE; int i = 0; @@ -12251,7 +12231,7 @@ u8 chk_ap_is_alive(_adapter *padapter, struct sta_info *psta) return ret; } -u8 chk_adhoc_peer_is_alive(struct sta_info *psta) +static u8 chk_adhoc_peer_is_alive(struct sta_info *psta) { u8 ret = _TRUE; @@ -12882,7 +12862,7 @@ void issue_action_ft_request(_adapter *padapter, u8 *pTargetAddr) u8 action = RTW_WLAN_ACTION_FT_REQUEST; u8 is_ft_roaming_with_rsn_ie = _TRUE; u8 *pie = NULL; - u16 *fctrl = NULL; + __le16 *fctrl; u32 ft_ie_len = 0; pmgntframe = alloc_mgtxmitframe(pxmitpriv); @@ -13071,7 +13051,7 @@ static int rtw_auto_ap_start_beacon(_adapter *adapter) ie += sz; /* beacon interval : 2bytes */ - *(u16 *)ie = cpu_to_le16((u16)100); /* BCN_INTERVAL=100; */ + *(__le16 *)ie = cpu_to_le16((u16)100); /* BCN_INTERVAL=100; */ sz += 2; ie += 2; @@ -13288,7 +13268,7 @@ u8 join_cmd_hdl(_adapter *padapter, u8 *pbuf) Set_MSR(padapter, _HW_STATE_STATION_); - rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_MLME_DISCONNECT, NULL); } #ifdef CONFIG_ANTENNA_DIVERSITY @@ -13527,7 +13507,7 @@ static bool scan_abort_hdl(_adapter *adapter) return ret; } -u8 rtw_scan_sparse(_adapter *adapter, struct rtw_ieee80211_channel *ch, u8 ch_num) +static u8 rtw_scan_sparse(_adapter *adapter, struct rtw_ieee80211_channel *ch, u8 ch_num) { /* interval larger than this is treated as backgroud scan */ #ifndef RTW_SCAN_SPARSE_BG_INTERVAL_MS @@ -13940,7 +13920,7 @@ void site_survey(_adapter *padapter, u8 survey_channel, RT_SCAN_TYPE ScanType) return; } -void survey_done_set_ch_bw(_adapter *padapter) +static void survey_done_set_ch_bw(_adapter *padapter) { struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; u8 cur_channel = 0; @@ -14010,7 +13990,7 @@ exit: * Returns: 0: no ps announcement is doing. 1: ps announcement is doing */ -u8 sitesurvey_ps_annc(_adapter *padapter, bool ps) +static u8 sitesurvey_ps_annc(_adapter *padapter, bool ps) { u8 ps_anc = 0; @@ -14056,7 +14036,7 @@ u8 sitesurvey_ps_annc(struct dvobj_priv *dvobj, bool ps) } #endif -void sitesurvey_set_igi(_adapter *adapter) +static void sitesurvey_set_igi(_adapter *adapter) { struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; struct ss_res *ss = &mlmeext->sitesurvey_res; @@ -14107,7 +14087,8 @@ void sitesurvey_set_igi(_adapter *adapter) break; } } -void sitesurvey_set_msr(_adapter *adapter, bool enter) + +static void sitesurvey_set_msr(_adapter *adapter, bool enter) { u8 network_type; struct mlme_ext_priv *pmlmeext = &adapter->mlmeextpriv; @@ -14184,7 +14165,7 @@ operation_by_state: rtw_rx_ampdu_apply(padapter); /* clear HW TX queue before scan */ - rtw_hal_set_hwreg(padapter, HW_VAR_CHECK_TXBUF, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_CHECK_TXBUF, NULL); /* power save state announcement */ if (sitesurvey_ps_annc(padapter, 1)) { diff --git a/core/rtw_security.c b/core/rtw_security.c index ea77149..3221d2b 100644 --- a/core/rtw_security.c +++ b/core/rtw_security.c @@ -210,7 +210,7 @@ exit: return; } -static u32 getcrc32(u8 *buf, sint len) +static __le32 getcrc32(u8 *buf, sint len) { u8 *p; u32 crc; @@ -221,7 +221,7 @@ static u32 getcrc32(u8 *buf, sint len) for (p = buf; len > 0; ++p, --len) crc = crc32_table[(crc ^ *p) & 0xff] ^ (crc >> 8); - return ~crc; /* transmit complement, per CRC-32 spec */ + return cpu_to_le32(~crc); /* transmit complement, per CRC-32 spec */ } @@ -231,7 +231,6 @@ static u32 getcrc32(u8 *buf, sint len) void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe) { /* exclude ICV */ - unsigned char crc[4]; struct arc4context mycontext; @@ -278,7 +277,7 @@ void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe) length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + *((__le32 *)crc) = getcrc32(payload, length); arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); @@ -286,7 +285,7 @@ void rtw_wep_encrypt(_adapter *padapter, u8 *pxmitframe) } else { length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len ; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); + *((__le32 *)crc) = getcrc32(payload, length); arcfour_init(&mycontext, wepkey, 3 + keylength); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload + length, crc, 4); @@ -337,15 +336,12 @@ void rtw_wep_decrypt(_adapter *padapter, u8 *precvframe) arcfour_encrypt(&mycontext, payload, payload, length); /* calculate icv and compare the icv */ - *((u32 *)crc) = le32_to_cpu(getcrc32(payload, length - 4)); + *((__le32 *)crc) = getcrc32(payload, length - 4); WEP_SW_DEC_CNT_INC(psecuritypriv, prxattrib->ra); } - - return; - } /* 3 =====TKIP related===== */ @@ -761,7 +757,7 @@ u32 rtw_tkip_encrypt(_adapter *padapter, u8 *pxmitframe) if ((curfragnum + 1) == pattrib->nr_frags) { /* 4 the last fragment */ length = pattrib->last_txcmdsz - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy*/ + *((__le32 *)crc) = getcrc32(payload, length); /* modified by Amy*/ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); @@ -769,7 +765,7 @@ u32 rtw_tkip_encrypt(_adapter *padapter, u8 *pxmitframe) } else { length = pxmitpriv->frag_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len ; - *((u32 *)crc) = cpu_to_le32(getcrc32(payload, length)); /* modified by Amy*/ + *((__le32 *)crc) = getcrc32(payload, length); /* modified by Amy*/ arcfour_init(&mycontext, rc4key, 16); arcfour_encrypt(&mycontext, payload, payload, length); arcfour_encrypt(&mycontext, payload + length, crc, 4); @@ -887,7 +883,7 @@ u32 rtw_tkip_decrypt(_adapter *padapter, u8 *precvframe) arcfour_init(&mycontext, rc4key, 16); 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] || crc[2] != payload[length - 2] || crc[1] != payload[length - 3] || crc[0] != payload[length - 4]) { res = _FAIL; @@ -1373,7 +1369,7 @@ static sint aes_cipher(u8 *key, uint hdrlen, u8 padded_buffer[16]; u8 mic[8]; /* uint offset = 0; */ - uint frtype = GetFrameType(pframe); + u16 frtype = GetFrameType(pframe); uint frsubtype = get_frame_sub_type(pframe); frsubtype = frsubtype >> 4; @@ -2797,7 +2793,7 @@ static int omac1_aes_128_vector(u8 *key, size_t num_elem, * OMAC1 was standardized with the name CMAC by NIST in a Special Publication * (SP) 800-38B. */ /* modify for CONFIG_IEEE80211W */ -int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac) +static int omac1_aes_128(u8 *key, u8 *data, size_t data_len, u8 *mac) { return omac1_aes_128_vector(key, 1, &data, &data_len, mac); } diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index 1e5829a..fcbb6ed 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -29,25 +29,22 @@ #define IP_OFFSET 30 #endif -unsigned char ARTHEROS_OUI1[] = {0x00, 0x03, 0x7f}; -unsigned char ARTHEROS_OUI2[] = {0x00, 0x13, 0x74}; +static unsigned char ATHEROS_OUI1[] = {0x00, 0x03, 0x7f}; +static unsigned char ATHEROS_OUI2[] = {0x00, 0x13, 0x74}; -unsigned char BROADCOM_OUI1[] = {0x00, 0x10, 0x18}; -unsigned char BROADCOM_OUI2[] = {0x00, 0x0a, 0xf7}; -unsigned char BROADCOM_OUI3[] = {0x00, 0x05, 0xb5}; +static unsigned char BROADCOM_OUI1[] = {0x00, 0x10, 0x18}; +static unsigned char BROADCOM_OUI2[] = {0x00, 0x0a, 0xf7}; +static unsigned char BROADCOM_OUI3[] = {0x00, 0x05, 0xb5}; +u8 REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20}; -unsigned char CISCO_OUI[] = {0x00, 0x40, 0x96}; -unsigned char MARVELL_OUI[] = {0x00, 0x50, 0x43}; -unsigned char RALINK_OUI[] = {0x00, 0x0c, 0x43}; -unsigned char REALTEK_OUI[] = {0x00, 0xe0, 0x4c}; -unsigned char AIRGOCAP_OUI[] = {0x00, 0x0a, 0xf5}; - -unsigned char REALTEK_96B_IE[] = {0x00, 0xe0, 0x4c, 0x02, 0x01, 0x20}; +static unsigned char CISCO_OUI[] = {0x00, 0x40, 0x96}; +static unsigned char MARVELL_OUI[] = {0x00, 0x50, 0x43}; +static unsigned char RALINK_OUI[] = {0x00, 0x0c, 0x43}; +static unsigned char REALTEK_OUI[] = {0x00, 0xe0, 0x4c}; +static unsigned char AIRGOCAP_OUI[] = {0x00, 0x0a, 0xf5}; 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) @@ -105,7 +102,7 @@ int cckratesonly_included(unsigned char *rate, int ratelen) } #ifdef CONFIG_GET_RAID_BY_DRV -s8 rtw_get_tx_nss(_adapter *adapter, struct sta_info *psta) +static s8 rtw_get_tx_nss(_adapter *adapter, struct sta_info *psta) { struct hal_spec_t *hal_spec = GET_HAL_SPEC(adapter); u8 rf_type = RF_1T1R, custom_rf_type; @@ -813,11 +810,10 @@ __inline u8 *get_my_bssid(WLAN_BSSID_EX *pnetwork) 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); return le16_to_cpu(val); - } int is_client_associated_to_ap(_adapter *padapter) @@ -1151,7 +1147,7 @@ inline bool rtw_sec_camid_is_drv_forbid(struct cam_ctl_t *cam_ctl, u8 id) return 1; } -bool _rtw_sec_camid_is_used(struct cam_ctl_t *cam_ctl, u8 id) +static bool _rtw_sec_camid_is_used(struct cam_ctl_t *cam_ctl, u8 id) { bool ret = _FALSE; @@ -1239,7 +1235,7 @@ inline bool rtw_camid_is_gk(_adapter *adapter, u8 cam_id) return ret; } -bool cam_cache_chk(_adapter *adapter, u8 id, u8 *addr, s16 kid, s8 gk) +static bool cam_cache_chk(_adapter *adapter, u8 id, u8 *addr, s16 kid, s8 gk) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); bool ret = _FALSE; @@ -1257,7 +1253,7 @@ exit: return ret; } -s16 _rtw_camid_search(_adapter *adapter, u8 *addr, s16 kid, s8 gk) +static s16 _rtw_camid_search(_adapter *adapter, u8 *addr, s16 kid, s8 gk) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; @@ -1297,7 +1293,7 @@ s16 rtw_camid_search(_adapter *adapter, u8 *addr, s16 kid, s8 gk) return cam_id; } -s16 rtw_get_camid(_adapter *adapter, struct sta_info *sta, u8 *addr, s16 kid) +static s16 rtw_get_camid(_adapter *adapter, struct sta_info *sta, u8 *addr, s16 kid) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; @@ -1411,7 +1407,7 @@ bitmap_handle: return cam_id; } -void rtw_camid_set(_adapter *adapter, u8 cam_id) +static void rtw_camid_set(_adapter *adapter, u8 cam_id) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; @@ -1494,7 +1490,7 @@ inline void rtw_sec_cam_swap(_adapter *adapter, u8 cam_id_a, u8 cam_id_b) } } -s16 rtw_get_empty_cam_entry(_adapter *adapter, u8 start_camid) +static s16 rtw_get_empty_cam_entry(_adapter *adapter, u8 start_camid) { struct dvobj_priv *dvobj = adapter_to_dvobj(adapter); struct cam_ctl_t *cam_ctl = &dvobj->cam_ctl; @@ -1959,8 +1955,8 @@ 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); + pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info = pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info; + pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps = pmlmeinfo->HT_caps.u.HT_cap_element.HT_ext_caps; /* update the MCS set */ for (i = 0; i < 16; i++) @@ -2259,7 +2255,7 @@ void update_ldpc_stbc_cap(struct sta_info *psta) #endif /* CONFIG_80211N_HT */ } -int check_ielen(u8 *start, uint len) +static int check_ielen(u8 *start, uint len) { int left = len; u8 *pos = start; @@ -2325,7 +2321,7 @@ int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len, _rtw_memset(recv_beacon, 0, sizeof(*recv_beacon)); /* checking capabilities */ - capability = le16_to_cpu(*(unsigned short *)(pframe + WLAN_HDR_A3_LEN + 10)); + capability = le16_to_cpu(*(__le16 *)(pframe + WLAN_HDR_A3_LEN + 10)); /* checking IEs */ left = packet_len - sizeof(struct rtw_ieee80211_hdr_3addr) - _BEACON_IE_OFFSET_; @@ -2339,7 +2335,7 @@ int rtw_get_bcn_keys(ADAPTER *Adapter, u8 *pframe, u32 packet_len, return _FALSE; pht_cap = (struct rtw_ieee80211_ht_cap *) elems.ht_capabilities; - recv_beacon->ht_cap_info = pht_cap->cap_info; + recv_beacon->ht_cap_info = le16_to_cpu(pht_cap->cap_info); } if (elems.ht_operation) { @@ -2715,10 +2711,9 @@ void update_beacon_info(_adapter *padapter, u8 *pframe, uint pkt_len, struct sta case _VENDOR_SPECIFIC_IE_: /* to update WMM paramter set while receiving beacon */ if (_rtw_memcmp(pIE->data, WMM_PARA_OUI, 6) && pIE->Length == WLAN_WMM_LEN) /* WMM */ - (WMM_param_handler(padapter, pIE)) ? report_wmm_edca_update(padapter) : 0; - + if (WMM_param_handler(padapter, pIE)) + report_wmm_edca_update(padapter); break; - case _HT_EXTRA_INFO_IE_: /* HT info */ /* HT_info_handler(padapter, pIE); */ bwmode_update_check(padapter, pIE); @@ -2887,7 +2882,6 @@ unsigned int is_ap_in_wep(_adapter *padapter) } -int wifirate2_ratetbl_inx(unsigned char rate); int wifirate2_ratetbl_inx(unsigned char rate) { int inx = 0; @@ -2983,7 +2977,7 @@ int support_short_GI(_adapter *padapter, struct HT_caps_element *pHT_caps, u8 bw bit_offset = (bwmode & 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; else return _FAIL; @@ -3065,7 +3059,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len) switch (pIE->ElementID) { case _VENDOR_SPECIFIC_IE_: - if ((_rtw_memcmp(pIE->data, ARTHEROS_OUI1, 3)) || (_rtw_memcmp(pIE->data, ARTHEROS_OUI2, 3))) { + if ((_rtw_memcmp(pIE->data, ATHEROS_OUI1, 3)) || (_rtw_memcmp(pIE->data, ATHEROS_OUI2, 3))) { RTW_INFO("link to Artheros AP\n"); return HT_IOT_PEER_ATHEROS; } else if ((_rtw_memcmp(pIE->data, BROADCOM_OUI1, 3)) @@ -3369,10 +3363,10 @@ exit: void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) { u8 *pIE; - u32 *pbuf; + __le32 *pbuf; pIE = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); - pbuf = (u32 *)pIE; + pbuf = (__le32 *)pIE; pmlmeext->TSFValue = le32_to_cpu(*(pbuf + 1)); @@ -3383,23 +3377,22 @@ void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) void correct_TSF(_adapter *padapter, struct mlme_ext_priv *pmlmeext) { - rtw_hal_set_hwreg(padapter, HW_VAR_CORRECT_TSF, 0); + rtw_hal_set_hwreg(padapter, HW_VAR_CORRECT_TSF, NULL); } void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, u8 *pframe, uint len) { int i; u8 *pIE; - u32 *pbuf; + __le32 *pbuf; u64 tsf = 0; u32 delay_ms; struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info); - pmlmeext->bcn_cnt++; pIE = pframe + sizeof(struct rtw_ieee80211_hdr_3addr); - pbuf = (u32 *)pIE; + pbuf = (__le32 *)pIE; tsf = le32_to_cpu(*(pbuf + 1)); tsf = tsf << 32; diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 2511abd..64132db 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -3677,7 +3677,6 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) _irqL irqL; /* if(check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) == _TRUE) */ { - void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb); int res, is_vlan_tag = 0, i, do_nat25 = 1; unsigned short vlan_hdr = 0; void *br_port = NULL; @@ -3721,7 +3720,6 @@ int rtw_br_client_tx(_adapter *padapter, struct sk_buff **pskb) if (*((unsigned short *)(skb->data + MACADDRLEN * 2)) == __constant_htons(ETH_P_IP)) { if (memcmp(padapter->scdb_mac, skb->data + MACADDRLEN, MACADDRLEN)) { - void *scdb_findEntry(_adapter *priv, unsigned char *macAddr, unsigned char *ipAddr); padapter->scdb_entry = (struct nat25_network_db_entry *)scdb_findEntry(padapter, skb->data + MACADDRLEN, skb->data + WLAN_ETHHDR_LEN + 12); diff --git a/hal/HalEfuseMask8188E_USB.c b/hal/HalEfuseMask8188E_USB.c index 7bf0444..4cd772e 100644 --- a/hal/HalEfuseMask8188E_USB.c +++ b/hal/HalEfuseMask8188E_USB.c @@ -30,7 +30,7 @@ * MUSB.TXT ******************************************************************************/ -u1Byte Array_MP_8188E_MUSB[] = { +static u1Byte Array_MP_8188E_MUSB[] = { 0xFF, 0xF3, 0x00, diff --git a/hal/phydm/halhwimg8188e_bb.c b/hal/phydm/halhwimg8188e_bb.c index 686fd3c..c131c23 100644 --- a/hal/phydm/halhwimg8188e_bb.c +++ b/hal/phydm/halhwimg8188e_bb.c @@ -119,7 +119,7 @@ check_negative( * AGC_TAB.TXT ******************************************************************************/ -u32 array_mp_8188e_agc_tab[] = { +static u32 array_mp_8188e_agc_tab[] = { 0x88000001, 0x00000000, 0x40000000, 0x00000000, 0xC78, 0xF6000001, 0xC78, 0xF5010001, @@ -1117,7 +1117,7 @@ odm_get_version_mp_8188e_agc_tab(void) * PHY_REG.TXT ******************************************************************************/ -u32 array_mp_8188e_phy_reg[] = { +static u32 array_mp_8188e_phy_reg[] = { 0x800, 0x80040000, 0x804, 0x00000003, 0x808, 0x0000FC00, @@ -1711,7 +1711,7 @@ odm_get_version_mp_8188e_phy_reg(void) * PHY_REG_PG.TXT ******************************************************************************/ -u32 array_mp_8188e_phy_reg_pg[] = { +static u32 array_mp_8188e_phy_reg_pg[] = { 0, 0, 0, 0x00000e08, 0x0000ff00, 0x00003800, 0, 0, 0, 0x0000086c, 0xffffff00, 0x32343600, 0, 0, 0, 0x00000e00, 0xffffffff, 0x40424446, diff --git a/hal/phydm/halhwimg8188e_mac.c b/hal/phydm/halhwimg8188e_mac.c index d1bcc5d..731f7c3 100644 --- a/hal/phydm/halhwimg8188e_mac.c +++ b/hal/phydm/halhwimg8188e_mac.c @@ -119,7 +119,7 @@ check_negative( * MAC_REG.TXT ******************************************************************************/ -u32 array_mp_8188e_mac_reg[] = { +static u32 array_mp_8188e_mac_reg[] = { 0x026, 0x00000041, 0x027, 0x00000035, 0x80000002, 0x00000000, 0x40000000, 0x00000000, diff --git a/hal/phydm/halphyrf_ce.c b/hal/phydm/halphyrf_ce.c index 7451d58..cc194ae 100644 --- a/hal/phydm/halphyrf_ce.c +++ b/hal/phydm/halphyrf_ce.c @@ -718,7 +718,7 @@ u8 odm_get_right_chnl_place_for_iqk(u8 chnl) } #endif -void +static void odm_iq_calibrate( struct PHY_DM_STRUCT *p_dm_odm ) diff --git a/hal/phydm/phydm.c b/hal/phydm/phydm.c index 9f4cea4..07f04c3 100644 --- a/hal/phydm/phydm.c +++ b/hal/phydm/phydm.c @@ -25,7 +25,7 @@ #include "mp_precomp.h" #include "phydm_precomp.h" -const u16 db_invert_table[12][8] = { +static const u16 db_invert_table[12][8] = { { 1, 1, 1, 2, 2, 2, 2, 3}, { 3, 3, 4, 4, 4, 5, 6, 6}, { 7, 8, 9, 10, 11, 13, 14, 16}, @@ -164,7 +164,7 @@ odm_init_mp_driver_status( } -void +static void odm_update_mp_driver_status( struct PHY_DM_STRUCT *p_dm_odm ) @@ -175,7 +175,7 @@ odm_update_mp_driver_status( p_dm_odm->mp_mode = (bool)adapter->registrypriv.mp_mode; } -void +static void phydm_init_trx_antenna_setting( struct PHY_DM_STRUCT *p_dm_odm ) @@ -197,7 +197,7 @@ phydm_init_trx_antenna_setting( /*#endif*/ } -void +static void phydm_traffic_load_decision( void *p_dm_void ) @@ -248,7 +248,7 @@ phydm_traffic_load_decision( } } -void +static void phydm_config_ofdm_tx_path( struct PHY_DM_STRUCT *p_dm_odm, u32 path @@ -338,7 +338,7 @@ phydm_config_ofdm_rx_path( #endif } -void +static void phydm_config_cck_rx_antenna_init( struct PHY_DM_STRUCT *p_dm_odm ) @@ -358,7 +358,7 @@ phydm_config_cck_rx_antenna_init( #endif } -void +static void phydm_config_cck_rx_path( struct PHY_DM_STRUCT *p_dm_odm, u8 path, @@ -460,7 +460,7 @@ phydm_config_trx_path( } -void +static void phydm_init_cck_setting( struct PHY_DM_STRUCT *p_dm_odm ) @@ -506,7 +506,7 @@ phydm_init_cck_setting( } -void +static void phydm_init_soft_ml_setting( struct PHY_DM_STRUCT *p_dm_odm ) @@ -519,7 +519,7 @@ phydm_init_soft_ml_setting( #endif } -void +static void phydm_init_hw_info_by_rfe( struct PHY_DM_STRUCT *p_dm_odm ) @@ -538,7 +538,7 @@ phydm_init_hw_info_by_rfe( #endif } -void +static void odm_common_info_self_init( struct PHY_DM_STRUCT *p_dm_odm ) @@ -580,7 +580,7 @@ odm_common_info_self_init( } -void +static void odm_common_info_self_update( struct PHY_DM_STRUCT *p_dm_odm ) @@ -627,7 +627,7 @@ odm_common_info_self_update( p_dm_odm->phydm_sys_up_time += p_dm_odm->phydm_period; } -void +static void odm_common_info_self_reset( struct PHY_DM_STRUCT *p_dm_odm ) @@ -683,7 +683,7 @@ phydm_get_structure( return p_struct; } -void +static void odm_hw_setting( struct PHY_DM_STRUCT *p_dm_odm ) @@ -709,7 +709,7 @@ odm_hw_setting( #endif } #if SUPPORTABLITY_PHYDMLIZE -void +static void phydm_supportability_init( void *p_dm_void ) @@ -2055,7 +2055,7 @@ phydm_set_ext_switch( } } -void +static void phydm_csi_mask_enable( void *p_dm_void, u32 enable @@ -2079,7 +2079,7 @@ phydm_csi_mask_enable( } -void +static void phydm_clean_all_csi_mask( void *p_dm_void ) @@ -2106,7 +2106,7 @@ phydm_clean_all_csi_mask( } } -void +static void phydm_set_csi_mask_reg( void *p_dm_void, u32 tone_idx_tmp, @@ -2169,7 +2169,7 @@ phydm_set_csi_mask_reg( ODM_RT_TRACE(p_dm_odm, ODM_COMP_API, ODM_DBG_LOUD, ("New Mask tone idx[%d]: Reg0x%x = ((0x%x))\n", (tone_idx_tmp + tone_num_shift), target_reg, reg_tmp_value)); } -void +static void phydm_set_nbi_reg( void *p_dm_void, u32 tone_idx_tmp, @@ -2239,7 +2239,7 @@ phydm_set_nbi_reg( } -void +static void phydm_nbi_enable( void *p_dm_void, u32 enable @@ -2262,7 +2262,7 @@ phydm_nbi_enable( } } -u8 +static u8 phydm_calculate_fc( void *p_dm_void, u32 channel, @@ -2342,7 +2342,7 @@ phydm_calculate_fc( } -u8 +static u8 phydm_calculate_intf_distance( void *p_dm_void, u32 bw, @@ -2376,7 +2376,7 @@ phydm_calculate_intf_distance( } -u8 +static u8 phydm_csi_mask_setting( void *p_dm_void, u32 enable, diff --git a/hal/phydm/phydm_acs.c b/hal/phydm/phydm_acs.c index b340123..0f737f5 100644 --- a/hal/phydm/phydm_acs.c +++ b/hal/phydm/phydm_acs.c @@ -48,7 +48,7 @@ odm_get_auto_channel_select_result( } -void +static void odm_auto_channel_select_setting( void *p_dm_void, bool is_enable diff --git a/hal/phydm/phydm_adaptivity.c b/hal/phydm/phydm_adaptivity.c index a5aff76..fd675f5 100644 --- a/hal/phydm/phydm_adaptivity.c +++ b/hal/phydm/phydm_adaptivity.c @@ -240,7 +240,7 @@ phydm_set_edcca_threshold( } -void +static void phydm_set_lna( void *p_dm_void, enum phydm_set_lna type @@ -596,7 +596,7 @@ phydm_search_pwdb_lower_bound( phydm_set_edcca_threshold(p_dm_odm, 0x7f, 0x7f); /*resume to no link state*/ } -bool +static bool phydm_re_search_condition( void *p_dm_void ) diff --git a/hal/phydm/phydm_ccx.c b/hal/phydm/phydm_ccx.c index 1d7d468..e841749 100644 --- a/hal/phydm/phydm_ccx.c +++ b/hal/phydm/phydm_ccx.c @@ -285,10 +285,7 @@ phydm_check_nhm_ready( return ret; } -void -phydm_store_nhm_setting( - void *p_dm_void -) +static void phydm_store_nhm_setting(void *p_dm_void) { struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void; struct _CCX_INFO *ccx_info = &p_dm_odm->dm_ccx_info; diff --git a/hal/phydm/phydm_cfotracking.c b/hal/phydm/phydm_cfotracking.c index 8eafb3a..76ddc19 100644 --- a/hal/phydm/phydm_cfotracking.c +++ b/hal/phydm/phydm_cfotracking.c @@ -20,7 +20,7 @@ #include "mp_precomp.h" #include "phydm_precomp.h" -void +static void odm_set_crystal_cap( void *p_dm_void, u8 crystal_cap @@ -65,7 +65,7 @@ odm_set_crystal_cap( #endif } -u8 +static u8 odm_get_default_crytaltal_cap( void *p_dm_void ) @@ -90,7 +90,7 @@ odm_get_default_crytaltal_cap( return crystal_cap; } -void +static void odm_set_atc_status( void *p_dm_void, bool atc_status @@ -106,7 +106,7 @@ odm_set_atc_status( p_cfo_track->is_atc_status = atc_status; } -bool +static bool odm_get_atc_status( void *p_dm_void ) diff --git a/hal/phydm/phydm_debug.c b/hal/phydm/phydm_debug.c index fa8127f..b3da79b 100644 --- a/hal/phydm/phydm_debug.c +++ b/hal/phydm/phydm_debug.c @@ -79,7 +79,7 @@ phydm_init_debug_setting( } #if CONFIG_PHYDM_DEBUG_FUNCTION -void +static void phydm_bb_rx_hang_info( void *p_dm_void, u32 *_used, @@ -256,7 +256,7 @@ phydm_bb_rx_hang_info( } -void +static void phydm_bb_debug_info_n_series( void *p_dm_void, u32 *_used, @@ -427,7 +427,7 @@ phydm_bb_debug_info_n_series( } -void +static void phydm_bb_debug_info( void *p_dm_void, u32 *_used, @@ -1430,7 +1430,7 @@ phydm_api_trx_mode( } #endif -void +static void phydm_get_per_path_txagc( void *p_dm_void, u8 path, @@ -1481,7 +1481,7 @@ phydm_get_per_path_txagc( } -void +static void phydm_get_txagc( void *p_dm_void, u32 *_used, @@ -1511,7 +1511,7 @@ phydm_get_txagc( } -void +static void phydm_set_txagc( void *p_dm_void, u32 *const dm_value, @@ -1564,7 +1564,7 @@ phydm_set_txagc( #endif } -void +static void phydm_debug_trace( void *p_dm_void, u32 *const dm_value, @@ -1629,7 +1629,7 @@ phydm_debug_trace( PHYDM_SNPRINTF((output + used, out_len - used, "%s\n", "================================")); } -void +static void phydm_fw_debug_trace( void *p_dm_void, u32 *const dm_value, @@ -1681,7 +1681,7 @@ phydm_fw_debug_trace( } } -void +static void phydm_dump_bb_reg( void *p_dm_void, u32 *_used, @@ -1726,7 +1726,7 @@ phydm_dump_bb_reg( } } -void +static void phydm_dump_all_reg( void *p_dm_void, u32 *_used, @@ -1775,7 +1775,7 @@ phydm_dump_all_reg( } } -void +static void phydm_enable_big_jump( struct PHY_DM_STRUCT *p_dm_odm, bool state @@ -1878,7 +1878,7 @@ enum PHYDM_CMD_ID { PHYDM_DYNAMIC_RA_PATH }; -struct _PHYDM_COMMAND phy_dm_ary[] = { +static struct _PHYDM_COMMAND phy_dm_ary[] = { {"-h", PHYDM_HELP}, /*do not move this element to other position*/ {"demo", PHYDM_DEMO}, /*do not move this element to other position*/ {"ra", PHYDM_RA}, @@ -3016,7 +3016,7 @@ phydm_fw_trace_handler_8051( int i = 0; u8 extend_c2h_sub_id = 0, extend_c2h_dbg_len = 0, extend_c2h_dbg_seq = 0; u8 fw_debug_trace[128]; - u8 *extend_c2h_dbg_content = 0; + u8 *extend_c2h_dbg_content = NULL; if (cmd_len > 127) return; diff --git a/hal/phydm/phydm_dig.c b/hal/phydm/phydm_dig.c index 914e0b2..4057065 100644 --- a/hal/phydm/phydm_dig.c +++ b/hal/phydm/phydm_dig.c @@ -58,7 +58,7 @@ odm_change_dynamic_init_gain_thresh( } } /* dm_change_dynamic_init_gain_thresh */ -int +static int get_igi_for_diff(int value_IGI) { #define ONERCCA_LOW_TH 0x30 @@ -73,7 +73,7 @@ get_igi_for_diff(int value_IGI) return value_IGI; } -void +static void odm_fa_threshold_check( void *p_dm_void, bool is_dfs_band, @@ -121,7 +121,7 @@ odm_fa_threshold_check( return; } -u8 +static u8 odm_forbidden_igi_check( void *p_dm_void, u8 dig_dynamic_min, @@ -226,7 +226,7 @@ odm_forbidden_igi_check( } -void +static void odm_inband_noise_calculate( void *p_dm_void ) @@ -337,7 +337,7 @@ odm_inband_noise_calculate( return; } -void +static void odm_dig_for_bt_hs_mode( void *p_dm_void ) @@ -369,7 +369,7 @@ odm_dig_for_bt_hs_mode( #endif } -void +static void phydm_set_big_jump_step( void *p_dm_void, u8 current_igi @@ -612,7 +612,7 @@ odm_pause_dig( } -bool +static bool odm_dig_abort( void *p_dm_void ) diff --git a/hal/phydm/phydm_dynamictxpower.c b/hal/phydm/phydm_dynamictxpower.c index 6876a7d..8494559 100644 --- a/hal/phydm/phydm_dynamictxpower.c +++ b/hal/phydm/phydm_dynamictxpower.c @@ -126,7 +126,7 @@ odm_dynamic_tx_power_write_power_index( } -void +static void odm_dynamic_tx_power_nic_ce( void *p_dm_void ) diff --git a/hal/phydm/phydm_hwconfig.c b/hal/phydm/phydm_hwconfig.c index f0ba34e..eb4da02 100644 --- a/hal/phydm/phydm_hwconfig.c +++ b/hal/phydm/phydm_hwconfig.c @@ -62,7 +62,7 @@ #define GET_VERSION(ic, txt) GET_VERSION_MP(ic, txt) #endif -u8 +static u8 odm_query_rx_pwr_percentage( s8 ant_power ) @@ -79,7 +79,7 @@ odm_query_rx_pwr_percentage( * 2012/01/12 MH MOve some signal strength smooth method to MP HAL layer. * IF other SW team do not support the feature, remove this section.?? * */ -s32 +static s32 odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_lenovo( struct PHY_DM_STRUCT *p_dm_odm, s32 curr_sig @@ -117,7 +117,7 @@ odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_lenovo( return ret_sig; } -s32 +static s32 odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_netcore( struct PHY_DM_STRUCT *p_dm_odm, s32 curr_sig @@ -155,7 +155,7 @@ odm_signal_scale_mapping_92c_series_patch_rt_cid_819x_netcore( return ret_sig; } -s32 +static s32 odm_signal_scale_mapping_92c_series( struct PHY_DM_STRUCT *p_dm_odm, s32 curr_sig @@ -482,7 +482,7 @@ odm_cfo( return ret_val; } -u8 +static u8 phydm_rate_to_num_ss( struct PHY_DM_STRUCT *p_dm_odm, u8 data_rate @@ -598,7 +598,7 @@ odm_CCKRSSI_8192E( #endif #if (RTL8188E_SUPPORT == 1) -s8 +static s8 odm_CCKRSSI_8188E( struct PHY_DM_STRUCT *p_dm_odm, u16 LNA_idx, @@ -621,7 +621,7 @@ odm_CCKRSSI_8188E( } #endif -void +static void odm_rx_phy_status92c_series_parsing( struct PHY_DM_STRUCT *p_dm_odm, struct _odm_phy_status_info_ *p_phy_info, @@ -1420,7 +1420,7 @@ odm_init_rssi_for_dm( } -void +static void odm_process_rssi_for_dm( struct PHY_DM_STRUCT *p_dm_odm, struct _odm_phy_status_info_ *p_phy_info, @@ -1721,7 +1721,7 @@ odm_process_rssi_for_dm( /* * Endianness before calling this API * */ -void +static void odm_phy_status_query_92c_series( struct PHY_DM_STRUCT *p_dm_odm, struct _odm_phy_status_info_ *p_phy_info, diff --git a/hal/phydm/phydm_interface.c b/hal/phydm/phydm_interface.c index 629a625..9f5b831 100644 --- a/hal/phydm/phydm_interface.c +++ b/hal/phydm/phydm_interface.c @@ -630,7 +630,7 @@ odm_release_timer( } -u8 +static u8 phydm_trans_h2c_id( struct PHY_DM_STRUCT *p_dm_odm, u8 phydm_h2c_id diff --git a/hal/phydm/phydm_kfree.c b/hal/phydm/phydm_kfree.c index f063b78..b26da8d 100644 --- a/hal/phydm/phydm_kfree.c +++ b/hal/phydm/phydm_kfree.c @@ -28,12 +28,7 @@ /* Add for KFree Feature Requested by RF David.*/ /*This is a phydm API*/ -void -phydm_set_kfree_to_rf_8814a( - void *p_dm_void, - u8 e_rf_path, - u8 data -) +static void phydm_set_kfree_to_rf_8814a(void *p_dm_void, u8 e_rf_path, u8 data) { struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void; struct odm_rf_calibration_structure *p_rf_calibrate_info = &(p_dm_odm->rf_calibrate_info); @@ -119,12 +114,7 @@ phydm_set_kfree_to_rf_8814a( } -void -phydm_set_kfree_to_rf( - void *p_dm_void, - u8 e_rf_path, - u8 data -) +static void phydm_set_kfree_to_rf(void *p_dm_void, u8 e_rf_path, u8 data) { struct PHY_DM_STRUCT *p_dm_odm = (struct PHY_DM_STRUCT *)p_dm_void; diff --git a/hal/phydm/phydm_noisemonitor.c b/hal/phydm/phydm_noisemonitor.c index 8501907..0429889 100644 --- a/hal/phydm/phydm_noisemonitor.c +++ b/hal/phydm/phydm_noisemonitor.c @@ -41,7 +41,7 @@ #if (DM_ODM_SUPPORT_TYPE & (ODM_CE | ODM_WIN)) -s16 odm_inband_noise_monitor_n_series(struct PHY_DM_STRUCT *p_dm_odm, u8 is_pause_dig, u8 igi_value, u32 max_time) +static s16 odm_inband_noise_monitor_n_series(struct PHY_DM_STRUCT *p_dm_odm, u8 is_pause_dig, u8 igi_value, u32 max_time) { u32 tmp4b; u8 max_rf_path = 0, rf_path; @@ -167,7 +167,7 @@ s16 odm_inband_noise_monitor_n_series(struct PHY_DM_STRUCT *p_dm_odm, u8 is_paus } -s16 +static s16 odm_inband_noise_monitor_ac_series(struct PHY_DM_STRUCT *p_dm_odm, u8 is_pause_dig, u8 igi_value, u32 max_time ) { diff --git a/hal/phydm/phydm_powertracking_ce.c b/hal/phydm/phydm_powertracking_ce.c index 88b4fba..a3a8c77 100644 --- a/hal/phydm/phydm_powertracking_ce.c +++ b/hal/phydm/phydm_powertracking_ce.c @@ -480,7 +480,7 @@ odm_txpowertracking_init( odm_txpowertracking_thermal_meter_init(p_dm_odm); } -u8 +static u8 get_swing_index( void *p_dm_void ) diff --git a/hal/rtl8188e_rxdesc.c b/hal/rtl8188e_rxdesc.c index cd1ea5e..b0034f9 100644 --- a/hal/rtl8188e_rxdesc.c +++ b/hal/rtl8188e_rxdesc.c @@ -33,52 +33,51 @@ void rtl8188e_query_rx_desc_status( /* phdr = &precvframe->u.hdr; */ - report.rxdw0 = le32_to_cpu(prxstat->rxdw0); - report.rxdw1 = le32_to_cpu(prxstat->rxdw1); - report.rxdw2 = le32_to_cpu(prxstat->rxdw2); - report.rxdw3 = le32_to_cpu(prxstat->rxdw3); - report.rxdw4 = le32_to_cpu(prxstat->rxdw4); - report.rxdw5 = le32_to_cpu(prxstat->rxdw5); + report.rxdw0 = prxstat->rxdw0; + report.rxdw1 = prxstat->rxdw1; + report.rxdw2 = prxstat->rxdw2; + report.rxdw3 = prxstat->rxdw3; + report.rxdw4 = prxstat->rxdw4; + report.rxdw5 = prxstat->rxdw5; prxreport = (PRXREPORT)&report; pattrib = &precvframe->u.hdr.attrib; _rtw_memset(pattrib, 0, sizeof(struct rx_pkt_attrib)); - pattrib->crc_err = (u8)((report.rxdw0 >> 14) & 0x1);;/* (u8)prxreport->crc32; */ + pattrib->crc_err = (u8)((le32_to_cpu(report.rxdw0) >> 14) & 0x1);;/* (u8)prxreport->crc32; */ /* update rx report to recv_frame attribute */ - pattrib->pkt_rpt_type = (u8)((report.rxdw3 >> 14) & 0x3);/* prxreport->rpt_sel; */ + pattrib->pkt_rpt_type = (u8)((le32_to_cpu(report.rxdw3) >> 14) & 0x3);/* prxreport->rpt_sel; */ if (pattrib->pkt_rpt_type == NORMAL_RX) { /* Normal rx packet */ - pattrib->pkt_len = (u16)(report.rxdw0 & 0x00003fff); /* (u16)prxreport->pktlen; */ - pattrib->drvinfo_sz = (u8)((report.rxdw0 >> 16) & 0xf) * 8;/* (u8)(prxreport->drvinfosize << 3); */ + pattrib->pkt_len = cpu_to_le16(le32_to_cpu(report.rxdw0) & 0x00003fff); /* (u16)prxreport->pktlen; */ + pattrib->drvinfo_sz = (u8)((le32_to_cpu(report.rxdw0) >> 16) & 0xf) * 8;/* (u8)(prxreport->drvinfosize << 3); */ - pattrib->physt = (u8)((report.rxdw0 >> 26) & 0x1); /* (u8)prxreport->physt; */ + pattrib->physt = (u8)((le32_to_cpu(report.rxdw0) >> 26) & 0x1); /* (u8)prxreport->physt; */ - pattrib->bdecrypted = (report.rxdw0 & BIT(27)) ? 0 : 1; /* (u8)(prxreport->swdec ? 0 : 1); */ - pattrib->encrypt = (u8)((report.rxdw0 >> 20) & 0x7);/* (u8)prxreport->security; */ + pattrib->bdecrypted = (le32_to_cpu(report.rxdw0) & BIT(27)) ? 0 : 1; /* (u8)(prxreport->swdec ? 0 : 1); */ + pattrib->encrypt = (u8)((le32_to_cpu(report.rxdw0) >> 20) & 0x7);/* (u8)prxreport->security; */ - pattrib->qos = (u8)((report.rxdw0 >> 23) & 0x1);/* (u8)prxreport->qos; */ - pattrib->priority = (u8)((report.rxdw1 >> 8) & 0xf);/* (u8)prxreport->tid; */ + pattrib->qos = (u8)((le32_to_cpu(report.rxdw0) >> 23) & 0x1);/* (u8)prxreport->qos; */ + pattrib->priority = (u8)((le32_to_cpu(report.rxdw1) >> 8) & 0xf);/* (u8)prxreport->tid; */ - pattrib->amsdu = (u8)((report.rxdw1 >> 13) & 0x1);/* (u8)prxreport->amsdu; */ + pattrib->amsdu = (u8)((le32_to_cpu(report.rxdw1) >> 13) & 0x1);/* (u8)prxreport->amsdu; */ - pattrib->seq_num = (u16)(report.rxdw2 & 0x00000fff);/* (u16)prxreport->seq; */ - pattrib->frag_num = (u8)((report.rxdw2 >> 12) & 0xf);/* (u8)prxreport->frag; */ - pattrib->mfrag = (u8)((report.rxdw1 >> 27) & 0x1);/* (u8)prxreport->mf; */ - pattrib->mdata = (u8)((report.rxdw1 >> 26) & 0x1);/* (u8)prxreport->md; */ + pattrib->seq_num = cpu_to_le16(le32_to_cpu(report.rxdw2) & 0x00000fff);/* (u16)prxreport->seq; */ + pattrib->frag_num = (u8)((le32_to_cpu(report.rxdw2) >> 12) & 0xf);/* (u8)prxreport->frag; */ + pattrib->mfrag = (u8)((le32_to_cpu(report.rxdw1) >> 27) & 0x1);/* (u8)prxreport->mf; */ + pattrib->mdata = (u8)((le32_to_cpu(report.rxdw1) >> 26) & 0x1);/* (u8)prxreport->md; */ - pattrib->data_rate = (u8)(report.rxdw3 & 0x3f);/* (u8)prxreport->rxmcs; */ - - pattrib->icv_err = (u8)((report.rxdw0 >> 15) & 0x1);/* (u8)prxreport->icverr; */ - pattrib->shift_sz = (u8)((report.rxdw0 >> 24) & 0x3); + pattrib->data_rate = (u8)(le32_to_cpu(report.rxdw3) & 0x3f);/* (u8)prxreport->rxmcs; */ + pattrib->icv_err = (u8)((le32_to_cpu(report.rxdw0) >> 15) & 0x1);/* (u8)prxreport->icverr; */ + pattrib->shift_sz = (u8)((le32_to_cpu(report.rxdw0) >> 24) & 0x3); } else if (pattrib->pkt_rpt_type == TX_REPORT1) { /* CCX */ - pattrib->pkt_len = TX_RPT1_PKT_LEN; + pattrib->pkt_len = cpu_to_le16(TX_RPT1_PKT_LEN); pattrib->drvinfo_sz = 0; } else if (pattrib->pkt_rpt_type == TX_REPORT2) { /* TX RPT */ - pattrib->pkt_len = (u16)(report.rxdw0 & 0x3FF); /* Rx length[9:0] */ + pattrib->pkt_len = cpu_to_le16(le32_to_cpu(report.rxdw0) & 0x3FF); /* Rx length[9:0] */ pattrib->drvinfo_sz = 0; /* */ @@ -86,9 +85,8 @@ void rtl8188e_query_rx_desc_status( /* */ pattrib->MacIDValidEntry[0] = report.rxdw4; pattrib->MacIDValidEntry[1] = report.rxdw5; - } else if (pattrib->pkt_rpt_type == HIS_REPORT) { /* USB HISR RPT */ - pattrib->pkt_len = (u16)(report.rxdw0 & 0x00003fff); /* (u16)prxreport->pktlen; */ + pattrib->pkt_len = cpu_to_le16(le32_to_cpu(report.rxdw0) & 0x00003fff); /* (u16)prxreport->pktlen; */ } } diff --git a/hal/rtl8188eu_xmit.c b/hal/rtl8188eu_xmit.c index 5323bdb..3ec0cf4 100644 --- a/hal/rtl8188eu_xmit.c +++ b/hal/rtl8188eu_xmit.c @@ -42,7 +42,7 @@ void rtl8188eu_free_xmit_priv(_adapter *padapter) { } -u8 urb_zero_packet_chk(_adapter *padapter, int sz) +static u8 urb_zero_packet_chk(_adapter *padapter, int sz) { u8 blnSetTxDescOffset; HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); @@ -51,9 +51,9 @@ u8 urb_zero_packet_chk(_adapter *padapter, int sz) return blnSetTxDescOffset; } -void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc) +static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc) { - u16 *usPtr = (u16 *)ptxdesc; + __le16 *usPtr = (__le16 *)ptxdesc; u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */ u32 index; u16 checksum = 0; @@ -147,7 +147,7 @@ void rtl8188e_fill_fake_txdesc( #endif } -void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc) +static void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc) { if ((pattrib->encrypt > 0) && !pattrib->bswenc) { switch (pattrib->encrypt) { @@ -182,7 +182,7 @@ void fill_txdesc_sectype(struct pkt_attrib *pattrib, struct tx_desc *ptxdesc) } -void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw) +static void fill_txdesc_vcs(struct pkt_attrib *pattrib, __le32 *pdw) { /* RTW_INFO("cvs_mode=%d\n", pattrib->vcs_mode); */ @@ -217,7 +217,7 @@ void fill_txdesc_vcs(struct pkt_attrib *pattrib, u32 *pdw) } } -void fill_txdesc_phy(struct pkt_attrib *pattrib, u32 *pdw) +static void fill_txdesc_phy(struct pkt_attrib *pattrib, __le32 *pdw) { /* RTW_INFO("bwmode=%d, ch_off=%d\n", pattrib->bwmode, pattrib->ch_offset); */ @@ -321,14 +321,15 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba if (pattrib->ampdu_en == _TRUE) { ptxdesc->txdw2 |= cpu_to_le32(AGG_EN);/* AGG EN */ - ptxdesc->txdw2 |= (pattrib->ampdu_spacing << AMPDU_DENSITY_SHT) & 0x00700000; + ptxdesc->txdw2 |= cpu_to_le32((pattrib->ampdu_spacing << + AMPDU_DENSITY_SHT) & 0x00700000); /* SET_TX_DESC_MAX_AGG_NUM_88E(pDesc, 0x1F); */ /* SET_TX_DESC_MCSG1_MAX_LEN_88E(pDesc, 0x6); */ /* SET_TX_DESC_MCSG2_MAX_LEN_88E(pDesc, 0x6); */ /* SET_TX_DESC_MCSG3_MAX_LEN_88E(pDesc, 0x6); */ /* SET_TX_DESC_MCS7_SGI_MAX_LEN_88E(pDesc, 0x6); */ - ptxdesc->txdw6 = 0x6666f800; + ptxdesc->txdw6 = cpu_to_le32(0x6666f800); } else { ptxdesc->txdw2 |= cpu_to_le32(AGG_BK);/* AGG BK */ } diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index 0f733b7..ba3f484 100644 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -86,7 +86,7 @@ static BOOLEAN HalUsbSetQueuePipeMapping8188EUsb( } -void rtl8188eu_interface_configure(_adapter *padapter) +static void rtl8188eu_interface_configure(_adapter *padapter) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); struct dvobj_priv *pdvobjpriv = adapter_to_dvobj(padapter); @@ -874,7 +874,8 @@ InitUsbAggregationSetting( /* 201/12/10 MH Add for USB agg mode dynamic switch. */ pHalData->UsbRxHighSpeedMode = _FALSE; } -VOID + +static VOID HalRxAggr8188EUsb( IN PADAPTER Adapter, IN BOOLEAN Value @@ -901,7 +902,7 @@ HalRxAggr8188EUsb( * 12/10/2010 MHC Create Version 0. * *---------------------------------------------------------------------------*/ -VOID +static VOID USB_AggModeSwitch( IN PADAPTER Adapter ) @@ -1054,7 +1055,7 @@ rt_rf_power_state RfOnOffDetect(IN PADAPTER pAdapter) void _ps_open_RF(_adapter *padapter); -u32 rtl8188eu_hal_init(PADAPTER Adapter) +static u32 rtl8188eu_hal_init(PADAPTER Adapter) { u8 value8 = 0; u16 value16; @@ -1489,13 +1490,13 @@ void _ps_open_RF(_adapter *padapter) /* phy_SsPwrSwitch92CU(padapter, rf_on, 1); */ } -void _ps_close_RF(_adapter *padapter) +static void _ps_close_RF(_adapter *padapter) { /* here call with bRegSSPwrLvl 1, bRegSSPwrLvl 2 needs to be verified */ /* phy_SsPwrSwitch92CU(padapter, rf_off, 1); */ } -VOID +static void hal_poweroff_8188eu( IN PADAPTER Adapter ) @@ -1582,7 +1583,7 @@ static void rtl8188eu_hw_power_down(_adapter *padapter) rtw_write16(padapter, REG_APS_FSMCO, 0x8812); } -u32 rtl8188eu_hal_deinit(PADAPTER Adapter) +static u32 rtl8188eu_hal_deinit(PADAPTER Adapter) { struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(Adapter); HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); @@ -1613,7 +1614,7 @@ u32 rtl8188eu_hal_deinit(PADAPTER Adapter) return _SUCCESS; } -unsigned int rtl8188eu_inirp_init(PADAPTER Adapter) +static unsigned int rtl8188eu_inirp_init(PADAPTER Adapter) { u8 i; struct recv_buf *precvbuf; @@ -1663,7 +1664,7 @@ exit: } -unsigned int rtl8188eu_inirp_deinit(PADAPTER Adapter) +static unsigned int rtl8188eu_inirp_deinit(PADAPTER Adapter) { rtw_read_port_cancel(Adapter); @@ -1850,7 +1851,7 @@ static u8 ReadAdapterInfo8188EU(PADAPTER Adapter) return _SUCCESS; } -void UpdateInterruptMask8188EU(PADAPTER padapter, u8 bHIMR0 , u32 AddMSR, u32 RemoveMSR) +static void UpdateInterruptMask8188EU(PADAPTER padapter, u8 bHIMR0 , u32 AddMSR, u32 RemoveMSR) { HAL_DATA_TYPE *pHalData; @@ -1875,7 +1876,7 @@ void UpdateInterruptMask8188EU(PADAPTER padapter, u8 bHIMR0 , u32 AddMSR, u32 Re } -void SetHwReg8188EU(PADAPTER Adapter, u8 variable, u8 *val) +static void SetHwReg8188EU(PADAPTER Adapter, u8 variable, u8 *val) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); @@ -1913,7 +1914,7 @@ void SetHwReg8188EU(PADAPTER Adapter, u8 variable, u8 *val) } -void GetHwReg8188EU(PADAPTER Adapter, u8 variable, u8 *val) +static void GetHwReg8188EU(PADAPTER Adapter, u8 variable, u8 *val) { HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter); @@ -1929,7 +1930,7 @@ void GetHwReg8188EU(PADAPTER Adapter, u8 variable, u8 *val) * Description: * Query setting of specified variable. * */ -u8 +static u8 GetHalDefVar8188EUsb( IN PADAPTER Adapter, IN HAL_DEF_VARIABLE eVariable, @@ -1966,7 +1967,7 @@ GetHalDefVar8188EUsb( * Description: * Change default setting of specified variable. * */ -u8 +static u8 SetHalDefVar8188EUsb( IN PADAPTER Adapter, IN HAL_DEF_VARIABLE eVariable, @@ -1985,7 +1986,7 @@ SetHalDefVar8188EUsb( return bResult; } -void _update_response_rate(_adapter *padapter, unsigned int mask) +static void _update_response_rate(_adapter *padapter, unsigned int mask) { u8 RateIndex = 0; /* Set RRSR rate table. */ @@ -2000,7 +2001,7 @@ void _update_response_rate(_adapter *padapter, unsigned int mask) rtw_write8(padapter, REG_INIRTS_RATE_SEL, RateIndex); } -void SetBeaconRelatedRegisters8188EUsb(PADAPTER padapter) +static void SetBeaconRelatedRegisters8188EUsb(PADAPTER padapter) { u32 value32; /* HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); */ diff --git a/include/basic_types.h b/include/basic_types.h index dc01ec6..f57af2c 100644 --- a/include/basic_types.h +++ b/include/basic_types.h @@ -108,43 +108,43 @@ /* * Read LE data from memory to host byte order */ -#define ReadLE4Byte(_ptr) le32_to_cpu(*((u32 *)(_ptr))) -#define ReadLE2Byte(_ptr) le16_to_cpu(*((u16 *)(_ptr))) +#define ReadLE4Byte(_ptr) le32_to_cpu(*((__le32 *)(_ptr))) +#define ReadLE2Byte(_ptr) le16_to_cpu(*((__le16 *)(_ptr))) #define ReadLE1Byte(_ptr) (*((u8 *)(_ptr))) /* * Read BE data from memory to host byte order */ -#define ReadBEE4Byte(_ptr) be32_to_cpu(*((u32 *)(_ptr))) -#define ReadBE2Byte(_ptr) be16_to_cpu(*((u16 *)(_ptr))) +#define ReadBEE4Byte(_ptr) be32_to_cpu(*((__be32 *)(_ptr))) +#define ReadBE2Byte(_ptr) be16_to_cpu(*((__be16 *)(_ptr))) #define ReadBE1Byte(_ptr) (*((u8 *)(_ptr))) /* * Write host byte order data to memory in LE order */ -#define WriteLE4Byte(_ptr, _val) ((*((u32 *)(_ptr))) = cpu_to_le32(_val)) -#define WriteLE2Byte(_ptr, _val) ((*((u16 *)(_ptr))) = cpu_to_le16(_val)) +#define WriteLE4Byte(_ptr, _val) ((*((__le32 *)(_ptr))) = cpu_to_le32(_val)) +#define WriteLE2Byte(_ptr, _val) ((*((i__le16 *)(_ptr))) = cpu_to_le16(_val)) #define WriteLE1Byte(_ptr, _val) ((*((u8 *)(_ptr))) = ((u8)(_val))) /* * Write host byte order data to memory in BE order */ -#define WriteBE4Byte(_ptr, _val) ((*((u32 *)(_ptr))) = cpu_to_be32(_val)) -#define WriteBE2Byte(_ptr, _val) ((*((u16 *)(_ptr))) = cpu_to_be16(_val)) +#define WriteBE4Byte(_ptr, _val) ((*((__be32 *)(_ptr))) = cpu_to_be32(_val)) +#define WriteBE2Byte(_ptr, _val) ((*((__be16 *)(_ptr))) = cpu_to_be16(_val)) #define WriteBE1Byte(_ptr, _val) ((*((u8 *)(_ptr))) = ((u8)(_val))) /* * Return 4-byte value in host byte ordering from 4-byte pointer in litten-endian system. */ -#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) (le32_to_cpu(*((u32 *)(__pStart)))) -#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) (le16_to_cpu(*((u16 *)(__pStart)))) +#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) (le32_to_cpu(*((__le32 *)(__pStart)))) +#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) (le16_to_cpu(*((__le16 *)(__pStart)))) #define LE_P1BYTE_TO_HOST_1BYTE(__pStart) ((*((u8 *)(__pStart)))) /* * Return 4-byte value in host byte ordering from 4-byte pointer in big-endian system. */ -#define BE_P4BYTE_TO_HOST_4BYTE(__pStart) (be32_to_cpu(*((u32 *)(__pStart)))) -#define BE_P2BYTE_TO_HOST_2BYTE(__pStart) (be16_to_cpu(*((u16 *)(__pStart)))) +#define BE_P4BYTE_TO_HOST_4BYTE(__pStart) (be32_to_cpu(*((__be32 *)(__pStart)))) +#define BE_P2BYTE_TO_HOST_2BYTE(__pStart) (be16_to_cpu(*((__be16 *)(__pStart)))) #define BE_P1BYTE_TO_HOST_1BYTE(__pStart) ((*((u8 *)(__pStart)))) /* diff --git a/include/drv_types.h b/include/drv_types.h index 392d799..b9d0e94 100644 --- a/include/drv_types.h +++ b/include/drv_types.h @@ -1473,7 +1473,12 @@ int rtw_dev_pno_set(struct net_device *net, pno_ssid_t *ssid, int num, #endif /* CONFIG_PNO_SET_DEBUG */ #endif /* CONFIG_PNO_SUPPORT */ +void *scdb_findEntry(_adapter *priv, unsigned char *macAddr, + unsigned char *ipAddr); +void dhcp_flag_bcast(_adapter *priv, struct sk_buff *skb); int rtw_suspend_free_assoc_resource(_adapter *padapter); +int recvbuf2recvframe(PADAPTER padapter, void *ptr); + #ifdef CONFIG_WOWLAN int rtw_suspend_wow(_adapter *padapter); int rtw_resume_process_wow(_adapter *padapter); diff --git a/include/hal_data.h b/include/hal_data.h index faff263..c69db7f 100755 --- a/include/hal_data.h +++ b/include/hal_data.h @@ -1040,11 +1040,11 @@ int rtw_halmac_deinit_adapter(struct dvobj_priv *); #define rf_mode_table_data0 RF_ModeTableData0 #define rf_mode_table_data1 RF_ModeTableData1 - - - - - #define RX_SMOOTH_FACTOR Rx_Smooth_Factor +extern int new_bcn_max; +extern u8 REALTEK_96B_IE[]; +extern unsigned char WPA_TKIP_CIPHER[4]; +extern unsigned char RSN_TKIP_CIPHER[4]; + #endif /* __HAL_DATA_H__ */ diff --git a/include/rtw_cmd.h b/include/rtw_cmd.h index aa22a8b..2663e97 100644 --- a/include/rtw_cmd.h +++ b/include/rtw_cmd.h @@ -1230,7 +1230,7 @@ enum rtw_h2c_cmd { #define _SetRFReg_CMD_ _Write_RFREG_CMD_ #ifdef _RTW_CMD_C_ -struct _cmd_callback rtw_cmd_callback[] = { +static struct _cmd_callback rtw_cmd_callback[] = { {GEN_CMD_CODE(_Read_MACREG), &rtw_getmacreg_cmdrsp_callback}, /*0*/ {GEN_CMD_CODE(_Write_MACREG), NULL}, {GEN_CMD_CODE(_Read_BBREG), &rtw_getbbrfreg_cmdrsp_callback}, diff --git a/include/rtw_ht.h b/include/rtw_ht.h index 8ae15ed..2685363 100644 --- a/include/rtw_ht.h +++ b/include/rtw_ht.h @@ -186,7 +186,7 @@ typedef enum _RT_HT_INF1_CAP { /* HT Operation element */ #define GET_HT_OP_ELE_PRI_CHL(_pEleStart) LE_BITS_TO_1BYTE(((u8 *)(_pEleStart)), 0, 8) -#define SET_HT_OP_ELE_PRI_CHL(_pEleStart, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_pEleStart)), 0, 8, _val) +#define SET_HT_OP_ELE_PRI_CHL(_pEleStart, _val) SET_BITS_TO_LE_1BYTE(((u8 *)(_pEleStart)), 0, 8, _val) /* HT Operation Info field */ #define HT_OP_ELE_OP_INFO(_pEleStart) (((u8 *)(_pEleStart)) + 1) diff --git a/include/rtw_io.h b/include/rtw_io.h index b71f0ea..b01d4ef 100644 --- a/include/rtw_io.h +++ b/include/rtw_io.h @@ -91,17 +91,17 @@ struct io_queue; struct _io_ops { u8(*_read8)(struct intf_hdl *pintfhdl, u32 addr); - u16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); - u32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); + __le16(*_read16)(struct intf_hdl *pintfhdl, u32 addr); + __le32(*_read32)(struct intf_hdl *pintfhdl, u32 addr); int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val); - int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val); - int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val); + int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, __le16 val); + int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, __le32 val); int (*_writeN)(struct intf_hdl *pintfhdl, u32 addr, u32 length, u8 *pdata); int (*_write8_async)(struct intf_hdl *pintfhdl, u32 addr, u8 val); - int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, u16 val); - int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, u32 val); + int (*_write16_async)(struct intf_hdl *pintfhdl, u32 addr, __le16 val); + int (*_write32_async)(struct intf_hdl *pintfhdl, u32 addr, __le32 val); void (*_read_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); void (*_write_mem)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem); diff --git a/include/rtw_mlme_ext.h b/include/rtw_mlme_ext.h index 7c05ea3..504e421 100644 --- a/include/rtw_mlme_ext.h +++ b/include/rtw_mlme_ext.h @@ -1108,7 +1108,7 @@ u8 rtw_getmacreg_hdl(_adapter *padapter, u8 *pbuf); #ifdef _RTW_CMD_C_ -struct cmd_hdl wlancmds[] = { +static struct cmd_hdl wlancmds[] = { GEN_DRV_CMD_HANDLER(sizeof(struct readMAC_parm), rtw_getmacreg) /*0*/ GEN_DRV_CMD_HANDLER(0, NULL) GEN_DRV_CMD_HANDLER(0, NULL) diff --git a/include/rtw_recv.h b/include/rtw_recv.h index 2129a7b..ec48df2 100644 --- a/include/rtw_recv.h +++ b/include/rtw_recv.h @@ -94,27 +94,8 @@ struct recv_reorder_ctrl { struct stainfo_rxcache { u16 tid_rxseq[16]; u8 iv[16][8]; -#if 0 - unsigned short tid0_rxseq; - unsigned short tid1_rxseq; - unsigned short tid2_rxseq; - unsigned short tid3_rxseq; - unsigned short tid4_rxseq; - unsigned short tid5_rxseq; - unsigned short tid6_rxseq; - unsigned short tid7_rxseq; - unsigned short tid8_rxseq; - unsigned short tid9_rxseq; - unsigned short tid10_rxseq; - unsigned short tid11_rxseq; - unsigned short tid12_rxseq; - unsigned short tid13_rxseq; - unsigned short tid14_rxseq; - unsigned short tid15_rxseq; -#endif }; - struct smooth_rssi_data { u32 elements[100]; /* array to store values */ u32 index; /* index to current array to store */ @@ -170,9 +151,8 @@ struct rx_raw_rssi { u8 ofdm_snr[4]; }; - struct rx_pkt_attrib { - u16 pkt_len; + __le16 pkt_len; u8 physt; u8 drvinfo_sz; u8 shift_sz; @@ -183,7 +163,7 @@ struct rx_pkt_attrib { u8 priority; u8 pw_save; u8 mdata; - u16 seq_num; + __le16 seq_num; u8 frag_num; u8 mfrag; u8 order; @@ -195,7 +175,7 @@ struct rx_pkt_attrib { u8 crc_err; u8 icv_err; - u16 eth_type; + __le16 eth_type; u8 dst[ETH_ALEN]; u8 src[ETH_ALEN]; @@ -219,16 +199,9 @@ struct rx_pkt_attrib { u8 ldpc; u8 sgi; u8 pkt_rpt_type; - u32 tsfl; - u32 MacIDValidEntry[2]; /* 64 bits present 64 entry. */ + __le32 tsfl; + __le32 MacIDValidEntry[2]; /* 64 bits present 64 entry. */ -#if 0 - u8 signal_qual; - s8 rx_mimo_signal_qual[2]; - u8 signal_strength; - u32 RxPWDBAll; - s32 RecvSignalPower; -#endif struct phy_info phy_info; }; @@ -266,26 +239,21 @@ struct recv_stat { }; #else struct recv_stat { - unsigned int rxdw0; + __le32 rxdw0; - unsigned int rxdw1; + __le32 rxdw1; #if !((defined(CONFIG_RTL8192E) || defined(CONFIG_RTL8814A) || defined(CONFIG_RTL8822B) || defined(CONFIG_RTL8821C)) && defined(CONFIG_PCI_HCI)) /* exclude 8192ee, 8814ae, 8822be, 8821ce */ - unsigned int rxdw2; + __le32 rxdw2; - unsigned int rxdw3; + __le32 rxdw3; #endif #ifndef BUF_DESC_ARCH - unsigned int rxdw4; + __le32 rxdw4; - unsigned int rxdw5; + __le32 rxdw5; -#ifdef CONFIG_PCI_HCI - unsigned int rxdw6; - - unsigned int rxdw7; -#endif #endif /* if BUF_DESC_ARCH is defined, rx_buf_desc occupy 4 double words */ }; #endif diff --git a/include/wifi.h b/include/wifi.h index 7db76d8..469720f 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -273,26 +273,26 @@ enum WIFI_REG_DOMAIN { #define SetToDs(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_TO_DS_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_TO_DS_); \ } while (0) -#define GetToDs(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_TO_DS_)) != 0) +#define GetToDs(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_TO_DS_)) != 0) #define ClearToDs(pbuf) \ do { \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_TO_DS_)); \ + *(__le16 *)(pbuf) &= (~cpu_to_le16(_TO_DS_)); \ } while (0) #define SetFrDs(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_FROM_DS_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_FROM_DS_); \ } while (0) -#define GetFrDs(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_FROM_DS_)) != 0) +#define GetFrDs(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_FROM_DS_)) != 0) #define ClearFrDs(pbuf) \ do { \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)); \ + *(__le16 *)(pbuf) &= (~cpu_to_le16(_FROM_DS_)); \ } while (0) #define get_tofr_ds(pframe) ((GetToDs(pframe) << 1) | GetFrDs(pframe)) @@ -300,76 +300,76 @@ enum WIFI_REG_DOMAIN { #define SetMFrag(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_FRAG_); \ } while (0) #define GetMFrag(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_MORE_FRAG_)) != 0) #define ClearMFrag(pbuf) \ do { \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)); \ + *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_FRAG_)); \ } while (0) #define SetRetry(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_RETRY_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_RETRY_); \ } while (0) -#define GetRetry(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_RETRY_)) != 0) +#define GetRetry(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_RETRY_)) != 0) #define ClearRetry(pbuf) \ do { \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_RETRY_)); \ + *(__le16 *)(pbuf) &= (~cpu_to_le16(_RETRY_)); \ } while (0) #define SetPwrMgt(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_PWRMGT_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_PWRMGT_); \ } while (0) #define GetPwrMgt(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_PWRMGT_)) != 0) #define ClearPwrMgt(pbuf) \ do { \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)); \ + *(__le16 *)(pbuf) &= (~cpu_to_le16(_PWRMGT_)); \ } while (0) #define SetMData(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_MORE_DATA_); \ } while (0) -#define GetMData(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_MORE_DATA_)) != 0) +#define GetMData(pbuf) (((*(__le16 *)(pbuf)) & le16_to_cpu(_MORE_DATA_)) != 0) #define ClearMData(pbuf) \ do { \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)); \ + *(__le16 *)(pbuf) &= (~cpu_to_le16(_MORE_DATA_)); \ } while (0) #define SetPrivacy(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_PRIVACY_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_PRIVACY_); \ } while (0) -#define GetPrivacy(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_PRIVACY_)) != 0) +#define GetPrivacy(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf)) & (_PRIVACY_)) != 0) #define ClearPrivacy(pbuf) \ do { \ - *(unsigned short *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)); \ + *(__le16 *)(pbuf) &= (~cpu_to_le16(_PRIVACY_)); \ } while (0) -#define GetOrder(pbuf) (((*(unsigned short *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0) +#define GetOrder(pbuf) (((*(__le16 *)(pbuf)) & le16_to_cpu(_ORDER_)) != 0) -#define GetFrameType(pbuf) (le16_to_cpu(*(unsigned short *)(pbuf)) & (BIT(3) | BIT(2))) +#define GetFrameType(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(3) | BIT(2))) #define SetFrameType(pbuf, type) \ do { \ - *(unsigned short *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \ - *(unsigned short *)(pbuf) |= __constant_cpu_to_le16(type); \ + *(__le16 *)(pbuf) &= __constant_cpu_to_le16(~(BIT(3) | BIT(2))); \ + *(__le16 *)(pbuf) |= __constant_cpu_to_le16(type); \ } while (0) -#define get_frame_sub_type(pbuf) (cpu_to_le16(*(unsigned short *)(pbuf)) & (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))) +#define get_frame_sub_type(pbuf) (le16_to_cpu(*(__le16 *)(pbuf)) & (BIT(7) | BIT(6) | BIT(5) | BIT(4) | BIT(3) | BIT(2))) #define set_frame_sub_type(pbuf, type) \ @@ -379,47 +379,47 @@ enum WIFI_REG_DOMAIN { } 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) (le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 22))) #define SetFragNum(pbuf, num) \ do { \ - *(unsigned short *)((SIZE_PTR)(pbuf) + 22) = \ - ((*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & le16_to_cpu(~(0x000f))) | \ + *(__le16 *)((SIZE_PTR)(pbuf) + 22) = \ + ((*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & cpu_to_le16(~(0x000f))) | \ cpu_to_le16(0x0f & (num)); \ } while (0) #define SetSeqNum(pbuf, num) \ do { \ - *(unsigned short *)((SIZE_PTR)(pbuf) + 22) = \ - ((*(unsigned short *)((SIZE_PTR)(pbuf) + 22)) & le16_to_cpu((unsigned short)~0xfff0)) | \ - le16_to_cpu((unsigned short)(0xfff0 & (num << 4))); \ + *(__le16 *)((SIZE_PTR)(pbuf) + 22) = \ + cpu_to_le16((le16_to_cpu(*(__le16 *)((SIZE_PTR)(pbuf) + 22)) & 0x000f) | \ + (0xfff0 & (num << 4))); \ } while (0) #define set_duration(pbuf, dur) \ do { \ - *(unsigned short *)((SIZE_PTR)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)); \ + *(__le16 *)((SIZE_PTR)(pbuf) + 2) = cpu_to_le16(0xffff & (dur)); \ } while (0) #define SetPriority(pbuf, tid) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(tid & 0xf); \ + *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf); \ } while (0) #define GetPriority(pbuf) ((le16_to_cpu(*(unsigned short *)(pbuf))) & 0xf) #define SetEOSP(pbuf, eosp) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16((eosp & 1) << 4); \ + *(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4); \ } while (0) #define SetAckpolicy(pbuf, ack) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16((ack & 3) << 5); \ + *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5); \ } while (0) #define GetAckpolicy(pbuf) (((le16_to_cpu(*(unsigned short *)pbuf)) >> 5) & 0x3) @@ -428,7 +428,7 @@ enum WIFI_REG_DOMAIN { #define SetAMsdu(pbuf, amsdu) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7); \ + *(__le16 *)(pbuf) |= cpu_to_le16((amsdu & 1) << 7); \ } while (0) #define GetAid(pbuf) (cpu_to_le16(*(unsigned short *)((SIZE_PTR)(pbuf) + 2)) & 0x3fff) @@ -760,7 +760,7 @@ typedef enum _ELEMENT_ID { #define set_order_bit(pbuf) \ do { \ - *(unsigned short *)(pbuf) |= cpu_to_le16(_ORDER_); \ + *(__le16 *)(pbuf) |= cpu_to_le16(_ORDER_); \ } while (0) @@ -776,12 +776,12 @@ typedef enum _ELEMENT_ID { * described in 802.11n draft section 7.2.1.7.1 */ struct rtw_ieee80211_bar { - unsigned short frame_control; - unsigned short duration; + __le16 frame_control; + __le16 duration; unsigned char ra[6]; unsigned char ta[6]; - unsigned short control; - unsigned short start_seq_num; + __le16 control; + __le16 start_seq_num; } __attribute__((packed)); /* 802.11 BAR control masks */ @@ -796,11 +796,11 @@ struct rtw_ieee80211_bar { */ struct rtw_ieee80211_ht_cap { - unsigned short cap_info; + __le16 cap_info; unsigned char ampdu_params_info; unsigned char supp_mcs_set[16]; - unsigned short extended_ht_cap_info; - unsigned int tx_BF_cap_info; + __le16 extended_ht_cap_info; + __le32 tx_BF_cap_info; unsigned char antenna_selection_info; } __attribute__((packed)); @@ -813,8 +813,8 @@ struct rtw_ieee80211_ht_cap { struct ieee80211_ht_addt_info { unsigned char control_chan; unsigned char ht_param; - unsigned short operation_mode; - unsigned short stbc_param; + __le16 operation_mode; + __le16 stbc_param; unsigned char basic_set[16]; } __attribute__((packed)); @@ -822,11 +822,11 @@ struct ieee80211_ht_addt_info { struct HT_caps_element { union { struct { - unsigned short HT_caps_info; + __le16 HT_caps_info; unsigned char AMPDU_para; unsigned char MCS_rate[16]; - unsigned short HT_ext_caps; - unsigned int Beamforming_caps; + __le16 HT_ext_caps; + __le32 Beamforming_caps; unsigned char ASEL_caps; } HT_cap_element; unsigned char HT_cap[26]; @@ -842,7 +842,7 @@ struct HT_info_element { struct AC_param { unsigned char ACI_AIFSN; unsigned char CW; - unsigned short TXOP_limit; + __le16 TXOP_limit; } __attribute__((packed)); struct WMM_para_element { @@ -853,9 +853,9 @@ struct WMM_para_element { struct ADDBA_request { unsigned char dialog_token; - unsigned short BA_para_set; - unsigned short BA_timeout_value; - unsigned short BA_starting_seqctrl; + __le16 BA_para_set; + __le16 BA_timeout_value; + __le16 BA_starting_seqctrl; } __attribute__((packed)); typedef enum _HT_CAP_AMPDU_FACTOR { diff --git a/os_dep/ioctl_cfg80211.c b/os_dep/ioctl_cfg80211.c index 7a54ef8..0358144 100644 --- a/os_dep/ioctl_cfg80211.c +++ b/os_dep/ioctl_cfg80211.c @@ -349,7 +349,11 @@ static const struct ieee80211_txrx_stypes static u64 rtw_get_systime_us(void) { -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)) + ktime_t ts; + ts = ktime_get_boottime(); + return ts / 1000; +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)) struct timespec ts; get_monotonic_boottime(&ts); return ((u64)ts.tv_sec * 1000000) + ts.tv_nsec / 1000; diff --git a/os_dep/usb_ops_linux.c b/os_dep/usb_ops_linux.c index e2127bb..1c66571 100644 --- a/os_dep/usb_ops_linux.c +++ b/os_dep/usb_ops_linux.c @@ -688,8 +688,6 @@ void usb_init_recvbuf(_adapter *padapter, struct recv_buf *precvbuf) } -int recvbuf2recvframe(PADAPTER padapter, void *ptr); - #ifdef CONFIG_USE_USB_BUFFER_ALLOC_RX void usb_recv_tasklet(void *priv) {