diff --git a/core/rtw_ap.c b/core/rtw_ap.c index a705574..3345fcf 100644 --- a/core/rtw_ap.c +++ b/core/rtw_ap.c @@ -643,11 +643,15 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta) phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable; /* check if sta support s Short GI */ - if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40)) + if ((le16_to_cpu(phtpriv_sta->ht_cap.cap_info) & + le16_to_cpu(phtpriv_ap->ht_cap.cap_info)) & + (IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40)) phtpriv_sta->sgi = true; /* bwmode */ - if ((phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info) & IEEE80211_HT_CAP_SUP_WIDTH) { + if ((le16_to_cpu(phtpriv_sta->ht_cap.cap_info) & + le16_to_cpu(phtpriv_ap->ht_cap.cap_info)) & + IEEE80211_HT_CAP_SUP_WIDTH) { phtpriv_sta->bwmode = pmlmeext->cur_bwmode; phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset; } @@ -1466,7 +1470,8 @@ static int rtw_ht_operation_update(struct 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 ((le16_to_cpu(phtpriv_ap->ht_cap.cap_info) & + IEEE80211_HT_CAP_SUP_WIDTH) && pmlmepriv->num_sta_ht_20mhz) new_op_mode = OP_MODE_20MHZ_HT_STA_ASSOCED; else if (pmlmepriv->olbc_ht) @@ -1596,7 +1601,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta) } if (psta->flags & WLAN_STA_HT) { - u16 ht_capab = psta->htpriv.ht_cap.cap_info; + u16 ht_capab = le16_to_cpu(psta->htpriv.ht_cap.cap_info); DBG_88E("HT: STA %pM HT Capabilities Info: 0x%04x\n", (psta->hwaddr), ht_capab); diff --git a/core/rtw_ieee80211.c b/core/rtw_ieee80211.c index 12cb229..be8d5c2 100644 --- a/core/rtw_ieee80211.c +++ b/core/rtw_ieee80211.c @@ -1493,7 +1493,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork) p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_); if (p && len > 0) { pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2); - pnetwork->BcnInfo.ht_cap_info = pht_cap->cap_info; + pnetwork->BcnInfo.ht_cap_info = le16_to_cpu(pht_cap->cap_info); } else { pnetwork->BcnInfo.ht_cap_info = 0; } diff --git a/core/rtw_mlme.c b/core/rtw_mlme.c index c7afc12..36adb71 100644 --- a/core/rtw_mlme.c +++ b/core/rtw_mlme.c @@ -2160,11 +2160,11 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_ _rtw_memset(&ht_capie, 0, sizeof(struct rtw_ieee80211_ht_cap)); - ht_capie.cap_info = IEEE80211_HT_CAP_SUP_WIDTH | - IEEE80211_HT_CAP_SGI_20 | - IEEE80211_HT_CAP_SGI_40 | - IEEE80211_HT_CAP_TX_STBC | - IEEE80211_HT_CAP_DSSSCCK40; + ht_capie.cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH | + IEEE80211_HT_CAP_SGI_20 | + IEEE80211_HT_CAP_SGI_40 | + IEEE80211_HT_CAP_TX_STBC | + IEEE80211_HT_CAP_DSSSCCK40); 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); diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index b28761c..53bb3f7 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -6066,16 +6066,17 @@ void issue_action_BA(struct adapter *padapter, unsigned char *raddr, unsigned ch pframe = rtw_set_fixed_ie(pframe, 1, &(pmlmeinfo->ADDBA_req.dialog_token), &(pattrib->pktlen)); pframe = rtw_set_fixed_ie(pframe, 2, (unsigned char *)(&status), &(pattrib->pktlen)); rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor); + BA_para_set = le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f; if (MAX_AMPDU_FACTOR_64K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); /* 64 buffer size */ + BA_para_set |= 0x1000; /* 64 buffer size */ else if (MAX_AMPDU_FACTOR_32K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0800); /* 32 buffer size */ + BA_para_set |= 0x0800; /* 32 buffer size */ else if (MAX_AMPDU_FACTOR_16K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0400); /* 16 buffer size */ + BA_para_set |= 0x0400; /* 16 buffer size */ else if (MAX_AMPDU_FACTOR_8K == max_rx_ampdu_factor) - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x0200); /* 8 buffer size */ + BA_para_set |= 0x0200; /* 8 buffer size */ else - BA_para_set = (((pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f) | 0x1000); /* 64 buffer size */ + BA_para_set |= 0x1000; /* 64 buffer size */ if (pregpriv->ampdu_amsdu == 0)/* disabled */ BA_para_set = BA_para_set & ~BIT(0); diff --git a/core/rtw_wlan_util.c b/core/rtw_wlan_util.c index b58b6a4..117b503 100644 --- a/core/rtw_wlan_util.c +++ b/core/rtw_wlan_util.c @@ -953,7 +953,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len) p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_); if (p && len > 0) { pht_cap = (struct rtw_ieee80211_ht_cap *)(p + 2); - ht_cap_info = pht_cap->cap_info; + ht_cap_info = le16_to_cpu(pht_cap->cap_info); } else { ht_cap_info = 0; } diff --git a/hal/rtl8188e_hal_init.c b/hal/rtl8188e_hal_init.c index 8d28898..58cf5a3 100644 --- a/hal/rtl8188e_hal_init.c +++ b/hal/rtl8188e_hal_init.c @@ -218,7 +218,7 @@ static void efuse_read_phymap_from_txpktbuf( u16 dbg_addr = 0; u32 start = 0, passing_time = 0; u8 reg_0x143 = 0; - u32 lo32 = 0, hi32 = 0; + __le32 lo32 = 0, hi32 = 0; u16 len = 0, count = 0; int i = 0; u16 limit = *size; @@ -245,8 +245,8 @@ static void efuse_read_phymap_from_txpktbuf( rtw_usleep_os(100); } - lo32 = le32_to_cpu((__le32)rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L)); - hi32 = le32_to_cpu((__le32)rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H)); + lo32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_L)); + hi32 = cpu_to_le32(rtw_read32(adapter, REG_PKTBUF_DBG_DATA_H)); if (i == 0) { u8 lenc[2]; diff --git a/include/wifi.h b/include/wifi.h index a60bc0e..1818b10 100644 --- a/include/wifi.h +++ b/include/wifi.h @@ -610,12 +610,12 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe) * described in 802.11n draft section 7.2.1.7.1 */ struct rtw_ieee80211_bar { - unsigned short frame_control; - unsigned short duration; - unsigned char ra[6]; - unsigned char ta[6]; - unsigned short control; - unsigned short start_seq_num; + __le16 frame_control; + __le16 duration; + unsigned char ra[ETH_ALEN]; + unsigned char ta[ETH_ALEN]; + __le16 control; + __le16 start_seq_num; } __packed; /* 802.11 BAR control masks */ @@ -630,11 +630,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; + __le16 tx_BF_cap_info; unsigned char antenna_selection_info; } __packed; @@ -647,8 +647,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]; } __packed; @@ -658,8 +658,8 @@ struct HT_caps_element { __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; + __le16 Beamforming_caps; unsigned char ASEL_caps; } HT_cap_element; unsigned char HT_cap[26]; @@ -685,10 +685,11 @@ struct WMM_para_element { } __packed; struct ADDBA_request { + unsigned char action_code; 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; } __packed; enum ht_cap_ampdu_factor { diff --git a/os_dep/ioctl_linux.c b/os_dep/ioctl_linux.c index a215b78..38c1357 100644 --- a/os_dep/ioctl_linux.c +++ b/os_dep/ioctl_linux.c @@ -245,11 +245,14 @@ static char *translate_scan(struct adapter *padapter, if (p && ht_ielen > 0) { struct rtw_ieee80211_ht_cap *pht_capie; + ht_cap = true; pht_capie = (struct rtw_ieee80211_ht_cap *)(p+2); memcpy(&mcs_rate, pht_capie->supp_mcs_set, 2); - bw_40MHz = (pht_capie->cap_info&IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0; - short_GI = (pht_capie->cap_info&(IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; + bw_40MHz = (le16_to_cpu(pht_capie->cap_info) & + IEEE80211_HT_CAP_SUP_WIDTH) ? 1 : 0; + short_GI = (le16_to_cpu(pht_capie->cap_info) & + (IEEE80211_HT_CAP_SGI_20|IEEE80211_HT_CAP_SGI_40)) ? 1 : 0; } /* Add the protocol name */