2020-12-08 04:13:07

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 00/21] replace unique macros and ELEMENT_ID

This patch set replaces many macros and the ELEMENT_ID enum with the
ieee80211_eid enum from linux/ieee80211.h. In several cases more than
one macro or constant is replaced by one constant. As suggested, each
constant replacement is separated into a distinct patch.

Changes in v2:
- Single patch divided into per-constant replacement patches

v1 can be found here:
https://lore.kernel.org/driverdev-devel/[email protected]/

Ross Schmidt (21):
staging: rtl8723bs: use WLAN_EID_HT_CAPABILITY
staging: rtl8723bs: use WLAN_EID_VENDOR_SPECIFIC
staging: rtl8723bs: use WLAN_EID_RSN
staging: rtl8723bs: use WLAN_EID_HT_OPERATION
staging: rtl8723bs: replace WLAN_EID_VHT_OP_MODE_NOTIFY
staging: rtl8723bs: replace _SSID_IE_
staging: rtl8723bs: replace _SUPPORTEDRATES_IE_
staging: rtl8723bs: replace _DSSET_IE_
staging: rtl8723bs: replace _TIM_IE_
staging: rtl8723bs: replace _IBSS_PARA_IE_
staging: rtl8723bs: replace _COUNTRY_IE_
staging: rtl8723bs: replace _CHLGETXT_IE_
staging: rtl8723bs: replace _ERPINFO_IE_
staging: rtl8723bs: replace _EXT_SUPPORTEDRATES_IE_
staging: rtl8723bs: replace _WAPI_IE_
staging: rtl8723bs: replace _MME_IE_
staging: rtl8723bs: replace EID_BSSCoexistence
staging: rtl8723bs: replace EID_BSSIntolerantChlReport
staging: rtl8723bs: replace EID_EXTCapability
staging: rtl8723bs: remove unused macros
staging: rtl8723bs: remove ELEMENT_ID enum

drivers/staging/rtl8723bs/core/rtw_ap.c | 62 ++++----
drivers/staging/rtl8723bs/core/rtw_cmd.c | 4 +-
.../staging/rtl8723bs/core/rtw_ieee80211.c | 44 +++---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 26 ++--
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 146 +++++++++---------
drivers/staging/rtl8723bs/core/rtw_recv.c | 4 +-
drivers/staging/rtl8723bs/core/rtw_security.c | 2 +-
.../staging/rtl8723bs/core/rtw_wlan_util.c | 26 ++--
drivers/staging/rtl8723bs/core/rtw_xmit.c | 12 +-
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 20 +--
drivers/staging/rtl8723bs/include/ieee80211.h | 8 -
.../staging/rtl8723bs/include/rtw_security.h | 3 -
drivers/staging/rtl8723bs/include/wifi.h | 108 -------------
.../staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 +-
.../staging/rtl8723bs/os_dep/ioctl_linux.c | 14 +-
drivers/staging/rtl8723bs/os_dep/mlme_linux.c | 2 +-
16 files changed, 183 insertions(+), 302 deletions(-)

--
2.25.1


2020-12-08 04:13:12

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 03/21] staging: rtl8723bs: use WLAN_EID_RSN

Replace unique _WPA2_IE_ID_, EID_WPA2, and _RSN_IE_2_ with kernel provided
WLAN_EID_RSN from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 6 +++---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 8 ++++----
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
drivers/staging/rtl8723bs/include/rtw_security.h | 2 --
drivers/staging/rtl8723bs/include/wifi.h | 1 -
7 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index c8953b442734..7cab9889140e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1080,7 +1080,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _RSN_IE_2_,
+ WLAN_EID_RSN,
&ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_)
);
@@ -1780,7 +1780,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)

break;

- case _RSN_IE_2_:
+ case WLAN_EID_RSN:

update_bcn_rsn_ie(padapter);

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 86a5114d1241..4ab34d71b09b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -424,7 +424,7 @@ unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit)

unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit)
{
- return rtw_get_ie(pie, _WPA2_IE_ID_, rsn_ie_len, limit);
+ return rtw_get_ie(pie, WLAN_EID_RSN, rsn_ie_len, limit);
}

int rtw_get_wpa_cipher_suite(u8 *s)
@@ -544,7 +544,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int *group_cipher, int *pairwi
return _FAIL;
}

- if ((*rsn_ie != _WPA2_IE_ID_) || (*(rsn_ie+1) != (u8)(rsn_ie_len - 2))) {
+ if ((*rsn_ie != WLAN_EID_RSN) || (*(rsn_ie+1) != (u8)(rsn_ie_len - 2))) {
return _FAIL;
}

@@ -683,7 +683,7 @@ void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 *wpa_ie
*wpa_len = in_ie[cnt+1]+2;
cnt += in_ie[cnt+1]+2; /* get next */
} else {
- if (authmode == _WPA2_IE_ID_) {
+ if (authmode == WLAN_EID_RSN) {
RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_, ("\n get_rsn_ie: sec_idx =%d in_ie[cnt+1]+2 =%d\n", sec_idx, in_ie[cnt+1]+2));

if (rsn_ie) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 50129a3e67e0..1d4e565a314b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -736,7 +736,7 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
bselected = false;

if (psecuritypriv->ndisauthtype == Ndis802_11AuthModeWPA2PSK) {
- p = rtw_get_ie(pnetwork->network.IEs + _BEACON_IE_OFFSET_, _RSN_IE_2_, &ie_len, (pnetwork->network.IELength - _BEACON_IE_OFFSET_));
+ p = rtw_get_ie(pnetwork->network.IEs + _BEACON_IE_OFFSET_, WLAN_EID_RSN, &ie_len, (pnetwork->network.IELength - _BEACON_IE_OFFSET_));
if (p && ie_len > 0)
bselected = true;
else
@@ -2361,13 +2361,13 @@ sint rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in
if ((ndisauthmode == Ndis802_11AuthModeWPA) || (ndisauthmode == Ndis802_11AuthModeWPAPSK))
authmode = WLAN_EID_VENDOR_SPECIFIC;
if ((ndisauthmode == Ndis802_11AuthModeWPA2) || (ndisauthmode == Ndis802_11AuthModeWPA2PSK))
- authmode = _WPA2_IE_ID_;
+ authmode = WLAN_EID_RSN;

if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
memcpy(out_ie+ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len);

ielength += psecuritypriv->wps_ie_len;
- } else if ((authmode == WLAN_EID_VENDOR_SPECIFIC) || (authmode == _WPA2_IE_ID_)) {
+ } else if ((authmode == WLAN_EID_VENDOR_SPECIFIC) || (authmode == WLAN_EID_RSN)) {
/* copy RSN or SSN */
memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1]+2);
/* debug for CONFIG_IEEE80211W
@@ -2386,7 +2386,7 @@ sint rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in
if (iEntry < 0) {
return ielength;
} else {
- if (authmode == _WPA2_IE_ID_)
+ if (authmode == WLAN_EID_RSN)
ielength = rtw_append_pmkid(adapter, iEntry, out_ie, ielength);
}
return ielength;
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 11e176f29b4b..1fa0be4dbfd5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -3369,8 +3369,8 @@ void issue_assocreq(struct adapter *padapter)
}
break;

- case EID_WPA2:
- pframe = rtw_set_ie(pframe, EID_WPA2, pIE->Length, pIE->data, &(pattrib->pktlen));
+ case WLAN_EID_RSN:
+ pframe = rtw_set_ie(pframe, WLAN_EID_RSN, pIE->Length, pIE->data, &(pattrib->pktlen));
break;
case WLAN_EID_HT_CAPABILITY:
if (padapter->mlmepriv.htpriv.ht_option) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 92c4ef01b070..c0e435ba2730 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1511,7 +1511,7 @@ unsigned int is_ap_in_tkip(struct adapter *padapter)

break;

- case _RSN_IE_2_:
+ case WLAN_EID_RSN:
if (!memcmp((pIE->data + 8), RSN_TKIP_CIPHER, 4))
return true;
break;
diff --git a/drivers/staging/rtl8723bs/include/rtw_security.h b/drivers/staging/rtl8723bs/include/rtw_security.h
index 67ba62b54b10..85ffd4ec4ce5 100644
--- a/drivers/staging/rtl8723bs/include/rtw_security.h
+++ b/drivers/staging/rtl8723bs/include/rtw_security.h
@@ -21,8 +21,6 @@

const char *security_type_str(u8 value);

-#define _WPA2_IE_ID_ 0x30
-
#define SHA256_MAC_LEN 32
#define AES_BLOCK_SIZE 16
#define AES_PRIV_SIZE (4 * 44)
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index f7d8d0ec827c..5a8c594008aa 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -396,7 +396,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
#define _CHLGETXT_IE_ 16
#define _SUPPORTED_CH_IE_ 36
#define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
-#define _RSN_IE_2_ 48
#define _ERPINFO_IE_ 42
#define _EXT_SUPPORTEDRATES_IE_ 50

--
2.25.1

2020-12-08 04:13:34

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 06/21] staging: rtl8723bs: replace _SSID_IE_

Replace unique _SSID_IE_ macro with kernel provided WLAN_EID_SSID from
linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
.../staging/rtl8723bs/core/rtw_ieee80211.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 20 +++++++++----------
.../staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 6 +++---
drivers/staging/rtl8723bs/include/wifi.h | 1 -
6 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index e44c01de3b10..aaa7edbebe2c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -100,7 +100,7 @@ static void update_BCNTIM(struct adapter *padapter)
/* get ssid_ie len */
p = rtw_get_ie(
pie + _BEACON_IE_OFFSET_,
- _SSID_IE_,
+ WLAN_EID_SSID,
&tmp_len,
(pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)
);
@@ -1004,7 +1004,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* SSID */
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _SSID_IE_,
+ WLAN_EID_SSID,
&ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_)
);
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 182cc8c0b7d3..daaa826add35 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -326,7 +326,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
ie += 2;

