Commit 37cb982c authored by Jes Sorensen's avatar Jes Sorensen Committed by Greg Kroah-Hartman

staging: rtl8723au: Get rid of struct ndis_802_11_config

This exposed a nice endian bug in collect_bss_info23a() where two
bytes in little-endian order were copied into a u32 and afterwards
le32_to_cpu() was applied to it....
Signed-off-by: default avatarJes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9a3c0568
......@@ -391,7 +391,7 @@ void add_RATid23a(struct rtw_adapter *padapter, struct sta_info *psta, u8 rssi_l
shortGIrate = psta_ht->sgi;
}
if (pcur_network->Configuration.DSConfig > 14) {
if (pcur_network->DSConfig > 14) {
/* 5G band */
if (tx_ra_bitmap & 0xffff000)
sta_band |= WIRELESS_11_5N | WIRELESS_11A;
......@@ -484,7 +484,7 @@ static void update_bmc_sta(struct rtw_adapter *padapter)
tx_ra_bitmap |= rtw_get_bit_value_from_ieee_value23a(psta->bssrateset[i]&0x7f);
}
if (pcur_network->Configuration.DSConfig > 14) {
if (pcur_network->DSConfig > 14) {
/* force to A mode. 5G doesn't support CCK rates */
network_type = WIRELESS_11A;
tx_ra_bitmap = 0x150; /* 6, 12, 24 Mbps */
......@@ -653,8 +653,8 @@ static void start_bss_network(struct rtw_adapter *padapter, u8 *pbuf)
struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;
struct HT_info_element *pht_info = NULL;
bcn_interval = (u16)pnetwork->Configuration.BeaconPeriod;
cur_channel = pnetwork->Configuration.DSConfig;
bcn_interval = (u16)pnetwork->BeaconPeriod;
cur_channel = pnetwork->DSConfig;
cur_bwmode = HT_CHANNEL_WIDTH_20;;
cur_ch_offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
......@@ -838,7 +838,7 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
/* beacon interval */
/* ie + 8; 8: TimeStamp, 2: Beacon Interval 2:Capability */
pbeacon = rtw_get_beacon_interval23a_from_ie(ie);
pbss_network->Configuration.BeaconPeriod = get_unaligned_le16(pbeacon);
pbss_network->BeaconPeriod = get_unaligned_le16(pbeacon);
/* capability */
cap = get_unaligned_le16(ie);
......@@ -854,13 +854,12 @@ int rtw_check_beacon_data23a(struct rtw_adapter *padapter, u8 *pbuf,
/* chnnel */
channel = 0;
pbss_network->Configuration.Length = 0;
p = rtw_get_ie23a(ie + _BEACON_IE_OFFSET_, WLAN_EID_DS_PARAMS, &ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_));
if (p && ie_len > 0)
channel = *(p + 2);
pbss_network->Configuration.DSConfig = channel;
pbss_network->DSConfig = channel;
memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
/* get supported rates */
......
......@@ -395,7 +395,7 @@ int rtw_generate_ie23a(struct registry_priv *pregistrypriv)
/* beacon interval : 2bytes */
/* BCN_INTERVAL; */
*(u16*)ie = cpu_to_le16((u16)pdev_network->Configuration.BeaconPeriod);
*(u16*)ie = cpu_to_le16(pdev_network->BeaconPeriod);
sz += 2;
ie += 2;
......@@ -419,7 +419,7 @@ int rtw_generate_ie23a(struct registry_priv *pregistrypriv)
/* supported rates */
if (pregistrypriv->wireless_mode == WIRELESS_11ABGN) {
if (pdev_network->Configuration.DSConfig > 14)
if (pdev_network->DSConfig > 14)
wireless_mode = WIRELESS_11A_5N;
else
wireless_mode = WIRELESS_11BG_24N;
......@@ -442,12 +442,12 @@ int rtw_generate_ie23a(struct registry_priv *pregistrypriv)
/* DS parameter set */
ie = rtw_set_ie23a(ie, WLAN_EID_DS_PARAMS, 1,
(u8 *)&pdev_network->Configuration.DSConfig, &sz);
(u8 *)&pdev_network->DSConfig, &sz);
/* IBSS Parameter Set */
ie = rtw_set_ie23a(ie, WLAN_EID_IBSS_PARAMS, 2,
(u8 *)&pdev_network->Configuration.ATIMWindow, &sz);
(u8 *)&pdev_network->ATIMWindow, &sz);
if (rateLen > 8) {
ie = rtw_set_ie23a(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8),
......
......@@ -367,7 +367,7 @@ int is_same_network23a(struct wlan_bssid_ex *src, struct wlan_bssid_ex *dst)
d_cap = get_unaligned_le16(rtw_get_capability23a_from_ie(dst->IEs));
return ((src->Ssid.ssid_len == dst->Ssid.ssid_len) &&
/* (src->Configuration.DSConfig == dst->Configuration.DSConfig) && */
/* (src->DSConfig == dst->DSConfig) && */
ether_addr_equal(src->MacAddress, dst->MacAddress) &&
((!memcmp(src->Ssid.ssid, dst->Ssid.ssid, src->Ssid.ssid_len))) &&
((s_cap & WLAN_CAPABILITY_IBSS) ==
......@@ -416,7 +416,7 @@ void update_network23a(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
DBG_8723A("%s %s(%pM, ch%u) ss_ori:%3u, sq_ori:%3u, rssi_ori:%3ld, "
"ss_smp:%3u, sq_smp:%3u, rssi_smp:%3ld\n",
__func__, src->Ssid.ssid, src->MacAddress,
src->Configuration.DSConfig, ss_ori, sq_ori, rssi_ori,
src->DSConfig, ss_ori, sq_ori, rssi_ori,
ss_smp, sq_smp, rssi_smp
);
......@@ -1795,7 +1795,7 @@ int rtw_select_and_join_from_scanned_queue23a(struct mlme_priv *pmlmepriv)
DBG_8723A("%s: candidate: %s("MAC_FMT", ch:%u)\n", __func__,
candidate->network.Ssid.ssid,
MAC_ARG(candidate->network.MacAddress),
candidate->network.Configuration.DSConfig);
candidate->network.DSConfig);
}
/* check for situation of _FW_LINKED */
......@@ -2122,8 +2122,7 @@ void rtw_init_registrypriv_dev_network23a(struct rtw_adapter* adapter)
memcpy(&pdev_network->Ssid, &pregistrypriv->ssid,
sizeof(struct cfg80211_ssid));
pdev_network->Configuration.Length=sizeof(struct ndis_802_11_config);
pdev_network->Configuration.BeaconPeriod = 100;
pdev_network->BeaconPeriod = 100;
}
void rtw_update_registrypriv_dev_network23a(struct rtw_adapter* adapter)
......@@ -2140,14 +2139,13 @@ void rtw_update_registrypriv_dev_network23a(struct rtw_adapter* adapter)
pdev_network->Rssi = 0;
pdev_network->Configuration.DSConfig = pregistrypriv->channel;
pdev_network->DSConfig = pregistrypriv->channel;
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
("pregistrypriv->channel =%d, pdev_network->Configuration."
"DSConfig = 0x%x\n", pregistrypriv->channel,
pdev_network->Configuration.DSConfig));
("pregistrypriv->channel =%d, pdev_network->DSConfig = 0x%x\n",
pregistrypriv->channel, pdev_network->DSConfig));
if (cur_network->network.ifmode == NL80211_IFTYPE_ADHOC)
pdev_network->Configuration.ATIMWindow = 0;
pdev_network->ATIMWindow = 0;
pdev_network->ifmode = cur_network->network.ifmode;
......
......@@ -2536,15 +2536,14 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms)
/* DS parameter set */
pframe = rtw_set_ie23a(pframe, WLAN_EID_DS_PARAMS, 1, (unsigned char *)
&cur_network->Configuration.DSConfig,
&pattrib->pktlen);
&cur_network->DSConfig, &pattrib->pktlen);
/* if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) */
{
u8 erpinfo = 0;
u32 ATIMWindow;
/* IBSS Parameter Set... */
/* ATIMWindow = cur->Configuration.ATIMWindow; */
/* ATIMWindow = cur->ATIMWindow; */
ATIMWindow = 0;
pframe = rtw_set_ie23a(pframe, WLAN_EID_IBSS_PARAMS, 2,
(unsigned char *)&ATIMWindow,
......@@ -2766,15 +2765,14 @@ void issue_probersp23a(struct rtw_adapter *padapter, unsigned char *da,
/* DS parameter set */
pframe = rtw_set_ie23a(pframe, WLAN_EID_DS_PARAMS, 1,
(unsigned char *)
&cur_network->Configuration.DSConfig,
(unsigned char *)&cur_network->DSConfig,
&pattrib->pktlen);
if ((pmlmeinfo->state & 0x03) == WIFI_FW_ADHOC_STATE) {
u8 erpinfo = 0;
u32 ATIMWindow;
/* IBSS Parameter Set... */
/* ATIMWindow = cur->Configuration.ATIMWindow; */
/* ATIMWindow = cur->ATIMWindow; */
ATIMWindow = 0;
pframe = rtw_set_ie23a(pframe, WLAN_EID_IBSS_PARAMS, 2,
(unsigned char *)&ATIMWindow,
......@@ -4231,11 +4229,11 @@ static void issue_action_BSSCoexistPacket(struct rtw_adapter *padapter)
pbss_network->IEs + _FIXED_IE_LENGTH_,
pbss_network->IELength -_FIXED_IE_LENGTH_);
if (!p || !p[1]) { /* non-HT */
if (pbss_network->Configuration.DSConfig <= 0 ||
pbss_network->Configuration.DSConfig > 14)
if (pbss_network->DSConfig <= 0 ||
pbss_network->DSConfig > 14)
continue;
ICS[0][pbss_network->Configuration.DSConfig] = 1;
ICS[0][pbss_network->DSConfig] = 1;
if (ICS[0][0] == 0)
ICS[0][0] = 1;
......@@ -4571,11 +4569,10 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
p = cfg80211_find_ie(WLAN_EID_DS_PARAMS, bssid->IEs + ie_offset,
bssid->IELength - ie_offset);
bssid->Configuration.DSConfig = 0;
bssid->Configuration.Length = 0;
bssid->DSConfig = 0;
if (p) {
bssid->Configuration.DSConfig = p[2];
bssid->DSConfig = p[2];
} else {/* In 5G, some ap do not have DSSET IE */
/* checking HT info for channel */
p = cfg80211_find_ie(WLAN_EID_HT_OPERATION,
......@@ -4584,12 +4581,9 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
if (p) {
struct HT_info_element *HT_info =
(struct HT_info_element *)(p + 2);
bssid->Configuration.DSConfig =
HT_info->primary_channel;
} else { /* use current channel */
bssid->Configuration.DSConfig =
rtw_get_oper_ch23a(padapter);
}
bssid->DSConfig = HT_info->primary_channel;
} else /* use current channel */
bssid->DSConfig = rtw_get_oper_ch23a(padapter);
}
if (ieee80211_is_probe_req(mgmt->frame_control)) {
......@@ -4600,10 +4594,8 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
return _SUCCESS;
}
memcpy(&bssid->Configuration.BeaconPeriod,
rtw_get_beacon_interval23a_from_ie(bssid->IEs), 2);
bssid->Configuration.BeaconPeriod =
le32_to_cpu(bssid->Configuration.BeaconPeriod);
bssid->BeaconPeriod = get_unaligned_le16(
rtw_get_beacon_interval23a_from_ie(bssid->IEs));
if (capab_info & BIT(0)) {
bssid->ifmode = NL80211_IFTYPE_STATION;
......@@ -4618,7 +4610,7 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
else
bssid->Privacy = 0;
bssid->Configuration.ATIMWindow = 0;
bssid->ATIMWindow = 0;
/* 20/40 BSS Coexistence check */
if (pregistrypriv->wifi_spec == 1 &&
......@@ -4640,7 +4632,7 @@ int collect_bss_info23a(struct rtw_adapter *padapter,
/* mark bss info receving from nearby channel as SignalQuality 101 */
if (bssid->Configuration.DSConfig != rtw_get_oper_ch23a(padapter))
if (bssid->DSConfig != rtw_get_oper_ch23a(padapter))
bssid->PhyInfo.SignalQuality = 101;
return _SUCCESS;
......@@ -4652,7 +4644,7 @@ void start_create_ibss23a(struct rtw_adapter* padapter)
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network;
pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
pmlmeext->cur_channel = (u8)pnetwork->DSConfig;
pmlmeinfo->bcn_interval = get_beacon_interval23a(pnetwork);
/* update wireless mode */
......@@ -4707,7 +4699,7 @@ void start_clnt_join23a(struct rtw_adapter* padapter)
struct wlan_bssid_ex *pnetwork = &pmlmeinfo->network;
int beacon_timeout;
pmlmeext->cur_channel = (u8)pnetwork->Configuration.DSConfig;
pmlmeext->cur_channel = (u8)pnetwork->DSConfig;
pmlmeinfo->bcn_interval = get_beacon_interval23a(pnetwork);
/* update wireless mode */
......@@ -5035,7 +5027,7 @@ static void process_80211d(struct rtw_adapter *padapter,
}
/* If channel is used by AP, set channel scan type to active */
channel = bssid->Configuration.DSConfig;
channel = bssid->DSConfig;
chplan_new = pmlmeext->channel_set;
i = 0;
while (i < MAX_CHANNEL_NUM && chplan_new[i].ChannelNum != 0) {
......
......@@ -267,15 +267,15 @@ static void ConstructBeacon(struct rtw_adapter *padapter, u8 *pframe, u32 *pLeng
/* DS parameter set */
pframe = rtw_set_ie23a(pframe, WLAN_EID_DS_PARAMS, 1, (unsigned char *)
&cur_network->Configuration.DSConfig, &pktlen);
&cur_network->DSConfig, &pktlen);
if ((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) {
u32 ATIMWindow;
/* IBSS Parameter Set... */
/* ATIMWindow = cur->Configuration.ATIMWindow; */
/* ATIMWindow = cur->ATIMWindow; */
ATIMWindow = 0;
pframe = rtw_set_ie23a(pframe, WLAN_EID_IBSS_PARAMS, 2,
(unsigned char *)(&ATIMWindow), &pktlen);
(unsigned char *)&ATIMWindow, &pktlen);
}
/* todo: ERP IE */
......
......@@ -22,17 +22,6 @@
#define NDIS_802_11_LENGTH_RATES 8
#define NDIS_802_11_LENGTH_RATES_EX 16
/*
FW will only save the channel number in DSConfig.
ODI Handler will convert the channel number to freq. number.
*/
struct ndis_802_11_config {
u32 Length; /* Length of structure */
u32 BeaconPeriod; /* units are Kusec */
u32 ATIMWindow; /* units are Kusec */
u32 DSConfig; /* Frequency, units are kHz */
};
struct ndis_802_11_fixed_ies {
u8 Timestamp[8];
u16 BeaconInterval;
......@@ -134,7 +123,9 @@ struct wlan_bssid_ex {
struct cfg80211_ssid Ssid;
u32 Privacy;
long Rssi;/* in dBM, raw data , get from PHY) */
struct ndis_802_11_config Configuration;
u16 BeaconPeriod; /* units are Kusec */
u32 ATIMWindow; /* units are Kusec */
u32 DSConfig; /* Frequency, units are kHz */
enum nl80211_iftype ifmode;
unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
struct wlan_phy_info PhyInfo;
......
......@@ -276,7 +276,7 @@ static int rtw_cfg80211_inform_bss(struct rtw_adapter *padapter,
goto exit;
}
channel = pnetwork->network.Configuration.DSConfig;
channel = pnetwork->network.DSConfig;
if (channel <= RTW_CH_MAX_2G_CHANNEL)
freq = ieee80211_channel_to_frequency(channel,
IEEE80211_BAND_2GHZ);
......@@ -367,7 +367,7 @@ void rtw_cfg80211_indicate_connect(struct rtw_adapter *padapter)
struct wiphy *wiphy = pwdev->wiphy;
struct ieee80211_channel *notify_channel;
u32 freq;
u16 channel = cur_network->network.Configuration.DSConfig;
u16 channel = cur_network->network.DSConfig;
if (channel <= RTW_CH_MAX_2G_CHANNEL)
freq =
......@@ -1475,7 +1475,7 @@ void rtw_cfg80211_surveydone_event_callback(struct rtw_adapter *padapter)
contains the channel to which this network belongs */
if (rtw_ch_set_search_ch23a
(padapter->mlmeextpriv.channel_set,
pnetwork->network.Configuration.DSConfig) >= 0)
pnetwork->network.DSConfig) >= 0)
rtw_cfg80211_inform_bss(padapter, pnetwork);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment