hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c
old mode 100644new mode 100755
....@@ -241,9 +241,9 @@
241241 */
242242 REG_RULE(2484-10, 2484+10, 20, 6, 20, 0),
243243 /* IEEE 802.11a, channel 36..64 */
244
- REG_RULE(5150-10, 5350+10, 80, 6, 20, 0),
244
+ REG_RULE(5150-10, 5350+10, 40, 6, 20, 0),
245245 /* IEEE 802.11a, channel 100..165 */
246
- REG_RULE(5470-10, 5850+10, 80, 6, 20, 0),
246
+ REG_RULE(5470-10, 5850+10, 40, 6, 20, 0),
247247 #ifdef WL_6G_BAND
248248 REG_RULE(6025-80, 6985+80, 160, 6, 20, 0),
249249 REG_RULE(5935-10, 7115+10, 20, 6, 20, 0),
....@@ -475,34 +475,18 @@
475475 #endif /* WL_CFG80211_P2P_DEV_IF */
476476 static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
477477 struct net_device *dev,
478
-#if defined(CFG80211_BKPORT_MLO)
479
- int link_id,
480
-#endif
481478 u8 key_idx, bool unicast, bool multicast);
482479 static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
483
-#if defined(CFG80211_BKPORT_MLO)
484
- int link_id,
485
-#endif
486480 u8 key_idx, bool pairwise, const u8 *mac_addr,
487481 struct key_params *params);
488482 static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
489
-#if defined(CFG80211_BKPORT_MLO)
490
- int link_id,
491
-#endif
492483 u8 key_idx, bool pairwise, const u8 *mac_addr);
493484 static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
494
-#if defined(CFG80211_BKPORT_MLO)
495
- int link_id,
496
-#endif
497485 u8 key_idx, bool pairwise, const u8 *mac_addr,
498486 void *cookie, void (*callback) (void *cookie,
499487 struct key_params *params));
500488 static s32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
501
- struct net_device *dev,
502
-#if defined(CFG80211_BKPORT_MLO)
503
- int link_id,
504
-#endif
505
- u8 key_idx);
489
+ struct net_device *dev, u8 key_idx);
506490 #if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
507491 static s32 wl_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
508492 bcm_struct_cfgdev *cfgdev, u64 cookie);
....@@ -595,8 +579,10 @@
595579 bcm_struct_cfgdev *cfgdev, const wl_event_msg_t *e, void *data);
596580 static s32 wl_bss_connect_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
597581 const wl_event_msg_t *e, void *data, bool completed);
582
+#ifdef DHD_LOSSLESS_ROAMING
598583 static s32 wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
599584 const wl_event_msg_t *e, void *data);
585
+#endif /* DHD_LOSSLESS_ROAMING */
600586 static s32 wl_notify_mic_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
601587 const wl_event_msg_t *e, void *data);
602588 #ifdef BT_WIFI_HANDOVER
....@@ -1089,86 +1075,12 @@
10891075 };
10901076 #endif /* CFG80211_6G_SUPPORT */
10911077
1092
-#ifdef WL_CAP_HE
1093
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) || defined(CONFIG_6GHZ_BKPORT)
1094
-static struct ieee80211_sband_iftype_data __wl_he_cap = {
1095
- .types_mask = BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_AP),
1096
- .he_cap = {
1097
- .has_he = true,
1098
- .he_cap_elem = {
1099
- .mac_cap_info[0] = (IEEE80211_HE_MAC_CAP0_HTC_HE |
1100
- IEEE80211_HE_MAC_CAP0_TWT_REQ),
1101
- .mac_cap_info[1] = IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US,
1102
- .mac_cap_info[2] = IEEE80211_HE_MAC_CAP2_BSR,
1103
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
1104
- .mac_cap_info[5] = IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX,
1105
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) */
1106
-
1107
- .phy_cap_info[0] =
1108
- IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
1109
- IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G,
1110
- .phy_cap_info[1] =
1111
- IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A |
1112
- IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD,
1113
- .phy_cap_info[2] =
1114
- IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US,
1115
- .phy_cap_info[3] =
1116
- IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER,
1117
- .phy_cap_info[4] =
1118
- IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE |
1119
- IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK |
1120
- IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4,
1121
- .phy_cap_info[5] =
1122
- IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2,
1123
- .phy_cap_info[6] =
1124
- IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
1125
- IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU |
1126
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0))
1127
- IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
1128
- IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB |
1129
-#else
1130
- IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB |
1131
- IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB |
1132
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) */
1133
- IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB |
1134
- IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT,
1135
- .phy_cap_info[7] =
1136
- IEEE80211_HE_PHY_CAP7_MAX_NC_1,
1137
- .phy_cap_info[8] =
1138
- IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU |
1139
- IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU,
1140
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0))
1141
- .phy_cap_info[9] =
1142
- IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU |
1143
- IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU,
1144
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) */
1145
- },
1146
- .he_mcs_nss_supp = {
1147
- .rx_mcs_80 = cpu_to_le16(0xfffa),
1148
- .tx_mcs_80 = cpu_to_le16(0xfffa),
1149
- .rx_mcs_160 = cpu_to_le16((0xfffa)),
1150
- .tx_mcs_160 = cpu_to_le16((0xfffa)),
1151
- }
1152
- },
1153
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
1154
- .he_6ghz_capa = {.capa = cpu_to_le16(0x3038)},
1155
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) */
1156
-};
1157
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) */
1158
-#endif /* WL_CAP_HE */
1159
-
11601078 static struct ieee80211_supported_band __wl_band_2ghz = {
11611079 .band = IEEE80211_BAND_2GHZ,
11621080 .channels = __wl_2ghz_channels,
11631081 .n_channels = ARRAY_SIZE(__wl_2ghz_channels),
11641082 .bitrates = wl_g_rates,
1165
- .n_bitrates = wl_g_rates_size,
1166
-#ifdef WL_CAP_HE
1167
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) || defined(CONFIG_6GHZ_BKPORT)
1168
- .iftype_data = &__wl_he_cap,
1169
- .n_iftype_data = 1
1170
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) */
1171
-#endif /* WL_CAP_HE */
1083
+ .n_bitrates = wl_g_rates_size
11721084 };
11731085
11741086 static struct ieee80211_supported_band __wl_band_5ghz_a = {
....@@ -1176,13 +1088,7 @@
11761088 .channels = __wl_5ghz_a_channels,
11771089 .n_channels = ARRAY_SIZE(__wl_5ghz_a_channels),
11781090 .bitrates = wl_a_rates,
1179
- .n_bitrates = wl_a_rates_size,
1180
-#ifdef WL_CAP_HE
1181
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) || defined(CONFIG_6GHZ_BKPORT)
1182
- .iftype_data = &__wl_he_cap,
1183
- .n_iftype_data = 1
1184
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) */
1185
-#endif /* WL_CAP_HE */
1091
+ .n_bitrates = wl_a_rates_size
11861092 };
11871093
11881094 #ifdef CFG80211_6G_SUPPORT
....@@ -1191,13 +1097,7 @@
11911097 .channels = __wl_6ghz_channels,
11921098 .n_channels = ARRAY_SIZE(__wl_6ghz_channels),
11931099 .bitrates = wl_a_rates,
1194
- .n_bitrates = wl_a_rates_size,
1195
-#ifdef WL_CAP_HE
1196
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) || defined(CONFIG_6GHZ_BKPORT)
1197
- .iftype_data = &__wl_he_cap,
1198
- .n_iftype_data = 1
1199
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0) */
1200
-#endif /* WL_CAP_HE */
1100
+ .n_bitrates = wl_a_rates_size
12011101 };
12021102 #endif /* CFG80211_6G_SUPPORT */
12031103
....@@ -2391,7 +2291,7 @@
23912291
23922292 WL_ERR(("%s: starts to read %s. Axi error \n", __FUNCTION__, filename));
23932293
2394
- fp = dhd_filp_open(filename, O_RDONLY, 0);
2294
+ fp = filp_open(filename, O_RDONLY, 0);
23952295
23962296 if (IS_ERR(fp) || (fp == NULL)) {
23972297 WL_ERR(("%s: Couldn't read the file, err %ld,File [%s] No previous axi error \n",
....@@ -2399,8 +2299,8 @@
23992299 return ret;
24002300 }
24012301
2402
- dhd_kernel_read_compat(fp, fp->f_pos, (char *)dhd->axi_err_dump, sizeof(dhd_axi_error_dump_t));
2403
- dhd_filp_close(fp, NULL);
2302
+ kernel_read_compat(fp, fp->f_pos, (char *)dhd->axi_err_dump, sizeof(dhd_axi_error_dump_t));
2303
+ filp_close(fp, NULL);
24042304
24052305 /* Delete axi error info file */
24062306 if (dhd_file_delete(filename) < 0) {
....@@ -3282,7 +3182,7 @@
32823182
32833183 if (addr) {
32843184 ifflags |= WL_INTERFACE_MAC_USE;
3285
- if (dhd_conf_legacy_chip_check(cfg->pub)) {
3185
+ if (wl_legacy_chip_check(ndev)) {
32863186 iface.flags = ifflags;
32873187 memcpy(&iface.mac_addr.octet, addr, ETH_ALEN);
32883188 }
....@@ -3295,7 +3195,7 @@
32953195 #endif /* WLEASYMESH */
32963196
32973197 /* Pass ver = 0 for fetching the interface_create iovar version */
3298
- if (dhd_conf_legacy_chip_check(cfg->pub)) {
3198
+ if (wl_legacy_chip_check(ndev)) {
32993199 bzero(&iface_v0, sizeof(iface_v0));
33003200 iface_v0.ver = WL_INTERFACE_CREATE_VER_0;
33013201 iface_v0.flags = iftype | ifflags;
....@@ -6483,9 +6383,6 @@
64836383
64846384 if (assoc_info.reassoc) {
64856385 /* Handle roam to same ESS */
6486
-#ifdef DHD_LOSSLESS_ROAMING
6487
- wl_ext_send_event_msg(dev, WLC_E_ROAM_PREP, WLC_E_STATUS_SUCCESS, WLC_E_REASON_LOW_RSSI);
6488
-#endif
64896386 if ((err = wl_handle_reassoc(cfg, dev, &assoc_info)) != BCME_OK) {
64906387 goto fail;
64916388 }
....@@ -6640,16 +6537,7 @@
66406537 WL_TRACE_HW4(("Aborting the scan! \n"));
66416538 wl_cfgscan_cancel_scan(cfg);
66426539 }
6643
- if (conn_in_progress || connected ||
6644
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
6645
- wdev->u.client.ssid_len)
6646
-#else
6647
- wdev->ssid_len)
6648
-#endif /* CFG80211_BKPORT_MLO */
6649
- {
6650
-#ifdef WL_EXT_IAPSTA
6651
- wl_ext_in4way_sync(dev, 0, WL_EXT_STATUS_PRE_DISCONNECTING, NULL);
6652
-#endif
6540
+ if (conn_in_progress || connected || wdev->ssid_len) {
66536541 scbval.val = reason_code;
66546542 memcpy(&scbval.ea, curbssid, ETHER_ADDR_LEN);
66556543 scbval.val = htod32(scbval.val);
....@@ -6693,12 +6581,8 @@
66936581 * disassoc indicates state mismatch with upper layer. Check for state
66946582 * and issue disconnect indication if required.
66956583 */
6696
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
6697
- if (wdev->connected || wdev->u.client.ssid_len)
6698
-#else
6699
- if (wdev->current_bss || wdev->ssid_len)
6700
-#endif /* CFG80211_BKPORT_MLO */
6701
- {
6584
+
6585
+ if (wdev->current_bss || wdev->ssid_len) {
67026586 WL_INFORM_MEM(("report disconnect event\n"));
67036587 CFG80211_DISCONNECTED(dev, 0, NULL, 0, false, GFP_KERNEL);
67046588 }
....@@ -6803,9 +6687,6 @@
68036687
68046688 static s32
68056689 wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
6806
-#if defined(CFG80211_BKPORT_MLO)
6807
- int link_id,
6808
-#endif
68096690 u8 key_idx, bool unicast, bool multicast)
68106691 {
68116692 struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
....@@ -6850,7 +6731,7 @@
68506731 s32 bssidx;
68516732 s32 mode = wl_get_mode_by_netdev(cfg, dev);
68526733
6853
- WL_MSG(dev->name, "key index (%d) for %pM\n", key_idx, mac_addr);
6734
+ WL_MSG(dev->name, "key index (%d)\n", key_idx);
68546735 if ((bssidx = wl_get_bssidx_by_wdev(cfg, dev->ieee80211_ptr)) < 0) {
68556736 WL_ERR(("Find p2p index from wdev(%p) failed\n", dev->ieee80211_ptr));
68566737 return BCME_ERROR;
....@@ -7017,9 +6898,6 @@
70176898
70186899 static s32
70196900 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
7020
-#if defined(CFG80211_BKPORT_MLO)
7021
- int link_id,
7022
-#endif
70236901 u8 key_idx, bool pairwise, const u8 *mac_addr,
70246902 struct key_params *params)
70256903 {
....@@ -7219,9 +7097,6 @@
72197097
72207098 static s32
72217099 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
7222
-#if defined(CFG80211_BKPORT_MLO)
7223
- int link_id,
7224
-#endif
72257100 u8 key_idx, bool pairwise, const u8 *mac_addr)
72267101 {
72277102 struct wl_wsec_key key;
....@@ -7285,9 +7160,6 @@
72857160 /* NOTE : this function cannot work as is and is never called */
72867161 static s32
72877162 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
7288
-#if defined(CFG80211_BKPORT_MLO)
7289
- int link_id,
7290
-#endif
72917163 u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
72927164 void (*callback) (void *cookie, struct key_params * params))
72937165 {
....@@ -7362,11 +7234,7 @@
73627234
73637235 static s32
73647236 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
7365
- struct net_device *dev,
7366
-#if defined(CFG80211_BKPORT_MLO)
7367
- int link_id,
7368
-#endif
7369
- u8 key_idx)
7237
+ struct net_device *dev, u8 key_idx)
73707238 {
73717239 #ifdef MFP
73727240 /* Firmware seems to use hard coded index for Group Mgmt Key.
....@@ -10267,7 +10135,7 @@
1026710135 chan = &band->channels[idx];
1026810136 /* Setting current channel to the requested channel */
1026910137 if ((err = wl_cfg80211_set_channel(wiphy, ndev, chan,
10270
- NL80211_CHAN_WIDTH_20) < 0)) {
10138
+ NL80211_CHAN_HT20) < 0)) {
1027110139 /*
1027210140 * FIXME:
1027310141 *
....@@ -10349,34 +10217,6 @@
1034910217 return err;
1035010218 }
1035110219 #endif /* WL_SUPPORT_ACS */
10352
-
10353
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
10354
-static int
10355
-wl_cfg80211_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
10356
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
10357
- unsigned int link_id,
10358
-#endif
10359
- struct cfg80211_chan_def *chandef)
10360
-{
10361
- struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
10362
- u32 chanspec = 0;
10363
- int ret = 0;
10364
-
10365
- RETURN_EIO_IF_NOT_UP(cfg);
10366
- if (NULL == wdev->netdev) {
10367
- /* the P2P interface may temporary use wdev without ndev */
10368
- return -EINVAL;
10369
- }
10370
-
10371
- if ((ret = wldev_iovar_getint(wdev->netdev, "chanspec", (s32 *)&chanspec) != BCME_OK)) {
10372
- return ret;
10373
- }
10374
- if (!chandef || (wl_chspec_chandef(chanspec, chandef, wiphy) != BCME_OK)) {
10375
- return BCME_ERROR;
10376
- }
10377
- return 0;
10378
-}
10379
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0) */
1038010220
1038110221 static struct cfg80211_ops wl_cfg80211_ops = {
1038210222 .add_virtual_intf = wl_cfg80211_add_virtual_iface,
....@@ -10475,9 +10315,6 @@
1047510315 .update_ft_ies = wl_cfg80211_update_ft_ies,
1047610316 #endif /* WLFBT */
1047710317 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
10478
-#if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0)
10479
- .get_channel = wl_cfg80211_get_channel,
10480
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0) */
1048110318 };
1048210319
1048310320 s32 wl_mode_to_nl80211_iftype(s32 mode)
....@@ -10516,7 +10353,7 @@
1051610353 GCC_DIAGNOSTIC_POP();
1051710354 if (iter->ndev) {
1051810355 if (wl_get_drv_status(cfg, AP_CREATED, iter->ndev)) {
10519
- WL_ERR(("AP active. skip coutry ccode change\n"));
10356
+ WL_ERR(("AP active. skip coutry ccode change"));
1052010357 return false;
1052110358 }
1052210359 }
....@@ -10524,7 +10361,7 @@
1052410361
1052510362 #ifdef WL_NAN
1052610363 if (wl_cfgnan_is_enabled(cfg) && wl_cfgnan_is_dp_active(net)) {
10527
- WL_ERR(("NDP established. skip coutry ccode change\n"));
10364
+ WL_ERR(("NDP established. skip coutry ccode change"));
1052810365 return false;
1052910366 }
1053010367 #endif /* WL_NAN */
....@@ -11061,7 +10898,7 @@
1106110898 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && defined(SUPPORT_RANDOM_MAC_SCAN) */
1106210899
1106310900 #if defined(WL_SAE) || defined(WL_CLIENT_SAE)
11064
- if (dhd_conf_extsae_chip(dhd))
10901
+ if (wl_extsae_chip(dhd))
1106510902 wdev->wiphy->features |= NL80211_FEATURE_SAE;
1106610903 #endif /* WL_SAE || WL_CLIENT_SAE */
1106710904 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)) && defined(BCMSUP_4WAY_HANDSHAKE)
....@@ -11078,6 +10915,10 @@
1107810915 wiphy_ext_feature_set(wdev->wiphy, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN);
1107910916 wdev->wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN;
1108010917 #endif /* WL_SCAN_TYPE */
10918
+
10919
+#ifdef DHD_PNO_FLAG
10920
+ wiphy_ext_feature_set(wdev->wiphy, NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI);
10921
+#endif
1108110922
1108210923 /* Now we can register wiphy with cfg80211 module */
1108310924 err = wiphy_register(wdev->wiphy);
....@@ -12414,7 +12255,7 @@
1241412255 memcpy(&emsg, as->event_msg, sizeof(wl_event_msg_t));
1241512256 ret = wl_ext_in4way_sync(ndev, STA_REASSOC_RETRY,
1241612257 WL_EXT_STATUS_RECONNECT, &emsg);
12417
- if (ret == BCME_ERROR)
12258
+ if (ret)
1241812259 return 0;
1241912260 }
1242012261 wl_ext_iapsta_enable_master_if(ndev, FALSE);
....@@ -12570,13 +12411,7 @@
1257012411 memcpy(&emsg, as->event_msg, sizeof(wl_event_msg_t));
1257112412 ret = wl_ext_in4way_sync(ndev, STA_REASSOC_RETRY,
1257212413 WL_EXT_STATUS_RECONNECT, &emsg);
12573
- if (ret == BCME_BADADDR) {
12574
- u8 *curbssid = NULL;
12575
- curbssid = wl_read_prof(cfg, ndev, WL_PROF_BSSID);
12576
- if (curbssid)
12577
- (void)memcpy_s(as->addr, ETH_ALEN, curbssid, ETH_ALEN);
12578
- }
12579
- else if (ret == BCME_ERROR)
12414
+ if (ret)
1258012415 return 0;
1258112416 }
1258212417 #endif
....@@ -12700,11 +12535,6 @@
1270012535 wl_ext_iapsta_restart_master(ndev);
1270112536 }
1270212537 #endif
12703
-
12704
- if (wl_get_drv_status(cfg, DISCONNECTING, ndev)) {
12705
- /* If DISCONNECTING bit is set, mark locally generated */
12706
- loc_gen = 1;
12707
- }
1270812538
1270912539 CFG80211_DISCONNECTED(ndev, reason, ie_ptr, ie_len,
1271012540 loc_gen, GFP_KERNEL);
....@@ -12953,22 +12783,6 @@
1295312783 goto exit;
1295412784 }
1295512785
12956
-#ifdef WL_ROAM_WAR
12957
- if (event_type == WLC_E_JOIN)
12958
- bzero((u8*)&cfg->roaming_bssid, ETHER_ADDR_LEN);
12959
- else if (wl_get_drv_status(cfg, CONNECTED, ndev)) {
12960
- if (event_type == WLC_E_AUTH && ntoh32(e->status) == WLC_E_STATUS_SUCCESS)
12961
- bcopy(&e->addr, &cfg->roaming_bssid, ETHER_ADDR_LEN);
12962
- else if (event_type == WLC_E_DEAUTH &&
12963
- !ETHER_ISNULLADDR(&cfg->roaming_bssid.octet) &&
12964
- memcmp(&e->addr, &cfg->roaming_bssid, ETHER_ADDR_LEN)) {
12965
- WL_MSG(ndev->name, "skip WLC_E_DEAUTH(%pM), roaming_bssid %pM\n",
12966
- &e->addr, &cfg->roaming_bssid);
12967
- goto exit;
12968
- }
12969
- }
12970
-#endif /* WL_ROAM_WAR */
12971
-
1297212786 if (wl_get_drv_status(cfg, CONNECTING, ndev)) {
1297312787 assoc_state = WL_STATE_ASSOCIATING;
1297412788 } else if (wl_get_drv_status(cfg, CONNECTED, ndev)) {
....@@ -13117,14 +12931,8 @@
1311712931 ndev = cfgdev_to_wlc_ndev(cfgdev, cfg);
1311812932 if (ndev) {
1311912933 wdev = ndev->ieee80211_ptr;
13120
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
13121
- wdev->u.client.ssid_len =
13122
- min(ssid->SSID_len, (uint32)DOT11_MAX_SSID_LEN);
13123
- memcpy(wdev->u.client.ssid, ssid->SSID, wdev->u.client.ssid_len);
13124
-#else
1312512934 wdev->ssid_len = min(ssid->SSID_len, (uint32)DOT11_MAX_SSID_LEN);
1312612935 memcpy(wdev->ssid, ssid->SSID, wdev->ssid_len);
13127
-#endif /* CFG80211_BKPORT_MLO */
1312812936 WL_ERR(("SSID is %s\n", ssid->SSID));
1312912937 wl_update_prof(cfg, ndev, NULL, ssid, WL_PROF_SSID);
1313012938 } else {
....@@ -13671,6 +13479,7 @@
1367113479 return err;
1367213480 }
1367313481
13482
+#ifdef DHD_LOSSLESS_ROAMING
1367413483 static s32
1367513484 wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
1367613485 const wl_event_msg_t *e, void *data)
....@@ -13678,14 +13487,14 @@
1367813487 struct wl_connect_info *conn_info = wl_to_conn(cfg);
1367913488 s32 err = 0;
1368013489 u8 *curbssid;
13681
- chanspec_t *chanspec, cur_chanspec;
13490
+ chanspec_t *chanspec;
1368213491 scb_val_t scbval;
1368313492 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || \
1368413493 defined(WL_COMPAT_WIRELESS)
1368513494 struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
1368613495 struct ieee80211_channel *notify_channel = NULL;
1368713496 u32 freq;
13688
- u32 cur_channel, orig_channel;
13497
+ u32 cur_channel, cur_chanspec, orig_channel;
1368913498 #endif /* LINUX_VERSION > 2.6.39 || WL_COMPAT_WIRELESS */
1369013499 #if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
1369113500 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || \
....@@ -13726,13 +13535,10 @@
1372613535 cur_channel = wf_chspec_ctlchan(wl_chspec_driver_to_host(cur_chanspec));
1372713536 orig_channel = wf_chspec_ctlchan(wl_chspec_driver_to_host(*chanspec));
1372813537 if (dhdp->conf->chip != BCM43569_CHIP_ID) {
13729
- if (((orig_channel == cur_channel) && memcmp(&ether_null, &cfg->last_roamed_addr, ETHER_ADDR_LEN)) &&
13538
+ if ((orig_channel == cur_channel) &&
1373013539 ((memcmp(curbssid, &e->addr, ETHER_ADDR_LEN) == 0) ||
1373113540 (memcmp(&cfg->last_roamed_addr, &e->addr, ETHER_ADDR_LEN) == 0))) {
13732
- WL_INFORM_MEM(("BSS already present, Skipping roamed event to upper layer\n"));
13733
- WL_INFORM_MEM(("orig_chan/cur_chan=%d/%d, addr/curbssid/last_roamed_addr=%pM/%pM/%pM\n",
13734
- orig_channel, cur_channel,
13735
- (const u8*)(&e->addr), curbssid, (const u8*)(&cfg->last_roamed_addr)));
13541
+ WL_DBG(("BSS already present, Skipping roamed event to upper layer\n"));
1373613542 goto fail;
1373713543 }
1373813544 }
....@@ -13766,15 +13572,13 @@
1376613572 }
1376713573 rssi = dtoh32(scbval.val);
1376813574
13769
- WL_MSG(ndev->name, "%pM(chan=%s-%d/%sMHz) => %pM(chan=%s-%d/%sMHz, rssi: %3d)\n",
13770
- curbssid,
13771
- CHSPEC2BANDSTR(*chanspec), wf_chspec_ctlchan(*chanspec),
13575
+ WL_MSG(ndev->name, "%pM(ch:%3d/%sMHz) => %pM(ch:%3d/%sMHz, rssi: %3d)\n",
13576
+ curbssid, orig_channel,
1377213577 CHSPEC_IS20(*chanspec)?"20":
1377313578 CHSPEC_IS40(*chanspec)?"40":
1377413579 CHSPEC_IS80(*chanspec)?"80":
1377513580 CHSPEC_IS160(*chanspec)?"160":"??",
13776
- (const u8*)(&e->addr),
13777
- CHSPEC2BANDSTR(cur_chanspec), wf_chspec_ctlchan(cur_chanspec),
13581
+ (const u8*)(&e->addr), cur_channel,
1377813582 CHSPEC_IS20(cur_chanspec)?"20":
1377913583 CHSPEC_IS40(cur_chanspec)?"40":
1378013584 CHSPEC_IS80(cur_chanspec)?"80":
....@@ -13815,20 +13619,15 @@
1381513619 DHD_STATLOG_CTRL(dhdp, ST(REASSOC_INFORM),
1381613620 dhd_net2idx(dhdp->info, ndev), 0);
1381713621 #ifdef WL_EXT_IAPSTA
13818
- wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_ROAMED, NULL);
13622
+ wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
1381913623 #endif
1382013624
1382113625 #if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
1382213626 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || \
1382313627 defined(WL_FILS_ROAM_OFFLD) || defined(CFG80211_ROAM_API_GE_4_12)
1382413628 memset(&roam_info, 0, sizeof(struct cfg80211_roam_info));
13825
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || defined(CFG80211_BKPORT_MLO)
13826
- roam_info.links[0].channel = notify_channel;
13827
- roam_info.links[0].bssid = curbssid;
13828
-#else
1382913629 roam_info.channel = notify_channel;
1383013630 roam_info.bssid = curbssid;
13831
-#endif /* CFG80211_BKPORT_MLO */
1383213631 roam_info.req_ie = conn_info->req_ie;
1383313632 roam_info.req_ie_len = conn_info->req_ie_len;
1383413633 roam_info.resp_ie = conn_info->resp_ie;
....@@ -13881,15 +13680,12 @@
1388113680 return err;
1388213681
1388313682 fail:
13884
-#ifdef WL_EXT_IAPSTA
13885
- if (err)
13886
- wl_ext_in4way_sync(ndev, STA_NO_BTC_IN4WAY, WL_EXT_STATUS_DISCONNECTED, NULL);
13887
-#endif
1388813683 #ifdef DHD_LOSSLESS_ROAMING
1388913684 wl_del_roam_timeout(cfg);
1389013685 #endif /* DHD_LOSSLESS_ROAMING */
1389113686 return err;
1389213687 }
13688
+#endif /* DHD_LOSSLESS_ROAMING */
1389313689
1389413690 static bool
1389513691 wl_cfg80211_verify_bss(struct bcm_cfg80211 *cfg, struct net_device *ndev,
....@@ -14025,21 +13821,10 @@
1402513821
1402613822 resp_params = (struct cfg80211_connect_resp_params *)params;
1402713823 resp_params->status = status;
14028
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || defined(CFG80211_BKPORT_MLO)
14029
- resp_params->links[0].bssid = curbssid;
14030
- resp_params->links[0].bss = CFG80211_GET_BSS(wiphy, NULL, curbssid,
14031
- ssid->SSID, ssid->SSID_len);
14032
-#else
1403313824 resp_params->bssid = curbssid;
1403413825 resp_params->bss = CFG80211_GET_BSS(wiphy, NULL, curbssid,
1403513826 ssid->SSID, ssid->SSID_len);
14036
-#endif
14037
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || defined(CFG80211_BKPORT_MLO)
14038
- if (!resp_params->links[0].bss)
14039
-#else
14040
- if (!resp_params->bss)
14041
-#endif /* CFG80211_BKPORT_MLO */
14042
- {
13827
+ if (!resp_params->bss) {
1404313828 WL_ERR(("null bss\n"));
1404413829 return BCME_ERROR;
1404513830 }
....@@ -14149,12 +13934,7 @@
1414913934 completed = false;
1415013935 sec->auth_assoc_res_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
1415113936 }
14152
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
14153
- if (!ndev->ieee80211_ptr->u.client.ssid_len)
14154
-#else
14155
- if (!ndev->ieee80211_ptr->ssid_len)
14156
-#endif /* CFG80211_BKPORT_MLO */
14157
- {
13937
+ if (!ndev->ieee80211_ptr->ssid_len) {
1415813938 /* In certain cases, the delayed cfg80211 work from
1415913939 * disconnect context will induce race conditions in
1416013940 * which the ssid_len will be cleared, but dhd is in
....@@ -14182,6 +13962,10 @@
1418213962
1418313963 if (completed) {
1418413964 WL_MSG(ndev->name, "Report connect result - connection succeeded\n");
13965
+#ifdef WL_EXT_IAPSTA
13966
+ wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
13967
+ wl_ext_iapsta_enable_master_if(ndev, TRUE);
13968
+#endif
1418513969 } else {
1418613970 WL_MSG(ndev->name, "Report connect result - connection failed\n");
1418713971 #ifdef WL_EXT_IAPSTA
....@@ -14230,13 +14014,6 @@
1423014014 }
1423114015 #endif /* WAPI */
1423214016 }
14233
-
14234
-#ifdef WL_EXT_IAPSTA
14235
- if (completed) {
14236
- wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
14237
- wl_ext_iapsta_enable_master_if(ndev, TRUE);
14238
- }
14239
-#endif
1424014017
1424114018 exit:
1424214019 CLR_TS(cfg, conn_start);
....@@ -14847,11 +14624,11 @@
1484714624 wl_cfg80211_ccode_evt_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
1484814625 const wl_event_msg_t *event, void *data)
1484914626 {
14850
- dhd_pub_t *dhd = cfg->pub;
1485114627 s32 err = 0;
1485214628 struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
1485314629 char country_str[WLC_CNTRY_BUF_SZ] = { 0 };
1485414630 struct net_device *dev = bcmcfg_to_prmry_ndev(cfg);
14631
+ wl_country_t cspec = {{0}, 0, {0}};
1485514632
1485614633 if (strlcpy(country_str, data, WL_CCODE_LEN + 1) >= WLC_CNTRY_BUF_SZ) {
1485714634 return -EINVAL;
....@@ -14864,7 +14641,18 @@
1486414641 }
1486514642
1486614643 WL_MSG(dev->name, "Updating new country %s\n", country_str);
14867
- dhd_conf_country(dhd, "country", country_str);
14644
+
14645
+ strlcpy(cspec.country_abbrev, country_str, WL_CCODE_LEN + 1);
14646
+ strlcpy(cspec.ccode, country_str, WL_CCODE_LEN + 1);
14647
+ err = dhd_conf_map_country_list(dhd_get_pub(dev), &cspec);
14648
+ if (err)
14649
+ dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec);
14650
+ err = dhd_conf_set_country(dhd_get_pub(dev), &cspec);
14651
+ if (err < 0) {
14652
+ WL_ERR(("set country for %s as %s rev %d failed\n",
14653
+ country_str, cspec.ccode, cspec.rev));
14654
+ }
14655
+ dhd_conf_fix_country(dhd_get_pub(dev));
1486814656
1486914657 /* Indicate to upper layer for regdom change */
1487014658 err = wl_update_wiphybands(cfg, true);
....@@ -15010,11 +14798,9 @@
1501014798 cfg->evt_handler[WLC_E_BSS_LOAD] = wl_cfg80211_bssload_report_event_handler;
1501114799 #endif /* WL_CHAN_UTIL */
1501214800 #ifdef WL_TWT
15013
- cfg->evt_handler[WLC_E_TWT] = wl_notify_twt_event;
15014
-#else
15015
-#ifdef WL_TWT_HAL_IF
15016
- cfg->evt_handler[WLC_E_TWT] = wl_cfgvendor_notify_twt_event;
15017
-#endif /* WL_TWT_HAL_IF */
14801
+ cfg->evt_handler[WLC_E_TWT_SETUP] = wl_notify_twt_event;
14802
+ cfg->evt_handler[WLC_E_TWT_TEARDOWN] = wl_notify_twt_event;
14803
+ cfg->evt_handler[WLC_E_TWT_INFO_FRM] = wl_notify_twt_event;
1501814804 #endif /* WL_TWT */
1501914805 #ifdef WL_CLIENT_SAE
1502014806 cfg->evt_handler[WLC_E_JOIN_START] = wl_notify_start_auth;
....@@ -15394,7 +15180,7 @@
1539415180
1539515181 wdev = ndev_to_wdev(dev);
1539615182 if (!wdev) {
15397
- WL_DBG(("wdev(%s) null. Do nothing\n", dev->name));
15183
+ WL_ERR(("wdev null. Do nothing\n"));
1539815184 return NOTIFY_DONE;
1539915185 }
1540015186
....@@ -15901,6 +15687,9 @@
1590115687 wl_destroy_event_handler(cfg);
1590215688 wl_flush_eq(cfg);
1590315689 wl_link_down(cfg);
15690
+#if defined (WL_SCHED_SCAN) && defined (SCHED_SCAN_DELAYED_WORK)
15691
+ cancel_delayed_work_sync(&cfg->sched_scan_stop_work);
15692
+#endif /* WL_SCHED_SCAN */
1590415693 del_timer_sync(&cfg->scan_timeout);
1590515694 #ifdef DHD_LOSSLESS_ROAMING
1590615695 del_timer_sync(&cfg->roam_timeout);
....@@ -16167,6 +15956,9 @@
1616715956 INIT_WORK(&cfg->wlan_work, wl_cfg80211_work_handler);
1616815957 #endif /* DHCP_SCAN_SUPPRESS */
1616915958
15959
+#if defined (WL_SCHED_SCAN) && defined (SCHED_SCAN_DELAYED_WORK)
15960
+ INIT_DELAYED_WORK(&cfg->sched_scan_stop_work, wl_cfgscan_sched_scan_stop_work);
15961
+#endif /* WL_SCHED_SCAN */
1617015962 INIT_DELAYED_WORK(&cfg->pm_enable_work, wl_cfg80211_work_handler);
1617115963 INIT_DELAYED_WORK(&cfg->loc.work, wl_cfgscan_listen_complete_work);
1617215964 INIT_DELAYED_WORK(&cfg->ap_work, wl_cfg80211_ap_timeout_work);
....@@ -16433,7 +16225,7 @@
1643316225
1643416226 #ifdef OEM_ANDROID
1643516227 if (cfg->event_workq == NULL) {
16436
- WL_ERR(("Event handler is not created (%s)\n", bcmevent_get_name(event_type)));
16228
+ WL_ERR(("Event handler is not created\n"));
1643716229 return;
1643816230 }
1643916231 #endif /* OEM_ANDROID */
....@@ -16820,8 +16612,7 @@
1682016612 return err;
1682116613 }
1682216614
16823
-static int wl_construct_reginfo(struct bcm_cfg80211 *cfg, s32 bw_cap_2g,
16824
- s32 bw_cap_5g, s32 bw_cap_6g)
16615
+static int wl_construct_reginfo(struct bcm_cfg80211 *cfg, s32 bw_cap)
1682516616 {
1682616617 struct net_device *dev = bcmcfg_to_prmry_ndev(cfg);
1682716618 struct ieee80211_channel *band_chan_arr = NULL;
....@@ -16889,13 +16680,14 @@
1688916680 (channel <= CH_MAX_2G_CHANNEL)) {
1689016681 band_chan_arr = __wl_2ghz_channels;
1689116682 array_size = ARRAYSIZE(__wl_2ghz_channels);
16683
+ ht40_allowed = (bw_cap == WLC_N_BW_40ALL)? true : false;
1689216684 }
1689316685 #ifdef CFG80211_6G_SUPPORT
1689416686 else if (CHSPEC_IS6G(chspec) && (channel >= CH_MIN_6G_CHANNEL) &&
1689516687 (channel <= CH_MAX_6G_CHANNEL)) {
1689616688 band_chan_arr = __wl_6ghz_channels;
1689716689 array_size = ARRAYSIZE(__wl_6ghz_channels);
16898
- ht40_allowed = WL_BW_CAP_40MHZ(bw_cap_6g);
16690
+ ht40_allowed = (bw_cap == WLC_N_BW_20ALL)? false : true;
1689916691 }
1690016692 #endif /* CFG80211_6G_SUPPORT */
1690116693 else if (
....@@ -16909,7 +16701,7 @@
1690916701 (CHSPEC_IS5G(chspec) && channel >= CH_MIN_5G_CHANNEL)) {
1691016702 band_chan_arr = __wl_5ghz_a_channels;
1691116703 array_size = ARRAYSIZE(__wl_5ghz_a_channels);
16912
- ht40_allowed = WL_BW_CAP_40MHZ(bw_cap_5g);
16704
+ ht40_allowed = (bw_cap == WLC_N_BW_20ALL)? false : true;
1691316705 } else {
1691416706 WL_ERR(("Invalid channel Sepc. 0x%x.\n", chspec));
1691516707 continue;
....@@ -16917,7 +16709,7 @@
1691716709 if (!ht40_allowed && CHSPEC_IS40(chspec))
1691816710 continue;
1691916711 for (j = 0; j < array_size; j++) {
16920
- if (band_chan_arr[j].hw_value == wf_chspec_primary20_chspec(chspec)) {
16712
+ if (band_chan_arr[j].hw_value == chspec) {
1692116713 break;
1692216714 }
1692316715 }
....@@ -16932,7 +16724,7 @@
1693216724 band_chan_arr[index].center_freq =
1693316725 wl_channel_to_frequency(channel, CHSPEC_BAND(chspec));
1693416726 #endif
16935
- band_chan_arr[index].hw_value = wf_chspec_primary20_chspec(chspec);
16727
+ band_chan_arr[index].hw_value = chspec;
1693616728 band_chan_arr[index].beacon_found = false;
1693716729 band_chan_arr[index].flags &= ~IEEE80211_CHAN_DISABLED;
1693816730
....@@ -16940,14 +16732,12 @@
1694016732 /* assuming the order is HT20, HT40 Upper,
1694116733 * HT40 lower from chanspecs
1694216734 */
16943
- u32 ht40_flag =
16944
- band_chan_arr[index].flags & IEEE80211_CHAN_NO_HT40;
16735
+ u32 ht40_flag = band_chan_arr[index].flags & IEEE80211_CHAN_NO_HT40;
1694516736 if (CHSPEC_SB_UPPER(chspec)) {
1694616737 if (ht40_flag == IEEE80211_CHAN_NO_HT40)
1694716738 band_chan_arr[index].flags &=
1694816739 ~IEEE80211_CHAN_NO_HT40;
16949
- band_chan_arr[index].flags |=
16950
- IEEE80211_CHAN_NO_HT40PLUS;
16740
+ band_chan_arr[index].flags |= IEEE80211_CHAN_NO_HT40PLUS;
1695116741 } else {
1695216742 /* It should be one of
1695316743 * IEEE80211_CHAN_NO_HT40 or IEEE80211_CHAN_NO_HT40PLUS
....@@ -16972,12 +16762,6 @@
1697216762 }
1697316763
1697416764 }
16975
-
16976
- WL_CHANNEL_COPY_FLAG(__wl_2ghz_channels);
16977
- WL_CHANNEL_COPY_FLAG(__wl_5ghz_a_channels);
16978
-#ifdef CFG80211_6G_SUPPORT
16979
- WL_CHANNEL_COPY_FLAG(__wl_6ghz_channels);
16980
-#endif /* CFG80211_6G_SUPPORT */
1698116765
1698216766 __wl_band_2ghz.n_channels = ARRAYSIZE(__wl_2ghz_channels);
1698316767 __wl_band_5ghz_a.n_channels = ARRAYSIZE(__wl_5ghz_a_channels);
....@@ -17017,8 +16801,8 @@
1701716801 s32 err = 0;
1701816802 s32 index = 0;
1701916803 s32 nmode = 0;
16804
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) || defined(CUSTOMER_HW5)
1702016805 u32 j = 0;
17021
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
1702216806 s32 vhtmode = 0;
1702316807 s32 txstreams = 0;
1702416808 s32 rxstreams = 0;
....@@ -17027,14 +16811,11 @@
1702716811 s32 stbc_tx = 0;
1702816812 s32 txbf_bfe_cap = 0;
1702916813 s32 txbf_bfr_cap = 0;
17030
-#endif
17031
- s32 txchain = 0;
17032
- s32 rxchain = 0;
17033
- s32 bw_cap_2g = 0, bw_cap_5g = 0, bw_cap_6g = 0;
16814
+#endif /* KERNEL >= 3.6 || CUSTOMER_HW5 */
16815
+ s32 bw_cap = 0;
1703416816 s32 cur_band = -1;
1703516817 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS] = {NULL, };
1703616818
17037
- WL_INFORM(("%s: Enter\n", __FUNCTION__));
1703816819 bzero(bandlist, sizeof(bandlist));
1703916820 err = wldev_ioctl_get(dev, WLC_GET_BANDLIST, bandlist,
1704016821 sizeof(bandlist));
....@@ -17054,7 +16835,7 @@
1705416835 WL_ERR(("error reading nmode (%d)\n", err));
1705516836 }
1705616837
17057
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
16838
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) || defined(CUSTOMER_HW5)
1705816839 err = wldev_iovar_getint(dev, "vhtmode", &vhtmode);
1705916840 if (unlikely(err)) {
1706016841 WL_ERR(("error reading vhtmode (%d)\n", err));
....@@ -17096,58 +16877,25 @@
1709616877 WL_ERR(("error reading txbf_bfr_cap (%d)\n", err));
1709716878 }
1709816879 }
17099
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) */
17100
-
17101
- err = wldev_iovar_getint(dev, "txchain", &txchain);
17102
- if (unlikely(err)) {
17103
- WL_ERR(("error reading txchain (%d)\n", err));
17104
- } else if (txchain == 0x03) {
17105
- txchain = 2;
17106
- } else {
17107
- txchain = 1;
17108
- }
17109
- err = wldev_iovar_getint(dev, "rxchain", &rxchain);
17110
- if (unlikely(err)) {
17111
- WL_ERR(("error reading rxchain (%d)\n", err));
17112
- } else if (rxchain == 0x03) {
17113
- rxchain = 2;
17114
- } else {
17115
- rxchain = 1;
17116
- }
16880
+#endif /* KERNEL >= 3.6 || CUSTOMER_HW5 */
1711716881
1711816882 /* For nmode and vhtmode check bw cap */
1711916883 if (nmode ||
17120
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
16884
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) || defined(CUSTOMER_HW5)
1712116885 vhtmode ||
17122
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) */
16886
+#endif /* KERNEL >= 3.6 || CUSTOMER_HW5 */
1712316887 0) {
17124
- uint32 value;
17125
-
17126
- value = WLC_BAND_2G;
17127
- err = wldev_iovar_getint(dev, "bw_cap", &value);
16888
+ err = wldev_iovar_getint(dev, "mimo_bw_cap", &bw_cap);
1712816889 if (unlikely(err)) {
17129
- WL_ERR(("error get bw_cap 2g (%d)\n", err));
16890
+ WL_ERR(("error get mimo_bw_cap (%d)\n", err));
1713016891 }
17131
- bw_cap_2g = dtoh32(value);
17132
- value = WLC_BAND_5G;
17133
- err = wldev_iovar_getint(dev, "bw_cap", &value);
17134
- if (unlikely(err)) {
17135
- WL_ERR(("error get bw_cap 5g (%d)\n", err));
17136
- }
17137
- bw_cap_5g = dtoh32(value);
17138
- value = WLC_BAND_6G;
17139
- err = wldev_iovar_getint(dev, "bw_cap", &value);
17140
- if (unlikely(err)) {
17141
- WL_ERR(("error get bw_cap 6g (%d)\n", err));
17142
- }
17143
- bw_cap_6g = dtoh32(value);
1714416892 }
1714516893
1714616894 #ifdef WL_6G_BAND
1714716895 wl_is_6g_supported(cfg, bandlist, bandlist[0]);
1714816896 #endif /* WL_6G_BAND */
1714916897
17150
- err = wl_construct_reginfo(cfg, bw_cap_2g, bw_cap_5g, bw_cap_6g);
16898
+ err = wl_construct_reginfo(cfg, bw_cap);
1715116899 if (err) {
1715216900 WL_ERR(("wl_construct_reginfo() fails err=%d\n", err));
1715316901 if (err != BCME_UNSUPPORTED)
....@@ -17157,9 +16905,6 @@
1715716905 wiphy = bcmcfg_to_wiphy(cfg);
1715816906 nband = bandlist[0];
1715916907
17160
- wiphy->available_antennas_tx = txchain;
17161
- wiphy->available_antennas_rx = rxchain;
17162
-
1716316908 for (i = 1; i <= nband && i < ARRAYSIZE(bandlist); i++) {
1716416909 index = -1;
1716516910
....@@ -17167,18 +16912,8 @@
1716716912 bands[IEEE80211_BAND_2GHZ] =
1716816913 &__wl_band_2ghz;
1716916914 index = IEEE80211_BAND_2GHZ;
17170
- (void)memset_s(bands[index]->ht_cap.mcs.rx_mask, IEEE80211_HT_MCS_MASK_LEN,
17171
- 0, IEEE80211_HT_MCS_MASK_LEN);
17172
- if (nmode && (WL_BW_CAP_40MHZ(bw_cap_2g))) {
17173
- bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
17174
- IEEE80211_HT_CAP_SGI_40;
17175
- bands[index]->ht_cap.mcs.rx_mask[4] = 0x01;
17176
- bands[index]->ht_cap.mcs.rx_highest =
17177
- cpu_to_le16(150 * rxchain); /* Mbps */
17178
- } else {
17179
- bands[index]->ht_cap.mcs.rx_highest =
17180
- cpu_to_le16(72 * rxchain); /* Mbps */
17181
- }
16915
+ if (bw_cap == WLC_N_BW_40ALL)
16916
+ bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
1718216917 } else {
1718316918 if (bandlist[i] == WLC_BAND_6G) {
1718416919 #ifdef CFG80211_6G_SUPPORT
....@@ -17209,26 +16944,14 @@
1720916944 continue;
1721016945 }
1721116946
17212
- (void)memset_s(bands[index]->ht_cap.mcs.rx_mask, IEEE80211_HT_MCS_MASK_LEN,
17213
- 0, IEEE80211_HT_MCS_MASK_LEN);
17214
- if (nmode && (WL_BW_CAP_40MHZ(bw_cap_5g))) {
17215
- bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
17216
- IEEE80211_HT_CAP_SGI_40;
17217
- bands[index]->ht_cap.mcs.rx_mask[4] = 0x01;
17218
- bands[index]->ht_cap.mcs.rx_highest = cpu_to_le16(150 * rxchain);
17219
- } else {
17220
- bands[index]->ht_cap.mcs.rx_highest = cpu_to_le16(72 * rxchain);
17221
- }
16947
+ if (nmode && (bw_cap == WLC_N_BW_40ALL || bw_cap == WLC_N_BW_20IN2G_40IN5G))
16948
+ bands[index]->ht_cap.cap |= IEEE80211_HT_CAP_SGI_40;
1722216949
17223
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0))
16950
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)) || defined(CUSTOMER_HW5)
1722416951 /* VHT capabilities. */
1722516952 if (vhtmode) {
1722616953 /* Supported */
1722716954 bands[index]->vht_cap.vht_supported = TRUE;
17228
- bands[index]->vht_cap.vht_mcs.tx_highest =
17229
- cpu_to_le16(433 * txstreams); /* Mbps */
17230
- bands[index]->vht_cap.vht_mcs.rx_highest =
17231
- cpu_to_le16(433 * txstreams); /* Mbps */
1723216955
1723316956 for (j = 1; j <= VHT_CAP_MCS_MAP_NSS_MAX; j++) {
1723416957 /* TX stream rates. */
....@@ -17251,13 +16974,11 @@
1725116974 }
1725216975
1725316976 /* Capabilities */
17254
- bands[index]->vht_cap.cap |= IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN
17255
- | IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
1725616977 /* 80 MHz is mandatory */
1725716978 bands[index]->vht_cap.cap |=
1725816979 IEEE80211_VHT_CAP_SHORT_GI_80;
1725916980
17260
- if (WL_BW_CAP_160MHZ(bw_cap_5g)) {
16981
+ if (WL_BW_CAP_160MHZ(bw_cap)) {
1726116982 bands[index]->vht_cap.cap |=
1726216983 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ;
1726316984 bands[index]->vht_cap.cap |=
....@@ -17309,7 +17030,7 @@
1730917030 bands[index]->vht_cap.vht_mcs.rx_mcs_map,
1731017031 bands[index]->vht_cap.vht_mcs.tx_mcs_map));
1731117032 }
17312
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) */
17033
+#endif /* KERNEL >= 3.6 || CUSTOMER_HW5 */
1731317034 }
1731417035
1731517036 if ((index >= 0) && nmode) {
....@@ -17319,10 +17040,7 @@
1731917040 bands[index]->ht_cap.ampdu_factor = IEEE80211_HT_MAX_AMPDU_64K;
1732017041 bands[index]->ht_cap.ampdu_density = IEEE80211_HT_MPDU_DENSITY_16;
1732117042 /* An HT shall support all EQM rates for one spatial stream */
17322
- for (j = 0; j < rxchain; j++) {
17323
- bands[index]->ht_cap.mcs.rx_mask[j] = 0xff;
17324
- }
17325
- bands[index]->ht_cap.mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
17043
+ bands[index]->ht_cap.mcs.rx_mask[0] = 0xff;
1732617044 }
1732717045
1732817046 }
....@@ -17407,10 +17125,6 @@
1740717125 /* Start the event logging */
1740817126 wl_add_remove_eventmsg(ndev, WLC_E_TRACE, TRUE);
1740917127 #endif /* SHOW_LOGTRACE */
17410
-#if defined(BCMDBUS)
17411
- if (!dhd->dhd_console_ms)
17412
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, FALSE);
17413
-#endif
1741417128
1741517129 (void)memcpy_s(wdev->wiphy->perm_addr, ETHER_ADDR_LEN,
1741617130 bcmcfg_to_prmry_ndev(cfg)->perm_addr, ETHER_ADDR_LEN);
....@@ -17567,77 +17281,6 @@
1756717281 return err;
1756817282 }
1756917283
17570
-#ifdef BCMDBUS
17571
-s32
17572
-__wl_cfg80211_up_resume(dhd_pub_t *dhd)
17573
-{
17574
- struct net_device *ndev = dhd_linux_get_primary_netdev(dhd);
17575
- struct bcm_cfg80211 *cfg;
17576
- struct wireless_dev *wdev;
17577
- s32 err = 0;
17578
-#ifdef WL_HOST_BAND_MGMT
17579
- s32 ret = 0;
17580
-#endif /* WL_HOST_BAND_MGMT */
17581
- u16 wl_iftype = 0;
17582
- u16 wl_mode = 0;
17583
-
17584
- WL_DBG(("In\n"));
17585
-
17586
- if (!ndev)
17587
- return -EINVAL;
17588
- cfg = wl_get_cfg(ndev);
17589
- wdev = ndev->ieee80211_ptr;
17590
- if (!cfg || !wdev)
17591
- return -EINVAL;
17592
-
17593
-#if defined(BCMDONGLEHOST)
17594
- err = dhd_config_dongle(cfg);
17595
- if (unlikely(err))
17596
- return err;
17597
-#endif /* defined(BCMDONGLEHOST) */
17598
-
17599
-#ifdef SHOW_LOGTRACE
17600
- /* Start the event logging */
17601
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, TRUE);
17602
-#endif /* SHOW_LOGTRACE */
17603
-#if defined(BCMDBUS)
17604
- if (!dhd->dhd_console_ms)
17605
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, FALSE);
17606
-#endif
17607
-
17608
- if (cfg80211_to_wl_iftype(wdev->iftype, &wl_iftype, &wl_mode) < 0) {
17609
- return -EINVAL;
17610
- }
17611
- if (!dhd->fw_preinit) {
17612
- err = wl_config_infra(cfg, ndev, wl_iftype);
17613
- if (unlikely(err && err != -EINPROGRESS)) {
17614
- WL_ERR(("wl_config_infra failed\n"));
17615
- if (err == -1) {
17616
- WL_ERR(("return error %d\n", err));
17617
- return err;
17618
- }
17619
- }
17620
- }
17621
-
17622
-#ifdef WL_HOST_BAND_MGMT
17623
- /* By default the curr_band is initialized to BAND_AUTO */
17624
- if ((ret = wl_cfg80211_set_band(ndev, WLC_BAND_AUTO)) < 0) {
17625
- if (ret == BCME_UNSUPPORTED) {
17626
- /* Don't fail the initialization, lets just
17627
- * fall back to the original method
17628
- */
17629
- WL_ERR(("WL_HOST_BAND_MGMT defined, "
17630
- "but roam_band iovar not supported \n"));
17631
- } else {
17632
- WL_ERR(("roam_band failed. ret=%d", ret));
17633
- err = -1;
17634
- }
17635
- }
17636
-#endif /* WL_HOST_BAND_MGMT */
17637
- return err;
17638
-}
17639
-#endif /* BCMDBUS */
17640
-
1764117284 static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
1764217285 {
1764317286 s32 err = 0;
....@@ -17786,11 +17429,7 @@
1778617429 struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
1778717430 struct wireless_dev *wdev = ndev->ieee80211_ptr;
1778817431 struct cfg80211_bss *bss = CFG80211_GET_BSS(wiphy, NULL, latest_bssid,
17789
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
17790
- wdev->u.client.ssid, wdev->u.client.ssid_len);
17791
-#else
1779217432 wdev->ssid, wdev->ssid_len);
17793
-#endif /* CFG80211_BKPORT_MLO */
1779417433
1779517434 BCM_REFERENCE(bss);
1779617435
....@@ -17949,7 +17588,7 @@
1794917588 if (init_roam_cache(cfg, ioctl_version) == 0) {
1795017589 /* Enable support for Roam cache */
1795117590 cfg->rcc_enabled = true;
17952
- WL_MSG(net->name, "Roam channel cache enabled\n");
17591
+ WL_ERR(("Roam channel cache enabled\n"));
1795317592 } else {
1795417593 WL_ERR(("Failed to enable RCC.\n"));
1795517594 }
....@@ -19699,12 +19338,7 @@
1969919338 while (ie) {
1970019339 if (count >= MAX_VNDR_IE_NUMBER)
1970119340 break;
19702
-#ifdef HOSTAPD_EID_EXTENSION_SUPPORT
19703
- if (ie->id == DOT11_MNG_VS_ID || (ie->id == DOT11_MNG_ID_EXT_ID))
19704
-#else
19705
- if (ie->id == DOT11_MNG_VS_ID)
19706
-#endif
19707
- {
19341
+ if (ie->id == DOT11_MNG_VS_ID || (ie->id == DOT11_MNG_ID_EXT_ID)) {
1970819342 vndrie = (const vndr_ie_t *) ie;
1970919343 if (ie->id == DOT11_MNG_ID_EXT_ID) {
1971019344 /* len should be bigger than sizeof ID extn field at least */
....@@ -20044,40 +19678,6 @@
2004419678 return 0;
2004519679 }
2004619680
20047
-#ifdef GET_FW_IE_DATA
20048
-static void
20049
-wl_dump_ie_buf(vndr_ie_buf_t *ie_getbuf)
20050
-{
20051
- uchar *iebuf;
20052
- uchar *data;
20053
- int tot_ie, pktflag, iecount, datalen;
20054
- vndr_ie_info_t *ie_info;
20055
- vndr_ie_t *ie;
20056
-
20057
- memcpy(&tot_ie, (void *)&ie_getbuf->iecount, sizeof(int));
20058
- tot_ie = dtoh32(tot_ie);
20059
- iebuf = (uchar *)&ie_getbuf->vndr_ie_list[0];
20060
-
20061
- printf("-----------------\n");
20062
- printf("Total IEs %d\n", tot_ie);
20063
- for (iecount = 0; iecount < tot_ie; iecount++) {
20064
- ie_info = (vndr_ie_info_t *) iebuf;
20065
- memcpy(&pktflag, (void *)&ie_info->pktflag, sizeof(uint32));
20066
- pktflag = dtoh32(pktflag);
20067
- iebuf += sizeof(uint32);
20068
- ie = &ie_info->vndr_ie_data;
20069
- data = &ie->data[0];
20070
- datalen = ie->len - VNDR_IE_MIN_LEN;
20071
- printf("index=%d, pktflag=0x%x\n", iecount, pktflag);
20072
- prhex("IE", (u8 *)ie, ie->len+VNDR_IE_HDR_LEN);
20073
-
20074
- iebuf += ie->len + VNDR_IE_HDR_LEN;
20075
- }
20076
- printf("-----------------\n");
20077
- printf("\n");
20078
-}
20079
-#endif /* GET_FW_IE_DATA */
20080
-
2008119681 static void
2008219682 wl_print_fw_ie_data(struct bcm_cfg80211 *cfg, struct net_device *ndev, s32 bssidx)
2008319683 {
....@@ -20089,10 +19689,18 @@
2008919689 bssidx, &cfg->ioctl_buf_sync);
2009019690 if (ret == BCME_OK) {
2009119691 ies = (vndr_ie_buf_t *)cfg->ioctl_buf;
19692
+ WL_INFORM_MEM(("FW IE count:%d ", ies->iecount));
2009219693 #ifdef GET_FW_IE_DATA
20093
- wl_dump_ie_buf((vndr_ie_buf_t *)cfg->ioctl_buf);
20094
-#else
20095
- WL_MSG(ndev->name, "FW IE count:%d\n", ies->iecount);
19694
+ if (wl_dbg_level & WL_DBG_DBG) {
19695
+ int i = 0;
19696
+ /* If debug enabled, print each IE */
19697
+ for (i = 0; i < ies->iecount; i++) {
19698
+ vndr_ie_info_t *info = &ies->vndr_ie_list[i];
19699
+ WL_DBG_MEM(("pktflag:0x%x\n", info->pktflag));
19700
+ prhex("IE:", (u8 *)&info->vndr_ie_data,
19701
+ info->vndr_ie_data.len + TLV_HDR_LEN);
19702
+ }
19703
+ }
2009619704 #endif /* GET_FW_IE_DATA */
2009719705 } else {
2009819706 WL_ERR(("IE retrieval failed! ret:%d\n", ret));
....@@ -20116,7 +19724,6 @@
2011619724 u32 parsed_ie_buf_len = 0;
2011719725 struct parsed_vndr_ies old_vndr_ies;
2011819726 struct parsed_vndr_ies new_vndr_ies;
20119
- int del_add_cnt = 0;
2012019727 s32 i;
2012119728 u8 *ptr;
2012219729 s32 remained_buf_len;
....@@ -20260,7 +19867,6 @@
2026019867
2026119868 curr_ie_buf += del_add_ie_buf_len;
2026219869 total_ie_buf_len += del_add_ie_buf_len;
20263
- del_add_cnt++;
2026419870 }
2026519871 }
2026619872
....@@ -20310,32 +19916,13 @@
2031019916 *mgmt_ie_len += vndrie_info->ie_len;
2031119917 curr_ie_buf += del_add_ie_buf_len;
2031219918 total_ie_buf_len += del_add_ie_buf_len;
20313
- del_add_cnt++;
2031419919 }
2031519920 }
2031619921
2031719922 if (total_ie_buf_len && cfg->ioctl_buf != NULL) {
20318
-#ifdef VNDR_IE_WAR
20319
- curr_ie_buf = g_mgmt_ie_buf;
20320
- for (i=0; i<del_add_cnt; i++) {
20321
- vndr_ie_setbuf_t *vndr_ie_setbuf = (vndr_ie_setbuf_t *)curr_ie_buf;
20322
- u32 curr_ie_buf_len;
20323
- curr_ie_buf_len =
20324
- (u8*)&vndr_ie_setbuf->vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.oui[0] -
20325
- (u8*)vndr_ie_setbuf;
20326
- curr_ie_buf_len += vndr_ie_setbuf->vndr_ie_buffer.vndr_ie_list[0].vndr_ie_data.len;
20327
- ret = wldev_iovar_setbuf_bsscfg(ndev, "vndr_ie", curr_ie_buf,
20328
- curr_ie_buf_len, cfg->ioctl_buf, WLC_IOCTL_MAXLEN,
20329
- bssidx, &cfg->ioctl_buf_sync);
20330
- if (ret)
20331
- break;
20332
- curr_ie_buf += curr_ie_buf_len;
20333
- }
20334
-#else
20335
- ret = wldev_iovar_setbuf_bsscfg(ndev, "vndr_ie", g_mgmt_ie_buf,
19923
+ ret = wldev_iovar_setbuf_bsscfg(ndev, "vndr_ie", g_mgmt_ie_buf,
2033619924 total_ie_buf_len, cfg->ioctl_buf, WLC_IOCTL_MAXLEN,
2033719925 bssidx, &cfg->ioctl_buf_sync);
20338
-#endif
2033919926 if (ret) {
2034019927 WL_ERR(("vndr_ie set error :%d\n", ret));
2034119928 if (ret == BCME_NOTFOUND) {