/* SSID */
- ie = rtw_set_ie(ie, _SSID_IE_, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_SSID, pdev_network->Ssid.SsidLength, pdev_network->Ssid.Ssid, &sz);

/* supported rates */
if (pregistrypriv->wireless_mode == WIRELESS_11ABGN) {
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index b829264b8aff..983fcaae6eca 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -728,7 +728,7 @@ unsigned int OnProbeReq(struct adapter *padapter, union recv_frame *precv_frame)

#endif /* CONFIG_AUTO_AP_MODE */

- p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, _SSID_IE_, (int *)&ielen,
+ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _PROBEREQ_IE_OFFSET_, WLAN_EID_SSID, (int *)&ielen,
len - WLAN_HDR_A3_LEN - _PROBEREQ_IE_OFFSET_);


@@ -1251,7 +1251,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)

/* now we should check all the fields... */
/* checking SSID */
- p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SSID_IE_, &ie_len,
+ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, WLAN_EID_SSID, &ie_len,
pkt_len - WLAN_HDR_A3_LEN - ie_offset);

if (!p || ie_len == 0) {
@@ -2536,7 +2536,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)
pattrib->pktlen += 2;

/* SSID */
- pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SSID, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);

/* supported rates... */
rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
@@ -2692,7 +2692,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
u8 buf[MAX_IE_SZ];
u8 *ies = pmgntframe->buf_addr+TXDESC_OFFSET+sizeof(struct ieee80211_hdr_3addr);

- ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, _SSID_IE_, &ssid_ielen,
+ ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, WLAN_EID_SSID, &ssid_ielen,
(pframe-ies)-_FIXED_IE_LENGTH_);

ssid_ielen_diff = cur_network->Ssid.SsidLength - ssid_ielen;
@@ -2740,7 +2740,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
/* below for ad-hoc mode */

/* SSID */
- pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SSID, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pattrib->pktlen);

/* supported rates... */
rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
@@ -2870,9 +2870,9 @@ static int _issue_probereq(struct adapter *padapter,
pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr);

if (pssid)
- pframe = rtw_set_ie(pframe, _SSID_IE_, pssid->SsidLength, pssid->Ssid, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SSID, pssid->SsidLength, pssid->Ssid, &(pattrib->pktlen));
else
- pframe = rtw_set_ie(pframe, _SSID_IE_, 0, NULL, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SSID, 0, NULL, &(pattrib->pktlen));

get_rate_set(padapter, bssrate, &bssrate_len);

@@ -3280,7 +3280,7 @@ void issue_assocreq(struct adapter *padapter)
pattrib->pktlen += 2;

/* SSID */
- pframe = rtw_set_ie(pframe, _SSID_IE_, pmlmeinfo->network.Ssid.SsidLength, pmlmeinfo->network.Ssid.Ssid, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SSID, pmlmeinfo->network.Ssid.SsidLength, pmlmeinfo->network.Ssid.Ssid, &(pattrib->pktlen));

/* supported rate & extended supported rate */

@@ -4464,7 +4464,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
bssid->PhyInfo.SignalStrength = precv_frame->u.hdr.attrib.phy_info.SignalStrength;/* in percentage */

/* checking SSID */
- p = rtw_get_ie(bssid->IEs + ie_offset, _SSID_IE_, &len, bssid->IELength - ie_offset);
+ p = rtw_get_ie(bssid->IEs + ie_offset, WLAN_EID_SSID, &len, bssid->IELength - ie_offset);
if (p == NULL) {
DBG_871X("marc: cannot find SSID for survey event\n");
return _FAIL;
@@ -5959,7 +5959,7 @@ static int rtw_auto_ap_start_beacon(struct adapter *adapter)
ie += 2;

/* SSID */
- ie = rtw_set_ie(ie, _SSID_IE_, ssid_len, ssid, &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_SSID, ssid_len, ssid, &sz);

/* supported rates */
wireless_mode = WIRELESS_11BG_24N;
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 94e4f82610ac..a8a743cffaa8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1341,7 +1341,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)

/* checking SSID */
ssid_len = 0;
- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _SSID_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_SSID, &len, bssid->IELength - _FIXED_IE_LENGTH_);
if (p) {
ssid_len = *(p + 1);
if (ssid_len > NDIS_802_11_LENGTH_SSID)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
index 56fea55513ba..49cf6c2c66d3 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
@@ -175,7 +175,7 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength)
/* below for ad-hoc mode */

/* SSID */
- pframe = rtw_set_ie(pframe, _SSID_IE_, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SSID, cur_network->Ssid.SsidLength, cur_network->Ssid.Ssid, &pktlen);

/* supported rates... */
rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
@@ -695,7 +695,7 @@ static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength
pktlen = sizeof(struct ieee80211_hdr_3addr);
pframe += pktlen;

- pframe = rtw_set_ie(pframe, _SSID_IE_, 0, NULL, &pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SSID, 0, NULL, &pktlen);

get_rate_set(padapter, bssrate, &bssrate_len);

@@ -793,7 +793,7 @@ static void ConstructProbeRsp(struct adapter *padapter, u8 *pframe, u32 *pLength
u8 buf[MAX_IE_SZ];
u8 *ies = pframe + sizeof(struct ieee80211_hdr_3addr);

- ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, _SSID_IE_, &ssid_ielen,
+ ssid_ie = rtw_get_ie(ies+_FIXED_IE_LENGTH_, WLAN_EID_SSID, &ssid_ielen,
(pframe-ies)-_FIXED_IE_LENGTH_);

ssid_ielen_diff = cur_network->Ssid.SsidLength - ssid_ielen;
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 18325583e624..7dee4a64da8e 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -387,7 +387,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_

-#define _SSID_IE_ 0
#define _SUPPORTEDRATES_IE_ 1
#define _DSSET_IE_ 3
#define _TIM_IE_ 5
--
2.25.1

2020-12-08 04:13:39

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 09/21] staging: rtl8723bs: replace _TIM_IE_

Replace unique _TIM_IE_ macro with kernel provided WLAN_EID_DS_PARAMS
from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 10 +++++-----
drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_recv.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_xmit.c | 8 ++++----
drivers/staging/rtl8723bs/include/wifi.h | 1 -
5 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 1514975f23bc..139350288d1b 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -76,7 +76,7 @@ static void update_BCNTIM(struct adapter *padapter)

p = rtw_get_ie(
pie + _FIXED_IE_LENGTH_,
- _TIM_IE_,
+ WLAN_EID_TIM,
&tim_ielen,
pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_
);
@@ -133,7 +133,7 @@ static void update_BCNTIM(struct adapter *padapter)
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
}

- *dst_ie++ = _TIM_IE_;
+ *dst_ie++ = WLAN_EID_TIM;

if ((pstapriv->tim_bitmap & 0xff00) && (pstapriv->tim_bitmap & 0x00fe))
tim_ielen = 5;
@@ -301,7 +301,7 @@ void expire_timeout_chk(struct adapter *padapter)

/* to update bcn with tim_bitmap for this station */
pstapriv->tim_bitmap |= BIT(psta->aid);
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);

if (!pmlmeext->active_keep_alive_check)
continue;
@@ -922,7 +922,7 @@ void start_bss_network(struct adapter *padapter, u8 *pbuf)
);

if (pmlmeext->bstart_bss) {
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);

#ifndef CONFIG_INTERRUPT_BASED_TXBCN /* other case will tx beacon when bcn interrupt coming in. */
/* issue beacon frame */
@@ -1762,7 +1762,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)

break;

- case _TIM_IE_:
+ case WLAN_EID_TIM:

update_BCNTIM(padapter);

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index 1d0a7690acde..3fe79169a811 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1703,7 +1703,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
pstapriv->sta_dz_bitmap &= ~BIT(0);

