Skip to contentSkip to conversation

staging: rtl8723bs: Rename variable supportRateNum

PATCH In review Erick Karanja 3 participants 4 messages Mar 25, 2025 – Mar 26, 2025 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: Rename variable supportRateNum

Rename the variable supportRateNum to support_rate_num to adhere to Linux kernel coding standards by using snake_case instead of CamelCase.

Fixes checkpatch.pl warning:
CHECK: Avoid CamelCase: <supportRateNum>

---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +8 -7
index 50022bb5911e..5124260602c8 100644
@@ -370,7 +370,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
 void update_bmc_sta(struct adapter *padapter)
 {
 	unsigned char network_type;
-	int supportRateNum = 0;
+	int support_rate_num = 0;
 	unsigned int tx_ra_bitmap = 0;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -396,9 +396,9 @@ void update_bmc_sta(struct adapter *padapter)
 		/* psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this. */
 
 		/* prepare for add_RATid */
-		supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
+		support_rate_num = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
 		network_type = rtw_check_network_type((u8 *)&pcur_network->supported_rates,
-						      supportRateNum,
+						      support_rate_num,
 						      pcur_network->configuration.ds_config
 		);
 		if (is_supported_tx_cck(network_type)) {
@@ -893,7 +893,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 	);
 	if (p) {
 		memcpy(supportRate, p + 2, ie_len);
-		supportRateNum = ie_len;
+		support_rate_num = ie_len;
 	}
 
 	/* get ext_supported rates */
@@ -904,11 +904,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		pbss_network->ie_length - _BEACON_IE_OFFSET_
 	);
 	if (p) {
-		memcpy(supportRate + supportRateNum, p + 2, ie_len);
-		supportRateNum += ie_len;
+		memcpy(supportRate + support_rate_num, p + 2, ie_len);
+		support_rate_num += ie_len;
 	}
 
-	network_type = rtw_check_network_type(supportRate, supportRateNum, channel);
+	network_type = rtw_check_network_type(supportRate, support_rate_num,
+					      channel);
 
 	rtw_set_supported_rate(pbss_network->supported_rates, network_type);
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 2 lines · Erick Karanja

Rename the variable supportRateNum to support_rate_num to adhere to Linux kernel coding standards by using snake_case instead of CamelCase.

Maybe it would make sense to do supportRate at the same time, since they seem to be closely related?

julia

Quoted 64 lines

Fixes checkpatch.pl warning:
CHECK: Avoid CamelCase: <supportRateNum>

---
 drivers/staging/rtl8723bs/core/rtw_ap.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/staging/rtl8723bs/core/rtw_ap.c +8 -8
index 50022bb5911e..5124260602c8 100644
@@ -370,7 +370,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
 void update_bmc_sta(struct adapter *padapter)
 {
 	unsigned char network_type;
-	int supportRateNum = 0;
+	int support_rate_num = 0;
 	unsigned int tx_ra_bitmap = 0;
 	struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
 	struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@@ -396,9 +396,9 @@ void update_bmc_sta(struct adapter *padapter)
 		/* psta->dot118021XPrivacy = _NO_PRIVACY_;//!!! remove it, because it has been set before this. */
 
 		/* prepare for add_RATid */
-		supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
+		support_rate_num = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
 		network_type = rtw_check_network_type((u8 *)&pcur_network->supported_rates,
-						      supportRateNum,
+						      support_rate_num,
 						      pcur_network->configuration.ds_config
 		);
 		if (is_supported_tx_cck(network_type)) {
@@ -893,7 +893,7 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 	);
 	if (p) {
 		memcpy(supportRate, p + 2, ie_len);
-		supportRateNum = ie_len;
+		support_rate_num = ie_len;
 	}
 
 	/* get ext_supported rates */
@@ -904,11 +904,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf,  int len)
 		pbss_network->ie_length - _BEACON_IE_OFFSET_
 	);
 	if (p) {
-		memcpy(supportRate + supportRateNum, p + 2, ie_len);
-		supportRateNum += ie_len;
+		memcpy(supportRate + support_rate_num, p + 2, ie_len);
+		support_rate_num += ie_len;
 	}
 
-	network_type = rtw_check_network_type(supportRate, supportRateNum, channel);
+	network_type = rtw_check_network_type(supportRate, support_rate_num,
+					      channel);
 
 	rtw_set_supported_rate(pbss_network->supported_rates, network_type);
 
