diff --git a/mxm_wifiex/wlan_src/Makefile b/mxm_wifiex/wlan_src/Makefile index 7b6ca47..08ae120 100644 --- a/mxm_wifiex/wlan_src/Makefile +++ b/mxm_wifiex/wlan_src/Makefile @@ -106,7 +106,8 @@ CONFIG_MULTI_CHAN_SUPPORT=y CONFIG_DUMP_TO_PROC=y -CONFIG_TASKLET_SUPPORT=y +CONFIG_TASKLET_SUPPORT=n + #32bit app over 64bit kernel support @@ -154,7 +155,7 @@ APPDIR= $(shell if test -d "mapp"; then echo mapp; fi) ############################################################################# ccflags-y += -I$(KERNELDIR)/include - ccflags-y += -DMLAN_RELEASE_VERSION='"437.p8"' + ccflags-y += -DMLAN_RELEASE_VERSION='"437.p18"' ccflags-y += -DFPNUM='"92"' @@ -275,6 +276,10 @@ ifeq ($(CONFIG_SDIW624),y) CONFIG_SDIO=y ccflags-y += -DSDIW624 endif +ifeq ($(CONFIG_SDAW693),y) + CONFIG_SDIO=y + ccflags-y += -DSDAW693 +endif ifeq ($(CONFIG_SD9177),y) CONFIG_SDIO=y ccflags-y += -DSD9177 @@ -335,6 +340,10 @@ ifeq ($(CONFIG_PCIEIW624),y) CONFIG_PCIE=y ccflags-y += -DPCIEIW624 endif +ifeq ($(CONFIG_PCIEAW693),y) + CONFIG_PCIE=y + ccflags-y += -DPCIEAW693 +endif ifeq ($(CONFIG_SDIO),y) ccflags-y += -DSDIO ccflags-y += -DSDIO_MMC diff --git a/mxm_wifiex/wlan_src/README b/mxm_wifiex/wlan_src/README index 4519a9e..5980a20 100755 --- a/mxm_wifiex/wlan_src/README +++ b/mxm_wifiex/wlan_src/README @@ -9,7 +9,7 @@ Goto source code directory wlan_src/. make [clean] build The driver and utility binaries can be found in ../bin_xxxx directory. - The driver code supports Linux kernel from 2.6.32 to 6.6.2. + The driver code supports Linux kernel from 2.6.32 to 6.7.0. 2) FOR DRIVER INSTALL @@ -1033,6 +1033,7 @@ Beamforming (0:disable, 1:enable) GreenField Mode (0:disable, 1:enable) STBC (0:disable, 1:enable) + Signal Bw (0: 20Mhz, 1: 40Mhz, 4:80Mhz, -1: Set to default) NumPkt (Set to default value -1) MaxPktExt (Set to default value -1) BeamChange (Set to default value -1) @@ -1045,7 +1046,7 @@ Example: To start Tx frame with duty cycle, first stop any ongoing Tx and then start Tx frame: echo "tx_frame=0" > /proc/mwlan/adapterX/config - echo "tx_frame=1 7 0xAAA 0x100 1 20 0 0 0 0 0 0 0 05:43:3f:c4:51" > /proc/mwlan/adapterX/config + echo "tx_frame=1 7 0xAAA 0x100 1 20 0 0 0 0 0 0 0 0 -1 -1 -1 -1 -1 -1 -1 05:43:3f:c4:51" > /proc/mwlan/adapterX/config Configure Trigger Frame Example: To configure Trigger frame: diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c index dd8d384..d7411f5 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c @@ -216,7 +216,8 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, t_u8 nss = 0; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0; t_u16 tx_nss = 0; #endif @@ -300,7 +301,8 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, if (cfg->param.vht_cfg.txrx & MLAN_RADIO_RX) { #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || @@ -335,7 +337,8 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -363,7 +366,8 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -789,7 +793,8 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, t_u16 nss; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0, tx_nss = 0; #endif ENTER(); @@ -811,7 +816,8 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, wlan_le16_to_cpu(pvht_cap->vht_cap.mcs_sets.rx_mcs_map); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(priv->adapter->card_type) || IS_CARDIW624(priv->adapter->card_type) || IS_CARD9097(priv->adapter->card_type) || @@ -838,7 +844,8 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, mcs_resp = GET_VHTNSSMCS(mcs_map_resp, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((rx_nss != 0) && (nss > rx_nss)) mcs_user = NO_NSS_SUPPORT; #endif @@ -871,7 +878,8 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, mcs_resp = GET_VHTNSSMCS(mcs_map_resp, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((tx_nss != 0) && (nss > tx_nss)) mcs_user = NO_NSS_SUPPORT; #endif @@ -1088,7 +1096,8 @@ t_u8 wlan_is_80_80_support(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) t_u8 ret = MFALSE; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0, tx_nss = 0; IEEEtypes_VHTCap_t *pvht_cap = pbss_desc->pvht_cap; MrvlIEtypes_He_cap_t *phecap = MNULL; @@ -1099,7 +1108,8 @@ t_u8 wlan_is_80_80_support(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (!IS_CARD9098(pmpriv->adapter->card_type) && !IS_CARDIW624(pmpriv->adapter->card_type) && !IS_CARD9097(pmpriv->adapter->card_type) && @@ -1155,7 +1165,8 @@ int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, t_u8 bw_80p80 = MFALSE; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0; #endif @@ -1227,7 +1238,8 @@ int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, SET_OPER_MODE_80M(pmrvl_oper_mode->oper_mode); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || @@ -1246,7 +1258,8 @@ int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c index 4d4faf2..1d66ee4 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c @@ -297,7 +297,8 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, t_u16 len = 0; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0, tx_nss = 0; #endif MrvlIEtypes_He_cap_t *phecap = MNULL; @@ -327,7 +328,8 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, phe_cap->len = wlan_cpu_to_le16(phe_cap->len); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmpriv->adapter->card_type) || IS_CARD9097(pmpriv->adapter->card_type) || IS_CARDAW693(pmpriv->adapter->card_type)) { @@ -350,7 +352,8 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, hw_value = GET_HE_NSSMCS(phw_hecap->rx_mcs_80, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -366,7 +369,8 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, hw_value = GET_HE_NSSMCS(phw_hecap->tx_mcs_80, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -403,7 +407,8 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, t_u8 bw_80p80 = MFALSE; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0, tx_nss = 0; #endif t_u8 nss = 0; @@ -448,7 +453,8 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, phecap->len = wlan_cpu_to_le16(phecap->len); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmpriv->adapter->card_type) || IS_CARDIW624(pmpriv->adapter->card_type) || IS_CARD9097(pmpriv->adapter->card_type) || @@ -474,7 +480,8 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, hw_value = GET_HE_NSSMCS(phw_hecap->rx_mcs_80, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -490,7 +497,8 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, hw_value = GET_HE_NSSMCS(phw_hecap->tx_mcs_80, nss); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; #endif @@ -1091,6 +1099,7 @@ mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, hostcmd_twt_setup *twt_setup_params = MNULL; hostcmd_twt_teardown *twt_teardown_params = MNULL; hostcmd_twt_report *twt_report_params = MNULL; + hostcmd_twt_information *twt_information_params = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); @@ -1150,6 +1159,17 @@ mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, twt_report_params->type = ds_twtcfg->param.twt_report.type; cmd->size += sizeof(hostcmd_twtcfg->param.twt_report); break; + case MLAN_11AX_TWT_INFORMATION_SUBID: + twt_information_params = &hostcmd_twtcfg->param.twt_information; + // coverity[bad_memset: SUPPRESS] + memset(pmadapter, twt_information_params, 0x00, + sizeof(hostcmd_twtcfg->param.twt_information)); + twt_information_params->flow_identifier = + ds_twtcfg->param.twt_information.flow_identifier; + twt_information_params->suspend_duration = wlan_cpu_to_le32( + ds_twtcfg->param.twt_information.suspend_duration); + cmd->size += sizeof(hostcmd_twtcfg->param.twt_information); + break; default: PRINTM(MERROR, "Unknown subcmd %x\n", ds_twtcfg->sub_id); ret = MLAN_STATUS_FAILURE; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11d.c b/mxm_wifiex/wlan_src/mlan/mlan_11d.c index e4a201d..9290e87 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11d.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11d.c @@ -638,16 +638,24 @@ wlan_11d_sort_parsed_region_chan(parsed_region_chan_11d_t *parsed_region_chan) * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ static mlan_status wlan_11d_send_domain_info(mlan_private *pmpriv, - t_void *pioctl_buf) + t_void *pioctl_buf, + t_bool is_op_special_set) { mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); /* Send cmd to FW to set domain info */ - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11D_DOMAIN_INFO, - HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_buf, - MNULL); + if (is_op_special_set) { + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11D_DOMAIN_INFO, + HostCmd_ACT_SPC_SET, 0, + (t_void *)pioctl_buf, MNULL); + } else { + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11D_DOMAIN_INFO, + HostCmd_ACT_GEN_SET, 0, + (t_void *)pioctl_buf, MNULL); + } + if (ret) PRINTM(MERROR, "11D: Failed to download domain Info\n"); @@ -973,6 +981,8 @@ mlan_status wlan_ret_802_11d_domain_info(mlan_private *pmpriv, break; case HostCmd_ACT_GEN_GET: break; + case HostCmd_ACT_SPC_SET: + break; default: PRINTM(MERROR, "11D: Invalid Action:%d\n", domain_info->action); ret = MLAN_STATUS_FAILURE; @@ -1324,7 +1334,7 @@ mlan_status wlan_11d_create_dnld_countryinfo(mlan_private *pmpriv, t_u16 band) wlan_11d_generate_domain_info(pmadapter, &parsed_region_chan); /* Set domain info */ - ret = wlan_11d_send_domain_info(pmpriv, MNULL); + ret = wlan_11d_send_domain_info(pmpriv, MNULL, MTRUE); if (ret) { PRINTM(MERROR, "11D: Error sending domain info to FW\n"); @@ -1419,7 +1429,7 @@ mlan_status wlan_11d_parse_dnld_countryinfo(mlan_private *pmpriv, wlan_11d_generate_domain_info(pmadapter, ®ion_chan); /* Set domain info */ - ret = wlan_11d_send_domain_info(pmpriv, MNULL); + ret = wlan_11d_send_domain_info(pmpriv, MNULL, MTRUE); if (ret) { PRINTM(MERROR, "11D: Error sending domain info to FW\n"); @@ -1547,7 +1557,7 @@ mlan_status wlan_11d_cfg_domain_info(pmlan_adapter pmadapter, domain_info->no_of_sub_band, (IEEEtypes_SubbandSet_t *)domain_info->sub_band, domain_info->dfs_region); - ret = wlan_11d_send_domain_info(pmpriv, pioctl_req); + ret = wlan_11d_send_domain_info(pmpriv, pioctl_req, MFALSE); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; @@ -1651,7 +1661,7 @@ mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u16 band, num_sub_band, pdomain_tlv->sub_band, NXP_DFS_UNKNOWN); - ret = wlan_11d_send_domain_info(pmpriv, pioctl_buf); + ret = wlan_11d_send_domain_info(pmpriv, pioctl_buf, MFALSE); done: LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11h.c b/mxm_wifiex/wlan_src/mlan/mlan_11h.c index b6760d7..1728b64 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11h.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11h.c @@ -3,7 +3,7 @@ * @brief This file contains functions for 802.11H. * * - * Copyright 2008-2021 NXP + * Copyright 2008-2021, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -231,8 +231,8 @@ static t_u8 woal_get_bonded_channels(t_u8 pri_chan, t_u8 bw, t_u8 *chan_list) * * @return N/A */ -t_void wlan_11h_set_chan_dfs_state(mlan_private *priv, t_u8 chan, t_u8 bw, - dfs_state_t dfs_state) +static t_void wlan_11h_set_chan_dfs_state(mlan_private *priv, t_u8 chan, + t_u8 bw, dfs_state_t dfs_state) { t_u8 n_chan; t_u8 chan_list[4] = {0}; @@ -885,7 +885,7 @@ static t_bool wlan_11h_is_slave_active_on_dfs_chan(mlan_private *priv) * - MTRUE if radar detection is required * - MFALSE otherwise */ -t_bool wlan_11h_is_radar_channel(mlan_private *priv, t_u8 channel) +static t_bool wlan_11h_is_radar_channel(mlan_private *priv, t_u8 channel) { t_bool required = MFALSE; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11n.c b/mxm_wifiex/wlan_src/mlan/mlan_11n.c index 2292d46..4977e2f 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n.c @@ -1469,7 +1469,8 @@ void wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap, rx_mcs_supp = GET_RXMCSSUPP(priv->usr_dev_mcs_support); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || @@ -1547,7 +1548,8 @@ void wlan_fill_ht_cap_ie(mlan_private *priv, IEEEtypes_HTCap_t *pht_cap, rx_mcs_supp = GET_RXMCSSUPP(priv->usr_dev_mcs_support); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c b/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c index 56cd1da..5b383dc 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c @@ -127,6 +127,12 @@ static void wlan_11n_form_amsdu_txpd(mlan_private *priv, mlan_buffer *mbuf) ptx_pd->tx_pkt_type = PKT_TYPE_AMSDU; if (mbuf->flags & MLAN_BUF_FLAG_TDLS) ptx_pd->flags = MRVDRV_TxPD_FLAGS_TDLS_PACKET; + + if (mbuf->flags & MLAN_BUF_FLAG_EASYMESH) { + ptx_pd->flags |= MRVDRV_TxPD_FLAGS_EASYMESH; + memcpy_ext(priv->adapter, ptx_pd->ra_mac, mbuf->mac, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + } if (ptx_pd->tx_control == 0) /* TxCtrl set by user or default */ ptx_pd->tx_control = priv->pkt_tx_ctrl; @@ -136,6 +142,150 @@ static void wlan_11n_form_amsdu_txpd(mlan_private *priv, mlan_buffer *mbuf) LEAVE(); } +/** + * @brief free pkts in amsdu_txq + * + * @param pmadapter A pointer to mlan_adapter structure + * + * @return N/A + */ +static INLINE void wlan_free_amsdu_txq(pmlan_adapter pmadapter) +{ + pmlan_buffer pmbuf; + + ENTER(); + while ((pmbuf = (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle, + &pmadapter->amsdu_txq, + MNULL, MNULL))) { + util_unlink_list(pmadapter->pmoal_handle, &pmadapter->amsdu_txq, + (pmlan_linked_list)pmbuf, MNULL, MNULL); + wlan_write_data_complete(pmadapter, pmbuf, MLAN_STATUS_FAILURE); + } + LEAVE(); +} + +#ifdef PCIEAW693 +/** + * @brief Add TxPD to AMSDU header + * + * @param priv A pointer to mlan_private structure + * @param pmbuf A pointer to buffer where the TxPD will be formed + * @param amsdu_pkt_len amsdu packet length + * + * @return increased length (TxPD + intf_hr_len + padding for DMA + * alignment) + */ +static t_u16 wlan_form_amsdu_txpd(mlan_private *priv, mlan_buffer *pmbuf, + t_u16 amsdu_pkt_len) +{ + mlan_adapter *pmadapter = priv->adapter; + TxPD *ptx_pd; + t_u8 *head_ptr = MNULL; + t_u16 data_len = pmbuf->data_len; + ENTER(); + + head_ptr = pmbuf->pbuf + pmbuf->data_offset - sizeof(TxPD) - + priv->intf_hr_len; + ptx_pd = (TxPD *)(head_ptr + priv->intf_hr_len); + memset(pmadapter, ptx_pd, 0, sizeof(TxPD)); + + /* Set the BSS number to TxPD */ + ptx_pd->bss_num = GET_BSS_NUM(priv); + ptx_pd->bss_type = priv->bss_type; + ptx_pd->priority = (t_u8)pmbuf->priority; + ptx_pd->tx_pkt_type = PKT_TYPE_AMSDU; + ptx_pd->tx_pkt_length = amsdu_pkt_len; + + ptx_pd->tx_pkt_offset = (t_u16)((t_ptr)pmbuf->pbuf + + pmbuf->data_offset - (t_ptr)ptx_pd); + if (pmbuf->flags & MLAN_BUF_FLAG_TDLS) + ptx_pd->flags = MRVDRV_TxPD_FLAGS_TDLS_PACKET; + if (ptx_pd->tx_control == 0) + /* TxCtrl set by user or default */ + ptx_pd->tx_control = priv->pkt_tx_ctrl; + + if (pmbuf->flags & MLAN_BUF_FLAG_EASYMESH) { + ptx_pd->flags |= MRVDRV_TxPD_FLAGS_EASYMESH; + memcpy_ext(priv->adapter, ptx_pd->ra_mac, pmbuf->mac, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + } + + endian_convert_TxPD(ptx_pd); + + /* Adjust the data offset and length to include TxPD in pmbuf */ + pmbuf->data_len += pmbuf->data_offset; + pmbuf->data_offset = (t_u32)(head_ptr - pmbuf->pbuf); + pmbuf->data_len -= pmbuf->data_offset; + + PRINTM(MDATA, "amsdu_pkt_len=%d, extra_len=%d\n", amsdu_pkt_len, + pmbuf->data_len - data_len); + DBG_HEXDUMP(MDAT_D, "AMSDU TxPD", ptx_pd, sizeof(TxPD)); + + LEAVE(); + return (pmbuf->data_len - data_len); +} + +/** + * @brief Form amsdu subframe + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pmbuf A pointer to mlan_buffer + * @param pad Pad + * + * @return Final packet size + */ +static int wlan_form_amsdu_subframe(pmlan_adapter pmadapter, mlan_buffer *pmbuf, + int *pad) +{ + int dt_offset, amsdu_buf_offset; + Rfc1042Hdr_t snap = { + 0xaa, /* LLC DSAP */ + 0xaa, /* LLC SSAP */ + 0x03, /* LLC CTRL */ + {0x00, 0x00, 0x00}, /* SNAP OUI */ + 0x0000 /* SNAP type */ + /* + * This field will be overwritten + * later with ethertype + */ + }; + t_u8 *amsdu_buf = MNULL; + t_u8 *data = pmbuf->pbuf + pmbuf->data_offset; + int pkt_len = pmbuf->data_len; + + ENTER(); + + pmbuf->data_offset -= sizeof(Rfc1042Hdr_t); + pmbuf->data_len += sizeof(Rfc1042Hdr_t); + + amsdu_buf = pmbuf->pbuf + pmbuf->data_offset; + + memcpy_ext(pmadapter, amsdu_buf, data, (MLAN_MAC_ADDR_LENGTH)*2, + (MLAN_MAC_ADDR_LENGTH)*2); + dt_offset = amsdu_buf_offset = (MLAN_MAC_ADDR_LENGTH)*2; + + snap.snap_type = *(t_u16 *)(data + dt_offset); + dt_offset += sizeof(t_u16); + *(t_u16 *)(amsdu_buf + amsdu_buf_offset) = + mlan_htons(pkt_len + LLC_SNAP_LEN - + ((2 * MLAN_MAC_ADDR_LENGTH) + sizeof(t_u16))); + amsdu_buf_offset += sizeof(t_u16); + memcpy_ext(pmadapter, amsdu_buf + amsdu_buf_offset, &snap, LLC_SNAP_LEN, + LLC_SNAP_LEN); + amsdu_buf_offset += LLC_SNAP_LEN; + *pad = (((pkt_len + LLC_SNAP_LEN) & 3)) ? + (4 - (((pkt_len + LLC_SNAP_LEN)) & 3)) : + 0; + pmbuf->data_len += *pad; + + DBG_HEXDUMP(MDAT_D, "AMSDU subframe", pmbuf->pbuf + pmbuf->data_offset, + MIN(pmbuf->data_len, MAX_DATA_DUMP_LEN)); + PRINTM(MDATA, "AMSDU subframe len=%d\n", pkt_len + LLC_SNAP_LEN + *pad); + LEAVE(); + return pkt_len + LLC_SNAP_LEN + *pad; +} +#endif + /** * @brief Update the TxPktLength field in TxPD after the complete AMSDU * packet is formed @@ -376,6 +526,7 @@ mlan_status wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf) daggr_mbuf->data_len = pkt_len; daggr_mbuf->in_ts_sec = pmbuf->in_ts_sec; daggr_mbuf->in_ts_usec = pmbuf->in_ts_usec; + daggr_mbuf->flags = pmbuf->flags; daggr_mbuf->extra_ts_sec = pmbuf->extra_ts_sec; daggr_mbuf->extra_ts_usec = pmbuf->extra_ts_usec; daggr_mbuf->pparent = pmbuf; @@ -399,6 +550,10 @@ mlan_status wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf) } #ifdef UAP_SUPPORT if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { + if (pmbuf->flags & MLAN_BUF_FLAG_EASYMESH) + memcpy_ext(priv->adapter, daggr_mbuf->mac, + pmbuf->mac, MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); ret = wlan_uap_recv_packet(priv, daggr_mbuf); } else { #endif /* UAP_SUPPORT */ @@ -475,6 +630,146 @@ done: return ret; } +#ifdef PCIEAW693 +/** + * @brief Send amsdu subframe list to interface + * + * @param priv A pointer to mlan_private structure + * @param pra_list Pointer to the RA List table containing the pointers + * to packets. + * @param headroom Any interface specific headroom that may be need. TxPD + * will be formed leaving this headroom. + * @param ptrindex Pointer index + * + * @return Final packet size or MLAN_STATUS_FAILURE + */ +int wlan_send_amsdu_subframe_list(mlan_private *priv, raListTbl *pra_list, + int headroom, int ptrindex) +{ + int pkt_size = 0; + pmlan_adapter pmadapter = priv->adapter; + mlan_buffer *pmbuf_src; + mlan_buffer *pmbuf_last = MNULL; + mlan_buffer *pmbuf_first = MNULL; + int pad = 0; + mlan_status ret = MLAN_STATUS_SUCCESS; +#ifdef DEBUG_LEVEL1 + t_u32 sec = 0, usec = 0; +#endif + t_u32 max_amsdu_size = MIN(pra_list->max_amsdu, pmadapter->tx_buf_size); + t_u32 max_msdu_count = 0; + t_u32 msdu_in_tx_amsdu_cnt = 0; + ENTER(); + + max_msdu_count = pmadapter->ops.get_max_msdu_cnt(pmadapter); + pmbuf_src = (pmlan_buffer)util_peek_list( + pmadapter->pmoal_handle, &pra_list->buf_head, MNULL, MNULL); + if (pmbuf_src) { + pmbuf_first = pmbuf_src; + } else { + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); + goto exit; + } + + while (pmbuf_src && + ((pkt_size + (pmbuf_src->data_len + LLC_SNAP_LEN) + headroom) <= + max_amsdu_size) && + (msdu_in_tx_amsdu_cnt < max_msdu_count)) { + pmbuf_src = + (pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle, + &pra_list->buf_head, + MNULL, MNULL); + /* Collects TP statistics */ + if (pmadapter->tp_state_on && (pkt_size > sizeof(TxPD))) + pmadapter->callbacks.moal_tp_accounting( + pmadapter->pmoal_handle, pmbuf_src, 3); + pra_list->total_pkts--; + + /* decrement for every PDU taken from the list */ + priv->wmm.pkts_queued[ptrindex]--; + util_scalar_decrement(pmadapter->pmoal_handle, + &priv->wmm.tx_pkts_queued, MNULL, MNULL); + + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); + + if (pmbuf_src) { + pkt_size += wlan_form_amsdu_subframe(pmadapter, + pmbuf_src, &pad); + util_enqueue_list_tail(pmadapter->pmoal_handle, + &pmadapter->amsdu_txq, + (pmlan_linked_list)pmbuf_src, + MNULL, MNULL); + pmbuf_last = pmbuf_src; + priv->msdu_in_tx_amsdu_cnt++; + msdu_in_tx_amsdu_cnt++; + } + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + + if (!wlan_is_ralist_valid(priv, pra_list, ptrindex)) { + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + pmbuf_src = + (pmlan_buffer)util_peek_list(pmadapter->pmoal_handle, + &pra_list->buf_head, MNULL, + MNULL); + } + + pmadapter->callbacks.moal_spin_unlock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + + /* Last AMSDU packet does not need padding */ + pkt_size -= pad; + pmbuf_last->data_len -= pad; + + pkt_size += wlan_form_amsdu_txpd(priv, pmbuf_first, pkt_size); + /* Collects TP statistics */ + if (pmadapter->tp_state_on) { + mlan_buffer mbuf; + mbuf.data_len = pkt_size; + pmadapter->callbacks.moal_tp_accounting(pmadapter->pmoal_handle, + &mbuf, 4); + pmadapter->callbacks.moal_tp_accounting_rx_param( + pmadapter->pmoal_handle, 5, msdu_in_tx_amsdu_cnt); + } + /* Drop Tx packets at drop point 4 */ + if (pmadapter->tp_state_drop_point == 4) { + wlan_free_amsdu_txq(pmadapter); + goto exit; + } + ret = pmadapter->ops.send_data_list(pmadapter, MLAN_TYPE_DATA, + msdu_in_tx_amsdu_cnt, pkt_size); + + if (ret != MLAN_STATUS_RESOURCE) { + pmadapter->callbacks.moal_spin_lock(pmadapter->pmoal_handle, + priv->wmm.ra_list_spinlock); + if (wlan_is_ralist_valid(priv, pra_list, ptrindex)) { + priv->wmm.packets_out[ptrindex]++; + priv->wmm.tid_tbl_ptr[ptrindex].ra_list_curr = pra_list; + } + pmadapter->bssprio_tbl[priv->bss_priority].bssprio_cur = + pmadapter->bssprio_tbl[priv->bss_priority] + .bssprio_cur->pnext; + pmadapter->callbacks.moal_spin_unlock( + pmadapter->pmoal_handle, priv->wmm.ra_list_spinlock); + } + + PRINTM_GET_SYS_TIME(MDATA, &sec, &usec); + PRINTM_NETINTF(MDATA, priv); + PRINTM(MDATA, "%lu.%06lu : Data => FW\n", sec, usec); + priv->amsdu_tx_cnt++; +exit: + LEAVE(); + return pkt_size; +} +#endif /** * @brief Aggregate multiple packets into one single AMSDU packet * @@ -509,6 +804,12 @@ int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list, PRINTM(MDAT_D, "Handling Aggr packet\n"); +#ifdef PCIEAW693 + if (IS_PCIEAW693(pmadapter->card_type)) { + return wlan_send_amsdu_subframe_list(priv, pra_list, headroom, + ptrindex); + } +#endif pmbuf_src = (pmlan_buffer)util_peek_list( pmadapter->pmoal_handle, &pra_list->buf_head, MNULL, MNULL); if (pmbuf_src) { @@ -540,6 +841,12 @@ int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list, if (pmbuf_src->flags & MLAN_BUF_FLAG_TCP_ACK) pmbuf_aggr->flags |= MLAN_BUF_FLAG_TCP_ACK; + if (pmbuf_src->flags & MLAN_BUF_FLAG_EASYMESH) { + pmbuf_aggr->flags |= MLAN_BUF_FLAG_EASYMESH; + memcpy_ext(priv->adapter, pmbuf_aggr->mac, + pmbuf_src->mac, MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); + } /* Form AMSDU */ wlan_11n_form_amsdu_txpd(priv, pmbuf_aggr); pkt_size = sizeof(TxPD); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_cfp.c b/mxm_wifiex/wlan_src/mlan/mlan_cfp.c index 8d2b8f4..239cd6c 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_cfp.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_cfp.c @@ -5,7 +5,7 @@ * related code * * - * Copyright 2009-2023 NXP + * Copyright 2009-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -2181,7 +2181,7 @@ int wlan_get_rate_index(pmlan_adapter pmadapter, t_u16 *rate_bitmap, int size) * * @return BAND_B|BAND_G|BAND_A */ -t_u16 wlan_convert_config_bands(t_u16 config_bands) +static t_u16 wlan_convert_config_bands(t_u16 config_bands) { t_u16 bands = 0; if (config_bands & BAND_B) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c index 804ece2..762ba4a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c @@ -4,7 +4,7 @@ * @brief This file contains the handling of CMD/EVENT in MLAN * * - * Copyright 2009-2023 NXP + * Copyright 2009-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -252,7 +252,7 @@ done: * * @return N/A */ -t_void wlan_flush_ext_cmd_pending_queue(pmlan_adapter pmadapter) +static t_void wlan_flush_ext_cmd_pending_queue(pmlan_adapter pmadapter) { cmd_ctrl_node *pcmd_node = MNULL; HostCmd_DS_COMMAND *pcmd = MNULL; @@ -1357,6 +1357,11 @@ static mlan_status wlan_dnld_cmd_to_fw(mlan_private *pmpriv, if (pcmd->command == HostCmd_CMD_802_11_SCAN_EXT) pmadapter->scan_state |= wlan_get_ext_scan_state(pcmd); + if (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA && + pmpriv->media_connected && + (pcmd->command == HostCmd_CMD_802_11_DEAUTHENTICATE || + pcmd->command == HostCmd_CMD_802_11_DISASSOCIATE)) + wlan_clean_txrx(pmpriv); if (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA && pmpriv->media_connected && @@ -2209,7 +2214,8 @@ done: * * @return N/A */ -void wlan_handle_cmd_error_in_pre_aleep(mlan_adapter *pmadapter, t_u16 cmd_no) +static void wlan_handle_cmd_error_in_pre_aleep(mlan_adapter *pmadapter, + t_u16 cmd_no) { cmd_ctrl_node *pcmd_node = MNULL; ENTER(); @@ -2442,7 +2448,8 @@ mlan_status wlan_process_cmdresp(mlan_adapter *pmadapter) if (IS_PCIE(pmadapter->card_type) && cmdresp_no == HostCmd_CMD_FUNC_SHUTDOWN && pmadapter->pwarm_reset_ioctl_req) { -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) #endif wlan_pcie_init_fw(pmadapter); @@ -2992,8 +2999,9 @@ t_void wlan_cancel_pending_ioctl(pmlan_adapter pmadapter, * * @return N/A */ -t_void wlan_fill_hal_wifi_rate(pmlan_private pmpriv, mlan_wifi_rate *pmlan_rate, - wifi_rate *prate) +static t_void wlan_fill_hal_wifi_rate(pmlan_private pmpriv, + mlan_wifi_rate *pmlan_rate, + wifi_rate *prate) { t_u8 index = 0; t_u8 rate_info = 0; @@ -5157,7 +5165,7 @@ mlan_status wlan_adapter_init_cmd(pmlan_adapter pmadapter) (t_u8)(pmadapter->init_para.drcs_chantime_mode >> 8); /* switchtime use default value in fw*/ drcs_init_cfg[0].switchtime = 10; - drcs_init_cfg[0].undozetime = 5; + drcs_init_cfg[0].rx_wait_time = 5; drcs_init_cfg[0].mode = (t_u8)(pmadapter->init_para.drcs_chantime_mode); drcs_init_cfg[1].chan_idx = 0x2; @@ -5165,7 +5173,7 @@ mlan_status wlan_adapter_init_cmd(pmlan_adapter pmadapter) (t_u8)(pmadapter->init_para.drcs_chantime_mode >> 24); /* switchtime use default value in fw*/ drcs_init_cfg[1].switchtime = 10; - drcs_init_cfg[1].undozetime = 5; + drcs_init_cfg[1].rx_wait_time = 5; drcs_init_cfg[1].mode = (t_u8)(pmadapter->init_para.drcs_chantime_mode >> 16); ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_DRCS_CONFIG, @@ -5828,14 +5836,14 @@ mlan_status wlan_cmd_drcs_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, wlan_cpu_to_le16(drcs_cfg->chan_idx); channel_time_slicing->chantime = drcs_cfg->chantime; channel_time_slicing->switchtime = drcs_cfg->switchtime; - channel_time_slicing->undozetime = drcs_cfg->undozetime; + channel_time_slicing->rx_wait_time = drcs_cfg->rx_wait_time; channel_time_slicing->mode = drcs_cfg->mode; PRINTM(MCMND, - "Set multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + "Set multi-channel: chan_idx=%d chantime=%d switchtime=%d rx_wait_time=%d mode=%d\n", channel_time_slicing->chan_idx, channel_time_slicing->chantime, channel_time_slicing->switchtime, - channel_time_slicing->undozetime, + channel_time_slicing->rx_wait_time, channel_time_slicing->mode); cmd->size = wlan_cpu_to_le16(S_DS_GEN + sizeof(HostCmd_DS_DRCS_CFG)); @@ -5852,14 +5860,16 @@ mlan_status wlan_cmd_drcs_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, wlan_cpu_to_le16(drcs_cfg->chan_idx); channel_time_slicing->chantime = drcs_cfg->chantime; channel_time_slicing->switchtime = drcs_cfg->switchtime; - channel_time_slicing->undozetime = drcs_cfg->undozetime; + // coverity[overflow_sink:SUPPRESS] + channel_time_slicing->rx_wait_time = + drcs_cfg->rx_wait_time; channel_time_slicing->mode = drcs_cfg->mode; PRINTM(MCMND, - "Set multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + "Set multi-channel: chan_idx=%d chantime=%d switchtime=%d rx_wait_time=%d mode=%d\n", channel_time_slicing->chan_idx, channel_time_slicing->chantime, channel_time_slicing->switchtime, - channel_time_slicing->undozetime, + channel_time_slicing->rx_wait_time, channel_time_slicing->mode); cmd->size += wlan_cpu_to_le16( sizeof(MrvlTypes_DrcsTimeSlice_t)); @@ -5910,15 +5920,15 @@ mlan_status wlan_ret_drcs_cfg(pmlan_private pmpriv, channel_time_slicing->chantime; pcfg->param.drcs_cfg[0].switchtime = channel_time_slicing->switchtime; - pcfg->param.drcs_cfg[0].undozetime = - channel_time_slicing->undozetime; + pcfg->param.drcs_cfg[0].rx_wait_time = + channel_time_slicing->rx_wait_time; pcfg->param.drcs_cfg[0].mode = channel_time_slicing->mode; PRINTM(MCMND, - "multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + "multi-channel: chan_idx=%d chantime=%d switchtime=%d rx_wait_time=%d mode=%d\n", pcfg->param.drcs_cfg[0].chan_idx, channel_time_slicing->chantime, channel_time_slicing->switchtime, - channel_time_slicing->undozetime, + channel_time_slicing->rx_wait_time, channel_time_slicing->mode); pioctl_buf->buf_len = sizeof(mlan_ds_drcs_cfg); /*Channel for chan_idx 1 and 2 have different parameters*/ @@ -5941,13 +5951,13 @@ mlan_status wlan_ret_drcs_cfg(pmlan_private pmpriv, drcs_cfg1->chantime = channel_time_slicing1->chantime; drcs_cfg1->switchtime = channel_time_slicing1->switchtime; - drcs_cfg1->undozetime = - channel_time_slicing1->undozetime; + drcs_cfg1->rx_wait_time = + channel_time_slicing1->rx_wait_time; drcs_cfg1->mode = channel_time_slicing1->mode; PRINTM(MCMND, - "multi-channel: chan_idx=%d chantime=%d switchtime=%d undozetime=%d mode=%d\n", + "multi-channel: chan_idx=%d chantime=%d switchtime=%d rx_wait_time=%d mode=%d\n", drcs_cfg1->chan_idx, drcs_cfg1->chantime, - drcs_cfg1->switchtime, drcs_cfg1->undozetime, + drcs_cfg1->switchtime, drcs_cfg1->rx_wait_time, drcs_cfg1->mode); pioctl_buf->buf_len += sizeof(mlan_ds_drcs_cfg); } @@ -6307,7 +6317,8 @@ mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, wlan_show_devmcssupport(pmadapter, pmadapter->hw_dev_mcs_support); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) pmadapter->user_htstream = pmadapter->hw_dev_mcs_support; /** separate stream config for 2.4G and 5G, will be changed according to * antenna cfg*/ @@ -7484,7 +7495,8 @@ mlan_status wlan_ret_802_11_rf_antenna(pmlan_private pmpriv, t_u16 rx_ant_mode = wlan_le16_to_cpu(pantenna->rx_antenna_mode); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) mlan_adapter *pmadapter = pmpriv->adapter; #endif typedef struct _HostCmd_DS_802_11_RF_ANTENNA_1X1 { @@ -7514,7 +7526,8 @@ mlan_status wlan_ret_802_11_rf_antenna(pmlan_private pmpriv, wlan_le16_to_cpu(pantenna->action_rx), rx_ant_mode); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ - defined(SDIW624) || defined(PCIEIW624) || defined(USBIW624) + defined(SDIW624) || defined(SDAW693) || defined(PCIEAW693) || \ + defined(PCIEIW624) || defined(USBIW624) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || IS_CARDAW693(pmadapter->card_type) || @@ -7589,7 +7602,8 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, mlan_ds_reg_rw *reg_rw; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) MrvlIEtypes_Reg_type_t *tlv; mlan_adapter *pmadapter = pmpriv->adapter; #endif @@ -7608,7 +7622,8 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, mac_reg->value = wlan_cpu_to_le32(reg_rw->value); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((reg_rw->type == MLAN_REG_MAC2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || @@ -7650,7 +7665,8 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, bbp_reg->value = (t_u8)reg_rw->value; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((reg_rw->type == MLAN_REG_BBP2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || @@ -7681,7 +7697,8 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, rf_reg->value = (t_u8)reg_rw->value; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((reg_rw->type == MLAN_REG_RF2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || @@ -7747,7 +7764,8 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, bca_reg->value = wlan_cpu_to_le32(reg_rw->value); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if ((reg_rw->type == MLAN_REG_BCA2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || diff --git a/mxm_wifiex/wlan_src/mlan/mlan_decl.h b/mxm_wifiex/wlan_src/mlan/mlan_decl.h index 3386669..0760357 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_decl.h @@ -396,7 +396,7 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** Black bird card type */ #define CARD_TYPE_AW693 0x0c /** IW615 card type */ -#define CARD_TYPE_IW615 0x0c +#define CARD_TYPE_IW615 0x0d /** 9098 A0 reverion num */ #define CHIP_9098_REV_A0 1 @@ -667,6 +667,7 @@ typedef enum { #define MEVT_D MBIT(18) #define MFW_D MBIT(19) #define MIF_D MBIT(20) +#define MFWDP_D MBIT(21) #define MENTRY MBIT(28) #define MWARN MBIT(29) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_fw.h b/mxm_wifiex/wlan_src/mlan/mlan_fw.h index 038653d..4bfbbeb 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_fw.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_fw.h @@ -1352,9 +1352,10 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_He_Op_t { #define IS_FW_SUPPORT_EMBEDDED_OWE(_adapter) \ (_adapter->fw_cap_info & FW_CAPINFO_EMBEDDED_OWE_SUPPORT) -#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ - defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) +#if defined(PCIE9098) || defined(SDAW693) || defined(SD9098) || \ + defined(USB9098) || defined(PCIE9097) || defined(USB9097) || \ + defined(SDIW624) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) /* TLV type: reg type */ #define TLV_TYPE_REG_ACCESS_CTRL (PROPRIETARY_TLV_BASE_ID + 0x13C) /* 0x023c*/ /** MrvlIEtypes_Reg_type_t*/ @@ -1445,6 +1446,8 @@ typedef enum _ENH_PS_MODES { #define HostCmd_ACT_GEN_GET 0x0000 /** General purpose action : Set */ #define HostCmd_ACT_GEN_SET 0x0001 +/** Special purpose action : Set */ +#define HostCmd_ACT_SPC_SET 0x8001 /** General purpose action : Set Default */ #define HostCmd_ACT_GEN_SET_DEFAULT 0x0002 /** General purpose action : Get_Current */ @@ -4754,6 +4757,22 @@ typedef MLAN_PACK_START struct _hostcmd_twt_report { /** TWT report payload for FW response to fill */ t_u8 data[36]; } MLAN_PACK_END hostcmd_twt_report, *phostcmd_twt_report; + +/** Type definition of hostcmd_twt_teardown */ +typedef struct MLAN_PACK_START _hostcmd_twt_information { + /** TWT Flow Identifier. Range: [0-7] */ + t_u8 flow_identifier; + /** Suspend Duration. Range: [0-UINT32_MAX] + * 0:Suspend forever; + * Else:Suspend agreement for specific duration in milli seconds, + * after than resume the agreement and enter SP immediately + */ + t_u32 suspend_duration; + /** TWT Information State. Set to 0 by driver, filled by FW in response + */ + t_u8 twt_information_state; +} MLAN_PACK_END hostcmd_twt_information, *phostcmd_twt_information; + /** HostCmd_DS_TWT_CFG */ typedef MLAN_PACK_START struct _HostCmd_DS_TWT_CFG { /** Action */ @@ -4769,6 +4788,10 @@ typedef MLAN_PACK_START struct _HostCmd_DS_TWT_CFG { hostcmd_twt_teardown twt_teardown; /** TWT report for Sub ID: MLAN_11AX_TWT_REPORT_SUBID */ hostcmd_twt_report twt_report; + /** TWT Information config for Sub ID: + * MLAN_11AX_TWT_INFORMATION_SUBID + */ + hostcmd_twt_information twt_information; } param; } MLAN_PACK_END HostCmd_DS_TWT_CFG; @@ -6441,7 +6464,7 @@ typedef MLAN_PACK_START struct _MrvlTypes_DrcsTimeSlice_t { /** Channel swith time (in TU) for chan_idx*/ t_u8 switchtime; /** Undoze time (in TU) for chan_idx*/ - t_u8 undozetime; + t_u8 rx_wait_time; /** Rx traffic control scheme when channel switch*/ /** only valid for GC/STA interface*/ t_u8 mode; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_init.c b/mxm_wifiex/wlan_src/mlan/mlan_init.c index ee477cd..5129d7a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_init.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_init.c @@ -976,7 +976,8 @@ t_void wlan_init_adapter(pmlan_adapter pmadapter) EVT_RW_PTR_ROLLOVER_IND; } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->rxbd_wrptr = pmadapter->pcard_pcie->txrx_bd_size; @@ -1187,6 +1188,9 @@ mlan_status wlan_init_lock_list(pmlan_adapter pmadapter) util_init_list_head((t_void *)pmadapter->pmoal_handle, &pmadapter->rx_data_queue, MTRUE, pmadapter->callbacks.moal_init_lock); + util_init_list_head((t_void *)pmadapter->pmoal_handle, + &pmadapter->amsdu_txq, MTRUE, + pmadapter->callbacks.moal_init_lock); util_scalar_init((t_void *)pmadapter->pmoal_handle, &pmadapter->bypass_pkt_count, 0, MNULL, pmadapter->callbacks.moal_init_lock); @@ -1300,6 +1304,8 @@ t_void wlan_free_lock_list(pmlan_adapter pmadapter) /* Free lists */ util_free_list_head((t_void *)pmadapter->pmoal_handle, &pmadapter->rx_data_queue, pcb->moal_free_lock); + util_free_list_head((t_void *)pmadapter->pmoal_handle, + &pmadapter->amsdu_txq, pcb->moal_free_lock); util_scalar_free((t_void *)pmadapter->pmoal_handle, &pmadapter->bypass_pkt_count, pcb->moal_free_lock); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h index 8153a98..252a7de 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h @@ -739,7 +739,7 @@ typedef struct _mlan_chan_list { #define CHAN_FLAGS_MAX MBIT(31) /** Maximum response buffer length */ -#define ASSOC_RSP_BUF_SIZE 500 +#define ASSOC_RSP_BUF_SIZE 2060 /** Type definition of mlan_ds_misc_assoc_rsp for MLAN_OID_MISC_ASSOC_RSP */ typedef struct _mlan_ds_misc_assoc_rsp { @@ -4025,6 +4025,7 @@ typedef struct _mlan_ds_11ax_cfg { #define MLAN_11AX_TWT_SETUP_SUBID 0x114 #define MLAN_11AX_TWT_TEARDOWN_SUBID 0x115 #define MLAN_11AX_TWT_REPORT_SUBID 0x116 +#define MLAN_11AX_TWT_INFORMATION_SUBID 0x119 #define MRVL_DOT11AX_ENABLE_SR_TLV_ID (PROPRIETARY_TLV_BASE_ID + 322) #define MRVL_DOT11AX_OBSS_PD_OFFSET_TLV_ID (PROPRIETARY_TLV_BASE_ID + 323) @@ -4202,6 +4203,18 @@ typedef MLAN_PACK_START struct _mlan_ds_twt_report { t_u8 data[36]; } MLAN_PACK_END mlan_ds_twt_report, *pmlan_ds_twt_report; +/** Type definition of mlan_ds_twt_information for MLAN_OID_11AX_TWT_CFG */ +typedef struct MLAN_PACK_START _mlan_ds_twt_information { + /** TWT Flow Identifier. Range: [0-7] */ + t_u8 flow_identifier; + /** Suspend Duration. Range: [0-UINT32_MAX] + * 0:Suspend forever; + * Else:Suspend agreement for specific duration in milli seconds, + * after than resume the agreement and enter SP immediately + */ + t_u32 suspend_duration; +} MLAN_PACK_END mlan_ds_twt_information, *pmlan_ds_twt_information; + /** Type definition of mlan_ds_twtcfg for MLAN_OID_11AX_TWT_CFG */ typedef struct MLAN_PACK_START _mlan_ds_twtcfg { /** Sub-command */ @@ -4217,6 +4230,10 @@ typedef struct MLAN_PACK_START _mlan_ds_twtcfg { mlan_ds_twt_teardown twt_teardown; /** TWT report for Sub ID: MLAN_11AX_TWT_REPORT_SUBID */ mlan_ds_twt_report twt_report; + /** TWT Information config for Sub ID: + * MLAN_11AX_TWT_INFORMATION_SUBID + */ + mlan_ds_twt_information twt_information; } param; } MLAN_PACK_END mlan_ds_twtcfg, *pmlan_ds_twtcfg; @@ -4296,14 +4313,16 @@ enum _mlan_reg_type { MLAN_REG_BCA = 7, #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) || \ - defined(SD9177) || defined(SDIW615) || defined(USBIW615) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) || defined(SD9177) || \ + defined(SDIW615) || defined(USBIW615) MLAN_REG_CIU = 8, #endif #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) || \ - defined(SDIW615) || defined(USBIW615) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) || defined(SDIW615) || \ + defined(USBIW615) MLAN_REG_MAC2 = 0x81, MLAN_REG_BBP2 = 0x82, MLAN_REG_RF2 = 0x83, @@ -5083,7 +5102,7 @@ typedef MLAN_PACK_START struct _mlan_ds_drcs_cfg { /** Channel swith time (in TU) for chan_idx */ t_u8 switchtime; /** Undoze time (in TU) for chan_idx */ - t_u8 undozetime; + t_u8 rx_wait_time; /** Rx traffic control scheme when channel switch*/ /** only valid for GC/STA interface*/ t_u8 mode; @@ -5844,7 +5863,9 @@ struct MLAN_PACK_START mfg_cmd_tx_frame2 { /** STBC */ t_u32 stbc; /** power id */ - t_u32 rsvd[2]; + t_u32 rsvd[1]; + /**signal bw*/ + t_u32 signal_bw; /** NumPkt */ t_u32 NumPkt; /** MaxPE */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_join.h b/mxm_wifiex/wlan_src/mlan/mlan_join.h index 5a90761..f7bafb9 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_join.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_join.h @@ -33,9 +33,6 @@ Change log: #ifndef _MLAN_JOIN_H_ #define _MLAN_JOIN_H_ -/** Size of buffer allocated to store the association response from firmware */ -#define MRVDRV_ASSOC_RSP_BUF_SIZE 500 - /** Size of buffer allocated to store IEs passed to firmware in the assoc req */ #define MRVDRV_GENIE_BUF_SIZE 256 diff --git a/mxm_wifiex/wlan_src/mlan/mlan_main.h b/mxm_wifiex/wlan_src/mlan/mlan_main.h index 3eaf14d..edd7433 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_main.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_main.h @@ -570,8 +570,8 @@ extern t_void (*assert_callback)(t_void *pmoal_handle, t_u32 cond); /** Maximum numbfer of registers to read for multiple port */ #if defined(SD8887) || defined(SD8997) || defined(SD8977) || \ defined(SD8987) || defined(SD9098) || defined(SD9097) || \ - defined(SDIW624) || defined(SD8978) || defined(SD9177) || \ - defined(SDIW615) + defined(SDAW693) || defined(SDIW624) || defined(SD8978) || \ + defined(SD9177) || defined(SDIW615) #define MAX_MP_REGS 196 #else /* upto 0xB7 */ @@ -1287,11 +1287,11 @@ typedef struct _mlan_private { #ifdef STA_SUPPORT /** Buffer to store the association response for application retrieval */ - t_u8 assoc_rsp_buf[MRVDRV_ASSOC_RSP_BUF_SIZE]; + t_u8 assoc_rsp_buf[ASSOC_RSP_BUF_SIZE]; /** Length of the data stored in assoc_rsp_buf */ t_u32 assoc_rsp_size; /** Buffer to store the association req IEs */ - t_u8 assoc_req_buf[MRVDRV_ASSOC_RSP_BUF_SIZE]; + t_u8 assoc_req_buf[ASSOC_RSP_BUF_SIZE]; /** Length of the data stored in assoc_rsp_buf */ t_u32 assoc_req_size; /** Generic IEEE IEs passed from the application to be inserted into the @@ -2341,6 +2341,13 @@ typedef struct _adapter_operations { mlan_status (*enable_host_int)(mlan_adapter *pmadapter); /** select host interrupt */ mlan_status (*select_host_int)(mlan_adapter *pmadapter); +#ifdef PCIEAW693 + /** get_max_msdu_pkt_num in AMSDU packet*/ + t_u32 (*get_max_msdu_cnt)(mlan_adapter *pmadapter); + /** send_data_list */ + mlan_status (*send_data_list)(mlan_adapter *pmadapter, t_u8 type, + t_u8 num_pkt, t_u16 pkt_size); +#endif /**Interface header length*/ t_u32 intf_header_len; } mlan_adapter_operations; @@ -2455,7 +2462,8 @@ struct _mlan_adapter { t_u32 fw_cap_ext; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ - defined(SDIW624) || defined(PCIEIW624) || defined(USBIW624) + defined(SDAW693) || defined(SDIW624) || defined(PCIEAW693) || \ + defined(PCIEIW624) || defined(USBIW624) /** High byte for 5G, low byte for 2G, like 0x2211 0x22 for 5G, 0x11 for * 2G */ t_u16 user_htstream; @@ -2802,6 +2810,8 @@ struct _mlan_adapter { t_u16 max_mgmt_ie_index; /** Head of Rx data queue */ mlan_list_head rx_data_queue; + /** Head of AMSDU Tx data queue */ + mlan_list_head amsdu_txq; #ifdef MFG_CMD_SUPPORT t_u32 mfg_mode; #endif @@ -3962,6 +3972,30 @@ static INLINE int wlan_is_tdls_link_setup(tdlsStatus_e status) return ret; } +/** + * @brief This function checks if address is broadcast + * + * @param addr mac address + * @return 1 - broadcast, 0 - not broadcast + */ +static INLINE t_bool is_bcast_addr(t_u8 *addr) +{ + return ((*(t_u16 *)addr == 0xffff) && + (*(t_u16 *)((t_u8 *)addr + 2) == 0xffff) && + (*(t_u16 *)((t_u8 *)addr + 4) == 0xffff)); +} + +/** + * @brief This function checks if address is multicast + * + * @param addr mac address + * @return 1 - multicast, 0 - not multicast + */ +static INLINE t_bool is_mcast_addr(t_u8 *addr) +{ + return ((*(t_u8 *)addr & 0x01) == 0x01); +} + /** * @brief This function checks tx_pause flag for peer * diff --git a/mxm_wifiex/wlan_src/mlan/mlan_misc.c b/mxm_wifiex/wlan_src/mlan/mlan_misc.c index 6c5ce99..0325d85 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_misc.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_misc.c @@ -4,7 +4,7 @@ * @brief This file include miscellaneous functions for MLAN module * * - * Copyright 2009-2023 NXP + * Copyright 2009-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -1679,7 +1679,8 @@ mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, case MLAN_REG_MAC: #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) case MLAN_REG_MAC2: #endif cmd_no = HostCmd_CMD_MAC_REG_ACCESS; @@ -1687,7 +1688,8 @@ mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, case MLAN_REG_BBP: #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) case MLAN_REG_BBP2: #endif cmd_no = HostCmd_CMD_BBP_REG_ACCESS; @@ -1695,7 +1697,8 @@ mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, case MLAN_REG_RF: #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) case MLAN_REG_RF2: #endif cmd_no = HostCmd_CMD_RF_REG_ACCESS; @@ -1709,15 +1712,17 @@ mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, case MLAN_REG_BCA: #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) case MLAN_REG_BCA2: #endif cmd_no = HostCmd_CMD_BCA_REG_ACCESS; break; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) || \ - defined(SD9177) || defined(SDIW615) || defined(USBIW615) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) || defined(SD9177) || \ + defined(SDIW615) || defined(USBIW615) case MLAN_REG_CIU: cmd_no = HostCmd_CMD_REG_ACCESS; break; @@ -3600,8 +3605,8 @@ mlan_status wlan_misc_multi_ap_cfg(pmlan_adapter pmadapter, * * @return MTRUE/MFALSE */ -t_u8 wlan_check_beacon_prot_supported(mlan_private *pmpriv, - BSSDescriptor_t *pbss_desc) +static t_u8 wlan_check_beacon_prot_supported(mlan_private *pmpriv, + BSSDescriptor_t *pbss_desc) { if (pbss_desc && pbss_desc->pext_cap) { if (pbss_desc->pext_cap->ieee_hdr.len < 11) @@ -4187,7 +4192,8 @@ mlan_status wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, if (IS_STREAM_2X2(pmadapter->feature_control)) { #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || IS_CARDAW693(pmadapter->card_type) || @@ -4236,7 +4242,8 @@ mlan_status wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, ant_cfg->rx_antenna &= 0x0003; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) } #endif if (!ant_cfg->tx_antenna || @@ -4335,7 +4342,8 @@ mlan_status wlan_handle_antcfg(mlan_private *pmpriv, t_u32 init_antcfg) if (IS_STREAM_2X2(pmadapter->feature_control)) { #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || IS_CARDAW693(pmadapter->card_type) || @@ -4379,7 +4387,8 @@ mlan_status wlan_handle_antcfg(mlan_private *pmpriv, t_u32 init_antcfg) ant_cfg.rx_antenna &= 0x0003; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) } #endif if (!ant_cfg.tx_antenna || diff --git a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c index cdf4975..983808b 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c @@ -121,6 +121,42 @@ static const struct _mlan_card_info mlan_card_info_pcie8997 = { }; #endif +#ifdef PCIEAW693 +static const struct _mlan_pcie_card_reg mlan_reg_pcieaw693 = { + .reg_txbd_rdptr = PCIE9098_TXBD_RDPTR, + .reg_txbd_wrptr = PCIE9098_TXBD_WRPTR, + .reg_rxbd_rdptr = PCIE9098_RXBD_RDPTR, + .reg_rxbd_wrptr = PCIE9098_RXBD_WRPTR, + .reg_evtbd_rdptr = PCIE9098_EVTBD_RDPTR, + .reg_evtbd_wrptr = PCIE9098_EVTBD_WRPTR, + .reg_host_int_mask = PCIE9097_B0_HOST_INT_MASK, + .reg_host_int_status_mask = PCIE9097_B0_HOST_INT_STATUS_MASK, + .reg_host_int_status = PCIE9097_B0_HOST_INT_STATUS, + .reg_host_int_clr_sel = PCIE9097_B0_HOST_INT_CLR_SEL, + .reg_cpu_int_event = PCIE9098_CPU_INT_EVENT, + .reg_ip_rev = PCIE9098_DEV_ID_REG, + .reg_drv_ready = PCIE9098_DRV_READY, + .reg_cpu_int_status = PCIE9098_CPU_INT_STATUS, + .reg_rev_id = PCIE9098_REV_ID_REG, + .reg_scratch_0 = PCIE9098_SCRATCH_0_REG, + .reg_scratch_1 = PCIE9098_SCRATCH_1_REG, + .reg_scratch_2 = PCIE9098_SCRATCH_2_REG, + .reg_scratch_3 = PCIE9098_SCRATCH_3_REG, + .reg_scratch_6 = PCIE9098_SCRATCH_6_REG, + .reg_scratch_7 = PCIE9098_SCRATCH_7_REG, + .host_intr_mask = PCIE9098_HOST_INTR_MASK, + .host_intr_dnld_done = PCIE9098_HOST_INTR_DNLD_DONE, + .host_intr_upld_rdy = PCIE9098_HOST_INTR_UPLD_RDY, + .host_intr_cmd_done = PCIE9098_HOST_INTR_CMD_DONE, + .host_intr_event_rdy = PCIE9098_HOST_INTR_EVENT_RDY, + .host_intr_cmd_dnld = PCIE9098_HOST_INTR_CMD_DNLD, + .adma_align_size = ADMA_ALIGN_SIZE_1, + .adma_min_pkt_size = ADMA_MIN_PKT_SIZE_32, + .use_adma = MTRUE, + .msi_int_wr_clr = MTRUE, +}; +#endif + #if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) static const struct _mlan_pcie_card_reg mlan_reg_pcie9097_b0 = { .reg_txbd_rdptr = PCIE9098_TXBD_RDPTR, @@ -193,7 +229,8 @@ static const struct _mlan_pcie_card_reg mlan_reg_pcie9098 = { }; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) static const struct _mlan_card_info mlan_card_info_pcie9098 = { .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, .v16_fw_api = 1, @@ -214,7 +251,8 @@ static const struct _mlan_card_info mlan_card_info_pcie9098 = { static mlan_status wlan_pcie_delete_evtbd_ring(pmlan_adapter pmadapter); static mlan_status wlan_pcie_delete_rxbd_ring(pmlan_adapter pmadapter); -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) /** * @brief This function program dma_cfg/dma_cfg2/dma_cfg3 registers * @@ -592,7 +630,104 @@ static void wlan_pcie_init_adma_ring_size(mlan_adapter *pmadapter) #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) +#if defined(PCIEAW693) +/** + * @brief This function get max msdu count + * + * @param pmadapter A pointer to mlan_adapter structure + * + * @return max msdu count + */ +static t_u32 wlan_pcie_get_max_msdu_cnt(mlan_adapter *pmadapter) +{ + t_u32 ring_size = 0; + const t_u32 num_tx_buffers = pmadapter->pcard_pcie->txrx_bd_size; + const t_u32 num_pending = pmadapter->pcard_pcie->txbd_pending; + + ENTER(); +#ifdef PCIEAW693 + if (!IS_PCIEAW693(pmadapter->card_type)) + return 0; +#endif + + if (num_tx_buffers > num_pending) + ring_size = num_tx_buffers - num_pending; + + LEAVE(); + return ring_size; +} +#endif + +#if defined(PCIEAW693) +/** + * @brief This function return the index of desc with EOP flag. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param num_tx_buffs Ring size + * @param index index in Tx ring + * @param wrindx Current write index in TX ring + * + * @return index in Tx ring with EOP flag + */ +static t_u32 wlan_get_adma_desc_with_eop(mlan_pcie_card *pcard, + t_u32 num_tx_buffs, t_u32 index, + t_u32 wrindx) +{ + for (; index != wrindx; index = (index + 1) & (num_tx_buffs - 1)) { + adma_dual_desc_buf *desc = pcard->txbd_ring[index]; + if (desc->flags & ADMA_BD_FLAG_EOP) + return index; + } + + return wrindx; +} + +/** + * @brief This function enables tx_done interrupt in pending descriptor if + * needed. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param num_tx_buffs Ring size + * @param wrindx Current write index in TX ring + * + * @return N/A + */ +static void wlan_get_adma_buf_flag_sliding(mlan_adapter *pmadapter, + t_u32 num_tx_buffs, t_u32 wrindx) +{ + const t_u32 txbd_pending_threshold = num_tx_buffs / 4; + const t_u32 invalid_index = 0xffffffff; + mlan_pcie_card *pcard = pmadapter->pcard_pcie; + t_u32 last_write_index_with_irq = invalid_index; + const t_u32 mid = + (wrindx - pcard->txbd_pending / 2) & (num_tx_buffs - 1); + const t_u32 mid_idx = + wlan_get_adma_desc_with_eop(pcard, num_tx_buffs, mid, wrindx); + + if (mid_idx != wrindx && pcard->txbd_pending > txbd_pending_threshold && + pcard->last_write_index_with_irq != mid_idx) { + adma_dual_desc_buf *desc = pcard->txbd_ring[mid_idx]; + + desc->flags |= wlan_cpu_to_le16(ADMA_BD_FLAG_INT_EN); + last_write_index_with_irq = mid_idx; + } + + if (last_write_index_with_irq != invalid_index) { + if (pcard->last_write_index_with_irq != invalid_index && + pcard->last_write_index_with_irq != mid_idx) { + adma_dual_desc_buf *desc = + pcard->txbd_ring + [pcard->last_write_index_with_irq]; + + desc->flags &= ~wlan_cpu_to_le16(ADMA_BD_FLAG_INT_EN); + } + + pcard->last_write_index_with_irq = last_write_index_with_irq; + } +} +#endif /** * @brief This function enables tx_done interrupt in pending descriptor if @@ -806,7 +941,7 @@ done: } #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) /** * @brief This function handles command response completion * @@ -870,7 +1005,8 @@ static mlan_status wlan_pcie_send_vdll(mlan_adapter *pmadapter, } pmadapter->pcard_pcie->vdll_cmd_buf = pmbuf; -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) /* issue the DMA */ if (pmadapter->pcard_pcie->reg->use_adma) { /* send the VDLL block down to the firmware */ @@ -992,7 +1128,8 @@ static mlan_status wlan_disable_pcie_host_int(mlan_adapter *pmadapter) LEAVE(); return ret; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || (pmadapter->card_type == CARD_TYPE_PCIEIW624) || (pmadapter->card_type == CARD_TYPE_PCIEAW693) || @@ -1071,7 +1208,8 @@ static mlan_status wlan_enable_pcie_host_int(mlan_adapter *pmadapter) LEAVE(); return ret; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || (pmadapter->card_type == CARD_TYPE_PCIEIW624) || (pmadapter->card_type == CARD_TYPE_PCIEAW693) || @@ -1103,7 +1241,8 @@ static mlan_status wlan_pcie_create_txbd_ring(mlan_adapter *pmadapter) #if defined(PCIE8997) || defined(PCIE8897) pmlan_pcie_data_buf ptx_bd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) padma_dual_desc_buf padma_bd_buf; #endif @@ -1125,7 +1264,8 @@ static mlan_status wlan_pcie_create_txbd_ring(mlan_adapter *pmadapter) pmadapter->pcard_pcie->txrx_bd_size; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->txbd_ring_size = sizeof(adma_dual_desc_buf) * @@ -1156,7 +1296,8 @@ static mlan_status wlan_pcie_create_txbd_ring(mlan_adapter *pmadapter) for (i = 0; i < pmadapter->pcard_pcie->txrx_bd_size; i++) { pmadapter->pcard_pcie->tx_buf_list[i] = MNULL; -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf @@ -1211,7 +1352,8 @@ static mlan_status wlan_pcie_delete_txbd_ring(mlan_adapter *pmadapter) #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_data_buf *ptx_bd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1245,7 +1387,8 @@ static mlan_status wlan_pcie_delete_txbd_ring(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *) @@ -1297,7 +1440,8 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_data_buf *prxbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1321,7 +1465,8 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) /* * driver maintaines the write pointer and firmware maintaines the read * pointer. The read pointer starts at 0 (zero) while the write pointer @@ -1413,7 +1558,8 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf @@ -1423,9 +1569,7 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) pmadapter->pcard_pcie->rxbd_ring[i] = (t_void *)padma_bd_buf; padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); - padma_bd_buf->len = wlan_cpu_to_le16(ALIGN_SZ( - pmbuf->data_len, - pmadapter->pcard_pcie->reg->adma_align_size)); + padma_bd_buf->len = wlan_cpu_to_le16(pmbuf->data_len); padma_bd_buf->flags = wlan_cpu_to_le16( ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); padma_bd_buf->pkt_size = 0; @@ -1453,7 +1597,8 @@ static mlan_status wlan_pcie_delete_rxbd_ring(mlan_adapter *pmadapter) #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_data_buf *prxbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1485,7 +1630,8 @@ static mlan_status wlan_pcie_delete_rxbd_ring(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *) @@ -1536,7 +1682,8 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) pmlan_pcie_evt_buf pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1555,7 +1702,8 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->evtbd_wrptr = MLAN_MAX_EVT_BD; pmadapter->pcard_pcie->evtbd_ring_size = @@ -1627,7 +1775,8 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf @@ -1637,9 +1786,7 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) pmadapter->pcard_pcie->evtbd_ring[i] = (t_void *)padma_bd_buf; padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); - padma_bd_buf->len = wlan_cpu_to_le16(ALIGN_SZ( - pmbuf->data_len, - pmadapter->pcard_pcie->reg->adma_align_size)); + padma_bd_buf->len = wlan_cpu_to_le16(pmbuf->data_len); padma_bd_buf->flags = wlan_cpu_to_le16( ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); padma_bd_buf->pkt_size = 0; @@ -1667,7 +1814,8 @@ static mlan_status wlan_pcie_delete_evtbd_ring(mlan_adapter *pmadapter) #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_evt_buf *pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif @@ -1698,7 +1846,8 @@ static mlan_status wlan_pcie_delete_evtbd_ring(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *) @@ -1896,7 +2045,8 @@ static t_u8 wlan_check_tx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) return MFALSE; } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { if ((pmadapter->pcard_pcie->txbd_rdptr & ADMA_RW_PTR_WRAP_MASK) != (rdptr & ADMA_RW_PTR_WRAP_MASK)) @@ -1930,7 +2080,8 @@ static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) pmadapter->pcard_pcie->reg->txrx_rw_ptr_rollover_ind; mlan_pcie_data_buf *ptx_bd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; t_u32 wrptr; #endif @@ -1958,7 +2109,8 @@ static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) rdptr = rdptr >> TXBD_RW_PTR_START; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { wrptr = rdptr & 0xffff; rdptr = rdptr >> ADMA_RPTR_START; @@ -2017,7 +2169,8 @@ static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) txrx_rw_ptr_rollover_ind); } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter->pcard_pcie @@ -2049,7 +2202,13 @@ done: pmadapter->pmlan_pcie_lock); pmadapter->pcard_pcie->txbd_pending -= unmap_count; if (unmap_count) { - pmadapter->data_sent = MFALSE; +#ifdef PCIEAW693 + if (IS_PCIEAW693(pmadapter->card_type) && + (wlan_pcie_get_max_msdu_cnt(pmadapter) < 2)) + pmadapter->data_sent = MTRUE; + else +#endif + pmadapter->data_sent = MFALSE; } pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->pmlan_pcie_lock); @@ -2105,7 +2264,8 @@ exit_tx_proc: ((wrptr & rollover_ind) == (rdptr & rollover_ind))) #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) #define ADMA_TXBD_IS_FULL(wrptr, rdptr, mask, rollover_ind) \ (((wrptr & mask) == (rdptr & mask)) && \ ((wrptr & rollover_ind) != (rdptr & rollover_ind))) @@ -2129,7 +2289,8 @@ static t_u8 wlan_check_txbd_not_full(mlan_adapter *pmadapter) return MFALSE; } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { txrx_rw_ptr_mask = pmadapter->pcard_pcie->txrx_bd_size - 1; txrx_rw_ptr_rollover_ind = pmadapter->pcard_pcie->txrx_bd_size; @@ -2145,7 +2306,190 @@ static t_u8 wlan_check_txbd_not_full(mlan_adapter *pmadapter) return MFALSE; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) +#if defined(PCIEAW693) +/** + * @brief This function downloads data to the card. + * + * @param pmadapter A pointer to mlan_adapter structure + * + * @param pmbuf A pointer to mlan_buffer (pmbuf->data_len should include + * PCIE header) + * @param flag A pointer to mlan_tx_param + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_pcie_send_adma_data(mlan_adapter *pmadapter, + mlan_buffer *pmbuf, t_u16 flags, + t_u16 pkt_size) +{ + t_u32 reg_txbd_wrptr = pmadapter->pcard_pcie->reg->reg_txbd_wrptr; + adma_dual_desc_buf *padma_bd_buf = MNULL; + const t_u32 num_tx_buffs = pmadapter->pcard_pcie->txrx_bd_size; + mlan_status ret = MLAN_STATUS_PENDING; + pmlan_callbacks pcb = &pmadapter->callbacks; + t_u32 rxbd_val = 0; + t_u32 wrindx; + t_u32 wr_ptr_start = 0; + + ENTER(); + + if (!pmbuf) { + PRINTM(MERROR, "%s() has no buffer", __FUNCTION__); + ret = MLAN_STATUS_FAILURE; + goto done; + } + if (!(pmbuf->pbuf && pmbuf->data_len)) { + PRINTM(MERROR, "Invalid parameter <%p, %#x>\n", pmbuf->pbuf, + pmbuf->data_len); + ret = MLAN_STATUS_FAILURE; + goto done; + } + PRINTM(MDATA, + "wlan_pcie_send_adma_data: len=%d flags=0x%x, pkt_size=%d\n", + pmbuf->data_len, flags, pkt_size); + PRINTM(MINFO, "SEND DATA: \n", + pmadapter->pcard_pcie->txbd_rdptr, + pmadapter->pcard_pcie->txbd_wrptr); + + if (wlan_check_txbd_not_full(pmadapter)) { + pmadapter->data_sent = MTRUE; + + /* Map pmbuf, and attach to tx ring */ + if (MLAN_STATUS_FAILURE == + pcb->moal_map_memory(pmadapter->pmoal_handle, + pmbuf->pbuf + pmbuf->data_offset, + &pmbuf->buf_pa, pmbuf->data_len, + PCI_DMA_TODEVICE)) { + PRINTM(MERROR, + "SEND DATA: failed to moal_map_memory\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + wrindx = pmadapter->pcard_pcie->txbd_wrptr & (num_tx_buffs - 1); + PRINTM(MDAT_D, + "SEND DATA: Attach pmbuf %p at tx_ring[%d], txbd_wrptr=0x%x\n", + pmbuf, wrindx, pmadapter->pcard_pcie->txbd_wrptr); + pcb->moal_spin_lock(pmadapter->pmoal_handle, + pmadapter->pmlan_pcie_lock); + pmadapter->pcard_pcie->tx_buf_list[wrindx] = pmbuf; + pmadapter->pcard_pcie->txbd_pending++; + pcb->moal_spin_unlock(pmadapter->pmoal_handle, + pmadapter->pmlan_pcie_lock); + + wr_ptr_start = ADMA_WPTR_START; + padma_bd_buf = (adma_dual_desc_buf *) + pmadapter->pcard_pcie->txbd_ring[wrindx]; + padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); + padma_bd_buf->len = + ALIGN_SZ(pmbuf->data_len, + pmadapter->pcard_pcie->reg->adma_align_size); + if (padma_bd_buf->len < + pmadapter->pcard_pcie->reg->adma_min_pkt_size) + padma_bd_buf->len = + pmadapter->pcard_pcie->reg->adma_min_pkt_size; + + padma_bd_buf->flags = ADMA_BD_FLAG_SRC_HOST; + if (flags & ADMA_BD_FLAG_SOP) { + padma_bd_buf->flags |= ADMA_BD_FLAG_SOP; + padma_bd_buf->pkt_size = pkt_size; + } else { + padma_bd_buf->pkt_size = padma_bd_buf->len; + } + if (flags & ADMA_BD_FLAG_EOP) { + wlan_get_adma_buf_flag_sliding(pmadapter, num_tx_buffs, + wrindx); + padma_bd_buf->flags |= ADMA_BD_FLAG_EOP; + } + padma_bd_buf->flags = wlan_cpu_to_le16(padma_bd_buf->flags); + padma_bd_buf->len = wlan_cpu_to_le16(padma_bd_buf->len); + padma_bd_buf->pkt_size = + wlan_cpu_to_le16(padma_bd_buf->pkt_size); + pmadapter->pcard_pcie->last_tx_pkt_size[wrindx] = + pmbuf->data_len; + pmadapter->pcard_pcie->txbd_wrptr++; + pmadapter->pcard_pcie->txbd_wrptr &= ADMA_RW_PTR_WRAP_MASK; + DBG_HEXDUMP(MDAT_D, "adma_bd_buf", padma_bd_buf, + sizeof(adma_dual_desc_buf)); + if (flags & ADMA_BD_FLAG_EOP) { + PRINTM(MINFO, "REG_TXBD_WRPT(0x%x) = 0x%x\n", + reg_txbd_wrptr, + ((pmadapter->pcard_pcie->txbd_wrptr + << wr_ptr_start) | + rxbd_val)); + /* Write the TX ring write pointer in to REG_TXBD_WRPTR + */ + if (pcb->moal_write_reg( + pmadapter->pmoal_handle, reg_txbd_wrptr, + (pmadapter->pcard_pcie->txbd_wrptr + << wr_ptr_start) | + rxbd_val)) { + PRINTM(MERROR, + "SEND DATA: failed to write REG_TXBD_WRPTR\n"); + ret = MLAN_STATUS_FAILURE; + goto done_unmap; + } + } + PRINTM(MINFO, "SEND DATA: Updated \n", + pmadapter->pcard_pcie->txbd_rdptr, + pmadapter->pcard_pcie->txbd_wrptr); + + if (wlan_check_txbd_not_full(pmadapter)) { +#ifdef PCIEAW693 + if (IS_PCIEAW693(pmadapter->card_type) && + (wlan_pcie_get_max_msdu_cnt(pmadapter) < 2)) + pmadapter->data_sent = MTRUE; + else +#endif + pmadapter->data_sent = MFALSE; + } else + wlan_pcie_process_tx_complete(pmadapter); + if (pmadapter->data_sent) + pmadapter->data_sent_cnt++; + + PRINTM(MINFO, "Sent packet to firmware successfully\n"); + } else { + PRINTM(MERROR, + "TX Ring full, can't send anymore packets to firmware\n"); + PRINTM(MINFO, "SEND DATA (FULL!): \n", + pmadapter->pcard_pcie->txbd_rdptr, + pmadapter->pcard_pcie->txbd_wrptr); + pmadapter->data_sent = MTRUE; + ret = MLAN_STATUS_FAILURE; + goto done; + } + + LEAVE(); + return ret; + +done_unmap: + if (MLAN_STATUS_FAILURE == + pcb->moal_unmap_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + pmbuf->buf_pa, pmbuf->data_len, PCI_DMA_TODEVICE)) { + PRINTM(MERROR, "SEND DATA: failed to moal_unmap_memory\n"); + ret = MLAN_STATUS_FAILURE; + } + pcb->moal_spin_lock(pmadapter->pmoal_handle, + pmadapter->pmlan_pcie_lock); + pmadapter->pcard_pcie->txbd_pending--; + pmadapter->pcard_pcie->tx_buf_list[wrindx] = MNULL; + pcb->moal_spin_unlock(pmadapter->pmoal_handle, + pmadapter->pmlan_pcie_lock); + + if (padma_bd_buf) { + padma_bd_buf->paddr = 0; + padma_bd_buf->len = 0; + padma_bd_buf->flags = 0; + padma_bd_buf->pkt_size = 0; + padma_bd_buf->reserved = 0; + } +done: + LEAVE(); + return ret; +} +#endif #endif @@ -2171,7 +2515,8 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, pmadapter->pcard_pcie->reg->txrx_rw_ptr_rollover_ind; mlan_pcie_data_buf *ptx_bd_buf = MNULL; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf = MNULL; #endif const t_u32 num_tx_buffs = pmadapter->pcard_pcie->txrx_bd_size; @@ -2265,24 +2610,29 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { wr_ptr_start = ADMA_WPTR_START; padma_bd_buf = (adma_dual_desc_buf *)pmadapter ->pcard_pcie->txbd_ring[wrindx]; padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); - padma_bd_buf->len = ALIGN_SZ( - pmbuf->data_len, - pmadapter->pcard_pcie->reg->adma_align_size); - padma_bd_buf->flags = wlan_get_adma_buf_flag( - pmadapter, num_tx_buffs, wrindx); + padma_bd_buf->len = pmbuf->data_len; + +#if defined(PCIEAW693) + if (IS_PCIEAW693(pmadapter->card_type)) { + padma_bd_buf->flags = 0; + wlan_get_adma_buf_flag_sliding( + pmadapter, num_tx_buffs, wrindx); + } else +#endif + { + padma_bd_buf->flags = wlan_get_adma_buf_flag( + pmadapter, num_tx_buffs, wrindx); + } padma_bd_buf->flags = wlan_cpu_to_le16( padma_bd_buf->flags | ADMA_BD_FLAG_SOP | ADMA_BD_FLAG_EOP | ADMA_BD_FLAG_SRC_HOST); - if (padma_bd_buf->len < - pmadapter->pcard_pcie->reg->adma_min_pkt_size) - padma_bd_buf->len = pmadapter->pcard_pcie->reg - ->adma_min_pkt_size; padma_bd_buf->len = wlan_cpu_to_le16(padma_bd_buf->len); padma_bd_buf->pkt_size = padma_bd_buf->len; pmadapter->pcard_pcie->last_tx_pkt_size[wrindx] = @@ -2317,7 +2667,13 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, pmadapter->pcard_pcie->txbd_wrptr); if (wlan_check_txbd_not_full(pmadapter)) { - pmadapter->data_sent = MFALSE; +#ifdef PCIEAW693 + if (IS_PCIEAW693(pmadapter->card_type) && + (wlan_pcie_get_max_msdu_cnt(pmadapter) < 2)) + pmadapter->data_sent = MTRUE; + else +#endif + pmadapter->data_sent = MFALSE; } else wlan_pcie_process_tx_complete(pmadapter); if (pmadapter->data_sent) @@ -2373,7 +2729,8 @@ done_unmap: ptx_bd_buf->offset = 0; } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma && padma_bd_buf) { padma_bd_buf->paddr = 0; padma_bd_buf->len = 0; @@ -2413,7 +2770,8 @@ static t_u8 wlan_check_rx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { if ((pmadapter->pcard_pcie->rxbd_rdptr & ADMA_RW_PTR_WRAP_MASK) != (rdptr & ADMA_RW_PTR_WRAP_MASK)) @@ -2459,7 +2817,8 @@ static t_u8 wlan_is_rx_pending_full(mlan_adapter *pmadapter, t_u32 rdptr) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { PRINTM(MDATA, "local wrptr: 0x%x -> reg rdptr: 0x%x\n", (pmadapter->pcard_pcie->rxbd_wrptr & @@ -2499,7 +2858,8 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) pmadapter->pcard_pcie->reg->txrx_rw_ptr_rollover_ind; mlan_pcie_data_buf *prxbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif t_u32 in_ts_sec, in_ts_usec; @@ -2513,7 +2873,8 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) ret = MLAN_STATUS_FAILURE; goto done; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif @@ -2525,6 +2886,12 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) pmadapter->pmoal_handle, 6, 0); } while (wlan_check_rx_pending_buffer(pmadapter, rdptr)) { + if (pmadapter->rx_pkts_queued > HIGH_RX_PENDING) { + PRINTM(MEVENT, "RX Pause\n"); + pmadapter->delay_rx_data_flag = MTRUE; + goto done; + } + /* detach pmbuf (with data) from Rx Ring */ rd_index = pmadapter->pcard_pcie->rxbd_rdptr & (num_rx_buffs - 1); @@ -2677,15 +3044,14 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) txbd_val = txbd_val << TXBD_RW_PTR_START; } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter->pcard_pcie ->rxbd_ring[rd_index]; padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); - padma_bd_buf->len = wlan_cpu_to_le16(ALIGN_SZ( - pmbuf->data_len, - pmadapter->pcard_pcie->reg->adma_align_size)); + padma_bd_buf->len = wlan_cpu_to_le16(pmbuf->data_len); padma_bd_buf->flags = wlan_cpu_to_le16( ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); padma_bd_buf->pkt_size = 0; @@ -2728,7 +3094,8 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) ret = MLAN_STATUS_FAILURE; goto done; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif @@ -2835,7 +3202,8 @@ static mlan_status wlan_pcie_send_cmd(mlan_adapter *pmadapter, } } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { /* To send a command, the driver will: 1. driver prepare the cmdrep buffer for adma @@ -3004,7 +3372,8 @@ static mlan_status wlan_pcie_process_cmd_resp(mlan_adapter *pmadapter) } } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { /* Clear the cmd-rsp buffer address in adma registers. This will prevent firmware from writing to the same @@ -3077,7 +3446,8 @@ static t_u8 wlan_check_evt_buffer(mlan_adapter *pmadapter, t_u32 rdptr) return MFALSE; } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { if ((pmadapter->pcard_pcie->evtbd_rdptr & ADMA_RW_PTR_WRAP_MASK) != (rdptr & ADMA_RW_PTR_WRAP_MASK)) @@ -3105,7 +3475,8 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_evt_buf *pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif ENTER(); @@ -3124,7 +3495,8 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) LEAVE(); return MLAN_STATUS_FAILURE; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif @@ -3155,7 +3527,8 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter->pcard_pcie @@ -3190,12 +3563,11 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) pcb->moal_spin_lock(pmadapter->pmoal_handle, pmadapter->pmlan_event_lock); + pmadapter->pmlan_buffer_event = pmbuf_evt; pmadapter->event_cause = wlan_le32_to_cpu(event); pmadapter->event_received = MTRUE; pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->pmlan_event_lock); - - pmadapter->pmlan_buffer_event = pmbuf_evt; pmadapter->pcard_pcie->evtbd_rdptr++; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { @@ -3209,7 +3581,8 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->evtbd_rdptr &= ADMA_RW_PTR_WRAP_MASK; @@ -3299,7 +3672,8 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, #if defined(PCIE8997) || defined(PCIE8897) mlan_pcie_evt_buf *pevtbd_buf; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) adma_dual_desc_buf *padma_bd_buf; #endif @@ -3324,7 +3698,8 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, ret = MLAN_STATUS_FAILURE; goto done; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; #endif @@ -3355,14 +3730,13 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter ->pcard_pcie->evtbd_ring[wrptr]; padma_bd_buf->paddr = wlan_cpu_to_le64(pmbuf->buf_pa); - padma_bd_buf->len = wlan_cpu_to_le16(ALIGN_SZ( - pmbuf->data_len, - pmadapter->pcard_pcie->reg->adma_align_size)); + padma_bd_buf->len = wlan_cpu_to_le16(pmbuf->data_len); padma_bd_buf->flags = 0; padma_bd_buf->flags = wlan_cpu_to_le16( ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_DST_HOST); @@ -3392,7 +3766,8 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, } } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->evtbd_wrptr &= ADMA_RW_PTR_WRAP_MASK; #endif @@ -3767,6 +4142,14 @@ mlan_status wlan_get_pcie_device(pmlan_adapter pmadapter) pmadapter->pcard_pcie->reg = &mlan_reg_pcie9097_b0; break; +#endif +#ifdef PCIEAW693 + case CARD_TYPE_PCIEAW693: + pmadapter->pcard_pcie->reg = &mlan_reg_pcieaw693; + pmadapter->pcard_info = &mlan_card_info_pcie9098; + pmadapter->pcard_pcie->txrx_bd_size = ADMA_DEF_TXRX_BD; + pmadapter->pcard_pcie->txrx_num_desc = TXRX_DEF_NUM_DESC; + break; #endif default: PRINTM(MERROR, "can't get right pcie card type \n"); @@ -3947,7 +4330,7 @@ mlan_status wlan_process_msix_int(mlan_adapter *pmadapter) MLAN_EVENT_ID_DRV_DEFER_CMDRESP, MNULL); } #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->host_intr_cmd_dnld && (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_cmd_dnld)) { pmadapter->pcie_cmd_dnld_int = MTRUE; @@ -4081,7 +4464,7 @@ static mlan_status wlan_process_pcie_int_status(mlan_adapter *pmadapter) MLAN_EVENT_ID_DRV_DEFER_CMDRESP, MNULL); } #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->host_intr_cmd_dnld && (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_cmd_dnld)) { @@ -4378,7 +4761,7 @@ mlan_status wlan_pcie_host_to_card(pmlan_private pmpriv, t_u8 type, } else if (type == MLAN_TYPE_CMD) ret = wlan_pcie_send_cmd(pmadapter, pmbuf); #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) else if (type == MLAN_TYPE_VDLL) ret = wlan_pcie_send_vdll(pmadapter, pmbuf); #endif @@ -4506,7 +4889,8 @@ mlan_status wlan_alloc_pcie_ring_buf(pmlan_adapter pmadapter) mlan_status ret = MLAN_STATUS_SUCCESS; ENTER(); -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || (pmadapter->card_type == CARD_TYPE_PCIEIW624) || (pmadapter->card_type == CARD_TYPE_PCIEAW693) || @@ -4657,7 +5041,8 @@ mlan_status wlan_set_pcie_buf_config(mlan_private *pmpriv) } } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { /** config ADMA for Tx Data */ wlan_init_adma(pmadapter, ADMA_TX_DATA, @@ -4861,7 +5246,7 @@ static void wlan_pcie_process_cmd_dnld(mlan_adapter *pmadapter) if (pmadapter->cmd_sent) pmadapter->cmd_sent = MFALSE; #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) if (pmadapter->pcard_pcie->vdll_cmd_buf) wlan_pcie_send_vdll_complete(pmadapter); #endif @@ -4916,12 +5301,14 @@ static mlan_status wlan_process_pcie_int_status_ext(mlan_adapter *pmadapter, static mlan_status wlan_pcie_select_host_int(mlan_adapter *pmadapter) { mlan_status ret = MLAN_STATUS_SUCCESS; -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) t_u32 int_sel_mask = PCIE9098_HOST_INTR_SEL_MASK & ~PCIE9098_HOST_INTR_UPLD_RDY; #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { ret = wlan_pcie_set_host_int_select_reg(pmadapter, int_sel_mask); @@ -4931,6 +5318,71 @@ static mlan_status wlan_pcie_select_host_int(mlan_adapter *pmadapter) return ret; } +#if defined(PCIEAW693) +/** + * @brief This function send buffer list to FW + * + * @param pmadapter A pointer to mlan_adapter structure + * @param type packet type + * @param num_pkt num of pkt + * @param pkt_size packet size + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_pcie_send_data_list(mlan_adapter *pmadapter, t_u8 type, + t_u8 num_pkt, t_u16 pkt_size) +{ + pmlan_buffer pmbuf; + + t_u16 *tmp; + t_u8 *payload; + t_u8 i; + ENTER(); +#ifdef PCIEAW693 + if (!IS_PCIEAW693(pmadapter->card_type)) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } +#endif + if (wlan_is_tx_pending(pmadapter)) + wlan_pcie_process_tx_complete(pmadapter); + + if (num_pkt == 1) { + pmbuf = (pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle, + &pmadapter->amsdu_txq, + MNULL, MNULL); + if (pmbuf) { + wlan_pcie_send_data(pmadapter, type, pmbuf, MNULL); + } + return MLAN_STATUS_SUCCESS; + } + for (i = 0; i < num_pkt; i++) { + pmbuf = (pmlan_buffer)util_dequeue_list(pmadapter->pmoal_handle, + &pmadapter->amsdu_txq, + MNULL, MNULL); + if (!pmbuf) + break; + /* first pkt */ + if (i == 0) { + payload = pmbuf->pbuf + pmbuf->data_offset; + tmp = (t_u16 *)&payload[0]; + *tmp = wlan_cpu_to_le16((t_u16)pkt_size); + tmp = (t_u16 *)&payload[2]; + *tmp = wlan_cpu_to_le16(type); + wlan_pcie_send_adma_data(pmadapter, pmbuf, + ADMA_BD_FLAG_SOP, pkt_size); + } else if (i == (num_pkt - 1)) { /* last pkt */ + wlan_pcie_send_adma_data(pmadapter, pmbuf, + ADMA_BD_FLAG_EOP, 0); + } else { + wlan_pcie_send_adma_data(pmadapter, pmbuf, 0, 0); + } + } + LEAVE(); + return MLAN_STATUS_SUCCESS; +} +#endif + mlan_adapter_operations mlan_pcie_ops = { .dnld_fw = wlan_pcie_dnld_fw, .interrupt = wlan_pcie_interrupt_ext, @@ -4945,4 +5397,8 @@ mlan_adapter_operations mlan_pcie_ops = { .select_host_int = wlan_pcie_select_host_int, .debug_dump = wlan_pcie_debug_dump, .intf_header_len = PCIE_INTF_HEADER_LEN, +#ifdef PCIEAW693 + .send_data_list = wlan_pcie_send_data_list, + .get_max_msdu_cnt = wlan_pcie_get_max_msdu_cnt, +#endif }; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_pcie.h b/mxm_wifiex/wlan_src/mlan/mlan_pcie.h index 85ce4e5..f7a5214 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_pcie.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_pcie.h @@ -186,7 +186,8 @@ Change log: /** PF start bit */ #define ADMA_MSIX_PF_BIT 24 -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) /** PCIE9098 dev_id/vendor id reg */ #define PCIE9098_DEV_ID_REG 0x0000 /** PCIE revision ID register */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_scan.c b/mxm_wifiex/wlan_src/mlan/mlan_scan.c index 1f09cf5..803f165 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_scan.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_scan.c @@ -966,6 +966,17 @@ wlan_scan_channel_list(mlan_private *pmpriv, t_void *pioctl_buf, if (pmadapter->ext_scan && pmadapter->ext_scan_enh && pmadapter->ext_scan_type == EXT_SCAN_ENHANCE) done_early = MFALSE; + + /* + * Stop the loop if the *next* channel is of different + * Band + */ + // coverity[overflow_sink:SUPPRESS] + if (ptmp_chan_list->bandcfg.chanBand != + ((ChanScanParamSet_t *)(ptmp_chan_list - 1)) + ->bandcfg.chanBand) { + done_early = MTRUE; + } } /* The total scan time should be less than scan command timeout @@ -1025,9 +1036,11 @@ wlan_scan_channel_list(mlan_private *pmpriv, t_void *pioctl_buf, if (IS_FW_SUPPORT_11AX(pmadapter) && ((pmpriv->config_bands & BAND_GAX) || (pmpriv->config_bands & BAND_AAX))) { + t_u16 select_band = + (radio_type == BAND_5GHZ ? BAND_AAX : BAND_GAX); phe_cap = (MrvlIEtypes_Extension_t *)ptlv_pos; - len = wlan_fill_he_cap_tlv(pmpriv, pmpriv->config_bands, - phe_cap, MFALSE); + len = wlan_fill_he_cap_tlv(pmpriv, select_band, phe_cap, + MFALSE); HEXDUMP("SCAN: HE_CAPABILITIES IE", (t_u8 *)phe_cap, len); ptlv_pos += len; @@ -5181,7 +5194,8 @@ done: static mlan_status wlan_update_ssid_in_beacon_buf( mlan_adapter *pmadapter, BSSDescriptor_t *pbss_entry, BSSDescriptor_t *pnew_entry, IEEEtypes_Ssid_t *pssid, - IEEEtypes_ExtCap_t *pnew_extcap, IEEEtypes_Generic_t *pnew_rsnx) + IEEEtypes_ExtCap_t *pnew_extcap, IEEEtypes_Generic_t *pnew_rsnx, + IEEEtypes_Generic_t *pnew_rsn) { mlan_callbacks *pcb = (pmlan_callbacks)&pmadapter->callbacks; t_u8 *pbeacon_buf = MNULL; @@ -5189,7 +5203,7 @@ static mlan_status wlan_update_ssid_in_beacon_buf( t_s8 offset = pnew_entry->ssid.ssid_len - pbss_entry->ssid.ssid_len; IEEEtypes_ExtCap_t *pextcap; mlan_status ret = MLAN_STATUS_FAILURE; - t_u32 rsnx_offset = 0; + t_u32 rsnx_offset = 0, rsn_offset = 0; if (pnew_entry->ssid.ssid_len >= pbss_entry->ssid.ssid_len) beacon_buf_size = @@ -5205,6 +5219,11 @@ static mlan_status wlan_update_ssid_in_beacon_buf( beacon_buf_size += pnew_rsnx->ieee_hdr.len + sizeof(IEEEtypes_Header_t); + rsn_offset = beacon_buf_size; + if (pnew_rsn) + beacon_buf_size += + pnew_rsn->ieee_hdr.len + sizeof(IEEEtypes_Header_t); + ret = pcb->moal_malloc(pmadapter->pmoal_handle, beacon_buf_size, MLAN_MEM_DEF, (t_u8 **)&pbeacon_buf); if (ret != MLAN_STATUS_SUCCESS || !pbeacon_buf) { @@ -5293,6 +5312,11 @@ static mlan_status wlan_update_ssid_in_beacon_buf( pmadapter, pbeacon_buf + rsnx_offset, (t_u8 *)pnew_rsnx, pnew_rsnx->ieee_hdr.len + sizeof(IEEEtypes_Header_t), pnew_rsnx->ieee_hdr.len + sizeof(IEEEtypes_Header_t)); + if (pnew_rsn) + memcpy_ext(pmadapter, pbeacon_buf + rsn_offset, + (t_u8 *)pnew_rsn, + pnew_rsn->ieee_hdr.len + sizeof(IEEEtypes_Header_t), + pnew_rsn->ieee_hdr.len + sizeof(IEEEtypes_Header_t)); DBG_HEXDUMP(MCMD_D, "MBSSID beacon buf", pbeacon_buf, beacon_buf_size); ret = MLAN_STATUS_SUCCESS; done: @@ -5361,6 +5385,7 @@ static t_void wlan_parse_non_trans_bssid_profile( (IEEEtypes_Header_t *)pbss_profile->profile_data; IEEEtypes_MultiBSSIDIndex_t *pbssid_index = MNULL; IEEEtypes_Ssid_t *pssid = MNULL; + IEEEtypes_Generic_t *prsn = MNULL; IEEEtypes_NotxBssCap_t *pcap = (IEEEtypes_NotxBssCap_t *)pbss_profile->profile_data; t_u8 *pos = pbss_profile->profile_data; @@ -5418,6 +5443,12 @@ static t_void wlan_parse_non_trans_bssid_profile( prsnx->ieee_hdr.len + sizeof(IEEEtypes_Header_t)); break; + case RSN_IE: + prsn = (IEEEtypes_Generic_t *)pos; + DBG_HEXDUMP(MCMD_D, "MBSSID RSN", pos, + prsn->ieee_hdr.len + + sizeof(IEEEtypes_Header_t)); + break; case SSID: pssid = (IEEEtypes_Ssid_t *)pos; PRINTM(MCMND, "MBSSID: Find mbssid ssid=%s\n", @@ -5454,7 +5485,7 @@ static t_void wlan_parse_non_trans_bssid_profile( if (MLAN_STATUS_SUCCESS != wlan_update_ssid_in_beacon_buf( pmadapter, pbss_entry, bss_new_entry, pssid, - pextcap, prsnx)) { + pextcap, prsnx, prsn)) { PRINTM(MERROR, "Fail to update MBSSID beacon buf\n"); pcb->moal_mfree(pmadapter->pmoal_handle, diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c index 87f5121..b79e543 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c @@ -3,7 +3,7 @@ * @brief This file contains SDIO specific code * * - * Copyright 2008-2021 NXP + * Copyright 2008-2021, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -225,7 +225,8 @@ static const struct _mlan_card_info mlan_card_info_sd8897 = { #if defined(SD8977) || defined(SD8997) || defined(SD8987) || \ defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ - defined(SD8978) || defined(SD9177) || defined(SDIW615) + defined(SDAW693) || defined(SD8978) || defined(SD9177) || \ + defined(SDIW615) static const struct _mlan_sdio_card_reg mlan_reg_sd8977_sd8997 = { .start_rd_port = 0, .start_wr_port = 0, @@ -326,6 +327,17 @@ static const struct _mlan_card_info mlan_card_info_sdiw624 = { }; #endif +#ifdef SDAW693 +static const struct _mlan_card_info mlan_card_info_sdaw693 = { + .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, + .v16_fw_api = 1, + .v17_fw_api = 1, + .supp_ps_handshake = 0, + .default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2, + .support_11mc = 1, +}; +#endif + #ifdef SD9098 static const struct _mlan_card_info mlan_card_info_sd9098 = { .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, @@ -1055,7 +1067,8 @@ static mlan_status wlan_sdio_prog_fw_w_helper(pmlan_adapter pmadapter, t_u8 *fw, check_fw_status = MTRUE; } #endif -#if defined(SD9097) || defined(SD9177) || defined(SDIW624) || defined(SDIW615) +#if defined(SD9097) || defined(SD9177) || defined(SDIW624) || \ + defined(SDAW693) || defined(SDIW615) if (IS_SD9097(pmadapter->card_type) || IS_SDIW624(pmadapter->card_type) || IS_SDAW693(pmadapter->card_type) || @@ -2444,6 +2457,12 @@ mlan_status wlan_get_sdio_device(pmlan_adapter pmadapter) pmadapter->pcard_info = &mlan_card_info_sdiw624; break; #endif +#ifdef SDAW693 + case CARD_TYPE_SDAW693: + pmadapter->pcard_sd->reg = &mlan_reg_sd8977_sd8997; + pmadapter->pcard_info = &mlan_card_info_sdaw693; + break; +#endif #ifdef SDIW615 case CARD_TYPE_SDIW615: pmadapter->pcard_sd->reg = &mlan_reg_sd8977_sd8997; @@ -2472,7 +2491,7 @@ mlan_status wlan_get_sdio_device(pmlan_adapter pmadapter) * @param pmadapter A pointer to mlan_adapter structure * @return N/A */ -void wlan_dump_mp_registers(pmlan_adapter pmadapter) +static void wlan_dump_mp_registers(pmlan_adapter pmadapter) { t_u32 mp_wr_bitmap; t_bool new_mode = pmadapter->pcard_sd->supports_sdio_new_mode; @@ -3066,8 +3085,8 @@ exit: } #if defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ - defined(SD9177) || defined(SD8997) || defined(SD8987) || \ - defined(SD8978) || defined(SDIW615) + defined(SDAW693) || defined(SD9177) || defined(SD8997) || \ + defined(SD8987) || defined(SD8978) || defined(SDIW615) /** * @brief This function sends vdll data to the card. * @@ -3129,8 +3148,8 @@ static mlan_status wlan_sdio_host_to_card_ext(pmlan_private pmpriv, t_u8 type, mlan_adapter *pmadapter = pmpriv->adapter; #if defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ - defined(SD9177) || defined(SD8997) || defined(SD8987) || \ - defined(SD8978) || defined(SDIW615) + defined(SDAW693) || defined(SD9177) || defined(SD8997) || \ + defined(SD8987) || defined(SD8978) || defined(SDIW615) if (type == MLAN_TYPE_VDLL) return wlan_sdio_send_vdll(pmadapter, pmbuf); #endif @@ -3613,7 +3632,8 @@ mlan_status wlan_reset_fw(pmlan_adapter pmadapter) } #if defined(SD8997) || defined(SD8977) || defined(SD8987) || \ defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ - defined(SD8978) || defined(SD9177) || defined(SDIW615) + defined(SDAW693) || defined(SD8978) || defined(SD9177) || \ + defined(SDIW615) if (MFALSE #ifdef SD8997 || IS_SD8997(pmadapter->card_type) @@ -3636,6 +3656,9 @@ mlan_status wlan_reset_fw(pmlan_adapter pmadapter) #ifdef SDIW624 || IS_SDIW624(pmadapter->card_type) #endif +#ifdef SDAW693 + || IS_SDAW693(pmadapter->card_type) +#endif #ifdef SDIW615 || IS_SDIW615(pmadapter->card_type) #endif diff --git a/mxm_wifiex/wlan_src/mlan/mlan_shim.c b/mxm_wifiex/wlan_src/mlan/mlan_shim.c index 5071576..b10dcb2 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_shim.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_shim.c @@ -1041,6 +1041,8 @@ mlan_status mlan_rx_process(t_void *padapter, t_u8 *rx_pkts) pcb->moal_spin_lock(pmadapter->pmoal_handle, pmadapter->prx_proc_lock); if (pmadapter->mlan_rx_processing || pmadapter->rx_lock_flag) { pmadapter->more_rx_task_flag = MTRUE; + if (rx_pkts) + *rx_pkts = 0; pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->prx_proc_lock); goto exit_rx_proc; @@ -1092,14 +1094,16 @@ rx_process_start: goto rx_process_start; } - if (pmadapter->delay_task_flag && + if (!IS_PCIE(pmadapter->card_type) && + pmadapter->delay_task_flag && (pmadapter->rx_pkts_queued < LOW_RX_PENDING)) { PRINTM(MEVENT, "Run\n"); pmadapter->delay_task_flag = MFALSE; mlan_queue_main_work(pmadapter); } #ifdef PCIE - if (pmadapter->delay_rx_data_flag && + if (IS_PCIE(pmadapter->card_type) && + pmadapter->delay_rx_data_flag && (pmadapter->rx_pkts_queued < LOW_RX_PENDING)) { PRINTM(MEVENT, "Run\n"); pmadapter->delay_rx_data_flag = MFALSE; @@ -1180,7 +1184,7 @@ process_start: pmadapter->pending_disconnect_priv = MNULL; } #if defined(SDIO) - if (!IS_USB(pmadapter->card_type)) { + if (IS_SD(pmadapter->card_type)) { if (pmadapter->rx_pkts_queued > HIGH_RX_PENDING) { pcb->moal_tp_accounting_rx_param( pmadapter->pmoal_handle, 2, 0); @@ -1458,19 +1462,23 @@ mlan_status mlan_send_packet(t_void *padapter, pmlan_buffer pmbuf) mlan_ntohs(*(t_u16 *)&pmbuf->pbuf[pmbuf->data_offset + MLAN_ETHER_PKT_TYPE_OFFSET]); +#ifdef UAP_SUPPORT /** Identify ICMP packet from ETH_IP packet. ICMP packet in IP header * Protocol field is 0x01 */ /** Enable the ICMP_VIA_BYPASS_TXQ only if wacp_mode is enabled */ if ((pmadapter->init_para.wacp_mode) && - (pmpriv->bss_role == MLAN_BSS_ROLE_UAP && + ((pmpriv->bss_role == MLAN_BSS_ROLE_UAP) && pmpriv->uap_bss_started)) { if (eth_type == MLAN_ETHER_PKT_TYPE_IP) { ip_protocol = *((t_u8 *)(pmbuf->pbuf + pmbuf->data_offset + MLAN_ETHER_PKT_TYPE_OFFSET + MLAN_IP_PROTOCOL_OFFSET)); + if (ip_protocol == MLAN_IP_PROTOCOL_ICMP) + pmbuf->priority = WMM_HIGHEST_PRIORITY; } } +#endif if ((eth_type == MLAN_ETHER_PKT_TYPE_EAPOL) || (eth_type == MLAN_ETHER_PKT_TYPE_ARP) || diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c index af5286e..8d65019 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c @@ -5,7 +5,7 @@ * it is ready. * * - * Copyright 2008-2023 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -406,9 +406,11 @@ static mlan_status wlan_cmd_mfg_tx_frame(pmlan_private pmpriv, mcmd->short_preamble = wlan_cpu_to_le32(cfg->short_preamble); mcmd->act_sub_ch = wlan_cpu_to_le32(cfg->act_sub_ch); mcmd->short_gi = wlan_cpu_to_le32(cfg->short_gi); + mcmd->adv_coding = wlan_cpu_to_le32(cfg->adv_coding); mcmd->tx_bf = wlan_cpu_to_le32(cfg->tx_bf); mcmd->gf_mode = wlan_cpu_to_le32(cfg->gf_mode); mcmd->stbc = wlan_cpu_to_le32(cfg->stbc); + mcmd->signal_bw = wlan_cpu_to_le32(cfg->signal_bw); mcmd->NumPkt = wlan_cpu_to_le32(cfg->NumPkt); mcmd->MaxPE = wlan_cpu_to_le32(cfg->MaxPE); mcmd->BeamChange = wlan_cpu_to_le32(cfg->BeamChange); @@ -484,8 +486,9 @@ static mlan_status wlan_cmd_mfg_config_trigger_frame(pmlan_private pmpriv, * @return MLAN_STATUS_SUCCESS */ -mlan_status wlan_cmd_mfg_he_tb_tx(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 action, t_void *pdata_buf) +static mlan_status wlan_cmd_mfg_he_tb_tx(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 action, + t_void *pdata_buf) { struct mfg_Cmd_HE_TBTx_t *mcmd = (struct mfg_Cmd_HE_TBTx_t *)&cmd->params.mfg_he_power; @@ -520,8 +523,9 @@ mlan_status wlan_cmd_mfg_he_tb_tx(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, * @return MLAN_STATUS_SUCCESS */ -mlan_status wlan_cmd_mfg_otp_rw(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 action, t_void *pdata_buf) +static mlan_status wlan_cmd_mfg_otp_rw(pmlan_private pmpriv, + HostCmd_DS_COMMAND *cmd, t_u16 action, + t_void *pdata_buf) { mfg_cmd_otp_mac_addr_rd_wr_t *mcmd = (mfg_cmd_otp_mac_addr_rd_wr_t *)&cmd->params @@ -2960,9 +2964,9 @@ mlan_status wlan_cmd_arb_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, * @return N/A */ -mlan_status wlan_cmd_ipv6_ra_offload(mlan_private *pmpriv, - HostCmd_DS_COMMAND *pcmd, t_u16 cmd_action, - void *pdata_buf) +static mlan_status wlan_cmd_ipv6_ra_offload(mlan_private *pmpriv, + HostCmd_DS_COMMAND *pcmd, + t_u16 cmd_action, void *pdata_buf) { HostCmd_DS_IPV6_RA_OFFLOAD *ipv6_ra_cfg = &pcmd->params.ipv6_ra_offload; mlan_ds_misc_ipv6_ra_offload *ipv6_ra_offload = diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c index 2a22f4b..ec91dc1 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c @@ -4,7 +4,7 @@ * responses generated by firmware. * * - * Copyright 2008-2023 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -2505,9 +2505,9 @@ mlan_status wlan_ret_arb_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, * * @return MLAN_STATUS_SUCCESS */ -mlan_status wlan_ret_ipv6_ra_offload(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) +static mlan_status wlan_ret_ipv6_ra_offload(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) { HostCmd_DS_IPV6_RA_OFFLOAD *ipv6_ra_resp = &resp->params.ipv6_ra_offload; @@ -2897,9 +2897,11 @@ static mlan_status wlan_ret_mfg_tx_frame(pmlan_private pmpriv, cfg->short_preamble = wlan_le32_to_cpu(mcmd->short_preamble); cfg->act_sub_ch = wlan_le32_to_cpu(mcmd->act_sub_ch); cfg->short_gi = wlan_le32_to_cpu(mcmd->short_gi); + cfg->adv_coding = wlan_le32_to_cpu(mcmd->adv_coding); cfg->tx_bf = wlan_le32_to_cpu(mcmd->tx_bf); cfg->gf_mode = wlan_le32_to_cpu(mcmd->gf_mode); cfg->stbc = wlan_le32_to_cpu(mcmd->stbc); + cfg->signal_bw = wlan_le32_to_cpu(mcmd->signal_bw); cfg->NumPkt = wlan_le32_to_cpu(mcmd->NumPkt); cfg->MaxPE = wlan_le32_to_cpu(mcmd->MaxPE); cfg->BeamChange = wlan_le32_to_cpu(mcmd->BeamChange); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c index 4096fe9..54f4195 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c @@ -737,6 +737,7 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) ENTER(); if (!pmbuf) { + PRINTM(MERROR, "ERR:event buffer is null\n"); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -744,6 +745,8 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) /* Event length check */ if ((pmbuf->data_len - sizeof(eventcause)) > MAX_EVENT_SIZE) { pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID; + PRINTM(MERROR, "ERR:event buffer len invalid=%d\n", + pmbuf->data_len); LEAVE(); return MLAN_STATUS_FAILURE; } @@ -946,7 +949,7 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) (pmbuf->pbuf + pmbuf->data_offset + sizeof(eventcause)); memcpy_ext(pmpriv->adapter, pmpriv->assoc_req_buf, evt_buf, pmbuf->data_len - sizeof(eventcause), - MRVDRV_ASSOC_RSP_BUF_SIZE); + ASSOC_RSP_BUF_SIZE); break; case EVENT_FW_DEBUG_INFO: diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c index f6f9a0b..d681caa 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c @@ -3,7 +3,7 @@ * @brief This file contains the functions for station ioctl. * * - * Copyright 2008-2023 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -2509,8 +2509,15 @@ static mlan_status wlan_sec_ioctl_auth_mode(pmlan_adapter pmadapter, sec = (mlan_ds_sec_cfg *)pioctl_req->pbuf; if (pioctl_req->action == MLAN_ACT_GET) sec->param.auth_mode = pmpriv->sec_info.authentication_mode; - else + else { pmpriv->sec_info.authentication_mode = sec->param.auth_mode; + if (pmpriv->sec_info.authentication_mode == + MLAN_AUTH_MODE_OWE) { + /* set ewpa_query to TRUE for OWE to set ewpa_enabled + * flag later */ + pmpriv->ewpa_query = MTRUE; + } + } pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; LEAVE(); @@ -4580,8 +4587,8 @@ static mlan_status wlan_misc_ioctl_ips_cfg(pmlan_adapter pmadapter, * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status wlan_misc_ioctl_ipv6_ra_offload(pmlan_adapter pmadapter, - mlan_ioctl_req *pioctl_req) +static mlan_status wlan_misc_ioctl_ipv6_ra_offload(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req) { pmlan_private pmpriv = pmadapter->priv[pioctl_req->bss_index]; mlan_ds_misc_cfg *misc = MNULL; @@ -5447,7 +5454,8 @@ mlan_status wlan_set_ewpa_mode(mlan_private *priv, mlan_ds_passphrase *psec_pp) if ((psec_pp->psk_type == MLAN_PSK_PASSPHRASE && psec_pp->psk.passphrase.passphrase_len > 0) || - (psec_pp->psk_type == MLAN_PSK_PMK)) + (psec_pp->psk_type == MLAN_PSK_PMK) || + priv->sec_info.authentication_mode == MLAN_AUTH_MODE_OWE) priv->sec_info.ewpa_enabled = MTRUE; else priv->sec_info.ewpa_enabled = MFALSE; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c index 4c2f4d7..e12a4fc 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c @@ -890,8 +890,12 @@ mlan_status wlan_ops_sta_process_rx_packet(t_void *adapter, pmlan_buffer pmbuf) */ if ((!IS_11N_ENABLED(priv) && !(prx_pd->flags & RXPD_FLAG_PKT_DIRECT_LINK)) || - memcmp(priv->adapter, priv->curr_addr, - prx_pkt->eth803_hdr.dest_addr, MLAN_MAC_ADDR_LENGTH)) { + (memcmp(priv->adapter, priv->curr_addr, + prx_pkt->eth803_hdr.dest_addr, MLAN_MAC_ADDR_LENGTH) && + !(prx_pd->flags & RXPD_FLAG_PKT_EASYMESH)) || + ((prx_pd->flags & RXPD_FLAG_PKT_EASYMESH) && + (is_bcast_addr(prx_pkt->eth803_hdr.dest_addr) || + is_mcast_addr(prx_pkt->eth803_hdr.dest_addr)))) { priv->snr = prx_pd->snr; priv->nf = prx_pd->nf; wlan_process_rx_packet(pmadapter, pmbuf); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_txrx.c b/mxm_wifiex/wlan_src/mlan/mlan_txrx.c index 5806eff..fbb966f 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_txrx.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_txrx.c @@ -4,7 +4,7 @@ * @brief This file contains the handling of TX/RX in MLAN * * - * Copyright 2009-2021 NXP + * Copyright 2009-2021, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -108,8 +108,8 @@ t_u8 mcast_drv_update_allow_flag = MTRUE; * * @return Nothing */ -void wlan_drv_mcast_cycle_delay_calulation(pmlan_adapter pmadapter, - pmlan_buffer pmbuf) +static void wlan_drv_mcast_cycle_delay_calulation(pmlan_adapter pmadapter, + pmlan_buffer pmbuf) { static t_u32 prev_mcast_sec = 0; static t_u32 prev_mcast_usec = 0; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c index 4c72e9d..242de00 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c @@ -722,7 +722,8 @@ static mlan_status wlan_uap_cmd_ap_config(pmlan_private pmpriv, t_u16 ac; #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) int rx_mcs_supp = 0; #endif @@ -1335,7 +1336,8 @@ static mlan_status wlan_uap_cmd_ap_config(pmlan_private pmpriv, sizeof(tlv_htcap->ht_cap.supported_mcs_set)); #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmpriv->adapter->card_type) || IS_CARDIW624(pmpriv->adapter->card_type) || IS_CARD9097(pmpriv->adapter->card_type) || @@ -5628,12 +5630,15 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) ENTER(); if (!pmbuf) { + PRINTM(MERROR, "ERR:event buffer is null\n"); LEAVE(); return MLAN_STATUS_FAILURE; } /* Event length check */ if (pmbuf && (pmbuf->data_len - sizeof(eventcause)) > MAX_EVENT_SIZE) { pmbuf->status_code = MLAN_ERROR_PKT_SIZE_INVALID; + PRINTM(MERROR, "ERR:event buffer len invalid=%d\n", + pmbuf->data_len); LEAVE(); return MLAN_STATUS_FAILURE; } diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c index cd7253d..37ec238 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c @@ -3,7 +3,7 @@ * @brief This file contains the handling of AP mode ioctls * * - * Copyright 2009-2023 NXP + * Copyright 2009-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -2347,6 +2347,8 @@ mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) pioctl_req); if (misc->sub_command == MLAN_OID_MISC_CSI) status = wlan_misc_csi(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_MULTI_AP_CFG) + status = wlan_misc_multi_ap_cfg(pmadapter, pioctl_req); break; case MLAN_IOCTL_POWER_CFG: power = (mlan_ds_power_cfg *)pioctl_req->pbuf; diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h index 3386669..0760357 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h @@ -396,7 +396,7 @@ typedef t_u8 mlan_802_11_mac_addr[MLAN_MAC_ADDR_LENGTH]; /** Black bird card type */ #define CARD_TYPE_AW693 0x0c /** IW615 card type */ -#define CARD_TYPE_IW615 0x0c +#define CARD_TYPE_IW615 0x0d /** 9098 A0 reverion num */ #define CHIP_9098_REV_A0 1 @@ -667,6 +667,7 @@ typedef enum { #define MEVT_D MBIT(18) #define MFW_D MBIT(19) #define MIF_D MBIT(20) +#define MFWDP_D MBIT(21) #define MENTRY MBIT(28) #define MWARN MBIT(29) diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h index 8153a98..252a7de 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h @@ -739,7 +739,7 @@ typedef struct _mlan_chan_list { #define CHAN_FLAGS_MAX MBIT(31) /** Maximum response buffer length */ -#define ASSOC_RSP_BUF_SIZE 500 +#define ASSOC_RSP_BUF_SIZE 2060 /** Type definition of mlan_ds_misc_assoc_rsp for MLAN_OID_MISC_ASSOC_RSP */ typedef struct _mlan_ds_misc_assoc_rsp { @@ -4025,6 +4025,7 @@ typedef struct _mlan_ds_11ax_cfg { #define MLAN_11AX_TWT_SETUP_SUBID 0x114 #define MLAN_11AX_TWT_TEARDOWN_SUBID 0x115 #define MLAN_11AX_TWT_REPORT_SUBID 0x116 +#define MLAN_11AX_TWT_INFORMATION_SUBID 0x119 #define MRVL_DOT11AX_ENABLE_SR_TLV_ID (PROPRIETARY_TLV_BASE_ID + 322) #define MRVL_DOT11AX_OBSS_PD_OFFSET_TLV_ID (PROPRIETARY_TLV_BASE_ID + 323) @@ -4202,6 +4203,18 @@ typedef MLAN_PACK_START struct _mlan_ds_twt_report { t_u8 data[36]; } MLAN_PACK_END mlan_ds_twt_report, *pmlan_ds_twt_report; +/** Type definition of mlan_ds_twt_information for MLAN_OID_11AX_TWT_CFG */ +typedef struct MLAN_PACK_START _mlan_ds_twt_information { + /** TWT Flow Identifier. Range: [0-7] */ + t_u8 flow_identifier; + /** Suspend Duration. Range: [0-UINT32_MAX] + * 0:Suspend forever; + * Else:Suspend agreement for specific duration in milli seconds, + * after than resume the agreement and enter SP immediately + */ + t_u32 suspend_duration; +} MLAN_PACK_END mlan_ds_twt_information, *pmlan_ds_twt_information; + /** Type definition of mlan_ds_twtcfg for MLAN_OID_11AX_TWT_CFG */ typedef struct MLAN_PACK_START _mlan_ds_twtcfg { /** Sub-command */ @@ -4217,6 +4230,10 @@ typedef struct MLAN_PACK_START _mlan_ds_twtcfg { mlan_ds_twt_teardown twt_teardown; /** TWT report for Sub ID: MLAN_11AX_TWT_REPORT_SUBID */ mlan_ds_twt_report twt_report; + /** TWT Information config for Sub ID: + * MLAN_11AX_TWT_INFORMATION_SUBID + */ + mlan_ds_twt_information twt_information; } param; } MLAN_PACK_END mlan_ds_twtcfg, *pmlan_ds_twtcfg; @@ -4296,14 +4313,16 @@ enum _mlan_reg_type { MLAN_REG_BCA = 7, #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) || \ - defined(SD9177) || defined(SDIW615) || defined(USBIW615) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) || defined(SD9177) || \ + defined(SDIW615) || defined(USBIW615) MLAN_REG_CIU = 8, #endif #if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ - defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) || \ - defined(SDIW615) || defined(USBIW615) + defined(SDAW693) || defined(PCIEAW693) || defined(PCIEIW624) || \ + defined(USBIW624) || defined(SD9097) || defined(SDIW615) || \ + defined(USBIW615) MLAN_REG_MAC2 = 0x81, MLAN_REG_BBP2 = 0x82, MLAN_REG_RF2 = 0x83, @@ -5083,7 +5102,7 @@ typedef MLAN_PACK_START struct _mlan_ds_drcs_cfg { /** Channel swith time (in TU) for chan_idx */ t_u8 switchtime; /** Undoze time (in TU) for chan_idx */ - t_u8 undozetime; + t_u8 rx_wait_time; /** Rx traffic control scheme when channel switch*/ /** only valid for GC/STA interface*/ t_u8 mode; @@ -5844,7 +5863,9 @@ struct MLAN_PACK_START mfg_cmd_tx_frame2 { /** STBC */ t_u32 stbc; /** power id */ - t_u32 rsvd[2]; + t_u32 rsvd[1]; + /**signal bw*/ + t_u32 signal_bw; /** NumPkt */ t_u32 NumPkt; /** MaxPE */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c index 9d84955..a9e8b45 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c @@ -3,7 +3,7 @@ * @brief This file contains the functions for CFG80211. * * - * Copyright 2011-2023 NXP + * Copyright 2011-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -206,8 +206,8 @@ void *woal_get_netdev_priv(struct net_device *dev) * * @return radio_type */ -struct ieee80211_channel *woal_get_ieee80211_channel(moal_private *priv, - chan_band_info *pchan_info) +static struct ieee80211_channel * +woal_get_ieee80211_channel(moal_private *priv, chan_band_info *pchan_info) { enum ieee80211_band band = IEEE80211_BAND_2GHZ; int freq = 0; @@ -2627,38 +2627,6 @@ void woal_cfg80211_mgmt_frame_register(struct wiphy *wiphy, LEAVE(); } -#ifdef UAP_CFG80211 -#if KERNEL_VERSION(3, 12, 0) <= CFG80211_VERSION_CODE -/* - * @brief prepare and send WOAL_EVENT_CANCEL_CHANRPT - * - * @param priv A pointer moal_private structure - * - * @return N/A - */ -void woal_cancel_chanrpt_event(moal_private *priv) -{ - struct woal_event *evt; - unsigned long flags; - moal_handle *handle = priv->phandle; - - evt = kzalloc(sizeof(struct woal_event), GFP_ATOMIC); - if (!evt) { - PRINTM(MERROR, "Fail to alloc memory for deauth event\n"); - LEAVE(); - return; - } - evt->priv = priv; - evt->type = WOAL_EVENT_CANCEL_CHANRPT; - INIT_LIST_HEAD(&evt->link); - spin_lock_irqsave(&handle->evt_lock, flags); - list_add_tail(&evt->link, &handle->evt_queue); - spin_unlock_irqrestore(&handle->evt_lock, flags); - queue_work(handle->evt_workqueue, &handle->evt_work); -} -#endif -#endif - #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) /* * @brief check if we need set remain_on_channel @@ -2668,9 +2636,9 @@ void woal_cancel_chanrpt_event(moal_private *priv) * * @return MFALSE-no need set remain_on_channel */ -t_u8 woal_check_mgmt_tx_channel(moal_private *priv, - struct ieee80211_channel *chan, - unsigned int wait) +static t_u8 woal_check_mgmt_tx_channel(moal_private *priv, + struct ieee80211_channel *chan, + unsigned int wait) { int freq; if (priv->bss_type == MLAN_BSS_TYPE_UAP) @@ -2696,8 +2664,9 @@ t_u8 woal_check_mgmt_tx_channel(moal_private *priv, * * @return 0 -- success, otherwise fail */ -int woal_mgmt_tx(moal_private *priv, const u8 *buf, size_t len, - struct ieee80211_channel *chan, u64 cookie, unsigned int wait) +static int woal_mgmt_tx(moal_private *priv, const u8 *buf, size_t len, + struct ieee80211_channel *chan, u64 cookie, + unsigned int wait) { int ret = 0; pmlan_buffer pmbuf = NULL; @@ -5198,7 +5167,9 @@ void woal_cfg80211_notify_channel(moal_private *priv, #if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE if (MLAN_STATUS_SUCCESS == woal_chandef_create(priv, &chandef, pchan_info)) { -#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(6, 7, 0) <= CFG80211_VERSION_CODE + wiphy_lock(priv->wdev->wiphy); +#elif KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE mutex_lock(&priv->wdev->mtx); #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) @@ -5211,7 +5182,9 @@ void woal_cfg80211_notify_channel(moal_private *priv, #else cfg80211_ch_switch_notify(priv->netdev, &chandef); #endif -#if KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(6, 7, 0) <= CFG80211_VERSION_CODE + wiphy_unlock(priv->wdev->wiphy); +#elif KERNEL_VERSION(3, 14, 0) <= CFG80211_VERSION_CODE mutex_unlock(&priv->wdev->mtx); #endif priv->channel = pchan_info->channel; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h index 1eff8a2..29a7674 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h @@ -3,7 +3,7 @@ * @brief This file contains the CFG80211 specific defines. * * - * Copyright 2011-2022 NXP + * Copyright 2011-2022, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -431,7 +431,13 @@ int woal_cfg80211_set_coalesce(struct wiphy *wiphy, struct cfg80211_coalesce *coalesce); #endif -#if KERNEL_VERSION(3, 4, 0) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(6, 7, 0) <= CFG80211_VERSION_CODE +int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_settings *params); + +int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_update *info); +#elif KERNEL_VERSION(3, 4, 0) <= CFG80211_VERSION_CODE int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_ap_settings *params); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c index 32ed3fc..d181f60 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c @@ -3,7 +3,7 @@ * @brief This file contains the functions for CFG80211 vendor. * * - * Copyright 2015-2022 NXP + * Copyright 2015-2022, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -1142,7 +1142,7 @@ done: * * @return An invalid ring id for failure or valid ring id on success. */ -int woal_get_ring_id_by_name(moal_private *priv, char *ring_name) +static int woal_get_ring_id_by_name(moal_private *priv, char *ring_name) { int id; wifi_ring_buffer *ring; @@ -1172,8 +1172,9 @@ int woal_get_ring_id_by_name(moal_private *priv, char *ring_name) * * @return 0: success 1: fail */ -int woal_start_logging(moal_private *priv, char *ring_name, int log_level, - int flags, int time_intval, int threshold) +static int woal_start_logging(moal_private *priv, char *ring_name, + int log_level, int flags, int time_intval, + int threshold) { int ret = 0; int ring_id; @@ -1452,8 +1453,8 @@ static t_u32 woal_get_ring_next_entry(wifi_ring_buffer *ring, t_u32 offset) * * @return data length */ -int woal_ring_pull_data(moal_private *priv, int ring_id, void *data, - t_s32 buf_len) +static int woal_ring_pull_data(moal_private *priv, int ring_id, void *data, + t_s32 buf_len) { t_s32 r_len = 0; wifi_ring_buffer *ring; @@ -1499,9 +1500,10 @@ int woal_ring_pull_data(moal_private *priv, int ring_id, void *data, * * @return 0: success 1: fail */ -int woal_ring_buffer_data_vendor_event(moal_private *priv, int ring_id, - t_u8 *data, int len, - wifi_ring_buffer_status *ring_status) +static int +woal_ring_buffer_data_vendor_event(moal_private *priv, int ring_id, t_u8 *data, + int len, + wifi_ring_buffer_status *ring_status) { struct wiphy *wiphy = NULL; struct sk_buff *skb = NULL; @@ -1588,7 +1590,7 @@ done: * * @return void */ -void woal_ring_poll_worker(struct work_struct *work) +static void woal_ring_poll_worker(struct work_struct *work) { struct delayed_work *d_work = to_delayed_work(work); wifi_ring_buffer *ring_info = @@ -1659,8 +1661,8 @@ exit: * * @return 0: success -1: fail */ -int woal_ring_push_data(moal_private *priv, int ring_id, - wifi_ring_buffer_entry *hdr, void *data) +static int woal_ring_push_data(moal_private *priv, int ring_id, + wifi_ring_buffer_entry *hdr, void *data) { unsigned long flags; t_u32 w_len; @@ -2073,8 +2075,8 @@ done: * * @return 0: success 1: fail */ -int woal_wake_reason_vendor_event(moal_private *priv, - mlan_ds_hs_wakeup_reason wake_reason) +static int woal_wake_reason_vendor_event(moal_private *priv, + mlan_ds_hs_wakeup_reason wake_reason) { struct wiphy *wiphy = NULL; struct sk_buff *skb = NULL; @@ -2166,9 +2168,8 @@ woal_cfg80211_subcmd_start_packet_fate_monitor(struct wiphy *wiphy, t_u32 reply_len = 0; int ret = 0; - /* TODO: Tune pkt fate monitor for TP, Disabling it for now */ - // struct net_device *dev = wdev->netdev; - // moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); + struct net_device *dev = wdev->netdev; + moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); ENTER(); @@ -2180,8 +2181,9 @@ woal_cfg80211_subcmd_start_packet_fate_monitor(struct wiphy *wiphy, goto done; } - /* TODO: Tune pkt fate monitor for TP, Disabling it for now */ - // priv->pkt_fate_monitor_enable = MTRUE; + /* Enable pkt fate monitor and use drvdbg MDAT_D to control forwarding + * data packet to kernel */ + priv->pkt_fate_monitor_enable = MTRUE; ret = cfg80211_vendor_cmd_reply(skb); @@ -2206,10 +2208,11 @@ done: * * @return 0: success 1: fail */ -int woal_packet_fate_vendor_event(moal_private *priv, - packet_fate_packet_type pkt_type, t_u8 fate, - frame_type payload_type, t_u32 drv_ts_usec, - t_u32 fw_ts_usec, t_u8 *data, t_u32 len) +static int woal_packet_fate_vendor_event(moal_private *priv, + packet_fate_packet_type pkt_type, + t_u8 fate, frame_type payload_type, + t_u32 drv_ts_usec, t_u32 fw_ts_usec, + t_u8 *data, t_u32 len) { struct wiphy *wiphy = NULL; struct sk_buff *skb = NULL; @@ -2529,8 +2532,9 @@ done: * @return non-zero if packet should be passed to AP, zero if * packet should be dropped. */ -int process_packet(const t_u8 *program, t_u32 program_len, const t_u8 *packet, - t_u32 packet_len, t_u32 filter_age) +static int process_packet(const t_u8 *program, t_u32 program_len, + const t_u8 *packet, t_u32 packet_len, + t_u32 filter_age) { /* Program counter */ t_u32 pc = 0; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c index b899631..dda746c 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c @@ -4,7 +4,7 @@ * @brief This file contains private ioctl functions * - * Copyright 2014-2023 NXP + * Copyright 2014-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -4076,7 +4076,7 @@ done: static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen, t_u8 bBSSID) { - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; moal_handle *handle = priv->phandle; int ret = 0; int header_len = 0; @@ -4102,7 +4102,12 @@ static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, copy_len = strlen(respbuf) - header_len; buflen = MIN(copy_len, (int)(sizeof(buf) - 1)); memset(buf, 0, sizeof(buf)); - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + LEAVE(); + return -ENOMEM; + } moal_memcpy_ext(handle, buf, respbuf + header_len, buflen, sizeof(buf)); priv->assoc_with_mac = MFALSE; @@ -4124,7 +4129,7 @@ static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, if (buf[i] == ':') { mac_idx++; } else { - ssid_bssid.bssid[mac_idx] = + ssid_bssid->bssid[mac_idx] = (t_u8)woal_atox(buf + i); while ((i < buflen) && isxdigit(buf[i + 1])) /* Skip entire hex value */ @@ -4134,32 +4139,32 @@ static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, /* Skip one space between the BSSID and start of the SSID */ i++; PRINTM(MMSG, "Trying to associate AP BSSID = [" MACSTR "]\n", - MAC2STR(ssid_bssid.bssid)); + MAC2STR(ssid_bssid->bssid)); priv->assoc_with_mac = MTRUE; } - ssid_bssid.ssid.ssid_len = buflen - i; + ssid_bssid->ssid.ssid_len = buflen - i; /* Check the size of the ssid_len */ - if (ssid_bssid.ssid.ssid_len > MLAN_MAX_SSID_LENGTH + 1) { - PRINTM(MERROR, "ssid_bssid.ssid.ssid_len = %d\n", - ssid_bssid.ssid.ssid_len); + if (ssid_bssid->ssid.ssid_len > MLAN_MAX_SSID_LENGTH + 1) { + PRINTM(MERROR, "ssid_bssid->ssid.ssid_len = %d\n", + ssid_bssid->ssid.ssid_len); ret = -E2BIG; goto setessid_ret; } /* Copy the SSID */ - moal_memcpy_ext(handle, ssid_bssid.ssid.ssid, buf + i, - ssid_bssid.ssid.ssid_len, MLAN_MAX_SSID_LENGTH); + moal_memcpy_ext(handle, ssid_bssid->ssid.ssid, buf + i, + ssid_bssid->ssid.ssid_len, MLAN_MAX_SSID_LENGTH); - if (!ssid_bssid.ssid.ssid_len || - (MFALSE == woal_ssid_valid(&ssid_bssid.ssid))) { + if (!ssid_bssid->ssid.ssid_len || + (MFALSE == woal_ssid_valid(&ssid_bssid->ssid))) { PRINTM(MERROR, "Invalid SSID - aborting set_essid\n"); ret = -EINVAL; goto setessid_ret; } PRINTM(MMSG, "Trying to associate AP SSID = %s\n", - (char *)ssid_bssid.ssid.ssid); + (char *)ssid_bssid->ssid.ssid); /* Cancel re-association */ priv->reassoc_required = MFALSE; @@ -4174,14 +4179,14 @@ static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) woal_set_scan_type(priv, MLAN_SCAN_TYPE_ACTIVE); - if (MTRUE == woal_is_connected(priv, &ssid_bssid)) { + if (MTRUE == woal_is_connected(priv, ssid_bssid)) { PRINTM(MIOCTL, "Already connect to the network\n"); ret = snprintf(respbuf, CMD_BUF_LEN, "Has already connected to this ESSID!\n") + 1; goto setessid_ret; } - moal_memcpy_ext(handle, &priv->prev_ssid_bssid, &ssid_bssid, + moal_memcpy_ext(handle, &priv->prev_ssid_bssid, ssid_bssid, sizeof(mlan_ssid_bssid), sizeof(mlan_ssid_bssid)); priv->auto_assoc_priv.drv_reconnect.status = MFALSE; priv->auto_assoc_priv.auto_assoc_trigger_flag = @@ -4199,6 +4204,7 @@ static int woal_priv_assocessid(moal_private *priv, t_u8 *respbuf, ret = snprintf(respbuf, CMD_BUF_LEN, "%s\n", buf) + 1; setessid_ret: + kfree(ssid_bssid); if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) woal_set_scan_type(priv, MLAN_SCAN_TYPE_PASSIVE); MOAL_REL_SEMAPHORE(&handle->reassoc_sem); @@ -5679,7 +5685,7 @@ static int woal_priv_set_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) t_u8 *data_ptr; const t_u8 bcast[MLAN_MAC_ADDR_LENGTH] = {255, 255, 255, 255, 255, 255}; const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; mlan_bss_info bss_info; struct mwreq *mwr; struct sockaddr *awrq; @@ -5717,8 +5723,12 @@ static int woal_priv_set_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) goto done; } - /* Broadcast MAC means search for best network */ - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + ret = -ENOMEM; + goto done; + } if (memcmp(bcast, awrq->sa_data, MLAN_MAC_ADDR_LENGTH)) { /* Check if we are already assoicated to the AP */ @@ -5726,21 +5736,22 @@ static int woal_priv_set_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) if (!memcmp(awrq->sa_data, &bss_info.bssid, ETH_ALEN)) goto done; } - moal_memcpy_ext(priv->phandle, &ssid_bssid.bssid, awrq->sa_data, - ETH_ALEN, sizeof(mlan_802_11_mac_addr)); + moal_memcpy_ext(priv->phandle, &ssid_bssid->bssid, + awrq->sa_data, ETH_ALEN, + sizeof(mlan_802_11_mac_addr)); } if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_find_best_network(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { PRINTM(MERROR, "ASSOC: WAP: MAC address not found in BSSID List\n"); ret = -ENETUNREACH; goto done; } /* Zero SSID implies use BSSID to connect */ - memset(&ssid_bssid.ssid, 0, sizeof(mlan_802_11_ssid)); + memset(&ssid_bssid->ssid, 0, sizeof(mlan_802_11_ssid)); if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { ret = -EFAULT; goto done; } @@ -5761,6 +5772,8 @@ static int woal_priv_set_ap(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) #endif /* REASSOCIATION */ done: + if (ssid_bssid) + kfree(ssid_bssid); LEAVE(); return ret; } @@ -5879,7 +5892,7 @@ static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, t_u32 respbuflen) { mlan_802_11_ssid req_ssid; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; moal_handle *handle = priv->phandle; #ifdef REASSOCIATION mlan_bss_info bss_info; @@ -5914,7 +5927,13 @@ static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) woal_set_scan_type(priv, MLAN_SCAN_TYPE_ACTIVE); memset(&req_ssid, 0, sizeof(mlan_802_11_ssid)); - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + + ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + ret = -ENOMEM; + goto setessid_ret; + } req_ssid.ssid_len = mwr->u.essid.length; @@ -5948,10 +5967,10 @@ static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, PRINTM(MINFO, "Requested new SSID = %s\n", (char *)req_ssid.ssid); - moal_memcpy_ext(handle, &ssid_bssid.ssid, &req_ssid, + moal_memcpy_ext(handle, &ssid_bssid->ssid, &req_ssid, sizeof(mlan_802_11_ssid), sizeof(mlan_802_11_ssid)); - if (MTRUE == woal_is_connected(priv, &ssid_bssid)) { + if (MTRUE == woal_is_connected(priv, ssid_bssid)) { PRINTM(MIOCTL, "Already connect to the network\n"); goto setessid_ret; } @@ -5990,7 +6009,7 @@ static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, if (mwr->u.essid.flags != 0xFFFF) { if (MLAN_STATUS_SUCCESS != - woal_find_essid(priv, &ssid_bssid, + woal_find_essid(priv, ssid_bssid, MOAL_IOCTL_WAIT)) { /* Do specific SSID scanning */ if (MLAN_STATUS_SUCCESS != @@ -6007,24 +6026,23 @@ static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, if (mode != MW_MODE_ADHOC) { if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, MOAL_IOCTL_WAIT, - &ssid_bssid)) { + woal_find_best_network(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { ret = -EFAULT; goto setessid_ret; } } #ifdef UAP_SUPPORT else if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) + woal_find_best_network(priv, MOAL_IOCTL_WAIT, ssid_bssid)) /* Adhoc start, Check the channel command */ woal_11h_channel_check_ioctl(priv, MOAL_IOCTL_WAIT); #endif /* Connect to BSS by ESSID */ - memset(&ssid_bssid.bssid, 0, MLAN_MAC_ADDR_LENGTH); + memset(&ssid_bssid->bssid, 0, MLAN_MAC_ADDR_LENGTH); if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { ret = -EFAULT; goto setessid_ret; } @@ -6043,6 +6061,8 @@ static int woal_priv_set_essid(moal_private *priv, t_u8 *respbuf, #endif /* REASSOCIATION */ setessid_ret: + if (ssid_bssid) + kfree(ssid_bssid); if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) woal_set_scan_type(priv, MLAN_SCAN_TYPE_PASSIVE); #ifdef REASSOCIATION @@ -8691,7 +8711,7 @@ static int woal_priv_drcs_time_slicing_cfg(moal_private *priv, t_u8 *respbuf, drcs_cfg = (mlan_ds_drcs_cfg *)&cfg->param.drcs_cfg[0]; drcs_cfg->chantime = (t_u8)data[0]; drcs_cfg->switchtime = (t_u8)data[1]; - drcs_cfg->undozetime = (t_u8)data[2]; + drcs_cfg->rx_wait_time = (t_u8)data[2]; drcs_cfg->mode = (t_u8)data[3]; /* Set the same parameters for two channels*/ if (user_data_len < (int)ARRAY_SIZE(data)) @@ -8703,7 +8723,7 @@ static int woal_priv_drcs_time_slicing_cfg(moal_private *priv, t_u8 *respbuf, drcs_cfg->chan_idx = 0x2; drcs_cfg->chantime = (t_u8)data[4]; drcs_cfg->switchtime = (t_u8)data[5]; - drcs_cfg->undozetime = (t_u8)data[6]; + drcs_cfg->rx_wait_time = (t_u8)data[6]; drcs_cfg->mode = (t_u8)data[7]; } } @@ -13828,7 +13848,7 @@ static int woal_priv_associate_ssid_bssid(moal_private *priv, t_u8 *respbuf, { int ret = 0, copy_len = 0; int header_len = 0; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; #ifdef REASSOCIATION mlan_bss_info bss_info; #endif @@ -13849,7 +13869,12 @@ static int woal_priv_associate_ssid_bssid(moal_private *priv, t_u8 *respbuf, mac_idx = 0; buflen = MIN(copy_len, (int)(sizeof(buf) - 1)); memset(buf, 0, sizeof(buf)); - memset(&ssid_bssid, 0, sizeof(ssid_bssid)); + ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + ret = -ENOMEM; + goto done; + } if (buflen < (3 * ETH_ALEN) + 2) { PRINTM(MERROR, @@ -13874,7 +13899,7 @@ static int woal_priv_associate_ssid_bssid(moal_private *priv, t_u8 *respbuf, if (buf[i] == ':') { mac_idx++; } else { - ssid_bssid.bssid[mac_idx] = (t_u8)woal_atox(buf + i); + ssid_bssid->bssid[mac_idx] = (t_u8)woal_atox(buf + i); while (((i < buflen) && isxdigit(buf[i + 1]))) /* Skip entire hex value */ @@ -13886,17 +13911,17 @@ static int woal_priv_associate_ssid_bssid(moal_private *priv, t_u8 *respbuf, i++; /* Copy the SSID */ - ssid_bssid.ssid.ssid_len = buflen - i; - moal_memcpy_ext(priv->phandle, ssid_bssid.ssid.ssid, buf + i, - sizeof(ssid_bssid.ssid.ssid), - sizeof(ssid_bssid.ssid.ssid)); + ssid_bssid->ssid.ssid_len = buflen - i; + moal_memcpy_ext(priv->phandle, ssid_bssid->ssid.ssid, buf + i, + sizeof(ssid_bssid->ssid.ssid), + sizeof(ssid_bssid->ssid.ssid)); PRINTM(MCMND, "iwpriv assoc: AP=[" MACSTR "], ssid(%d)=[%s]\n", - MAC2STR(ssid_bssid.bssid), (int)ssid_bssid.ssid.ssid_len, - ssid_bssid.ssid.ssid); + MAC2STR(ssid_bssid->bssid), (int)ssid_bssid->ssid.ssid_len, + ssid_bssid->ssid.ssid); if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { ret = -EFAULT; goto done; } @@ -13915,6 +13940,8 @@ static int woal_priv_associate_ssid_bssid(moal_private *priv, t_u8 *respbuf, #endif /* REASSOCIATION */ done: + if (ssid_bssid) + kfree(ssid_bssid); LEAVE(); return ret; } @@ -15201,6 +15228,62 @@ done: return ret; } +/** + * @brief Configure TWT Information parameters + * + * @param priv Pointer to the mlan_private driver data struct + * @param respbuf A pointer to response buffer + * @param len Length used + * @param respbuflen Available length of response buffer + * + * @return Number of bytes written if successful else negative + * value + */ +static int woal_priv_twt_information(moal_private *priv, t_u8 *respbuf, + t_u8 len, t_u32 respbuflen) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_twtcfg *cfg = NULL; + int ret = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_twtcfg)); + if (req == NULL) { + PRINTM(MERROR, "Failed to allocate ioctl_req!\n"); + ret = -ENOMEM; + goto done; + } + + req->req_id = MLAN_IOCTL_11AX_CFG; + req->action = MLAN_ACT_SET; + cfg = (mlan_ds_twtcfg *)req->pbuf; + cfg->sub_command = MLAN_OID_11AX_TWT_CFG; + cfg->sub_id = MLAN_11AX_TWT_INFORMATION_SUBID; + + if (len) { + moal_memcpy_ext(priv->phandle, + (t_u8 *)&cfg->param.twt_information, respbuf, + len, sizeof(mlan_ds_twt_information)); + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "woal_request_ioctl failed!\n"); + ret = -EFAULT; + goto done; + } + + ret = sizeof(mlan_ds_twt_information); +done: + if (status != MLAN_STATUS_PENDING) { + kfree(req); + } + LEAVE(); + return ret; +} + #ifdef WIFI_DIRECT_SUPPORT #if defined(UAP_CFG80211) /** @@ -21285,6 +21368,21 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) priv_cmd.total_len); len += strlen(PRIV_CMD_TWT_REPORT) + strlen(CMD_NXP); goto handled; + + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_TWT_INFORMATION, + strlen(PRIV_CMD_TWT_INFORMATION)) == 0) { + pdata = buf + strlen(CMD_NXP) + + strlen(PRIV_CMD_TWT_INFORMATION); + len = priv_cmd.used_len - + strlen(PRIV_CMD_TWT_INFORMATION) - + strlen(CMD_NXP); + len = woal_priv_twt_information(priv, pdata, len, + priv_cmd.total_len); + len += strlen(PRIV_CMD_TWT_INFORMATION) + + strlen(CMD_NXP); + goto handled; + #if defined(STA_CFG80211) || defined(UAP_CFG80211) } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_GET_CFG_CHAN_LIST, diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h index 784c946..b7d87c8 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h @@ -4,7 +4,7 @@ * @brief This file contains definition for private IOCTL call. * * - * Copyright 2008-2023 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -405,6 +405,8 @@ typedef struct _ssu_params_cfg { #define PRIV_CMD_TWT_TEARDOWN "twt_teardown" /** Private command: TWT report Cfg */ #define PRIV_CMD_TWT_REPORT "twt_report" +/** Private command: TWT Information Cfg */ +#define PRIV_CMD_TWT_INFORMATION "twt_information" #define PRIV_CMD_LPM "lpm" @@ -414,6 +416,10 @@ int woal_do_ioctl(struct net_device *dev, struct ifreq *req, void __user *data, #else int woal_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd); #endif + +mlan_status parse_arguments(t_u8 *pos, int *data, int datalen, + int *user_data_len); + /* * For android private commands, fixed value of ioctl is used. * Internally commands are differentiated using strings. diff --git a/mxm_wifiex/wlan_src/mlinux/moal_init.c b/mxm_wifiex/wlan_src/mlinux/moal_init.c index d87f9bf..56a8768 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_init.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_init.c @@ -156,10 +156,11 @@ static int rps = 0; /** * rps cpu mask - * rps can be configure to any value between 0x1 - 0xf + * rps can be configure to any value between 0x1 - 0xff * ex: value of 0x3(0011) indicates to use cpu-0 and cpu-1 + * ex: value of 0x3f(11 1111) indicates to use cpu-0 and cpu-5 */ -#define RPS_CPU_MASK 0xf +#define RPS_CPU_MASK 0xff #endif #endif @@ -365,6 +366,9 @@ static card_type_entry card_type_map_tbl[] = { #ifdef SDIW624 {CARD_TYPE_SDIW624, 0, CARD_SDIW624}, #endif +#ifdef SDAW693 + {CARD_TYPE_SDAW693, 0, CARD_SDAW693}, +#endif #ifdef SDIW615 {CARD_TYPE_SDIW615, 0, CARD_SDIW615}, #endif @@ -380,6 +384,9 @@ static card_type_entry card_type_map_tbl[] = { #ifdef PCIE9098 {CARD_TYPE_PCIE9098, 0, CARD_PCIE9098}, #endif +#ifdef PCIEAW693 + {CARD_TYPE_PCIEAW693, 0, CARD_PCIEAW693}, +#endif #ifdef PCIEIW624 {CARD_TYPE_PCIEIW624, 0, CARD_PCIEIW624}, #endif diff --git a/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c index 2b0b547..d005124 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c @@ -3,7 +3,7 @@ * @brief This file contains ioctl function to MLAN * * - * Copyright 2008-2023 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -1248,7 +1248,7 @@ mlan_status woal_bss_start(moal_private *priv, t_u8 wait_option, mlan_ds_bss *bss = NULL; mlan_status status; #ifdef UAP_SUPPORT - mlan_ssid_bssid temp_ssid_bssid; + mlan_ssid_bssid *temp_ssid_bssid = NULL; #endif ENTER(); @@ -1264,12 +1264,20 @@ mlan_status woal_bss_start(moal_private *priv, t_u8 wait_option, LEAVE(); return MLAN_STATUS_FAILURE; } - moal_memcpy_ext(priv->phandle, &temp_ssid_bssid, ssid_bssid, + temp_ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!temp_ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + moal_memcpy_ext(priv->phandle, temp_ssid_bssid, ssid_bssid, sizeof(mlan_ssid_bssid), sizeof(mlan_ssid_bssid)); if (MLAN_STATUS_SUCCESS == - woal_find_best_network(priv, wait_option, &temp_ssid_bssid)) + woal_find_best_network(priv, wait_option, temp_ssid_bssid)) woal_check_mc_connection(priv, wait_option, - temp_ssid_bssid.channel); + temp_ssid_bssid->channel); + kfree(temp_ssid_bssid); #endif /* Allocate an IOCTL request buffer */ @@ -6608,7 +6616,7 @@ mlan_status woal_set_rssi_low_threshold(moal_private *priv, char *rssi, priv->mrvl_rssi_low = low_rssi; #endif misc->param.subscribe_event.low_rssi = low_rssi; - misc->param.subscribe_event.low_rssi_freq = 0; + misc->param.subscribe_event.low_rssi_freq = 1; ret = woal_request_ioctl(priv, req, wait_option); if (ret == MLAN_STATUS_FAILURE) { PRINTM(MERROR, "request set rssi_low_threshold fail!\n"); @@ -6672,7 +6680,7 @@ mlan_status woal_set_rssi_threshold(moal_private *priv, t_u32 event_id, SUBSCRIBE_EVT_ACT_BITWISE_SET; misc->param.subscribe_event.evt_bitmap = SUBSCRIBE_EVT_RSSI_LOW | SUBSCRIBE_EVT_RSSI_HIGH; - misc->param.subscribe_event.low_rssi_freq = 0; + misc->param.subscribe_event.low_rssi_freq = 1; misc->param.subscribe_event.low_rssi = priv->last_rssi_low; misc->param.subscribe_event.high_rssi_freq = 0; misc->param.subscribe_event.high_rssi = priv->last_rssi_high; @@ -8276,12 +8284,15 @@ static int parse_tx_pwr_string(moal_handle *handle, const char *s, size_t len, /* tx power value */ pos = strsep(&string, " \t"); if (pow_conv && pos) { - /* for SH and later chipsets we need to convert user power vals - * including -ve vals to 1/16dbm resolution*/ + /* We need to convert user power vals including -ve vals to + * 1/16dbm resolution*/ tx_pwr_local = woal_string_to_number(pos); - PowerLevelToDUT11Bits(tx_pwr_local, &tx_pwr_converted); - d->data1 = tx_pwr_converted; - pow_limit = 384; + if (tx_pwr_local != 0xffffffff) { + PowerLevelToDUT11Bits(tx_pwr_local, &tx_pwr_converted); + d->data1 = tx_pwr_converted; + pow_limit = 384; + } else + d->data1 = (t_u32)tx_pwr_local; } else if (pos) { d->data1 = (t_u32)woal_string_to_number(pos); } @@ -8666,6 +8677,10 @@ static int parse_tx_frame_string(const char *s, size_t len, if (pos) d->stbc = (t_u32)woal_string_to_number(pos); + pos = strsep(&string, " \t"); + if (pos) + d->signal_bw = (t_u32)woal_string_to_number(pos); + pos = strsep(&string, " \t"); if (pos) d->NumPkt = (t_u32)woal_string_to_number(pos); @@ -9108,18 +9123,20 @@ mlan_status woal_process_rf_test_mode_cmd(moal_handle *handle, t_u32 cmd, handle->rf_data->tx_frame_data[12] = misc->param.mfg_tx_frame2.stbc; handle->rf_data->tx_frame_data[13] = - misc->param.mfg_tx_frame2.NumPkt; + misc->param.mfg_tx_frame2.signal_bw; handle->rf_data->tx_frame_data[14] = - misc->param.mfg_tx_frame2.MaxPE; + misc->param.mfg_tx_frame2.NumPkt; handle->rf_data->tx_frame_data[15] = - misc->param.mfg_tx_frame2.BeamChange; + misc->param.mfg_tx_frame2.MaxPE; handle->rf_data->tx_frame_data[16] = - misc->param.mfg_tx_frame2.Dcm; + misc->param.mfg_tx_frame2.BeamChange; handle->rf_data->tx_frame_data[17] = - misc->param.mfg_tx_frame2.Doppler; + misc->param.mfg_tx_frame2.Dcm; handle->rf_data->tx_frame_data[18] = - misc->param.mfg_tx_frame2.MidP; + misc->param.mfg_tx_frame2.Doppler; handle->rf_data->tx_frame_data[19] = + misc->param.mfg_tx_frame2.MidP; + handle->rf_data->tx_frame_data[20] = misc->param.mfg_tx_frame2.QNum; for (i = 0; i < ETH_ALEN; i++) { handle->rf_data->bssid[i] = diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.c b/mxm_wifiex/wlan_src/mlinux/moal_main.c index 6a6d506..43ec9aa 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.c @@ -4,7 +4,7 @@ * driver. * * - * Copyright 2008-2022 NXP + * Copyright 2008-2022, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -516,6 +516,50 @@ static struct _card_info card_info_SDIW624 = { }; #endif +#ifdef SDAW693 +static struct _card_info card_info_SDAW693 = { + .embedded_supp = 1, + .drcs = 1, + .go_noa = 1, + .v16_fw_api = 1, + .v17_fw_api = 1, + .pmic = 1, + .cal_data_cfg = 0, + .low_power_enable = 0, + .rx_rate_max = 412, + .histogram_table_num = 3, + .feature_control = FEATURE_CTRL_DEFAULT, + .rev_id_reg = 0xc8, + .host_strap_reg = 0xf4, + .magic_reg = 0xf0, + .fw_name = SDAW693_DEFAULT_COMBO_FW_NAME, + .fw_name_wlan = SDAW693_DEFAULT_WLAN_FW_NAME, +#ifdef SDIO + .dump_fw_info = DUMP_FW_SDIO_V3, + .dump_fw_ctrl_reg = 0xf9, + .dump_fw_start_reg = 0xf1, + .dump_fw_end_reg = 0xf8, + .dump_fw_host_ready = 0xcc, + .dump_reg.reg_table = {0x08, 0x58, 0x5C, 0x5D, 0x60, 0x61, 0x62, 0x64, + 0x65, 0x66, 0x68, 0x69, 0x6a}, + .dump_reg.reg_table_size = 13, + .scratch_reg = 0xe8, + .func1_reg_start = 0x10, + .func1_reg_end = 0x17, + .fw_stuck_code_reg = 0xEB, + .fw_reset_reg = 0x0EE, + .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, + .slew_rate_reg = 0x90002328, + .slew_rate_bit_offset = 12, +#endif + .sniffer_support = 1, + .per_pkt_cfg_support = 1, + .host_mlme_required = 1, +}; +#endif + #ifdef SD9177 static struct _card_info card_info_SD9177 = { .embedded_supp = 1, @@ -713,6 +757,34 @@ static struct _card_info card_info_PCIEIW624 = { }; #endif +#ifdef PCIEAW693 +static struct _card_info card_info_PCIEAW693 = { + .embedded_supp = 1, + .drcs = 1, + .go_noa = 1, + .v16_fw_api = 1, + .v17_fw_api = 1, + .pmic = 1, + .cal_data_cfg = 0, + .low_power_enable = 0, + .rx_rate_max = 412, + .histogram_table_num = 3, + .feature_control = FEATURE_CTRL_DEFAULT, + .rev_id_reg = 0x8, + .host_strap_reg = 0x1c70, + .magic_reg = 0x1c74, + .fw_name = PCIEAW693_DEFAULT_COMBO_FW_NAME, + .fw_name_wlan = PCIEAW693_DEFAULT_WLAN_FW_NAME, + .fw_stuck_code_reg = 0x1c80, + .fw_reset_reg = 0x1c94, + .fw_reset_val = 0x98, + .fw_wakeup_reg = 0x0, + .sniffer_support = 1, + .per_pkt_cfg_support = 1, + .host_mlme_required = 1, +}; +#endif + #ifdef USB8801 static struct _card_info card_info_USB8801 = { .embedded_supp = 0, @@ -900,6 +972,8 @@ static struct _card_info card_info_SD8987 = { }; #endif +#define NXP_ETH_P_EAPOL 0x888E + /** Driver version */ char driver_version[] = INTF_CARDTYPE KERN_VERSION "--" MLAN_RELEASE_VERSION "-GPL" @@ -1019,6 +1093,57 @@ static struct workqueue_struct *register_workqueue; /** register work */ static struct work_struct register_work; +#ifdef DUMP_TO_PROC +#define MAX_BUF_SIZE 100 +/** + * @brief This function writes the fw dump in kernel(dmesg) log + * + * @param pfd_buf pointer to fw dump buffer + * @param fwdump_len length of fw dump buffer + * + * @return N/A + */ +void woal_print_firmware_dump_buf(t_u8 *pfd_buf, t_u64 fwdump_len) +{ + t_u64 i = 0, count = 0; + u8 buf[MAX_BUF_SIZE] = {0}; + u8 *ptr = NULL; + ENTER(); + + if (!pfd_buf || !fwdump_len) { + PRINTM(MERROR, + "%s: fw dump buffer is NULL or total length is zero\n", + __func__); + return; + } + + PRINTM(MFW_D, "===== FW Dump To Console START=====\n"); + for (i = 0; ((i < fwdump_len) && ((i + 15) < fwdump_len)); i += 16) { + PRINTM(MFW_D, + "[FW Dump] %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + pfd_buf[i], pfd_buf[i + 1], pfd_buf[i + 2], + pfd_buf[i + 3], pfd_buf[i + 4], pfd_buf[i + 5], + pfd_buf[i + 6], pfd_buf[i + 7], pfd_buf[i + 8], + pfd_buf[i + 9], pfd_buf[i + 10], pfd_buf[i + 11], + pfd_buf[i + 12], pfd_buf[i + 13], pfd_buf[i + 14], + pfd_buf[i + 15]); + count++; + moal_usleep_range(NULL, 40, 50); + } + + if (i < fwdump_len) { + ptr = buf; + for (; i < fwdump_len; i++) { + ptr += snprintf(ptr, MAX_BUF_SIZE, " %02X", pfd_buf[i]); + } + PRINTM(MFW_D, "[FW Dump]%s\n", buf); + } + + PRINTM(MFW_D, "===== FW Dump To Console END=====\n"); + PRINTM(MFW_D, "FW Dump buffer length = %llu\n", fwdump_len); +} +#endif + /** * @brief This function send fw dump event to kernel * @@ -1333,7 +1458,8 @@ static void woal_hang_work_queue(struct work_struct *work) void woal_process_hang(moal_handle *handle) { ENTER(); - if (!handle || handle->fw_reseting) { + if (!handle || handle->fw_reseting || + (handle->hardware_status != HardwareStatusReady)) { LEAVE(); return; } @@ -2538,6 +2664,10 @@ void woal_free_moal_handle(moal_handle *handle) } #endif + if (handle->is_fw_dump_timer_set) { + woal_cancel_timer(&handle->fw_dump_timer); + handle->is_fw_dump_timer_set = MFALSE; + } /* Free allocated memory for fwdump filename */ kfree(handle->fwdump_fname); if (fwdump_fname) { @@ -2734,7 +2864,7 @@ static t_u32 woal_set_sdio_slew_rate(moal_handle *handle) (handle->params.slew_rate > 3 || handle->params.slew_rate < 0)) return MLAN_STATUS_FAILURE; #if defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ - defined(SD9177) || defined(SDIW615) + defined(SDAW693) || defined(SD9177) || defined(SDIW615) if (IS_SD9098(handle->card_type) || IS_SD9097(handle->card_type) || IS_SDIW624(handle->card_type) || IS_SDIW615(handle->card_type) || IS_SD9177(handle->card_type)) @@ -3804,13 +3934,13 @@ static ssize_t woal_set_rps_map(struct netdev_rx_queue *queue, const char *buf, static mlan_status woal_add_card_dpc(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; - int i; + int i, j; char str_buf[MLAN_MAX_VER_STR_LEN]; #if defined(CONFIG_RPS) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) moal_private *priv_rps = NULL; - t_u8 rps_buf[2]; + t_u8 rps_buf[3]; #endif #endif @@ -3933,19 +4063,27 @@ static mlan_status woal_add_card_dpc(moal_handle *handle) #if defined(CONFIG_RPS) #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) if (handle->params.rps) { - priv_rps = woal_get_priv_bss_type(handle, MLAN_BSS_TYPE_STA); snprintf(rps_buf, sizeof(rps_buf), "%x", handle->params.rps); - if (priv_rps) { - PRINTM(MCMND, - "num_rx_queues=%u real_num_rx_queues=%u\n", - priv_rps->netdev->num_rx_queues, - priv_rps->netdev->real_num_rx_queues); - for (i = 0; - i < (int)MIN(priv_rps->netdev->num_rx_queues, - priv_rps->netdev->real_num_rx_queues); - i++) { - woal_set_rps_map(&(priv_rps->netdev->_rx[i]), - rps_buf, strlen(rps_buf)); + for (i = 0; i < MIN(handle->priv_num, MLAN_MAX_BSS_NUM); i++) { + priv_rps = handle->priv[i]; + if (priv_rps && priv_rps->netdev) { + PRINTM(MCMND, "bss_type=%d bss_role=%d \n", + priv_rps->bss_type, priv_rps->bss_role); + PRINTM(MCMND, + "num_rx_queues=%u real_num_rx_queues=%u rps_buf=%s\n", + priv_rps->netdev->num_rx_queues, + priv_rps->netdev->real_num_rx_queues, + rps_buf); + for (j = 0; + j < + (int)MIN(priv_rps->netdev->num_rx_queues, + priv_rps->netdev + ->real_num_rx_queues); + j++) { + woal_set_rps_map( + &(priv_rps->netdev->_rx[j]), + rps_buf, strlen(rps_buf)); + } } } } @@ -4302,8 +4440,11 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) fw.fw_reload = handle->params.fw_reload; else fw.fw_reload = 0; + /* Make sure device is awake before FW download */ + mlan_pm_wakeup_card(handle->pmlan_adapter, MTRUE); wifi_status = WIFI_STATUS_FW_DNLD; ret = mlan_dnld_fw(handle->pmlan_adapter, &fw); + mlan_pm_wakeup_card(handle->pmlan_adapter, MFALSE); if (ret == MLAN_STATUS_FAILURE) { wifi_status = WIFI_STATUS_DNLD_FW_FAIL; PRINTM(MERROR, @@ -4384,13 +4525,20 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) 10 * HZ); if (handle->hardware_status != HardwareStatusReady) { wifi_status = WIFI_STATUS_INIT_FW_FAIL; + handle->event_fw_dump = MFALSE; if (handle->ops.reg_dbg) handle->ops.reg_dbg(handle); #ifdef DEBUG_LEVEL1 if (drvdbg & MFW_D) { - drvdbg &= ~MFW_D; - if (handle->ops.dump_fw_info) + if (handle->ops.dump_fw_info) { handle->ops.dump_fw_info(handle); +#ifdef DUMP_TO_PROC + woal_print_firmware_dump_buf( + handle->fw_dump_buf, + handle->fw_dump_len); +#endif + } + drvdbg &= ~MFW_D; } #endif ret = MLAN_STATUS_FAILURE; @@ -5352,6 +5500,12 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, INIT_LIST_HEAD(&priv->mcast_list); spin_lock_init(&priv->mcast_lock); +#ifdef STA_CFG80211 + INIT_LIST_HEAD(&priv->dhcp_discover_queue); + /* CID - 10017917 */ + // coverity[side_effect_free: SUPPRESS] + spin_lock_init(&priv->dhcp_discover_lock); +#endif #ifdef STA_CFG80211 #ifdef STA_SUPPORT spin_lock_init(&priv->connect_lock); @@ -5648,6 +5802,9 @@ void woal_remove_interface(moal_handle *handle, t_u8 bss_index) woal_flush_tcp_sess_queue(priv); woal_flush_tx_stat_queue(priv); +#ifdef STA_CFG80211 + woal_flush_dhcp_discover_queue(priv); +#endif #ifdef STA_CFG80211 if (priv->bss_type == MLAN_BSS_TYPE_STA) @@ -5733,9 +5890,16 @@ void woal_remove_interface(moal_handle *handle, t_u8 bss_index) /* Clear the whole backhaul station list in moal */ for (count = 0; count < MAX_STA_COUNT; count++) { if (priv->vlan_sta_list[count]) { - if (priv->vlan_sta_list[count]->is_valid) + if (priv->vlan_sta_list[count]->is_valid) { + priv->vlan_sta_list[count]->is_valid = MFALSE; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) + cfg80211_unregister_netdevice( + priv->vlan_sta_list[count]->netdev); +#else unregister_netdevice( priv->vlan_sta_list[count]->netdev); +#endif + } kfree(priv->vlan_sta_list[count]); } priv->vlan_sta_list[count] = NULL; @@ -6279,6 +6443,9 @@ int woal_close(struct net_device *dev) #endif woal_flush_tx_stat_queue(priv); +#ifdef STA_CFG80211 + woal_flush_dhcp_discover_queue(priv); +#endif if ((priv->media_connected == MTRUE) #ifdef UAP_SUPPORT @@ -6361,7 +6528,7 @@ int woal_close(struct net_device *dev) * * @return 0 --success, otherwise fail */ -void woal_disable_ampdu(moal_private *priv) +static void woal_disable_ampdu(moal_private *priv) { mlan_ds_11n_aggr_prio_tbl aggr_prio_tbl; int i; @@ -6959,7 +7126,6 @@ u16 woal_select_queue(struct net_device *dev, struct sk_buff *skb #else tid = skb->priority = woal_classify8021d(skb); #endif -#define NXP_ETH_P_EAPOL 0x888E #define NXP_ETH_P_WAPI 0x88B4 switch (skb->protocol) { case htons(ETH_P_ARP): @@ -7075,6 +7241,143 @@ void woal_remove_tx_info(moal_private *priv, t_u8 tx_seq_num) LEAVE(); } +#if defined(STA_CFG80211) +/** + * @brief This function flushes timesync info queue + * + * @param priv A pointer to moal_private structure + * + * @return N/A + */ +void woal_flush_dhcp_discover_queue(moal_private *priv) +{ + struct dhcp_discover_info *discover_info = NULL, *tmp_node; + unsigned long flags; + spin_lock_irqsave(&priv->dhcp_discover_lock, flags); + list_for_each_entry_safe (discover_info, tmp_node, + &priv->dhcp_discover_queue, link) { + list_del(&discover_info->link); + kfree(discover_info); + } + INIT_LIST_HEAD(&priv->dhcp_discover_queue); + spin_unlock_irqrestore(&priv->dhcp_discover_lock, flags); +} + +/** + * @brief This function gets dhcp_discover_info + * + * @param priv A pointer to moal_private structure + * @param transation_id token_id of the packet + * + * @return N/A + */ +struct dhcp_discover_info *woal_get_dhcp_discover_info(moal_private *priv, + t_u32 transaction_id) +{ + struct dhcp_discover_info *discover_info = NULL; + + ENTER(); + list_for_each_entry (discover_info, &priv->dhcp_discover_queue, link) { + // TODO: add 5 second ageout check + if (discover_info->transaction_id == transaction_id) { + LEAVE(); + return discover_info; + } + } + LEAVE(); + return NULL; +} + +/** + * @brief add dhcp_discover_node + * + * @param priv A pointer to moal_private structure + * @param transaction_id dhcp discover pkt's transaction_id + * @param pmbuf pmbuf + * + * @return N/A + */ +t_void woal_add_dhcp_discover_node(moal_private *priv, t_u32 transaction_id, + mlan_buffer *pmbuf) +{ + struct dhcp_discover_info *node = NULL; + unsigned long flags; + t_u8 find_node = MFALSE; + if (priv) { + spin_lock_irqsave(&priv->dhcp_discover_lock, flags); + list_for_each_entry (node, &priv->dhcp_discover_queue, link) { + if (node->transaction_id == transaction_id) { + find_node = MTRUE; + node->in_ts_sec = pmbuf->in_ts_sec; + node->in_ts_usec = pmbuf->in_ts_usec; + break; + } + } + if (!find_node) { + /* create new mcast node */ + node = kzalloc(sizeof(struct dhcp_discover_info), + GFP_ATOMIC); + if (node) { + node->transaction_id = transaction_id; + node->in_ts_sec = pmbuf->in_ts_sec; + node->in_ts_usec = pmbuf->in_ts_usec; + INIT_LIST_HEAD(&node->link); + list_add_tail(&node->link, + &priv->dhcp_discover_queue); + PRINTM(MCMND, + "Add to dhcp_disover_queue: transaction_id=0x%x\n", + transaction_id); + } + } + spin_unlock_irqrestore(&priv->dhcp_discover_lock, flags); + } + /* CID - 36267456 */ + // coverity[leaked_storage:SUPPRESS] +} + +/** + * @brief get_dhcp_discover packet's transation_id + * + * @param skb point to struct skb_buff + * + * @return transation_id + */ +t_u32 woal_get_dhcp_discover_transation_id(struct sk_buff *skb) +{ + struct ethhdr *eth; + struct iphdr *iph; + struct udphdr *udph; + struct dhcp_pkt *dhcp_info; + t_u16 min_pkt_size = 0; + const t_u8 bc_mac[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + + ENTER(); + eth = (struct ethhdr *)(skb->data); + if (memcmp(eth->h_dest, bc_mac, MLAN_MAC_ADDR_LENGTH)) + goto done; + min_pkt_size = DHCP_ETH_HEADER_SIZE + DHCP_MIN_IP_HEADER_SIZE + + DHCP_UDP_HEADER_SIZE + sizeof(struct dhcp_pkt); + if (skb->len < min_pkt_size) + goto done; + if (eth->h_proto == __constant_htons(ETH_P_IP)) { + iph = (struct iphdr *)((t_u8 *)eth + sizeof(struct ethhdr)); + if (iph->protocol == DHCP_UDP_PROTO) { + udph = (struct udphdr *)((t_u8 *)iph + (iph->ihl << 2)); + if (udph->source == __constant_htons(DHCP_SRC_PORT) && + udph->dest == __constant_htons(DHCP_DST_PORT)) { + dhcp_info = (struct dhcp_pkt + *)((t_u8 *)udph + + sizeof(struct udphdr)); + return __constant_htonl(dhcp_info->xid); + } + } + } +done: + LEAVE(); + return 0; +} +#endif + /** * @brief This function flush mcast list * @@ -7630,7 +7933,7 @@ done: * @param pmbuf A mlan buffer * @return N/A */ -void woal_send_tx_pkt_to_mon_if(moal_private *priv, pmlan_buffer pmbuf) +static void woal_send_tx_pkt_to_mon_if(moal_private *priv, pmlan_buffer pmbuf) { struct ieee80211_hdr *dot11_hdr = NULL; struct radiotap_info *rt = NULL; @@ -7880,6 +8183,15 @@ static void woal_start_xmit(moal_private *priv, struct sk_buff *skb) multi_ap_packet = woal_check_easymesh_packet(priv, pmbuf); } #endif +#endif +#ifdef STA_CFG80211 + if (priv->multi_ap_flag && priv->bss_type == MLAN_BSS_TYPE_STA) { + t_u32 transaction_id; + transaction_id = woal_get_dhcp_discover_transation_id(skb); + if (transaction_id) + woal_add_dhcp_discover_node(priv, transaction_id, + pmbuf); + } #endif if (priv->enable_tcp_ack_enh == MTRUE) { @@ -7990,7 +8302,8 @@ netdev_tx_t woal_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) priv->stats.tx_dropped++; goto done; } - if (moal_extflg_isset(priv->phandle, EXT_TX_WORK)) { + if (moal_extflg_isset(priv->phandle, EXT_TX_WORK) && + (skb->protocol != htons(NXP_ETH_P_EAPOL))) { spin_lock_bh(&(priv->tx_q.lock)); __skb_queue_tail(&(priv->tx_q), skb); spin_unlock_bh(&(priv->tx_q.lock)); @@ -8703,7 +9016,7 @@ pmlan_ioctl_req woal_alloc_mlan_ioctl_req(int size) t_s32 temp_size = 0; ENTER(); - flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; + flag = GFP_ATOMIC; if (!woal_secure_add( &size, @@ -8812,6 +9125,11 @@ static int woal_get_card_info(moal_handle *phandle) phandle->card_info = &card_info_SD9097; break; #endif +#ifdef SDAW693 + case CARD_TYPE_SDAW693: + phandle->card_info = &card_info_SDAW693; + break; +#endif #ifdef SDIW624 case CARD_TYPE_SDIW624: phandle->card_info = &card_info_SDIW624; @@ -8838,6 +9156,12 @@ static int woal_get_card_info(moal_handle *phandle) phandle->card_info = &card_info_PCIE9097; break; #endif +#ifdef PCIEAW693 + case CARD_TYPE_PCIEAW693: + phandle->card_info = &card_info_PCIEAW693; + phandle->event_fw_dump = MTRUE; + break; +#endif #ifdef PCIEIW624 case CARD_TYPE_PCIEIW624: phandle->card_info = &card_info_PCIEIW624; @@ -9908,7 +10232,11 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) moal_memcpy_ext(phandle, pos, pmevent->event_buf + OFFSET_SEQNUM, pmevent->event_len - OFFSET_SEQNUM, FW_DUMP_INFO_LEN - phandle->fw_dump_len); - phandle->fw_dump_len += pmevent->event_len - OFFSET_SEQNUM; + if (pmevent->event_len > OFFSET_SEQNUM) { + phandle->fw_dump_len += pmevent->event_len - OFFSET_SEQNUM; + } else { + PRINTM(MERROR, "event_len is invalid\n"); + } PRINTM(MINFO, "fw dump event: evt_len=%d toal_len=%ld\n", pmevent->event_len, (long int)phandle->fw_dump_len); @@ -9935,6 +10263,66 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) } #else + +t_void woal_print_firmware_dump(moal_handle *phandle, char *fwdp_fname) +{ + struct file *pfile_fwdump = NULL; + loff_t pos = 0; + t_u8 *pbuf = NULL; + t_u32 i = 0, count = 0, fwdump_len = 0, ret = 0; + + ENTER(); + + pos = 0; + fwdump_len = (t_u32)phandle->fw_dump_len; + + ret = moal_vmalloc(phandle, fwdump_len, &pbuf); + if (ret != MLAN_STATUS_SUCCESS || !pbuf) { + PRINTM(MFWDP_D, " moal_vmalloc failed\n"); + } else { + memset(pbuf, 0, fwdump_len); + pfile_fwdump = filp_open(fwdp_fname, O_RDONLY, 0644); + ret = kernel_read(pfile_fwdump, pbuf, + (long int)phandle->fw_dump_len, &pos); + + if (ret <= 0) { + PRINTM(MFWDP_D, "kernel_read failed %d\n", ret); + } else { + PRINTM(MFWDP_D, + "===== FW Dump To Console START=====\n"); + for (i = 0; + ((i < fwdump_len) && ((i + 15) < fwdump_len)); + i += 16) { + PRINTM(MFWDP_D, + "[FW Dump] %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", + pbuf[i], pbuf[i + 1], pbuf[i + 2], + pbuf[i + 3], pbuf[i + 4], pbuf[i + 5], + pbuf[i + 6], pbuf[i + 7], pbuf[i + 8], + pbuf[i + 9], pbuf[i + 10], pbuf[i + 11], + pbuf[i + 12], pbuf[i + 13], pbuf[i + 14], + pbuf[i + 15]); + count++; + usleep_range(10, 20); + } + + if (i < fwdump_len) { + for (; i < fwdump_len; i++) { + PRINTM(MFWDP_D, "%02X\n", pbuf[i]); + } + } + + PRINTM(MFWDP_D, "===== FW Dump To Console END=====\n"); + PRINTM(MFWDP_D, "FW Dump buffer length = %d\n", + fwdump_len); + } + + filp_close(pfile_fwdump, NULL); + } + + if (pbuf) + moal_vfree(phandle, pbuf); +} + t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) { struct file *pfile_fwdump = NULL; @@ -10018,7 +10406,11 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) LEAVE(); return; } - phandle->fw_dump_len += pmevent->event_len - OFFSET_SEQNUM; + if (pmevent->event_len > OFFSET_SEQNUM) { + phandle->fw_dump_len += pmevent->event_len - OFFSET_SEQNUM; + } else { + PRINTM(MERROR, "event_len is invalid\n"); + } #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) vfs_write(pfile_fwdump, (const char __user *)pmevent->event_buf + OFFSET_SEQNUM, @@ -10029,6 +10421,10 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) #endif filp_close(pfile_fwdump, NULL); if (type == DUMP_TYPE_ENDE) { + woal_print_firmware_dump(phandle, + (phandle->fwdump_fname ? + phandle->fwdump_fname : + fwdump_fname)); PRINTM(MMSG, "==== FW DUMP END: %ld bytes ====\n", (long int)phandle->fw_dump_len); phandle->fw_dump = MFALSE; @@ -10048,7 +10444,7 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) } #endif /* DUMP_TO_PROC */ -#define DRV_INFO_SIZE 0x60000 +#define DRV_INFO_SIZE 0xA0000 #define DRV_INFO_PER_INTF 0x11000 #define ROW_SIZE_16 16 #define ROW_SIZE_32 32 @@ -10082,7 +10478,7 @@ static int woal_save_hex_dump(int rowsize, const void *buf, size_t len, hex_dump_to_buffer(ptr + i, linelen, rowsize, 1, linebuf, sizeof(linebuf), false); - pos += snprintf(pos, MAX_BUF_LEN, "%s\n", linebuf); + pos += snprintf(pos, sizeof(linebuf), "%s\n", linebuf); } return (int)(pos - (char *)save_buf); @@ -11505,7 +11901,13 @@ t_void woal_evt_work_queue(struct work_struct *work) break; case WOAL_EVENT_RX_MGMT_PKT: #if defined(UAP_CFG80211) || defined(STA_CFG80211) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + priv = evt->priv; + wiphy_lock(priv->wdev->wiphy); + cfg80211_rx_mlme_mgmt(priv->netdev, evt->evt.event_buf, + evt->evt.event_len); + wiphy_unlock(priv->wdev->wiphy); +#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) priv = evt->priv; mutex_lock(&priv->wdev->mtx); cfg80211_rx_mlme_mgmt(priv->netdev, evt->evt.event_buf, @@ -11642,7 +12044,7 @@ t_void woal_rx_work_queue(struct work_struct *work) * * @return N/A */ -void woal_pcie_rx_data_task(unsigned long data) +static void woal_pcie_rx_data_task(unsigned long data) { moal_handle *handle = (moal_handle *)data; wifi_timeval start_timeval; @@ -11689,7 +12091,7 @@ void woal_pcie_rx_data_task(unsigned long data) * * @return N/A */ -t_void woal_pcie_tx_complete_task(unsigned long data) +static t_void woal_pcie_tx_complete_task(unsigned long data) { moal_handle *handle = (moal_handle *)data; ENTER(); @@ -11847,7 +12249,7 @@ t_void woal_pcie_delayed_tx_work(struct work_struct *work) * @return skb buffer */ -struct sk_buff *woal_skb_dequeue_spinlock(struct sk_buff_head *list) +static struct sk_buff *woal_skb_dequeue_spinlock(struct sk_buff_head *list) { struct sk_buff *result; @@ -11864,7 +12266,7 @@ struct sk_buff *woal_skb_dequeue_spinlock(struct sk_buff_head *list) * * @return N/A */ -t_void woal_tx_work_handler(struct work_struct *work) +static t_void woal_tx_work_handler(struct work_struct *work) { moal_handle *handle = container_of(work, moal_handle, tx_work); moal_private *priv = NULL; @@ -13675,6 +14077,9 @@ static void woal_cleanup_module(void) goto exit; } woal_flush_tx_stat_queue(handle->priv[i]); +#ifdef STA_CFG80211 + woal_flush_dhcp_discover_queue(handle->priv[i]); +#endif #endif } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.h b/mxm_wifiex/wlan_src/mlinux/moal_main.h index c66bee5..d36e1aa 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.h @@ -3,7 +3,7 @@ * @brief This file contains wlan driver specific defines etc. * * - * Copyright 2008-2023 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -44,6 +44,8 @@ Change log: #include #include #include +#include +#include #if LINUX_VERSION_CODE > KERNEL_VERSION(4, 10, 17) #include #endif @@ -1375,7 +1377,7 @@ struct rf_test_mode_data { /* Tx continuous config values */ t_u32 tx_cont_data[6]; /* Tx frame config values */ - t_u32 tx_frame_data[20]; + t_u32 tx_frame_data[22]; /* HE TB Tx values */ t_u32 he_tb_tx[4]; t_s32 he_tb_tx_power[1]; @@ -1453,6 +1455,7 @@ typedef struct _auto_zero_dfs_cfg { } __ATTRIB_PACK__ auto_zero_dfs_cfg; #if defined(UAP_CFG80211) || defined(STA_CFG80211) +/** station node */ typedef struct _station_node { /** station aid */ t_u16 aid; @@ -1464,6 +1467,71 @@ typedef struct _station_node { t_u8 is_valid; } station_node; +/** dhcp discover info */ +struct dhcp_discover_info { + /** link */ + struct list_head link; + /** transaction id */ + t_u32 transaction_id; + /** Time stamp when packet is received (seconds) */ + t_u32 in_ts_sec; + /** Time stamp when packet is received (micro seconds) */ + t_u32 in_ts_usec; +}; + +#define UDP_PSEUDO_HEADER_SIZE 12 +#define DHCP_ETH_HEADER_SIZE 14 +#define DHCP_MIN_IP_HEADER_SIZE 20 +#define DHCP_UDP_HEADER_SIZE 8 +#define DHCP_IP_PROTO 0x0800 +#define DHCP_IP_VERSION 0x04 +#define DHCP_IP_TOS 0x00 +#define DHCP_IP_TTL 0x40 +#define DHCP_UDP_PROTO 0x11 +#define DHCP_IPADDR_SIZE 4 +#define DHCP_SRC_PORT 0x0044 +#define DHCP_DST_PORT 0x0043 + +struct dhcp_pkt { + /** DHCP op code or message type */ + t_u8 op; + /** Hardware address type */ + t_u8 htype; + /** Hardware address length */ + t_u8 hlen; + /** Hops is optionally used by relay agents */ + t_u8 hops; + /** Transaction identifier */ + t_u32 xid; + /** Seconds till the client has started the DHCP process */ + t_u16 secs; + /** Flags */ + t_u16 flags; + /** + * IP address of the client Only filled in if + * the client is in BOUND, RENEW or REBINDING + */ + t_u32 ciaddr; + /** + * Your IP address offered to the client. + * Sent by server during the DISCOVER and ACK + */ + t_u32 yiaddr; + /** + * IP address of the DHCP server to use next. + */ + t_u32 siaddr; + /** Relay agent IP address */ + t_u32 giaddr; + t_u8 chaddr[16]; + /** Null terminated server host name */ + t_u8 sname[64]; + t_u8 file[128]; + /** BOOTP magic cookie */ + t_u32 magic; + t_u8 pOptions[1]; +} __ATTRIB_PACK__; + #define EASY_MESH_MULTI_AP_FH_BSS (t_u8)(0x20) #define EASY_MESH_MULTI_AP_BH_BSS (t_u8)(0x40) #define EASY_MESH_MULTI_AP_BH_AND_FH_BSS (t_u8)(0x60) @@ -1865,6 +1933,10 @@ struct _moal_private { moal_private *parent_priv; #endif #endif + /** dhcp discover lock*/ + spinlock_t dhcp_discover_lock; + /** DHCP DISCOVER Info queue */ + struct list_head dhcp_discover_queue; /** txwatchdog disable */ t_u8 txwatchdog_disable; @@ -3066,10 +3138,8 @@ struct _moal_handle { BOOLEAN is_tp_acnt_timer_set; t_u8 request_pm; -#ifdef IMX_SUPPORT #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 35) struct pm_qos_request woal_pm_qos_req; -#endif #endif t_u32 ips_ctrl; BOOLEAN is_edmac_enabled; @@ -3242,6 +3312,12 @@ extern t_u32 drvdbg; } while (0) #endif /* DEBUG_LEVEL2 */ +#define PRINTM_MFWDP_D(level, msg...) \ + do { \ + woal_print(level, msg); \ + if (drvdbg & MFWDP_D) \ + printk(KERN_DEBUG msg); \ + } while (0) #define PRINTM_MFW_D(level, msg...) \ do { \ woal_print(level, msg); \ @@ -3855,6 +3931,8 @@ void woal_dump_firmware_info(moal_handle *phandle); void woal_dump_firmware_info_v2(moal_handle *phandle); void woal_dump_firmware_info_v3(moal_handle *phandle); #endif /* SDIO_MMC */ +/* Print FW dumps in kernel(dmesg) log */ +t_void woal_print_firmware_dump(moal_handle *phandle, char *fwdp_fname); /* Store the FW dumps received from events in a file */ void woal_store_firmware_dump(moal_handle *phandle, pmlan_event pmevent); void woal_send_fw_dump_complete_event(moal_private *priv); @@ -3911,9 +3989,9 @@ void woal_send_iwevcustom_event(moal_private *priv, char *str); /** Get channel list */ mlan_status woal_get_channel_list(moal_private *priv, t_u8 wait_option, mlan_chan_list *chanlist); +#endif mlan_status woal_11d_check_ap_channel(moal_private *priv, t_u8 wait_option, mlan_ssid_bssid *ssid_bssid); -#endif /** Set/Get retry count */ mlan_status woal_set_get_retry(moal_private *priv, t_u32 action, t_u8 wait_option, int *value); @@ -4230,6 +4308,12 @@ mlan_status woal_set_hotspotcfg(moal_private *priv, t_u8 wait_option, #if defined(STA_CFG80211) mlan_status woal_multi_ap_cfg(moal_private *priv, t_u8 wait_option, t_u8 flag); +struct dhcp_discover_info *woal_get_dhcp_discover_info(moal_private *priv, + t_u32 transaction_id); +void woal_flush_dhcp_discover_queue(moal_private *priv); +t_u32 woal_get_dhcp_discover_transation_id(struct sk_buff *skb); +t_void woal_add_dhcp_discover_node(moal_private *priv, t_u32 transaction_id, + mlan_buffer *pmbuf); #endif mlan_status woal_set_get_wowlan_config(moal_private *priv, t_u16 action, @@ -4323,4 +4407,7 @@ t_bool woal_secure_sub(t_void *datain, t_s32 sub, t_void *dataout, mlan_status woal_edmac_cfg(moal_private *priv, t_u8 *country_code); +#ifdef DUMP_TO_PROC +void woal_print_firmware_dump_buf(t_u8 *pfd_buf, t_u64 fwdump_len); +#endif #endif /* _MOAL_MAIN_H */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_pcie.c b/mxm_wifiex/wlan_src/mlinux/moal_pcie.c index 2c76012..9df7f3d 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_pcie.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_pcie.c @@ -117,6 +117,24 @@ static const struct pci_device_id wlan_ids[] = { 0, }, #endif +#ifdef PCIEAW693 + { + PCIE_VENDOR_ID_NXP, + PCIE_DEVICE_ID_88WAW693_FN0, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, + { + PCIE_VENDOR_ID_NXP, + PCIE_DEVICE_ID_88WAW693_FN1, + PCI_ANY_ID, + PCI_ANY_ID, + 0, + 0, + }, +#endif #ifdef PCIEIW624 { PCIE_VENDOR_ID_NXP, @@ -145,7 +163,7 @@ MODULE_DEVICE_TABLE(pci, wlan_ids); static mlan_status woal_pcie_preinit(struct pci_dev *pdev); #if defined(PCIE8897) || defined(PCIE8997) || defined(PCIE9098) || \ - defined(PCIE9097) || defined(PCIEIW624) + defined(PCIE9097) || defined(PCIEAW693) || defined(PCIEIW624) static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, t_u8 resetflag); #endif @@ -216,6 +234,20 @@ static t_u16 woal_update_card_type(t_void *card) strlen(KERN_VERSION)); } #endif +#ifdef PCIEAW693 + if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88WAW693_FN0 || + cardp_pcie->dev->device == PCIE_DEVICE_ID_88WAW693_FN1) { + card_type = CARD_TYPE_PCIEAW693; + moal_memcpy_ext(NULL, driver_version, CARD_PCIEAW693, + strlen(CARD_PCIEAW693), strlen(driver_version)); + moal_memcpy_ext(NULL, + driver_version + strlen(INTF_CARDTYPE) + + strlen(KERN_VERSION), + V18, strlen(V18), + strlen(driver_version) - strlen(INTF_CARDTYPE) - + strlen(KERN_VERSION)); + } +#endif #ifdef PCIEIW624 if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88WIW624) { card_type = CARD_TYPE_PCIEIW624; @@ -408,6 +440,25 @@ static mlan_status woal_do_flr(moal_handle *handle, bool prepare, bool flr_flag) } handle->pmlan_adapter = NULL; } +#ifdef DUMP_TO_PROC + if (handle->fw_dump_buf) { + moal_vfree(handle, handle->fw_dump_buf); + handle->fw_dump_buf = NULL; + handle->fw_dump_len = 0; + } +#endif +#ifdef PCIEAW693 + if (IS_PCIEAW693(handle->card_type)) + handle->event_fw_dump = MTRUE; +#endif +#ifdef PCIEIW624 + if (IS_PCIEIW624(handle->card_type)) + handle->event_fw_dump = MTRUE; +#endif +#ifdef PCIE9098 + if (IS_PCIE9098(handle->card_type)) + handle->event_fw_dump = MTRUE; +#endif goto exit; @@ -422,7 +473,7 @@ perform_init: if (!handle->pmlan_adapter) goto err_init_fw; -#if defined(PCIE9098) +#if defined(PCIE9098) || defined(PCIEAW693) if ((card->dev->device == PCIE_DEVICE_ID_88W9098P_FN1) || (card->dev->device == PCIE_DEVICE_ID_88WAW693_FN1)) mlan_set_int_mode(handle->pmlan_adapter, pcie_int_mode, 1); @@ -647,7 +698,8 @@ static void woal_pcie_shutdown(struct pci_dev *dev) handle = card->handle; if (handle->second_mac) goto done; -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(handle->card_type) || IS_PCIEIW624(handle->card_type) || IS_PCIEAW693(handle->card_type) || IS_PCIE9097(handle->card_type)) { if (RDWR_STATUS_FAILURE != @@ -1516,7 +1568,7 @@ static mlan_status woal_pcie_register_dev(moal_handle *handle) break; } -#if defined(PCIE9098) +#if defined(PCIE9098) || defined(PCIEAW693) if ((card->dev->device == PCIE_DEVICE_ID_88W9098P_FN1) || (card->dev->device == PCIE_DEVICE_ID_88WAW693_FN1)) mlan_set_int_mode(handle->pmlan_adapter, pcie_int_mode, 1); @@ -1644,7 +1696,8 @@ void woal_pcie_bus_unregister(void) LEAVE(); } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) #define PCIE9098_DUMP_CTRL_REG 0x1C94 #define PCIE9098_DUMP_START_REG 0x1C98 #define PCIE9098_DUMP_END_REG 0x1C9F @@ -1655,7 +1708,8 @@ void woal_pcie_bus_unregister(void) #define DEBUG_DUMP_END_REG 0xCFF #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) #define PCIE9098_SCRATCH_12_REG 0x1C90 #define PCIE9098_SCRATCH_14_REG 0x1C98 #define PCIE9098_SCRATCH_15_REG 0x1C9C @@ -1691,7 +1745,8 @@ static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) t_u32 dump_end_reg = 0; t_u32 scratch_14_reg = 0; t_u32 scratch_15_reg = 0; -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) /* Tx/Rx/Event AMDA start address */ t_u32 adma_reg_table[] = {0x10000, 0x10800, 0x10880, 0x11000, 0x11080}; t_u8 j; @@ -1731,7 +1786,8 @@ static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1776,7 +1832,8 @@ static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) } i++; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1855,7 +1912,8 @@ static void woal_pcie_reg_dbg(moal_handle *phandle) t_u32 dump_end_reg = 0; t_u32 scratch_14_reg = 0; t_u32 scratch_15_reg = 0; -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) /* Tx/Rx/Event AMDA start address */ t_u32 adma_reg_table[] = {0x10000, 0x10800, 0x10880, 0x11000, 0x11080}; t_u8 j; @@ -1889,7 +1947,8 @@ static void woal_pcie_reg_dbg(moal_handle *phandle) } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1929,7 +1988,8 @@ static void woal_pcie_reg_dbg(moal_handle *phandle) } i++; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -2020,7 +2080,7 @@ static memory_type_mapping mem_type_mapping_tbl_8897[] = { #endif #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) #define DEBUG_HOST_READY_8997 0xCC #define DEBUG_HOST_EVENT_READY 0xAA #define DEBUG_HOST_RESET_READY 0x99 @@ -2030,7 +2090,7 @@ static memory_type_mapping mem_type_mapping_tbl_8997 = {"DUMP", NULL, NULL, #endif #if defined(PCIE8897) || defined(PCIE8997) || defined(PCIE9098) || \ - defined(PCIE9097) || defined(PCIEIW624) + defined(PCIE9097) || defined(PCIEAW693) || defined(PCIEIW624) /** * @brief This function reads data by 8 bit from card register * @@ -2080,7 +2140,8 @@ static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -2101,7 +2162,8 @@ static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, dump_ctrl_reg, debug_host_ready); return RDWR_STATUS_FAILURE; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -2354,7 +2416,7 @@ done: #endif #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) /** * @brief This function dump firmware memory to file * @@ -2386,7 +2448,8 @@ static void woal_pcie_dump_fw_info_v2(moal_handle *phandle) PRINTM(MERROR, "Could not dump firmwware info\n"); return; } -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -2424,7 +2487,8 @@ static void woal_pcie_dump_fw_info_v2(moal_handle *phandle) if (RDWR_STATUS_FAILURE == woal_pcie_rdwr_firmware(phandle, doneflag, 0)) goto done; -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -2572,7 +2636,7 @@ done: */ static t_u8 woal_pcie_is_second_mac(moal_handle *handle) { -#if defined(PCIE9098) +#if defined(PCIE9098) || defined(PCIEAW693) pcie_service_card *card = (pcie_service_card *)handle->card; if ((card->dev->device == PCIE_DEVICE_ID_88W9098P_FN1) || (card->dev->device == PCIE_DEVICE_ID_88WAW693_FN1)) @@ -2597,7 +2661,7 @@ static void woal_pcie_dump_fw_info(moal_handle *phandle) woal_pcie_dump_fw_info_v1(phandle); #endif #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) if (IS_PCIE8997(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || @@ -2636,19 +2700,19 @@ static void woal_pcie_dump_fw_info(moal_handle *phandle) static mlan_status woal_pcie_get_fw_name(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; -#if defined(PCIE9098) +#if defined(PCIE9098) || defined(PCIEAW693) pcie_service_card *card = (pcie_service_card *)handle->card; moal_handle *ref_handle = NULL; #endif #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) t_u32 rev_id_reg = handle->card_info->rev_id_reg; t_u32 revision_id = 0; #endif #if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ - defined(PCIEIW624) + defined(PCIEAW693) || defined(PCIEIW624) t_u32 host_strap_reg = handle->card_info->host_strap_reg; t_u32 magic_reg = handle->card_info->magic_reg; t_u32 strap = 0; @@ -2658,9 +2722,13 @@ static mlan_status woal_pcie_get_fw_name(moal_handle *handle) t_u32 boot_mode_reg = handle->card_info->boot_mode_reg; t_u32 boot_mode; #endif + t_u32 value = 0; ENTER(); + /* Make sure device is awake before reading host interface registers */ + woal_pcie_read_reg(handle, handle->card_info->fw_wakeup_reg, &value); + if (handle->params.fw_name) { #ifdef PCIE9097 if (IS_PCIE9097(handle->card_type)) { @@ -2810,6 +2878,37 @@ static mlan_status woal_pcie_get_fw_name(moal_handle *handle) } } #endif +#ifdef PCIEAW693 + if (IS_PCIEAW693(handle->card_type)) { + if (card->dev->device == PCIE_DEVICE_ID_88WAW693_FN0) { + woal_pcie_read_reg(handle, rev_id_reg, &revision_id); + woal_pcie_read_reg(handle, host_strap_reg, &strap); + woal_pcie_read_reg(handle, magic_reg, &magic); + revision_id &= 0xff; + strap &= 0x7; + magic &= 0xff; + PRINTM(MCMND, + "magic=0x%x, strap=0x%x, revision_id=0x%x\n", + magic, strap, revision_id); + if (magic == CHIP_MAGIC_VALUE) { + if (strap == CARD_TYPE_PCIE_UART) + strcpy(handle->card_info->fw_name, + PCIEUARTAW693_DEFAULT_COMBO_FW_NAME); + else + strcpy(handle->card_info->fw_name, + PCIEAW693_DEFAULT_COMBO_FW_NAME); + } + } else { + ref_handle = (moal_handle *)handle->pref_mac; + if (ref_handle) { + strcpy(handle->card_info->fw_name, + ref_handle->card_info->fw_name); + strcpy(handle->card_info->fw_name_wlan, + ref_handle->card_info->fw_name_wlan); + } + } + } +#endif #ifdef PCIEIW624 if (IS_PCIEIW624(handle->card_type)) { woal_pcie_read_reg(handle, rev_id_reg, &revision_id); @@ -2901,6 +3000,7 @@ static int woal_pcie_reset_fw(moal_handle *handle) ret = -EFAULT; goto done; } + PRINTM(MMSG, "PCIE Trigger FW In-band Reset success."); done: LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_pcie.h b/mxm_wifiex/wlan_src/mlinux/moal_pcie.h index 28a3fb9..a60be64 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_pcie.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_pcie.h @@ -47,7 +47,7 @@ Change log: #define PCIE_DEVICE_ID_88W9097 (0x2b56) #endif -#if defined(PCIE9098) +#if defined(PCIE9098) || defined(PCIEAW693) /** PCIE device ID for 9098 card FN0 */ #define PCIE_DEVICE_ID_88W9098P_FN0 (0x2b43) /** PCIE device ID for 9098 card FN1 */ @@ -59,7 +59,7 @@ Change log: #define PCIE_DEVICE_ID_88WIW624 (0x3000) #endif -#if defined(PCIE9098) +#if defined(PCIE9098) || defined(PCIEAW693) /** PCIE device ID for AW693 card FN0 */ #define PCIE_DEVICE_ID_88WAW693_FN0 (0x3003) /** PCIE device ID for AW693 card FN1 */ @@ -91,6 +91,12 @@ Change log: #define PCIE8897_DEFAULT_WLAN_FW_NAME "nxp/pcie8897_wlan.bin" #endif /* PCIE8897*/ +#ifdef PCIEAW693 +#define PCIEUARTAW693_DEFAULT_COMBO_FW_NAME "nxp/pcieuartaw693_combo.bin" +#define PCIEAW693_DEFAULT_COMBO_FW_NAME "nxp/pcieuartaw693_combo.bin" +#define PCIEAW693_DEFAULT_WLAN_FW_NAME "nxp/pcieaw693_wlan.bin" +#endif /* PCIEAW693*/ + #ifdef PCIE9098 #define PCIE9098_Z1Z2 0x00 #define PCIE9098_A0 0x01 @@ -131,7 +137,8 @@ Change log: #define PCIEIW624_DEFAULT_WLAN_FW_NAME "nxp/pcieiw624_wlan.bin" #endif /* PCIEIW624 */ -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEAW693) || \ + defined(PCIEIW624) #define PCIE_NUM_MSIX_VECTORS 32 #else #define PCIE_NUM_MSIX_VECTORS 4 diff --git a/mxm_wifiex/wlan_src/mlinux/moal_priv.c b/mxm_wifiex/wlan_src/mlinux/moal_priv.c index 1f21df0..e5f0425 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_priv.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_priv.c @@ -3,7 +3,7 @@ * @brief This file contains standard ioctl functions * * - * Copyright 2008-2021 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -75,7 +75,7 @@ static t_u8 SupportedInfraBand[] = { */ static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) { - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; #ifdef REASSOCIATION mlan_bss_info bss_info; #endif @@ -86,7 +86,12 @@ static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) ENTER(); - memset(&ssid_bssid, 0, sizeof(ssid_bssid)); + ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + LEAVE(); + return -ENOMEM; + } mac_idx = 0; buflen = MIN(wrq->u.data.length, (sizeof(buf) - 1)); memset(buf, 0, sizeof(buf)); @@ -94,7 +99,7 @@ static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) if (buflen < (3 * ETH_ALEN) + 2) { PRINTM(MERROR, "Associate: Insufficient length in IOCTL input\n"); - + kfree(ssid_bssid); /* buffer should be at least 3 characters per BSSID octet "00:" ** plus a space separater and at least 1 char in the SSID */ @@ -105,6 +110,7 @@ static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) if (copy_from_user(buf, wrq->u.data.pointer, buflen) != 0) { /* copy_from_user failed */ PRINTM(MERROR, "Associate: copy from user failed\n"); + kfree(ssid_bssid); LEAVE(); return -EINVAL; } @@ -118,9 +124,11 @@ static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) if (buf[i] == ':') { mac_idx++; } else { - if (mac_idx < ETH_ALEN) - ssid_bssid.bssid[mac_idx] = + if (mac_idx < ETH_ALEN) { + // coverity[tainted_data: SUPPRESS] + ssid_bssid->bssid[mac_idx] = (t_u8)woal_atox(buf + i); + } while ((i < buflen) && (isxdigit(buf[i + 1]))) { /* Skip entire hex value */ @@ -133,17 +141,18 @@ static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) i++; /* Copy the SSID */ - ssid_bssid.ssid.ssid_len = buflen - i - 1; - moal_memcpy_ext(priv->phandle, ssid_bssid.ssid.ssid, buf + i, - sizeof(ssid_bssid.ssid.ssid), - sizeof(ssid_bssid.ssid.ssid)); + ssid_bssid->ssid.ssid_len = buflen - i - 1; + moal_memcpy_ext(priv->phandle, ssid_bssid->ssid.ssid, buf + i, + sizeof(ssid_bssid->ssid.ssid), + sizeof(ssid_bssid->ssid.ssid)); PRINTM(MCMND, "iwpriv assoc: AP=[" MACSTR "], ssid(%d)=[%s]\n", - MAC2STR(ssid_bssid.bssid), (int)ssid_bssid.ssid.ssid_len, - ssid_bssid.ssid.ssid); + MAC2STR(ssid_bssid->bssid), (int)ssid_bssid->ssid.ssid_len, + ssid_bssid->ssid.ssid); if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { + kfree(ssid_bssid); LEAVE(); return -EFAULT; } @@ -160,7 +169,7 @@ static int woal_associate_ssid_bssid(moal_private *priv, struct iwreq *wrq) sizeof(mlan_802_11_mac_addr)); } #endif /* REASSOCIATION */ - + kfree(ssid_bssid); LEAVE(); return 0; } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_proc.c b/mxm_wifiex/wlan_src/mlinux/moal_proc.c index 2197378..08f7289 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_proc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_proc.c @@ -3,7 +3,7 @@ * @brief This file contains functions for proc file. * * - * Copyright 2008-2022 NXP + * Copyright 2008-2022, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -26,6 +26,7 @@ Change log: ********************************************************/ #include "moal_main.h" +#include "moal_eth_ioctl.h" #ifdef UAP_SUPPORT #include "moal_uap.h" #endif @@ -64,9 +65,6 @@ static char *szModes[] = { }; #endif -mlan_status parse_arguments(t_u8 *pos, int *data, int datalen, - int *user_data_len); - /******************************************************** Global Variables ********************************************************/ @@ -455,7 +453,7 @@ static int parse_cmd52_string(const char *buffer, size_t len, int *func, } #endif -void woal_priv_get_tx_rx_ant(struct seq_file *sfp, moal_private *priv) +static void woal_priv_get_tx_rx_ant(struct seq_file *sfp, moal_private *priv) { int ret = 0; int data[4] = {0}; @@ -519,7 +517,7 @@ void woal_priv_get_tx_rx_ant(struct seq_file *sfp, moal_private *priv) return; } -mlan_status woal_priv_set_tx_rx_ant(moal_handle *handle, char *line) +static mlan_status woal_priv_set_tx_rx_ant(moal_handle *handle, char *line) { moal_private *priv = NULL; mlan_ioctl_req *req = NULL; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sdio.h b/mxm_wifiex/wlan_src/mlinux/moal_sdio.h index 4592b46..4c3ebb1 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sdio.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_sdio.h @@ -153,6 +153,13 @@ Change log: #define SDIW624_DEFAULT_WLAN_FW_NAME "nxp/sdiw624_wlan.bin" #endif /* SDIW624 */ +#ifdef SDAW693 +#define SDAW693_DEFAULT_COMBO_FW_NAME "nxp/sdsdwaw693_combo.bin" +#define SDUARTAW693_COMBO_FW_NAME "nxp/sduartw693_combo.bin" +#define SDSDAW693_COMBO_FW_NAME "sdsdaw693_combo.bin" +#define SDAW693_DEFAULT_WLAN_FW_NAME "nxp/sdaw693_wlan.bin" +#endif /* SDAW693 */ + #ifdef SD9177 #define SD9177_A0 0x00 #define SD9177_A1 0x01 diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c b/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c index 15cc332..1b968be 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c @@ -78,6 +78,12 @@ static moal_if_ops sdiommc_ops; /** Device ID for SD8987 */ #define SD_DEVICE_ID_8987 (0x9149) #endif +#ifdef SDAW693 +/** Device ID for SDAW693 */ +#define SD_DEVICE_ID_AW693_FN1 (0x0211) +/** Device ID for SDAW693 */ +#define SD_DEVICE_ID_AW693_FN2 (0x0212) +#endif #ifdef SD9098 /** Device ID for SD9098 */ #define SD_DEVICE_ID_9098_FN1 (0x914D) @@ -124,6 +130,10 @@ static const struct sdio_device_id wlan_ids[] = { #ifdef SD8987 {SDIO_DEVICE(MRVL_VENDOR_ID, SD_DEVICE_ID_8987)}, #endif +#ifdef SDAW693 + {SDIO_DEVICE(NXP_VENDOR_ID, SD_DEVICE_ID_AW693_FN1)}, + {SDIO_DEVICE(NXP_VENDOR_ID, SD_DEVICE_ID_AW693_FN2)}, +#endif #ifdef SD9098 {SDIO_DEVICE(MRVL_VENDOR_ID, SD_DEVICE_ID_9098_FN1)}, {SDIO_DEVICE(MRVL_VENDOR_ID, SD_DEVICE_ID_9098_FN2)}, @@ -428,6 +438,21 @@ static t_u16 woal_update_card_type(t_void *card) (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif +#ifdef SDAW693 + if (cardp_sd->func->device == SD_DEVICE_ID_AW693_FN1 || + cardp_sd->func->device == SD_DEVICE_ID_AW693_FN2) { + card_type = CARD_TYPE_SDAW693; + moal_memcpy_ext(NULL, driver_version, CARD_SDAW693, + strlen(CARD_SDAW693), strlen(driver_version)); + moal_memcpy_ext( + NULL, + driver_version + strlen(INTF_CARDTYPE) + + strlen(KERN_VERSION), + V17, strlen(V17), + strlen(driver_version) - + (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); + } +#endif #ifdef SD9097 if (cardp_sd->func->device == SD_DEVICE_ID_9097) { card_type = CARD_TYPE_SD9097; @@ -1445,10 +1470,14 @@ int woal_sdio_read_write_cmd52(moal_handle *handle, int func, int reg, int val) */ static t_u8 woal_sdiommc_is_second_mac(moal_handle *handle) { -#if defined(SD9098) +#if defined(SDAW693) || defined(SD9098) sdio_mmc_card *card = (sdio_mmc_card *)handle->card; #endif +#ifdef SDAW693 + if (card->func->device == SD_DEVICE_ID_AW693_FN2) + return MTRUE; +#endif #ifdef SD9098 if (card->func->device == SD_DEVICE_ID_9098_FN2) return MTRUE; @@ -1466,8 +1495,8 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) t_u32 rev_id_reg = handle->card_info->rev_id_reg; #if defined(SD8987) || defined(SD8997) || defined(SD9098) || \ - defined(SD9097) || defined(SDIW624) || defined(SD8978) || \ - defined(SD9177) || defined(SDIW615) + defined(SD9097) || defined(SDIW624) || defined(SDAW693) || \ + defined(SD8978) || defined(SD9177) || defined(SDIW615) t_u32 magic_reg = handle->card_info->magic_reg; t_u32 magic = 0; t_u32 host_strap_reg = handle->card_info->host_strap_reg; @@ -1487,8 +1516,8 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) PRINTM(MCMND, "revision_id=0x%x\n", revision_id); #if defined(SD8987) || defined(SD8997) || defined(SD9098) || \ - defined(SD9097) || defined(SDIW624) || defined(SD8978) || \ - defined(SD9177) || defined(SDIW615) + defined(SD9097) || defined(SDIW624) || defined(SDAW693) || \ + defined(SD8978) || defined(SD9177) || defined(SDIW615) /** Revision ID register */ woal_sdiommc_read_reg(handle, magic_reg, &magic); /** Revision ID register */ @@ -1653,6 +1682,20 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) } } #endif +#ifdef SDAW693 + if (IS_SDAW693(handle->card_type)) { + if (magic == CHIP_MAGIC_VALUE) { + if (strap == CARD_TYPE_SD_UART) + strncpy(handle->card_info->fw_name, + SDUARTAW693_COMBO_FW_NAME, + FW_NAMW_MAX_LEN); + else + strncpy(handle->card_info->fw_name, + SDSDAW693_COMBO_FW_NAME, + FW_NAMW_MAX_LEN); + } + } +#endif #ifdef SDIW624 if (IS_SDIW624(handle->card_type)) { @@ -2931,7 +2974,7 @@ static int woal_sdiommc_reset_fw(moal_handle *handle) goto done; } #if defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ - defined(SD9177) || defined(SDIW615) + defined(SDAW693) || defined(SD9177) || defined(SDIW615) if (IS_SD9098(handle->card_type) || IS_SD9097(handle->card_type) || IS_SDIW624(handle->card_type) || IS_SD9177(handle->card_type) || IS_SDIW615(handle->card_type) || IS_SDAW693(handle->card_type)) @@ -3064,6 +3107,17 @@ static mlan_status woal_do_sdiommc_flr(moal_handle *handle, bool prepare, } handle->pmlan_adapter = NULL; } +#ifdef DUMP_TO_PROC + if (handle->fw_dump_buf) { + moal_vfree(handle, handle->fw_dump_buf); + handle->fw_dump_buf = NULL; + handle->fw_dump_len = 0; + } +#endif +#ifdef SD9177 + if (IS_SD9177(handle->card_type)) + handle->event_fw_dump = MTRUE; +#endif goto exit; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_shim.c b/mxm_wifiex/wlan_src/mlinux/moal_shim.c index 88888b1..4c0736a 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_shim.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_shim.c @@ -3,7 +3,7 @@ * @brief This file contains the callback functions registered to MLAN * * - * Copyright 2008-2023 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -224,6 +224,10 @@ mlan_status moal_malloc_consistent(t_void *pmoal, t_u32 size, t_u8 **ppbuf, __func__, (int)size); return MLAN_STATUS_FAILURE; } +#ifdef PCIEAW693 + if (IS_PCIEAW693(handle->card_type)) + dma |= 0x100000000; +#endif *pbuf_pa = (t_u64)dma; atomic_inc(&handle->malloc_cons_count); @@ -248,6 +252,10 @@ mlan_status moal_mfree_consistent(t_void *pmoal, t_u32 size, t_u8 *pbuf, if (!pbuf || !card) return MLAN_STATUS_FAILURE; +#ifdef PCIEAW693 + if (IS_PCIEAW693(handle->card_type)) + buf_pa &= 0xffffffff; +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) dma_free_coherent(&card->dev->dev, size, pbuf, buf_pa); #else @@ -292,6 +300,10 @@ mlan_status moal_map_memory(t_void *pmoal, t_u8 *pbuf, t_u64 *pbuf_pa, PRINTM(MERROR, "Tx ring: failed to dma_map_single\n"); return MLAN_STATUS_FAILURE; } +#ifdef PCIEAW693 + if (IS_PCIEAW693(handle->card_type)) + dma |= 0x100000000; +#endif *pbuf_pa = dma; return MLAN_STATUS_SUCCESS; } @@ -315,6 +327,10 @@ mlan_status moal_unmap_memory(t_void *pmoal, t_u8 *pbuf, t_u64 buf_pa, if (!card) return MLAN_STATUS_FAILURE; +#ifdef PCIEAW693 + if (IS_PCIEAW693(handle->card_type)) + buf_pa &= 0xffffffff; +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) dma_unmap_single(&card->dev->dev, buf_pa, size, flag); #else @@ -1149,22 +1165,26 @@ mlan_status moal_send_packet_complete(t_void *pmoal, pmlan_buffer pmbuf, priv->stats.tx_bytes += skb->len; #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor( - priv, PACKET_TYPE_TX, - TX_PKT_FATE_SENT, - FRAME_TYPE_ETHERNET_II, 0, 0, - skb->data, skb->data_len); + if (drvdbg & MDAT_D) + woal_packet_fate_monitor( + priv, PACKET_TYPE_TX, + TX_PKT_FATE_SENT, + FRAME_TYPE_ETHERNET_II, + 0, 0, skb->data, + skb->data_len); #endif #endif } else { priv->stats.tx_errors++; #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor( - priv, PACKET_TYPE_TX, - TX_PKT_FATE_DRV_DROP_OTHER, - FRAME_TYPE_ETHERNET_II, 0, 0, - skb->data, skb->data_len); + if (drvdbg & MDAT_D) + woal_packet_fate_monitor( + priv, PACKET_TYPE_TX, + TX_PKT_FATE_DRV_DROP_OTHER, + FRAME_TYPE_ETHERNET_II, + 0, 0, skb->data, + skb->data_len); #endif #endif } @@ -1901,7 +1921,8 @@ done: * * @return binded net_device pointer or NULL if not found */ -struct net_device *moal_get_netdev_from_stalist(moal_private *priv, t_u16 aid) +static struct net_device *moal_get_netdev_from_stalist(moal_private *priv, + t_u16 aid) { station_node *sta_node = NULL; @@ -1941,6 +1962,11 @@ mlan_status moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf) t_u8 drop = 0; t_u8 rfc1042_eth_hdr[MLAN_MAC_ADDR_LENGTH] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; +#ifdef UAP_SUPPORT +#if defined(UAP_CFG80211) || defined(STA_CFG80211) + t_u16 aid = 0; +#endif +#endif wifi_timeval t1, t2; t_s32 delay; @@ -1962,6 +1988,19 @@ mlan_status moal_recv_amsdu_packet(t_void *pmoal, pmlan_buffer pmbuf) goto done; } netdev = priv->netdev; +#ifdef UAP_SUPPORT +#if defined(UAP_CFG80211) || defined(STA_CFG80211) + if (pmbuf->flags & MLAN_BUF_FLAG_EASYMESH) { + aid = (pmbuf->priority & 0xFF000000) >> 24; + if (!priv->vlan_sta_list[(aid - 1) % MAX_STA_COUNT]->is_valid) { + priv->stats.rx_dropped++; + goto done; + } + if (aid != 0) + netdev = moal_get_netdev_from_stalist(priv, aid); + } +#endif +#endif skb = (struct sk_buff *)pmbuf->pdesc; if (!skb) goto done; @@ -2210,13 +2249,15 @@ mlan_status moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf) priv->stats.rx_dropped++; #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor( - priv, PACKET_TYPE_RX, - RX_PKT_FATE_DRV_DROP_NOBUFS, - FRAME_TYPE_ETHERNET_II, 0, 0, - (t_u8 *)(pmbuf->pbuf + - pmbuf->data_offset), - pmbuf->data_len); + if (drvdbg & MDAT_D) + woal_packet_fate_monitor( + priv, PACKET_TYPE_RX, + RX_PKT_FATE_DRV_DROP_NOBUFS, + FRAME_TYPE_ETHERNET_II, + 0, 0, + (t_u8 *)(pmbuf->pbuf + + pmbuf->data_offset), + pmbuf->data_len); #endif #endif goto done; @@ -2266,6 +2307,22 @@ mlan_status moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf) } #endif #endif + if (priv->multi_ap_flag && + priv->bss_type == MLAN_BSS_TYPE_STA) { + t_u32 transaction_id; + transaction_id = + woal_get_dhcp_discover_transation_id( + skb); + if (transaction_id && + woal_get_dhcp_discover_info( + priv, transaction_id)) { + PRINTM(MDATA, + "Drop dhcp pkt, transation_id=%x\n", + transaction_id); + dev_kfree_skb(skb); + goto done; + } + } if (!netdev) netdev = priv->netdev; skb->dev = netdev; @@ -2315,11 +2372,12 @@ mlan_status moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf) priv->netdev->name); status = MLAN_STATUS_FAILURE; priv->stats.rx_dropped++; - woal_packet_fate_monitor( - priv, PACKET_TYPE_RX, - RX_PKT_FATE_DRV_DROP_FILTER, - FRAME_TYPE_ETHERNET_II, 0, 0, skb->data, - skb->len); + if (drvdbg & MDAT_D) + woal_packet_fate_monitor( + priv, PACKET_TYPE_RX, + RX_PKT_FATE_DRV_DROP_FILTER, + FRAME_TYPE_ETHERNET_II, 0, 0, + skb->data, skb->len); dev_kfree_skb(skb); goto done; } @@ -2329,10 +2387,12 @@ mlan_status moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf) priv->stats.rx_packets++; #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor(priv, PACKET_TYPE_RX, - RX_PKT_FATE_SUCCESS, - FRAME_TYPE_ETHERNET_II, 0, 0, - skb->data, skb->len); + if (drvdbg & MDAT_D) + woal_packet_fate_monitor(priv, PACKET_TYPE_RX, + RX_PKT_FATE_SUCCESS, + FRAME_TYPE_ETHERNET_II, + 0, 0, skb->data, + skb->len); #endif #endif #ifdef ANDROID_KERNEL @@ -2433,22 +2493,18 @@ void woal_request_busfreq_pmqos_add(t_void *handle) if (moal_extflg_isset(pmhandle, EXT_PMQOS)) { #if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 6, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) -#ifdef IMX_SUPPORT if (!pm_qos_request_active(&pmhandle->woal_pm_qos_req)) pm_qos_add_request(&pmhandle->woal_pm_qos_req, PM_QOS_CPU_DMA_LATENCY, 0); else PRINTM(MERROR, "PM-QOS request already active\n"); #endif -#endif #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) -#ifdef IMX_SUPPORT if (!cpu_latency_qos_request_active(&pmhandle->woal_pm_qos_req)) cpu_latency_qos_add_request(&pmhandle->woal_pm_qos_req, 0); else PRINTM(MERROR, "PM-QOS request already active\n"); -#endif #endif } return; @@ -2468,21 +2524,17 @@ void woal_release_busfreq_pmqos_remove(t_void *handle) if (moal_extflg_isset(pmhandle, EXT_PMQOS)) { #if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 6, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 36) -#ifdef IMX_SUPPORT if (pm_qos_request_active(&pmhandle->woal_pm_qos_req)) pm_qos_remove_request(&pmhandle->woal_pm_qos_req); else PRINTM(MERROR, "PM-QOS request already removed\n"); #endif -#endif #elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) -#ifdef IMX_SUPPORT if (cpu_latency_qos_request_active(&pmhandle->woal_pm_qos_req)) cpu_latency_qos_remove_request( &pmhandle->woal_pm_qos_req); else PRINTM(MERROR, "PM-QOS request already removed\n"); -#endif #endif } return; @@ -2582,7 +2634,7 @@ static void woal_rx_mgmt_pkt_event(moal_private *priv, t_u8 *pkt, t_u16 len) * * @return N/A */ -void woal_rgpower_key_mismatch_event(moal_private *priv) +static void woal_rgpower_key_mismatch_event(moal_private *priv) { struct woal_event *evt; unsigned long flags; @@ -2771,10 +2823,12 @@ t_void woal_process_event_tx_status(moal_private *priv, } #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor( - priv, PACKET_TYPE_TX, - ack ? TX_PKT_FATE_ACKED : TX_PKT_FATE_SENT, - FRAME_TYPE_80211_MGMT, 0, 0, skb->data, skb->len); + if (drvdbg & MDAT_D) + woal_packet_fate_monitor(priv, PACKET_TYPE_TX, + ack ? TX_PKT_FATE_ACKED : + TX_PKT_FATE_SENT, + FRAME_TYPE_80211_MGMT, 0, 0, + skb->data, skb->len); #endif #endif #endif @@ -4465,6 +4519,11 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #endif #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + // forward mgmt packet to kernel without (drvdbg + // & MDAT_D) because + // (few) userspace process needs this for + // processing disassoc/deauth event with reason + // code woal_packet_fate_monitor( priv, PACKET_TYPE_RX, RX_PKT_FATE_SUCCESS, @@ -4637,11 +4696,13 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) } #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_packet_fate_monitor(priv, PACKET_TYPE_TX, - ack ? TX_PKT_FATE_ACKED : - TX_PKT_FATE_SENT, - FRAME_TYPE_80211_MGMT, 0, 0, - skb->data, skb->len); + if (drvdbg & MDAT_D) + woal_packet_fate_monitor( + priv, PACKET_TYPE_TX, + ack ? TX_PKT_FATE_ACKED : + TX_PKT_FATE_SENT, + FRAME_TYPE_80211_MGMT, 0, 0, skb->data, + skb->len); #endif #endif #endif diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c index dcdc5ab..ead7e93 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c @@ -3,7 +3,7 @@ * @brief This file contains the functions for STA CFG80211. * * - * Copyright 2011-2023 NXP + * Copyright 2011-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -25,7 +25,7 @@ #include "moal_sta_cfg80211.h" #include "moal_eth_ioctl.h" #ifdef UAP_SUPPORT -#include "moal_uap.h" +#include "moal_uap_cfg80211.h" #endif #include @@ -315,13 +315,6 @@ static int woal_cfg80211_disassociate(struct wiphy *wiphy, struct cfg80211_disassoc_request *req); #endif -#ifdef UAP_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) -int woal_cfg80211_set_radar_background(struct wiphy *wiphy, - struct cfg80211_chan_def *chandef); -#endif -#endif - /** cfg80211 operations */ static struct cfg80211_ops woal_cfg80211_ops = { .change_virtual_intf = woal_cfg80211_change_virtual_intf, @@ -2102,7 +2095,7 @@ static int woal_cfg80211_auth_scan(moal_private *priv, * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING * -- success, otherwise fail */ -mlan_status woal_request_set_host_mlme(moal_private *priv, t_u8 *bssid) +static mlan_status woal_request_set_host_mlme(moal_private *priv, t_u8 *bssid) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -2610,7 +2603,11 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv, struct cfg80211_bss *bss = NULL; unsigned long flags; u8 *assoc_req_buf = NULL; -#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + struct cfg80211_rx_assoc_resp_data resp = { + .uapsd_queues = -1, + }; +#elif ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) struct cfg80211_rx_assoc_resp resp = { .uapsd_queues = -1, }; @@ -2674,10 +2671,17 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv, resp.req_ies = assoc_req_buf; resp.req_ies_len = assoc_info->assoc_req_len; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + wiphy_lock(priv->wdev->wiphy); + cfg80211_rx_assoc_resp(priv->netdev, + &resp); + wiphy_unlock(priv->wdev->wiphy); +#else mutex_lock(&priv->wdev->mtx); cfg80211_rx_assoc_resp(priv->netdev, &resp); mutex_unlock(&priv->wdev->mtx); +#endif #else #if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) mutex_lock(&priv->wdev->mtx); @@ -2734,9 +2738,16 @@ static void woal_assoc_resp_event(moal_private *priv, struct woal_event *evt; unsigned long flags; moal_handle *handle = priv->phandle; - mlan_ds_misc_assoc_req assoc_req; - memset(&assoc_req, 0, sizeof(mlan_ds_misc_assoc_req)); - woal_get_assoc_req(priv, &assoc_req, MOAL_IOCTL_WAIT); + mlan_ds_misc_assoc_req *assoc_req = NULL; + + assoc_req = kzalloc(sizeof(mlan_ds_misc_assoc_req), GFP_ATOMIC); + if (!assoc_req) { + PRINTM(MERROR, + "Fail to allocate mlan_ds_misc_assoc_req buffer\n"); + return; + } + + woal_get_assoc_req(priv, assoc_req, MOAL_IOCTL_WAIT); evt = kzalloc(sizeof(struct woal_event), GFP_ATOMIC); if (evt) { @@ -2748,10 +2759,10 @@ static void woal_assoc_resp_event(moal_private *priv, evt->assoc_info.assoc_resp_len = MIN(passoc_rsp->assoc_resp_len, ASSOC_RSP_BUF_SIZE); moal_memcpy_ext(priv->phandle, evt->assoc_info.assoc_req_buf, - assoc_req.assoc_req_buf, - assoc_req.assoc_req_len, ASSOC_RSP_BUF_SIZE); + assoc_req->assoc_req_buf, + assoc_req->assoc_req_len, ASSOC_RSP_BUF_SIZE); evt->assoc_info.assoc_req_len = - MIN(assoc_req.assoc_req_len, ASSOC_RSP_BUF_SIZE); + MIN(assoc_req->assoc_req_len, ASSOC_RSP_BUF_SIZE); INIT_LIST_HEAD(&evt->link); spin_lock_irqsave(&handle->evt_lock, flags); @@ -2759,6 +2770,9 @@ static void woal_assoc_resp_event(moal_private *priv, spin_unlock_irqrestore(&handle->evt_lock, flags); queue_work(handle->evt_workqueue, &handle->evt_work); } + kfree(assoc_req); + // coverity[leaked_storage:SUPPRESS] + return; } /** @@ -3696,8 +3710,8 @@ static int compare(const void *lhs, const void *rhs) * * @return N/A */ -t_u32 woal_get_chan_rule_flags(mlan_ds_custom_reg_domain *custom_reg, - t_u8 channel) +static t_u32 woal_get_chan_rule_flags(mlan_ds_custom_reg_domain *custom_reg, + t_u8 channel) { t_u16 num_chan = 0; t_u32 flags = 0; @@ -4271,7 +4285,7 @@ static t_u8 woal_is_uap_scan_result_expired(moal_private *priv) * * @return MTRUE/MFALSE; */ -t_u8 wlan_check_scan_table_ageout(moal_private *priv) +static t_u8 wlan_check_scan_table_ageout(moal_private *priv) { mlan_scan_resp scan_resp; wifi_timeval t; @@ -5141,7 +5155,7 @@ static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, unsigned long flags; mlan_ds_misc_assoc_rsp *assoc_rsp = NULL; IEEEtypes_AssocRsp_t *passoc_rsp = NULL; - mlan_ds_misc_assoc_req assoc_req; + mlan_ds_misc_assoc_req *assoc_req = NULL; mlan_ssid_bssid *ssid_bssid = NULL; moal_handle *handle = priv->phandle; @@ -5294,8 +5308,9 @@ static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, priv->ft_md = 0; priv->ft_cap = 0; } - memset(&assoc_req, 0, sizeof(mlan_ds_misc_assoc_req)); - woal_get_assoc_req(priv, &assoc_req, MOAL_IOCTL_WAIT); + assoc_req = kzalloc(sizeof(mlan_ds_misc_assoc_req), GFP_ATOMIC); + if (assoc_req) + woal_get_assoc_req(priv, assoc_req, MOAL_IOCTL_WAIT); } spin_lock_irqsave(&priv->connect_lock, flags); priv->cfg_connect = MFALSE; @@ -5305,8 +5320,8 @@ static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, MAC2STR(priv->cfg_bssid)); spin_unlock_irqrestore(&priv->connect_lock, flags); cfg80211_connect_result( - priv->netdev, priv->cfg_bssid, assoc_req.assoc_req_buf, - assoc_req.assoc_req_len, passoc_rsp->ie_buffer, + priv->netdev, priv->cfg_bssid, assoc_req->assoc_req_buf, + assoc_req->assoc_req_len, passoc_rsp->ie_buffer, assoc_rsp->assoc_resp_len - ASSOC_RESP_FIXED_SIZE, WLAN_STATUS_SUCCESS, GFP_KERNEL); } else { @@ -5319,6 +5334,7 @@ static int woal_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, GFP_KERNEL); } kfree(ssid_bssid); + kfree(assoc_req); kfree(assoc_rsp); assoc_rsp = NULL; LEAVE(); @@ -5555,7 +5571,9 @@ static int woal_cfg80211_disassociate(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (priv->host_mlme) { priv->delay_deauth_notify = MTRUE; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if (CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || \ + (defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33 && \ + CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 15, 74))) moal_memcpy_ext(priv->phandle, priv->bssid_notify, req->ap_addr, MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); #else @@ -9657,7 +9675,11 @@ void woal_host_mlme_disconnect(moal_private *priv, u16 reason_code, u8 *sa) } if (GET_BSS_ROLE(priv) != MLAN_BSS_ROLE_UAP) { -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + wiphy_lock(priv->wdev->wiphy); + cfg80211_rx_mlme_mgmt(priv->netdev, frame_buf, 26); + wiphy_unlock(priv->wdev->wiphy); +#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) mutex_lock(&priv->wdev->mtx); cfg80211_rx_mlme_mgmt(priv->netdev, frame_buf, 26); mutex_unlock(&priv->wdev->mtx); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap.c b/mxm_wifiex/wlan_src/mlinux/moal_uap.c index 7c0f70e..9ccbecf 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap.c @@ -4,7 +4,7 @@ * driver. * * - * Copyright 2008-2022 NXP + * Copyright 2008-2022, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -2213,7 +2213,7 @@ static int woal_uap_get_dfs_chan(t_u8 pri_chan, t_u8 bw, * * @return N/A */ -void woal_set_channel_dfs_state(t_u8 channel, t_u8 dfs_state) +static void woal_set_channel_dfs_state(t_u8 channel, t_u8 dfs_state) { int index; mlan_ds_11h_chan_dfs_state ch_dfs_state; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c index f853522..8b38b6b 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c @@ -3,7 +3,7 @@ * @brief This file contains the functions for uAP CFG80211. * * - * Copyright 2011-2023 NXP + * Copyright 2011-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -1791,8 +1791,12 @@ static int woal_cfg80211_add_vlan_vir_if(struct wiphy *wiphy, sizeof(ndev->perm_addr)); moal_memcpy_ext(handle, ndev->perm_addr, priv->current_addr, ETH_ALEN, sizeof(ndev->perm_addr)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0) + eth_hw_addr_set(ndev, priv->current_addr); +#else moal_memcpy_ext(handle, (t_void *)ndev->dev_addr, ndev->perm_addr, ETH_ALEN, MAX_ADDR_LEN); +#endif SET_NETDEV_DEV(ndev, wiphy_dev(wiphy)); ndev->watchdog_timeo = MRVDRV_DEFAULT_UAP_WATCHDOG_TIMEOUT; @@ -1827,9 +1831,18 @@ static int woal_cfg80211_add_vlan_vir_if(struct wiphy *wiphy, ndev->ieee80211_ptr->use_4addr = params->use_4addr; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) + ret = cfg80211_register_netdevice(ndev); +#else ret = register_netdevice(ndev); +#endif if (ret) { PRINTM(MFATAL, "register net_device failed, ret=%d\n", ret); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) + cfg80211_unregister_netdevice(ndev); +#else + unregister_netdevice(ndev); +#endif free_netdev(ndev); goto fail; } @@ -1951,6 +1964,11 @@ moal_private *woal_alloc_virt_interface(moal_handle *handle, t_u8 bss_index, INIT_LIST_HEAD(&priv->mcast_list); spin_lock_init(&priv->mcast_lock); +#ifdef STA_CFG80211 + INIT_LIST_HEAD(&priv->dhcp_discover_queue); + spin_lock_init(&priv->dhcp_discover_lock); +#endif + spin_lock_init(&priv->connect_lock); #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) @@ -2668,7 +2686,11 @@ int woal_cfg80211_del_virtual_intf(struct wiphy *wiphy, PRINTM(MCMND, "wlan: Easymesh del Vlan aid=%d\n", aid); vlan_priv->parent_priv->vlan_sta_list[(aid - 1) % MAX_STA_COUNT] ->is_valid = MFALSE; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) + cfg80211_unregister_netdevice(dev); +#else unregister_netdevice(dev); +#endif LEAVE(); return ret; } @@ -2907,7 +2929,18 @@ done: return ret; } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) +/** + * @brief set AP or GO parameter + * + * @param wiphy A pointer to wiphy structure + * @param dev A pointer to net_device structure + * @param info A pointer to cfg80211_ap_update structure + * @return 0 -- success, otherwise fail + */ +int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, + struct cfg80211_ap_update *info) +#elif CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 4, 0) /** * @brief set AP or GO parameter * @@ -2932,6 +2965,9 @@ int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev, #endif { moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + struct cfg80211_beacon_data *params = &info->beacon; +#endif int ret = 0; ENTER(); @@ -3007,7 +3043,6 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) #ifdef STA_SUPPORT moal_private *pmpriv = NULL; #endif - int i; ENTER(); @@ -3093,19 +3128,7 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) memset(priv->uap_wep_key, 0, sizeof(priv->uap_wep_key)); priv->channel = 0; priv->bandwidth = 0; -#ifdef UAP_SUPPORT - priv->multi_ap_flag = 0; - /* Clear the whole backhaul station list in moal */ - for (i = 0; i < MAX_STA_COUNT; i++) { - if (priv->vlan_sta_list[i]) { - if (priv->vlan_sta_list[i]->is_valid) - unregister_netdevice( - priv->vlan_sta_list[i]->netdev); - kfree(priv->vlan_sta_list[i]); - } - priv->vlan_sta_list[i] = NULL; - } -#endif + PRINTM(MMSG, "wlan: %s AP stopped\n", dev->name); done: LEAVE(); @@ -3234,6 +3257,11 @@ int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, #endif u16 reason_code = REASON_CODE_DEAUTH_LEAVING; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); +#ifdef UAP_SUPPORT +#if defined(UAP_CFG80211) || defined(STA_CFG80211) + int i; +#endif +#endif ENTER(); #ifdef UAP_SUPPORT @@ -3265,6 +3293,25 @@ int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, } else { PRINTM(MIOCTL, "del station\n"); } + +#ifdef UAP_SUPPORT +#if defined(UAP_CFG80211) || defined(STA_CFG80211) + if (mac_addr) { + for (i = 0; i < MAX_STA_COUNT; i++) { + if (priv->vlan_sta_list[i] && + !moal_memcmp(priv->phandle, + priv->vlan_sta_list[i]->peer_mac, + (u8 *)mac_addr, + MLAN_MAC_ADDR_LENGTH)) { + kfree(priv->vlan_sta_list[i]); + priv->vlan_sta_list[i] = NULL; + break; + } + } + } +#endif +#endif + LEAVE(); return 0; } @@ -3732,6 +3779,10 @@ void woal_cac_timer_func(void *context) static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) { chan_band_info uap_channel; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + struct cfg80211_ap_update *info = container_of( + &priv->beacon_after, struct cfg80211_ap_update, beacon); +#endif t_u8 chan2Offset = SEC_CHAN_NONE; ENTER(); woal_clear_all_mgmt_ies(priv, MOAL_IOCTL_WAIT); @@ -3739,8 +3790,13 @@ static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) PRINTM(MERROR, "%s: stop uap failed \n", __func__); goto done; } + +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + if (woal_cfg80211_set_beacon(priv->wdev->wiphy, priv->netdev, info)) { +#else if (woal_cfg80211_set_beacon(priv->wdev->wiphy, priv->netdev, &priv->beacon_after)) { +#endif PRINTM(MERROR, "%s: set mgmt ies failed \n", __func__); goto done; } @@ -3803,9 +3859,9 @@ static void woal_switch_uap_channel(moal_private *priv, t_u8 wait_option) cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0, 0); #elif ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || \ IMX_ANDROID_13 || IMX_ANDROID_12_BACKPORT) - cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0); +cfg80211_ch_switch_notify(priv->netdev, &priv->chan, 0); #else - cfg80211_ch_switch_notify(priv->netdev, &priv->chan); +cfg80211_ch_switch_notify(priv->netdev, &priv->chan); #endif if (priv->uap_tx_blocked) { if (!netif_carrier_ok(priv->netdev)) @@ -4035,6 +4091,10 @@ int woal_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); t_u32 chsw_msec; mlan_uap_bss_param *bss_cfg = NULL; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + struct cfg80211_ap_update *info = container_of( + ¶ms->beacon_csa, struct cfg80211_ap_update, beacon); +#endif ENTER(); @@ -4070,7 +4130,11 @@ int woal_cfg80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, } woal_clear_all_mgmt_ies(priv, MOAL_IOCTL_WAIT); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0) + if (woal_cfg80211_set_beacon(wiphy, dev, info)) { +#else if (woal_cfg80211_set_beacon(wiphy, dev, ¶ms->beacon_csa)) { +#endif PRINTM(MERROR, "%s: setting csa mgmt ies failed\n", __func__); goto done; } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.h b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.h index 7d6c805..81e8fac 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.h @@ -3,7 +3,7 @@ * @brief This file contains the uAP CFG80211 specific defines. * * - * Copyright 2011-2021 NXP + * Copyright 2011-2021, 2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -27,4 +27,11 @@ mlan_status woal_register_uap_cfg80211(struct net_device *dev, t_u8 bss_type); +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) +int woal_cfg80211_set_radar_background(struct wiphy *wiphy, + struct cfg80211_chan_def *chandef); +#endif +#endif + #endif /* _MOAL_UAP_CFG80211_H_ */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_wext.c b/mxm_wifiex/wlan_src/mlinux/moal_wext.c index 06f6651..8f686ff 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_wext.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_wext.c @@ -3,7 +3,7 @@ * @brief This file contains wireless extension standard ioctl functions * * - * Copyright 2008-2021 NXP + * Copyright 2008-2024 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -618,7 +618,7 @@ static int woal_set_wap(struct net_device *dev, struct iw_request_info *info, const t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; moal_private *priv = (moal_private *)netdev_priv(dev); struct sockaddr *awrq = &wrqu->addr; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; mlan_bss_info bss_info; ENTER(); @@ -650,29 +650,34 @@ static int woal_set_wap(struct net_device *dev, struct iw_request_info *info, } /* Broadcast MAC means search for best network */ - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); - + ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + ret = -ENOMEM; + goto done; + } if (memcmp(bcast, awrq->sa_data, MLAN_MAC_ADDR_LENGTH)) { /* Check if we are already assoicated to the AP */ if (bss_info.media_connected == MTRUE) { if (!memcmp(awrq->sa_data, &bss_info.bssid, ETH_ALEN)) goto done; } - moal_memcpy_ext(priv->phandle, &ssid_bssid.bssid, awrq->sa_data, - ETH_ALEN, sizeof(ssid_bssid.bssid)); + moal_memcpy_ext(priv->phandle, &ssid_bssid->bssid, + awrq->sa_data, ETH_ALEN, + sizeof(ssid_bssid->bssid)); } if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_find_best_network(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { PRINTM(MERROR, "ASSOC: WAP: MAC address not found in BSSID List\n"); ret = -ENETUNREACH; goto done; } /* Zero SSID implies use BSSID to connect */ - memset(&ssid_bssid.ssid, 0, sizeof(mlan_802_11_ssid)); + memset(&ssid_bssid->ssid, 0, sizeof(mlan_802_11_ssid)); if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { ret = -EFAULT; goto done; } @@ -693,7 +698,8 @@ static int woal_set_wap(struct net_device *dev, struct iw_request_info *info, #endif /* REASSOCIATION */ done: - + if (ssid_bssid) + kfree(ssid_bssid); LEAVE(); return ret; } @@ -1176,6 +1182,13 @@ static int woal_get_encode(struct net_device *dev, struct iw_request_info *info, dwrq->flags = IW_ENCODE_RESTRICTED; break; + case MLAN_AUTH_MODE_SAE: + dwrq->flags = IW_ENCODE_RESTRICTED; + break; + case MLAN_AUTH_MODE_OWE: + dwrq->flags = IW_ENCODE_OPEN; + break; + case MLAN_AUTH_MODE_AUTO: dwrq->flags = IW_ENCODE_OPEN | IW_ENCODE_RESTRICTED; break; @@ -2654,7 +2667,7 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, moal_private *priv = (moal_private *)netdev_priv(dev); struct iw_point *dwrq = &wrqu->data; mlan_802_11_ssid req_ssid; - mlan_ssid_bssid ssid_bssid; + mlan_ssid_bssid *ssid_bssid = NULL; mlan_ssid_bssid *owe_ssid_bssid = NULL; #ifdef REASSOCIATION moal_handle *handle = priv->phandle; @@ -2684,7 +2697,12 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) woal_set_scan_type(priv, MLAN_SCAN_TYPE_ACTIVE); memset(&req_ssid, 0, sizeof(mlan_802_11_ssid)); - memset(&ssid_bssid, 0, sizeof(mlan_ssid_bssid)); + ssid_bssid = kzalloc(sizeof(mlan_ssid_bssid), GFP_ATOMIC); + if (!ssid_bssid) { + PRINTM(MERROR, "Fail to allocate ssid_bssid buffer\n"); + ret = -ENOMEM; + goto setessid_ret; + } #if WIRELESS_EXT > 20 req_ssid.ssid_len = dwrq->length; @@ -2725,10 +2743,10 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, PRINTM(MINFO, "Requested new SSID = %s\n", (char *)req_ssid.ssid); - moal_memcpy_ext(priv->phandle, &ssid_bssid.ssid, &req_ssid, + moal_memcpy_ext(priv->phandle, &ssid_bssid->ssid, &req_ssid, sizeof(mlan_802_11_ssid), - sizeof(ssid_bssid.ssid)); - if (MTRUE == woal_is_connected(priv, &ssid_bssid)) { + sizeof(mlan_802_11_ssid)); + if (MTRUE == woal_is_connected(priv, ssid_bssid)) { PRINTM(MIOCTL, "Already connect to the network\n"); goto setessid_ret; } @@ -2767,7 +2785,7 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, if (dwrq->flags != 0xFFFF) { if (MLAN_STATUS_SUCCESS != - woal_find_essid(priv, &ssid_bssid, + woal_find_essid(priv, ssid_bssid, MOAL_IOCTL_WAIT)) { /* Do specific SSID scanning */ if (MLAN_STATUS_SUCCESS != @@ -2792,13 +2810,12 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, if (mode != IW_MODE_ADHOC) { if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, MOAL_IOCTL_WAIT, - &ssid_bssid)) { + woal_find_best_network(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { ret = -EFAULT; goto setessid_ret; } - if (ssid_bssid.trans_ssid.ssid_len && - (ssid_bssid.owe_transition_mode == OWE_TRANS_MODE_OPEN)) { + if (ssid_bssid->trans_ssid.ssid_len && + (ssid_bssid->owe_transition_mode == OWE_TRANS_MODE_OPEN)) { // We need scan for OWE AP owe_ssid_bssid = (mlan_ssid_bssid *)kmalloc( sizeof(mlan_ssid_bssid), GFP_KERNEL); @@ -2807,34 +2824,34 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, ret = -ENOMEM; goto setessid_ret; } - woal_owe_specific_scan(priv, &ssid_bssid); + woal_owe_specific_scan(priv, ssid_bssid); memset(owe_ssid_bssid, 0, sizeof(mlan_ssid_bssid)); moal_memcpy_ext(priv->phandle, &owe_ssid_bssid->ssid, - &ssid_bssid.trans_ssid, + &ssid_bssid->trans_ssid, sizeof(mlan_802_11_ssid), sizeof(owe_ssid_bssid->ssid)); moal_memcpy_ext(priv->phandle, &owe_ssid_bssid->bssid, - &ssid_bssid.trans_bssid, + &ssid_bssid->trans_bssid, sizeof(mlan_802_11_mac_addr), sizeof(owe_ssid_bssid->bssid)); if (MLAN_STATUS_SUCCESS == woal_find_essid(priv, owe_ssid_bssid, MOAL_IOCTL_WAIT)) - moal_memcpy_ext(priv->phandle, &ssid_bssid, + moal_memcpy_ext(priv->phandle, ssid_bssid, owe_ssid_bssid, sizeof(mlan_ssid_bssid), - sizeof(ssid_bssid)); + sizeof(mlan_ssid_bssid)); } if (MLAN_STATUS_SUCCESS != woal_11d_check_ap_channel(priv, MOAL_IOCTL_WAIT, - &ssid_bssid)) { + ssid_bssid)) { PRINTM(MERROR, "The AP's channel is invalid for current region\n"); ret = -EFAULT; goto setessid_ret; } } else if (MLAN_STATUS_SUCCESS != - woal_find_best_network(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) + woal_find_best_network(priv, MOAL_IOCTL_WAIT, ssid_bssid)) /* Adhoc start, Check the channel command */ woal_11h_channel_check_ioctl(priv, MOAL_IOCTL_WAIT); @@ -2849,10 +2866,10 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, #endif /* REASSOCIATION */ /* Connect to BSS by ESSID */ - memset(&ssid_bssid.bssid, 0, MLAN_MAC_ADDR_LENGTH); + memset(&ssid_bssid->bssid, 0, MLAN_MAC_ADDR_LENGTH); if (MLAN_STATUS_SUCCESS != - woal_bss_start(priv, MOAL_IOCTL_WAIT, &ssid_bssid)) { + woal_bss_start(priv, MOAL_IOCTL_WAIT, ssid_bssid)) { ret = -EFAULT; goto setessid_ret; } @@ -2873,6 +2890,8 @@ static int woal_set_essid(struct net_device *dev, struct iw_request_info *info, #endif /* REASSOCIATION */ setessid_ret: + if (ssid_bssid) + kfree(ssid_bssid); if (priv->scan_type == MLAN_SCAN_TYPE_PASSIVE) woal_set_scan_type(priv, MLAN_SCAN_TYPE_PASSIVE); #ifdef REASSOCIATION diff --git a/mxm_wifiex/wlan_src/script/unload b/mxm_wifiex/wlan_src/script/unload index 4f2a306..03d3e78 100644 --- a/mxm_wifiex/wlan_src/script/unload +++ b/mxm_wifiex/wlan_src/script/unload @@ -9,6 +9,8 @@ ifconfig wfd0 down ifconfig wfd1 down ifconfig mwfd0 down ifconfig mwfd1 down +ifconfig nan0 down +ifconfig mnan0 down for (( i = 0; i <= 30; i++ )) do rmmod moal 2> /dev/null