forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c
old mode 100644new mode 100755
....@@ -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
....@@ -2305,7 +2291,7 @@
23052291
23062292 WL_ERR(("%s: starts to read %s. Axi error \n", __FUNCTION__, filename));
23072293
2308
- fp = dhd_filp_open(filename, O_RDONLY, 0);
2294
+ fp = filp_open(filename, O_RDONLY, 0);
23092295
23102296 if (IS_ERR(fp) || (fp == NULL)) {
23112297 WL_ERR(("%s: Couldn't read the file, err %ld,File [%s] No previous axi error \n",
....@@ -2313,8 +2299,8 @@
23132299 return ret;
23142300 }
23152301
2316
- dhd_kernel_read_compat(fp, fp->f_pos, (char *)dhd->axi_err_dump, sizeof(dhd_axi_error_dump_t));
2317
- 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);
23182304
23192305 /* Delete axi error info file */
23202306 if (dhd_file_delete(filename) < 0) {
....@@ -3196,7 +3182,7 @@
31963182
31973183 if (addr) {
31983184 ifflags |= WL_INTERFACE_MAC_USE;
3199
- if (dhd_conf_legacy_chip_check(cfg->pub)) {
3185
+ if (wl_legacy_chip_check(ndev)) {
32003186 iface.flags = ifflags;
32013187 memcpy(&iface.mac_addr.octet, addr, ETH_ALEN);
32023188 }
....@@ -3209,7 +3195,7 @@
32093195 #endif /* WLEASYMESH */
32103196
32113197 /* Pass ver = 0 for fetching the interface_create iovar version */
3212
- if (dhd_conf_legacy_chip_check(cfg->pub)) {
3198
+ if (wl_legacy_chip_check(ndev)) {
32133199 bzero(&iface_v0, sizeof(iface_v0));
32143200 iface_v0.ver = WL_INTERFACE_CREATE_VER_0;
32153201 iface_v0.flags = iftype | ifflags;
....@@ -6397,9 +6383,6 @@
63976383
63986384 if (assoc_info.reassoc) {
63996385 /* Handle roam to same ESS */
6400
-#ifdef DHD_LOSSLESS_ROAMING
6401
- wl_ext_send_event_msg(dev, WLC_E_ROAM_PREP, WLC_E_STATUS_SUCCESS, WLC_E_REASON_LOW_RSSI);
6402
-#endif
64036386 if ((err = wl_handle_reassoc(cfg, dev, &assoc_info)) != BCME_OK) {
64046387 goto fail;
64056388 }
....@@ -6554,16 +6537,7 @@
65546537 WL_TRACE_HW4(("Aborting the scan! \n"));
65556538 wl_cfgscan_cancel_scan(cfg);
65566539 }
6557
- if (conn_in_progress || connected ||
6558
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
6559
- wdev->u.client.ssid_len
6560
-#else
6561
- wdev->ssid_len
6562
-#endif
6563
- ) {
6564
-#ifdef WL_EXT_IAPSTA
6565
- wl_ext_in4way_sync(dev, 0, WL_EXT_STATUS_PRE_DISCONNECTING, NULL);
6566
-#endif
6540
+ if (conn_in_progress || connected || wdev->ssid_len) {
65676541 scbval.val = reason_code;
65686542 memcpy(&scbval.ea, curbssid, ETHER_ADDR_LEN);
65696543 scbval.val = htod32(scbval.val);
....@@ -6608,13 +6582,7 @@
66086582 * and issue disconnect indication if required.
66096583 */
66106584
6611
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
6612
- // terence 20220911: fix me
6613
- if (wdev->links[0].client.current_bss || wdev->u.client.ssid_len)
6614
-#else
6615
- if (wdev->current_bss || wdev->ssid_len)
6616
-#endif
6617
- {
6585
+ if (wdev->current_bss || wdev->ssid_len) {
66186586 WL_INFORM_MEM(("report disconnect event\n"));
66196587 CFG80211_DISCONNECTED(dev, 0, NULL, 0, false, GFP_KERNEL);
66206588 }
....@@ -6719,9 +6687,6 @@
67196687
67206688 static s32
67216689 wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
6722
-#if defined(CFG80211_BKPORT_MLO)
6723
- int link_id,
6724
-#endif
67256690 u8 key_idx, bool unicast, bool multicast)
67266691 {
67276692 struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
....@@ -6766,7 +6731,7 @@
67666731 s32 bssidx;
67676732 s32 mode = wl_get_mode_by_netdev(cfg, dev);
67686733
6769
- 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);
67706735 if ((bssidx = wl_get_bssidx_by_wdev(cfg, dev->ieee80211_ptr)) < 0) {
67716736 WL_ERR(("Find p2p index from wdev(%p) failed\n", dev->ieee80211_ptr));
67726737 return BCME_ERROR;
....@@ -6933,9 +6898,6 @@
69336898
69346899 static s32
69356900 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
6936
-#if defined(CFG80211_BKPORT_MLO)
6937
- int link_id,
6938
-#endif
69396901 u8 key_idx, bool pairwise, const u8 *mac_addr,
69406902 struct key_params *params)
69416903 {
....@@ -7135,9 +7097,6 @@
71357097
71367098 static s32
71377099 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
7138
-#if defined(CFG80211_BKPORT_MLO)
7139
- int link_id,
7140
-#endif
71417100 u8 key_idx, bool pairwise, const u8 *mac_addr)
71427101 {
71437102 struct wl_wsec_key key;
....@@ -7201,9 +7160,6 @@
72017160 /* NOTE : this function cannot work as is and is never called */
72027161 static s32
72037162 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
7204
-#if defined(CFG80211_BKPORT_MLO)
7205
- int link_id,
7206
-#endif
72077163 u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
72087164 void (*callback) (void *cookie, struct key_params * params))
72097165 {
....@@ -7278,11 +7234,7 @@
72787234
72797235 static s32
72807236 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
7281
- struct net_device *dev,
7282
-#if defined(CFG80211_BKPORT_MLO)
7283
- int link_id,
7284
-#endif
7285
- u8 key_idx)
7237
+ struct net_device *dev, u8 key_idx)
72867238 {
72877239 #ifdef MFP
72887240 /* Firmware seems to use hard coded index for Group Mgmt Key.
....@@ -10266,34 +10218,6 @@
1026610218 }
1026710219 #endif /* WL_SUPPORT_ACS */
1026810220
10269
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
10270
-static int
10271
-wl_cfg80211_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
10272
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
10273
- unsigned int link_id,
10274
-#endif
10275
- struct cfg80211_chan_def *chandef)
10276
-{
10277
- struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
10278
- u32 chanspec = 0;
10279
- int ret = 0;
10280
-
10281
- RETURN_EIO_IF_NOT_UP(cfg);
10282
- if (NULL == wdev->netdev) {
10283
- /* the P2P interface may temporary use wdev without ndev */
10284
- return -EINVAL;
10285
- }
10286
-
10287
- if ((ret = wldev_iovar_getint(wdev->netdev, "chanspec", (s32 *)&chanspec) != BCME_OK)) {
10288
- return ret;
10289
- }
10290
- if (!chandef || (wl_chspec_chandef(chanspec, chandef, wiphy) != BCME_OK)) {
10291
- return BCME_ERROR;
10292
- }
10293
- return 0;
10294
-}
10295
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0) */
10296
-
1029710221 static struct cfg80211_ops wl_cfg80211_ops = {
1029810222 .add_virtual_intf = wl_cfg80211_add_virtual_iface,
1029910223 .del_virtual_intf = wl_cfg80211_del_virtual_iface,
....@@ -10391,9 +10315,6 @@
1039110315 .update_ft_ies = wl_cfg80211_update_ft_ies,
1039210316 #endif /* WLFBT */
1039310317 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
10394
-#if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0)
10395
- .get_channel = wl_cfg80211_get_channel,
10396
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0) */
1039710318 };
1039810319
1039910320 s32 wl_mode_to_nl80211_iftype(s32 mode)
....@@ -10432,7 +10353,7 @@
1043210353 GCC_DIAGNOSTIC_POP();
1043310354 if (iter->ndev) {
1043410355 if (wl_get_drv_status(cfg, AP_CREATED, iter->ndev)) {
10435
- WL_ERR(("AP active. skip coutry ccode change\n"));
10356
+ WL_ERR(("AP active. skip coutry ccode change"));
1043610357 return false;
1043710358 }
1043810359 }
....@@ -10440,7 +10361,7 @@
1044010361
1044110362 #ifdef WL_NAN
1044210363 if (wl_cfgnan_is_enabled(cfg) && wl_cfgnan_is_dp_active(net)) {
10443
- WL_ERR(("NDP established. skip coutry ccode change\n"));
10364
+ WL_ERR(("NDP established. skip coutry ccode change"));
1044410365 return false;
1044510366 }
1044610367 #endif /* WL_NAN */
....@@ -10977,7 +10898,7 @@
1097710898 #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && defined(SUPPORT_RANDOM_MAC_SCAN) */
1097810899
1097910900 #if defined(WL_SAE) || defined(WL_CLIENT_SAE)
10980
- if (dhd_conf_extsae_chip(dhd))
10901
+ if (wl_extsae_chip(dhd))
1098110902 wdev->wiphy->features |= NL80211_FEATURE_SAE;
1098210903 #endif /* WL_SAE || WL_CLIENT_SAE */
1098310904 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)) && defined(BCMSUP_4WAY_HANDSHAKE)
....@@ -10994,6 +10915,10 @@
1099410915 wiphy_ext_feature_set(wdev->wiphy, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN);
1099510916 wdev->wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN;
1099610917 #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
1099710922
1099810923 /* Now we can register wiphy with cfg80211 module */
1099910924 err = wiphy_register(wdev->wiphy);
....@@ -12330,7 +12255,7 @@
1233012255 memcpy(&emsg, as->event_msg, sizeof(wl_event_msg_t));
1233112256 ret = wl_ext_in4way_sync(ndev, STA_REASSOC_RETRY,
1233212257 WL_EXT_STATUS_RECONNECT, &emsg);
12333
- if (ret == BCME_ERROR)
12258
+ if (ret)
1233412259 return 0;
1233512260 }
1233612261 wl_ext_iapsta_enable_master_if(ndev, FALSE);
....@@ -12486,13 +12411,7 @@
1248612411 memcpy(&emsg, as->event_msg, sizeof(wl_event_msg_t));
1248712412 ret = wl_ext_in4way_sync(ndev, STA_REASSOC_RETRY,
1248812413 WL_EXT_STATUS_RECONNECT, &emsg);
12489
- if (ret == BCME_BADADDR) {
12490
- u8 *curbssid = NULL;
12491
- curbssid = wl_read_prof(cfg, ndev, WL_PROF_BSSID);
12492
- if (curbssid)
12493
- (void)memcpy_s(as->addr, ETH_ALEN, curbssid, ETH_ALEN);
12494
- }
12495
- else if (ret == BCME_ERROR)
12414
+ if (ret)
1249612415 return 0;
1249712416 }
1249812417 #endif
....@@ -12616,11 +12535,6 @@
1261612535 wl_ext_iapsta_restart_master(ndev);
1261712536 }
1261812537 #endif
12619
-
12620
- if (wl_get_drv_status(cfg, DISCONNECTING, ndev)) {
12621
- /* If DISCONNECTING bit is set, mark locally generated */
12622
- loc_gen = 1;
12623
- }
1262412538
1262512539 CFG80211_DISCONNECTED(ndev, reason, ie_ptr, ie_len,
1262612540 loc_gen, GFP_KERNEL);
....@@ -12868,22 +12782,6 @@
1286812782 " connect state. Ignore\n"));
1286912783 goto exit;
1287012784 }
12871
-
12872
-#ifdef WL_ROAM_WAR
12873
- if (event_type == WLC_E_JOIN)
12874
- bzero((u8*)&cfg->roaming_bssid, ETHER_ADDR_LEN);
12875
- else if (wl_get_drv_status(cfg, CONNECTED, ndev)) {
12876
- if (event_type == WLC_E_AUTH && ntoh32(e->status) == WLC_E_STATUS_SUCCESS)
12877
- bcopy(&e->addr, &cfg->roaming_bssid, ETHER_ADDR_LEN);
12878
- else if (event_type == WLC_E_DEAUTH &&
12879
- !ETHER_ISNULLADDR(&cfg->roaming_bssid.octet) &&
12880
- memcmp(&e->addr, &cfg->roaming_bssid, ETHER_ADDR_LEN)) {
12881
- WL_MSG(ndev->name, "skip WLC_E_DEAUTH(%pM), roaming_bssid %pM\n",
12882
- &e->addr, &cfg->roaming_bssid);
12883
- goto exit;
12884
- }
12885
- }
12886
-#endif /* WL_ROAM_WAR */
1288712785
1288812786 if (wl_get_drv_status(cfg, CONNECTING, ndev)) {
1288912787 assoc_state = WL_STATE_ASSOCIATING;
....@@ -13581,6 +13479,7 @@
1358113479 return err;
1358213480 }
1358313481
13482
+#ifdef DHD_LOSSLESS_ROAMING
1358413483 static s32
1358513484 wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
1358613485 const wl_event_msg_t *e, void *data)
....@@ -13588,14 +13487,14 @@
1358813487 struct wl_connect_info *conn_info = wl_to_conn(cfg);
1358913488 s32 err = 0;
1359013489 u8 *curbssid;
13591
- chanspec_t *chanspec, cur_chanspec;
13490
+ chanspec_t *chanspec;
1359213491 scb_val_t scbval;
1359313492 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || \
1359413493 defined(WL_COMPAT_WIRELESS)
1359513494 struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
1359613495 struct ieee80211_channel *notify_channel = NULL;
1359713496 u32 freq;
13598
- u32 cur_channel, orig_channel;
13497
+ u32 cur_channel, cur_chanspec, orig_channel;
1359913498 #endif /* LINUX_VERSION > 2.6.39 || WL_COMPAT_WIRELESS */
1360013499 #if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
1360113500 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || \
....@@ -13636,13 +13535,10 @@
1363613535 cur_channel = wf_chspec_ctlchan(wl_chspec_driver_to_host(cur_chanspec));
1363713536 orig_channel = wf_chspec_ctlchan(wl_chspec_driver_to_host(*chanspec));
1363813537 if (dhdp->conf->chip != BCM43569_CHIP_ID) {
13639
- if (((orig_channel == cur_channel) && memcmp(&ether_null, &cfg->last_roamed_addr, ETHER_ADDR_LEN)) &&
13538
+ if ((orig_channel == cur_channel) &&
1364013539 ((memcmp(curbssid, &e->addr, ETHER_ADDR_LEN) == 0) ||
1364113540 (memcmp(&cfg->last_roamed_addr, &e->addr, ETHER_ADDR_LEN) == 0))) {
13642
- WL_INFORM_MEM(("BSS already present, Skipping roamed event to upper layer\n"));
13643
- WL_INFORM_MEM(("orig_chan/cur_chan=%d/%d, addr/curbssid/last_roamed_addr=%pM/%pM/%pM\n",
13644
- orig_channel, cur_channel,
13645
- (const u8*)(&e->addr), curbssid, (const u8*)(&cfg->last_roamed_addr)));
13541
+ WL_DBG(("BSS already present, Skipping roamed event to upper layer\n"));
1364613542 goto fail;
1364713543 }
1364813544 }
....@@ -13676,15 +13572,13 @@
1367613572 }
1367713573 rssi = dtoh32(scbval.val);
1367813574
13679
- WL_MSG(ndev->name, "%pM(chan=%s-%d/%sMHz) => %pM(chan=%s-%d/%sMHz, rssi: %3d)\n",
13680
- curbssid,
13681
- 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,
1368213577 CHSPEC_IS20(*chanspec)?"20":
1368313578 CHSPEC_IS40(*chanspec)?"40":
1368413579 CHSPEC_IS80(*chanspec)?"80":
1368513580 CHSPEC_IS160(*chanspec)?"160":"??",
13686
- (const u8*)(&e->addr),
13687
- CHSPEC2BANDSTR(cur_chanspec), wf_chspec_ctlchan(cur_chanspec),
13581
+ (const u8*)(&e->addr), cur_channel,
1368813582 CHSPEC_IS20(cur_chanspec)?"20":
1368913583 CHSPEC_IS40(cur_chanspec)?"40":
1369013584 CHSPEC_IS80(cur_chanspec)?"80":
....@@ -13725,20 +13619,15 @@
1372513619 DHD_STATLOG_CTRL(dhdp, ST(REASSOC_INFORM),
1372613620 dhd_net2idx(dhdp->info, ndev), 0);
1372713621 #ifdef WL_EXT_IAPSTA
13728
- wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_ROAMED, NULL);
13622
+ wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
1372913623 #endif
1373013624
1373113625 #if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
1373213626 (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || \
1373313627 defined(WL_FILS_ROAM_OFFLD) || defined(CFG80211_ROAM_API_GE_4_12)
1373413628 memset(&roam_info, 0, sizeof(struct cfg80211_roam_info));
13735
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
13736
- roam_info.links[0].channel = notify_channel;
13737
- roam_info.links[0].bssid = curbssid;
13738
-#else
1373913629 roam_info.channel = notify_channel;
1374013630 roam_info.bssid = curbssid;
13741
-#endif
1374213631 roam_info.req_ie = conn_info->req_ie;
1374313632 roam_info.req_ie_len = conn_info->req_ie_len;
1374413633 roam_info.resp_ie = conn_info->resp_ie;
....@@ -13791,15 +13680,12 @@
1379113680 return err;
1379213681
1379313682 fail:
13794
-#ifdef WL_EXT_IAPSTA
13795
- if (err)
13796
- wl_ext_in4way_sync(ndev, STA_NO_BTC_IN4WAY, WL_EXT_STATUS_DISCONNECTED, NULL);
13797
-#endif
1379813683 #ifdef DHD_LOSSLESS_ROAMING
1379913684 wl_del_roam_timeout(cfg);
1380013685 #endif /* DHD_LOSSLESS_ROAMING */
1380113686 return err;
1380213687 }
13688
+#endif /* DHD_LOSSLESS_ROAMING */
1380313689
1380413690 static bool
1380513691 wl_cfg80211_verify_bss(struct bcm_cfg80211 *cfg, struct net_device *ndev,
....@@ -13935,21 +13821,10 @@
1393513821
1393613822 resp_params = (struct cfg80211_connect_resp_params *)params;
1393713823 resp_params->status = status;
13938
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
13939
- resp_params->links[0].bssid = curbssid;
13940
- resp_params->links[0].bss = CFG80211_GET_BSS(wiphy, NULL, curbssid,
13941
- ssid->SSID, ssid->SSID_len);
13942
-#else
1394313824 resp_params->bssid = curbssid;
1394413825 resp_params->bss = CFG80211_GET_BSS(wiphy, NULL, curbssid,
1394513826 ssid->SSID, ssid->SSID_len);
13946
-#endif
13947
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
13948
- if (!resp_params->links[0].bss)
13949
-#else
13950
- if (!resp_params->bss)
13951
-#endif
13952
- {
13827
+ if (!resp_params->bss) {
1395313828 WL_ERR(("null bss\n"));
1395413829 return BCME_ERROR;
1395513830 }
....@@ -14059,12 +13934,7 @@
1405913934 completed = false;
1406013935 sec->auth_assoc_res_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
1406113936 }
14062
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
14063
- if (!ndev->ieee80211_ptr->u.client.ssid_len)
14064
-#else
14065
- if (!ndev->ieee80211_ptr->ssid_len)
14066
-#endif
14067
- {
13937
+ if (!ndev->ieee80211_ptr->ssid_len) {
1406813938 /* In certain cases, the delayed cfg80211 work from
1406913939 * disconnect context will induce race conditions in
1407013940 * which the ssid_len will be cleared, but dhd is in
....@@ -14092,6 +13962,10 @@
1409213962
1409313963 if (completed) {
1409413964 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
1409513969 } else {
1409613970 WL_MSG(ndev->name, "Report connect result - connection failed\n");
1409713971 #ifdef WL_EXT_IAPSTA
....@@ -14140,13 +14014,6 @@
1414014014 }
1414114015 #endif /* WAPI */
1414214016 }
14143
-
14144
-#ifdef WL_EXT_IAPSTA
14145
- if (completed) {
14146
- wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
14147
- wl_ext_iapsta_enable_master_if(ndev, TRUE);
14148
- }
14149
-#endif
1415014017
1415114018 exit:
1415214019 CLR_TS(cfg, conn_start);
....@@ -14757,11 +14624,11 @@
1475714624 wl_cfg80211_ccode_evt_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
1475814625 const wl_event_msg_t *event, void *data)
1475914626 {
14760
- dhd_pub_t *dhd = cfg->pub;
1476114627 s32 err = 0;
1476214628 struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
1476314629 char country_str[WLC_CNTRY_BUF_SZ] = { 0 };
1476414630 struct net_device *dev = bcmcfg_to_prmry_ndev(cfg);
14631
+ wl_country_t cspec = {{0}, 0, {0}};
1476514632
1476614633 if (strlcpy(country_str, data, WL_CCODE_LEN + 1) >= WLC_CNTRY_BUF_SZ) {
1476714634 return -EINVAL;
....@@ -14774,7 +14641,18 @@
1477414641 }
1477514642
1477614643 WL_MSG(dev->name, "Updating new country %s\n", country_str);
14777
- 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));
1477814656
1477914657 /* Indicate to upper layer for regdom change */
1478014658 err = wl_update_wiphybands(cfg, true);
....@@ -14920,11 +14798,9 @@
1492014798 cfg->evt_handler[WLC_E_BSS_LOAD] = wl_cfg80211_bssload_report_event_handler;
1492114799 #endif /* WL_CHAN_UTIL */
1492214800 #ifdef WL_TWT
14923
- cfg->evt_handler[WLC_E_TWT] = wl_notify_twt_event;
14924
-#else
14925
-#ifdef WL_TWT_HAL_IF
14926
- cfg->evt_handler[WLC_E_TWT] = wl_cfgvendor_notify_twt_event;
14927
-#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;
1492814804 #endif /* WL_TWT */
1492914805 #ifdef WL_CLIENT_SAE
1493014806 cfg->evt_handler[WLC_E_JOIN_START] = wl_notify_start_auth;
....@@ -15304,7 +15180,7 @@
1530415180
1530515181 wdev = ndev_to_wdev(dev);
1530615182 if (!wdev) {
15307
- WL_DBG(("wdev(%s) null. Do nothing\n", dev->name));
15183
+ WL_ERR(("wdev null. Do nothing\n"));
1530815184 return NOTIFY_DONE;
1530915185 }
1531015186
....@@ -15811,6 +15687,9 @@
1581115687 wl_destroy_event_handler(cfg);
1581215688 wl_flush_eq(cfg);
1581315689 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 */
1581415693 del_timer_sync(&cfg->scan_timeout);
1581515694 #ifdef DHD_LOSSLESS_ROAMING
1581615695 del_timer_sync(&cfg->roam_timeout);
....@@ -16077,6 +15956,9 @@
1607715956 INIT_WORK(&cfg->wlan_work, wl_cfg80211_work_handler);
1607815957 #endif /* DHCP_SCAN_SUPPRESS */
1607915958
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 */
1608015962 INIT_DELAYED_WORK(&cfg->pm_enable_work, wl_cfg80211_work_handler);
1608115963 INIT_DELAYED_WORK(&cfg->loc.work, wl_cfgscan_listen_complete_work);
1608215964 INIT_DELAYED_WORK(&cfg->ap_work, wl_cfg80211_ap_timeout_work);
....@@ -16343,7 +16225,7 @@
1634316225
1634416226 #ifdef OEM_ANDROID
1634516227 if (cfg->event_workq == NULL) {
16346
- WL_ERR(("Event handler is not created (%s)\n", bcmevent_get_name(event_type)));
16228
+ WL_ERR(("Event handler is not created\n"));
1634716229 return;
1634816230 }
1634916231 #endif /* OEM_ANDROID */
....@@ -17243,10 +17125,6 @@
1724317125 /* Start the event logging */
1724417126 wl_add_remove_eventmsg(ndev, WLC_E_TRACE, TRUE);
1724517127 #endif /* SHOW_LOGTRACE */
17246
-#if defined(BCMDBUS)
17247
- if (!dhd->dhd_console_ms)
17248
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, FALSE);
17249
-#endif
1725017128
1725117129 (void)memcpy_s(wdev->wiphy->perm_addr, ETHER_ADDR_LEN,
1725217130 bcmcfg_to_prmry_ndev(cfg)->perm_addr, ETHER_ADDR_LEN);
....@@ -17403,77 +17281,6 @@
1740317281 return err;
1740417282 }
1740517283
17406
-#ifdef BCMDBUS
17407
-s32
17408
-__wl_cfg80211_up_resume(dhd_pub_t *dhd)
17409
-{
17410
- struct net_device *ndev = dhd_linux_get_primary_netdev(dhd);
17411
- struct bcm_cfg80211 *cfg;
17412
- struct wireless_dev *wdev;
17413
- s32 err = 0;
17414
-#ifdef WL_HOST_BAND_MGMT
17415
- s32 ret = 0;
17416
-#endif /* WL_HOST_BAND_MGMT */
17417
- u16 wl_iftype = 0;
17418
- u16 wl_mode = 0;
17419
-
17420
- WL_DBG(("In\n"));
17421
-
17422
- if (!ndev)
17423
- return -EINVAL;
17424
- cfg = wl_get_cfg(ndev);
17425
- wdev = ndev->ieee80211_ptr;
17426
- if (!cfg || !wdev)
17427
- return -EINVAL;
17428
-
17429
-#if defined(BCMDONGLEHOST)
17430
- err = dhd_config_dongle(cfg);
17431
- if (unlikely(err))
17432
- return err;
17433
-#endif /* defined(BCMDONGLEHOST) */
17434
-
17435
-#ifdef SHOW_LOGTRACE
17436
- /* Start the event logging */
17437
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, TRUE);
17438
-#endif /* SHOW_LOGTRACE */
17439
-#if defined(BCMDBUS)
17440
- if (!dhd->dhd_console_ms)
17441
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, FALSE);
17442
-#endif
17443
-
17444
- if (cfg80211_to_wl_iftype(wdev->iftype, &wl_iftype, &wl_mode) < 0) {
17445
- return -EINVAL;
17446
- }
17447
- if (!dhd->fw_preinit) {
17448
- err = wl_config_infra(cfg, ndev, wl_iftype);
17449
- if (unlikely(err && err != -EINPROGRESS)) {
17450
- WL_ERR(("wl_config_infra failed\n"));
17451
- if (err == -1) {
17452
- WL_ERR(("return error %d\n", err));
17453
- return err;
17454
- }
17455
- }
17456
- }
17457
-
17458
-#ifdef WL_HOST_BAND_MGMT
17459
- /* By default the curr_band is initialized to BAND_AUTO */
17460
- if ((ret = wl_cfg80211_set_band(ndev, WLC_BAND_AUTO)) < 0) {
17461
- if (ret == BCME_UNSUPPORTED) {
17462
- /* Don't fail the initialization, lets just
17463
- * fall back to the original method
17464
- */
17465
- WL_ERR(("WL_HOST_BAND_MGMT defined, "
17466
- "but roam_band iovar not supported \n"));
17467
- } else {
17468
- WL_ERR(("roam_band failed. ret=%d", ret));
17469
- err = -1;
17470
- }
17471
- }
17472
-#endif /* WL_HOST_BAND_MGMT */
17473
- return err;
17474
-}
17475
-#endif /* BCMDBUS */
17476
-
1747717284 static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
1747817285 {
1747917286 s32 err = 0;
....@@ -17622,12 +17429,7 @@
1762217429 struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
1762317430 struct wireless_dev *wdev = ndev->ieee80211_ptr;
1762417431 struct cfg80211_bss *bss = CFG80211_GET_BSS(wiphy, NULL, latest_bssid,
17625
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
17626
- wdev->u.client.ssid, wdev->u.client.ssid_len
17627
-#else
17628
- wdev->ssid, wdev->ssid_len
17629
-#endif
17630
- );
17432
+ wdev->ssid, wdev->ssid_len);
1763117433
1763217434 BCM_REFERENCE(bss);
1763317435
....@@ -17786,7 +17588,7 @@
1778617588 if (init_roam_cache(cfg, ioctl_version) == 0) {
1778717589 /* Enable support for Roam cache */
1778817590 cfg->rcc_enabled = true;
17789
- WL_MSG(net->name, "Roam channel cache enabled\n");
17591
+ WL_ERR(("Roam channel cache enabled\n"));
1779017592 } else {
1779117593 WL_ERR(("Failed to enable RCC.\n"));
1779217594 }
....@@ -19887,7 +19689,7 @@
1988719689 bssidx, &cfg->ioctl_buf_sync);
1988819690 if (ret == BCME_OK) {
1988919691 ies = (vndr_ie_buf_t *)cfg->ioctl_buf;
19890
- WL_INFORM_MEM(("FW IE count:%d\n", ies->iecount));
19692
+ WL_INFORM_MEM(("FW IE count:%d ", ies->iecount));
1989119693 #ifdef GET_FW_IE_DATA
1989219694 if (wl_dbg_level & WL_DBG_DBG) {
1989319695 int i = 0;