--

2.43.0

#2 lore raw
In reply to Erick Karanja
kernel test robot noticed the following build errors:

Hi Erick,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Erick-Karanja/staging-rtl8723bs-Rename-variable-supportRateNum/20250325-171434
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20250325091220.38601-1-karanja99erick%40gmail.com
patch subject: [PATCH] staging: rtl8723bs: Rename variable supportRateNum
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20250326/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250326/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

drivers/staging/rtl8723bs/core/rtw_ap.c: In function 'rtw_check_beacon_data':

>> drivers/staging/rtl8723bs/core/rtw_ap.c:896:17: error: 'support_rate_num' undeclared (first use in this function); did you mean 'supportRateNum'?
     896 |                 support_rate_num = ie_len;
         |                 ^~~~~~~~~~~~~~~~
         |                 supportRateNum
   drivers/staging/rtl8723bs/core/rtw_ap.c:896:17: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/staging/rtl8723bs/core/rtw_ap.c:821:13: warning: unused variable 'supportRateNum' [-Wunused-variable]
     821 |         int supportRateNum = 0;
         |             ^~~~~~~~~~~~~~

vim +896 drivers/staging/rtl8723bs/core/rtw_ap.c

809
810 int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
811 {
812 int ret = _SUCCESS;
813 u8 *p;
814 u8 *pHT_caps_ie = NULL;
815 u8 *pHT_info_ie = NULL;
816 struct sta_info *psta = NULL;
817 u16 cap, ht_cap = false;
818 uint ie_len = 0;
819 int group_cipher, pairwise_cipher;
820 u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX];

 > 821		int supportRateNum = 0;
   822		u8 OUI1[] = {0x00, 0x50, 0xf2, 0x01};
   823		u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01};
   824		struct registry_priv *pregistrypriv = &padapter->registrypriv;
   825		struct security_priv *psecuritypriv = &padapter->securitypriv;
   826		struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
   827		struct wlan_bssid_ex
   828			*pbss_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network;
   829		u8 *ie = pbss_network->ies;
   830	
   831		if (!check_fwstate(pmlmepriv, WIFI_AP_STATE))
   832			return _FAIL;
   833	
   834		if (len < 0 || len > MAX_IE_SZ)
   835			return _FAIL;
   836	
   837		pbss_network->ie_length = len;
   838	
   839		memset(ie, 0, MAX_IE_SZ);
   840	
   841		memcpy(ie, pbuf, pbss_network->ie_length);
   842	
   843		if (pbss_network->infrastructure_mode != Ndis802_11APMode)
   844			return _FAIL;
   845	
   846		pbss_network->rssi = 0;
   847	
   848		memcpy(pbss_network->mac_address, myid(&padapter->eeprompriv), ETH_ALEN);
   849	
   850		/* beacon interval */
   851		p = rtw_get_beacon_interval_from_ie(ie);/* ie + 8;	8: TimeStamp, 2: Beacon Interval 2:Capability */
   852		/* pbss_network->configuration.beacon_period = le16_to_cpu(*(unsigned short*)p); */
   853		pbss_network->configuration.beacon_period = get_unaligned_le16(p);
   854	
   855		/* capability */
   856		/* cap = *(unsigned short *)rtw_get_capability_from_ie(ie); */
   857		/* cap = le16_to_cpu(cap); */
   858		cap = get_unaligned_le16(ie);
   859	
   860		/* SSID */
   861		p = rtw_get_ie(
   862			ie + _BEACON_IE_OFFSET_,
   863			WLAN_EID_SSID,
   864			&ie_len,
   865			(pbss_network->ie_length - _BEACON_IE_OFFSET_)
   866		);
   867		if (p && ie_len > 0) {
   868			memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid));
   869			memcpy(pbss_network->ssid.ssid, (p + 2), ie_len);
   870			pbss_network->ssid.ssid_length = ie_len;
   871		}
   872	
   873		/* channel */
   874		channel = 0;
   875		pbss_network->configuration.length = 0;
   876		p = rtw_get_ie(
   877			ie + _BEACON_IE_OFFSET_,
   878			WLAN_EID_DS_PARAMS, &ie_len,
   879			(pbss_network->ie_length - _BEACON_IE_OFFSET_)
   880		);
   881		if (p && ie_len > 0)
   882			channel = *(p + 2);
   883	
   884		pbss_network->configuration.ds_config = channel;
   885	
   886		memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
   887		/*  get supported rates */
   888		p = rtw_get_ie(
   889			ie + _BEACON_IE_OFFSET_,
   890			WLAN_EID_SUPP_RATES,
   891			&ie_len,
   892			(pbss_network->ie_length - _BEACON_IE_OFFSET_)
   893		);
   894		if (p) {
   895			memcpy(supportRate, p + 2, ie_len);
 > 896			support_rate_num = ie_len;

897 }
898
899 /* get ext_supported rates */
900 p = rtw_get_ie(
901 ie + _BEACON_IE_OFFSET_,
902 WLAN_EID_EXT_SUPP_RATES,
903 &ie_len,
904 pbss_network->ie_length - _BEACON_IE_OFFSET_
905 );
906 if (p) {
907 memcpy(supportRate + support_rate_num, p + 2, ie_len);
908 support_rate_num += ie_len;
909 }
910
911 network_type = rtw_check_network_type(supportRate, support_rate_num,
912 channel);
913
914 rtw_set_supported_rate(pbss_network->supported_rates, network_type);
915
916 /* parsing ERP_IE */
917 p = rtw_get_ie(
918 ie + _BEACON_IE_OFFSET_,
919 WLAN_EID_ERP_INFO,
920 &ie_len,
921 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
922 );
923 if (p && ie_len > 0)
924 ERP_IE_handler(padapter, (struct ndis_80211_var_ie *)p);
925
926 /* update privacy/security */
927 if (cap & BIT(4))
928 pbss_network->privacy = 1;
929 else
930 pbss_network->privacy = 0;
931
932 psecuritypriv->wpa_psk = 0;
933
934 /* wpa2 */
935 group_cipher = 0; pairwise_cipher = 0;
936 psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
937 psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
938 p = rtw_get_ie(
939 ie + _BEACON_IE_OFFSET_,
940 WLAN_EID_RSN,
941 &ie_len,
942 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
943 );
944 if (p && ie_len > 0) {
945 if (rtw_parse_wpa2_ie(
946 p,
947 ie_len + 2,
948 &group_cipher,
949 &pairwise_cipher,
950 NULL
951 ) == _SUCCESS) {
952 psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
953
954 psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
955 psecuritypriv->wpa_psk |= BIT(1);
956
957 psecuritypriv->wpa2_group_cipher = group_cipher;
958 psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher;
959 }
960 }
961
962 /* wpa */
963 ie_len = 0;
964 group_cipher = 0; pairwise_cipher = 0;
965 psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
966 psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
967 for (p = ie + _BEACON_IE_OFFSET_; ; p += (ie_len + 2)) {
968 p = rtw_get_ie(
969 p,
970 WLAN_EID_VENDOR_SPECIFIC,
971 &ie_len,
972 (pbss_network->ie_length - _BEACON_IE_OFFSET_ - (ie_len + 2))
973 );
974 if ((p) && (!memcmp(p + 2, OUI1, 4))) {
975 if (rtw_parse_wpa_ie(
976 p,
977 ie_len + 2,
978 &group_cipher,
979 &pairwise_cipher,
980 NULL
981 ) == _SUCCESS) {
982 psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
983
984 psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
985
986 psecuritypriv->wpa_psk |= BIT(0);
987
988 psecuritypriv->wpa_group_cipher = group_cipher;
989 psecuritypriv->wpa_pairwise_cipher = pairwise_cipher;
990 }
991
992 break;
993 }
994
995 if (!p || ie_len == 0)
996 break;
997 }
998
999 /* wmm */
1000 ie_len = 0;
1001 pmlmepriv->qospriv.qos_option = 0;
1002 if (pregistrypriv->wmm_enable) {
1003 for (p = ie + _BEACON_IE_OFFSET_; ; p += (ie_len + 2)) {
1004 p = rtw_get_ie(
1005 p,
1006 WLAN_EID_VENDOR_SPECIFIC,
1007 &ie_len,
1008 (pbss_network->ie_length - _BEACON_IE_OFFSET_ - (ie_len + 2))
1009 );
1010 if ((p) && !memcmp(p + 2, WMM_PARA_IE, 6)) {
1011 pmlmepriv->qospriv.qos_option = 1;
1012
1013 *(p + 8) |= BIT(7);/* QoS Info, support U-APSD */
1014
1015 /* disable all ACM bits since the WMM admission */
1016 /* control is not supported */
1017 *(p + 10) &= ~BIT(4); /* BE */
1018 *(p + 14) &= ~BIT(4); /* BK */
1019 *(p + 18) &= ~BIT(4); /* VI */
1020 *(p + 22) &= ~BIT(4); /* VO */
1021
1022 break;
1023 }
1024
1025 if (!p || ie_len == 0)
1026 break;
1027 }
1028 }
1029
1030 /* parsing HT_CAP_IE */
1031 p = rtw_get_ie(
1032 ie + _BEACON_IE_OFFSET_,
1033 WLAN_EID_HT_CAPABILITY,
1034 &ie_len,
1035 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
1036 );
1037 if (p && ie_len > 0) {
1038 u8 max_rx_ampdu_factor = 0;
1039 struct ieee80211_ht_cap *pht_cap = (struct ieee80211_ht_cap *)(p + 2);
1040
1041 pHT_caps_ie = p;
1042
1043 ht_cap = true;
1044 network_type |= WIRELESS_11_24N;
1045
1046 rtw_ht_use_default_setting(padapter);
1047
1048 if (pmlmepriv->htpriv.sgi_20m == false)
1049 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_20));
1050
1051 if (pmlmepriv->htpriv.sgi_40m == false)
1052 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_40));
1053
1054 if (!TEST_FLAG(pmlmepriv->htpriv.ldpc_cap, LDPC_HT_ENABLE_RX))
1055 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_LDPC_CODING));
1056
1057 if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_TX))
1058 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_TX_STBC));
1059
1060 if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_RX))
1061 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_RX_STBC_3R));
1062
1063 pht_cap->ampdu_params_info &= ~(
1064 IEEE80211_HT_CAP_AMPDU_FACTOR | IEEE80211_HT_CAP_AMPDU_DENSITY
1065 );
1066
1067 if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) ||
1068 (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) {
1069 pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY &
1070 (0x07 << 2));
1071 } else {
1072 pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY &
1073 0x00);
1074 }
1075
1076 rtw_hal_get_def_var(
1077 padapter,
1078 HW_VAR_MAX_RX_AMPDU_FACTOR,
1079 &max_rx_ampdu_factor
1080 );
1081 pht_cap->ampdu_params_info |= (
1082 IEEE80211_HT_CAP_AMPDU_FACTOR & max_rx_ampdu_factor
1083 ); /* set Max Rx AMPDU size to 64K */
1084
1085 pht_cap->mcs.rx_mask[0] = 0xff;
1086 pht_cap->mcs.rx_mask[1] = 0x0;
1087
1088 memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len);
1089 }
1090
1091 /* parsing HT_INFO_IE */
1092 p = rtw_get_ie(
1093 ie + _BEACON_IE_OFFSET_,
1094 WLAN_EID_HT_OPERATION,
1095 &ie_len,
1096 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
1097 );
1098 if (p && ie_len > 0)
1099 pHT_info_ie = p;
1100
1101 switch (network_type) {
1102 case WIRELESS_11B:
1103 pbss_network->network_type_in_use = Ndis802_11DS;
1104 break;
1105 case WIRELESS_11G:
1106 case WIRELESS_11BG:
1107 case WIRELESS_11G_24N:
1108 case WIRELESS_11BG_24N:
1109 pbss_network->network_type_in_use = Ndis802_11OFDM24;
1110 break;
1111 default:
1112 pbss_network->network_type_in_use = Ndis802_11OFDM24;
1113 break;
1114 }
1115
1116 pmlmepriv->cur_network.network_type = network_type;
1117
1118 pmlmepriv->htpriv.ht_option = false;
1119
1120 if ((psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_TKIP) ||
1121 (psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_TKIP)) {
1122 /* todo: */
1123 /* ht_cap = false; */
1124 }
1125
1126 /* ht_cap */
1127 if (pregistrypriv->ht_enable && ht_cap) {
1128 pmlmepriv->htpriv.ht_option = true;
1129 pmlmepriv->qospriv.qos_option = 1;
1130
1131 if (pregistrypriv->ampdu_enable == 1)
1132 pmlmepriv->htpriv.ampdu_enable = true;
1133
1134 HT_caps_handler(padapter, (struct ndis_80211_var_ie *)pHT_caps_ie);
1135
1136 HT_info_handler(padapter, (struct ndis_80211_var_ie *)pHT_info_ie);
1137 }
1138
1139 pbss_network->length = get_wlan_bssid_ex_sz(
1140 (struct wlan_bssid_ex *)pbss_network
1141 );
1142
1143 /* issue beacon to start bss network */
1144 /* start_bss_network(padapter, (u8 *)pbss_network); */
1145 rtw_startbss_cmd(padapter, RTW_CMDF_WAIT_ACK);
1146
1147 /* alloc sta_info for ap itself */
1148 psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->mac_address);
1149 if (!psta) {
1150 psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->mac_address);
1151 if (!psta)
1152 return _FAIL;
1153 }
1154
1155 /* update AP's sta info */
1156 update_ap_info(padapter, psta);
1157
1158 psta->state |= WIFI_AP_STATE; /* Aries, add, fix bug of flush_cam_entry at STOP AP mode , 0724 */
1159 rtw_indicate_connect(padapter);
1160
1161 pmlmepriv->cur_network.join_res = true;/* for check if already set beacon */
1162
1163 /* update bc/mc sta_info */
1164 /* update_bmc_sta(padapter); */
1165
1166 return ret;
1167 }
1168

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw
In reply to Erick Karanja
kernel test robot noticed the following build errors:

