From b22da3d8526a935aa31e086e63f60ff3246cb61c Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 09 Dec 2023 07:24:11 +0000
Subject: [PATCH] add stmac read mac form eeprom
---
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c | 326 ++++++++++-------------------------------------------
1 files changed, 64 insertions(+), 262 deletions(-)
diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c
old mode 100644
new mode 100755
index 21d3846..08de44a
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_cfg80211.c
@@ -475,34 +475,18 @@
#endif /* WL_CFG80211_P2P_DEV_IF */
static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy,
struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool unicast, bool multicast);
static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool pairwise, const u8 *mac_addr,
struct key_params *params);
static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool pairwise, const u8 *mac_addr);
static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool pairwise, const u8 *mac_addr,
void *cookie, void (*callback) (void *cookie,
struct key_params *params));
static s32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
- struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
- u8 key_idx);
+ struct net_device *dev, u8 key_idx);
#if defined(WL_SUPPORT_BACKPORTED_KPATCHES) || (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0))
static s32 wl_cfg80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
bcm_struct_cfgdev *cfgdev, u64 cookie);
@@ -595,8 +579,10 @@
bcm_struct_cfgdev *cfgdev, const wl_event_msg_t *e, void *data);
static s32 wl_bss_connect_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
const wl_event_msg_t *e, void *data, bool completed);
+#ifdef DHD_LOSSLESS_ROAMING
static s32 wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
const wl_event_msg_t *e, void *data);
+#endif /* DHD_LOSSLESS_ROAMING */
static s32 wl_notify_mic_status(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *e, void *data);
#ifdef BT_WIFI_HANDOVER
@@ -2305,7 +2291,7 @@
WL_ERR(("%s: starts to read %s. Axi error \n", __FUNCTION__, filename));
- fp = dhd_filp_open(filename, O_RDONLY, 0);
+ fp = filp_open(filename, O_RDONLY, 0);
if (IS_ERR(fp) || (fp == NULL)) {
WL_ERR(("%s: Couldn't read the file, err %ld,File [%s] No previous axi error \n",
@@ -2313,8 +2299,8 @@
return ret;
}
- dhd_kernel_read_compat(fp, fp->f_pos, (char *)dhd->axi_err_dump, sizeof(dhd_axi_error_dump_t));
- dhd_filp_close(fp, NULL);
+ kernel_read_compat(fp, fp->f_pos, (char *)dhd->axi_err_dump, sizeof(dhd_axi_error_dump_t));
+ filp_close(fp, NULL);
/* Delete axi error info file */
if (dhd_file_delete(filename) < 0) {
@@ -3196,7 +3182,7 @@
if (addr) {
ifflags |= WL_INTERFACE_MAC_USE;
- if (dhd_conf_legacy_chip_check(cfg->pub)) {
+ if (wl_legacy_chip_check(ndev)) {
iface.flags = ifflags;
memcpy(&iface.mac_addr.octet, addr, ETH_ALEN);
}
@@ -3209,7 +3195,7 @@
#endif /* WLEASYMESH */
/* Pass ver = 0 for fetching the interface_create iovar version */
- if (dhd_conf_legacy_chip_check(cfg->pub)) {
+ if (wl_legacy_chip_check(ndev)) {
bzero(&iface_v0, sizeof(iface_v0));
iface_v0.ver = WL_INTERFACE_CREATE_VER_0;
iface_v0.flags = iftype | ifflags;
@@ -6397,9 +6383,6 @@
if (assoc_info.reassoc) {
/* Handle roam to same ESS */
-#ifdef DHD_LOSSLESS_ROAMING
- wl_ext_send_event_msg(dev, WLC_E_ROAM_PREP, WLC_E_STATUS_SUCCESS, WLC_E_REASON_LOW_RSSI);
-#endif
if ((err = wl_handle_reassoc(cfg, dev, &assoc_info)) != BCME_OK) {
goto fail;
}
@@ -6554,16 +6537,7 @@
WL_TRACE_HW4(("Aborting the scan! \n"));
wl_cfgscan_cancel_scan(cfg);
}
- if (conn_in_progress || connected ||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- wdev->u.client.ssid_len
-#else
- wdev->ssid_len
-#endif
- ) {
-#ifdef WL_EXT_IAPSTA
- wl_ext_in4way_sync(dev, 0, WL_EXT_STATUS_PRE_DISCONNECTING, NULL);
-#endif
+ if (conn_in_progress || connected || wdev->ssid_len) {
scbval.val = reason_code;
memcpy(&scbval.ea, curbssid, ETHER_ADDR_LEN);
scbval.val = htod32(scbval.val);
@@ -6608,13 +6582,7 @@
* and issue disconnect indication if required.
*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- // terence 20220911: fix me
- if (wdev->links[0].client.current_bss || wdev->u.client.ssid_len)
-#else
- if (wdev->current_bss || wdev->ssid_len)
-#endif
- {
+ if (wdev->current_bss || wdev->ssid_len) {
WL_INFORM_MEM(("report disconnect event\n"));
CFG80211_DISCONNECTED(dev, 0, NULL, 0, false, GFP_KERNEL);
}
@@ -6719,9 +6687,6 @@
static s32
wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool unicast, bool multicast)
{
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
@@ -6766,7 +6731,7 @@
s32 bssidx;
s32 mode = wl_get_mode_by_netdev(cfg, dev);
- WL_MSG(dev->name, "key index (%d) for %pM\n", key_idx, mac_addr);
+ WL_MSG(dev->name, "key index (%d)\n", key_idx);
if ((bssidx = wl_get_bssidx_by_wdev(cfg, dev->ieee80211_ptr)) < 0) {
WL_ERR(("Find p2p index from wdev(%p) failed\n", dev->ieee80211_ptr));
return BCME_ERROR;
@@ -6933,9 +6898,6 @@
static s32
wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool pairwise, const u8 *mac_addr,
struct key_params *params)
{
@@ -7135,9 +7097,6 @@
static s32
wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool pairwise, const u8 *mac_addr)
{
struct wl_wsec_key key;
@@ -7201,9 +7160,6 @@
/* NOTE : this function cannot work as is and is never called */
static s32
wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie,
void (*callback) (void *cookie, struct key_params * params))
{
@@ -7278,11 +7234,7 @@
static s32
wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy,
- struct net_device *dev,
-#if defined(CFG80211_BKPORT_MLO)
- int link_id,
-#endif
- u8 key_idx)
+ struct net_device *dev, u8 key_idx)
{
#ifdef MFP
/* Firmware seems to use hard coded index for Group Mgmt Key.
@@ -10266,34 +10218,6 @@
}
#endif /* WL_SUPPORT_ACS */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0)
-static int
-wl_cfg80211_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- unsigned int link_id,
-#endif
- struct cfg80211_chan_def *chandef)
-{
- struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
- u32 chanspec = 0;
- int ret = 0;
-
- RETURN_EIO_IF_NOT_UP(cfg);
- if (NULL == wdev->netdev) {
- /* the P2P interface may temporary use wdev without ndev */
- return -EINVAL;
- }
-
- if ((ret = wldev_iovar_getint(wdev->netdev, "chanspec", (s32 *)&chanspec) != BCME_OK)) {
- return ret;
- }
- if (!chandef || (wl_chspec_chandef(chanspec, chandef, wiphy) != BCME_OK)) {
- return BCME_ERROR;
- }
- return 0;
-}
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0) */
-
static struct cfg80211_ops wl_cfg80211_ops = {
.add_virtual_intf = wl_cfg80211_add_virtual_iface,
.del_virtual_intf = wl_cfg80211_del_virtual_iface,
@@ -10391,9 +10315,6 @@
.update_ft_ies = wl_cfg80211_update_ft_ies,
#endif /* WLFBT */
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0) */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0)
- .get_channel = wl_cfg80211_get_channel,
-#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION (3, 6, 0) */
};
s32 wl_mode_to_nl80211_iftype(s32 mode)
@@ -10432,7 +10353,7 @@
GCC_DIAGNOSTIC_POP();
if (iter->ndev) {
if (wl_get_drv_status(cfg, AP_CREATED, iter->ndev)) {
- WL_ERR(("AP active. skip coutry ccode change\n"));
+ WL_ERR(("AP active. skip coutry ccode change"));
return false;
}
}
@@ -10440,7 +10361,7 @@
#ifdef WL_NAN
if (wl_cfgnan_is_enabled(cfg) && wl_cfgnan_is_dp_active(net)) {
- WL_ERR(("NDP established. skip coutry ccode change\n"));
+ WL_ERR(("NDP established. skip coutry ccode change"));
return false;
}
#endif /* WL_NAN */
@@ -10977,7 +10898,7 @@
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) && defined(SUPPORT_RANDOM_MAC_SCAN) */
#if defined(WL_SAE) || defined(WL_CLIENT_SAE)
- if (dhd_conf_extsae_chip(dhd))
+ if (wl_extsae_chip(dhd))
wdev->wiphy->features |= NL80211_FEATURE_SAE;
#endif /* WL_SAE || WL_CLIENT_SAE */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0)) && defined(BCMSUP_4WAY_HANDSHAKE)
@@ -10994,6 +10915,10 @@
wiphy_ext_feature_set(wdev->wiphy, NL80211_EXT_FEATURE_HIGH_ACCURACY_SCAN);
wdev->wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN;
#endif /* WL_SCAN_TYPE */
+
+#ifdef DHD_PNO_FLAG
+ wiphy_ext_feature_set(wdev->wiphy, NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI);
+#endif
/* Now we can register wiphy with cfg80211 module */
err = wiphy_register(wdev->wiphy);
@@ -12330,7 +12255,7 @@
memcpy(&emsg, as->event_msg, sizeof(wl_event_msg_t));
ret = wl_ext_in4way_sync(ndev, STA_REASSOC_RETRY,
WL_EXT_STATUS_RECONNECT, &emsg);
- if (ret == BCME_ERROR)
+ if (ret)
return 0;
}
wl_ext_iapsta_enable_master_if(ndev, FALSE);
@@ -12486,13 +12411,7 @@
memcpy(&emsg, as->event_msg, sizeof(wl_event_msg_t));
ret = wl_ext_in4way_sync(ndev, STA_REASSOC_RETRY,
WL_EXT_STATUS_RECONNECT, &emsg);
- if (ret == BCME_BADADDR) {
- u8 *curbssid = NULL;
- curbssid = wl_read_prof(cfg, ndev, WL_PROF_BSSID);
- if (curbssid)
- (void)memcpy_s(as->addr, ETH_ALEN, curbssid, ETH_ALEN);
- }
- else if (ret == BCME_ERROR)
+ if (ret)
return 0;
}
#endif
@@ -12616,11 +12535,6 @@
wl_ext_iapsta_restart_master(ndev);
}
#endif
-
- if (wl_get_drv_status(cfg, DISCONNECTING, ndev)) {
- /* If DISCONNECTING bit is set, mark locally generated */
- loc_gen = 1;
- }
CFG80211_DISCONNECTED(ndev, reason, ie_ptr, ie_len,
loc_gen, GFP_KERNEL);
@@ -12868,22 +12782,6 @@
" connect state. Ignore\n"));
goto exit;
}
-
-#ifdef WL_ROAM_WAR
- if (event_type == WLC_E_JOIN)
- bzero((u8*)&cfg->roaming_bssid, ETHER_ADDR_LEN);
- else if (wl_get_drv_status(cfg, CONNECTED, ndev)) {
- if (event_type == WLC_E_AUTH && ntoh32(e->status) == WLC_E_STATUS_SUCCESS)
- bcopy(&e->addr, &cfg->roaming_bssid, ETHER_ADDR_LEN);
- else if (event_type == WLC_E_DEAUTH &&
- !ETHER_ISNULLADDR(&cfg->roaming_bssid.octet) &&
- memcmp(&e->addr, &cfg->roaming_bssid, ETHER_ADDR_LEN)) {
- WL_MSG(ndev->name, "skip WLC_E_DEAUTH(%pM), roaming_bssid %pM\n",
- &e->addr, &cfg->roaming_bssid);
- goto exit;
- }
- }
-#endif /* WL_ROAM_WAR */
if (wl_get_drv_status(cfg, CONNECTING, ndev)) {
assoc_state = WL_STATE_ASSOCIATING;
@@ -13581,6 +13479,7 @@
return err;
}
+#ifdef DHD_LOSSLESS_ROAMING
static s32
wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
const wl_event_msg_t *e, void *data)
@@ -13588,14 +13487,14 @@
struct wl_connect_info *conn_info = wl_to_conn(cfg);
s32 err = 0;
u8 *curbssid;
- chanspec_t *chanspec, cur_chanspec;
+ chanspec_t *chanspec;
scb_val_t scbval;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)) || \
defined(WL_COMPAT_WIRELESS)
struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
struct ieee80211_channel *notify_channel = NULL;
u32 freq;
- u32 cur_channel, orig_channel;
+ u32 cur_channel, cur_chanspec, orig_channel;
#endif /* LINUX_VERSION > 2.6.39 || WL_COMPAT_WIRELESS */
#if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || \
@@ -13636,13 +13535,10 @@
cur_channel = wf_chspec_ctlchan(wl_chspec_driver_to_host(cur_chanspec));
orig_channel = wf_chspec_ctlchan(wl_chspec_driver_to_host(*chanspec));
if (dhdp->conf->chip != BCM43569_CHIP_ID) {
- if (((orig_channel == cur_channel) && memcmp(ðer_null, &cfg->last_roamed_addr, ETHER_ADDR_LEN)) &&
+ if ((orig_channel == cur_channel) &&
((memcmp(curbssid, &e->addr, ETHER_ADDR_LEN) == 0) ||
(memcmp(&cfg->last_roamed_addr, &e->addr, ETHER_ADDR_LEN) == 0))) {
- WL_INFORM_MEM(("BSS already present, Skipping roamed event to upper layer\n"));
- WL_INFORM_MEM(("orig_chan/cur_chan=%d/%d, addr/curbssid/last_roamed_addr=%pM/%pM/%pM\n",
- orig_channel, cur_channel,
- (const u8*)(&e->addr), curbssid, (const u8*)(&cfg->last_roamed_addr)));
+ WL_DBG(("BSS already present, Skipping roamed event to upper layer\n"));
goto fail;
}
}
@@ -13676,15 +13572,13 @@
}
rssi = dtoh32(scbval.val);
- WL_MSG(ndev->name, "%pM(chan=%s-%d/%sMHz) => %pM(chan=%s-%d/%sMHz, rssi: %3d)\n",
- curbssid,
- CHSPEC2BANDSTR(*chanspec), wf_chspec_ctlchan(*chanspec),
+ WL_MSG(ndev->name, "%pM(ch:%3d/%sMHz) => %pM(ch:%3d/%sMHz, rssi: %3d)\n",
+ curbssid, orig_channel,
CHSPEC_IS20(*chanspec)?"20":
CHSPEC_IS40(*chanspec)?"40":
CHSPEC_IS80(*chanspec)?"80":
CHSPEC_IS160(*chanspec)?"160":"??",
- (const u8*)(&e->addr),
- CHSPEC2BANDSTR(cur_chanspec), wf_chspec_ctlchan(cur_chanspec),
+ (const u8*)(&e->addr), cur_channel,
CHSPEC_IS20(cur_chanspec)?"20":
CHSPEC_IS40(cur_chanspec)?"40":
CHSPEC_IS80(cur_chanspec)?"80":
@@ -13725,20 +13619,15 @@
DHD_STATLOG_CTRL(dhdp, ST(REASSOC_INFORM),
dhd_net2idx(dhdp->info, ndev), 0);
#ifdef WL_EXT_IAPSTA
- wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_ROAMED, NULL);
+ wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
#endif
#if (defined(CONFIG_ARCH_MSM) && defined(CFG80211_ROAMED_API_UNIFIED)) || \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)) || \
defined(WL_FILS_ROAM_OFFLD) || defined(CFG80211_ROAM_API_GE_4_12)
memset(&roam_info, 0, sizeof(struct cfg80211_roam_info));
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- roam_info.links[0].channel = notify_channel;
- roam_info.links[0].bssid = curbssid;
-#else
roam_info.channel = notify_channel;
roam_info.bssid = curbssid;
-#endif
roam_info.req_ie = conn_info->req_ie;
roam_info.req_ie_len = conn_info->req_ie_len;
roam_info.resp_ie = conn_info->resp_ie;
@@ -13791,15 +13680,12 @@
return err;
fail:
-#ifdef WL_EXT_IAPSTA
- if (err)
- wl_ext_in4way_sync(ndev, STA_NO_BTC_IN4WAY, WL_EXT_STATUS_DISCONNECTED, NULL);
-#endif
#ifdef DHD_LOSSLESS_ROAMING
wl_del_roam_timeout(cfg);
#endif /* DHD_LOSSLESS_ROAMING */
return err;
}
+#endif /* DHD_LOSSLESS_ROAMING */
static bool
wl_cfg80211_verify_bss(struct bcm_cfg80211 *cfg, struct net_device *ndev,
@@ -13935,21 +13821,10 @@
resp_params = (struct cfg80211_connect_resp_params *)params;
resp_params->status = status;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- resp_params->links[0].bssid = curbssid;
- resp_params->links[0].bss = CFG80211_GET_BSS(wiphy, NULL, curbssid,
- ssid->SSID, ssid->SSID_len);
-#else
resp_params->bssid = curbssid;
resp_params->bss = CFG80211_GET_BSS(wiphy, NULL, curbssid,
ssid->SSID, ssid->SSID_len);
-#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- if (!resp_params->links[0].bss)
-#else
- if (!resp_params->bss)
-#endif
- {
+ if (!resp_params->bss) {
WL_ERR(("null bss\n"));
return BCME_ERROR;
}
@@ -14059,12 +13934,7 @@
completed = false;
sec->auth_assoc_res_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- if (!ndev->ieee80211_ptr->u.client.ssid_len)
-#else
- if (!ndev->ieee80211_ptr->ssid_len)
-#endif
- {
+ if (!ndev->ieee80211_ptr->ssid_len) {
/* In certain cases, the delayed cfg80211 work from
* disconnect context will induce race conditions in
* which the ssid_len will be cleared, but dhd is in
@@ -14092,6 +13962,10 @@
if (completed) {
WL_MSG(ndev->name, "Report connect result - connection succeeded\n");
+#ifdef WL_EXT_IAPSTA
+ wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
+ wl_ext_iapsta_enable_master_if(ndev, TRUE);
+#endif
} else {
WL_MSG(ndev->name, "Report connect result - connection failed\n");
#ifdef WL_EXT_IAPSTA
@@ -14140,13 +14014,6 @@
}
#endif /* WAPI */
}
-
-#ifdef WL_EXT_IAPSTA
- if (completed) {
- wl_ext_in4way_sync(ndev, 0, WL_EXT_STATUS_CONNECTED, NULL);
- wl_ext_iapsta_enable_master_if(ndev, TRUE);
- }
-#endif
exit:
CLR_TS(cfg, conn_start);
@@ -14757,11 +14624,11 @@
wl_cfg80211_ccode_evt_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *event, void *data)
{
- dhd_pub_t *dhd = cfg->pub;
s32 err = 0;
struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
char country_str[WLC_CNTRY_BUF_SZ] = { 0 };
struct net_device *dev = bcmcfg_to_prmry_ndev(cfg);
+ wl_country_t cspec = {{0}, 0, {0}};
if (strlcpy(country_str, data, WL_CCODE_LEN + 1) >= WLC_CNTRY_BUF_SZ) {
return -EINVAL;
@@ -14774,7 +14641,18 @@
}
WL_MSG(dev->name, "Updating new country %s\n", country_str);
- dhd_conf_country(dhd, "country", country_str);
+
+ strlcpy(cspec.country_abbrev, country_str, WL_CCODE_LEN + 1);
+ strlcpy(cspec.ccode, country_str, WL_CCODE_LEN + 1);
+ err = dhd_conf_map_country_list(dhd_get_pub(dev), &cspec);
+ if (err)
+ dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec);
+ err = dhd_conf_set_country(dhd_get_pub(dev), &cspec);
+ if (err < 0) {
+ WL_ERR(("set country for %s as %s rev %d failed\n",
+ country_str, cspec.ccode, cspec.rev));
+ }
+ dhd_conf_fix_country(dhd_get_pub(dev));
/* Indicate to upper layer for regdom change */
err = wl_update_wiphybands(cfg, true);
@@ -14920,11 +14798,9 @@
cfg->evt_handler[WLC_E_BSS_LOAD] = wl_cfg80211_bssload_report_event_handler;
#endif /* WL_CHAN_UTIL */
#ifdef WL_TWT
- cfg->evt_handler[WLC_E_TWT] = wl_notify_twt_event;
-#else
-#ifdef WL_TWT_HAL_IF
- cfg->evt_handler[WLC_E_TWT] = wl_cfgvendor_notify_twt_event;
-#endif /* WL_TWT_HAL_IF */
+ cfg->evt_handler[WLC_E_TWT_SETUP] = wl_notify_twt_event;
+ cfg->evt_handler[WLC_E_TWT_TEARDOWN] = wl_notify_twt_event;
+ cfg->evt_handler[WLC_E_TWT_INFO_FRM] = wl_notify_twt_event;
#endif /* WL_TWT */
#ifdef WL_CLIENT_SAE
cfg->evt_handler[WLC_E_JOIN_START] = wl_notify_start_auth;
@@ -15304,7 +15180,7 @@
wdev = ndev_to_wdev(dev);
if (!wdev) {
- WL_DBG(("wdev(%s) null. Do nothing\n", dev->name));
+ WL_ERR(("wdev null. Do nothing\n"));
return NOTIFY_DONE;
}
@@ -15811,6 +15687,9 @@
wl_destroy_event_handler(cfg);
wl_flush_eq(cfg);
wl_link_down(cfg);
+#if defined (WL_SCHED_SCAN) && defined (SCHED_SCAN_DELAYED_WORK)
+ cancel_delayed_work_sync(&cfg->sched_scan_stop_work);
+#endif /* WL_SCHED_SCAN */
del_timer_sync(&cfg->scan_timeout);
#ifdef DHD_LOSSLESS_ROAMING
del_timer_sync(&cfg->roam_timeout);
@@ -16077,6 +15956,9 @@
INIT_WORK(&cfg->wlan_work, wl_cfg80211_work_handler);
#endif /* DHCP_SCAN_SUPPRESS */
+#if defined (WL_SCHED_SCAN) && defined (SCHED_SCAN_DELAYED_WORK)
+ INIT_DELAYED_WORK(&cfg->sched_scan_stop_work, wl_cfgscan_sched_scan_stop_work);
+#endif /* WL_SCHED_SCAN */
INIT_DELAYED_WORK(&cfg->pm_enable_work, wl_cfg80211_work_handler);
INIT_DELAYED_WORK(&cfg->loc.work, wl_cfgscan_listen_complete_work);
INIT_DELAYED_WORK(&cfg->ap_work, wl_cfg80211_ap_timeout_work);
@@ -16343,7 +16225,7 @@
#ifdef OEM_ANDROID
if (cfg->event_workq == NULL) {
- WL_ERR(("Event handler is not created (%s)\n", bcmevent_get_name(event_type)));
+ WL_ERR(("Event handler is not created\n"));
return;
}
#endif /* OEM_ANDROID */
@@ -17243,10 +17125,6 @@
/* Start the event logging */
wl_add_remove_eventmsg(ndev, WLC_E_TRACE, TRUE);
#endif /* SHOW_LOGTRACE */
-#if defined(BCMDBUS)
- if (!dhd->dhd_console_ms)
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, FALSE);
-#endif
(void)memcpy_s(wdev->wiphy->perm_addr, ETHER_ADDR_LEN,
bcmcfg_to_prmry_ndev(cfg)->perm_addr, ETHER_ADDR_LEN);
@@ -17403,77 +17281,6 @@
return err;
}
-#ifdef BCMDBUS
-s32
-__wl_cfg80211_up_resume(dhd_pub_t *dhd)
-{
- struct net_device *ndev = dhd_linux_get_primary_netdev(dhd);
- struct bcm_cfg80211 *cfg;
- struct wireless_dev *wdev;
- s32 err = 0;
-#ifdef WL_HOST_BAND_MGMT
- s32 ret = 0;
-#endif /* WL_HOST_BAND_MGMT */
- u16 wl_iftype = 0;
- u16 wl_mode = 0;
-
- WL_DBG(("In\n"));
-
- if (!ndev)
- return -EINVAL;
- cfg = wl_get_cfg(ndev);
- wdev = ndev->ieee80211_ptr;
- if (!cfg || !wdev)
- return -EINVAL;
-
-#if defined(BCMDONGLEHOST)
- err = dhd_config_dongle(cfg);
- if (unlikely(err))
- return err;
-#endif /* defined(BCMDONGLEHOST) */
-
-#ifdef SHOW_LOGTRACE
- /* Start the event logging */
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, TRUE);
-#endif /* SHOW_LOGTRACE */
-#if defined(BCMDBUS)
- if (!dhd->dhd_console_ms)
- wl_add_remove_eventmsg(ndev, WLC_E_TRACE, FALSE);
-#endif
-
- if (cfg80211_to_wl_iftype(wdev->iftype, &wl_iftype, &wl_mode) < 0) {
- return -EINVAL;
- }
- if (!dhd->fw_preinit) {
- err = wl_config_infra(cfg, ndev, wl_iftype);
- if (unlikely(err && err != -EINPROGRESS)) {
- WL_ERR(("wl_config_infra failed\n"));
- if (err == -1) {
- WL_ERR(("return error %d\n", err));
- return err;
- }
- }
- }
-
-#ifdef WL_HOST_BAND_MGMT
- /* By default the curr_band is initialized to BAND_AUTO */
- if ((ret = wl_cfg80211_set_band(ndev, WLC_BAND_AUTO)) < 0) {
- if (ret == BCME_UNSUPPORTED) {
- /* Don't fail the initialization, lets just
- * fall back to the original method
- */
- WL_ERR(("WL_HOST_BAND_MGMT defined, "
- "but roam_band iovar not supported \n"));
- } else {
- WL_ERR(("roam_band failed. ret=%d", ret));
- err = -1;
- }
- }
-#endif /* WL_HOST_BAND_MGMT */
- return err;
-}
-#endif /* BCMDBUS */
-
static s32 __wl_cfg80211_down(struct bcm_cfg80211 *cfg)
{
s32 err = 0;
@@ -17622,12 +17429,7 @@
struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
struct wireless_dev *wdev = ndev->ieee80211_ptr;
struct cfg80211_bss *bss = CFG80211_GET_BSS(wiphy, NULL, latest_bssid,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO)
- wdev->u.client.ssid, wdev->u.client.ssid_len
-#else
- wdev->ssid, wdev->ssid_len
-#endif
- );
+ wdev->ssid, wdev->ssid_len);
BCM_REFERENCE(bss);
@@ -17786,7 +17588,7 @@
if (init_roam_cache(cfg, ioctl_version) == 0) {
/* Enable support for Roam cache */
cfg->rcc_enabled = true;
- WL_MSG(net->name, "Roam channel cache enabled\n");
+ WL_ERR(("Roam channel cache enabled\n"));
} else {
WL_ERR(("Failed to enable RCC.\n"));
}
@@ -19887,7 +19689,7 @@
bssidx, &cfg->ioctl_buf_sync);
if (ret == BCME_OK) {
ies = (vndr_ie_buf_t *)cfg->ioctl_buf;
- WL_INFORM_MEM(("FW IE count:%d\n", ies->iecount));
+ WL_INFORM_MEM(("FW IE count:%d ", ies->iecount));
#ifdef GET_FW_IE_DATA
if (wl_dbg_level & WL_DBG_DBG) {
int i = 0;
--
Gitblit v1.6.2