if (update_tim)
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);
} else {/* re check again */
rtw_chk_hi_queue_cmd(padapter);
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_recv.c b/drivers/staging/rtl8723bs/core/rtw_recv.c
index 2bb501f2113c..3c9dbd7443d9 100644
--- a/drivers/staging/rtl8723bs/core/rtw_recv.c
+++ b/drivers/staging/rtl8723bs/core/rtw_recv.c
@@ -1158,7 +1158,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_

/* update BCN for TIM IE */
/* update_BCNTIM(padapter); */
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);
}

/* spin_unlock_bh(&psta->sleep_q.lock); */
@@ -1184,7 +1184,7 @@ sint validate_recv_ctrl_frame(struct adapter *padapter, union recv_frame *precv_

/* update BCN for TIM IE */
/* update_BCNTIM(padapter); */
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);
}
}
}
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index f9ef7dc84e55..1d62ce501e80 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -2251,7 +2251,7 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr
pstapriv->sta_dz_bitmap |= BIT(0);

if (update_tim)
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);
else
chk_bmc_sleepq_cmd(padapter);

@@ -2308,7 +2308,7 @@ sint xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct xmit_fr

if (update_tim)
/* update BCN for TIM IE */
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);
}

ret = true;
@@ -2516,7 +2516,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)
spin_unlock_bh(&pxmitpriv->lock);

if (update_mask)
- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);
}

void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *psta)
@@ -2579,7 +2579,7 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst
if ((psta->sleepq_ac_len == 0) && (!psta->has_legacy_ac) && (wmmps_ac)) {
pstapriv->tim_bitmap &= ~BIT(psta->aid);

- update_beacon(padapter, _TIM_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_TIM, NULL, true);
}
}

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index b29762bfb3c1..dc11ba28d469 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -387,7 +387,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_

-#define _TIM_IE_ 5
#define _IBSS_PARA_IE_ 6
#define _COUNTRY_IE_ 7
#define _CHLGETXT_IE_ 16
--
2.25.1

2020-12-08 04:13:47

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 15/21] staging: rtl8723bs: replace _WAPI_IE_

Replace unique _WAPI_IE_ macro with kernel provided
WLAN_EID_BSS_AC_ACCESS_DELAY from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
drivers/staging/rtl8723bs/include/wifi.h | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 28d5892d8bda..be4cffce4f5d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -623,8 +623,8 @@ int rtw_get_wapi_ie(u8 *in_ie, uint in_len, u8 *wapi_ie, u16 *wapi_len)
while (cnt < in_len) {
authmode = in_ie[cnt];

- /* if (authmode == _WAPI_IE_) */
- if (authmode == _WAPI_IE_ && (!memcmp(&in_ie[cnt+6], wapi_oui1, 4) ||
+ /* if (authmode == WLAN_EID_BSS_AC_ACCESS_DELAY) */
+ if (authmode == WLAN_EID_BSS_AC_ACCESS_DELAY && (!memcmp(&in_ie[cnt+6], wapi_oui1, 4) ||
!memcmp(&in_ie[cnt+6], wapi_oui2, 4))) {
if (wapi_ie) {
memcpy(wapi_ie, &in_ie[cnt], in_ie[cnt+1]+2);
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index e221d4574f32..29621fce6a83 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -393,7 +393,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
#define _FTIE_ 55
#define _TIMEOUT_ITVL_IE_ 56
#define _SRC_IE_ 59
-#define _WAPI_IE_ 68

#define _RIC_Descriptor_IE_ 75
#define _MME_IE_ 76 /* 802.11w Management MIC element */
--
2.25.1

2020-12-08 04:14:02

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 05/21] staging: rtl8723bs: replace WLAN_EID_VHT_OP_MODE_NOTIFY

Replace unique WLAN_EID_VHT_OP_MODE_NOFITY macro with kernel provided
WLAN_EID_OPMODE_NOTIF from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 2 +-
drivers/staging/rtl8723bs/include/ieee80211.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index ff4f493e8dcd..182cc8c0b7d3 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1072,7 +1072,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
elems->vht_operation = pos;
elems->vht_operation_len = elen;
break;
- case WLAN_EID_VHT_OP_MODE_NOTIFY:
+ case WLAN_EID_OPMODE_NOTIF:
elems->vht_op_mode_notify = pos;
elems->vht_op_mode_notify_len = elen;
break;
diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
index 880d3f0a32fa..20c53c290aa1 100644
--- a/drivers/staging/rtl8723bs/include/ieee80211.h
+++ b/drivers/staging/rtl8723bs/include/ieee80211.h
@@ -352,7 +352,6 @@ struct ieee80211_snap_hdr {
#define WLAN_EID_20_40_BSS_COEXISTENCE 72
#define WLAN_EID_20_40_BSS_INTOLERANT 73
#define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
-#define WLAN_EID_VHT_OP_MODE_NOTIFY 199

#define IEEE80211_MGMT_HDR_LEN 24
#define IEEE80211_DATA_HDR3_LEN 24
--
2.25.1

2020-12-08 04:14:09

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 17/21] staging: rtl8723bs: replace EID_BSSCoexistence

Replace unique EID_BSSCoexistence constant with kernel provided
WLAN_EID_BSS_COEX_2040 from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index e9b14fc8b10f..b6e255f6cdc5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4096,7 +4096,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)

iedata |= BIT(2);/* 20 MHz BSS Width Request */

- pframe = rtw_set_ie(pframe, EID_BSSCoexistence, 1, &iedata, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_BSS_COEX_2040, 1, &iedata, &(pattrib->pktlen));

}

--
2.25.1

2020-12-08 04:14:14

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 04/21] staging: rtl8723bs: use WLAN_EID_HT_OPERATION

Replace unique _HT_EXTRA_INFO_IE_ and _HT_ADD_INFO_IE_ macros with kernel
provided WLAN_EID_HT_OPERATION from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 10 +++++-----
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_mlme.c | 8 ++++----
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 ++++----
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 6 +++---
drivers/staging/rtl8723bs/include/wifi.h | 2 --
6 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 7cab9889140e..e44c01de3b10 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -855,7 +855,7 @@ void start_bss_network(struct adapter *padapter, u8 *pbuf)
/* set channel, bwmode */
p = rtw_get_ie(
(pnetwork->IEs + sizeof(struct ndis_802_11_fix_ie)),
- _HT_ADD_INFO_IE_,
+ WLAN_EID_HT_OPERATION,
&ie_len,
(pnetwork->IELength - sizeof(struct ndis_802_11_fix_ie))
);
@@ -1235,7 +1235,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* parsing HT_INFO_IE */
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _HT_ADD_INFO_IE_,
+ WLAN_EID_HT_OPERATION,
&ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_)
);
@@ -1786,7 +1786,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)

break;

- case _HT_ADD_INFO_IE_:
+ case WLAN_EID_HT_OPERATION:

update_bcn_htinfo_ie(padapter);

@@ -2053,7 +2053,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)

if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, WLAN_EID_HT_CAPABILITY, NULL, false);
- update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_HT_OPERATION, NULL, true);
}

/* update associated stations cap. */
@@ -2117,7 +2117,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)

if (rtw_ht_operation_update(padapter) > 0) {
update_beacon(padapter, WLAN_EID_HT_CAPABILITY, NULL, false);
- update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_HT_OPERATION, NULL, true);
}

/* update associated stations cap. */
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index 4ab34d71b09b..ff4f493e8dcd 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1217,7 +1217,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork)
pnetwork->BcnInfo.ht_cap_info = 0;
}
/* parsing HT_INFO_IE */
- p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_);
+ p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, WLAN_EID_HT_OPERATION, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_);
if (p && len > 0) {
pht_info = (struct HT_info_element *)(p + 2);
pnetwork->BcnInfo.ht_info_infos_0 = pht_info->infos[0];
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 1d4e565a314b..d05338015744 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -2616,7 +2616,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
/* TDLS: TODO 40? */
operation_bw = CHANNEL_WIDTH_40;
} else {
- p = rtw_get_ie(in_ie, _HT_ADD_INFO_IE_, &ielen, in_len);
+ p = rtw_get_ie(in_ie, WLAN_EID_HT_OPERATION, &ielen, in_len);
if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) {
struct HT_info_element *pht_info = (struct HT_info_element *)(p+2);

@@ -2724,10 +2724,10 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
phtpriv->ht_option = true;

if (in_ie) {
- p = rtw_get_ie(in_ie, _HT_ADD_INFO_IE_, &ielen, in_len);
+ p = rtw_get_ie(in_ie, WLAN_EID_HT_OPERATION, &ielen, in_len);
if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) {
out_len = *pout_len;
- pframe = rtw_set_ie(out_ie+out_len, _HT_ADD_INFO_IE_, ielen, p+2, pout_len);
+ pframe = rtw_set_ie(out_ie+out_len, WLAN_EID_HT_OPERATION, ielen, p+2, pout_len);
}
}