Hi Erick,

kernel test robot noticed the following build errors:

[auto build test ERROR on staging/staging-testing]

url:    https://github.com/intel-lab-lkp/linux/commits/Erick-Karanja/staging-rtl8723bs-Rename-variable-supportRateNum/20250325-171434
base:   staging/staging-testing
patch link:    https://lore.kernel.org/r/20250325091220.38601-1-karanja99erick%40gmail.com
patch subject: [PATCH] staging: rtl8723bs: Rename variable supportRateNum
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20250326/[email protected]/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250326/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/staging/rtl8723bs/core/rtw_ap.c:896:3: error: use of undeclared identifier 'support_rate_num'; did you mean 'supportRateNum'?
     896 |                 support_rate_num = ie_len;
         |                 ^~~~~~~~~~~~~~~~
         |                 supportRateNum
   drivers/staging/rtl8723bs/core/rtw_ap.c:821:6: note: 'supportRateNum' declared here
     821 |         int supportRateNum = 0;
         |             ^
   drivers/staging/rtl8723bs/core/rtw_ap.c:907:24: error: use of undeclared identifier 'support_rate_num'; did you mean 'supportRateNum'?
     907 |                 memcpy(supportRate + support_rate_num, p + 2, ie_len);
         |                                      ^~~~~~~~~~~~~~~~
         |                                      supportRateNum
   drivers/staging/rtl8723bs/core/rtw_ap.c:821:6: note: 'supportRateNum' declared here
     821 |         int supportRateNum = 0;
         |             ^
   drivers/staging/rtl8723bs/core/rtw_ap.c:908:3: error: use of undeclared identifier 'support_rate_num'; did you mean 'supportRateNum'?
     908 |                 support_rate_num += ie_len;
         |                 ^~~~~~~~~~~~~~~~
         |                 supportRateNum
   drivers/staging/rtl8723bs/core/rtw_ap.c:821:6: note: 'supportRateNum' declared here
     821 |         int supportRateNum = 0;
         |             ^
   drivers/staging/rtl8723bs/core/rtw_ap.c:911:53: error: use of undeclared identifier 'support_rate_num'; did you mean 'supportRateNum'?
     911 |         network_type = rtw_check_network_type(supportRate, support_rate_num,
         |                                                            ^~~~~~~~~~~~~~~~
         |                                                            supportRateNum
   drivers/staging/rtl8723bs/core/rtw_ap.c:821:6: note: 'supportRateNum' declared here
     821 |         int supportRateNum = 0;
         |             ^

4 errors generated.

vim +896 drivers/staging/rtl8723bs/core/rtw_ap.c

809
810 int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
811 {
812 int ret = _SUCCESS;
813 u8 *p;
814 u8 *pHT_caps_ie = NULL;
815 u8 *pHT_info_ie = NULL;
816 struct sta_info *psta = NULL;
817 u16 cap, ht_cap = false;
818 uint ie_len = 0;
819 int group_cipher, pairwise_cipher;
820 u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX];
821 int supportRateNum = 0;
822 u8 OUI1[] = {0x00, 0x50, 0xf2, 0x01};
823 u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01};
824 struct registry_priv *pregistrypriv = &padapter->registrypriv;
825 struct security_priv *psecuritypriv = &padapter->securitypriv;
826 struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
827 struct wlan_bssid_ex
828 *pbss_network = (struct wlan_bssid_ex *)&pmlmepriv->cur_network.network;
829 u8 *ie = pbss_network->ies;
830
831 if (!check_fwstate(pmlmepriv, WIFI_AP_STATE))
832 return _FAIL;
833
834 if (len < 0 || len > MAX_IE_SZ)
835 return _FAIL;
836
837 pbss_network->ie_length = len;
838
839 memset(ie, 0, MAX_IE_SZ);
840
841 memcpy(ie, pbuf, pbss_network->ie_length);
842
843 if (pbss_network->infrastructure_mode != Ndis802_11APMode)
844 return _FAIL;
845
846 pbss_network->rssi = 0;
847
848 memcpy(pbss_network->mac_address, myid(&padapter->eeprompriv), ETH_ALEN);
849
850 /* beacon interval */
851 p = rtw_get_beacon_interval_from_ie(ie);/* ie + 8; 8: TimeStamp, 2: Beacon Interval 2:Capability */
852 /* pbss_network->configuration.beacon_period = le16_to_cpu(*(unsigned short*)p); */
853 pbss_network->configuration.beacon_period = get_unaligned_le16(p);
854
855 /* capability */
856 /* cap = *(unsigned short *)rtw_get_capability_from_ie(ie); */
857 /* cap = le16_to_cpu(cap); */
858 cap = get_unaligned_le16(ie);
859
860 /* SSID */
861 p = rtw_get_ie(
862 ie + _BEACON_IE_OFFSET_,
863 WLAN_EID_SSID,
864 &ie_len,
865 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
866 );
867 if (p && ie_len > 0) {
868 memset(&pbss_network->ssid, 0, sizeof(struct ndis_802_11_ssid));
869 memcpy(pbss_network->ssid.ssid, (p + 2), ie_len);
870 pbss_network->ssid.ssid_length = ie_len;
871 }
872
873 /* channel */
874 channel = 0;
875 pbss_network->configuration.length = 0;
876 p = rtw_get_ie(
877 ie + _BEACON_IE_OFFSET_,
878 WLAN_EID_DS_PARAMS, &ie_len,
879 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
880 );
881 if (p && ie_len > 0)
882 channel = *(p + 2);
883
884 pbss_network->configuration.ds_config = channel;
885
886 memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
887 /* get supported rates */
888 p = rtw_get_ie(
889 ie + _BEACON_IE_OFFSET_,
890 WLAN_EID_SUPP_RATES,
891 &ie_len,
892 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
893 );
894 if (p) {
895 memcpy(supportRate, p + 2, ie_len);

 > 896			support_rate_num = ie_len;

897 }
898
899 /* get ext_supported rates */
900 p = rtw_get_ie(
901 ie + _BEACON_IE_OFFSET_,
902 WLAN_EID_EXT_SUPP_RATES,
903 &ie_len,
904 pbss_network->ie_length - _BEACON_IE_OFFSET_
905 );
906 if (p) {
907 memcpy(supportRate + support_rate_num, p + 2, ie_len);
908 support_rate_num += ie_len;
909 }
910
911 network_type = rtw_check_network_type(supportRate, support_rate_num,
912 channel);
913
914 rtw_set_supported_rate(pbss_network->supported_rates, network_type);
915
916 /* parsing ERP_IE */
917 p = rtw_get_ie(
918 ie + _BEACON_IE_OFFSET_,
919 WLAN_EID_ERP_INFO,
920 &ie_len,
921 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
922 );
923 if (p && ie_len > 0)
924 ERP_IE_handler(padapter, (struct ndis_80211_var_ie *)p);
925
926 /* update privacy/security */
927 if (cap & BIT(4))
928 pbss_network->privacy = 1;
929 else
930 pbss_network->privacy = 0;
931
932 psecuritypriv->wpa_psk = 0;
933
934 /* wpa2 */
935 group_cipher = 0; pairwise_cipher = 0;
936 psecuritypriv->wpa2_group_cipher = _NO_PRIVACY_;
937 psecuritypriv->wpa2_pairwise_cipher = _NO_PRIVACY_;
938 p = rtw_get_ie(
939 ie + _BEACON_IE_OFFSET_,
940 WLAN_EID_RSN,
941 &ie_len,
942 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
943 );
944 if (p && ie_len > 0) {
945 if (rtw_parse_wpa2_ie(
946 p,
947 ie_len + 2,
948 &group_cipher,
949 &pairwise_cipher,
950 NULL
951 ) == _SUCCESS) {
952 psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
953
954 psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
955 psecuritypriv->wpa_psk |= BIT(1);
956
957 psecuritypriv->wpa2_group_cipher = group_cipher;
958 psecuritypriv->wpa2_pairwise_cipher = pairwise_cipher;
959 }
960 }
961
962 /* wpa */
963 ie_len = 0;
964 group_cipher = 0; pairwise_cipher = 0;
965 psecuritypriv->wpa_group_cipher = _NO_PRIVACY_;
966 psecuritypriv->wpa_pairwise_cipher = _NO_PRIVACY_;
967 for (p = ie + _BEACON_IE_OFFSET_; ; p += (ie_len + 2)) {
968 p = rtw_get_ie(
969 p,
970 WLAN_EID_VENDOR_SPECIFIC,
971 &ie_len,
972 (pbss_network->ie_length - _BEACON_IE_OFFSET_ - (ie_len + 2))
973 );
974 if ((p) && (!memcmp(p + 2, OUI1, 4))) {
975 if (rtw_parse_wpa_ie(
976 p,
977 ie_len + 2,
978 &group_cipher,
979 &pairwise_cipher,
980 NULL
981 ) == _SUCCESS) {
982 psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_8021X;
983
984 psecuritypriv->dot8021xalg = 1;/* psk, todo:802.1x */
985
986 psecuritypriv->wpa_psk |= BIT(0);
987
988 psecuritypriv->wpa_group_cipher = group_cipher;
989 psecuritypriv->wpa_pairwise_cipher = pairwise_cipher;
990 }
991
992 break;
993 }
994
995 if (!p || ie_len == 0)
996 break;
997 }
998
999 /* wmm */
1000 ie_len = 0;
1001 pmlmepriv->qospriv.qos_option = 0;
1002 if (pregistrypriv->wmm_enable) {
1003 for (p = ie + _BEACON_IE_OFFSET_; ; p += (ie_len + 2)) {
1004 p = rtw_get_ie(
1005 p,
1006 WLAN_EID_VENDOR_SPECIFIC,
1007 &ie_len,
1008 (pbss_network->ie_length - _BEACON_IE_OFFSET_ - (ie_len + 2))
1009 );
1010 if ((p) && !memcmp(p + 2, WMM_PARA_IE, 6)) {
1011 pmlmepriv->qospriv.qos_option = 1;
1012
1013 *(p + 8) |= BIT(7);/* QoS Info, support U-APSD */
1014
1015 /* disable all ACM bits since the WMM admission */
1016 /* control is not supported */
1017 *(p + 10) &= ~BIT(4); /* BE */
1018 *(p + 14) &= ~BIT(4); /* BK */
1019 *(p + 18) &= ~BIT(4); /* VI */
1020 *(p + 22) &= ~BIT(4); /* VO */
1021
1022 break;
1023 }
1024
1025 if (!p || ie_len == 0)
1026 break;
1027 }
1028 }
1029
1030 /* parsing HT_CAP_IE */
1031 p = rtw_get_ie(
1032 ie + _BEACON_IE_OFFSET_,
1033 WLAN_EID_HT_CAPABILITY,
1034 &ie_len,
1035 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
1036 );
1037 if (p && ie_len > 0) {
1038 u8 max_rx_ampdu_factor = 0;
1039 struct ieee80211_ht_cap *pht_cap = (struct ieee80211_ht_cap *)(p + 2);
1040
1041 pHT_caps_ie = p;
1042
1043 ht_cap = true;
1044 network_type |= WIRELESS_11_24N;
1045
1046 rtw_ht_use_default_setting(padapter);
1047
1048 if (pmlmepriv->htpriv.sgi_20m == false)
1049 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_20));
1050
1051 if (pmlmepriv->htpriv.sgi_40m == false)
1052 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_SGI_40));
1053
1054 if (!TEST_FLAG(pmlmepriv->htpriv.ldpc_cap, LDPC_HT_ENABLE_RX))
1055 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_LDPC_CODING));
1056
1057 if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_TX))
1058 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_TX_STBC));
1059
1060 if (!TEST_FLAG(pmlmepriv->htpriv.stbc_cap, STBC_HT_ENABLE_RX))
1061 pht_cap->cap_info &= cpu_to_le16(~(IEEE80211_HT_CAP_RX_STBC_3R));
1062
1063 pht_cap->ampdu_params_info &= ~(
1064 IEEE80211_HT_CAP_AMPDU_FACTOR | IEEE80211_HT_CAP_AMPDU_DENSITY
1065 );
1066
1067 if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) ||
1068 (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) {
1069 pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY &
1070 (0x07 << 2));
1071 } else {
1072 pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY &
1073 0x00);
1074 }
1075
1076 rtw_hal_get_def_var(
1077 padapter,
1078 HW_VAR_MAX_RX_AMPDU_FACTOR,
1079 &max_rx_ampdu_factor
1080 );
1081 pht_cap->ampdu_params_info |= (
1082 IEEE80211_HT_CAP_AMPDU_FACTOR & max_rx_ampdu_factor
1083 ); /* set Max Rx AMPDU size to 64K */
1084
1085 pht_cap->mcs.rx_mask[0] = 0xff;
1086 pht_cap->mcs.rx_mask[1] = 0x0;
1087
1088 memcpy(&pmlmepriv->htpriv.ht_cap, p + 2, ie_len);
1089 }
1090
1091 /* parsing HT_INFO_IE */
1092 p = rtw_get_ie(
1093 ie + _BEACON_IE_OFFSET_,
1094 WLAN_EID_HT_OPERATION,
1095 &ie_len,
1096 (pbss_network->ie_length - _BEACON_IE_OFFSET_)
1097 );
1098 if (p && ie_len > 0)
1099 pHT_info_ie = p;
1100
1101 switch (network_type) {
1102 case WIRELESS_11B:
1103 pbss_network->network_type_in_use = Ndis802_11DS;
1104 break;
1105 case WIRELESS_11G:
1106 case WIRELESS_11BG:
1107 case WIRELESS_11G_24N:
1108 case WIRELESS_11BG_24N:
1109 pbss_network->network_type_in_use = Ndis802_11OFDM24;
1110 break;
1111 default:
1112 pbss_network->network_type_in_use = Ndis802_11OFDM24;
1113 break;
1114 }
1115
1116 pmlmepriv->cur_network.network_type = network_type;
1117
1118 pmlmepriv->htpriv.ht_option = false;
1119
1120 if ((psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_TKIP) ||
1121 (psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_TKIP)) {
1122 /* todo: */
1123 /* ht_cap = false; */
1124 }
1125
1126 /* ht_cap */
1127 if (pregistrypriv->ht_enable && ht_cap) {
1128 pmlmepriv->htpriv.ht_option = true;
1129 pmlmepriv->qospriv.qos_option = 1;
1130
1131 if (pregistrypriv->ampdu_enable == 1)
1132 pmlmepriv->htpriv.ampdu_enable = true;
1133
1134 HT_caps_handler(padapter, (struct ndis_80211_var_ie *)pHT_caps_ie);
1135
1136 HT_info_handler(padapter, (struct ndis_80211_var_ie *)pHT_info_ie);
1137 }
1138
1139 pbss_network->length = get_wlan_bssid_ex_sz(
1140 (struct wlan_bssid_ex *)pbss_network
1141 );
1142
1143 /* issue beacon to start bss network */
1144 /* start_bss_network(padapter, (u8 *)pbss_network); */
1145 rtw_startbss_cmd(padapter, RTW_CMDF_WAIT_ACK);
1146
1147 /* alloc sta_info for ap itself */
1148 psta = rtw_get_stainfo(&padapter->stapriv, pbss_network->mac_address);
1149 if (!psta) {
1150 psta = rtw_alloc_stainfo(&padapter->stapriv, pbss_network->mac_address);
1151 if (!psta)
1152 return _FAIL;
1153 }
1154
1155 /* update AP's sta info */
1156 update_ap_info(padapter, psta);
1157
1158 psta->state |= WIFI_AP_STATE; /* Aries, add, fix bug of flush_cam_entry at STOP AP mode , 0724 */
1159 rtw_indicate_connect(padapter);
1160
1161 pmlmepriv->cur_network.join_res = true;/* for check if already set beacon */
1162
1163 /* update bc/mc sta_info */
1164 /* update_bmc_sta(padapter); */
1165
1166 return ret;
1167 }
1168

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki