rtl8188eu: Rework endianess

Several of the struct items related to on-air data must be little endian.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
Larry Finger 2014-12-12 12:15:07 -06:00
parent bad0b4cde4
commit ed2c3ab733
8 changed files with 47 additions and 37 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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];

View file

@ -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 {

View file

@ -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 */