@@ -2780,7 +2780,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe
}

len = 0;
- p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), _HT_ADD_INFO_IE_, &len, ie_len-sizeof(struct ndis_802_11_fix_ie));
+ p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_OPERATION, &len, ie_len-sizeof(struct ndis_802_11_fix_ie));
if (p && len > 0) {
pht_addtinfo = (struct ieee80211_ht_addt_info *)(p+2);
/* todo: */
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 1fa0be4dbfd5..b829264b8aff 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1701,7 +1701,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame)
HT_caps_handler(padapter, pIE);
break;

- case _HT_EXTRA_INFO_IE_: /* HT info */
+ case WLAN_EID_HT_OPERATION: /* HT info */
HT_info_handler(padapter, pIE);
break;

@@ -3173,7 +3173,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i

/* FILL HT ADD INFO IE */
/* p = hostapd_eid_ht_operation(hapd, p); */
- pbuf = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_ADD_INFO_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
+ pbuf = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_HT_OPERATION, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
if (pbuf && ie_len > 0) {
memcpy(pframe, pbuf, ie_len+2);
pframe += (ie_len+2);
@@ -4519,7 +4519,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
} else {
/* In 5G, some ap do not have DSSET IE */
/* checking HT info for channel */
- p = rtw_get_ie(bssid->IEs + ie_offset, _HT_ADD_INFO_IE_, &len, bssid->IELength - ie_offset);
+ p = rtw_get_ie(bssid->IEs + ie_offset, WLAN_EID_HT_OPERATION, &len, bssid->IELength - ie_offset);
if (p) {
struct HT_info_element *HT_info = (struct HT_info_element *)(p + 2);

@@ -6182,7 +6182,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf)
pmlmeinfo->HT_caps_enable = 1;
break;

- case _HT_EXTRA_INFO_IE_: /* Get HT Info IE. */
+ case WLAN_EID_HT_OPERATION: /* Get HT Info IE. */
pmlmeinfo->HT_info_enable = 1;

/* spec case only for cisco's ap because cisco's ap issue assoc rsp using mcs rate @40MHz or @20MHz */
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index c0e435ba2730..94e4f82610ac 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1297,7 +1297,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
ht_cap_info = 0;
}
/* parsing HT_INFO_IE */
- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_HT_OPERATION, &len, bssid->IELength - _FIXED_IE_LENGTH_);
if (p && len > 0) {
pht_info = (struct HT_info_element *)(p + 2);
ht_info_infos_0 = pht_info->infos[0];
@@ -1325,7 +1325,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
if (p) {
bcn_channel = *(p + 2);
} else {/* In 5G, some ap do not have DSSET IE checking HT info for channel */
- rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_ADD_INFO_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_HT_OPERATION, &len, bssid->IELength - _FIXED_IE_LENGTH_);
if (pht_info) {
bcn_channel = pht_info->primary_channel;
} else { /* we don't find channel IE, so don't check it */
@@ -1474,7 +1474,7 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru

break;

- case _HT_EXTRA_INFO_IE_: /* HT info */
+ case WLAN_EID_HT_OPERATION: /* HT info */
/* HT_info_handler(padapter, pIE); */
bwmode_update_check(padapter, pIE);
break;
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 5a8c594008aa..18325583e624 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -402,8 +402,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
#define _FTIE_ 55
#define _TIMEOUT_ITVL_IE_ 56
#define _SRC_IE_ 59
-#define _HT_EXTRA_INFO_IE_ 61
-#define _HT_ADD_INFO_IE_ 61 /* _HT_EXTRA_INFO_IE_ */
#define _WAPI_IE_ 68

#define _RIC_Descriptor_IE_ 75
--
2.25.1

2020-12-08 04:15:31

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 07/21] staging: rtl8723bs: replace _SUPPORTEDRATES_IE_

Replace unique _SUPPORTEDRATES_IE_ macro with kernel provided
WLAN_EID_SUPP_RATES from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 4 ++--
.../staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 24 +++++++++----------
.../staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 6 ++---
drivers/staging/rtl8723bs/include/wifi.h | 1 -
6 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index aaa7edbebe2c..99a34c059f6d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -110,7 +110,7 @@ static void update_BCNTIM(struct adapter *padapter)
/* get supported rates len */
p = rtw_get_ie(
pie + _BEACON_IE_OFFSET_,
- _SUPPORTEDRATES_IE_, &tmp_len,
+ WLAN_EID_SUPP_RATES, &tmp_len,
(pnetwork_mlmeext->IELength - _BEACON_IE_OFFSET_)
);
if (p)
@@ -1031,7 +1031,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* get supported rates */
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _SUPPORTEDRATES_IE_,
+ WLAN_EID_SUPP_RATES,
&ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_)
);
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index daaa826add35..e0896e128dda 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -343,10 +343,10 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
rateLen = rtw_get_rateset_len(pdev_network->SupportedRates);

if (rateLen > 8) {
- ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, 8, pdev_network->SupportedRates, &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, 8, pdev_network->SupportedRates, &sz);
/* ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz); */
} else {
- ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, pdev_network->SupportedRates, &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, rateLen, pdev_network->SupportedRates, &sz);
}

/* DS parameter set */
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 983fcaae6eca..b9e612e1e162 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1271,7 +1271,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
goto OnAssocReqFail;

/* check if the supported rate is ok */
- p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _SUPPORTEDRATES_IE_, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset);
+ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, WLAN_EID_SUPP_RATES, &ie_len, pkt_len - WLAN_HDR_A3_LEN - ie_offset);
if (p == NULL) {
DBG_871X("Rx a sta assoc-req which supported rate is empty!\n");
/* use our own rate set as statoin used */
@@ -2540,7 +2540,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)

/* supported rates... */
rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8) ? 8 : rate_len), cur_network->SupportedRates, &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, ((rate_len > 8) ? 8 : rate_len), cur_network->SupportedRates, &pattrib->pktlen);

/* DS parameter set */
pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen);
@@ -2744,7 +2744,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p

/* supported rates... */
rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8) ? 8 : rate_len), cur_network->SupportedRates, &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, ((rate_len > 8) ? 8 : rate_len), cur_network->SupportedRates, &pattrib->pktlen);

/* DS parameter set */
pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pattrib->pktlen);
@@ -2877,10 +2877,10 @@ static int _issue_probereq(struct adapter *padapter,
get_rate_set(padapter, bssrate, &bssrate_len);

if (bssrate_len > 8) {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, bssrate, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &(pattrib->pktlen));
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
} else {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, bssrate_len, bssrate, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &(pattrib->pktlen));
}

if (ch)
@@ -3153,9 +3153,9 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_, (unsigned char *)&le_tmp, &(pattrib->pktlen));

if (pstat->bssratelen <= 8) {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen));
} else {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, pstat->bssrateset, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, pstat->bssrateset, &(pattrib->pktlen));
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (pstat->bssratelen-8), pstat->bssrateset+8, &(pattrib->pktlen));
}

@@ -3340,10 +3340,10 @@ void issue_assocreq(struct adapter *padapter)


if (bssrate_len > 8) {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, bssrate, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &(pattrib->pktlen));
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
} else
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, bssrate_len, bssrate, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &(pattrib->pktlen));

/* vendor specific IE, such as WPA, WMM, WPS */
for (i = sizeof(struct ndis_802_11_fix_ie); i < pmlmeinfo->network.IELength;) {
@@ -4484,7 +4484,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str

/* checking rate info... */
i = 0;
- p = rtw_get_ie(bssid->IEs + ie_offset, _SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset);
+ p = rtw_get_ie(bssid->IEs + ie_offset, WLAN_EID_SUPP_RATES, &len, bssid->IELength - ie_offset);
if (p) {
if (len > NDIS_802_11_LENGTH_RATES_EX) {
DBG_871X("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len);
@@ -5966,9 +5966,9 @@ static int rtw_auto_ap_start_beacon(struct adapter *adapter)
rtw_set_supported_rate(supportRate, wireless_mode);
rateLen = rtw_get_rateset_len(supportRate);
if (rateLen > 8) {
- ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, 8, supportRate, &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, 8, supportRate, &sz);
} else {
- ie = rtw_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, supportRate, &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, rateLen, supportRate, &sz);
}


diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index a8a743cffaa8..5ad2ed6af593 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1784,7 +1784,7 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);

- pIE = (struct ndis_80211_var_ie *)rtw_get_ie(pvar_ie, _SUPPORTEDRATES_IE_, &ie_len, var_ie_len);
+ pIE = (struct ndis_80211_var_ie *)rtw_get_ie(pvar_ie, WLAN_EID_SUPP_RATES, &ie_len, var_ie_len);
if (!pIE)
return _FAIL;
if (ie_len > sizeof(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates))
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
index 49cf6c2c66d3..c98dd18c316d 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
@@ -179,7 +179,7 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength)

