summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/rtl8723bs/core/rtw_ap.c289
1 files changed, 120 insertions, 169 deletions
diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 2faa1e14a039..4cd9b7a74313 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -477,14 +477,14 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
/* check if sta supports rx ampdu */
phtpriv_sta->ampdu_enable = phtpriv_ap->ampdu_enable;
- phtpriv_sta->rx_ampdu_min_spacing = (
- phtpriv_sta->ht_cap.ampdu_params_info & IEEE80211_HT_CAP_AMPDU_DENSITY
- ) >> 2;
+ phtpriv_sta->rx_ampdu_min_spacing =
+ (phtpriv_sta->ht_cap.ampdu_params_info &
+ IEEE80211_HT_CAP_AMPDU_DENSITY) >> 2;
/* bwmode */
- if ((
- phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info
- ) & cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
+ if ((phtpriv_sta->ht_cap.cap_info &
+ phtpriv_ap->ht_cap.cap_info) &
+ cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH))
psta->bw_mode = CHANNEL_WIDTH_40;
else
psta->bw_mode = CHANNEL_WIDTH_20;
@@ -495,15 +495,15 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
phtpriv_sta->ch_offset = pmlmeext->cur_ch_offset;
/* check if sta support s Short GI 20M */
- if ((
- phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info
- ) & cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
+ if ((phtpriv_sta->ht_cap.cap_info &
+ phtpriv_ap->ht_cap.cap_info) &
+ cpu_to_le16(IEEE80211_HT_CAP_SGI_20))
phtpriv_sta->sgi_20m = true;
/* check if sta support s Short GI 40M */
- if ((
- phtpriv_sta->ht_cap.cap_info & phtpriv_ap->ht_cap.cap_info
- ) & cpu_to_le16(IEEE80211_HT_CAP_SGI_40)) {
+ if ((phtpriv_sta->ht_cap.cap_info &
+ phtpriv_ap->ht_cap.cap_info) &
+ cpu_to_le16(IEEE80211_HT_CAP_SGI_40)) {
if (psta->bw_mode == CHANNEL_WIDTH_40) /* according to psta->bw_mode */
phtpriv_sta->sgi_40m = true;
else
@@ -622,9 +622,9 @@ static void update_hw_ht_param(struct adapter *padapter)
/* */
/* Config SM Power Save setting */
/* */
- pmlmeinfo->SM_PS = (le16_to_cpu(
- pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info
- ) & 0x0C) >> 2;
+ pmlmeinfo->SM_PS =
+ (le16_to_cpu(pmlmeinfo->HT_caps.u.HT_cap_element.HT_caps_info) &
+ 0x0C) >> 2;
/* */
/* Config current HT Protection mode. */
@@ -702,9 +702,8 @@ void start_bss_network(struct adapter *padapter)
rtw_hal_set_hwreg(padapter, HW_VAR_AC_PARAM_BK, (u8 *)(&acparm));
/* Set Security */
- val8 = (
- psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X
- ) ? 0xcc : 0xcf;
+ val8 = (psecuritypriv->dot11AuthAlgrthm ==
+ dot11AuthAlgrthm_8021X) ? 0xcc : 0xcf;
rtw_hal_set_hwreg(padapter, HW_VAR_SEC_CFG, (u8 *)(&val8));
/* Beacon Control related register */
@@ -779,10 +778,8 @@ void start_bss_network(struct adapter *padapter)
rtw_hal_set_hwreg(padapter, HW_VAR_BASIC_RATE, pnetwork->supported_rates);
/* update capability after cur_wireless_mode updated */
- update_capinfo(
- padapter,
- rtw_get_capability((struct wlan_bssid_ex *)pnetwork)
- );
+ update_capinfo(padapter,
+ rtw_get_capability((struct wlan_bssid_ex *)pnetwork));
if (pmlmeext->bstart_bss) {
update_beacon(padapter, WLAN_EID_TIM, NULL, true);
@@ -848,12 +845,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
cap = get_unaligned_le16(ie);
/* SSID */
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_SSID,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_SSID,
+ &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p && ie_len > 0) {
memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid));
memcpy(pbss_network->ssid.ssid, (p + 2), ie_len);
@@ -863,11 +858,9 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* channel */
channel = 0;
pbss_network->configuration.length = 0;
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_DS_PARAMS, &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_DS_PARAMS, &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p && ie_len > 0)
channel = *(p + 2);
@@ -875,24 +868,20 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
/* get supported rates */
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_SUPP_RATES,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_SUPP_RATES,
+ &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p) {
memcpy(supportRate, p + 2, ie_len);
supportRateNum = ie_len;
}
/* get ext_supported rates */
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_EXT_SUPP_RATES,
- &ie_len,
- pbss_network->ie_length - _BEACON_IE_OFFSET_
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_EXT_SUPP_RATES,
+ &ie_len,
+ pbss_network->ie_length - _BEACON_IE_OFFSET_);
if (p) {
memcpy(supportRate + supportRateNum, p + 2, ie_len);
supportRateNum += ie_len;
@@ -903,12 +892,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
rtw_set_supported_rate(pbss_network->supported_rates, network_type);
/* parsing ERP_IE */
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_ERP_INFO,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_ERP_INFO,
+ &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p && ie_len > 0)
ERP_IE_handler(padapter, (struct ndis_80211_var_ie *)p);
@@ -924,20 +911,16 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
group_cipher = 0; pairwise_cipher = 0;
psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_RSN,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_RSN,
+ &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p && ie_len > 0) {
- if (rtw_parse_wpa2_ie(
- p,
- ie_len + 2,
- &group_cipher,
- &pairwise_cipher,
- NULL
- ) == _SUCCESS) {
+ if (rtw_parse_wpa2_ie(p,
+ ie_len + 2,
+ &group_cipher,
+ &pairwise_cipher,
+ NULL) == _SUCCESS) {
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
@@ -954,20 +937,16 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
for (p = ie + _BEACON_IE_OFFSET_; ; p += (ie_len + 2)) {
- p = rtw_get_ie(
- p,
- WLAN_EID_VENDOR_SPECIFIC,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_ - (ie_len + 2))
- );
+ p = rtw_get_ie(p,
+ WLAN_EID_VENDOR_SPECIFIC,
+ &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_ - (ie_len + 2)));
if ((p) && (!memcmp(p + 2, OUI1, 4))) {
- if (rtw_parse_wpa_ie(
- p,
- ie_len + 2,
- &group_cipher,
- &pairwise_cipher,
- NULL
- ) == _SUCCESS) {
+ if (rtw_parse_wpa_ie(p,
+ ie_len + 2,
+ &group_cipher,
+ &pairwise_cipher,
+ NULL) == _SUCCESS) {
psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
@@ -990,12 +969,11 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
pmlmepriv->qospriv.qos_option = 0;
if (pregistrypriv->wmm_enable) {
for (p = ie + _BEACON_IE_OFFSET_; ; p += (ie_len + 2)) {
- p = rtw_get_ie(
- p,
- WLAN_EID_VENDOR_SPECIFIC,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_ - (ie_len + 2))
- );
+ p = rtw_get_ie(p,
+ WLAN_EID_VENDOR_SPECIFIC,
+ &ie_len,
+ (pbss_network->ie_length -
+ _BEACON_IE_OFFSET_ - (ie_len + 2)));
if ((p) && !memcmp(p + 2, WMM_PARA_IE, 6)) {
pmlmepriv->qospriv.qos_option = 1;
@@ -1017,12 +995,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
}
/* parsing HT_CAP_IE */
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_HT_CAPABILITY,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_HT_CAPABILITY,
+ &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p && ie_len > 0) {
u8 max_rx_ampdu_factor = 0;
struct ieee80211_ht_cap *pht_cap = (struct ieee80211_ht_cap *)(p + 2);
@@ -1049,9 +1025,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_RX))
pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_RX_STBC_3R));
- pht_cap->ampdu_params_info &= ~(
- IEEE80211_HT_CAP_AMPDU_FACTOR | IEEE80211_HT_CAP_AMPDU_DENSITY
- );
+ pht_cap->ampdu_params_info &= ~(IEEE80211_HT_CAP_AMPDU_FACTOR |
+ IEEE80211_HT_CAP_AMPDU_DENSITY);
if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) ||
(psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) {
@@ -1062,14 +1037,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
0x00);
}
- rtw_hal_get_def_var(
- padapter,
- HW_VAR_MAX_RX_AMPDU_FACTOR,
- &max_rx_ampdu_factor
- );
- pht_cap->ampdu_params_info |= (
- IEEE80211_HT_CAP_AMPDU_FACTOR & max_rx_ampdu_factor
- ); /* set Max Rx AMPDU size to 64K */
+ rtw_hal_get_def_var(padapter,
+ HW_VAR_MAX_RX_AMPDU_FACTOR,
+ &max_rx_ampdu_factor);
+ /* set Max Rx AMPDU size to 64K */
+ pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR &
+ max_rx_ampdu_factor);
pht_cap->mcs.rx_mask[0] = 0xff;
pht_cap->mcs.rx_mask[1] = 0x0;
@@ -1078,12 +1051,10 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
}
/* parsing HT_INFO_IE */
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_HT_OPERATION,
- &ie_len,
- (pbss_network->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_HT_OPERATION,
+ &ie_len,
+ (pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p && ie_len > 0)
pHT_info_ie = p;
@@ -1125,9 +1096,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
HT_info_handler(padapter, (struct ndis_80211_var_ie *)pHT_info_ie);
}
- pbss_network->length = get_wlan_bssid_ex_sz(
- (struct wlan_bssid_ex *)pbss_network
- );
+ pbss_network->length =
+ get_wlan_bssid_ex_sz((struct wlan_bssid_ex *)pbss_network);
/* issue beacon to start bss network */
/* start_bss_network(padapter, (u8 *)pbss_network); */
@@ -1234,10 +1204,8 @@ void rtw_acl_remove_sta(struct adapter *padapter, u8 *addr)
list_for_each_safe(plist, tmp, phead) {
paclnode = list_entry(plist, struct rtw_wlan_acl_node, list);
- if (
- !memcmp(paclnode->addr, addr, ETH_ALEN) ||
- is_broadcast_ether_addr(addr)
- ) {
+ if (!memcmp(paclnode->addr, addr, ETH_ALEN) ||
+ is_broadcast_ether_addr(addr)) {
if (paclnode->valid) {
paclnode->valid = false;
@@ -1286,13 +1254,11 @@ exit:
return res;
}
-static int rtw_ap_set_key(
- struct adapter *padapter,
- u8 *key,
- u8 alg,
- int keyid,
- u8 set_tx
-)
+static int rtw_ap_set_key(struct adapter *padapter,
+ u8 *key,
+ u8 alg,
+ int keyid,
+ u8 set_tx)
{
u8 keylen;
struct cmd_obj *pcmd;
@@ -1356,13 +1322,11 @@ int rtw_ap_set_group_key(struct adapter *padapter, u8 *key, u8 alg, int keyid)
return rtw_ap_set_key(padapter, key, alg, keyid, 1);
}
-int rtw_ap_set_wep_key(
- struct adapter *padapter,
- u8 *key,
- u8 keylen,
- int keyid,
- u8 set_tx
-)
+int rtw_ap_set_wep_key(struct adapter *padapter,
+ u8 *key,
+ u8 keylen,
+ int keyid,
+ u8 set_tx)
{
u8 alg;
@@ -1397,21 +1361,18 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter)
return;
/* parsing ERP_IE */
- p = rtw_get_ie(
- ie + _BEACON_IE_OFFSET_,
- WLAN_EID_ERP_INFO,
- &len,
- (pnetwork->ie_length - _BEACON_IE_OFFSET_)
- );
+ p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
+ WLAN_EID_ERP_INFO,
+ &len,
+ (pnetwork->ie_length - _BEACON_IE_OFFSET_));
if (p && len > 0) {
struct ndis_80211_var_ie *pIE = (struct ndis_80211_var_ie *)p;
if (pmlmepriv->num_sta_non_erp == 1)
pIE->data[0] |= RTW_ERP_INFO_NON_ERP_PRESENT | RTW_ERP_INFO_USE_PROTECTION;
else
- pIE->data[0] &= ~(
- RTW_ERP_INFO_NON_ERP_PRESENT | RTW_ERP_INFO_USE_PROTECTION
- );
+ pIE->data[0] &= ~(RTW_ERP_INFO_NON_ERP_PRESENT |
+ RTW_ERP_INFO_USE_PROTECTION);
if (pmlmepriv->num_sta_no_short_preamble > 0)
pIE->data[0] |= RTW_ERP_INFO_BARKER_PREAMBLE_MODE;
@@ -1457,12 +1418,10 @@ static void update_bcn_wps_ie(struct adapter *padapter)
unsigned char *ie = pnetwork->ies;
u32 ielen = pnetwork->ie_length;
- pwps_ie = rtw_get_wps_ie(
- ie + _FIXED_IE_LENGTH_,
- ielen - _FIXED_IE_LENGTH_,
- NULL,
- &wps_ielen
- );
+ pwps_ie = rtw_get_wps_ie(ie + _FIXED_IE_LENGTH_,
+ ielen - _FIXED_IE_LENGTH_,
+ NULL,
+ &wps_ielen);
if (!pwps_ie || wps_ielen == 0)
return;
@@ -1647,9 +1606,9 @@ static int rtw_ht_operation_update(struct adapter *padapter)
if (pmlmepriv->num_sta_no_ht ||
(pmlmepriv->ht_op_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT))
new_op_mode = IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED;
- else if (
- (le16_to_cpu(phtpriv_ap->ht_cap.cap_info) & IEEE80211_HT_CAP_SUP_WIDTH)
- && pmlmepriv->num_sta_ht_20mhz)
+ else if ((le16_to_cpu(phtpriv_ap->ht_cap.cap_info) &
+ IEEE80211_HT_CAP_SUP_WIDTH) &&
+ pmlmepriv->num_sta_ht_20mhz)
new_op_mode = IEEE80211_HT_OP_MODE_PROTECTION_20MHZ;
else if (pmlmepriv->olbc_ht)
new_op_mode = IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER;
@@ -1870,12 +1829,10 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
return beacon_updated;
}
-u8 ap_free_sta(
- struct adapter *padapter,
- struct sta_info *psta,
- bool active,
- u16 reason
-)
+u8 ap_free_sta(struct adapter *padapter,
+ struct sta_info *psta,
+ bool active,
+ u16 reason)
{
u8 beacon_updated = false;
@@ -2004,25 +1961,21 @@ void rtw_ap_restore_network(struct adapter *padapter)
rtw_setopmode_cmd(padapter, Ndis802_11APMode, false);
- set_channel_bwmode(
- padapter,
- pmlmeext->cur_channel,
- pmlmeext->cur_ch_offset,
- pmlmeext->cur_bwmode
- );
+ set_channel_bwmode(padapter,
+ pmlmeext->cur_channel,
+ pmlmeext->cur_ch_offset,
+ pmlmeext->cur_bwmode);
start_bss_network(padapter);
if ((padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_) ||
(padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)) {
/* restore group key, WEP keys is restored in ips_leave() */
- rtw_set_key(
- padapter,
- psecuritypriv,
- psecuritypriv->dot118021XGrpKeyid,
- 0,
- false
- );
+ rtw_set_key(padapter,
+ psecuritypriv,
+ psecuritypriv->dot118021XGrpKeyid,
+ 0,
+ false);
}
spin_lock_bh(&pstapriv->asoc_list_lock);
@@ -2123,11 +2076,9 @@ void stop_ap_mode(struct adapter *padapter)
pmlmeext->bstart_bss = false;
/* reset and init security priv , this can refine with rtw_reset_securitypriv */
- memset(
- (unsigned char *)&padapter->securitypriv,
- 0,
- sizeof(struct security_priv)
- );
+ memset((unsigned char *)&padapter->securitypriv,
+ 0,
+ sizeof(struct security_priv));
padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen;
padapter->securitypriv.ndisencryptstatus = Ndis802_11WEPDisabled;