From 9d50dc51e5172bfbb737fb5a3d948bfff016a132 Mon Sep 17 00:00:00 2001 From: "lei.chen" Date: Thu, 14 Sep 2023 14:59:55 +0800 Subject: [PATCH] wifi: update bcmdhd.101.10.361.x version to 34. [1/1] PD#SWPL-139664 Problem: Connecting to web-64bits encrypted AP, connection failed Solution: fix it Verify: TL1 Change-Id: Ic8025f2e69b012de3203db7a8826c1f47979f863 Signed-off-by: lei.chen --- bcmdhd.101.10.361.x/Makefile | 4 +- bcmdhd.101.10.361.x/bcm_app_utils.c | 2 + bcmdhd.101.10.361.x/bcmsdh_sdmmc.c | 62 ++++++++++++++++++++++++- bcmdhd.101.10.361.x/bcmwifi_channels.c | 2 + bcmdhd.101.10.361.x/dbus_usb_linux.c | 20 ++++++++ bcmdhd.101.10.361.x/dhd_config.c | 31 +++++++++---- bcmdhd.101.10.361.x/dhd_config.h | 1 + bcmdhd.101.10.361.x/dhd_linux.c | 20 ++++---- bcmdhd.101.10.361.x/dhd_linux_platdev.c | 16 +++++++ bcmdhd.101.10.361.x/dhd_linux_priv.h | 2 +- bcmdhd.101.10.361.x/dhd_pcie.c | 4 +- bcmdhd.101.10.361.x/dhd_static_buf.c | 2 + bcmdhd.101.10.361.x/include/epivers.h | 2 +- bcmdhd.101.10.361.x/include/linux_osl.h | 2 +- bcmdhd.101.10.361.x/include/linuxver.h | 4 ++ bcmdhd.101.10.361.x/linux_osl.c | 2 +- bcmdhd.101.10.361.x/wl_android.c | 1 + bcmdhd.101.10.361.x/wl_android_ext.c | 6 ++- bcmdhd.101.10.361.x/wl_cfg80211.c | 60 +++++++++++++++++------- bcmdhd.101.10.361.x/wl_cfg80211.h | 2 +- bcmdhd.101.10.361.x/wl_cfgnan.h | 2 + bcmdhd.101.10.361.x/wl_cfgp2p.h | 2 +- bcmdhd.101.10.361.x/wl_cfgscan.c | 2 +- bcmdhd.101.10.361.x/wl_cfgvendor.c | 6 +++ bcmdhd.101.10.361.x/wl_cfgvif.c | 53 ++++++++++++++++----- bcmdhd.101.10.361.x/wl_cfgvif.h | 4 +- bcmdhd.101.10.361.x/wl_iapsta.c | 40 ++++++++-------- bcmdhd.101.10.361.x/wl_iw.c | 19 ++++---- bcmdhd.101.10.361.x/wl_iw.h | 1 - 29 files changed, 283 insertions(+), 91 deletions(-) diff --git a/bcmdhd.101.10.361.x/Makefile b/bcmdhd.101.10.361.x/Makefile index 8f8e8e5..67a5085 100755 --- a/bcmdhd.101.10.361.x/Makefile +++ b/bcmdhd.101.10.361.x/Makefile @@ -89,6 +89,7 @@ ifneq ($(CONFIG_CFG80211),) DHDOFILES += wl_linux_mon.o wl_cfg_btcoex.o wl_cfgvendor.o DHDOFILES += dhd_cfg80211.o wl_cfgvif.o wl_roam.o DHDCFLAGS += -DWL_CFG80211 -DWLP2P -DWL_CFG80211_STA_EVENT + DHDCFLAGS += -DWL_P2P_RAND DHDCFLAGS += -DWL_CAP_HE DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=10 @@ -100,6 +101,7 @@ ifneq ($(CONFIG_CFG80211),) # DHDCFLAGS += -DHOSTAPD_BW_SUPPORT DHDCFLAGS += -DWL_VIRTUAL_APSTA -DSTA_MGMT DHDCFLAGS += -DPNO_SUPPORT -DEXPLICIT_DISCIF_CLEANUP +# DHDCFLAGS += -DWL_SCHED_SCAN DHDCFLAGS += -DDHD_USE_SCAN_WAKELOCK DHDCFLAGS += -DSPECIFIC_MAC_GEN_SCHEME DHDCFLAGS += -DWL_IFACE_MGMT @@ -271,7 +273,7 @@ endif endif # MESH support for kernel 3.10 later -ifeq ($(CONFIG_WL_MESH),y) +ifeq ($(CONFIG_BCMDHD_WLMESH),y) DHDCFLAGS += -DWLMESH ifneq ($(CONFIG_CFG80211),) DHDCFLAGS += -DWLMESH_CFG80211 diff --git a/bcmdhd.101.10.361.x/bcm_app_utils.c b/bcmdhd.101.10.361.x/bcm_app_utils.c index 62d0507..3127143 100755 --- a/bcmdhd.101.10.361.x/bcm_app_utils.c +++ b/bcmdhd.101.10.361.x/bcm_app_utils.c @@ -28,7 +28,9 @@ #ifdef BCMDRIVER #include #define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) +#ifndef tolower #define tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c)) +#endif /* tolower */ #else /* BCMDRIVER */ #include #include diff --git a/bcmdhd.101.10.361.x/bcmsdh_sdmmc.c b/bcmdhd.101.10.361.x/bcmsdh_sdmmc.c index d4b6878..741cf89 100755 --- a/bcmdhd.101.10.361.x/bcmsdh_sdmmc.c +++ b/bcmdhd.101.10.361.x/bcmsdh_sdmmc.c @@ -513,7 +513,8 @@ enum { IOV_HCIREGS, IOV_POWER, IOV_CLOCK, - IOV_RXCHAIN + IOV_RXCHAIN, + IOV_DS }; const bcm_iovar_t sdioh_iovars[] = { @@ -537,6 +538,7 @@ const bcm_iovar_t sdioh_iovars[] = { #ifdef BCMDBG {"sd_hciregs", IOV_HCIREGS, 0, 0, IOVT_BUFFER, 0 }, #endif + {"sd_ds", IOV_DS, 0, 0, IOVT_UINT32, 0 }, {NULL, 0, 0, 0, 0, 0 } }; @@ -751,6 +753,64 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, int_val = (int32)0; bcopy(&int_val, arg, val_size); break; + + case IOV_GVAL(IOV_DS): + { + uint8 reg2; + int err; + + sdio_claim_host(si->func[0]); + reg2 = sdio_readb(si->func[0], SDIOD_CCCR_DRIVER_STRENGTH, &err); + if (err) { + sd_err(("sd_ds error for read SDIOD_CCCR_DRIVER_STRENGTH : 0x%x\n", err)); + bcmerror = BCME_SDIO_ERROR; + } else { + sd_trace(("sd_ds get cccr driver strength 0x%x\n", reg2)); + } + sdio_release_host(si->func[0]); + + int_val = (int)reg2; + bcopy(&int_val, arg, sizeof(int_val)); + break; + } + + case IOV_SVAL(IOV_DS): + { + uint8 reg2; + int err; + + sdio_claim_host(si->func[0]); + reg2 = sdio_readb(si->func[0], SDIOD_CCCR_DRIVER_STRENGTH, &err); + if (err) { + sd_err(("sd_ds error for read SDIOD_CCCR_DRIVER_STRENGTH : 0x%x\n", err)); + bcmerror = BCME_SDIO_ERROR; + sdio_release_host(si->func[0]); + break; + } else { + sd_trace(("sd_ds get cccr driver strength 0x%x\n", reg2)); + } + + if (int_val == 0) { + reg2 = ((reg2 & 0xf) | 0x0); + } else if (int_val == 1) { + reg2 = ((reg2 & 0xf) | 0x10); + } else if (int_val == 2) { + reg2 = ((reg2 & 0xf) | 0x20); + } else if (int_val == 3) { + reg2 = ((reg2 & 0xf) | 0x30); + } else { + bcmerror = BCME_BADARG; + sdio_release_host(si->func[0]); + break; + } + + sdio_writeb(si->func[0], reg2, SDIOD_CCCR_DRIVER_STRENGTH, &err); + if (err) { + sd_err(("sd_ds error write SDIOD_CCCR_DRIVER_STRENGTH : 0x%x\n", err)); + } + sdio_release_host(si->func[0]); + break; + } #ifdef BCMINTERNAL case IOV_GVAL(IOV_HOSTREG): { diff --git a/bcmdhd.101.10.361.x/bcmwifi_channels.c b/bcmdhd.101.10.361.x/bcmwifi_channels.c index 9387207..1ecd311 100755 --- a/bcmdhd.101.10.361.x/bcmwifi_channels.c +++ b/bcmdhd.101.10.361.x/bcmwifi_channels.c @@ -29,7 +29,9 @@ #ifdef BCMDRIVER #include #define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base)) +#ifndef tolower #define tolower(c) (bcm_isupper((c)) ? ((c) + 'a' - 'A') : (c)) +#endif #else #include #include diff --git a/bcmdhd.101.10.361.x/dbus_usb_linux.c b/bcmdhd.101.10.361.x/dbus_usb_linux.c index 96a25ce..f85d18f 100755 --- a/bcmdhd.101.10.361.x/dbus_usb_linux.c +++ b/bcmdhd.101.10.361.x/dbus_usb_linux.c @@ -908,7 +908,11 @@ dbus_usbos_recv_urb_submit(usbos_info_t *usbos_info, dbus_irb_rx_t *rxirb, uint3 usb_fill_bulk_urb(req->urb, usbos_info->usb, rx_pipe, p, rxirb->buf_len, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) + (void *)dbus_usbos_recv_complete, req); +#else (usb_complete_t)dbus_usbos_recv_complete, req); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) */ req->urb->transfer_flags |= URB_QUEUE_BULK; if ((ret = USB_SUBMIT_URB(req->urb))) { @@ -1828,7 +1832,11 @@ dbus_usbos_intf_send_irb(void *bus, dbus_irb_tx_t *txirb) req_zlp->buf_len = 0; usb_fill_bulk_urb(req_zlp->urb, usbos_info->usb, usbos_info->tx_pipe, NULL, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) + 0, (void *)dbus_usbos_send_complete, req_zlp); +#else 0, (usb_complete_t)dbus_usbos_send_complete, req_zlp); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) */ req_zlp->urb->transfer_flags |= URB_QUEUE_BULK; } @@ -1883,7 +1891,11 @@ dbus_usbos_intf_send_irb(void *bus, dbus_irb_tx_t *txirb) } usb_fill_bulk_urb(req->urb, usbos_info->usb, usbos_info->tx_pipe, buf, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) + buffer_length, (void *)dbus_usbos_send_complete, req); +#else buffer_length, (usb_complete_t)dbus_usbos_send_complete, req); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) */ req->urb->transfer_flags |= URB_QUEUE_BULK; @@ -2048,7 +2060,11 @@ dbus_usbos_intf_send_ctl(void *bus, uint8 *buf, int len) usbos_info->usb, usb_sndctrlpipe(usbos_info->usb, 0), (unsigned char *) &usbos_info->ctl_write, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) + buf, size, (void *)dbus_usbos_ctlwrite_complete, usbos_info); +#else buf, size, (usb_complete_t)dbus_usbos_ctlwrite_complete, usbos_info); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) */ #ifdef USBOS_TX_THREAD /* Enqueue CTRL request for transmission by the TX thread. The @@ -2113,7 +2129,11 @@ dbus_usbos_intf_recv_ctl(void *bus, uint8 *buf, int len) usbos_info->usb, usb_rcvctrlpipe(usbos_info->usb, 0), (unsigned char *) &usbos_info->ctl_read, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) + buf, size, (void *)dbus_usbos_ctlread_complete, usbos_info); +#else buf, size, (usb_complete_t)dbus_usbos_ctlread_complete, usbos_info); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) */ status = USB_SUBMIT_URB(usbos_info->ctl_urb); if (status < 0) { diff --git a/bcmdhd.101.10.361.x/dhd_config.c b/bcmdhd.101.10.361.x/dhd_config.c index 4df7ca3..32e269d 100755 --- a/bcmdhd.101.10.361.x/dhd_config.c +++ b/bcmdhd.101.10.361.x/dhd_config.c @@ -1932,24 +1932,39 @@ dhd_conf_scan_mac(dhd_pub_t * dhd, char *cmd, char *buf) } #endif +bool +dhd_conf_same_country(dhd_pub_t *dhd, char *buf) +{ + wl_country_t cspec = {{0}, 0, {0}}; + wl_country_t cur_cspec = {{0}, 0, {0}}; + + strlcpy(cspec.country_abbrev, buf, WL_CCODE_LEN + 1); + strlcpy(cspec.ccode, buf, WL_CCODE_LEN + 1); + dhd_conf_map_country_list(dhd, &cspec); + dhd_conf_get_country(dhd, &cur_cspec); + if (!memcmp(&cspec.ccode, &cur_cspec.ccode, WL_CCODE_LEN) && + (cspec.rev == cur_cspec.rev)) { + CONFIG_MSG("country code = %s/%d is already configured\n", + cspec.ccode, cspec.rev); + return TRUE; + } + + return FALSE; +} + int dhd_conf_country(dhd_pub_t *dhd, char *cmd, char *buf) { wl_country_t cspec = {{0}, 0, {0}}; - wl_country_t cur_cspec = {{0}, 0, {0}}; int err = 0; if (buf) { - dhd_conf_get_country(dhd, &cur_cspec); + if (dhd_conf_same_country(dhd, buf)) { + return 0; + } strlcpy(cspec.country_abbrev, buf, WL_CCODE_LEN + 1); strlcpy(cspec.ccode, buf, WL_CCODE_LEN + 1); dhd_conf_map_country_list(dhd, &cspec); - if (!memcmp(&cspec.ccode, &cur_cspec.ccode, WL_CCODE_LEN) && - (cspec.rev == cur_cspec.rev)) { - CONFIG_MSG("country code = %s/%d is already configured\n", - cspec.ccode, cspec.rev); - return 0; - } err = dhd_conf_set_country(dhd, &cspec); if (!err) { dhd_conf_fix_country(dhd); diff --git a/bcmdhd.101.10.361.x/dhd_config.h b/bcmdhd.101.10.361.x/dhd_config.h index e33e8c7..21b273a 100755 --- a/bcmdhd.101.10.361.x/dhd_config.h +++ b/bcmdhd.101.10.361.x/dhd_config.h @@ -418,6 +418,7 @@ void dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path); int dhd_conf_set_intiovar(dhd_pub_t *dhd, int ifidx, uint cmd, char *name, int val, int def, bool down); int dhd_conf_get_band(dhd_pub_t *dhd); +bool dhd_conf_same_country(dhd_pub_t *dhd, char *buf); int dhd_conf_country(dhd_pub_t *dhd, char *cmd, char *buf); int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec); #ifdef CCODE_LIST diff --git a/bcmdhd.101.10.361.x/dhd_linux.c b/bcmdhd.101.10.361.x/dhd_linux.c index e54223c..5613ab9 100755 --- a/bcmdhd.101.10.361.x/dhd_linux.c +++ b/bcmdhd.101.10.361.x/dhd_linux.c @@ -3558,7 +3558,9 @@ static void dhd_set_mac_addr_handler(void *handle, void *event_info, u8 event) { dhd_info_t *dhd = handle; - dhd_if_t *ifp = event_info; + int ifidx = (int)((long int)event_info); + dhd_if_t *ifp = NULL; + if (event != DHD_WQ_WORK_SET_MAC) { DHD_ERROR(("%s: unexpected event \n", __FUNCTION__)); @@ -3575,6 +3577,8 @@ dhd_set_mac_addr_handler(void *handle, void *event_info, u8 event) dhd_net_if_lock_local(dhd); DHD_OS_WAKE_LOCK(&dhd->pub); + ifp = dhd->iflist[ifidx]; + // terence 20160907: fix for not able to set mac when wlan0 is down if (ifp == NULL || !ifp->set_macaddress) { goto done; @@ -3626,11 +3630,6 @@ dhd_set_mcast_list_handler(void *handle, void *event_info, u8 event) goto done; } - if (ifp == NULL || !dhd->pub.up) { - DHD_ERROR(("%s: interface info not available/down \n", __FUNCTION__)); - goto done; - } - ifidx = ifp->idx; #ifdef MCAST_LIST_ACCUMULATION @@ -3703,8 +3702,8 @@ dhd_set_mac_address(struct net_device *dev, void *addr) } #endif /* WL_CFG80211 */ - dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)dhdif, DHD_WQ_WORK_SET_MAC, - dhd_set_mac_addr_handler, DHD_WQ_WORK_PRIORITY_LOW); + dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)((long int)ifidx), + DHD_WQ_WORK_SET_MAC, dhd_set_mac_addr_handler, DHD_WQ_WORK_PRIORITY_LOW); return ret; } @@ -3723,7 +3722,7 @@ dhd_set_multicast_list(struct net_device *dev) DHD_WQ_WORK_SET_MCAST_LIST, dhd_set_mcast_list_handler, DHD_WQ_WORK_PRIORITY_LOW); // terence 20160907: fix for not able to set mac when wlan0 is down - dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)dhd->iflist[ifidx], + dhd_deferred_schedule_work(dhd->dhd_deferred_wq, (void *)((long int)ifidx), DHD_WQ_WORK_SET_MAC, dhd_set_mac_addr_handler, DHD_WQ_WORK_PRIORITY_LOW); } @@ -16993,7 +16992,8 @@ dhd_register_if(dhd_pub_t *dhdp, int ifidx, bool need_rtnl_lock) wl_ext_iapsta_update_net_device(net, ifidx); #endif /* WL_EXT_IAPSTA */ if (dhd->pub.up == 1) { - if (_dhd_set_mac_address(dhd, ifidx, net->dev_addr, FALSE) == 0) + memcpy(temp_addr, net->dev_addr, ETHER_ADDR_LEN); + if (_dhd_set_mac_address(dhd, ifidx, temp_addr, FALSE) == 0) DHD_INFO(("%s: MACID is overwritten\n", __FUNCTION__)); else DHD_ERROR(("%s: _dhd_set_mac_address() failed\n", __FUNCTION__)); diff --git a/bcmdhd.101.10.361.x/dhd_linux_platdev.c b/bcmdhd.101.10.361.x/dhd_linux_platdev.c index 8d65e48..690049c 100755 --- a/bcmdhd.101.10.361.x/dhd_linux_platdev.c +++ b/bcmdhd.101.10.361.x/dhd_linux_platdev.c @@ -158,6 +158,10 @@ wifi_adapter_info_t* dhd_wifi_platform_get_adapter(uint32 bus_type, uint32 bus_n return NULL; } +#if defined(CONFIG_WIFI_CONTROL_FUNC) && defined(CONFIG_DHD_USE_STATIC_BUF) +extern void *dhd_wlan_mem_prealloc(int section, unsigned long size); +#endif /* CONFIG_WIFI_CONTROL_FUNC && CONFIG_DHD_USE_STATIC_BUF */ + void* wifi_platform_prealloc(wifi_adapter_info_t *adapter, int section, unsigned long size) { void *alloc_ptr = NULL; @@ -169,8 +173,12 @@ void* wifi_platform_prealloc(wifi_adapter_info_t *adapter, int section, unsigned if (plat_data->mem_prealloc) { #if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER) alloc_ptr = plat_data->mem_prealloc(adapter->bus_type, adapter->index, section, size); +#else +#if defined(CONFIG_WIFI_CONTROL_FUNC) && defined(CONFIG_DHD_USE_STATIC_BUF) + alloc_ptr = dhd_wlan_mem_prealloc(section, size); #else alloc_ptr = plat_data->mem_prealloc(section, size); +#endif #endif if (alloc_ptr) { DHD_INFO(("success alloc section %d\n", section)); @@ -257,7 +265,11 @@ int wifi_platform_set_power(wifi_adapter_info_t *adapter, bool on, unsigned long } #endif /* ENABLE_4335BT_WAR */ +#ifdef CONFIG_WIFI_CONTROL_FUNC + err = plat_data->set_power(on); +#else err = plat_data->set_power(on, adapter); +#endif } if (msec && !err) @@ -307,7 +319,11 @@ int wifi_platform_get_mac_addr(wifi_adapter_info_t *adapter, unsigned char *buf, return -EINVAL; plat_data = adapter->wifi_plat_data; if (plat_data->get_mac_addr) { +#ifdef CONFIG_WIFI_CONTROL_FUNC + return plat_data->get_mac_addr(buf); +#else return plat_data->get_mac_addr(buf, ifidx); +#endif } return -EOPNOTSUPP; } diff --git a/bcmdhd.101.10.361.x/dhd_linux_priv.h b/bcmdhd.101.10.361.x/dhd_linux_priv.h index 019884b..ce3aaa5 100755 --- a/bcmdhd.101.10.361.x/dhd_linux_priv.h +++ b/bcmdhd.101.10.361.x/dhd_linux_priv.h @@ -501,7 +501,7 @@ extern uint sssr_enab; extern uint fis_enab; #endif /* DHD_SSSR_DUMP */ -#if defined(ANDROID_VERSION) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) +#if defined(ANDROID_VERSION) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) #define WAKELOCK_BACKPORT #endif diff --git a/bcmdhd.101.10.361.x/dhd_pcie.c b/bcmdhd.101.10.361.x/dhd_pcie.c index ee82a99..21f5ed2 100755 --- a/bcmdhd.101.10.361.x/dhd_pcie.c +++ b/bcmdhd.101.10.361.x/dhd_pcie.c @@ -9454,7 +9454,7 @@ dhd_bus_hostready(struct dhd_bus *bus) return; } - DHD_ERROR_MEM(("%s : Read PCICMD Reg: 0x%08X\n", __FUNCTION__, + DHD_ERROR(("%s : Read PCICMD Reg: 0x%08X\n", __FUNCTION__, dhd_pcie_config_read(bus, PCI_CFG_CMD, sizeof(uint32)))); dhd_bus_dump_dar_registers(bus); @@ -9464,7 +9464,7 @@ dhd_bus_hostready(struct dhd_bus *bus) #endif /* defined(DHD_MMIO_TRACE) */ si_corereg(bus->sih, bus->sih->buscoreidx, dhd_bus_db1_addr_get(bus), ~0, 0x12345678); bus->hostready_count ++; - DHD_ERROR_MEM(("%s: Ring Hostready:%d\n", __FUNCTION__, bus->hostready_count)); + DHD_ERROR(("%s: Ring Hostready:%d\n", __FUNCTION__, bus->hostready_count)); } /* Clear INTSTATUS */ diff --git a/bcmdhd.101.10.361.x/dhd_static_buf.c b/bcmdhd.101.10.361.x/dhd_static_buf.c index b565b90..ec803e6 100755 --- a/bcmdhd.101.10.361.x/dhd_static_buf.c +++ b/bcmdhd.101.10.361.x/dhd_static_buf.c @@ -48,7 +48,9 @@ do { \ #ifndef BCMDBUS #define BCMDBUS #endif +#ifndef DHD_USE_STATIC_MEMDUMP #define DHD_USE_STATIC_MEMDUMP { : = y} +#endif //#define BCMDHD_UNUSE_MEM #endif diff --git a/bcmdhd.101.10.361.x/include/epivers.h b/bcmdhd.101.10.361.x/include/epivers.h index 2061770..68c2c6e 100755 --- a/bcmdhd.101.10.361.x/include/epivers.h +++ b/bcmdhd.101.10.361.x/include/epivers.h @@ -45,7 +45,7 @@ #elif (defined (BCMDBG_ASSERT) && !defined (BCMDBG_ASSERT_DISABLED)) #define EPI_VERSION_STR "101.10.361 (wlan=r892223 ASSRT)" #else -#define EPI_VERSION_STR "101.10.361.32 (wlan=r892223-20230508-1)" +#define EPI_VERSION_STR "101.10.361.34 (wlan=r892223-20230904-2)" #endif /* BCMINTERNAL */ #endif /* _epivers_h_ */ diff --git a/bcmdhd.101.10.361.x/include/linux_osl.h b/bcmdhd.101.10.361.x/include/linux_osl.h index f81edab..db0799b 100755 --- a/bcmdhd.101.10.361.x/include/linux_osl.h +++ b/bcmdhd.101.10.361.x/include/linux_osl.h @@ -817,7 +817,7 @@ typedef struct osl_timer { typedef void (*linux_timer_fn)(ulong arg); -extern osl_timer_t * osl_timer_init(osl_t *osh, const char *name, void (*fn)(void *arg), void *arg); +extern osl_timer_t * osl_timer_init(osl_t *osh, const char *name, void (*fn)(ulong arg), void *arg); extern void osl_timer_add(osl_t *osh, osl_timer_t *t, uint32 ms, bool periodic); extern void osl_timer_update(osl_t *osh, osl_timer_t *t, uint32 ms, bool periodic); extern bool osl_timer_del(osl_t *osh, osl_timer_t *t); diff --git a/bcmdhd.101.10.361.x/include/linuxver.h b/bcmdhd.101.10.361.x/include/linuxver.h index 355eacc..5e4fe73 100755 --- a/bcmdhd.101.10.361.x/include/linuxver.h +++ b/bcmdhd.101.10.361.x/include/linuxver.h @@ -941,6 +941,10 @@ int kernel_read_compat(struct file *file, loff_t offset, char *addr, unsigned lo #define kernel_read_compat(file, offset, addr, count) kernel_read(file, offset, addr, count) #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0) */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) +#include +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)) */ + #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) #define netdev_tx_t int #endif diff --git a/bcmdhd.101.10.361.x/linux_osl.c b/bcmdhd.101.10.361.x/linux_osl.c index 6af4812..5a7ff58 100755 --- a/bcmdhd.101.10.361.x/linux_osl.c +++ b/bcmdhd.101.10.361.x/linux_osl.c @@ -1787,7 +1787,7 @@ timer_cb_compat(struct timer_list *tl) /* Note: All timer api's are thread unsafe and should be protected with locks by caller */ osl_timer_t * -osl_timer_init(osl_t *osh, const char *name, void (*fn)(void *arg), void *arg) +osl_timer_init(osl_t *osh, const char *name, void (*fn)(ulong arg), void *arg) { osl_timer_t *t; BCM_REFERENCE(fn); diff --git a/bcmdhd.101.10.361.x/wl_android.c b/bcmdhd.101.10.361.x/wl_android.c index b108fca..8f66bec 100755 --- a/bcmdhd.101.10.361.x/wl_android.c +++ b/bcmdhd.101.10.361.x/wl_android.c @@ -450,6 +450,7 @@ typedef struct android_wifi_af_params { #define BUFSZ 8 #define BUFSZN BUFSZ + 1 +#undef _S #define _S(x) #x #define S(x) _S(x) diff --git a/bcmdhd.101.10.361.x/wl_android_ext.c b/bcmdhd.101.10.361.x/wl_android_ext.c index 54d8546..4f45b0b 100755 --- a/bcmdhd.101.10.361.x/wl_android_ext.c +++ b/bcmdhd.101.10.361.x/wl_android_ext.c @@ -1720,6 +1720,7 @@ wl_ext_recal(struct net_device *dev, char *data, char *command, int ret = 0, i, nchan, nssid = 0; int params_size = WL_SCAN_PARAMS_V1_FIXED_SIZE + WL_NUMCHANNELS * sizeof(uint16); wl_scan_params_v1_t *params = NULL; + uint16 *chan_list = NULL; char *p; AEXT_TRACE(dev->name, "Enter\n"); @@ -1744,8 +1745,9 @@ wl_ext_recal(struct net_device *dev, char *data, char *command, params->scan_type |= WL_SCANFLAGS_PASSIVE; nchan = 2; - params->channel_list[0] = wf_channel2chspec(1, WL_CHANSPEC_BW_20); - params->channel_list[1] = wf_channel2chspec(2, WL_CHANSPEC_BW_20); + chan_list = params->channel_list; + chan_list[0] = wf_channel2chspec(1, WL_CHANSPEC_BW_20); + chan_list[1] = wf_channel2chspec(2, WL_CHANSPEC_BW_20); params->nprobes = htod32(params->nprobes); params->active_time = htod32(params->active_time); diff --git a/bcmdhd.101.10.361.x/wl_cfg80211.c b/bcmdhd.101.10.361.x/wl_cfg80211.c index db46ac7..6dbdfbb 100755 --- a/bcmdhd.101.10.361.x/wl_cfg80211.c +++ b/bcmdhd.101.10.361.x/wl_cfg80211.c @@ -1335,9 +1335,6 @@ static const rsn_akm_wpa_auth_entry_t rsn_akm_wpa_auth_lookup_tbl[] = { #define BUFSZ 8 #define BUFSZN BUFSZ + 1 -#define _S(x) #x -#define S(x) _S(x) - #define SOFT_AP_IF_NAME "swlan0" /* watchdog timer for disconnecting when fw is not associated for FW_ASSOC_WATCHDOG_TIME ms */ @@ -2462,7 +2459,7 @@ _wl_cfg80211_check_axi_error(struct bcm_cfg80211 *cfg) struct wireless_dev * wl_cfg80211_add_if(struct bcm_cfg80211 *cfg, struct net_device *primary_ndev, - wl_iftype_t wl_iftype, const char *name, u8 *mac) + wl_iftype_t wl_iftype, const char *name, const u8 *mac) { u8 mac_addr[ETH_ALEN]; s32 err = -ENODEV; @@ -10673,6 +10670,11 @@ wl_is_ccode_change_required(struct net_device *net, s32 ret = BCME_OK; wl_country_t cspec = {{0}, 0, {0}}; wl_country_t cur_cspec = {{0}, 0, {0}}; + struct dhd_pub *dhd = dhd_get_pub(net); + + if (dhd_conf_same_country(dhd, country_code)) { + return false; + } ret = wldev_iovar_getbuf(net, "country", NULL, 0, &cur_cspec, sizeof(cur_cspec), NULL); @@ -14016,7 +14018,7 @@ wl_bss_roaming_done(struct bcm_cfg80211 *cfg, struct net_device *ndev, return err; fail: -#ifdef WL_EXT_IAPSTA +#if defined(WL_EXT_IAPSTA) && !defined(WL_EXT_DISCONNECT_RECONNECT) if (err) wl_ext_in4way_sync(ndev, STA_NO_BTC_IN4WAY, WL_EXT_STATUS_DISCONNECTED, NULL); #endif @@ -20664,19 +20666,28 @@ static int wl_cfg80211_update_owe_info(struct wiphy *wiphy, struct net_device *d int err = 0; struct bcm_cfg80211 *cfg = wl_get_cfg(dev); dhd_pub_t *dhdp = (dhd_pub_t *)(cfg->pub); - wl_assoc_resp_params_v1_t *assoc_resp_params; - uint8 resp_buf[AP_OWE_IOCTL_BUF_SIZE]; + wl_assoc_resp_params_v1_t *assoc_resp_params = NULL; + uint8 *resp_buf = NULL; uint8 *p_resp_ies_tlv = NULL; uint16 assoc_params_iovsize; WL_DBG(("%s: Enter\n", __func__)); + + resp_buf = MALLOCZ(dhdp->osh, AP_OWE_IOCTL_BUF_SIZE); + if (resp_buf == NULL) { + WL_ERR(("error: failed to allocate %d bytes of memory\n", AP_OWE_IOCTL_BUF_SIZE)); + err = BCME_NOMEM; + goto exit; + } + assoc_params_iovsize = AP_OWE_ASSOC_RESP_PARAMS_BUFSZ + OFFSETOF(wl_assoc_resp_params_v1_t, ies); assoc_resp_params = (wl_assoc_resp_params_v1_t *)MALLOCZ(dhdp->osh, assoc_params_iovsize); if (assoc_resp_params == NULL) { WL_ERR(("error: failed to allocate %d bytes of memory\n", assoc_params_iovsize)); - return BCME_ERROR; + err = BCME_NOMEM; + goto exit; } /* setup assoc_resp_params iovar */ assoc_resp_params->version = WL_ASSOC_RESP_PARAMS_V1; @@ -20709,6 +20720,10 @@ static int wl_cfg80211_update_owe_info(struct wiphy *wiphy, struct net_device *d WL_DBG(("ap_assoc_resp_params failed, err=%d\n", err)); } exit: + if (resp_buf) + MFREE(dhdp->osh, resp_buf, AP_OWE_IOCTL_BUF_SIZE); + if (assoc_resp_params) + MFREE(dhdp->osh, assoc_resp_params, assoc_params_iovsize); return err; } #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) */ @@ -22090,6 +22105,9 @@ wl_cfg80211_sup_event_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgde u32 status = ntoh32(event->status); struct net_device *ndev = bcmcfg_to_prmry_ndev(cfg); u32 reason = ntoh32(event->reason); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) + const u8 *curbssid = (const u8 *)event->addr.octet; +#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(4, 15, 0) */ if (!wl_get_drv_status(cfg, CFG80211_CONNECT, ndev)) { /* Join attempt via non-cfg80211 interface. @@ -22103,17 +22121,23 @@ wl_cfg80211_sup_event_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgde if ((status == WLC_SUP_KEYED || status == WLC_SUP_KEYXCHANGE_WAIT_G1) && reason == WLC_E_SUP_OTHER) { -#if ((defined (AML_KERNEL_VERSION) && AML_KERNEL_VERSION >= 15) || LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)) - /* NL80211_CMD_PORT_AUTHORIZED supported above >= 4.15 */ - cfg80211_port_authorized(ndev, (u8 *)wl_read_prof(cfg, ndev, WL_PROF_BSSID), - NULL, 0, GFP_KERNEL); - WL_INFORM_MEM(("4way HS finished. port authorized event sent\n")); -#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) - /* NL80211_CMD_PORT_AUTHORIZED supported above >= 4.15 */ - cfg80211_port_authorized(ndev, (u8 *)wl_read_prof(cfg, ndev, WL_PROF_BSSID), - GFP_KERNEL); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) + if (!ETHER_ISNULLADDR(curbssid)) { + WL_DBG(("Authorizing Port with BSSID from FW event " MACDBG" \n", + MAC2STRDBG(curbssid))); + } else { + curbssid = wl_read_prof(cfg, ndev, WL_PROF_BSSID); + WL_DBG(("Authorizing Port with BSSID from DHD profile " MACDBG" \n", + MAC2STRDBG(curbssid))); + } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0)) || \ + ((ANDROID_VERSION >= 13) && (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 94))) + cfg80211_port_authorized(ndev, (const u8 *)curbssid, NULL, 0, GFP_KERNEL); +#else + cfg80211_port_authorized(ndev, (const u8 *)curbssid, GFP_KERNEL); +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(6, 2, 0) */ WL_INFORM_MEM(("4way HS finished. port authorized event sent\n")); -#elif ((LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0)) || defined(WL_VENDOR_EXT_SUPPORT)) +#elif (LINUX_VERSION_CODE > KERNEL_VERSION(3, 14, 0)) || defined(WL_VENDOR_EXT_SUPPORT) err = wl_cfgvendor_send_async_event(bcmcfg_to_wiphy(cfg), ndev, BRCM_VENDOR_EVENT_PORT_AUTHORIZED, NULL, 0); WL_INFORM_MEM(("4way HS finished. port authorized event sent\n")); diff --git a/bcmdhd.101.10.361.x/wl_cfg80211.h b/bcmdhd.101.10.361.x/wl_cfg80211.h index d05482b..30d45b2 100755 --- a/bcmdhd.101.10.361.x/wl_cfg80211.h +++ b/bcmdhd.101.10.361.x/wl_cfg80211.h @@ -2959,7 +2959,7 @@ int wl_set_rssi_logging(struct net_device *dev, void *param); int wl_get_rssi_per_ant(struct net_device *dev, char *ifname, char *peer_mac, void *param); #endif /* SUPPORT_RSSI_SUM_REPORT */ struct wireless_dev * wl_cfg80211_add_if(struct bcm_cfg80211 *cfg, struct net_device *primary_ndev, - wl_iftype_t wl_iftype, const char *name, u8 *mac); + wl_iftype_t wl_iftype, const char *name, const u8 *mac); extern s32 wl_cfg80211_del_if(struct bcm_cfg80211 *cfg, struct net_device *primary_ndev, struct wireless_dev *wdev, char *name); s32 _wl_cfg80211_del_if(struct bcm_cfg80211 *cfg, struct net_device *primary_ndev, diff --git a/bcmdhd.101.10.361.x/wl_cfgnan.h b/bcmdhd.101.10.361.x/wl_cfgnan.h index 703e645..d90987f 100755 --- a/bcmdhd.101.10.361.x/wl_cfgnan.h +++ b/bcmdhd.101.10.361.x/wl_cfgnan.h @@ -90,7 +90,9 @@ #define NAME_TO_STR(name) #name #define NAN_ID_CTRL_SIZE ((NAN_MAXIMUM_ID_NUMBER/8) + 1) +#ifndef tolower #define tolower(c) bcm_tolower(c) +#endif /* tolower */ #define NMR2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5], (a)[6], (a)[7] #define NMRSTR "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x" diff --git a/bcmdhd.101.10.361.x/wl_cfgp2p.h b/bcmdhd.101.10.361.x/wl_cfgp2p.h index 33a3c1f..c34d4c2 100755 --- a/bcmdhd.101.10.361.x/wl_cfgp2p.h +++ b/bcmdhd.101.10.361.x/wl_cfgp2p.h @@ -222,7 +222,7 @@ enum wl_cfgp2p_status { #endif #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) #ifdef WL_CFG80211_STA_EVENT #undef WL_CFG80211_STA_EVENT #endif diff --git a/bcmdhd.101.10.361.x/wl_cfgscan.c b/bcmdhd.101.10.361.x/wl_cfgscan.c index 85eb430..cd700d7 100755 --- a/bcmdhd.101.10.361.x/wl_cfgscan.c +++ b/bcmdhd.101.10.361.x/wl_cfgscan.c @@ -4450,7 +4450,7 @@ wl_notify_sched_scan_results(struct bcm_cfg80211 *cfg, struct net_device *ndev, STATIC_ASSERT(sizeof(wl_pfn_net_info_v1_t) == sizeof(wl_pfn_net_info_v2_t)); STATIC_ASSERT(sizeof(wl_pfn_lnet_info_v1_t) == sizeof(wl_pfn_lnet_info_v2_t)); STATIC_ASSERT(sizeof(wl_pfn_subnet_info_v1_t) == sizeof(wl_pfn_subnet_info_v2_t)); - STATIC_ASSERT(OFFSETOF(wl_pfn_subnet_info_v1_t, SSID) == + ASSERT(OFFSETOF(wl_pfn_subnet_info_v1_t, SSID) == OFFSETOF(wl_pfn_subnet_info_v2_t, u.SSID)); /* Extract the version-specific items */ diff --git a/bcmdhd.101.10.361.x/wl_cfgvendor.c b/bcmdhd.101.10.361.x/wl_cfgvendor.c index 71c16f8..bf9415b 100755 --- a/bcmdhd.101.10.361.x/wl_cfgvendor.c +++ b/bcmdhd.101.10.361.x/wl_cfgvendor.c @@ -6945,6 +6945,8 @@ static int wl_cfgvendor_lstats_get_info(struct wiphy *wiphy, if (err != BCME_OK && err != BCME_UNSUPPORTED) { WL_ERR(("error (%d) - size = %zu\n", err, sizeof(wl_pwrstats_t))); goto exit; + } else if (err == BCME_UNSUPPORTED) { + goto exit; } pwrstats = (wl_pwrstats_t *) iovar_buf; @@ -8302,7 +8304,9 @@ static int wl_cfgvendor_nla_put_dump_data(dhd_pub_t *dhd_pub, struct sk_buff *sk wl_cfgvendor_nla_put_axi_error_data(skb, ndev); } #endif /* DNGL_AXI_ERROR_LOGGING */ +#if defined(DHD_FW_COREDUMP) if (dhd_pub->memdump_enabled || (dhd_pub->memdump_type == DUMP_TYPE_BY_SYSDUMP)) { +#endif /* DHD_FW_COREDUMP */ if (((ret = wl_cfgvendor_nla_put_debug_dump_data(skb, ndev)) < 0) || ((ret = wl_cfgvendor_nla_put_memdump_data(skb, ndev, fw_len)) < 0) || ((ret = wl_cfgvendor_nla_put_sssr_dump_data(skb, ndev)) < 0)) { @@ -8313,7 +8317,9 @@ static int wl_cfgvendor_nla_put_dump_data(dhd_pub_t *dhd_pub, struct sk_buff *sk goto done; } #endif /* DHD_PKT_LOGGING */ +#if defined(DHD_FW_COREDUMP) } +#endif /* DHD_FW_COREDUMP */ done: return ret; } diff --git a/bcmdhd.101.10.361.x/wl_cfgvif.c b/bcmdhd.101.10.361.x/wl_cfgvif.c index 6a43073..6297e7f 100755 --- a/bcmdhd.101.10.361.x/wl_cfgvif.c +++ b/bcmdhd.101.10.361.x/wl_cfgvif.c @@ -879,7 +879,7 @@ wl_cfg80211_handle_if_role_conflict(struct bcm_cfg80211 *cfg, #endif /* WL_IFACE_MGMT */ s32 -wl_release_vif_macaddr(struct bcm_cfg80211 *cfg, u8 *mac_addr, u16 wl_iftype) +wl_release_vif_macaddr(struct bcm_cfg80211 *cfg, const u8 *mac_addr, u16 wl_iftype) { struct net_device *ndev = bcmcfg_to_prmry_ndev(cfg); u16 org_toggle_bytes; @@ -4430,7 +4430,7 @@ wl_get_auth_assoc_status(struct bcm_cfg80211 *cfg, struct net_device *ndev, */ #if !defined(WL_CFG80211_STA_EVENT) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)) static s32 -wl_notify_connect_status_ap_legacy(struct bcm_cfg80211 *cfg, struct net_device *ndev +wl_notify_connect_status_ap_legacy(struct bcm_cfg80211 *cfg, struct net_device *ndev, const wl_event_msg_t *e, void *data) { s32 err = 0; @@ -4438,6 +4438,8 @@ wl_notify_connect_status_ap_legacy(struct bcm_cfg80211 *cfg, struct net_device * u32 reason = ntoh32(e->reason); u32 len = ntoh32(e->datalen); u32 status = ntoh32(e->status); + chanspec_t chanspec; + bool retval; bool isfree = false; u8 *mgmt_frame; @@ -4508,7 +4510,8 @@ wl_notify_connect_status_ap_legacy(struct bcm_cfg80211 *cfg, struct net_device * return err; } chanspec = wl_chspec_driver_to_host(chanspec); - freq = wl_channel_to_frequency(wf_chspec_ctlchan(chanspec), CHSPEC_BAND(chanspec)); + channel = wf_chspec_ctlchan(chanspec); + freq = wl_channel_to_frequency(channel, CHSPEC_BAND(chanspec)); body_len = len; err = wl_frame_get_mgmt(cfg, fc, &da, &e->addr, &bssid, &mgmt_frame, &len, body); @@ -4519,16 +4522,44 @@ wl_notify_connect_status_ap_legacy(struct bcm_cfg80211 *cfg, struct net_device * if ((event == WLC_E_ASSOC_IND && reason == DOT11_SC_SUCCESS) || (event == WLC_E_DISASSOC_IND) || ((event == WLC_E_DEAUTH_IND) || (event == WLC_E_DEAUTH))) { + if (event == WLC_E_ASSOC_IND && reason == DOT11_SC_SUCCESS) { + WL_MSG(ndev->name, "new sta event for "MACDBG "\n", + MAC2STRDBG(e->addr.octet)); +#ifdef WL_EXT_IAPSTA + wl_ext_in4way_sync(ndev, AP_WAIT_STA_RECONNECT, + WL_EXT_STATUS_STA_CONNECTED, (void *)&e->addr); +#endif +#ifdef STA_MGMT + if (!wl_ext_add_sta_info(ndev, (u8 *)&e->addr)) { + return -EINVAL; + } +#endif /* STA_MGMT */ + } else if (event == WLC_E_DISASSOC_IND || event == WLC_E_DEAUTH_IND || + event == WLC_E_DEAUTH) { + WL_MSG_RLMT(ndev->name, &e->addr, ETHER_ADDR_LEN, + "del sta event for "MACDBG "\n", MAC2STRDBG(e->addr.octet)); +#ifdef WL_EXT_IAPSTA + wl_ext_in4way_sync(ndev, AP_WAIT_STA_RECONNECT, + WL_EXT_STATUS_STA_DISCONNECTED, (void *)&e->addr); +#endif +#ifdef STA_MGMT + if (!wl_ext_del_sta_info(ndev, (u8 *)&e->addr)) { + return -EINVAL; + } +#endif /* STA_MGMT */ + } #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) - cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0); + retval = cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0); #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)) - cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); + retval = cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, 0, GFP_ATOMIC); #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0)) || \ defined(WL_COMPAT_WIRELESS) - cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, GFP_ATOMIC); + retval = cfg80211_rx_mgmt(ndev, freq, 0, mgmt_frame, len, GFP_ATOMIC); #else - cfg80211_rx_mgmt(ndev, freq, mgmt_frame, len, GFP_ATOMIC); + retval = cfg80211_rx_mgmt(ndev, freq, mgmt_frame, len, GFP_ATOMIC); #endif /* LINUX_VERSION >= VERSION(3, 18,0) || WL_COMPAT_WIRELESS */ + WL_DBG(("mgmt_frame_len (%d) , e->datalen (%d), channel (%d), freq (%d) retval (%d)\n", + len, ntoh32(e->datalen), channel, freq, retval)); } exit: @@ -4698,8 +4729,6 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev, wl_wps_session_update(ndev, WPS_STATE_LINKDOWN, e->addr.octet); #endif /* WL_WPS_SYNC */ } - -#endif /* LINUX_VERSION < VERSION(3,2,0) && !WL_CFG80211_STA_EVENT && !WL_COMPAT_WIRELESS */ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)) else if (event == WLC_E_OWE_INFO) { if (!data) { @@ -4717,6 +4746,7 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev, cfg80211_update_owe_info_event(ndev, &owe_info, GFP_ATOMIC); } #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0) */ +#endif /* LINUX_VERSION < VERSION(3,2,0) && !WL_CFG80211_STA_EVENT && !WL_COMPAT_WIRELESS */ return err; } @@ -5337,13 +5367,14 @@ wl_cfg80211_ch_switch_notify(struct net_device *dev, uint16 chanspec, struct wip #if (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 8, 0)) freq = chandef.chan ? chandef.chan->center_freq : chandef.center_freq1; -#if ((defined (AML_KERNEL_VERSION) && AML_KERNEL_VERSION >= 15) || LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) || \ + ((ANDROID_VERSION >= 13) && (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 94))) cfg80211_ch_switch_notify(dev, &chandef, 0, 0); #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 19, 2) || defined(CFG80211_BKPORT_MLO) cfg80211_ch_switch_notify(dev, &chandef, 0); #else cfg80211_ch_switch_notify(dev, &chandef); -#endif /* CFG80211_BKPORT_MLO */ +#endif /* LINUX_VER >= 5.19.2 || defined(CFG80211_BKPORT_MLO) */ #elif (LINUX_VERSION_CODE >= KERNEL_VERSION (3, 5, 0) && (LINUX_VERSION_CODE <= (3, 7, 0))) freq = chandef.freq; cfg80211_ch_switch_notify(dev, freq, chandef.chan_type); diff --git a/bcmdhd.101.10.361.x/wl_cfgvif.h b/bcmdhd.101.10.361.x/wl_cfgvif.h index c949c10..d665792 100755 --- a/bcmdhd.101.10.361.x/wl_cfgvif.h +++ b/bcmdhd.101.10.361.x/wl_cfgvif.h @@ -126,7 +126,7 @@ extern wl_iftype_t wl_cfg80211_get_sec_iface(struct bcm_cfg80211 *cfg); #endif /* WL_IFACE_MGMT */ extern s32 wl_get_vif_macaddr(struct bcm_cfg80211 *cfg, u16 wl_iftype, u8 *mac_addr); -extern s32 wl_release_vif_macaddr(struct bcm_cfg80211 *cfg, u8 *mac_addr, u16 wl_iftype); +extern s32 wl_release_vif_macaddr(struct bcm_cfg80211 *cfg, const u8 *mac_addr, u16 wl_iftype); int wl_cfg80211_set_he_mode(struct net_device *dev, struct bcm_cfg80211 *cfg, s32 bssidx, u32 interface_type, bool set); @@ -244,8 +244,6 @@ wl_cfg80211_add_virtual_iface(struct wiphy *wiphy, #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) */ struct vif_params *params); extern s32 wl_cfg80211_del_virtual_iface(struct wiphy *wiphy, bcm_struct_cfgdev *cfgdev); -extern s32 wl_cfg80211_change_beacon(struct wiphy *wiphy, struct net_device *dev, - struct cfg80211_beacon_data *info); extern s32 wl_get_auth_assoc_status(struct bcm_cfg80211 *cfg, struct net_device *ndev, const wl_event_msg_t *e, void *data); diff --git a/bcmdhd.101.10.361.x/wl_iapsta.c b/bcmdhd.101.10.361.x/wl_iapsta.c index f6a5424..b3222ca 100755 --- a/bcmdhd.101.10.361.x/wl_iapsta.c +++ b/bcmdhd.101.10.361.x/wl_iapsta.c @@ -226,8 +226,8 @@ typedef struct wl_if_info { int transit_maxcount; #endif /* PROPTX_MAXCOUNT */ uint conn_state; - uint16 prev_channel; - uint16 post_channel; + struct wl_chan_info prev_chan_info; + struct wl_chan_info post_chan_info; struct osl_timespec sta_disc_ts; struct osl_timespec sta_conn_ts; bool ap_recon_sta; @@ -1412,7 +1412,7 @@ wl_mesh_update_mesh_info(struct wl_apsta_params *apsta_params, WL_MSG(mesh_if->ifname, "moving channel %d -> %d\n", cur_chan, peer_mesh_info.master_channel); wl_ext_disable_iface(mesh_if->dev, mesh_if->ifname); - mesh_if->channel = peer_mesh_info.master_channel; + mesh_if->chan_info.chan = peer_mesh_info.master_channel; wl_ext_enable_iface(mesh_if->dev, mesh_if->ifname, 500, TRUE); } } @@ -1475,8 +1475,8 @@ wl_mesh_event_handler(struct wl_if_info *cur_if, (event_type == WLC_E_LINK && status == WLC_E_STATUS_SUCCESS && reason == WLC_E_REASON_INITIAL_ASSOC))) { if (!wl_mesh_update_master_info(apsta_params, mesh_if)) { - mesh_info->scan_channel = wl_ext_get_chan(&mesh_if->dev, - mesh_if->chan_info); + mesh_info->scan_channel = wl_ext_get_chan(mesh_if->dev, + &mesh_if->chan_info); wl_timer_mod(dhd, &mesh_if->delay_scan, WL_MESH_DELAY_SCAN_TMO); } } @@ -2432,7 +2432,7 @@ wl_ext_get_dfs_master_if(struct wl_apsta_params *apsta_params) static void wl_ext_save_master_channel(struct wl_apsta_params *apsta_params, - uint16 post_channel) + struct wl_chan_info *post_chan_info) { struct wl_if_info *cur_if = NULL; struct wl_chan_info chan_info; @@ -2448,8 +2448,8 @@ wl_ext_save_master_channel(struct wl_apsta_params *apsta_params, memset(&chan_info, 0, sizeof(struct wl_chan_info)); wl_ext_get_chan(cur_if->dev, &chan_info); if (chan_info.chan) { - cur_if->prev_channel = chan_info.chan; - cur_if->post_channel = post_channel; + memcpy(&cur_if->prev_chan_info, &chan_info, sizeof(struct wl_chan_info)); + memcpy(&cur_if->post_chan_info, post_chan_info, sizeof(struct wl_chan_info)); } } } @@ -2464,16 +2464,17 @@ wl_ext_iapsta_enable_master_if(struct net_device *dev, bool post) for (i=0; iif_info[i]; - if (cur_if && cur_if->post_channel) { + if (cur_if && cur_if->post_chan_info.chan) { if (post) - cur_if->chan_info.chan = cur_if->post_channel; + memcpy(&cur_if->chan_info, &cur_if->post_chan_info, sizeof(struct wl_chan_info)); else - cur_if->chan_info.chan = cur_if->prev_channel; + memcpy(&cur_if->chan_info, &cur_if->prev_chan_info, sizeof(struct wl_chan_info)); if (wl_ext_associated(cur_if->dev)) wl_ext_if_down(apsta_params, cur_if); + OSL_SLEEP(100); wl_ext_if_up(apsta_params, cur_if, TRUE, 0); - cur_if->prev_channel = 0; - cur_if->post_channel = 0; + memset(&cur_if->prev_chan_info, 0, sizeof(struct wl_chan_info)); + memset(&cur_if->post_chan_info, 0, sizeof(struct wl_chan_info)); } } } @@ -2572,7 +2573,7 @@ wl_ext_iapsta_update_channel(struct net_device *dev, u32 chanspec) chan_info->chan = wl_ext_move_cur_channel(apsta_params, cur_if); if (chan_info->chan) { if (cur_if->ifmode == ISTA_MODE && wl_ext_dfs_chan(chan_info)) - wl_ext_save_master_channel(apsta_params, chan_info->chan); + wl_ext_save_master_channel(apsta_params, chan_info); target_if = wl_ext_move_other_channel(apsta_params, cur_if); if (dhd->conf->chip == BCM4359_CHIP_ID && cur_if->ifmode == ISTA_MODE && !target_if) { @@ -4153,13 +4154,15 @@ wl_ext_in4way_sync_sta(dhd_pub_t *dhd, struct wl_if_info *cur_if, wl_timer_mod(dhd, &cur_if->reconnect_timer, 0); #endif /* WL_EXT_RECONNECT && WL_CFG80211 */ #ifdef KEY_INSTALL_CHECK - key_installed = wl_key_installed(cur_if); + if (wpa_auth != WPA_AUTH_DISABLED && wpa_auth != WPA_AUTH_PSK) { + key_installed = wl_key_installed(cur_if); + } #endif /* KEY_INSTALL_CHECK */ if (key_installed) conn_state = CONN_STATE_CONNECTED; - wl_ext_update_conn_state(dhd, cur_if->ifidx, conn_state); IAPSTA_INFO(dev->name, "WPA 4-WAY complete %d => %d\n", cur_conn_state, conn_state); + wl_ext_update_conn_state(dhd, cur_if->ifidx, conn_state); #ifdef EAPOL_RESEND if (key_installed) wl_ext_release_eapol_txpkt(dhd, cur_if->ifidx, FALSE); @@ -5728,8 +5731,7 @@ wl_ext_parse_config(struct wl_if_info *cur_if, char *command, char **pick_next) } } else if (!strcmp(row->name, " chan ")) { cur_if->chan_info.chan = (int)simple_strtol(pick_tmp, NULL, 10); - if (!cur_if->chan_info.band) - cur_if->chan_info.band = WL_GET_BAND(cur_if->chan_info.chan); + cur_if->chan_info.band = WL_GET_BAND(cur_if->chan_info.chan); } else if (!strcmp(row->name, " amode ")) { if (!strcmp(pick_tmp, "open")) cur_if->amode = AUTH_OPEN; @@ -6847,7 +6849,7 @@ wl_ext_iapsta_postinit(struct net_device *net, struct wl_if_info *cur_if) } #ifdef WLMESH else if (cur_if->ifmode == IMESH_MODE) { - pm = 0; + int pm = 0; wl_ext_ioctl(cur_if->dev, WLC_SET_PM, &pm, sizeof(pm), 1); } #endif /* WLMESH */ diff --git a/bcmdhd.101.10.361.x/wl_iw.c b/bcmdhd.101.10.361.x/wl_iw.c index 2497c1f..1d0a484 100755 --- a/bcmdhd.101.10.361.x/wl_iw.c +++ b/bcmdhd.101.10.361.x/wl_iw.c @@ -1568,17 +1568,20 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end, if (bi->ie_length) { /* look for wpa/rsn ies in the ie list... */ bcm_tlv_t *ie; - uint8 *ptr = ((uint8 *)bi) + bi->ie_offset; + uint8 *ptr = ((uint8 *)bi) + bi->ie_offset, *ie_data; int ptr_len = bi->ie_length; /* OSEN IE */ - if ((ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_VS_ID)) && - ie->len > WFA_OUI_LEN + 1 && - !bcmp((const void *)&ie->data[0], (const void *)WFA_OUI, WFA_OUI_LEN) && - ie->data[WFA_OUI_LEN] == WFA_OUI_TYPE_OSEN) { - iwe.cmd = IWEVGENIE; - iwe.u.data.length = ie->len + 2; - event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie); + ie = bcm_parse_tlvs(ptr, ptr_len, DOT11_MNG_VS_ID); + if (ie) { + ie_data = ie->data; + if (ie->len > WFA_OUI_LEN + 1 && + !bcmp((const void *)&ie->data[0], (const void *)WFA_OUI, WFA_OUI_LEN) && + ie_data[WFA_OUI_LEN] == WFA_OUI_TYPE_OSEN) { + iwe.cmd = IWEVGENIE; + iwe.u.data.length = ie->len + 2; + event = IWE_STREAM_ADD_POINT(info, event, end, &iwe, (char *)ie); + } } ptr = ((uint8 *)bi) + bi->ie_offset; diff --git a/bcmdhd.101.10.361.x/wl_iw.h b/bcmdhd.101.10.361.x/wl_iw.h index e161006..a162655 100755 --- a/bcmdhd.101.10.361.x/wl_iw.h +++ b/bcmdhd.101.10.361.x/wl_iw.h @@ -83,7 +83,6 @@ typedef struct wl_iw_extra_params { #define WL_IW_RSSI_INVALID 0 /* invalid RSSI value */ #define MAX_WX_STRING 80 #define SSID_FMT_BUF_LEN ((4 * 32) + 1) -#define isprint(c) bcm_isprint(c) #define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1) #define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3) #define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5) -- 2.20.1