/* supported rates... */
rate_len = rtw_get_rateset_len(cur_network->SupportedRates);
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, ((rate_len > 8) ? 8 : rate_len), cur_network->SupportedRates, &pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, ((rate_len > 8) ? 8 : rate_len), cur_network->SupportedRates, &pktlen);

/* DS parameter set */
pframe = rtw_set_ie(pframe, _DSSET_IE_, 1, (unsigned char *)&(cur_network->Configuration.DSConfig), &pktlen);
@@ -700,10 +700,10 @@ static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength
get_rate_set(padapter, bssrate, &bssrate_len);

if (bssrate_len > 8) {
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, 8, bssrate, &pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &pktlen);
pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (bssrate_len - 8), (bssrate + 8), &pktlen);
} else
- pframe = rtw_set_ie(pframe, _SUPPORTEDRATES_IE_, bssrate_len, bssrate, &pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &pktlen);

*pLength = pktlen;
}
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 7dee4a64da8e..285d6f9b74b6 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -387,7 +387,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_

-#define _SUPPORTEDRATES_IE_ 1
#define _DSSET_IE_ 3
#define _TIM_IE_ 5
#define _IBSS_PARA_IE_ 6
--
2.25.1

2020-12-08 04:15:35

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 13/21] staging: rtl8723bs: replace _ERPINFO_IE_

Replace unique _ERPINFO_IE_ macro with kernel provided WLAN_EID_ERP_INFO
from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 12 ++++++------
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 6 +++---
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_xmit.c | 2 +-
drivers/staging/rtl8723bs/include/wifi.h | 1 -
5 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 139350288d1b..5e93a85cb6ce 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1059,7 +1059,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* parsing ERP_IE */
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _ERPINFO_IE_,
+ WLAN_EID_ERP_INFO,
&ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_)
);
@@ -1585,7 +1585,7 @@ static void update_bcn_erpinfo_ie(struct adapter *padapter)
/* parsing ERP_IE */
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _ERPINFO_IE_,
+ WLAN_EID_ERP_INFO,
&len,
(pnetwork->IELength - _BEACON_IE_OFFSET_)
);
@@ -1768,7 +1768,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)

break;

- case _ERPINFO_IE_:
+ case WLAN_EID_ERP_INFO:

update_bcn_erpinfo_ie(padapter);

@@ -1964,7 +1964,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)

if (pmlmepriv->num_sta_non_erp == 1) {
beacon_updated = true;
- update_beacon(padapter, _ERPINFO_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_ERP_INFO, NULL, true);
}
}
} else {
@@ -1975,7 +1975,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)

if (pmlmepriv->num_sta_non_erp == 0) {
beacon_updated = true;
- update_beacon(padapter, _ERPINFO_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_ERP_INFO, NULL, true);
}
}
}
@@ -2086,7 +2086,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
pmlmepriv->num_sta_non_erp--;
if (pmlmepriv->num_sta_non_erp == 0) {
beacon_updated = true;
- update_beacon(padapter, _ERPINFO_IE_, NULL, true);
+ update_beacon(padapter, WLAN_EID_ERP_INFO, NULL, true);
}
}

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 93380493e8dc..5d56fbf0c1fe 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1705,7 +1705,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame)
HT_info_handler(padapter, pIE);
break;

- case _ERPINFO_IE_:
+ case WLAN_EID_ERP_INFO:
ERP_IE_handler(padapter, pIE);
break;

@@ -2555,7 +2555,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)
pframe = rtw_set_ie(pframe, WLAN_EID_IBSS_PARAMS, 2, (unsigned char *)(&ATIMWindow), &pattrib->pktlen);

/* ERP IE */
- pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_ERP_INFO, 1, &erpinfo, &pattrib->pktlen);
}


@@ -2758,7 +2758,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p
pframe = rtw_set_ie(pframe, WLAN_EID_IBSS_PARAMS, 2, (unsigned char *)(&ATIMWindow), &pattrib->pktlen);

/* ERP IE */
- pframe = rtw_set_ie(pframe, _ERPINFO_IE_, 1, &erpinfo, &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_ERP_INFO, 1, &erpinfo, &pattrib->pktlen);
}


diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index ff5125b33749..e8e91e24c04d 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1479,7 +1479,7 @@ void update_beacon_info(struct adapter *padapter, u8 *pframe, uint pkt_len, stru
bwmode_update_check(padapter, pIE);
break;

- case _ERPINFO_IE_:
+ case WLAN_EID_ERP_INFO:
ERP_IE_handler(padapter, pIE);
VCS_update(padapter, psta);
break;
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 1d62ce501e80..187a2aa77a55 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -1447,7 +1447,7 @@ void rtw_update_protection(struct adapter *padapter, u8 *ie, uint ie_len)

case AUTO_VCS:
default:
- perp = rtw_get_ie(ie, _ERPINFO_IE_, &erp_len, ie_len);
+ perp = rtw_get_ie(ie, WLAN_EID_ERP_INFO, &erp_len, ie_len);
if (!perp) {
pxmitpriv->vcs = NONE_VCS;
} else {
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 2f13bbe38f74..ff8865d1d846 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -389,7 +389,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _SUPPORTED_CH_IE_ 36
#define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
-#define _ERPINFO_IE_ 42
#define _EXT_SUPPORTEDRATES_IE_ 50

#define _FTIE_ 55
--
2.25.1

2020-12-08 04:15:36

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 01/21] staging: rtl8723bs: use WLAN_EID_HT_CAPABILITY

Replace unique WLAN_EID_HT_CAP, _HT_CAPABILITY_IE_, and EID_HTCapability
with kernel provided WLAN_EID_HT_CAPABILITY from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 8 ++++----
drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_mlme.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 14 +++++++-------
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
drivers/staging/rtl8723bs/include/ieee80211.h | 1 -
drivers/staging/rtl8723bs/include/wifi.h | 1 -
drivers/staging/rtl8723bs/os_dep/ioctl_linux.c | 6 +++---
9 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 04d5852d0d3e..87605d425a31 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1172,7 +1172,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* parsing HT_CAP_IE */
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _HT_CAPABILITY_IE_,
+ WLAN_EID_HT_CAPABILITY,
&ie_len,
(pbss_network->IELength - _BEACON_IE_OFFSET_)
);
@@ -1774,7 +1774,7 @@ void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx)

break;

- case _HT_CAPABILITY_IE_:
+ case WLAN_EID_HT_CAPABILITY:

update_bcn_htcap_ie(padapter);

@@ -2052,7 +2052,7 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, struct sta_info *psta)
}

if (rtw_ht_operation_update(padapter) > 0) {
- update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, false);
+ update_beacon(padapter, WLAN_EID_HT_CAPABILITY, NULL, false);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
}

@@ -2116,7 +2116,7 @@ u8 bss_cap_update_on_sta_leave(struct adapter *padapter, struct sta_info *psta)
}

if (rtw_ht_operation_update(padapter) > 0) {
- update_beacon(padapter, _HT_CAPABILITY_IE_, NULL, false);
+ update_beacon(padapter, WLAN_EID_HT_CAPABILITY, NULL, false);
update_beacon(padapter, _HT_ADD_INFO_IE_, NULL, true);
}

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index f6160f1cca43..1d0a7690acde 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -842,7 +842,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
}

phtpriv->ht_option = false;
- ptmp = rtw_get_ie(&pnetwork->network.IEs[12], _HT_CAPABILITY_IE_, &tmp_len, pnetwork->network.IELength-12);
+ ptmp = rtw_get_ie(&pnetwork->network.IEs[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.IELength-12);
if (pregistrypriv->ht_enable && ptmp && tmp_len > 0) {
/* Added by Albert 2010/06/23 */
/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index e80b957f947f..23ba4160ab21 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -1056,7 +1056,7 @@ ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
elems->timeout_int = pos;
elems->timeout_int_len = elen;
break;
- case WLAN_EID_HT_CAP:
+ case WLAN_EID_HT_CAPABILITY:
elems->ht_capabilities = pos;
elems->ht_capabilities_len = elen;
break;
@@ -1209,7 +1209,7 @@ void rtw_get_bcn_info(struct wlan_network *pnetwork)

/* get bwmode and ch_offset */
/* parsing HT_CAP_IE */
- p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_);
+ p = rtw_get_ie(pnetwork->network.IEs + _FIXED_IE_LENGTH_, WLAN_EID_HT_CAPABILITY, &len, pnetwork->network.IELength - _FIXED_IE_LENGTH_);
if (p && len > 0) {
pht_cap = (struct ieee80211_ht_cap *)(p + 2);
pnetwork->BcnInfo.ht_cap_info = le16_to_cpu(pht_cap->cap_info);
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index b1737fbeb33f..f32cf36ea949 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -2718,7 +2718,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
else
ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00);

- pframe = rtw_set_ie(out_ie+out_len, _HT_CAPABILITY_IE_,
+ pframe = rtw_set_ie(out_ie+out_len, WLAN_EID_HT_CAPABILITY,
sizeof(struct ieee80211_ht_cap), (unsigned char *)&ht_capie, pout_len);

phtpriv->ht_option = true;
@@ -2768,7 +2768,7 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe

/* check Max Rx A-MPDU Size */
len = 0;
- p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), _HT_CAPABILITY_IE_, &len, ie_len-sizeof(struct ndis_802_11_fix_ie));
+ p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_CAPABILITY, &len, ie_len-sizeof(struct ndis_802_11_fix_ie));
if (p && len > 0) {
pht_capie = (struct ieee80211_ht_cap *)(p+2);
max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR);
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 632b0f7eeff2..9024aa9f1a92 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1697,7 +1697,7 @@ unsigned int OnAssocRsp(struct adapter *padapter, union recv_frame *precv_frame)
WMM_param_handler(padapter, pIE);
break;

- case _HT_CAPABILITY_IE_: /* HT caps */
+ case WLAN_EID_HT_CAPABILITY: /* HT caps */
HT_caps_handler(padapter, pIE);
break;

@@ -3164,7 +3164,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i

/* FILL HT CAP INFO IE */
/* p = hostapd_eid_ht_capabilities_info(hapd, p); */
- pbuf = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
+ pbuf = rtw_get_ie(ie + _BEACON_IE_OFFSET_, WLAN_EID_HT_CAPABILITY, &ie_len, (pnetwork->IELength - _BEACON_IE_OFFSET_));
if (pbuf && ie_len > 0) {
memcpy(pframe, pbuf, ie_len+2);
pframe += (ie_len+2);
@@ -3372,11 +3372,11 @@ void issue_assocreq(struct adapter *padapter)
case EID_WPA2:
pframe = rtw_set_ie(pframe, EID_WPA2, pIE->Length, pIE->data, &(pattrib->pktlen));
break;
- case EID_HTCapability:
+ case WLAN_EID_HT_CAPABILITY:
if (padapter->mlmepriv.htpriv.ht_option) {
if (!(is_ap_in_tkip(padapter))) {
memcpy(&(pmlmeinfo->HT_caps), pIE->data, sizeof(struct HT_caps_element));
- pframe = rtw_set_ie(pframe, EID_HTCapability, pIE->Length, (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_HT_CAPABILITY, pIE->Length, (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen));
}
}
break;
@@ -4125,7 +4125,7 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter)

pbss_network = (struct wlan_bssid_ex *)&pnetwork->network;

- p = rtw_get_ie(pbss_network->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, pbss_network->IELength - _FIXED_IE_LENGTH_);
+ p = rtw_get_ie(pbss_network->IEs + _FIXED_IE_LENGTH_, WLAN_EID_HT_CAPABILITY, &len, pbss_network->IELength - _FIXED_IE_LENGTH_);
if ((p == NULL) || (len == 0)) {/* non-HT */

if ((pbss_network->Configuration.DSConfig <= 0) || (pbss_network->Configuration.DSConfig > 14))
@@ -4553,7 +4553,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
if ((pregistrypriv->wifi_spec == 1) && (false == pmlmeinfo->bwmode_updated)) {
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;

- p = rtw_get_ie(bssid->IEs + ie_offset, _HT_CAPABILITY_IE_, &len, bssid->IELength - ie_offset);
+ p = rtw_get_ie(bssid->IEs + ie_offset, WLAN_EID_HT_CAPABILITY, &len, bssid->IELength - ie_offset);
if (p && len > 0) {
struct HT_caps_element *pHT_caps;

@@ -6178,7 +6178,7 @@ u8 join_cmd_hdl(struct adapter *padapter, u8 *pbuf)
WMM_param_handler(padapter, pIE);
break;

- case _HT_CAPABILITY_IE_: /* Get HT Cap IE. */
+ case WLAN_EID_HT_CAPABILITY: /* Get HT Cap IE. */
pmlmeinfo->HT_caps_enable = 1;
break;

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 4bc0bea7e969..9659e0db5484 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1289,7 +1289,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)

/* check bw and channel offset */
/* parsing HT_CAP_IE */
- p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _HT_CAPABILITY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ p = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_HT_CAPABILITY, &len, bssid->IELength - _FIXED_IE_LENGTH_);
if (p && len > 0) {
pht_cap = (struct ieee80211_ht_cap *)(p + 2);
ht_cap_info = le16_to_cpu(pht_cap->cap_info);
diff --git a/drivers/staging/rtl8723bs/include/ieee80211.h b/drivers/staging/rtl8723bs/include/ieee80211.h
index 79c410cfadba..7cf32aa7cd88 100644
--- a/drivers/staging/rtl8723bs/include/ieee80211.h
+++ b/drivers/staging/rtl8723bs/include/ieee80211.h
@@ -349,7 +349,6 @@ struct ieee80211_snap_hdr {
#define WLAN_REASON_EXPIRATION_CHK 65535

/* EIDs defined by IEEE 802.11h - END */
-#define WLAN_EID_HT_CAP 45
#define WLAN_EID_20_40_BSS_COEXISTENCE 72
#define WLAN_EID_20_40_BSS_INTOLERANT 73
#define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 41de2605c517..47a828de5227 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -401,7 +401,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
#define _ERPINFO_IE_ 42
#define _EXT_SUPPORTEDRATES_IE_ 50

-#define _HT_CAPABILITY_IE_ 45
#define _FTIE_ 55
#define _TIMEOUT_ITVL_IE_ 56
#define _SRC_IE_ 59
diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
index 1d73df69f737..e81a953d9c9a 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c
@@ -109,9 +109,9 @@ static char *translate_scan(struct adapter *padapter,

/* parsing HT_CAP_IE */
if (pnetwork->network.Reserved[0] == 2) { /* Probe Request */
- p = rtw_get_ie(&pnetwork->network.IEs[0], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength);
+ p = rtw_get_ie(&pnetwork->network.IEs[0], WLAN_EID_HT_CAPABILITY, &ht_ielen, pnetwork->network.IELength);
} else {
- p = rtw_get_ie(&pnetwork->network.IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pnetwork->network.IELength-12);
+ p = rtw_get_ie(&pnetwork->network.IEs[12], WLAN_EID_HT_CAPABILITY, &ht_ielen, pnetwork->network.IELength-12);
}
if (p && ht_ielen > 0) {
struct ieee80211_ht_cap *pht_capie;
@@ -771,7 +771,7 @@ static int rtw_wx_get_name(struct net_device *dev,

if (check_fwstate(pmlmepriv, _FW_LINKED|WIFI_ADHOC_MASTER_STATE) == true) {
/* parsing HT_CAP_IE */
- p = rtw_get_ie(&pcur_bss->IEs[12], _HT_CAPABILITY_IE_, &ht_ielen, pcur_bss->IELength-12);
+ p = rtw_get_ie(&pcur_bss->IEs[12], WLAN_EID_HT_CAPABILITY, &ht_ielen, pcur_bss->IELength-12);
if (p && ht_ielen > 0)
ht_cap = true;

--
2.25.1

2020-12-08 04:15:36

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 12/21] staging: rtl8723bs: replace _CHLGETXT_IE_

Replace unique _CHLGETXT_IE_ macro with kernel provided WLAN_EID_CHALLENGE
from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 8 ++++----
drivers/staging/rtl8723bs/include/wifi.h | 1 -
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 319a99833a49..93380493e8dc 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1028,7 +1028,7 @@ unsigned int OnAuth(struct adapter *padapter, union recv_frame *precv_frame)
/* checking for challenging txt... */
DBG_871X("checking for challenging txt...\n");

- p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&ie_len,
+ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + 4 + _AUTH_IE_OFFSET_, WLAN_EID_CHALLENGE, (int *)&ie_len,
len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_ - 4);

if ((p == NULL) || (ie_len <= 0)) {
@@ -1124,7 +1124,7 @@ unsigned int OnAuthClient(struct adapter *padapter, union recv_frame *precv_fram
if (seq == 2) {
if (pmlmeinfo->auth_algo == dot11AuthAlgrthm_Shared) {
/* legendary shared system */
- p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _AUTH_IE_OFFSET_, _CHLGETXT_IE_, (int *)&len,
+ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + _AUTH_IE_OFFSET_, WLAN_EID_CHALLENGE, (int *)&len,
pkt_len - WLAN_HDR_A3_LEN - _AUTH_IE_OFFSET_);

if (p == NULL) {
@@ -3026,7 +3026,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short

/* added challenging text... */
if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1))
- pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, psta->chg_txt, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_CHALLENGE, 128, psta->chg_txt, &(pattrib->pktlen));

} else {
memcpy(pwlanhdr->addr1, get_my_bssid(&pmlmeinfo->network), ETH_ALEN);
@@ -3066,7 +3066,7 @@ void issue_auth(struct adapter *padapter, struct sta_info *psta, unsigned short

/* then checking to see if sending challenging text... */
if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) {
- pframe = rtw_set_ie(pframe, _CHLGETXT_IE_, 128, pmlmeinfo->chg_txt, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_CHALLENGE, 128, pmlmeinfo->chg_txt, &(pattrib->pktlen));

SetPrivacy(fctrl);

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 6df50468200e..2f13bbe38f74 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -387,7 +387,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_

-#define _CHLGETXT_IE_ 16
#define _SUPPORTED_CH_IE_ 36
#define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
#define _ERPINFO_IE_ 42
--
2.25.1

2020-12-08 04:15:37

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 14/21] staging: rtl8723bs: replace _EXT_SUPPORTEDRATES_IE_

Replace unique _EXT_SUPPORTEDRATES_IE_ macro with kernel provided
WLAN_EID_EXT_SUPP_RATES from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_ap.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_ieee80211.c | 4 ++--
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 18 +++++++++---------
drivers/staging/rtl8723bs/core/rtw_wlan_util.c | 2 +-
drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c | 4 ++--
drivers/staging/rtl8723bs/include/wifi.h | 1 -
6 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
index 5e93a85cb6ce..b6f944b37b08 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ap.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
@@ -1043,7 +1043,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
/* get ext_supported rates */
p = rtw_get_ie(
ie + _BEACON_IE_OFFSET_,
- _EXT_SUPPORTEDRATES_IE_,
+ WLAN_EID_EXT_SUPP_RATES,
&ie_len,
pbss_network->IELength - _BEACON_IE_OFFSET_
);
diff --git a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
index b899f511ff9f..28d5892d8bda 100644
--- a/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723bs/core/rtw_ieee80211.c
@@ -344,7 +344,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)

if (rateLen > 8) {
ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, 8, pdev_network->SupportedRates, &sz);
- /* ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz); */
+ /* ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz); */
} else {
ie = rtw_set_ie(ie, WLAN_EID_SUPP_RATES, rateLen, pdev_network->SupportedRates, &sz);
}
@@ -357,7 +357,7 @@ int rtw_generate_ie(struct registry_priv *pregistrypriv)
ie = rtw_set_ie(ie, WLAN_EID_IBSS_PARAMS, 2, (u8 *)&(pdev_network->Configuration.ATIMWindow), &sz);

if (rateLen > 8) {
- ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8), (pdev_network->SupportedRates + 8), &sz);
}

/* HT Cap. */
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 5d56fbf0c1fe..e9b14fc8b10f 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -783,7 +783,7 @@ unsigned int OnBeacon(struct adapter *padapter, union recv_frame *precv_frame)
u8 *p = NULL;
u32 ielen = 0;

- p = rtw_get_ie(pframe + sizeof(struct ieee80211_hdr_3addr) + _BEACON_IE_OFFSET_, _EXT_SUPPORTEDRATES_IE_, &ielen, precv_frame->u.hdr.len - sizeof(struct ieee80211_hdr_3addr) - _BEACON_IE_OFFSET_);
+ p = rtw_get_ie(pframe + sizeof(struct ieee80211_hdr_3addr) + _BEACON_IE_OFFSET_, WLAN_EID_EXT_SUPP_RATES, &ielen, precv_frame->u.hdr.len - sizeof(struct ieee80211_hdr_3addr) - _BEACON_IE_OFFSET_);
if (p && ielen > 0) {
if ((*(p + 1 + ielen) == 0x2D) && (*(p + 2 + ielen) != 0x2D)) {
/* Invalid value 0x2D is detected in Extended Supported Rates (ESR) IE. Try to fix the IE length to avoid failed Beacon parsing. */
@@ -1284,7 +1284,7 @@ unsigned int OnAssocReq(struct adapter *padapter, union recv_frame *precv_frame)
memcpy(supportRate, p+2, ie_len);
supportRateNum = ie_len;

- p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, _EXT_SUPPORTEDRATES_IE_, &ie_len,
+ p = rtw_get_ie(pframe + WLAN_HDR_A3_LEN + ie_offset, WLAN_EID_EXT_SUPP_RATES, &ie_len,
pkt_len - WLAN_HDR_A3_LEN - ie_offset);
if (p != NULL) {

@@ -2561,7 +2561,7 @@ void issue_beacon(struct adapter *padapter, int timeout_ms)

/* EXTERNDED SUPPORTED RATE */
if (rate_len > 8) {
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
}


@@ -2764,7 +2764,7 @@ void issue_probersp(struct adapter *padapter, unsigned char *da, u8 is_valid_p2p

/* EXTERNDED SUPPORTED RATE */
if (rate_len > 8) {
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (rate_len - 8), (cur_network->SupportedRates + 8), &pattrib->pktlen);
}


@@ -2878,7 +2878,7 @@ static int _issue_probereq(struct adapter *padapter,

if (bssrate_len > 8) {
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &(pattrib->pktlen));
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
} else {
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &(pattrib->pktlen));
}
@@ -3156,7 +3156,7 @@ void issue_asocrsp(struct adapter *padapter, unsigned short status, struct sta_i
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, pstat->bssratelen, pstat->bssrateset, &(pattrib->pktlen));
} else {
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, pstat->bssrateset, &(pattrib->pktlen));
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (pstat->bssratelen-8), pstat->bssrateset+8, &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (pstat->bssratelen-8), pstat->bssrateset+8, &(pattrib->pktlen));
}

if ((pstat->flags & WLAN_STA_HT) && (pmlmepriv->htpriv.ht_option)) {
@@ -3341,7 +3341,7 @@ void issue_assocreq(struct adapter *padapter)

if (bssrate_len > 8) {
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &(pattrib->pktlen));
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
+ pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &(pattrib->pktlen));
} else
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &(pattrib->pktlen));

@@ -4494,7 +4494,7 @@ u8 collect_bss_info(struct adapter *padapter, union recv_frame *precv_frame, str
i = len;
}

- p = rtw_get_ie(bssid->IEs + ie_offset, _EXT_SUPPORTEDRATES_IE_, &len, bssid->IELength - ie_offset);
+ p = rtw_get_ie(bssid->IEs + ie_offset, WLAN_EID_EXT_SUPP_RATES, &len, bssid->IELength - ie_offset);
if (p) {
if (len > (NDIS_802_11_LENGTH_RATES_EX-i)) {
DBG_871X("%s()-%d: IE too long (%d) for survey event\n", __func__, __LINE__, len);
@@ -5986,7 +5986,7 @@ static int rtw_auto_ap_start_beacon(struct adapter *adapter)

/* ext supported rates */
if (rateLen > 8) {
- ie = rtw_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (supportRate + 8), &sz);
+ ie = rtw_set_ie(ie, WLAN_EID_EXT_SUPP_RATES, (rateLen - 8), (supportRate + 8), &sz);
}

DBG_871X("%s, start auto ap beacon sz =%d\n", __func__, sz);
diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index e8e91e24c04d..975f2830e29e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1793,7 +1793,7 @@ int update_sta_support_rate(struct adapter *padapter, u8 *pvar_ie, uint var_ie_l
memcpy(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates, pIE->data, ie_len);
supportRateNum = ie_len;

- pIE = (struct ndis_80211_var_ie *)rtw_get_ie(pvar_ie, _EXT_SUPPORTEDRATES_IE_, &ie_len, var_ie_len);
+ pIE = (struct ndis_80211_var_ie *)rtw_get_ie(pvar_ie, WLAN_EID_EXT_SUPP_RATES, &ie_len, var_ie_len);
if (pIE && (ie_len <= sizeof(pmlmeinfo->FW_sta_info[cam_idx].SupportedRates) - supportRateNum))
memcpy((pmlmeinfo->FW_sta_info[cam_idx].SupportedRates + supportRateNum), pIE->data, ie_len);

diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
index f6073ecef2e2..86f31d98349a 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_cmd.c
@@ -198,7 +198,7 @@ static void ConstructBeacon(struct adapter *padapter, u8 *pframe, u32 *pLength)

/* EXTERNDED SUPPORTED RATE */
if (rate_len > 8)
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (rate_len - 8), (cur_network->SupportedRates + 8), &pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (rate_len - 8), (cur_network->SupportedRates + 8), &pktlen);


/* todo:HT for adhoc */
@@ -701,7 +701,7 @@ static void ConstructProbeReq(struct adapter *padapter, u8 *pframe, u32 *pLength

if (bssrate_len > 8) {
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, 8, bssrate, &pktlen);
- pframe = rtw_set_ie(pframe, _EXT_SUPPORTEDRATES_IE_, (bssrate_len - 8), (bssrate + 8), &pktlen);
+ pframe = rtw_set_ie(pframe, WLAN_EID_EXT_SUPP_RATES, (bssrate_len - 8), (bssrate + 8), &pktlen);
} else
pframe = rtw_set_ie(pframe, WLAN_EID_SUPP_RATES, bssrate_len, bssrate, &pktlen);

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index ff8865d1d846..e221d4574f32 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -389,7 +389,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _SUPPORTED_CH_IE_ 36
#define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
-#define _EXT_SUPPORTEDRATES_IE_ 50

#define _FTIE_ 55
#define _TIMEOUT_ITVL_IE_ 56
--
2.25.1

2020-12-08 04:15:38

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 11/21] staging: rtl8723bs: replace _COUNTRY_IE_

Replace unique _COUNTRY_IE_ macro with kernel provided WLAN_EID_COUNTRY
from linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +-
drivers/staging/rtl8723bs/include/wifi.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index 546e4a31142b..319a99833a49 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -4788,7 +4788,7 @@ static void process_80211d(struct adapter *padapter, struct wlan_bssid_ex *bssid
u8 noc; /* number of channel */
u8 j, k;

- ie = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, _COUNTRY_IE_, &len, bssid->IELength - _FIXED_IE_LENGTH_);
+ ie = rtw_get_ie(bssid->IEs + _FIXED_IE_LENGTH_, WLAN_EID_COUNTRY, &len, bssid->IELength - _FIXED_IE_LENGTH_);
if (!ie)
return;
if (len < 6)
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 3adeb3c23a3c..6df50468200e 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -387,7 +387,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_

-#define _COUNTRY_IE_ 7
#define _CHLGETXT_IE_ 16
#define _SUPPORTED_CH_IE_ 36
#define _CH_SWTICH_ANNOUNCE_ 37 /* Secondary Channel Offset */
--
2.25.1

2020-12-08 04:16:05

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 21/21] staging: rtl8723bs: remove ELEMENT_ID enum

The ELEMENT_ID enum is no longer used, remove it.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/include/wifi.h | 76 ------------------------
1 file changed, 76 deletions(-)

diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 7f482a45705b..fe984fcb66a9 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -387,82 +387,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)

#define _FIXED_IE_LENGTH_ _BEACON_IE_OFFSET_

-enum ELEMENT_ID {
- EID_SsId = 0, /* service set identifier (0:32) */
- EID_SupRates = 1, /* supported rates (1:8) */
- EID_FHParms = 2, /* FH parameter set (5) */
- EID_DSParms = 3, /* DS parameter set (1) */
- EID_CFParms = 4, /* CF parameter set (6) */
- EID_Tim = 5, /* Traffic Information Map (4:254) */
- EID_IbssParms = 6, /* IBSS parameter set (2) */
- EID_Country = 7, /* */
-
- /* Form 7.3.2: Information elements in 802.11E/D13.0, page 46. */
- EID_QBSSLoad = 11,
- EID_EDCAParms = 12,
- EID_TSpec = 13,
- EID_TClass = 14,
- EID_Schedule = 15,
- /* */
-
- EID_Ctext = 16, /* challenge text*/
- EID_POWER_CONSTRAINT = 32, /* Power Constraint*/
-
- /* vivi for WIFITest, 802.11h AP, 20100427 */
- /* 2010/12/26 MH The definition we can declare always!! */
- EID_PowerCap = 33,
- EID_SupportedChannels = 36,
- EID_ChlSwitchAnnounce = 37,
-
- EID_MeasureRequest = 38, /* Measurement Request */
- EID_MeasureReport = 39, /* Measurement Report */
-
- EID_ERPInfo = 42,
-
- /* Form 7.3.2: Information elements in 802.11E/D13.0, page 46. */
- EID_TSDelay = 43,
- EID_TCLASProc = 44,
- EID_HTCapability = 45,
- EID_QoSCap = 46,
- /* */
-
- EID_WPA2 = 48,
- EID_ExtSupRates = 50,
-
- EID_FTIE = 55, /* Defined in 802.11r */
- EID_Timeout = 56, /* Defined in 802.11r */
-
- EID_SupRegulatory = 59, /* Supported Requlatory Classes 802.11y */
- EID_HTInfo = 61,
- EID_SecondaryChnlOffset = 62,
-
- EID_BSSCoexistence = 72, /* 20/40 BSS Coexistence */
- EID_BSSIntolerantChlReport = 73,
- EID_OBSS = 74, /* Overlapping BSS Scan Parameters */
-
- EID_LinkIdentifier = 101, /* Defined in 802.11z */
- EID_WakeupSchedule = 102, /* Defined in 802.11z */
- EID_ChnlSwitchTimeing = 104, /* Defined in 802.11z */
- EID_PTIControl = 105, /* Defined in 802.11z */
- EID_PUBufferStatus = 106, /* Defined in 802.11z */
-
- EID_EXTCapability = 127, /* Extended Capabilities */
- /* From S19:Aironet IE and S21:AP IP address IE in CCX v1.13, p16 and p18. */
- EID_Aironet = 133, /* 0x85: Aironet Element for Cisco CCX */
- EID_CiscoIP = 149, /* 0x95: IP Address IE for Cisco CCX */
-
- EID_CellPwr = 150, /* 0x96: Cell Power Limit IE. Ref. 0x96. */
-
- EID_CCKM = 156,
-
- EID_Vendor = 221, /* 0xDD: Vendor Specific */
-
- EID_WAPI = 68,
- EID_VHTCapability = 191, /* Based on 802.11ac D2.0 */
- EID_VHTOperation = 192, /* Based on 802.11ac D2.0 */
- EID_OpModeNotification = 199, /* Based on 802.11ac D3.0 */
-};
-
/* ---------------------------------------------------------------------------
Below is the fixed elements...
-----------------------------------------------------------------------------*/
--
2.25.1

2020-12-08 06:06:47

by Ross Schmidt

[permalink] [raw]
Subject: [PATCH v2 16/21] staging: rtl8723bs: replace _MME_IE_

Replace unique _MME_IE_ macro with kernel provided WLAN_EID_MMIE from
linux/ieee80211.h.

Signed-off-by: Ross Schmidt <[email protected]>
---
drivers/staging/rtl8723bs/core/rtw_security.c | 2 +-
drivers/staging/rtl8723bs/core/rtw_xmit.c | 2 +-
drivers/staging/rtl8723bs/include/wifi.h | 1 -
3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c
index 33f5d3c5ac36..a83d8f7f611c 100644
--- a/drivers/staging/rtl8723bs/core/rtw_security.c
+++ b/drivers/staging/rtl8723bs/core/rtw_security.c
@@ -1819,7 +1819,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
/* save the frame body + MME */
memcpy(BIP_AAD+BIP_AAD_SIZE, pframe+WLAN_HDR_A3_LEN, pattrib->pkt_len-WLAN_HDR_A3_LEN);
/* find MME IE pointer */
- p = rtw_get_ie(BIP_AAD+BIP_AAD_SIZE, _MME_IE_, &len, pattrib->pkt_len-WLAN_HDR_A3_LEN);
+ p = rtw_get_ie(BIP_AAD+BIP_AAD_SIZE, WLAN_EID_MMIE, &len, pattrib->pkt_len-WLAN_HDR_A3_LEN);
/* Baron */
if (p) {
u16 keyid = 0;
diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c
index 187a2aa77a55..41632fa0b3c8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_xmit.c
+++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c
@@ -1292,7 +1292,7 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, _pkt *pkt, struct xmit
pmlmeext->mgnt_80211w_IPN++;

/* add MME IE with MIC all zero, MME string doesn't include element id and length */
- pframe = rtw_set_ie(pframe, _MME_IE_, 16,
+ pframe = rtw_set_ie(pframe, WLAN_EID_MMIE, 16,
MME, &pattrib->pktlen);
pattrib->last_txcmdsz = pattrib->pktlen;
/* total frame length - header length */
diff --git a/drivers/staging/rtl8723bs/include/wifi.h b/drivers/staging/rtl8723bs/include/wifi.h
index 29621fce6a83..82dfdafb38fc 100644
--- a/drivers/staging/rtl8723bs/include/wifi.h
+++ b/drivers/staging/rtl8723bs/include/wifi.h
@@ -395,7 +395,6 @@ static inline int IsFrameTypeCtrl(unsigned char *pframe)
#define _SRC_IE_ 59

#define _RIC_Descriptor_IE_ 75
-#define _MME_IE_ 76 /* 802.11w Management MIC element */
#define _LINK_ID_IE_ 101
#define _CH_SWITCH_TIMING_ 104
#define _PTI_BUFFER_STATUS_ 106
--
2.25.1