diff --git a/mxm_wifiex/wlan_src/Makefile b/mxm_wifiex/wlan_src/Makefile index a53b04a..166b409 100644 --- a/mxm_wifiex/wlan_src/Makefile +++ b/mxm_wifiex/wlan_src/Makefile @@ -106,7 +106,7 @@ CONFIG_MULTI_CHAN_SUPPORT=y CONFIG_DUMP_TO_PROC=y -CONFIG_TASKLET_SUPPORT=n +CONFIG_TASKLET_SUPPORT=y #32bit app over 64bit kernel support diff --git a/mxm_wifiex/wlan_src/README b/mxm_wifiex/wlan_src/README index 4574419..bfc3767 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.3.0. + The driver code supports Linux kernel from 2.6.32 to 6.4.7. 2) FOR DRIVER INSTALL diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c index ae3fb6b..769351a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c @@ -214,8 +214,12 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, t_u32 cfg_value = 0; t_u32 hw_value = 0; t_u8 nss = 0; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0; t_u16 tx_nss = 0; +#endif ENTER(); @@ -294,9 +298,13 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, /** update the RX MCS map */ 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) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type)) { + IS_CARD9097(pmadapter->card_type) || + IS_CARDAW693(pmadapter->card_type)) { if (cfg->param.vht_cfg.band == BAND_SELECT_A) { rx_nss = GET_RXMCSSUPP( pmadapter->user_htstream >> 8); @@ -314,6 +322,7 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, 0x0f; } } +#endif /* use the previous user value */ if (cfg->param.vht_cfg.vht_rx_mcs == 0xffffffff) cfg->param.vht_cfg.vht_rx_mcs = GET_VHTMCS( @@ -324,8 +333,12 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, hw_value = GET_DEVNSSRXMCS( pmadapter->hw_dot_11ac_mcs_support, nss); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; +#endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) SET_VHTNSSMCS( @@ -348,8 +361,12 @@ static mlan_status wlan_11ac_ioctl_vhtcfg(pmlan_adapter pmadapter, hw_value = GET_DEVNSSTXMCS( pmadapter->hw_dot_11ac_mcs_support, nss); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; +#endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) SET_VHTNSSMCS( @@ -770,7 +787,11 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, t_u16 mcs_user = 0; t_u16 mcs_resp = 0; t_u16 nss; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0, tx_nss = 0; +#endif ENTER(); /* Fill VHT cap info */ @@ -788,9 +809,13 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, if (flag) mcs_map_resp = 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) if (IS_CARD9098(priv->adapter->card_type) || IS_CARDIW624(priv->adapter->card_type) || - IS_CARD9097(priv->adapter->card_type)) { + IS_CARD9097(priv->adapter->card_type) || + IS_CARDAW693(priv->adapter->card_type)) { if (bands & BAND_A) { rx_nss = GET_RXMCSSUPP(priv->adapter->user_htstream >> 8); @@ -806,12 +831,17 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, if (bw_80p80) rx_nss = tx_nss = 1; } +#endif mcs_map_result = 0; for (nss = 1; nss <= 8; nss++) { mcs_user = GET_VHTNSSMCS(mcs_map_user, nss); 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) if ((rx_nss != 0) && (nss > rx_nss)) mcs_user = NO_NSS_SUPPORT; +#endif if ((mcs_user == NO_NSS_SUPPORT) || (mcs_resp == NO_NSS_SUPPORT)) SET_VHTNSSMCS(mcs_map_result, nss, NO_NSS_SUPPORT); @@ -839,8 +869,12 @@ void wlan_fill_vht_cap_tlv(mlan_private *priv, MrvlIETypes_VHTCap_t *pvht_cap, for (nss = 1; nss <= 8; nss++) { mcs_user = GET_VHTNSSMCS(mcs_map_user, nss); 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) if ((tx_nss != 0) && (nss > tx_nss)) mcs_user = NO_NSS_SUPPORT; +#endif if ((mcs_user == NO_NSS_SUPPORT) || (mcs_resp == NO_NSS_SUPPORT)) SET_VHTNSSMCS(mcs_map_result, nss, NO_NSS_SUPPORT); @@ -1052,16 +1086,24 @@ void wlan_fill_tdls_vht_oprat_ie(mlan_private *priv, 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) t_u16 rx_nss = 0, tx_nss = 0; IEEEtypes_VHTCap_t *pvht_cap = pbss_desc->pvht_cap; MrvlIEtypes_He_cap_t *phecap = MNULL; IEEEtypes_HECap_t *pBsshecap = MNULL; +#endif ENTER(); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + 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)) + !IS_CARD9097(pmpriv->adapter->card_type) && + !IS_CARDAW693(pmpriv->adapter->card_type)) return ret; /** check band A */ if (!(pbss_desc->bss_band & BAND_A)) @@ -1087,6 +1129,7 @@ t_u8 wlan_is_80_80_support(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc) else ret = MFALSE; } +#endif LEAVE(); return ret; } @@ -1110,7 +1153,11 @@ int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, t_u16 nss; int ret_len = 0; t_u8 bw_80p80 = MFALSE; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0; +#endif ENTER(); @@ -1178,9 +1225,13 @@ int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, } else { /** set default bandwidth:80M*/ 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) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type)) { + IS_CARD9097(pmadapter->card_type) || + IS_CARDAW693(pmadapter->card_type)) { if (pbss_desc->bss_band & BAND_A) rx_nss = GET_RXMCSSUPP( pmadapter->user_htstream >> 8); @@ -1188,16 +1239,22 @@ int wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, rx_nss = GET_RXMCSSUPP(pmadapter->user_htstream); } +#endif mcs_map_user = GET_DEVRXMCSMAP(pmpriv->usr_dot_11ac_mcs_support); nss = wlan_get_nss_num_vht_mcs(mcs_map_user); +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type)) { + IS_CARD9097(pmadapter->card_type) || + IS_CARDAW693(pmadapter->card_type)) { PRINTM(MCMND, "rx_nss=%d nss=%d\n", rx_nss, nss); nss = MIN(rx_nss, nss); } +#endif pmrvl_oper_mode->oper_mode |= (nss - 1) << 4; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c index 5e88d0d..ff26f97 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c @@ -295,7 +295,11 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, { pmlan_adapter pmadapter = pmpriv->adapter; t_u16 len = 0; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0, tx_nss = 0; +#endif MrvlIEtypes_He_cap_t *phecap = MNULL; t_u8 nss = 0; t_u16 cfg_value = 0; @@ -321,8 +325,12 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, } phe_cap->type = wlan_cpu_to_le16(phe_cap->type); 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) if (IS_CARD9098(pmpriv->adapter->card_type) || - IS_CARD9097(pmpriv->adapter->card_type)) { + IS_CARD9097(pmpriv->adapter->card_type) || + IS_CARDAW693(pmpriv->adapter->card_type)) { if (band & BAND_AAX) { rx_nss = GET_RXMCSSUPP(pmpriv->adapter->user_htstream >> 8); @@ -335,12 +343,17 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, 0x0f; } } +#endif phecap = (MrvlIEtypes_He_cap_t *)phe_cap; for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->rx_mcs_80, nss); 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) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; +#endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->rx_mcs_80, nss, NO_NSS_SUPPORT); @@ -351,8 +364,12 @@ t_u16 wlan_fill_he_cap_tlv(mlan_private *pmpriv, t_u16 band, for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->tx_mcs_80, nss); 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) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; +#endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->tx_mcs_80, nss, NO_NSS_SUPPORT); @@ -384,7 +401,11 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, MrvlIEtypes_He_cap_t *phecap = MNULL; int len = 0; t_u8 bw_80p80 = MFALSE; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) t_u16 rx_nss = 0, tx_nss = 0; +#endif t_u8 nss = 0; t_u16 cfg_value = 0; t_u16 hw_value = 0; @@ -425,9 +446,13 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, } phecap->type = wlan_cpu_to_le16(phecap->type); 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) if (IS_CARD9098(pmpriv->adapter->card_type) || IS_CARDIW624(pmpriv->adapter->card_type) || - IS_CARD9097(pmpriv->adapter->card_type)) { + IS_CARD9097(pmpriv->adapter->card_type) || + IS_CARDAW693(pmpriv->adapter->card_type)) { if (pbss_desc->bss_band & band_selected) { rx_nss = GET_RXMCSSUPP(pmpriv->adapter->user_htstream >> 8); @@ -443,11 +468,16 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, if (bw_80p80) rx_nss = tx_nss = 1; } +#endif for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->rx_mcs_80, nss); 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) if ((rx_nss != 0) && (nss > rx_nss)) cfg_value = NO_NSS_SUPPORT; +#endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->rx_mcs_80, nss, NO_NSS_SUPPORT); @@ -458,8 +488,12 @@ int wlan_cmd_append_11ax_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, for (nss = 1; nss <= 8; nss++) { cfg_value = GET_HE_NSSMCS(phecap->tx_mcs_80, nss); 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) if ((tx_nss != 0) && (nss > tx_nss)) cfg_value = NO_NSS_SUPPORT; +#endif if ((hw_value == NO_NSS_SUPPORT) || (cfg_value == NO_NSS_SUPPORT)) SET_HE_NSSMCS(phecap->tx_mcs_80, nss, NO_NSS_SUPPORT); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11d.c b/mxm_wifiex/wlan_src/mlan/mlan_11d.c index 947d146..e1cc67a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11d.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11d.c @@ -853,6 +853,8 @@ mlan_status wlan_cmd_802_11d_domain_info(mlan_private *pmpriv, MrvlIEtypes_DomainParamSet_t *domain = &pdomain_info->domain; t_u8 no_of_sub_band = pmadapter->domain_reg.no_of_sub_band; MrvlIEtypes_Rgn_dom_code_t *rgn = MNULL; + t_u8 *tlv = MNULL; + t_u8 i; ENTER(); @@ -881,7 +883,10 @@ mlan_status wlan_cmd_802_11d_domain_info(mlan_private *pmpriv, return MLAN_STATUS_SUCCESS; } + tlv = (t_u8 *)&pdomain_info->domain; + /* Set domain info fields */ + domain = (MrvlIEtypes_DomainParamSet_t *)tlv; domain->header.type = wlan_cpu_to_le16(TLV_TYPE_DOMAIN); memcpy_ext(pmadapter, domain->country_code, pmadapter->domain_reg.country_code, @@ -898,20 +903,22 @@ mlan_status wlan_cmd_802_11d_domain_info(mlan_private *pmpriv, MRVDRV_MAX_SUBBAND_802_11D * sizeof(IEEEtypes_SubbandSet_t)); - pcmd->size = sizeof(pdomain_info->action) + domain->header.len + - sizeof(MrvlIEtypesHeader_t) + S_DS_GEN; + pcmd->size += sizeof(pdomain_info->action) + + domain->header.len + sizeof(MrvlIEtypesHeader_t) + + S_DS_GEN; + + tlv += domain->header.len + sizeof(MrvlIEtypesHeader_t); if (pmadapter->domain_reg.dfs_region != NXP_DFS_UNKNOWN) { - rgn = (MrvlIEtypes_Rgn_dom_code_t - *)((t_u8 *)&pdomain_info->domain + - domain->header.len + - sizeof(MrvlIEtypesHeader_t)); + rgn = (MrvlIEtypes_Rgn_dom_code_t *)tlv; rgn->header.type = wlan_cpu_to_le16(TLV_TYPE_REGION_DOMAIN_CODE); rgn->header.len = 2; rgn->domain_code = pmadapter->domain_reg.dfs_region; pcmd->size += sizeof(MrvlIEtypes_Rgn_dom_code_t); + tlv += sizeof(MrvlIEtypes_Rgn_dom_code_t); } + } else { pcmd->size = sizeof(pdomain_info->action) + S_DS_GEN; } diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11h.c b/mxm_wifiex/wlan_src/mlan/mlan_11h.c index 7453dd9..8252b8b 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11h.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11h.c @@ -197,7 +197,7 @@ static t_u32 wlan_11h_convert_ieee_to_mrvl_ie(mlan_adapter *pmadapter, LEAVE(); /* Return the number of bytes appended to pout_buf */ - return sizeof(mrvl_ie_hdr) + pin_ie[1]; + return (t_u32)(sizeof(mrvl_ie_hdr) + pin_ie[1]); } /** @@ -3530,6 +3530,12 @@ mlan_status wlan_11h_ioctl_chan_dfs_state(pmlan_adapter pmadapter, priv, BAND_A, ds_11hcfg->param.ch_dfs_state.channel); } else { + if (ds_11hcfg->param.ch_dfs_state.dfs_state == + DFS_UNAVAILABLE) { + wlan_11h_add_dfs_timestamp( + pmadapter, DFS_TS_REPR_NOP_START, + ds_11hcfg->param.ch_dfs_state.channel); + } wlan_set_chan_dfs_state( priv, BAND_A, ds_11hcfg->param.ch_dfs_state.channel, diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11n.c b/mxm_wifiex/wlan_src/mlan/mlan_11n.c index 3de0809..9598d93 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n.c @@ -1536,9 +1536,13 @@ void wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap, pmadapter->hw_mpdu_density); 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) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type)) { + IS_CARD9097(pmadapter->card_type) || + IS_CARDAW693(pmadapter->card_type)) { if (bands & BAND_A) rx_mcs_supp = MIN( rx_mcs_supp, @@ -1548,6 +1552,7 @@ void wlan_fill_ht_cap_tlv(mlan_private *priv, MrvlIETypes_HTCap_t *pht_cap, MIN(rx_mcs_supp, GET_RXMCSSUPP(pmadapter->user_htstream)); } +#endif memset(pmadapter, (t_u8 *)pht_cap->ht_cap.supported_mcs_set, 0xff, rx_mcs_supp); /* Clear all the other values to get the minimum mcs set btw STA and AP @@ -1609,9 +1614,13 @@ void wlan_fill_ht_cap_ie(mlan_private *priv, IEEEtypes_HTCap_t *pht_cap, SETAMPDU_SPACING(pht_cap->ht_cap.ampdu_param, 0); 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) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || - IS_CARD9097(pmadapter->card_type)) { + IS_CARD9097(pmadapter->card_type) || + IS_CARDAW693(pmadapter->card_type)) { if (bands & BAND_A) rx_mcs_supp = MIN( rx_mcs_supp, @@ -1621,6 +1630,7 @@ void wlan_fill_ht_cap_ie(mlan_private *priv, IEEEtypes_HTCap_t *pht_cap, MIN(rx_mcs_supp, GET_RXMCSSUPP(pmadapter->user_htstream)); } +#endif memset(pmadapter, (t_u8 *)pht_cap->ht_cap.supported_mcs_set, 0xff, rx_mcs_supp); /* Clear all the other values to get the minimum mcs set btw STA and AP diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.c b/mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.c index b14988d..956d1e0 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n_rxreorder.c @@ -1538,6 +1538,9 @@ static void wlan_update_ampdu_rxwinsize(pmlan_adapter pmadapter, t_u8 coex_flag) priv->add_ba_param.rx_win_size = MLAN_WFD_COEX_AMPDU_DEF_RXWINSIZE; #endif + if (priv->bss_type == MLAN_BSS_TYPE_NAN) + priv->add_ba_param.rx_win_size = + MLAN_NAN_COEX_AMPDU_DEF_RXWINSIZE; #ifdef UAP_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_UAP) priv->add_ba_param.rx_win_size = diff --git a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c index b745194..cf33377 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c @@ -2372,6 +2372,16 @@ mlan_status wlan_process_cmdresp(mlan_adapter *pmadapter) goto done; } + if (cmdresp_result == HostCmd_RESULT_RGPWR_KEY_MISMATCH) { + PRINTM(MERROR, + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + PRINTM(MERROR, " Security Key Mismatch for rgpower_XX.bin \n"); + PRINTM(MERROR, + "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"); + wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_RGPWR_KEY_MISMATCH, + MNULL); + } + if (pmadapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { if (pmadapter->curr_cmd && cmdresp_result == HostCmd_RESULT_PRE_ASLEEP) { @@ -2428,7 +2438,9 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) +#endif wlan_pcie_init_fw(pmadapter); } #endif @@ -4917,16 +4929,6 @@ mlan_status wlan_adapter_get_hw_spec(pmlan_adapter pmadapter) pmadapter->ptxpwr_data = MNULL; pmadapter->txpwr_data_len = 0; } - if (!pmadapter->pdpd_data && - (pmadapter->dpd_data_len == UNKNOW_DPD_LENGTH)) { - ret = wlan_prepare_cmd(priv, HostCmd_CMD_CFG_DATA, - HostCmd_ACT_GEN_GET, OID_TYPE_DPD, MNULL, - MNULL); - if (ret) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - } /** Cal data dnld cmd prepare */ if ((pmadapter->pcal_data) && (pmadapter->cal_data_len > 0)) { ret = wlan_prepare_cmd(priv, HostCmd_CMD_CFG_DATA, @@ -5306,8 +5308,10 @@ mlan_status wlan_process_vdll_event(pmlan_private pmpriv, pmlan_buffer pevent) case VDLL_IND_TYPE_REQ: offset = wlan_le32_to_cpu(ind->offset); block_len = wlan_le16_to_cpu(ind->block_len); - PRINTM(MEVENT, "VDLL_IND: type=%d offset = 0x%x, len = %d\n", - wlan_le16_to_cpu(ind->type), offset, block_len); + PRINTM(MEVENT, + "VDLL_IND: type=%d ID=%d offset = 0x%x len = %d\n", + wlan_le16_to_cpu(ind->type), + wlan_le16_to_cpu(ind->vdllId), offset, block_len); if (offset <= ctrl->vdll_len) { block_len = MIN(block_len, ctrl->vdll_len - offset); if (!pmadapter->cmd_sent) { @@ -5341,6 +5345,9 @@ mlan_status wlan_process_vdll_event(pmlan_private pmpriv, pmlan_buffer pevent) case VDLL_IND_TYPE_ERR_ID: PRINTM(MERROR, "VDLL_IND (ID ERR).\n"); break; + case VDLL_IND_TYPE_SEC_ERR_ID: + PRINTM(MERROR, "VDLL_IND (SECURE ERR).\n"); + break; default: PRINTM(MERROR, "unknow vdll ind type=%d\n", ind->type); break; @@ -5526,6 +5533,7 @@ mlan_status wlan_handle_event_multi_chan_info(pmlan_private pmpriv, #ifdef USB if (IS_USB(pmadapter->card_type)) { + wlan_resync_usb_port(pmadapter); } #endif @@ -6158,12 +6166,16 @@ mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, wlan_show_dot11ndevcap(pmadapter, pmadapter->hw_dot_11n_dev_cap); 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) pmadapter->user_htstream = pmadapter->hw_dev_mcs_support; /** separate stream config for 2.4G and 5G, will be changed according to * antenna cfg*/ if (pmadapter->fw_bands & BAND_A) pmadapter->user_htstream |= (pmadapter->user_htstream << 8); PRINTM(MCMND, "user_htstream=0x%x\n", pmadapter->user_htstream); +#endif if (ISSUPP_BEAMFORMING(pmadapter->hw_dot_11n_dev_cap)) { PRINTM(MCMND, "Enable Beamforming\n"); @@ -7219,75 +7231,6 @@ mlan_status wlan_ret_tx_rx_pkt_stats(pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } -/* - * @brief This function prepares command of cwmode control. - * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param cmd_action The action: GET or SET - * @param pdata_buf A pointer to data buffer - * - * @return MLAN_STATUS_SUCCESS - */ -mlan_status wlan_cmd_cw_mode_ctrl(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf) -{ - HostCmd_DS_CW_MODE_CTRL *cwmode_ctrl = &cmd->params.cwmode; - mlan_ds_cw_mode_ctrl *cw_mode = (mlan_ds_cw_mode_ctrl *)pdata_buf; - ENTER(); - cmd->size = - wlan_cpu_to_le16((sizeof(HostCmd_DS_CW_MODE_CTRL)) + S_DS_GEN); - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_CW_MODE_CTRL); - cwmode_ctrl->action = wlan_cpu_to_le16(cmd_action); - - if (cmd_action == HostCmd_ACT_GEN_SET) { - cwmode_ctrl->mode = cw_mode->mode; - cwmode_ctrl->channel = cw_mode->channel; - cwmode_ctrl->chanInfo = cw_mode->chanInfo; - cwmode_ctrl->txPower = wlan_cpu_to_le16(cw_mode->txPower); - cwmode_ctrl->rateInfo = wlan_cpu_to_le32(cw_mode->rateInfo); - cwmode_ctrl->pktLength = wlan_cpu_to_le16(cw_mode->pktLength); - } - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - -/* - * @brief This function handles the command response of cwmode_ctrl - * - * @param pmpriv A pointer to mlan_private structure - * @param resp A pointer to HostCmd_DS_COMMAND - * @param pioctl_buf A pointer to mlan_ioctl_req structure - * - * @return MLAN_STATUS_SUCCESS - */ -mlan_status wlan_ret_cw_mode_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) -{ - HostCmd_DS_CW_MODE_CTRL *cwmode_resp = &resp->params.cwmode; - mlan_ds_misc_cfg *misc = MNULL; - - ENTER(); - if (pioctl_buf) { - misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; - misc->param.cwmode.mode = cwmode_resp->mode; - misc->param.cwmode.channel = cwmode_resp->channel; - misc->param.cwmode.chanInfo = cwmode_resp->chanInfo; - misc->param.cwmode.txPower = - wlan_le16_to_cpu(cwmode_resp->txPower); - misc->param.cwmode.rateInfo = - wlan_le32_to_cpu(cwmode_resp->rateInfo); - ; - misc->param.cwmode.pktLength = - wlan_le16_to_cpu(cwmode_resp->pktLength); - ; - pioctl_buf->data_read_written = sizeof(mlan_ds_misc_cfg); - } - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function prepares command of rf_antenna. * @@ -7376,7 +7319,11 @@ mlan_status wlan_ret_802_11_rf_antenna(pmlan_private pmpriv, HostCmd_DS_802_11_RF_ANTENNA *pantenna = &resp->params.antenna; t_u16 tx_ant_mode = wlan_le16_to_cpu(pantenna->tx_antenna_mode); 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) mlan_adapter *pmadapter = pmpriv->adapter; +#endif typedef struct _HostCmd_DS_802_11_RF_ANTENNA_1X1 { /** Action */ t_u16 action; @@ -7402,6 +7349,9 @@ mlan_status wlan_ret_802_11_rf_antenna(pmlan_private pmpriv, " Rx action = 0x%x, Rx Mode = 0x%04x\n", wlan_le16_to_cpu(pantenna->action_tx), tx_ant_mode, 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) if (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || IS_CARDAW693(pmadapter->card_type) || @@ -7437,6 +7387,7 @@ mlan_status wlan_ret_802_11_rf_antenna(pmlan_private pmpriv, pmadapter->user_htstream, tx_ant_mode, rx_ant_mode); } +#endif } else PRINTM(MINFO, "RF_ANT_RESP: action = 0x%x, Mode = 0x%04x, Evaluate time = %d, Current antenna = %d\n", @@ -7473,8 +7424,12 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf) { 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) MrvlIEtypes_Reg_type_t *tlv; mlan_adapter *pmadapter = pmpriv->adapter; +#endif ENTER(); @@ -7488,6 +7443,9 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, mac_reg->action = wlan_cpu_to_le16(cmd_action); mac_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); 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) if ((reg_rw->type == MLAN_REG_MAC2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || @@ -7505,6 +7463,7 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, sizeof(HostCmd_DS_MAC_REG_ACCESS) + S_DS_GEN + sizeof(MrvlIEtypes_Reg_type_t)); } +#endif break; } case HostCmd_CMD_REG_ACCESS: { @@ -7526,6 +7485,9 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, bbp_reg->action = wlan_cpu_to_le16(cmd_action); bbp_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); 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) if ((reg_rw->type == MLAN_REG_BBP2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || @@ -7543,6 +7505,7 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, sizeof(HostCmd_DS_BBP_REG_ACCESS) + S_DS_GEN + sizeof(MrvlIEtypes_Reg_type_t)); } +#endif break; } case HostCmd_CMD_RF_REG_ACCESS: { @@ -7553,6 +7516,9 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, rf_reg->action = wlan_cpu_to_le16(cmd_action); rf_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); 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) if ((reg_rw->type == MLAN_REG_RF2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || @@ -7570,6 +7536,7 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, sizeof(HostCmd_DS_RF_REG_ACCESS) + S_DS_GEN + sizeof(MrvlIEtypes_Reg_type_t)); } +#endif break; } case HostCmd_CMD_CAU_REG_ACCESS: { @@ -7615,6 +7582,9 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, bca_reg->action = wlan_cpu_to_le16(cmd_action); bca_reg->offset = wlan_cpu_to_le16((t_u16)reg_rw->offset); 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) if ((reg_rw->type == MLAN_REG_BCA2) && (IS_CARD9098(pmadapter->card_type) || IS_CARDIW624(pmadapter->card_type) || @@ -7632,6 +7602,7 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, sizeof(HostCmd_DS_BCA_REG_ACCESS) + S_DS_GEN + sizeof(MrvlIEtypes_Reg_type_t)); } +#endif break; } default: @@ -7816,6 +7787,69 @@ mlan_status wlan_ret_mem_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, return MLAN_STATUS_SUCCESS; } +/** + * @brief This function prepares command of gpio_cfg. + * + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_gpio_cfg_ops(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf) +{ + mlan_ds_misc_cfg *misc = (mlan_ds_misc_cfg *)pdata_buf; + HostCmd_gpio_cfg_ops *gpio_cfg = + (HostCmd_gpio_cfg_ops *)&cmd->params.gpio_cfg_ops; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_GPIO_CFG); + cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_gpio_cfg_ops) + S_DS_GEN); + + gpio_cfg->action = (t_u8)cmd_action; + gpio_cfg->opsType = misc->param.gpio_cfg_ops.opsType; + gpio_cfg->pin_num = misc->param.gpio_cfg_ops.pin_num; + gpio_cfg->value = misc->param.gpio_cfg_ops.value; + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + +/** + * @brief This function handles the command response of gpio_cfg + * + * @param pmpriv A pointer to mlan_private structure + * @param resp A pointer to HostCmd_DS_COMMAND + * @param pioctl_buf A pointer to command buffer + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_ret_gpio_cfg_ops(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *misc = MNULL; + mlan_ds_gpio_cfg_ops *gpio_cfg = MNULL; + HostCmd_gpio_cfg_ops *gpio = + (HostCmd_gpio_cfg_ops *)&resp->params.gpio_cfg_ops; + + ENTER(); + + if (pioctl_buf) { + misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + gpio_cfg = &misc->param.gpio_cfg_ops; + + gpio_cfg->action = gpio->action; + gpio_cfg->opsType = gpio->opsType; + gpio_cfg->pin_num = gpio->pin_num; + gpio_cfg->value = gpio->value; + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /** * * @brief This function handles coex events generated by firmware @@ -8513,6 +8547,7 @@ mlan_status wlan_ret_chan_region_cfg(pmlan_private pmpriv, /* Add FW cfp tables and region info */ wlan_add_fw_cfp_tables(pmpriv, tlv_buf, tlv_buf_left); + if (pmadapter->otp_region) { if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, pmadapter->fw_bands)) { @@ -10312,6 +10347,74 @@ mlan_status wlan_ret_range_ext(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, return MLAN_STATUS_SUCCESS; } +/** + * @brief This function prepares command of TX_FRAME + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action the action: GET or SET + * @param pdata_buf A pointer to data buffer + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_tx_frame(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + t_u16 cmd_size = 0; + HostCmd_DS_80211_TX_FRAME *tx_frame_cmd = &cmd->params.tx_frame; + mlan_ds_misc_tx_frame *tx_frame = (mlan_ds_misc_tx_frame *)pdata_buf; + TxPD *plocal_tx_pd = (TxPD *)tx_frame_cmd->buffer; + t_u32 pkt_type; + t_u32 tx_control; + t_u8 *pdata = tx_frame->tx_buf; + t_u16 data_len = tx_frame->data_len; + + ENTER(); + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_TX_FRAME); + cmd_size = sizeof(HostCmd_DS_80211_TX_FRAME) + S_DS_GEN; + tx_frame_cmd->action = 0; + tx_frame_cmd->status = 0; + memcpy_ext(pmpriv->adapter, &tx_frame_cmd->band_config, + (t_u8 *)&tx_frame->bandcfg, sizeof(t_u8), sizeof(t_u8)); + tx_frame_cmd->channel = tx_frame->channel; + + if (tx_frame->buf_type == MLAN_BUF_TYPE_RAW_DATA) { + memcpy_ext(pmpriv->adapter, &pkt_type, tx_frame->tx_buf, + sizeof(pkt_type), sizeof(pkt_type)); + memcpy_ext(pmpriv->adapter, &tx_control, + tx_frame->tx_buf + sizeof(pkt_type), + sizeof(tx_control), sizeof(tx_control)); + data_len -= sizeof(pkt_type) + sizeof(tx_control); + pdata += sizeof(pkt_type) + sizeof(tx_control); + } + memcpy_ext(pmpriv->adapter, tx_frame_cmd->buffer + sizeof(TxPD), pdata, + data_len, data_len); + + memset(pmpriv->adapter, plocal_tx_pd, 0, sizeof(TxPD)); + plocal_tx_pd->bss_num = GET_BSS_NUM(pmpriv); + plocal_tx_pd->bss_type = pmpriv->bss_type; + plocal_tx_pd->tx_pkt_length = (t_u16)data_len; + plocal_tx_pd->priority = (t_u8)tx_frame->priority; + plocal_tx_pd->tx_pkt_offset = sizeof(TxPD); + plocal_tx_pd->pkt_delay_2ms = 0xff; + + if (tx_frame->buf_type == MLAN_BUF_TYPE_RAW_DATA) { + plocal_tx_pd->tx_pkt_type = (t_u16)pkt_type; + plocal_tx_pd->tx_control = tx_control; + } + + if (tx_frame->flags & MLAN_BUF_FLAG_TX_STATUS) { + plocal_tx_pd->tx_control_1 |= tx_frame->tx_seq_num << 8; + plocal_tx_pd->flags |= MRVDRV_TxPD_FLAGS_TX_PACKET_STATUS; + } + + endian_convert_TxPD(plocal_tx_pd); + cmd_size += sizeof(TxPD) + data_len; + cmd->size = wlan_cpu_to_le16(cmd_size); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /** * @brief This function prepares command of get_sensor_temp * @@ -10367,3 +10470,35 @@ mlan_status wlan_ret_get_sensor_temp(pmlan_private pmpriv, LEAVE(); return MLAN_STATUS_SUCCESS; } + +/** + * @brief This function prepares command to configure edmac + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param cmd_action Action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS + */ +mlan_status wlan_cmd_edmac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf) +{ + HostCmd_DS_EDMAC_CFG *edmac_cmd = &cmd->params.ed_mac_cfg; + mlan_ds_ed_mac_cfg *edmac_cfg = (mlan_ds_ed_mac_cfg *)pdata_buf; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_EDMAC_CFG); + cmd->size = wlan_cpu_to_le16(sizeof(mlan_ds_ed_mac_cfg) + S_DS_GEN); + + edmac_cmd->ed_ctrl_2g = wlan_cpu_to_le16(edmac_cfg->ed_ctrl_2g); + edmac_cmd->ed_offset_2g = wlan_cpu_to_le16(edmac_cfg->ed_offset_2g); + edmac_cmd->ed_ctrl_5g = wlan_cpu_to_le16(edmac_cfg->ed_ctrl_5g); + edmac_cmd->ed_offset_5g = wlan_cpu_to_le16(edmac_cfg->ed_offset_5g); + edmac_cmd->ed_bitmap_txq_lock = + wlan_cpu_to_le32(edmac_cfg->ed_bitmap_txq_lock); + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} diff --git a/mxm_wifiex/wlan_src/mlan/mlan_decl.h b/mxm_wifiex/wlan_src/mlan/mlan_decl.h index f0af2e3..7956c25 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_decl.h @@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "408.p4" +#define MLAN_RELEASE_VERSION "423.p1" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -157,10 +157,6 @@ typedef t_s32 t_sval; /** This is current limit on Maximum Rx AMPDU allowed */ #define MLAN_MAX_RX_BASTREAM_SUPPORTED 16 -#ifndef UINT_MAX -#define UINT_MAX (~0U) -#endif - #ifdef STA_SUPPORT /** Default Win size attached during ADDBA request */ #define MLAN_STA_AMPDU_DEF_TXWINSIZE 64 @@ -185,6 +181,11 @@ typedef t_s32 t_sval; #define MLAN_WFD_COEX_AMPDU_DEF_RXWINSIZE 16 #endif +/** NAN use the same window size for tx/rx */ +#define MLAN_NAN_AMPDU_DEF_TXRXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_NAN_COEX_AMPDU_DEF_RXWINSIZE 16 + /** Block ack timeout value */ #define MLAN_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff /** Maximum Tx Win size configured for ADDBA request [10 bits] */ @@ -273,6 +274,11 @@ typedef t_s32 t_sval; /** pcie inband reset */ #define FW_RELOAD_PCIE_INBAND_RESET 6 +/** auto fw reload enable */ +#define AUTO_FW_RELOAD_ENABLE MBIT(0) +/** auto fw reload enable pcie inband reset */ +#define AUTO_FW_RELOAD_PCIE_INBAND_RESET MBIT(1) + #ifdef PCIE /* Interrupt type */ enum { RX_DATA, RX_EVENT, TX_COMPLETE, RX_CMD_RESP, RX_CMD_DNLD }; @@ -747,6 +753,7 @@ typedef enum _mlan_bss_type { #ifdef WIFI_DIRECT_SUPPORT MLAN_BSS_TYPE_WIFIDIRECT = 2, #endif + MLAN_BSS_TYPE_NAN = 4, MLAN_BSS_TYPE_DFS = 8, MLAN_BSS_TYPE_ANY = 0xff, } mlan_bss_type; @@ -803,6 +810,8 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_FW_RADAR_DETECTED = 0x00000024, MLAN_EVENT_ID_FW_CHANNEL_REPORT_RDY = 0x00000025, MLAN_EVENT_ID_FW_BW_CHANGED = 0x00000026, + MLAN_EVENT_ID_FW_IBSS_CONNECT = 0x00000028, + MLAN_EVENT_ID_FW_IBSS_DISCONNECT = 0x00000029, MLAN_EVENT_ID_FW_REMAIN_ON_CHAN_EXPIRED = 0x0000002B, #ifdef UAP_SUPPORT @@ -845,6 +854,7 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_UAP_CHAN_INFO = 0x80000020, #endif MLAN_EVENT_ID_FW_ROAM_OFFLOAD_RESULT = 0x80000023, + MLAN_EVENT_ID_NAN_STARTED = 0x80000024, MLAN_EVENT_ID_DRV_RTT_RESULT = 0x80000025, MLAN_EVENT_ID_DRV_ASSOC_FAILURE_LOGGER = 0x80000026, MLAN_EVENT_ID_DRV_ASSOC_SUCC_LOGGER = 0x80000027, @@ -857,7 +867,9 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_DEFER_RX_EVENT = 0x80000033, MLAN_EVENT_ID_DRV_DEFER_CMDRESP = 0x80000034, MLAN_EVENT_ID_DRV_DEFER_TX_COMPLTE = 0x80000035, + MLAN_EVENT_ID_DRV_DELAY_TX_COMPLETE = 0x80000036, #endif + MLAN_EVENT_ID_DRV_RGPWR_KEY_MISMATCH = 0x80000037, } mlan_event_id; /** Data Structures */ @@ -907,7 +919,9 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t { #define OID_TYPE_CAL 0x2 #define OID_TYPE_DPD 0xa +#define NONE_TYPE_DPD 0xb #define UNKNOW_DPD_LENGTH 0xffffffff +#define NONE_DPD_LENGTH 0xfafafafa /** Custom data structure */ typedef struct _mlan_init_param { @@ -1296,7 +1310,19 @@ typedef MLAN_PACK_START struct _mc_txcontrol { /** mc_pkt_flags */ t_u8 mc_pkt_flags; } MLAN_PACK_END mc_txcontrol, *pmc_txcontrol; - +typedef MLAN_PACK_START struct MAPP_Stats_Mcast_drv { + t_u32 cycle_recv_under_2300usec; + t_u32 cycle_recv_in_time; + t_u32 cycle_recv_over_2900usec; + t_u32 cycle_recv_over_3500usec; + t_u32 cycle_recv_over_5000usec; + t_u32 cycle_recv_over_10000usec; + t_u32 cycle_recv_over_15000usec; + t_u32 spent_time_under_1000usec; + t_u32 spent_time_over_1000usec; + t_u32 spent_time_over_2000usec; + t_u32 spent_time_over_3000usec; +} MLAN_PACK_END Stats_mcast_drv_t, *pStats_mcast_drv_t; /** mlan_buffer data structure */ typedef struct _mlan_buffer { /** Pointer to previous mlan_buffer */ @@ -2787,4 +2813,97 @@ MLAN_API void mlan_process_pcie_interrupt_cb(t_void *pmadapter, int type); #define CSI_SIGNATURE 0xABCD +/** secure add/sub **/ +#ifndef SINT8_MAX +#define SINT8_MAX 0x7f +#endif + +#ifndef SINT8_MIN +#define SINT8_MIN 0x80 +#endif + +#ifndef UINT8_MAX +#define UINT8_MAX 0xff +#endif + +#ifndef SINT16_MAX +#define SINT16_MAX 0x7fff +#endif + +#ifndef SINT16_MIN +#define SINT16_MIN 0x8000 +#endif + +#ifndef UINT16_MAX +#define UINT16_MAX 0xffff +#endif + +#ifndef SINT32_MAX +#define SINT32_MAX 0x7fffffff +#endif + +#ifndef SINT32_MIN +#define SINT32_MIN 0x80000000 +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff +#endif + +#ifndef SINT64_MAX +#define SINT64_MAX 0x7fffffffffffffff +#endif + +#ifndef SINT64_MIN +#define SINT64_MIN 0x8000000000000000 +#endif + +#ifndef UINT64_MAX +#define UINT64_MAX 0xffffffffffffffff +#endif + +#ifndef PTR_MAX +#ifdef MLAN_64BIT +#define PTR_MAX UINT64_MAX +#else +#define PTR_MAX UINT32_MAX +#endif +#endif + +#ifndef SINT_MAX +#ifdef MLAN_64BIT +#define SINT_MAX SINT64_MAX +#else +#define SINT_MAX SINT32_MAX +#endif +#endif + +#ifndef SINT_MIN +#ifdef MLAN_64BIT +#define SINT_MIN SINT64_MIN +#else +#define SINT_MIN SINT32_MIN +#endif +#endif + +#ifndef UINT_MAX +#ifdef MLAN_64BIT +#define UINT_MAX UINT64_MAX +#else +#define UINT_MAX UINT32_MAX +#endif +#endif + +typedef enum { + TYPE_SINT8, + TYPE_UINT8, + TYPE_SINT16, + TYPE_UINT16, + TYPE_SINT32, + TYPE_UINT32, + TYPE_SINT64, + TYPE_UINT64, + TYPE_PTR, +} data_type; + #endif /* !_MLAN_DECL_H_ */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h b/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h index c1c661d..56d3e55 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h @@ -189,6 +189,8 @@ ENUM_ELEMENT(EVENT_DUMMY_HOST_WAKEUP_SIGNAL, 0x0001), /** Event ID: Tx status */ ENUM_ELEMENT(EVENT_TX_STATUS_REPORT, 0x0074), + ENUM_ELEMENT(EVENT_NAN_GENERIC, 0x0075), + ENUM_ELEMENT(EVENT_BT_COEX_WLAN_PARA_CHANGE, 0x0076), ENUM_ELEMENT(EVENT_VDLL_IND, 0x0081), @@ -205,6 +207,7 @@ ENUM_ELEMENT(EVENT_DUMMY_HOST_WAKEUP_SIGNAL, 0x0001), ENUM_ELEMENT(EVENT_CSI, 0x008D), ENUM_ELEMENT(EVENT_FW_HANG_REPORT, 0x008F), + ENUM_ELEMENT(EVENT_DPD_LOG, 0x0091), /** Card Event definition : RESET PN */ ENUM_ELEMENT(EVENT_ASSOC_REQ_IE, 0x0095), @@ -215,3 +218,4 @@ ENUM_ELEMENT(EVENT_DUMMY_HOST_WAKEUP_SIGNAL, 0x0001), ENUM_ELEMENT(EVENT_IMD3_CAL_END, 0x00A1), /* Always keep this last */ + ENUM_ELEMENT_LAST(__HostEvent_Last) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_fw.h b/mxm_wifiex/wlan_src/mlan/mlan_fw.h index fe0e7ec..c696843 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_fw.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_fw.h @@ -1219,6 +1219,10 @@ enum host_cmd_id { #define FW_CAPINFO_EXT_CHAN_TRACK MBIT(13) /** FW cap info bit 14: 6G Support */ #define FW_CAPINFO_EXT_6G MBIT(14) +/** FW cap info bit 16: 6G Support */ +#define FW_CAPINFO_EXT_CMD_TX_DATA MBIT(16) +/** FW cap info bit 19: security rgpower table */ +#define FW_CAPINFO_EXT_SEC_RG_POWER MBIT(19) /** Check if 5G 1x1 only is supported by firmware */ #define IS_FW_SUPPORT_5G_1X1_ONLY(_adapter) \ @@ -1257,6 +1261,10 @@ enum host_cmd_id { (_adapter->fw_cap_ext & FW_CAPINFO_EXT_CHAN_TRACK) /** Check if 6G supported by firmware */ #define IS_FW_SUPPORT_6G(_adapter) (_adapter->fw_cap_ext & FW_CAPINFO_EXT_6G) +#define IS_FW_SUPPORT_CMD_TX_DATA(_adapter) \ + (_adapter->fw_cap_ext & FW_CAPINFO_EXT_CMD_TX_DATA) +#define IS_FW_SUPPORT_SEC_RG_POWER(_adapter) \ + (_adapter->fw_cap_ext & FW_CAPINFO_EXT_SEC_RG_POWER) /** MrvlIEtypes_PrevBssid_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_PrevBssid_t { @@ -1348,6 +1356,9 @@ 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) /* TLV type: reg type */ #define TLV_TYPE_REG_ACCESS_CTRL (PROPRIETARY_TLV_BASE_ID + 0x13C) /* 0x023c*/ /** MrvlIEtypes_Reg_type_t*/ @@ -1357,6 +1368,7 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Reg_type_t { /** type: 0x81/0x82/0x83 */ t_u8 type; } MLAN_PACK_END MrvlIEtypes_Reg_type_t; +#endif /* mod_grp */ typedef enum _mod_grp { @@ -1445,7 +1457,6 @@ typedef enum _ENH_PS_MODES { #define HostCmd_ACT_GEN_REMOVE 0x0004 /** General purpose action : Reset */ #define HostCmd_ACT_GEN_RESET 0x0005 - /** Host command action : Set Rx */ #define HostCmd_ACT_SET_RX 0x0001 /** Host command action : Set Tx */ @@ -1476,6 +1487,8 @@ typedef enum _ENH_PS_MODES { #define HostCmd_RESULT_BLOCK 0x0006 /** cmd is blocked by pre_asleep */ #define HostCmd_RESULT_PRE_ASLEEP 0x0007 +/** rgpower_XX.bin download failed with security key mismatch */ +#define HostCmd_RESULT_RGPWR_KEY_MISMATCH 0x0008 /* Define action or option for HostCmd_CMD_MAC_CONTROL */ /** MAC action : Rx on */ @@ -1564,6 +1577,12 @@ enum host_fw_event_id { #undef ENUM_ELEMENT #undef ENUM_ELEMENT_LAST +enum nan_event_subtype { + NAN_EVT_SUBTYPE_SD_EVENT = 0, + NAN_EVT_SUBTYPE_NAN_STARTED = 1, + NAN_EVT_SUBTYPE_SDF_TX_DONE = 2, +}; + enum wls_event_subtype { WLS_SUB_EVENT_FTM_COMPLETE = 0, WLS_SUB_EVENT_RADIO_RECEIVED = 1, @@ -1656,6 +1675,12 @@ typedef enum _tdls_error_code_e { TDLS_PEER_STA_UNREACHABLE = 25, } tdls_error_code_e; +/** Event structure for generic events from NAN FW */ +typedef MLAN_PACK_START struct _event_nan_generic { + /** NAN Event SubType */ + t_u16 event_sub_type; +} MLAN_PACK_END event_nan_generic; + #define RXPD_FLAG_EXTRA_HEADER (1 << 1) #define RXPD_FLAG_UCAST_PKT (1 << 3) @@ -5461,24 +5486,11 @@ typedef MLAN_PACK_START struct _HostCmd_DS_CHAN_REGION_CFG { t_u16 action; } MLAN_PACK_END HostCmd_DS_CHAN_REGION_CFG; -/** HostCmd_CMD_CW_MODE_CTRL */ -typedef MLAN_PACK_START struct _HostCmd_DS_CW_MODE_CTRL { - /** Action for CW Tone Control */ +/** HostCmd_DS_REGION_POWER_CFG */ +typedef MLAN_PACK_START struct _HostCmd_DS_REGION_POWER_CFG { + /** Action */ t_u16 action; - /** Mode of Operation 0: Disbale 1: Tx Continuous Packet 2: Tx - * Continuous Wave */ - t_u8 mode; - /** channel */ - t_u8 channel; - /** channel info*/ - t_u8 chanInfo; - /** Tx Power level in dBm */ - t_u16 txPower; - /** Packet Length */ - t_u16 pktLength; - /** bit rate Info */ - t_u32 rateInfo; -} MLAN_PACK_END HostCmd_DS_CW_MODE_CTRL; +} MLAN_PACK_END HostCmd_DS_REGION_POWER_CFG; /** HostCmd_CMD_802_11_RF_ANTENNA */ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_RF_ANTENNA { @@ -5621,6 +5633,18 @@ typedef MLAN_PACK_START struct _HostCmd_DS_REG_ACCESS { t_u32 value; } MLAN_PACK_END HostCmd_DS_REG_ACCESS; +/** Type defination of HostCmd_gpio_cfg_ops */ +typedef MLAN_PACK_START struct _HostCmd_gpio_cfg_ops { + /** Get or Set action */ + t_u8 action; + /** Operation type */ + t_u8 opsType; + /** pin number */ + t_u8 pin_num; + /** pin value */ + t_u8 value; +} MLAN_PACK_END HostCmd_gpio_cfg_ops; + /** HostCmd_DS_TARGET_ACCESS */ typedef MLAN_PACK_START struct _HostCmd_DS_TARGET_ACCESS { /** Action */ @@ -5887,23 +5911,6 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_MacAddr_t { t_u8 mac[MLAN_MAC_ADDR_LENGTH]; } MLAN_PACK_END MrvlIEtypes_MacAddr_t; -/** Assoc Request */ -#define SUBTYPE_ASSOC_REQUEST 0 -/** ReAssoc Request */ -#define SUBTYPE_REASSOC_REQUEST 2 -/** Probe Resp */ -#define SUBTYPE_PROBE_RESP 5 -/** Disassoc Request */ -#define SUBTYPE_DISASSOC 10 -/** Auth Request */ -#define SUBTYPE_AUTH 11 -/** Deauth Request */ -#define SUBTYPE_DEAUTH 12 -/** Action frame */ -#define SUBTYPE_ACTION 13 -/** beacon */ -#define SUBTYPE_BEACON 8 - #ifdef UAP_SUPPORT /** TLV type : AP Channel band Config */ #define TLV_TYPE_UAP_CHAN_BAND_CONFIG \ @@ -7753,6 +7760,36 @@ typedef MLAN_PACK_START struct _HostCmd_DS_CMD_CCK_DESENSE_CFG { t_u8 num_off_intervals; } MLAN_PACK_END HostCmd_DS_CMD_CCK_DESENSE_CFG; +/** HostCmd_DS_80211_TX_FRAME */ +typedef MLAN_PACK_START struct _HostCmd_DS_80211_TX_FRAME { + /** Action Set or get */ + t_u16 action; + /** status */ + t_u16 status; + /** BandConfig */ + t_u8 band_config; + /** channel */ + t_u8 channel; + /** reserved */ + t_u32 reserved; + /** buffer include TxPD and full Tx packet */ + t_u8 buffer[]; +} MLAN_PACK_END HostCmd_DS_80211_TX_FRAME; + +/* edmac configuration: HostCmd_DS_EDMAC_CFG*/ +typedef MLAN_PACK_START struct _HostCmd_DS_EDMAC_CFG { + /** EU adaptivity for 2.4ghz band */ + t_u16 ed_ctrl_2g; + /** Energy detect threshold offset for 2.4ghz */ + t_s16 ed_offset_2g; + /** EU adaptivity for 5ghz band */ + t_u16 ed_ctrl_5g; + /** Energy detect threshold offset for 5ghz */ + t_s16 ed_offset_5g; + + t_u32 ed_bitmap_txq_lock; +} MLAN_PACK_END HostCmd_DS_EDMAC_CFG; + /** HostCmd_DS_COMMAND */ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { /** Command Header : Command */ @@ -7809,8 +7846,6 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { /** RF antenna */ HostCmd_DS_802_11_RF_ANTENNA antenna; - /** CW Mode: Tx CW Level control */ - HostCmd_DS_CW_MODE_CTRL cwmode; /** Enhanced power save command */ HostCmd_DS_802_11_PS_MODE_ENH psmode_enh; HostCmd_DS_802_11_HS_CFG_ENH opt_hs_cfg; @@ -7988,6 +8023,7 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { HostCmd_DS_802_11_PS_INACTIVITY_TIMEOUT ps_inact_tmo; HostCmd_DS_ROAM_OFFLOAD roam_offload; HostCmd_DS_CHAN_REGION_CFG reg_cfg; + HostCmd_DS_REGION_POWER_CFG rg_power_cfg; HostCmd_DS_AUTO_TX auto_tx; HostCmd_DS_FTM_CONFIG_SESSION_PARAMS ftm_config; HostCmd_DS_FTM_CONFIG_RESPONDER ftm_rtt_responder; @@ -8038,6 +8074,10 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { HostCmd_DS_STATS stats; HostCmd_DS_GET_CH_LOAD ch_load; HostCmd_DS_CROSS_CHIP_SYNCH cross_chip_synch; + HostCmd_DS_80211_TX_FRAME tx_frame; + + HostCmd_DS_EDMAC_CFG ed_mac_cfg; + HostCmd_gpio_cfg_ops gpio_cfg_ops; } params; } MLAN_PACK_END HostCmd_DS_COMMAND, *pHostCmd_DS_COMMAND; @@ -8082,13 +8122,15 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Secure_Boot_Uuid_t { #define VDLL_IND_TYPE_ERR_SIG 2 /** notify vdll download error: ID error */ #define VDLL_IND_TYPE_ERR_ID 3 +/** notify vdll download error: Secure error */ +#define VDLL_IND_TYPE_SEC_ERR_ID 4 /** vdll indicate event structure */ typedef MLAN_PACK_START struct _vdll_ind { /*VDLL ind type*/ t_u16 type; - /*reserved*/ - t_u16 reserved; + /*vdllId*/ + t_u16 vdllId; /*indicate the offset downloaded so far*/ t_u32 offset; /*VDLL block size*/ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h b/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h index da947e0..aa104f6 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h @@ -73,13 +73,13 @@ ENUM_ELEMENT(HostCmd_CMD_GET_HW_SPEC, 0x0003), /** Host Command ID : 802.11 Ad-Hoc join */ ENUM_ELEMENT(HostCmd_CMD_802_11_AD_HOC_JOIN, 0x002c), - /** Host Command ID: CW Mode */ - ENUM_ELEMENT(HostCmd_CMD_CW_MODE_CTRL, 0x0239), /** Host Command ID : 802.11 key material */ ENUM_ELEMENT(HostCmd_CMD_802_11_KEY_MATERIAL, 0x005e), /** Host Command ID : 802.11 Ad-Hoc stop */ ENUM_ELEMENT(HostCmd_CMD_802_11_AD_HOC_STOP, 0x0040), + /** Host Command ID : GPIO Configuration */ + ENUM_ELEMENT(HostCmd_CMD_GPIO_CFG, 0x0041), /** Host Command ID : 802.22 MAC address */ ENUM_ELEMENT(HostCmd_CMD_802_11_MAC_ADDRESS, 0x004D), @@ -199,6 +199,8 @@ ENUM_ELEMENT(HostCmd_CMD_GET_HW_SPEC, 0x0003), /** Host Command ID :EAPOL PKT */ ENUM_ELEMENT(HostCmd_CMD_802_11_EAPOL_PKT, 0x012e), + ENUM_ELEMENT(HostCmd_CMD_EDMAC_CFG, 0x0130), + /** Host Command ID :MIMO SWITCH **/ ENUM_ELEMENT(HostCmd_CMD_802_11_MIMO_SWITCH, 0x0235), @@ -375,6 +377,17 @@ ENUM_ELEMENT(HostCmd_CMD_GET_HW_SPEC, 0x0003), /** Host Command ID: Get sensor temp*/ ENUM_ELEMENT(HostCmd_CMD_DS_GET_SENSOR_TEMP, 0x0227), + /** Host Command ID: NAN Parameters cofiguration */ + ENUM_ELEMENT(HostCmd_CMD_NAN_PARAMS_CONFIG, 0x0228), + /** Host Command ID: NAN mode cofiguration */ + ENUM_ELEMENT(HostCmd_CMD_NAN_MODE_CONFIG, 0x0229), + /** Host Command ID: NAN service discovery functionality */ + ENUM_ELEMENT(HostCmd_CMD_NAN_SDF, 0x022a), + /** Host Command ID: NAN service hash */ + ENUM_ELEMENT(HostCmd_CMD_NAN_SERVICE_HASH, 0x022b), + /** Host Command ID: NAN service state info (get/set) */ + ENUM_ELEMENT(HostCmd_CMD_NAN_STATE_INFO, 0x022c), + /** Host Command ID : Configure ADHOC_OVER_IP parameters */ ENUM_ELEMENT(HostCmd_CMD_WMM_PARAM_CONFIG, 0x023a), @@ -446,4 +459,8 @@ ENUM_ELEMENT(HostCmd_CMD_GET_HW_SPEC, 0x0003), ENUM_ELEMENT(HostCmd_CMD_OFDM_DESENSE_CFG, 0x027f), ENUM_ELEMENT(HostCmd_CMD_NAV_MITIGATION_CFG, 0x0282), + /** Host Command ID: Tx Frame */ + ENUM_ELEMENT(HostCmd_CMD_802_11_TX_FRAME, 0x0283), + /* Always keep this last */ + ENUM_ELEMENT_LAST(__HostCmd_CMD_Last) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_ieee.h b/mxm_wifiex/wlan_src/mlan/mlan_ieee.h index e0a73ad..f238a01 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_ieee.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_ieee.h @@ -319,6 +319,27 @@ typedef MLAN_PACK_START struct { t_u8 variablep[]; } MLAN_PACK_END IEEEtypes_assoc_req; +/** Assoc Request */ +#define SUBTYPE_ASSOC_REQUEST 0 +/** Assoc Response */ +#define SUBTYPE_ASSOC_RESP 1 +/** ReAssoc Request */ +#define SUBTYPE_REASSOC_REQUEST 2 +/** ReAssoc Request */ +#define SUBTYPE_REASSOC_RESP 3 +/** Probe Resp */ +#define SUBTYPE_PROBE_RESP 5 +/** Disassoc Request */ +#define SUBTYPE_DISASSOC 10 +/** Auth Request */ +#define SUBTYPE_AUTH 11 +/** Deauth Request */ +#define SUBTYPE_DEAUTH 12 +/** Action frame */ +#define SUBTYPE_ACTION 13 +/** beacon */ +#define SUBTYPE_BEACON 8 + /*Mgmt frame*/ typedef MLAN_PACK_START struct { /** frame control */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_init.c b/mxm_wifiex/wlan_src/mlan/mlan_init.c index a27dcba..4aaac9d 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_init.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_init.c @@ -975,6 +975,7 @@ t_void wlan_init_adapter(pmlan_adapter pmadapter) pmadapter->pcard_pcie->txbd_rdptr = 0; pmadapter->pcard_pcie->rxbd_rdptr = 0; pmadapter->pcard_pcie->evtbd_rdptr = 0; + pmadapter->pcard_pcie->txbd_pending = 0; #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->rxbd_wrptr = @@ -984,11 +985,15 @@ t_void wlan_init_adapter(pmlan_adapter pmadapter) EVT_RW_PTR_ROLLOVER_IND; } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->rxbd_wrptr = pmadapter->pcard_pcie->txrx_bd_size; pmadapter->pcard_pcie->evtbd_wrptr = MLAN_MAX_EVT_BD; + pmadapter->pcard_pcie->last_write_index_with_irq = + 0xffffffff; } +#endif } #endif LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h index b234715..2d679d3 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h @@ -89,6 +89,7 @@ enum _mlan_ioctl_req_id { #ifdef UAP_SUPPORT MLAN_OID_ACTION_CHAN_SWITCH = 0x0002001E, #endif + MLAN_OID_BSS_HOST_MLME = 0x0002001F, /* Radio Configuration Group */ MLAN_IOCTL_RADIO_CFG = 0x00030000, @@ -376,6 +377,10 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_REORDER_FLUSH_TIME = 0x0020008F, MLAN_OID_MISC_NAV_MITIGATION = 0x00200090, MLAN_OID_MISC_LED_CONFIG = 0x00200091, + MLAN_OID_MISC_TX_FRAME = 0x00200092, + MLAN_OID_MISC_EDMAC_CONFIG = 0x00200093, + MLAN_OID_MISC_GPIO_CFG = 0x00200094, + MLAN_OID_MISC_REGION_POWER_CFG = 0x00200095, }; /** Sub command size */ @@ -390,7 +395,6 @@ enum _mlan_act_ioctl { MLAN_ACT_RESET, MLAN_ACT_DEFAULT }; - /** Enumeration for generic enable/disable */ enum _mlan_act_generic { MLAN_ACT_DISABLE = 0, MLAN_ACT_ENABLE = 1 }; @@ -1965,6 +1969,9 @@ typedef struct _mlan_fw_info { /* higher 8 bytes of uuid */ t_u64 uuid_hi; + /* FW support tx data by cmd */ + t_u8 cmd_tx_data; + t_u8 sec_rgpower; } mlan_fw_info, *pmlan_fw_info; /** Version string buffer length */ @@ -4104,7 +4111,9 @@ typedef struct _mlan_ds_11ax_llde_cmd { t_u8 triggerlimit; // cap airtime limit index: auto=0xff t_u8 peakULrate; // cap peak UL rate t_u8 dl_llde; // Downlink LLDE: enable=1,disable=0 - t_u16 triggerinterval; // Set trigger frame interval(us): auto=0 + t_u16 pollinterval; // Set trigger frame interval(us): auto=0 + t_u16 txOpDuration; // Set TxOp duration + t_u16 llde_ctrl; // for other configurations t_u16 mu_rts_successcnt; t_u16 mu_rts_failcnt; t_u16 basic_trigger_successcnt; @@ -4286,11 +4295,20 @@ enum _mlan_reg_type { MLAN_REG_CAU = 5, MLAN_REG_PSU = 6, 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) MLAN_REG_CIU = 8, +#endif +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) MLAN_REG_MAC2 = 0x81, MLAN_REG_BBP2 = 0x82, MLAN_REG_RF2 = 0x83, MLAN_REG_BCA2 = 0x87 +#endif }; /** Type definition of mlan_ds_reg_rw for MLAN_OID_REG_RW */ @@ -4490,6 +4508,26 @@ typedef struct _mlan_ds_misc_cmd { t_u8 cmd[MRVDRV_SIZE_OF_CMD_BUFFER]; } mlan_ds_misc_cmd; +/** Type definition of mlan_ds_misc_tx_frame for MLAN_OID_MISC_TX_FRAME */ +typedef struct _mlan_ds_misc_tx_frame { + /** Band Configuration */ + Band_Config_t bandcfg; + /** channel */ + t_u8 channel; + /** Buffer type: data, cmd, event etc. */ + mlan_buf_type buf_type; + /** QoS priority */ + t_u32 priority; + /** Flags for this buffer */ + t_u32 flags; + /** tx_seq_num */ + t_u32 tx_seq_num; + /** tx_buf length */ + t_u16 data_len; + /** Tx buffer */ + t_u8 tx_buf[MRVDRV_SIZE_OF_CMD_BUFFER]; +} mlan_ds_misc_tx_frame; + /** Maximum number of system clocks */ #define MLAN_MAX_CLK_NUM 16 @@ -4766,6 +4804,18 @@ typedef struct _mlan_ds_misc_country_code { t_u8 country_code[COUNTRY_CODE_LEN]; } mlan_ds_misc_country_code; +/** Type defination of mlan_ds_gpio_cfg_ops */ +typedef struct _mlan_ds_gpio_cfg_ops { + /** Get or Set action */ + t_u8 action; + /** Operation type */ + t_u8 opsType; + /** pin number */ + t_u8 pin_num; + /** pin value */ + t_u8 value; +} mlan_ds_gpio_cfg_ops; + /** action for set */ #define SUBSCRIBE_EVT_ACT_BITWISE_SET 0x0002 /** action for clear */ @@ -5490,22 +5540,6 @@ typedef MLAN_PACK_START struct _mlan_ds_misc_tx_rx_histogram { t_u8 value[1]; } MLAN_PACK_END mlan_ds_misc_tx_rx_histogram; -typedef MLAN_PACK_START struct _mlan_ds_cw_mode_ctrl { - /** Mode of Operation 0: Disable 1: Tx Continuous Packet 2: Tx - * Continuous Wave */ - t_u8 mode; - /*channel*/ - t_u8 channel; - /* channel info*/ - t_u8 chanInfo; - /** Tx Power level in dBm */ - t_u16 txPower; - /** Packet Length */ - t_u16 pktLength; - /** bit rate Info */ - t_u32 rateInfo; -} MLAN_PACK_END mlan_ds_cw_mode_ctrl; - #define RX_PKT_INFO MBIT(1) /** Struct for per-packet configuration */ typedef struct _mlan_per_pkt_cfg { @@ -6124,6 +6158,20 @@ typedef struct _mlan_ds_reorder_flush_time { t_u16 flush_time_ac_vi_vo; } mlan_ds_reorder_flush_time; +/** EDMAC configuration parameters */ +typedef struct _mlan_ds_ed_mac_cfg { + /** EU adaptivity for 2.4ghz band */ + t_u16 ed_ctrl_2g; + /** Energy detect threshold offset for 2.4ghz */ + t_s16 ed_offset_2g; + /** EU adaptivity for 5ghz band */ + t_u16 ed_ctrl_5g; + /** Energy detect threshold offset for 5ghz */ + t_s16 ed_offset_5g; + + t_u32 ed_bitmap_txq_lock; +} mlan_ds_ed_mac_cfg; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -6140,6 +6188,8 @@ typedef struct _mlan_ds_misc_cfg { #endif /** Hostcmd for MLAN_OID_MISC_HOST_CMD */ mlan_ds_misc_cmd hostcmd; + /** tx_frame for MLAN_OID_MISC_TX_FRAME */ + mlan_ds_misc_tx_frame tx_frame; /** System clock for MLAN_OID_MISC_SYS_CLOCK */ mlan_ds_misc_sys_clock sys_clock; /** WWS set/get for MLAN_OID_MISC_WWS */ @@ -6241,7 +6291,6 @@ typedef struct _mlan_ds_misc_cfg { mlan_ds_misc_keep_alive keep_alive; mlan_ds_misc_keep_alive_rx keep_alive_rx; mlan_ds_misc_tx_rx_histogram tx_rx_histogram; - mlan_ds_cw_mode_ctrl cwmode; /** Tx/Rx per-packet control */ t_u8 txrx_pkt_ctrl; mlan_ds_misc_robustcoex_params robustcoexparams; @@ -6294,6 +6343,8 @@ typedef struct _mlan_ds_misc_cfg { mlan_ds_ch_load ch_load; mlan_ds_cross_chip_synch cross_chip_synch; mlan_ds_reorder_flush_time flush_time; + mlan_ds_ed_mac_cfg edmac_cfg; + mlan_ds_gpio_cfg_ops gpio_cfg_ops; } param; } mlan_ds_misc_cfg, *pmlan_ds_misc_cfg; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_join.c b/mxm_wifiex/wlan_src/mlan/mlan_join.c index a900ce6..f70106c 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_join.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_join.c @@ -839,6 +839,14 @@ static int wlan_update_rsn_ie(mlan_private *pmpriv, ap_mfpc = ((*prsn_cap & (0x1 << MFPC_BIT)) == (0x1 << MFPC_BIT)); ap_mfpr = ((*prsn_cap & (0x1 << MFPR_BIT)) == (0x1 << MFPR_BIT)); + /* Check for negative case + * If WPA3SAE AP has PMF=0, block the association */ + if ((*akm_type == AssocAgentAuth_Wpa3Sae) && (!ap_mfpc && !ap_mfpr)) { + PRINTM(MERROR, + "RSNE: WPA3-SAE AP with incorrect PMF setting, can't associate to AP\n"); + return MLAN_STATUS_FAILURE; + } + if ((!ap_mfpc && !ap_mfpr && pmpriv->pmfcfg.mfpr) || ((!ap_mfpc) && ap_mfpr) || (ap_mfpc && ap_mfpr && (!pmpriv->pmfcfg.mfpc))) { @@ -1627,21 +1635,22 @@ mlan_status wlan_ret_802_11_associate(mlan_private *pmpriv, assoc_logger_data *assoc_succ; mlan_ds_bss *bss; IEEEtypes_MgmtHdr_t *hdr; + t_u16 sub_type = 0; ENTER(); - if (pmpriv->curr_bss_params.host_mlme) { - hdr = (IEEEtypes_MgmtHdr_t *)&resp->params; - if (!memcmp(pmpriv->adapter, hdr->BssId, - pmpriv->pattempted_bss_desc->mac_address, - MLAN_MAC_ADDR_LENGTH)) - passoc_rsp = (IEEEtypes_AssocRsp_t - *)((t_u8 *)(&resp->params) + + hdr = (IEEEtypes_MgmtHdr_t *)&resp->params; + sub_type = IEEE80211_GET_FC_MGMT_FRAME_SUBTYPE(hdr->FrmCtl); + if (!memcmp(pmpriv->adapter, hdr->BssId, + pmpriv->pattempted_bss_desc->mac_address, + MLAN_MAC_ADDR_LENGTH) && + ((sub_type == SUBTYPE_ASSOC_RESP) || + (sub_type == SUBTYPE_REASSOC_RESP))) { + passoc_rsp = + (IEEEtypes_AssocRsp_t *)((t_u8 *)(&resp->params) + sizeof(IEEEtypes_MgmtHdr_t)); - else - passoc_rsp = (IEEEtypes_AssocRsp_t *)&resp->params; + pmpriv->curr_bss_params.host_mlme = MTRUE; } else - passoc_rsp = (IEEEtypes_AssocRsp_t *)&resp->params; passoc_rsp->status_code = wlan_le16_to_cpu(passoc_rsp->status_code); if (pmpriv->media_connected == MTRUE) @@ -2185,6 +2194,19 @@ mlan_status wlan_cmd_802_11_ad_hoc_start(mlan_private *pmpriv, wlan_cpu_to_le16(prsn_ie_tlv->header.len); } + if (pmpriv->curr_bss_params.host_mlme) { + MrvlIEtypes_HostMlme_t *host_mlme_tlv = + (MrvlIEtypes_HostMlme_t *)pos; + host_mlme_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HOST_MLME); + host_mlme_tlv->header.len = sizeof(host_mlme_tlv->host_mlme); + host_mlme_tlv->host_mlme = MTRUE; + pos += sizeof(host_mlme_tlv->header) + + host_mlme_tlv->header.len; + cmd_append_size += sizeof(MrvlIEtypes_HostMlme_t); + host_mlme_tlv->header.len = + wlan_cpu_to_le16(host_mlme_tlv->header.len); + } cmd->size = (t_u16)wlan_cpu_to_le16( (t_u16)(sizeof(HostCmd_DS_802_11_AD_HOC_START) + S_DS_GEN + cmd_append_size)); @@ -2480,6 +2502,20 @@ mlan_status wlan_cmd_802_11_ad_hoc_join(mlan_private *pmpriv, } } + if (pmpriv->curr_bss_params.host_mlme) { + MrvlIEtypes_HostMlme_t *host_mlme_tlv = + (MrvlIEtypes_HostMlme_t *)pos; + host_mlme_tlv->header.type = + wlan_cpu_to_le16(TLV_TYPE_HOST_MLME); + host_mlme_tlv->header.len = sizeof(host_mlme_tlv->host_mlme); + host_mlme_tlv->host_mlme = MTRUE; + pos += sizeof(host_mlme_tlv->header) + + host_mlme_tlv->header.len; + cmd_append_size += sizeof(MrvlIEtypes_HostMlme_t); + host_mlme_tlv->header.len = + wlan_cpu_to_le16(host_mlme_tlv->header.len); + } + cmd->size = (t_u16)wlan_cpu_to_le16( (t_u16)(sizeof(HostCmd_DS_802_11_AD_HOC_JOIN) + S_DS_GEN + cmd_append_size)); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_main.h b/mxm_wifiex/wlan_src/mlan/mlan_main.h index 11f59c6..b88cd01 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_main.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_main.h @@ -560,7 +560,14 @@ extern t_void (*assert_callback)(t_void *pmoal_handle, t_u32 cond); #ifdef SDIO #define MAX_SUPPORT_AMSDU_SIZE 4096 /** 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) #define MAX_MP_REGS 196 +#else +/* upto 0xB7 */ +#define MAX_MP_REGS 184 +#endif /** Maximum port */ #define MAX_PORT 32 /** Maximum port 16 */ @@ -2254,8 +2261,11 @@ typedef struct _mlan_pcie_card { mlan_buffer *cmdrsp_buf; /** Command buffer */ mlan_buffer *vdll_cmd_buf; + /** last write index where we have tx_done interrupt enabled */ + t_u32 last_write_index_with_irq; /** last tx_pkt_size */ t_u32 last_tx_pkt_size[MLAN_MAX_TXRX_BD]; + } mlan_pcie_card, *pmlan_pcie_card; #endif @@ -2436,9 +2446,13 @@ struct _mlan_adapter { t_u32 fw_cap_info; /** Extended firmware capability information */ t_u32 fw_cap_ext; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(SD9097) || defined(USB9097) || \ + defined(SDIW624) || defined(PCIEIW624) || defined(USBIW624) /** High byte for 5G, low byte for 2G, like 0x2211 0x22 for 5G, 0x11 for * 2G */ t_u16 user_htstream; +#endif /** vdll ctrl */ vdll_dnld_ctrl vdll_ctrl; #if defined(SDIO) || defined(PCIE) @@ -3197,6 +3211,11 @@ t_void wlan_process_bypass_tx(mlan_adapter *pmadapter); t_void wlan_cleanup_bypass_txq(pmlan_private priv); t_u8 wlan_bypass_tx_list_empty(mlan_adapter *pmadapter); +mlan_status wlan_misc_ioctl_tx_frame(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); +mlan_status wlan_cmd_tx_frame(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); + /** Check if this is the last packet */ t_u8 wlan_check_last_packet_indication(pmlan_private priv); @@ -4015,12 +4034,6 @@ mlan_status wlan_cmd_mac_control(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd, mlan_status wlan_ret_mac_control(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); -mlan_status wlan_cmd_cw_mode_ctrl(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_void *pdata_buf); -mlan_status wlan_ret_cw_mode_ctrl(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf); - mlan_status wlan_cmd_802_11_radio_control(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); @@ -4040,6 +4053,9 @@ mlan_status wlan_ret_reg_access(mlan_adapter *pmadapter, t_u16 type, mlan_ioctl_req *pioctl_buf); mlan_status wlan_ret_mem_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); +mlan_status wlan_ret_gpio_cfg_ops(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf); mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); @@ -4051,6 +4067,8 @@ mlan_status wlan_cmd_reg_access(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); mlan_status wlan_cmd_mem_access(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_cmd_gpio_cfg_ops(HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, + t_void *pdata_buf); mlan_status wlan_cmd_802_11_mac_address(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action); @@ -4243,9 +4261,6 @@ mlan_status wlan_misc_ioctl_low_pwr_mode(pmlan_adapter pmadapter, mlan_status wlan_misc_ioctl_pmic_configure(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); -mlan_status wlan_misc_ioctl_cwmode_ctrl(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req); - mlan_status wlan_set_mef_entry(mlan_private *pmpriv, pmlan_adapter pmadapter, mef_cfg_data *pmef); mlan_status wlan_process_mef_cfg_cmd(mlan_private *pmpriv, @@ -4289,11 +4304,12 @@ mlan_status wlan_ret_ch_load(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_status wlan_misc_ioctl_get_tsf(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); void wlan_add_fw_cfp_tables(pmlan_private pmpriv, t_u8 *buf, t_u16 buf_left); - void wlan_free_fw_cfp_tables(mlan_adapter *pmadapter); mlan_status wlan_misc_chan_reg_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); +mlan_status wlan_misc_region_power_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); mlan_status wlan_get_cfp_table(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); @@ -4341,6 +4357,9 @@ mlan_status wlan_cmd_fw_dump_event(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf); +mlan_status wlan_misc_gpiocfg(pmlan_adapter pmadapter, + mlan_ioctl_req *pioctl_req); + mlan_status wlan_misc_bootsleep(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); @@ -4381,6 +4400,11 @@ mlan_status wlan_ret_get_sensor_temp(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_ioctl_req *pioctl_buf); +mlan_status wlan_misc_ioctl_edmac_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req); +mlan_status wlan_cmd_edmac_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_void *pdata_buf); + /** Set/Get Country code */ mlan_status wlan_misc_ioctl_country_code(pmlan_adapter pmadapter, mlan_ioctl_req *pioctl_req); @@ -4743,4 +4767,10 @@ wlan_get_privs_by_two_cond(mlan_adapter *pmadapter, return count; } + +t_bool wlan_secure_add(t_void *datain, t_s32 add, t_void *dataout, + data_type type); +t_bool wlan_secure_sub(t_void *datain, t_s32 sub, t_void *dataout, + data_type type); + #endif /* !_MLAN_MAIN_H_ */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_misc.c b/mxm_wifiex/wlan_src/mlan/mlan_misc.c index 5dfbeb4..1da74c3 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_misc.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_misc.c @@ -330,6 +330,35 @@ mlan_status wlan_misc_ioctl_host_cmd(pmlan_adapter pmadapter, return ret; } +/** + * @brief send host cmd + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status wlan_misc_ioctl_tx_frame(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_cfg *misc = MNULL; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_TX_FRAME, + HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, + &misc->param.tx_frame); + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + /** * @brief Send function init/shutdown command to firmware * @@ -1638,15 +1667,27 @@ mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, switch (reg_mem->param.reg_rw.type) { case MLAN_REG_MAC: +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) case MLAN_REG_MAC2: +#endif cmd_no = HostCmd_CMD_MAC_REG_ACCESS; break; case MLAN_REG_BBP: +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) case MLAN_REG_BBP2: +#endif cmd_no = HostCmd_CMD_BBP_REG_ACCESS; break; case MLAN_REG_RF: +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) case MLAN_REG_RF2: +#endif cmd_no = HostCmd_CMD_RF_REG_ACCESS; break; case MLAN_REG_CAU: @@ -1656,12 +1697,21 @@ mlan_status wlan_reg_mem_ioctl_reg_rw(pmlan_adapter pmadapter, cmd_no = HostCmd_CMD_TARGET_ACCESS; break; case MLAN_REG_BCA: +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + 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) case MLAN_REG_CIU: cmd_no = HostCmd_CMD_REG_ACCESS; break; +#endif default: pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; ret = MLAN_STATUS_FAILURE; @@ -4117,6 +4167,9 @@ mlan_status wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, if (pioctl_req->action == MLAN_ACT_SET) { /* User input validation */ 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) if (IS_CARD9098(pmadapter->card_type) || IS_CARD9097(pmadapter->card_type) || IS_CARDAW693(pmadapter->card_type) || @@ -4159,9 +4212,15 @@ mlan_status wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, ant_cfg->tx_antenna, ant_cfg->rx_antenna); } else { +#endif + ant_cfg->tx_antenna &= 0x0003; ant_cfg->rx_antenna &= 0x0003; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) } +#endif if (!ant_cfg->tx_antenna || bitcount(ant_cfg->tx_antenna & 0x00FF) > pmadapter->number_of_antenna || @@ -5340,41 +5399,6 @@ mlan_status wlan_misc_ioctl_pmic_configure(pmlan_adapter pmadapter, return ret; } -/* @brief Set/Get CW Mode Level control - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pioctl_req A pointer to ioctl request buffer - * - * @return MLAN_STATUS_SUCCESS - */ -mlan_status wlan_misc_ioctl_cwmode_ctrl(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_ds_misc_cfg *misc = MNULL; - mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; - t_u16 cmd_action = 0; - - ENTER(); - - misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; - - if (pioctl_req->action == MLAN_ACT_SET) - cmd_action = HostCmd_ACT_GEN_SET; - else - cmd_action = HostCmd_ACT_GEN_GET; - - /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_CW_MODE_CTRL, cmd_action, 0, - (t_void *)pioctl_req, &misc->param.cwmode); - - if (ret == MLAN_STATUS_SUCCESS) - ret = MLAN_STATUS_PENDING; - - LEAVE(); - return ret; -} - /** * @brief push value to stack * @@ -6211,6 +6235,32 @@ mlan_status wlan_misc_ioctl_get_tsf(pmlan_adapter pmadapter, return ret; } +/** + * @brief Create custom regulatory cfg + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req A pointer to ioctl request buffer + * + * @return MLAN_STATUS_PENDING --success, otherwise fail + */ +mlan_status wlan_misc_region_power_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_status ret = MLAN_STATUS_SUCCESS; + ENTER(); + + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_REGION_POWER_CFG, + HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, + MNULL); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + /** * @brief Create custom regulatory cfg * @@ -6242,7 +6292,7 @@ mlan_status wlan_misc_chan_reg_cfg(pmlan_adapter pmadapter, misc_cfg->param.custom_reg_domain.region.country_code[0] != '\0' && misc_cfg->param.custom_reg_domain.region.country_code[1] != '\0') { /* Copy the driver country code in the custom_reg_domain. The - * cmd cmd response handler will use it to compare with the FW + * cmd response handler will use it to compare with the FW * country code */ pmadapter->country_code[0] = @@ -6252,7 +6302,7 @@ mlan_status wlan_misc_chan_reg_cfg(pmlan_adapter pmadapter, pmadapter->country_code[2] = '\0'; } - /* Send request to firmware */ + /* Send 2G/5G CFP table request to firmware */ ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_CHAN_REGION_CFG, cmd_action, 0, (t_void *)pioctl_req, MNULL); @@ -6597,6 +6647,41 @@ mlan_status wlan_misc_ioctl_net_monitor(pmlan_adapter pmadapter, return ret; } +/** + * @brief config gpio cfg + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req Pointer to the IOCTL request buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status wlan_misc_gpiocfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + mlan_ds_misc_cfg *misc = MNULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + t_u16 cmd_action = 0; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + if (pioctl_req->action == MLAN_ACT_GET) + cmd_action = HostCmd_ACT_GEN_GET; + else + cmd_action = HostCmd_ACT_GEN_SET; + + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_GPIO_CFG, cmd_action, 0, + (t_void *)pioctl_req, (t_void *)misc); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + /** * @brief config boot sleep * @@ -7553,3 +7638,226 @@ mlan_status wlan_misc_ioctl_reorder_flush_time(pmlan_adapter pmadapter, LEAVE(); return ret; } + +/** + * @brief configure edmac parameters + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pioctl_req Pointer to the IOCTL request buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +mlan_status wlan_misc_ioctl_edmac_cfg(pmlan_adapter pmadapter, + pmlan_ioctl_req pioctl_req) +{ + mlan_ds_misc_cfg *misc = MNULL; + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; + + ENTER(); + + misc = (mlan_ds_misc_cfg *)pioctl_req->pbuf; + + if (MLAN_ACT_SET == pioctl_req->action) { + misc->param.edmac_cfg.ed_ctrl_2g = 0x1; + misc->param.edmac_cfg.ed_offset_2g = 0x8; + misc->param.edmac_cfg.ed_ctrl_5g = 0x1; + misc->param.edmac_cfg.ed_offset_5g = 0x8; + misc->param.edmac_cfg.ed_bitmap_txq_lock = 0x1e00FF; + } else { + misc->param.edmac_cfg.ed_ctrl_2g = 0x0; + misc->param.edmac_cfg.ed_ctrl_5g = 0x0; + } + + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_EDMAC_CFG, + HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, + (t_void *)&misc->param.edmac_cfg); + + if (ret == MLAN_STATUS_SUCCESS) + ret = MLAN_STATUS_PENDING; + + LEAVE(); + return ret; +} + +/** + * @brief Add 2 variables securely, to prevent overflow. + * + * @param datain Pointer to 1st variable + * @param add 2nd variable value to add to 1st variable + * @param dataout Pointer to variable where sum is to be stored + * @param type Datatype of 1st and 2nd variable + * + * @return MTRUE if success or MFALSE if overflow error + */ +t_bool wlan_secure_add(t_void *datain, t_s32 add, t_void *dataout, + data_type type) +{ + t_bool status = MTRUE; + + switch (type) { + case TYPE_SINT8: + if (add > SINT8_MAX || *(t_s8 *)datain > SINT8_MAX - add) + goto fail; + else + *(t_s8 *)dataout = *(t_s8 *)datain + add; + break; + + case TYPE_UINT8: + if (add > UINT8_MAX || *(t_u8 *)datain > UINT8_MAX - add) + goto fail; + else + *(t_u8 *)dataout = *(t_u8 *)datain + add; + break; + + case TYPE_SINT16: + if (add > SINT16_MAX || *(t_s16 *)datain > SINT16_MAX - add) + goto fail; + else + *(t_s16 *)dataout = *(t_s16 *)datain + add; + break; + + case TYPE_UINT16: + if (add > UINT16_MAX || *(t_u16 *)datain > UINT16_MAX - add) + goto fail; + else + *(t_u16 *)dataout = *(t_u16 *)datain + add; + break; + + case TYPE_SINT32: + if (*(t_s32 *)datain > SINT32_MAX - add) + goto fail; + else + *(t_s32 *)dataout = *(t_s32 *)datain + add; + break; + + case TYPE_UINT32: + if (*(t_u32 *)datain > UINT32_MAX - add) + goto fail; + else + *(t_u32 *)dataout = *(t_u32 *)datain + add; + break; + + case TYPE_SINT64: + if (*(t_s64 *)datain > SINT64_MAX - add) + goto fail; + else + *(t_s64 *)dataout = *(t_s64 *)datain + add; + break; + + case TYPE_UINT64: + if (*(t_u64 *)datain > UINT64_MAX - add) + goto fail; + else + *(t_u64 *)dataout = *(t_u64 *)datain + add; + break; + + case TYPE_PTR: + if (*(t_ptr *)datain > PTR_MAX - add) + goto fail; + else + *(t_ptr *)dataout = *(t_ptr *)datain + add; + break; + + default: + status = MFALSE; + break; + } +ret: + return status; + +fail: + status = MFALSE; + goto ret; +} + +/** + * @brief Subtract 2 variables securely, to prevent underflow. + * + * @param datain Pointer to 1st variable + * @param add 2nd variable value to subtract from 1st variable + * @param dataout Pointer to variable where diff is to be stored + * @param type Datatype of 1st and 2nd variable + * + * @return MTRUE if success or MFALSE if underflow error + */ +t_bool wlan_secure_sub(t_void *datain, t_s32 sub, t_void *dataout, + data_type type) +{ + t_u8 status = MTRUE; + + switch (type) { + case TYPE_SINT8: + if (*(t_s8 *)datain >= (t_s8)SINT8_MIN + sub) + *(t_s8 *)dataout = *(t_s8 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT8: + if (*(t_u8 *)datain >= sub) + *(t_u8 *)dataout = *(t_u8 *)datain - sub; + else + goto fail; + break; + + case TYPE_SINT16: + if (*(t_s16 *)datain >= (t_s16)SINT16_MIN + sub) + *(t_s16 *)dataout = *(t_s16 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT16: + if (*(t_u16 *)datain >= sub) + *(t_u16 *)dataout = *(t_u16 *)datain - sub; + else + goto fail; + break; + + case TYPE_SINT32: + if (*(t_s32 *)datain >= (t_s32)SINT32_MIN + sub) + *(t_s32 *)dataout = *(t_s32 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT32: + if (*(t_u32 *)datain >= sub) + *(t_u32 *)dataout = *(t_u32 *)datain - sub; + else + goto fail; + break; + + case TYPE_SINT64: + if (*(t_s64 *)datain >= (t_s64)SINT64_MIN + sub) + *(t_s64 *)dataout = *(t_s64 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT64: + if (*(t_u64 *)datain >= sub) + *(t_u64 *)dataout = *(t_u64 *)datain - sub; + else + goto fail; + break; + + case TYPE_PTR: + if (*(t_ptr *)datain >= sub) + *(t_ptr *)dataout = *(t_ptr *)datain - sub; + else + goto fail; + break; + + default: + status = MFALSE; + break; + } +ret: + return status; + +fail: + status = MFALSE; + goto ret; +} diff --git a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c index 2525f98..9742db8 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c @@ -120,40 +120,6 @@ static const struct _mlan_card_info mlan_card_info_pcie8997 = { }; #endif -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, -}; - #if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) static const struct _mlan_pcie_card_reg mlan_reg_pcie9097_b0 = { .reg_txbd_rdptr = PCIE9098_TXBD_RDPTR, @@ -190,6 +156,7 @@ static const struct _mlan_pcie_card_reg mlan_reg_pcie9097_b0 = { }; #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) static const struct _mlan_pcie_card_reg mlan_reg_pcie9098 = { .reg_txbd_rdptr = PCIE9098_TXBD_RDPTR, .reg_txbd_wrptr = PCIE9098_TXBD_WRPTR, @@ -232,6 +199,7 @@ static const struct _mlan_card_info mlan_card_info_pcie9098 = { .default_11n_tx_bf_cap = DEFAULT_11N_TX_BF_CAP_2X2, .support_11mc = 1, }; +#endif /******************************************************** Global Variables ********************************************************/ @@ -243,6 +211,7 @@ 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) /** * @brief This function init the adma setting * @@ -578,6 +547,52 @@ static void wlan_pcie_init_adma_ring_size(mlan_adapter *pmadapter) return; } +#endif + +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +/** + * @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 t_u16 wlan_get_adma_buf_flag(mlan_adapter *pmadapter, t_u32 num_tx_buffs, + t_u32 wrindx) +{ + mlan_pcie_card *pcard = pmadapter->pcard_pcie; + t_u16 flags = 0; + /* enable DMA transfer done interrupt when ring is full so we don't need + * to wait when it became empty */ + const t_u32 txbd_pending_threshold = num_tx_buffs - 1; + const t_bool need_int_en = + pcard->txbd_pending >= txbd_pending_threshold; + + if (need_int_en) { + const t_u32 distance = num_tx_buffs / 2; + t_u32 past_wrindx = (wrindx - distance) & (num_tx_buffs - 1); + const t_u32 distance_to_last = + (past_wrindx - pcard->last_write_index_with_irq) & + (num_tx_buffs - 1); + + if (pcard->last_write_index_with_irq == 0xffffffff || + distance_to_last >= distance) { + flags = ADMA_BD_FLAG_INT_EN; + pcard->last_write_index_with_irq = past_wrindx; + } + } + + if (pcard->last_write_index_with_irq == wrindx) { + /* we are going to overwrite descriptor where we set interrupt, + * need to invalidate */ + pcard->last_write_index_with_irq = 0xffffffff; + } + return flags; +} + /** * @brief This function set the host interrupt select mask * @@ -623,7 +638,9 @@ static mlan_status wlan_pcie_set_host_int_select_mask(mlan_adapter *pmadapter, LEAVE(); return MLAN_STATUS_SUCCESS; } +#endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) /** * @brief This function handles command response completion * @@ -699,6 +716,7 @@ done: LEAVE(); return ret; } +#endif /** * @brief This function disables the host interrupt @@ -793,6 +811,7 @@ static mlan_status wlan_disable_pcie_host_int(mlan_adapter *pmadapter) LEAVE(); return ret; } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || (pmadapter->card_type == CARD_TYPE_PCIEIW624) || (pmadapter->card_type == CARD_TYPE_PCIEAW693) || @@ -803,6 +822,7 @@ static mlan_status wlan_disable_pcie_host_int(mlan_adapter *pmadapter) return ret; } } +#endif ret = wlan_pcie_disable_host_int_mask(pmadapter); LEAVE(); return ret; @@ -870,6 +890,7 @@ static mlan_status wlan_enable_pcie_host_int(mlan_adapter *pmadapter) LEAVE(); return ret; } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if ((pmadapter->card_type == CARD_TYPE_PCIE9098) || (pmadapter->card_type == CARD_TYPE_PCIEIW624) || (pmadapter->card_type == CARD_TYPE_PCIEAW693) || @@ -880,6 +901,7 @@ static mlan_status wlan_enable_pcie_host_int(mlan_adapter *pmadapter) return ret; } } +#endif ret = wlan_pcie_enable_host_int_mask(pmadapter); LEAVE(); return ret; @@ -900,7 +922,9 @@ 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) padma_dual_desc_buf padma_bd_buf; +#endif ENTER(); /* @@ -920,10 +944,12 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->txbd_ring_size = sizeof(adma_dual_desc_buf) * pmadapter->pcard_pcie->txrx_bd_size; +#endif PRINTM(MINFO, "TX ring: allocating %d bytes\n", pmadapter->pcard_pcie->txbd_ring_size); @@ -949,6 +975,7 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf @@ -965,6 +992,7 @@ static mlan_status wlan_pcie_create_txbd_ring(mlan_adapter *pmadapter) padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } +#endif #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { @@ -1002,7 +1030,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif ENTER(); @@ -1034,6 +1064,7 @@ static mlan_status wlan_pcie_delete_txbd_ring(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *) @@ -1047,6 +1078,7 @@ static mlan_status wlan_pcie_delete_txbd_ring(mlan_adapter *pmadapter) padma_bd_buf->reserved = 0; } } +#endif pmadapter->pcard_pcie->txbd_ring[i] = MNULL; } @@ -1084,7 +1116,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif ENTER(); @@ -1106,6 +1140,7 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) /* * driver maintaines the write pointer and firmware maintaines the read * pointer. The read pointer starts at 0 (zero) while the write pointer @@ -1118,6 +1153,7 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) sizeof(adma_dual_desc_buf) * pmadapter->pcard_pcie->txrx_bd_size; } +#endif PRINTM(MINFO, "RX ring: allocating %d bytes\n", pmadapter->pcard_pcie->rxbd_ring_size); @@ -1196,6 +1232,7 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf @@ -1213,6 +1250,7 @@ static mlan_status wlan_pcie_create_rxbd_ring(mlan_adapter *pmadapter) padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } +#endif } LEAVE(); @@ -1234,7 +1272,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif ENTER(); for (i = 0; i < pmadapter->pcard_pcie->txrx_bd_size; i++) { @@ -1250,6 +1290,7 @@ static mlan_status wlan_pcie_delete_rxbd_ring(mlan_adapter *pmadapter) pmadapter->pcard_pcie->rx_buf_list[i]); } pmadapter->pcard_pcie->rx_buf_list[i] = MNULL; + #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { prxbd_buf = (mlan_pcie_data_buf *) @@ -1263,6 +1304,7 @@ static mlan_status wlan_pcie_delete_rxbd_ring(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *) @@ -1276,6 +1318,7 @@ static mlan_status wlan_pcie_delete_rxbd_ring(mlan_adapter *pmadapter) padma_bd_buf->len = 0; } } +#endif pmadapter->pcard_pcie->rxbd_ring[i] = MNULL; } @@ -1312,7 +1355,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif ENTER(); /* @@ -1329,11 +1374,13 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { pmadapter->pcard_pcie->evtbd_wrptr = MLAN_MAX_EVT_BD; pmadapter->pcard_pcie->evtbd_ring_size = sizeof(adma_dual_desc_buf) * MLAN_MAX_EVT_BD; } +#endif PRINTM(MINFO, "Evt ring: allocating %d bytes\n", pmadapter->pcard_pcie->evtbd_ring_size); @@ -1399,6 +1446,7 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf @@ -1416,6 +1464,7 @@ static mlan_status wlan_pcie_create_evtbd_ring(mlan_adapter *pmadapter) padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } +#endif } LEAVE(); @@ -1437,7 +1486,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif ENTER(); for (i = 0; i < MLAN_MAX_EVT_BD; i++) { @@ -1451,6 +1502,7 @@ static mlan_status wlan_pcie_delete_evtbd_ring(mlan_adapter *pmadapter) } pmadapter->pcard_pcie->evt_buf_list[i] = MNULL; + #if defined(PCIE8997) || defined(PCIE8897) if (!pmadapter->pcard_pcie->reg->use_adma) { pevtbd_buf = @@ -1465,6 +1517,7 @@ static mlan_status wlan_pcie_delete_evtbd_ring(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *) @@ -1478,6 +1531,7 @@ static mlan_status wlan_pcie_delete_evtbd_ring(mlan_adapter *pmadapter) padma_bd_buf->reserved = 0; } } +#endif pmadapter->pcard_pcie->evtbd_ring[i] = MNULL; } @@ -1544,6 +1598,7 @@ static mlan_status wlan_pcie_alloc_cmdrsp_buf(mlan_adapter *pmadapter) pmbuf->data_len = MRVDRV_SIZE_OF_CMD_BUFFER; pmbuf->total_pcie_buf_len = MRVDRV_SIZE_OF_CMD_BUFFER; pmadapter->pcard_pcie->cmdrsp_buf = pmbuf; + LEAVE(); return MLAN_STATUS_SUCCESS; } @@ -1660,6 +1715,7 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) { if ((pmadapter->pcard_pcie->txbd_rdptr & ADMA_RW_PTR_WRAP_MASK) != (rdptr & ADMA_RW_PTR_WRAP_MASK)) @@ -1667,6 +1723,7 @@ static t_u8 wlan_check_tx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) else return MFALSE; } +#endif return MFALSE; } @@ -1692,8 +1749,10 @@ 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) adma_dual_desc_buf *padma_bd_buf; t_u32 wrptr; +#endif ENTER(); @@ -1714,6 +1773,7 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) { wrptr = rdptr & 0xffff; rdptr = rdptr >> ADMA_RPTR_START; @@ -1721,6 +1781,7 @@ static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) PRINTM(MINFO, "wlan: Unexpected wrptr 0x%x 0x%x\n", wrptr, pmadapter->pcard_pcie->txbd_wrptr); } +#endif /* free from previous txbd_rdptr to current txbd_rdptr */ while (wlan_check_tx_pending_buffer(pmadapter, rdptr)) { @@ -1771,6 +1832,7 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter->pcard_pcie @@ -1784,6 +1846,7 @@ static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) pmadapter->pcard_pcie->txbd_rdptr &= ADMA_RW_PTR_WRAP_MASK; } +#endif } if (unmap_count) @@ -1856,9 +1919,11 @@ exit_tx_proc: ((wrptr & rollover_ind) == (rdptr & rollover_ind))) #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) #define ADMA_TXBD_IS_FULL(wrptr, rdptr, mask, rollover_ind) \ (((wrptr & mask) == (rdptr & mask)) && \ ((wrptr & rollover_ind) != (rdptr & rollover_ind))) +#endif static t_u8 wlan_check_txbd_not_full(mlan_adapter *pmadapter) { @@ -1878,6 +1943,7 @@ static t_u8 wlan_check_txbd_not_full(mlan_adapter *pmadapter) return MFALSE; } #endif +#if defined(PCIE9098) || defined(PCIE9097) || 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; @@ -1889,6 +1955,7 @@ static t_u8 wlan_check_txbd_not_full(mlan_adapter *pmadapter) else return MFALSE; } +#endif return MFALSE; } @@ -1914,7 +1981,9 @@ 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) adma_dual_desc_buf *padma_bd_buf = MNULL; +#endif const t_u32 num_tx_buffs = pmadapter->pcard_pcie->txrx_bd_size; mlan_status ret = MLAN_STATUS_PENDING; mlan_status status; @@ -1927,6 +1996,11 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, ENTER(); + if (pmadapter->pcard_pcie->reg->use_adma) { + if (wlan_is_tx_pending(pmadapter)) + wlan_pcie_process_tx_complete(pmadapter); + } + if (!pmbuf) { PRINTM(MERROR, "%s() has no buffer", __FUNCTION__); ret = MLAN_STATUS_FAILURE; @@ -2001,6 +2075,7 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { wr_ptr_start = ADMA_WPTR_START; padma_bd_buf = (adma_dual_desc_buf *)pmadapter @@ -2009,9 +2084,11 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, 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->flags = wlan_cpu_to_le16( - ADMA_BD_FLAG_SOP | ADMA_BD_FLAG_EOP | - ADMA_BD_FLAG_INT_EN | ADMA_BD_FLAG_SRC_HOST); + 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 @@ -2024,6 +2101,7 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, pmadapter->pcard_pcie->txbd_wrptr &= ADMA_RW_PTR_WRAP_MASK; } +#endif pmadapter->pcard_pcie->txbd_pending++; PRINTM(MINFO, "REG_TXBD_WRPT(0x%x) = 0x%x\n", reg_txbd_wrptr, ((pmadapter->pcard_pcie->txbd_wrptr << wr_ptr_start) | @@ -2105,6 +2183,7 @@ done_unmap: ptx_bd_buf->offset = 0; } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma && padma_bd_buf) { padma_bd_buf->paddr = 0; padma_bd_buf->len = 0; @@ -2112,6 +2191,7 @@ done_unmap: padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } +#endif done: LEAVE(); return ret; @@ -2143,6 +2223,7 @@ static t_u8 wlan_check_rx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || 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)) @@ -2150,6 +2231,7 @@ static t_u8 wlan_check_rx_pending_buffer(mlan_adapter *pmadapter, t_u32 rdptr) else return MFALSE; } +#endif return MFALSE; } @@ -2187,6 +2269,7 @@ static t_u8 wlan_is_rx_pending_full(mlan_adapter *pmadapter, t_u32 rdptr) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || 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 & @@ -2198,6 +2281,7 @@ static t_u8 wlan_is_rx_pending_full(mlan_adapter *pmadapter, t_u32 rdptr) else return MFALSE; } +#endif return MFALSE; } @@ -2225,7 +2309,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif t_u32 in_ts_sec, in_ts_usec; ENTER(); @@ -2237,8 +2323,10 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; +#endif if (pmadapter->tp_state_on && wlan_is_rx_pending_full(pmadapter, rdptr)) { @@ -2399,6 +2487,7 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter->pcard_pcie @@ -2418,6 +2507,7 @@ static mlan_status wlan_pcie_process_recv_data(mlan_adapter *pmadapter) pmadapter->pcard_pcie->rxbd_wrptr &= ADMA_RW_PTR_WRAP_MASK; } +#endif PRINTM(MINFO, "RECV DATA: Updated \n", pmadapter->pcard_pcie->rxbd_wrptr, rdptr); @@ -2448,8 +2538,10 @@ 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 (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; +#endif } done: @@ -2592,6 +2684,7 @@ static mlan_status wlan_pcie_send_cmd(mlan_adapter *pmadapter, } } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { /* To send a command, the driver will: 1. driver prepare the cmdrep buffer for adma @@ -2609,6 +2702,7 @@ static mlan_status wlan_pcie_send_cmd(mlan_adapter *pmadapter, pmadapter->pcard_pcie->cmd_buf->data_len, MFALSE); } +#endif done: if ((ret == MLAN_STATUS_FAILURE) && pmadapter) pmadapter->cmd_sent = MFALSE; @@ -2759,6 +2853,7 @@ static mlan_status wlan_pcie_process_cmd_resp(mlan_adapter *pmadapter) } } #endif +#if defined(PCIE9098) || defined(PCIE9097) || 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 @@ -2771,6 +2866,7 @@ static mlan_status wlan_pcie_process_cmd_resp(mlan_adapter *pmadapter) goto done; } } +#endif } done: @@ -2830,6 +2926,7 @@ static t_u8 wlan_check_evt_buffer(mlan_adapter *pmadapter, t_u32 rdptr) return MFALSE; } #endif +#if defined(PCIE9098) || defined(PCIE9097) || 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)) @@ -2837,6 +2934,7 @@ static t_u8 wlan_check_evt_buffer(mlan_adapter *pmadapter, t_u32 rdptr) else return MFALSE; } +#endif return MFALSE; } @@ -2856,7 +2954,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif ENTER(); if (rd_index >= MLAN_MAX_EVT_BD) { @@ -2873,8 +2973,10 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) LEAVE(); return MLAN_STATUS_FAILURE; } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; +#endif PRINTM(MINFO, "EvtRdy: Initial \n", pmadapter->pcard_pcie->evtbd_wrptr, rdptr); if (wlan_check_evt_buffer(pmadapter, rdptr)) { @@ -2902,6 +3004,7 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter->pcard_pcie @@ -2912,6 +3015,7 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } +#endif pmadapter->pcard_pcie->evt_buf_list[rd_index] = MNULL; event = *((t_u32 *)&pmbuf_evt->pbuf[pmbuf_evt->data_offset + @@ -2949,9 +3053,11 @@ static mlan_status wlan_pcie_process_event_ready(mlan_adapter *pmadapter) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->evtbd_rdptr &= ADMA_RW_PTR_WRAP_MASK; +#endif /* Do not update the event write pointer here, wait till the buffer is released. This is just to make things simpler, @@ -3028,7 +3134,9 @@ 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) adma_dual_desc_buf *padma_bd_buf; +#endif ENTER(); @@ -3051,8 +3159,10 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, ret = MLAN_STATUS_FAILURE; goto done; } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) rdptr = rdptr >> ADMA_RPTR_START; +#endif if (!pmadapter->pcard_pcie->evt_buf_list[wrptr]) { pmbuf->data_len = MAX_EVENT_SIZE; @@ -3080,6 +3190,7 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { padma_bd_buf = (adma_dual_desc_buf *)pmadapter ->pcard_pcie->evtbd_ring[wrptr]; @@ -3093,6 +3204,7 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, padma_bd_buf->pkt_size = 0; padma_bd_buf->reserved = 0; } +#endif pmbuf = MNULL; } else { PRINTM(MINFO, @@ -3115,8 +3227,10 @@ static mlan_status wlan_pcie_event_complete(mlan_adapter *pmadapter, } } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) pmadapter->pcard_pcie->evtbd_wrptr &= ADMA_RW_PTR_WRAP_MASK; +#endif PRINTM(MINFO, "EvtCom: Updated \n", pmadapter->pcard_pcie->evtbd_wrptr, rdptr); @@ -3335,6 +3449,7 @@ static mlan_status wlan_pcie_prog_fw_w_helper(mlan_adapter *pmadapter, PRINTM(MERROR, "prog_fw: Unable to allocate mlan_buffer\n"); goto done; } + #if defined(PCIE9098) if (IS_PCIE9098(pmadapter->card_type)) { rev_id_reg = pmadapter->pcard_pcie->reg->reg_rev_id; @@ -3582,12 +3697,6 @@ mlan_status wlan_get_pcie_device(pmlan_adapter pmadapter) break; #endif - 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; default: PRINTM(MERROR, "can't get right pcie card type \n"); ret = MLAN_STATUS_FAILURE; @@ -3762,11 +3871,15 @@ mlan_status wlan_process_msix_int(mlan_adapter *pmadapter) wlan_recv_event(wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), MLAN_EVENT_ID_DRV_DEFER_CMDRESP, MNULL); } +#if defined(PCIE9098) || defined(PCIE9097) || 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; PRINTM(MINFO, "<--- CMD DNLD DONE Interrupt --->\n"); + wlan_recv_event(wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL); } +#endif PRINTM(MINFO, "cmd_sent=%d data_sent=%d\n", pmadapter->cmd_sent, pmadapter->data_sent); @@ -3885,6 +3998,7 @@ static mlan_status wlan_process_pcie_int_status(mlan_adapter *pmadapter) MLAN_BSS_ROLE_ANY), MLAN_EVENT_ID_DRV_DEFER_CMDRESP, MNULL); } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->host_intr_cmd_dnld && (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_cmd_dnld)) { @@ -3892,7 +4006,11 @@ static mlan_status wlan_process_pcie_int_status(mlan_adapter *pmadapter) ~pmadapter->pcard_pcie->reg->host_intr_cmd_dnld; pmadapter->pcie_cmd_dnld_int = MTRUE; PRINTM(MINFO, "<--- CMD DNLD DONE Interrupt --->\n"); + wlan_recv_event( + wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL); } +#endif if (pmadapter->pcard_pcie->pcie_int_mode == PCIE_INT_MODE_MSI) { pcb->moal_spin_lock(pmadapter->pmoal_handle, pmadapter->pint_lock); @@ -4176,8 +4294,10 @@ mlan_status wlan_pcie_host_to_card(pmlan_private pmpriv, t_u8 type, ret = wlan_pcie_send_data(pmadapter, type, pmbuf, tx_param); } else if (type == MLAN_TYPE_CMD) ret = wlan_pcie_send_cmd(pmadapter, pmbuf); +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) else if (type == MLAN_TYPE_VDLL) ret = wlan_pcie_send_vdll(pmadapter, pmbuf); +#endif LEAVE(); return ret; } @@ -4302,12 +4422,14 @@ 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 ((pmadapter->card_type == CARD_TYPE_PCIE9098) || (pmadapter->card_type == CARD_TYPE_PCIEIW624) || (pmadapter->card_type == CARD_TYPE_PCIEAW693) || (pmadapter->card_type == CARD_TYPE_PCIE9097)) { wlan_pcie_init_adma_ring_size(pmadapter); } +#endif pmadapter->pcard_pcie->cmdrsp_buf = MNULL; ret = wlan_pcie_create_txbd_ring(pmadapter); if (ret) @@ -4451,6 +4573,7 @@ mlan_status wlan_set_pcie_buf_config(mlan_private *pmpriv) } } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->reg->use_adma) { /** config ADMA for Tx Data */ wlan_init_adma(pmadapter, ADMA_TX_DATA, @@ -4471,6 +4594,7 @@ mlan_status wlan_set_pcie_buf_config(mlan_private *pmpriv) pmadapter->pcard_pcie->cmdrsp_buf->buf_pa, 0, MTRUE); } +#endif wlan_pcie_init_fw(pmadapter); LEAVE(); return ret; @@ -4652,8 +4776,10 @@ static void wlan_pcie_process_cmd_dnld(mlan_adapter *pmadapter) ENTER(); if (pmadapter->cmd_sent) pmadapter->cmd_sent = MFALSE; +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (pmadapter->pcard_pcie->vdll_cmd_buf) wlan_pcie_send_vdll_complete(pmadapter); +#endif LEAVE(); return; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_pcie.h b/mxm_wifiex/wlan_src/mlan/mlan_pcie.h index 54f1c5c..1c18d09 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_pcie.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_pcie.h @@ -186,6 +186,7 @@ Change log: /** PF start bit */ #define ADMA_MSIX_PF_BIT 24 +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) /** PCIE9098 dev_id/vendor id reg */ #define PCIE9098_DEV_ID_REG 0x0000 /** PCIE revision ID register */ @@ -322,6 +323,7 @@ Change log: #define PCIE9098_HOST_INTR_SEL_MASK \ (PCIE9098_HOST_INTR_DNLD_DONE | PCIE9098_HOST_INTR_UPLD_RDY | \ PCIE9098_HOST_INTR_CMD_DONE | PCIE9098_HOST_INTR_EVENT_RDY) +#endif #if defined(PCIE8997) || defined(PCIE8897) /* PCIE INTERNAL REGISTERS */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_scan.c b/mxm_wifiex/wlan_src/mlan/mlan_scan.c index c939781..cafb1a9 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_scan.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_scan.c @@ -3383,7 +3383,8 @@ static t_void wlan_scan_process_results(mlan_private *pmpriv) * Prepares domain info from scan table and downloads the * domain info command to the FW. */ - wlan_11d_prepare_dnld_domain_info_cmd(pmpriv); + if (pmpriv->bss_role == MLAN_BSS_ROLE_STA) + wlan_11d_prepare_dnld_domain_info_cmd(pmpriv); PRINTM(MMSG, "wlan: SCAN COMPLETED: scanned AP count=%d\n", pmadapter->num_in_scan_table); LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c index aec692c..2e76291 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c @@ -223,6 +223,9 @@ static const struct _mlan_card_info mlan_card_info_sd8897 = { }; #endif +#if defined(SD8977) || defined(SD8997) || defined(SD8987) || \ + defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ + defined(SD8978) || defined(SD9177) static const struct _mlan_sdio_card_reg mlan_reg_sd8977_sd8997 = { .start_rd_port = 0, .start_wr_port = 0, @@ -289,6 +292,7 @@ static const struct _mlan_sdio_card_reg mlan_reg_sd8977_sd8997 = { .fw_dnld_status_1_reg = 0xE9, .winner_check_reg = 0xFC, }; +#endif #ifdef SD8997 static const struct _mlan_card_info mlan_card_info_sd8997 = { @@ -322,15 +326,6 @@ static const struct _mlan_card_info mlan_card_info_sdiw624 = { }; #endif -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, -}; - #ifdef SD9098 static const struct _mlan_card_info mlan_card_info_sd9098 = { .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, @@ -1049,10 +1044,12 @@ 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) if (IS_SD9097(pmadapter->card_type) || IS_SDIW624(pmadapter->card_type) || IS_SDAW693(pmadapter->card_type) || IS_SD9177(pmadapter->card_type)) check_fw_status = MTRUE; +#endif /* Perform firmware data transfer */ do { @@ -2411,10 +2408,6 @@ mlan_status wlan_get_sdio_device(pmlan_adapter pmadapter) pmadapter->pcard_info = &mlan_card_info_sdiw624; break; #endif - case CARD_TYPE_SDAW693: - pmadapter->pcard_sd->reg = &mlan_reg_sd8977_sd8997; - pmadapter->pcard_info = &mlan_card_info_sdaw693; - break; #ifdef SD9177 case CARD_TYPE_SD9177: pmadapter->pcard_sd->reg = &mlan_reg_sd8977_sd8997; @@ -3024,6 +3017,7 @@ exit: return ret; } +#if (defined(SD9098) || defined(SD9097) || defined(SDIW624) || defined(SD9177)) /** * @brief This function sends vdll data to the card. * @@ -3065,6 +3059,7 @@ static mlan_status wlan_sdio_send_vdll(mlan_adapter *pmadapter, LEAVE(); return ret; } +#endif /** * @brief This function sends data to the card. @@ -3083,8 +3078,10 @@ static mlan_status wlan_sdio_host_to_card_ext(pmlan_private pmpriv, t_u8 type, mlan_status ret = MLAN_STATUS_SUCCESS; mlan_adapter *pmadapter = pmpriv->adapter; +#if (defined(SD9098) || defined(SD9097) || defined(SDIW624) || defined(SD9177)) if (type == MLAN_TYPE_VDLL) return wlan_sdio_send_vdll(pmadapter, pmbuf); +#endif ret = wlan_sdio_host_to_card(pmadapter, type, pmbuf, tx_param); if (type == MLAN_TYPE_DATA && ret == MLAN_STATUS_FAILURE) @@ -3110,6 +3107,7 @@ mlan_status wlan_alloc_sdio_mpa_buffers(mlan_adapter *pmadapter, { mlan_status ret = MLAN_STATUS_SUCCESS; pmlan_callbacks pcb = &pmadapter->callbacks; + t_u32 buf_size = 0; t_u8 mp_aggr_pkt_limit = pmadapter->pcard_sd->mp_aggr_pkt_limit; ENTER(); @@ -3117,9 +3115,12 @@ mlan_status wlan_alloc_sdio_mpa_buffers(mlan_adapter *pmadapter, if ((pmadapter->pcard_sd->max_segs < mp_aggr_pkt_limit) || (pmadapter->pcard_sd->max_seg_size < pmadapter->pcard_sd->max_sp_tx_size)) { + if (!wlan_secure_add(&mpa_tx_buf_size, DMA_ALIGNMENT, &buf_size, + TYPE_UINT32)) + PRINTM(MERROR, "%s:tx_buf_size overflow \n", __func__); + ret = pcb->moal_malloc( - pmadapter->pmoal_handle, - mpa_tx_buf_size + DMA_ALIGNMENT, + pmadapter->pmoal_handle, buf_size, MLAN_MEM_DEF | MLAN_MEM_DMA, (t_u8 **)&pmadapter->pcard_sd->mpa_tx.head_ptr); if (ret != MLAN_STATUS_SUCCESS || @@ -3141,9 +3142,12 @@ mlan_status wlan_alloc_sdio_mpa_buffers(mlan_adapter *pmadapter, if ((pmadapter->pcard_sd->max_segs < mp_aggr_pkt_limit) || (pmadapter->pcard_sd->max_seg_size < pmadapter->pcard_sd->max_sp_rx_size)) { + if (!wlan_secure_add(&mpa_rx_buf_size, DMA_ALIGNMENT, &buf_size, + TYPE_UINT32)) + PRINTM(MERROR, "%s:rx_buf_size overflow \n", __func__); + ret = pcb->moal_malloc( - pmadapter->pmoal_handle, - mpa_rx_buf_size + DMA_ALIGNMENT, + pmadapter->pmoal_handle, buf_size, MLAN_MEM_DEF | MLAN_MEM_DMA, (t_u8 **)&pmadapter->pcard_sd->mpa_rx.head_ptr); if (ret != MLAN_STATUS_SUCCESS || @@ -3384,6 +3388,9 @@ mlan_status wlan_reset_fw(pmlan_adapter pmadapter) ret = MLAN_STATUS_FAILURE; goto done; } +#if defined(SD8997) || defined(SD8977) || defined(SD8987) || \ + defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ + defined(SD8978) || defined(SD9177) if (MFALSE #ifdef SD8997 || IS_SD8997(pmadapter->card_type) @@ -3406,7 +3413,6 @@ mlan_status wlan_reset_fw(pmlan_adapter pmadapter) #ifdef SDIW624 || IS_SDIW624(pmadapter->card_type) #endif - || IS_SDAW693(pmadapter->card_type) #ifdef SD9177 || IS_SD9177(pmadapter->card_type) #endif @@ -3417,6 +3423,7 @@ mlan_status wlan_reset_fw(pmlan_adapter pmadapter) HOST_TO_CARD_EVENT_REG, value | HOST_POWER_UP); } +#endif /* Poll register around 100 ms */ for (tries = 0; tries < MAX_POLL_TRIES; ++tries) { pcb->moal_read_reg(pmadapter->pmoal_handle, reset_reg, &value); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_shim.c b/mxm_wifiex/wlan_src/mlan/mlan_shim.c index 0651be4..dd32094 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_shim.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_shim.c @@ -1385,7 +1385,19 @@ process_start: break; } #endif - +#ifdef PCIE + if (IS_PCIE(pmadapter->card_type)) { + if (pmadapter->pcard_pcie->reg->use_adma) { + if (wlan_is_tx_pending(pmadapter)) { + wlan_recv_event( + wlan_get_priv(pmadapter, + MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DELAY_TX_COMPLETE, + MNULL); + } + } + } +#endif } while (MTRUE); pcb->moal_spin_lock(pmadapter->pmoal_handle, @@ -1439,10 +1451,9 @@ mlan_status mlan_send_packet(t_void *padapter, pmlan_buffer pmbuf) eth_type = mlan_ntohs(*(t_u16 *)&pmbuf->pbuf[pmbuf->data_offset + MLAN_ETHER_PKT_TYPE_OFFSET]); - if (((pmadapter->priv[pmbuf->bss_index]->port_ctrl_mode == MTRUE) && - ((eth_type == MLAN_ETHER_PKT_TYPE_EAPOL) || - (eth_type == MLAN_ETHER_PKT_TYPE_ARP) || - (eth_type == MLAN_ETHER_PKT_TYPE_WAPI))) || + if ((eth_type == MLAN_ETHER_PKT_TYPE_EAPOL) || + (eth_type == MLAN_ETHER_PKT_TYPE_ARP) || + (eth_type == MLAN_ETHER_PKT_TYPE_WAPI) || (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) || (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) @@ -1908,6 +1919,9 @@ void mlan_process_pcie_interrupt_cb(t_void *padapter, int type) LEAVE(); return; } + } else if (type == TX_COMPLETE && !wlan_is_tx_pending(pmadapter)) { + LEAVE(); + return; } pmadapter->ops.process_int_status(pmadapter, type); switch (type) { @@ -1919,10 +1933,22 @@ void mlan_process_pcie_interrupt_cb(t_void *padapter, int type) mlan_rx_process(pmadapter, MNULL); } break; - case RX_EVENT: // Rx event case TX_COMPLETE: // Tx data complete + wlan_recv_event(wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DEFER_HANDLING, MNULL); + if (pmadapter->pcard_pcie->reg->use_adma) { + if (wlan_is_tx_pending(pmadapter)) + wlan_recv_event( + wlan_get_priv(pmadapter, + MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DELAY_TX_COMPLETE, + MNULL); + } + break; + case RX_EVENT: // Rx event case RX_CMD_RESP: // Rx CMD Resp - mlan_main_process(pmadapter); + if (mlan_main_process(pmadapter) == MLAN_STATUS_FAILURE) + PRINTM(MERROR, "mlan_main_process failed.\n"); break; case RX_CMD_DNLD: default: diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c index e7dd3d5..43eb0e6 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c @@ -1169,7 +1169,7 @@ static mlan_status wlan_cmd_802_11_key_material(pmlan_private pmpriv, PRINTM(MCMND, "Remove Key\n"); goto done; } - pkey_material->action = wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); + pkey_material->action = wlan_cpu_to_le16(cmd_action); pkey_material->key_param_set.key_idx = pkey->key_index & KEY_INDEX_MASK; pkey_material->key_param_set.type = wlan_cpu_to_le16(TLV_TYPE_KEY_PARAM_V2); @@ -3750,10 +3750,6 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, ret = wlan_cmd_802_11_rf_antenna(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; - case HostCmd_CMD_CW_MODE_CTRL: - ret = wlan_cmd_cw_mode_ctrl(pmpriv, cmd_ptr, cmd_action, - pdata_buf); - break; case HostCmd_CMD_TXPWR_CFG: ret = wlan_cmd_tx_power_cfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); @@ -4034,6 +4030,9 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, case HostCmd_CMD_MEM_ACCESS: ret = wlan_cmd_mem_access(cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_GPIO_CFG: + ret = wlan_cmd_gpio_cfg_ops(cmd_ptr, cmd_action, pdata_buf); + break; case HostCmd_CMD_INACTIVITY_TIMEOUT_EXT: ret = wlan_cmd_inactivity_timeout(cmd_ptr, cmd_action, pdata_buf); @@ -4175,6 +4174,13 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, sizeof(HostCmd_DS_CHAN_REGION_CFG) + S_DS_GEN); cmd_ptr->params.reg_cfg.action = wlan_cpu_to_le16(cmd_action); break; + case HostCmd_CMD_REGION_POWER_CFG: + cmd_ptr->command = wlan_cpu_to_le16(cmd_no); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_REGION_POWER_CFG) + S_DS_GEN); + cmd_ptr->params.rg_power_cfg.action = + wlan_cpu_to_le16(cmd_action); + break; case HostCmd_CMD_AUTO_TX: ret = wlan_cmd_auto_tx(pmpriv, cmd_ptr, cmd_action, cmd_oid, pdata_buf); @@ -4275,6 +4281,13 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, ret = wlan_cmd_cross_chip_synch(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_802_11_TX_FRAME: + ret = wlan_cmd_tx_frame(pmpriv, cmd_ptr, cmd_action, pdata_buf); + break; + case HostCmd_CMD_EDMAC_CFG: + ret = wlan_cmd_edmac_cfg(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; default: PRINTM(MERROR, "PREP_CMD: unknown command- %#x\n", cmd_no); ret = MLAN_STATUS_FAILURE; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c index a92a2c3..271b21e 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c @@ -158,7 +158,8 @@ static mlan_status wlan_process_cmdresp_error(mlan_private *pmpriv, ENTER(); if (resp->command != HostCmd_CMD_WMM_PARAM_CONFIG && - resp->command != HostCmd_CMD_CHAN_REGION_CFG) + resp->command != HostCmd_CMD_CHAN_REGION_CFG && + resp->command != HostCmd_CMD_REGION_POWER_CFG) PRINTM(MERROR, "CMD_RESP: cmd %#x error, result=%#x\n", resp->command, resp->result); if (pioctl_buf) @@ -335,6 +336,10 @@ static mlan_status wlan_process_cmdresp_error(mlan_private *pmpriv, ret = MLAN_STATUS_SUCCESS; PRINTM(MCMND, "FW don't support chan region cfg command!\n"); break; + case HostCmd_CMD_REGION_POWER_CFG: + ret = MLAN_STATUS_SUCCESS; + PRINTM(MCMND, "FW don't support region power cfg command!\n"); + break; default: break; } @@ -3354,9 +3359,6 @@ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, case HostCmd_CMD_802_11_RF_ANTENNA: ret = wlan_ret_802_11_rf_antenna(pmpriv, resp, pioctl_buf); break; - case HostCmd_CMD_CW_MODE_CTRL: - ret = wlan_ret_cw_mode_ctrl(pmpriv, resp, pioctl_buf); - break; case HostCmd_CMD_VERSION_EXT: ret = wlan_ret_ver_ext(pmpriv, resp, pioctl_buf); break; @@ -3511,6 +3513,9 @@ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, case HostCmd_CMD_MEM_ACCESS: ret = wlan_ret_mem_access(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_GPIO_CFG: + ret = wlan_ret_gpio_cfg_ops(pmpriv, resp, pioctl_buf); + break; case HostCmd_CMD_INACTIVITY_TIMEOUT_EXT: ret = wlan_ret_inactivity_timeout(pmpriv, resp, pioctl_buf); break; @@ -3612,6 +3617,8 @@ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, case HostCmd_CMD_CHAN_REGION_CFG: ret = wlan_ret_chan_region_cfg(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_REGION_POWER_CFG: + break; case HostCmd_CMD_AUTO_TX: ret = wlan_ret_auto_tx(pmpriv, resp, pioctl_buf); break; @@ -3695,6 +3702,10 @@ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, case HostCmd_CMD_CROSS_CHIP_SYNCH: ret = wlan_ret_cross_chip_synch(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_802_11_TX_FRAME: + break; + case HostCmd_CMD_EDMAC_CFG: + break; default: PRINTM(MERROR, "CMD_RESP: Unknown command response %#x\n", resp->command); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c index b75746e..1586fa8 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c @@ -62,6 +62,49 @@ static t_void wlan_handle_disconnect_event(pmlan_private pmpriv) LEAVE(); } +/** + * @brief This function iterates over station list and notifies + * mac address of each sta to respective event handler. + * + * @param priv A pointer to mlan_private structure + * @event_id A reference to mlan event + * @return N/A + */ +static void wlan_notify_stations(mlan_private *priv, mlan_event_id event_id) +{ + sta_node *sta_ptr; + t_u8 event_buf[128]; + mlan_event *pevent = (mlan_event *)event_buf; + t_u8 *pbuf; + + ENTER(); + sta_ptr = (sta_node *)util_peek_list( + priv->adapter->pmoal_handle, &priv->sta_list, + priv->adapter->callbacks.moal_spin_lock, + priv->adapter->callbacks.moal_spin_unlock); + + if (!sta_ptr) { + LEAVE(); + return; + } + + while (sta_ptr != (sta_node *)&priv->sta_list) { + memset(priv->adapter, event_buf, 0, sizeof(event_buf)); + pevent->bss_index = priv->bss_index; + pevent->event_id = event_id; + pevent->event_len = MLAN_MAC_ADDR_LENGTH + 2; + pbuf = (t_u8 *)pevent->event_buf; + /* reason field set to 0, Unspecified */ + memcpy_ext(priv->adapter, pbuf + 2, sta_ptr->mac_addr, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + wlan_recv_event(priv, pevent->event_id, pevent); + sta_ptr = sta_ptr->pnext; + } + + LEAVE(); + return; +} + /** * @brief This function will parse the TDLS event for further wlan action * @@ -334,6 +377,75 @@ static void wlan_send_tdls_tear_down_request(pmlan_private priv) return; } +/** + * @brief This function will handle the generic NAN event for further wlan + * action based on the Event subtypes + * + * @param pmpriv A pointer to mlan_private + * @param evt_buf A pointer to mlan_event + * @param pmbuf A pointer to mlan buffer + * + * @return N/A + */ +static void wlan_process_nan_event(pmlan_private pmpriv, pmlan_buffer pmbuf) +{ + t_u8 *evt_buf = MNULL; + mlan_event *pevent; + mlan_status ret = MLAN_STATUS_SUCCESS; + event_nan_generic *nan_event = + (event_nan_generic *)(pmbuf->pbuf + pmbuf->data_offset + + sizeof(mlan_event_id)); + pmlan_adapter pmadapter = pmpriv->adapter; + pmlan_callbacks pcb = &pmadapter->callbacks; + + ENTER(); + + ret = pcb->moal_malloc(pmadapter->pmoal_handle, MAX_EVENT_SIZE, + MLAN_MEM_DEF, &evt_buf); + if (ret != MLAN_STATUS_SUCCESS || !evt_buf) { + LEAVE(); + return; + } + + pevent = (pmlan_event)evt_buf; + + pevent->bss_index = pmpriv->bss_index; + if (wlan_le16_to_cpu(nan_event->event_sub_type) == + NAN_EVT_SUBTYPE_SD_EVENT || + wlan_le16_to_cpu(nan_event->event_sub_type) == + NAN_EVT_SUBTYPE_SDF_TX_DONE) { + pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU; + pevent->event_len = pmbuf->data_len; + memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, + pmbuf->pbuf + pmbuf->data_offset, pevent->event_len, + pevent->event_len); + wlan_recv_event(pmpriv, pevent->event_id, pevent); + pcb->moal_mfree(pmadapter->pmoal_handle, evt_buf); + } else { + t_u8 test_mac[MLAN_MAC_ADDR_LENGTH] = {0x00, 0x11, 0x22, + 0x33, 0x44, 0x55}; + pevent->event_id = MLAN_EVENT_ID_DRV_CONNECTED; + pevent->event_len = MLAN_MAC_ADDR_LENGTH; + memcpy_ext(pmpriv->adapter, (t_u8 *)pevent->event_buf, test_mac, + MLAN_MAC_ADDR_LENGTH, pevent->event_len); + wlan_ralist_add(pmpriv, test_mac); + memcpy_ext(pmpriv->adapter, + pmpriv->curr_bss_params.bss_descriptor.mac_address, + test_mac, MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); + wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_CONNECTED, pevent); + if (pmpriv->port_ctrl_mode == MTRUE) + pmpriv->port_open = MTRUE; + pmpriv->media_connected = MTRUE; + PRINTM_NETINTF(MEVENT, pmpriv); + PRINTM(MEVENT, "nan interface - opened\n"); + pcb->moal_mfree(pmadapter->pmoal_handle, evt_buf); + } + + LEAVE(); + return; +} + /******************************************************** Global Functions ********************************************************/ @@ -377,10 +489,6 @@ t_void wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) else #endif wlan_11h_check_update_radar_det_state(priv); -#if defined(USB) - if (IS_USB(pmadapter->card_type)) - wlan_resync_usb_port(pmadapter); -#endif } if (priv->port_ctrl_mode == MTRUE) { @@ -887,6 +995,8 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) wlan_clean_txrx(pmpriv); wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_ADHOC_LINK_LOST, MNULL); + /* Notify IBSS disconnect handler to delete stations if any. */ + wlan_notify_stations(pmpriv, MLAN_EVENT_ID_FW_IBSS_DISCONNECT); break; case EVENT_ASSOC_REQ_IE: pmpriv->assoc_req_size = pmbuf->data_len - sizeof(eventcause); @@ -932,10 +1042,6 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_PORT_RELEASE, MNULL); /* Send OBSS scan param to the application */ wlan_2040_coex_event(pmpriv); -#if defined(USB) - if (IS_USB(pmadapter->card_type)) - wlan_resync_usb_port(pmadapter); -#endif break; case EVENT_STOP_TX: @@ -1296,8 +1402,22 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) break; case EVENT_IBSS_STATION_CONNECT: + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_FW_IBSS_CONNECT; + pevent->event_len = pmbuf->data_len; + memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, + pmbuf->pbuf + pmbuf->data_offset, pevent->event_len, + pevent->event_len); + wlan_recv_event(pmpriv, pevent->event_id, pevent); break; case EVENT_IBSS_STATION_DISCONNECT: + pevent->bss_index = pmpriv->bss_index; + pevent->event_id = MLAN_EVENT_ID_FW_IBSS_DISCONNECT; + pevent->event_len = pmbuf->data_len; + memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf, + pmbuf->pbuf + pmbuf->data_offset, pevent->event_len, + pevent->event_len); + wlan_recv_event(pmpriv, pevent->event_id, pevent); break; case EVENT_SAD_REPORT: { #ifdef DEBUG_LEVEL1 @@ -1339,6 +1459,10 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) PRINTM(MEVENT, "EVENT: BT coex wlan param update\n"); wlan_bt_coex_wlan_param_update_event(pmpriv, pmbuf); break; + case EVENT_NAN_GENERIC: + PRINTM(MEVENT, "EVENT: NAN_GENERIC_EVENT\n"); + wlan_process_nan_event(pmpriv, pmbuf); + break; #if defined(PCIE) case EVENT_SSU_DUMP_DMA: diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c index e6decf6..c0adaaf 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c @@ -468,6 +468,10 @@ static mlan_status wlan_get_info_ioctl(pmlan_adapter pmadapter, IS_FW_SUPPORT_BEACON_PROT(pmadapter) ? 0x01 : 0x00; pget_info->param.fw_info.rtt_support = IS_FW_SUPPORT_RTT(pmadapter) ? 0x01 : 0x00; + pget_info->param.fw_info.cmd_tx_data = + IS_FW_SUPPORT_CMD_TX_DATA(pmadapter) ? 0x01 : 0x00; + pget_info->param.fw_info.sec_rgpower = + IS_FW_SUPPORT_SEC_RG_POWER(pmadapter) ? 0x01 : 0x00; break; case MLAN_OID_GET_BSS_INFO: status = wlan_get_info_bss_info(pmadapter, pioctl_req); @@ -1504,6 +1508,7 @@ static mlan_status wlan_bss_ioctl(pmlan_adapter pmadapter, { mlan_status status = MLAN_STATUS_SUCCESS; mlan_ds_bss *bss = MNULL; + mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; ENTER(); @@ -1519,6 +1524,9 @@ static mlan_status wlan_bss_ioctl(pmlan_adapter pmadapter, bss = (mlan_ds_bss *)pioctl_req->pbuf; switch (bss->sub_command) { + case MLAN_OID_BSS_HOST_MLME: + pmpriv->curr_bss_params.host_mlme = MTRUE; + break; case MLAN_OID_BSS_START: status = wlan_bss_ioctl_start(pmadapter, pioctl_req); break; @@ -2998,7 +3006,7 @@ static mlan_status wlan_sec_ioctl_set_wpa_key(pmlan_adapter pmadapter, } ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, 0, (t_void *)pioctl_req, + pioctl_req->action, 0, (t_void *)pioctl_req, &sec->param.encrypt_key); if (ret == MLAN_STATUS_SUCCESS) @@ -3113,7 +3121,8 @@ static mlan_status wlan_sec_ioctl_encrypt_key(pmlan_adapter pmadapter, mlan_ds_sec_cfg *sec = MNULL; ENTER(); sec = (mlan_ds_sec_cfg *)pioctl_req->pbuf; - if (pioctl_req->action == MLAN_ACT_SET) { + if ((pioctl_req->action == MLAN_ACT_SET) || + (pioctl_req->action == MLAN_ACT_CLEAR)) { if (sec->param.encrypt_key.is_wapi_key) status = wlan_sec_ioctl_set_wapi_key(pmadapter, pioctl_req); @@ -5225,9 +5234,6 @@ static mlan_status wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, case MLAN_OID_MISC_PMIC_CFG: status = wlan_misc_ioctl_pmic_configure(pmadapter, pioctl_req); break; - case MLAN_OID_MISC_CWMODE_CTRL: - status = wlan_misc_ioctl_cwmode_ctrl(pmadapter, pioctl_req); - break; case MLAN_OID_MISC_MEF_FLT_CFG: status = wlan_misc_ioctl_mef_flt_cfg(pmadapter, pioctl_req); break; @@ -5283,6 +5289,9 @@ static mlan_status wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, case MLAN_OID_MISC_GET_CHAN_REGION_CFG: status = wlan_misc_chan_reg_cfg(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_REGION_POWER_CFG: + status = wlan_misc_region_power_cfg(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_CLOUD_KEEP_ALIVE: status = wlan_misc_cloud_keep_alive(pmadapter, pioctl_req); break; @@ -5316,6 +5325,9 @@ static mlan_status wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, case MLAN_OID_MISC_GET_TX_RX_HISTOGRAM: status = wlan_get_tx_rx_histogram(pmadapter, pioctl_req); break; + case MLAN_OID_MISC_GPIO_CFG: + status = wlan_misc_gpiocfg(pmadapter, pioctl_req); + break; case MLAN_OID_MISC_BOOT_SLEEP: status = wlan_misc_bootsleep(pmadapter, pioctl_req); break; @@ -5403,7 +5415,12 @@ static mlan_status wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, status = wlan_misc_ioctl_reorder_flush_time(pmadapter, pioctl_req); break; - + case MLAN_OID_MISC_TX_FRAME: + status = wlan_misc_ioctl_tx_frame(pmadapter, pioctl_req); + break; + case MLAN_OID_MISC_EDMAC_CONFIG: + status = wlan_misc_ioctl_edmac_cfg(pmadapter, pioctl_req); + break; default: if (pioctl_req) pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_txrx.c b/mxm_wifiex/wlan_src/mlan/mlan_txrx.c index d97e36d..0610f5c 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_txrx.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_txrx.c @@ -89,7 +89,85 @@ done: LEAVE(); return ret; } +Stats_mcast_drv_t gmcast_stats = {0}; +/* This flag is used to protect the mcast drv stat update + * when it's value is copied to provide to mlanutl + * MTRUE = Update is allowed + * MFALSE = Update is not allowed + */ +t_u8 mcast_drv_update_allow_flag = MTRUE; +#define DEST_MAC_OFFSET 10 +#define CYCLE_START 1 +#define FIVE_SEC 5000000 /* 1000000 usec = 1sec*/ +/** + * @brief This function calculates the cycle delta and driver time delta + * for Mcast packets + * + * @param pmadapter A pointer to pmlan_adapter structure + * @param pmbuf A pointer to the mlan_buffer for process + * + * @return Nothing + */ +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; + t_u32 curr_ts_sec = 0; + t_u32 curr_ts_usec = 0; + t_u64 cycle_delta = 0; + t_u64 profile_delta = 0; + if (mcast_drv_update_allow_flag == MFALSE) + return; + /* Take current time */ + if (pmadapter && pmadapter->pmoal_handle) + pmadapter->callbacks.moal_get_system_time( + pmadapter->pmoal_handle, &curr_ts_sec, &curr_ts_usec); + else + PRINTM(MERROR, "ERR: pmadapter or pmoal_handle NULL\n", + __func__); + + if (curr_ts_sec || curr_ts_usec) { + /* Calculate profile delta */ + profile_delta = (curr_ts_sec - pmbuf->in_ts_sec) * 1000000; + profile_delta += (t_s32)(curr_ts_usec - pmbuf->in_ts_usec); + + if ((profile_delta >= 0) && (profile_delta <= 1000)) + gmcast_stats.spent_time_under_1000usec++; + else if ((profile_delta > 1000) && (profile_delta <= 2000)) + gmcast_stats.spent_time_over_1000usec++; + else if ((profile_delta > 2000) && (profile_delta <= 3000)) + gmcast_stats.spent_time_over_2000usec++; + else if (profile_delta > 3000) + gmcast_stats.spent_time_over_3000usec++; + } + /* Process the start cycle data */ + cycle_delta = (pmbuf->in_ts_sec - prev_mcast_sec) * 1000000; + cycle_delta += (t_s32)(pmbuf->in_ts_usec - prev_mcast_usec); + + /* If start cycle delta is more than 5 sec ignore*/ + if ((pmbuf->u.mc_tx_info.mc_pkt_flags & (1 << CYCLE_START)) && + (cycle_delta < FIVE_SEC)) { + if ((cycle_delta >= 0) && (cycle_delta <= 2300)) + gmcast_stats.cycle_recv_under_2300usec++; + if ((cycle_delta > 2300) && (cycle_delta <= 2900)) + gmcast_stats.cycle_recv_in_time++; + if ((cycle_delta > 2900) && (cycle_delta <= 3500)) + gmcast_stats.cycle_recv_over_2900usec++; + if ((cycle_delta > 3500) && (cycle_delta <= 5000)) + gmcast_stats.cycle_recv_over_3500usec++; + if ((cycle_delta > 5000) && (cycle_delta <= 10000)) + gmcast_stats.cycle_recv_over_5000usec++; + if ((cycle_delta > 10000) && (cycle_delta <= 15000)) + gmcast_stats.cycle_recv_over_10000usec++; + if (cycle_delta > 15000) + gmcast_stats.cycle_recv_over_15000usec++; + } + /* Update the last received mcast cycle value */ + prev_mcast_sec = pmbuf->in_ts_sec; + prev_mcast_usec = pmbuf->in_ts_usec; +} /** * @brief This function checks the conditions and sends packet to device * @@ -112,6 +190,7 @@ mlan_status wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf, #ifdef STA_SUPPORT PTxPD plocal_tx_pd = MNULL; #endif + t_u8 dest_mac_first_octet = 0; ENTER(); head_ptr = (t_u8 *)priv->ops.process_txpd(priv, pmbuf); @@ -124,6 +203,11 @@ mlan_status wlan_process_tx(pmlan_private priv, pmlan_buffer pmbuf, if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) plocal_tx_pd = (TxPD *)(head_ptr + priv->intf_hr_len); #endif + dest_mac_first_octet = *(head_ptr + priv->intf_hr_len + sizeof(TxPD) + + DEST_MAC_OFFSET); + + if (dest_mac_first_octet & 0x01) + wlan_drv_mcast_cycle_delay_calulation(pmadapter, pmbuf); if (pmadapter->tp_state_on) pmadapter->callbacks.moal_tp_accounting(pmadapter->pmoal_handle, pmbuf, 4); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c index 2c84a8e..0548354 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c @@ -197,7 +197,8 @@ static mlan_status uap_process_cmdresp_error(mlan_private *pmpriv, ENTER(); if (resp->command != HostCmd_CMD_WMM_PARAM_CONFIG && - resp->command != HostCmd_CMD_CHAN_REGION_CFG) + resp->command != HostCmd_CMD_CHAN_REGION_CFG && + resp->command != HostCmd_CMD_REGION_POWER_CFG) PRINTM(MERROR, "CMD_RESP: cmd %#x error, result=%#x\n", resp->command, resp->result); if (pioctl_buf) @@ -291,6 +292,10 @@ static mlan_status uap_process_cmdresp_error(mlan_private *pmpriv, ret = MLAN_STATUS_SUCCESS; PRINTM(MCMND, "FW don't support chan region cfg command!\n"); break; + case HostCmd_CMD_REGION_POWER_CFG: + ret = MLAN_STATUS_SUCCESS; + PRINTM(MCMND, "FW don't support region power cfg command!\n"); + break; case HostCmd_CMD_802_11_REMAIN_ON_CHANNEL: if (resp->result == HostCmd_RESULT_BUSY) pmadapter->dbg.num_remain_chan_err++; @@ -711,7 +716,11 @@ static mlan_status wlan_uap_cmd_ap_config(pmlan_private pmpriv, t_u8 zero_mac[] = {0, 0, 0, 0, 0, 0}; t_u16 i; t_u16 ac; +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) int rx_mcs_supp = 0; +#endif ENTER(); if (pioctl_buf == MNULL) { @@ -1320,9 +1329,13 @@ static mlan_status wlan_uap_cmd_ap_config(pmlan_private pmpriv, memcpy_ext(pmpriv->adapter, tlv_htcap->ht_cap.supported_mcs_set, bss->param.bss_config.supported_mcs_set, 16, 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) if (IS_CARD9098(pmpriv->adapter->card_type) || IS_CARDIW624(pmpriv->adapter->card_type) || - IS_CARD9097(pmpriv->adapter->card_type)) { + IS_CARD9097(pmpriv->adapter->card_type) || + IS_CARDAW693(pmpriv->adapter->card_type)) { if (bss->param.bss_config.supported_mcs_set[0]) { if (bss->param.bss_config.bandcfg.chanBand == BAND_5GHZ) @@ -1346,6 +1359,7 @@ static mlan_status wlan_uap_cmd_ap_config(pmlan_private pmpriv, } } } +#endif tlv_htcap->ht_cap.ht_ext_cap = wlan_cpu_to_le16(bss->param.bss_config.ht_ext_cap); tlv_htcap->ht_cap.tx_bf_cap = @@ -3529,7 +3543,7 @@ static mlan_status wlan_uap_cmd_key_material(pmlan_private pmpriv, PRINTM(MCMND, "Remove Key\n"); goto done; } - pkey_material->action = wlan_cpu_to_le16(HostCmd_ACT_GEN_SET); + pkey_material->action = wlan_cpu_to_le16(cmd_action); pkey_material->key_param_set.key_idx = pkey->key_index & KEY_INDEX_MASK; pkey_material->key_param_set.type = wlan_cpu_to_le16(TLV_TYPE_KEY_PARAM_V2); @@ -4567,6 +4581,9 @@ static mlan_status wlan_ret_add_station(pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } +extern Stats_mcast_drv_t gmcast_stats; +extern t_u8 mcast_drv_update_allow_flag; +#define OP_RESET 3 /** * @brief This function prepares command of per peer stats * @@ -4600,6 +4617,13 @@ static mlan_status wlan_cmd_stats(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, (Stats_Cfg_Params_TLV_t *)stats_cmd->tlv_buffer; *cfg_param = *stats_param; } + /* To identify the reset operation */ + if (stats_param->op == OP_RESET) { + mcast_drv_update_allow_flag = MFALSE; + memset(pmpriv->adapter, &gmcast_stats, 0, + sizeof(Stats_mcast_drv_t)); + mcast_drv_update_allow_flag = MTRUE; + } } else { cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_STATS) + S_DS_GEN); @@ -4624,6 +4648,7 @@ static mlan_status wlan_ret_stats(pmlan_private pmpriv, { HostCmd_DS_STATS *cfg_cmd = (HostCmd_DS_STATS *)&resp->params.stats; mlan_ds_misc_cfg *misc_cfg = MNULL; + Stats_Cfg_Params_TLV_t *stats_param = MNULL; t_u8 *pBuf = (t_u8 *)&cfg_cmd->tlv_buffer; int len = resp->size; @@ -4636,6 +4661,29 @@ static mlan_status wlan_ret_stats(pmlan_private pmpriv, len); misc_cfg->param.stats.tlv_len = len; pioctl_buf->buf_len = sizeof(mlan_ds_stats) + len - 1; + + stats_param = + (Stats_Cfg_Params_TLV_t *)misc_cfg->param.stats.tlv_buf; + if (stats_param && (stats_param->tlvHeader.type == + NXP_802_11_PER_PEER_STATS_ENTRY_TLV_ID)) { + /* add the mcast drv stats */ + mcast_drv_update_allow_flag = MFALSE; + /* Adding the Mcast drv stats to stats tlv_buf */ + memcpy_ext(pmpriv->adapter, + (t_u8 *)(((t_u8 *)&misc_cfg->param.stats + .tlv_buf) + + len), + (t_u8 *)&gmcast_stats, + sizeof(Stats_mcast_drv_t), + sizeof(Stats_mcast_drv_t)); + mcast_drv_update_allow_flag = MTRUE; + /* Updating the tlv_len */ + misc_cfg->param.stats.tlv_len = + len + sizeof(Stats_mcast_drv_t); + + pioctl_buf->buf_len = sizeof(mlan_ds_stats) + len + + sizeof(Stats_mcast_drv_t) - 1; + } } LEAVE(); @@ -4933,6 +4981,13 @@ mlan_status wlan_ops_uap_prepare_cmd(t_void *priv, t_u16 cmd_no, sizeof(HostCmd_DS_CHAN_REGION_CFG) + S_DS_GEN); cmd_ptr->params.reg_cfg.action = wlan_cpu_to_le16(cmd_action); break; + case HostCmd_CMD_REGION_POWER_CFG: + cmd_ptr->command = wlan_cpu_to_le16(cmd_no); + cmd_ptr->size = wlan_cpu_to_le16( + sizeof(HostCmd_DS_REGION_POWER_CFG) + S_DS_GEN); + cmd_ptr->params.rg_power_cfg.action = + wlan_cpu_to_le16(cmd_action); + break; case HostCmd_CMD_802_11_NET_MONITOR: ret = wlan_cmd_net_monitor(pmpriv, cmd_ptr, cmd_action, pdata_buf); @@ -5059,6 +5114,13 @@ mlan_status wlan_ops_uap_prepare_cmd(t_void *priv, t_u16 cmd_no, ret = wlan_cmd_802_11_scan_ext(pmpriv, cmd_ptr, pdata_buf); break; #endif + case HostCmd_CMD_802_11_TX_FRAME: + ret = wlan_cmd_tx_frame(pmpriv, cmd_ptr, cmd_action, pdata_buf); + break; + case HostCmd_CMD_EDMAC_CFG: + ret = wlan_cmd_edmac_cfg(pmpriv, cmd_ptr, cmd_action, + pdata_buf); + break; default: PRINTM(MERROR, "PREP_CMD: unknown command- %#x\n", cmd_no); if (pioctl_req) @@ -5131,10 +5193,6 @@ mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, wlan_11h_radar_detected_callback((t_void *)pmpriv); wlan_coex_ampdu_rxwinsize(pmadapter); pmpriv->uap_host_based = 0; -#if defined(USB) - if (IS_USB(pmadapter->card_type)) - wlan_resync_usb_port(pmadapter); -#endif break; case HostCmd_CMD_APCMD_BSS_START: if (!pmpriv->intf_state_11h.is_11h_host && @@ -5154,13 +5212,12 @@ mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, pmpriv->uap_bss_started = MFALSE; pmpriv->uap_host_based = 0; ret = wlan_uap_ret_sys_reset(pmpriv, resp, pioctl_buf); - wlan_11h_reset_dfs_checking_chan_dfs_state(priv, DFS_USABLE); + if (!(wlan_is_etsi_country(pmpriv->adapter, + pmpriv->adapter->country_code))) + wlan_11h_reset_dfs_checking_chan_dfs_state(priv, + DFS_USABLE); wlan_11h_check_update_radar_det_state(pmpriv); wlan_coex_ampdu_rxwinsize(pmadapter); -#if defined(USB) - if (IS_USB(pmadapter->card_type)) - wlan_resync_usb_port(pmadapter); -#endif break; case HostCmd_CMD_APCMD_SYS_INFO: break; @@ -5384,6 +5441,8 @@ mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, case HostCmd_CMD_CHAN_REGION_CFG: ret = wlan_ret_chan_region_cfg(pmpriv, resp, pioctl_buf); break; + case HostCmd_CMD_REGION_POWER_CFG: + break; case HostCmd_CMD_PACKET_AGGR_CTRL: ret = wlan_ret_packet_aggr_ctrl(pmpriv, resp, pioctl_buf); break; @@ -5483,6 +5542,10 @@ mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, pmadapter->curr_cmd->pioctl_buf = MNULL; break; #endif + case HostCmd_CMD_802_11_TX_FRAME: + break; + case HostCmd_CMD_EDMAC_CFG: + break; default: PRINTM(MERROR, "CMD_RESP: Unknown command response %#x\n", resp->command); @@ -5567,10 +5630,6 @@ mlan_status wlan_ops_uap_process_event(t_void *priv) wlan_coex_ampdu_rxwinsize(pmadapter); if (wlan_11h_radar_detect_required(pmpriv, pmpriv->uap_channel)) wlan_11h_update_dfs_master_state_by_uap(pmpriv); -#if defined(USB) - if (IS_USB(pmadapter->card_type)) - wlan_resync_usb_port(pmadapter); -#endif break; case EVENT_MICRO_AP_BSS_ACTIVE: PRINTM(MEVENT, "EVENT: MICRO_AP_BSS_ACTIVE\n"); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c index 72eedba..ca16562 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c @@ -1042,7 +1042,7 @@ wlan_uap_sec_ioctl_set_encrypt_key(pmlan_adapter pmadapter, ENTER(); sec = (mlan_ds_sec_cfg *)pioctl_req->pbuf; - if (pioctl_req->action != MLAN_ACT_SET) { + if ((pioctl_req->action != MLAN_ACT_SET)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; LEAVE(); return MLAN_STATUS_FAILURE; @@ -1055,7 +1055,7 @@ wlan_uap_sec_ioctl_set_encrypt_key(pmlan_adapter pmadapter, } ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_KEY_MATERIAL, - HostCmd_ACT_GEN_SET, KEY_INFO_ENABLED, + pioctl_req->action, KEY_INFO_ENABLED, (t_void *)pioctl_req, &sec->param.encrypt_key); if (ret == MLAN_STATUS_SUCCESS) @@ -2127,6 +2127,13 @@ mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) pmadapter->max_sta_conn; pget_info->param.fw_info.uuid_lo = pmadapter->uuid_lo; pget_info->param.fw_info.uuid_hi = pmadapter->uuid_hi; + pget_info->param.fw_info.cmd_tx_data = + IS_FW_SUPPORT_CMD_TX_DATA(pmadapter) ? 0x01 : + 0x00; + pget_info->param.fw_info.sec_rgpower = + IS_FW_SUPPORT_SEC_RG_POWER(pmadapter) ? 0x01 : + 0x00; + } else if (pget_info->sub_command == MLAN_OID_LINK_STATS) status = wlan_ioctl_link_statistic(pmpriv, pioctl_req); break; @@ -2305,6 +2312,9 @@ mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) pioctl_req); if (misc->sub_command == MLAN_OID_MISC_GET_REGIONPWR_CFG) status = wlan_get_rgchnpwr_cfg(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_REGION_POWER_CFG) + status = wlan_misc_region_power_cfg(pmadapter, + pioctl_req); if (misc->sub_command == MLAN_OID_MISC_CFP_TABLE) status = wlan_get_cfp_table(pmadapter, pioctl_req); if (misc->sub_command == MLAN_OID_MISC_RANGE_EXT) @@ -2321,6 +2331,12 @@ mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) pioctl_req); if (misc->sub_command == MLAN_OID_MISC_EXT_CAP_CFG) status = wlan_misc_ext_capa_cfg(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_TX_FRAME) + status = + wlan_misc_ioctl_tx_frame(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_EDMAC_CONFIG) + status = wlan_misc_ioctl_edmac_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/mlan/mlan_wmm.c b/mxm_wifiex/wlan_src/mlan/mlan_wmm.c index 41a6f9e..077c038 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_wmm.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_wmm.c @@ -1876,6 +1876,12 @@ t_void wlan_wmm_init(pmlan_adapter pmadapter) MLAN_WFD_AMPDU_DEF_TXRXWINSIZE; } #endif + if (priv->bss_type == MLAN_BSS_TYPE_NAN) { + priv->add_ba_param.tx_win_size = + MLAN_NAN_AMPDU_DEF_TXRXWINSIZE; + priv->add_ba_param.rx_win_size = + MLAN_NAN_AMPDU_DEF_TXRXWINSIZE; + } #ifdef UAP_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_UAP) { priv->add_ba_param.tx_win_size = @@ -2502,7 +2508,7 @@ t_u8 wlan_wmm_compute_driver_packet_delay(pmlan_private priv, t_u8 ret_val = 0; t_u32 out_ts_sec, out_ts_usec; t_s32 queue_delay; - + t_s32 temp_delay = 0; ENTER(); priv->adapter->callbacks.moal_get_system_time( @@ -2514,9 +2520,17 @@ t_u8 wlan_wmm_compute_driver_packet_delay(pmlan_private priv, priv->adapter->callbacks.moal_tp_accounting( priv->adapter->pmoal_handle, pmbuf, 11); } - queue_delay = (t_s32)(out_ts_sec - pmbuf->in_ts_sec) * 1000; - queue_delay += (t_s32)(out_ts_usec - pmbuf->in_ts_usec) / 1000; + if (!wlan_secure_sub(&out_ts_sec, pmbuf->in_ts_sec, &temp_delay, + TYPE_SINT32)) + PRINTM(MERROR, "%s:TS(sec) not valid \n", __func__); + queue_delay = temp_delay * 1000; + + if (!wlan_secure_sub(&out_ts_usec, pmbuf->in_ts_usec, &temp_delay, + TYPE_SINT32)) + PRINTM(MERROR, "%s:TS(usec) not valid \n", __func__); + + queue_delay += temp_delay / 1000; /* * Queue delay is passed as a uint8 in units of 2ms (ms shifted * by 1). Min value (other than 0) is therefore 2ms, max is 510ms. diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h index f0af2e3..7956c25 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h @@ -24,7 +24,7 @@ #define _MLAN_DECL_H_ /** MLAN release version */ -#define MLAN_RELEASE_VERSION "408.p4" +#define MLAN_RELEASE_VERSION "423.p1" /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ @@ -157,10 +157,6 @@ typedef t_s32 t_sval; /** This is current limit on Maximum Rx AMPDU allowed */ #define MLAN_MAX_RX_BASTREAM_SUPPORTED 16 -#ifndef UINT_MAX -#define UINT_MAX (~0U) -#endif - #ifdef STA_SUPPORT /** Default Win size attached during ADDBA request */ #define MLAN_STA_AMPDU_DEF_TXWINSIZE 64 @@ -185,6 +181,11 @@ typedef t_s32 t_sval; #define MLAN_WFD_COEX_AMPDU_DEF_RXWINSIZE 16 #endif +/** NAN use the same window size for tx/rx */ +#define MLAN_NAN_AMPDU_DEF_TXRXWINSIZE 16 +/** RX winsize for COEX */ +#define MLAN_NAN_COEX_AMPDU_DEF_RXWINSIZE 16 + /** Block ack timeout value */ #define MLAN_DEFAULT_BLOCK_ACK_TIMEOUT 0xffff /** Maximum Tx Win size configured for ADDBA request [10 bits] */ @@ -273,6 +274,11 @@ typedef t_s32 t_sval; /** pcie inband reset */ #define FW_RELOAD_PCIE_INBAND_RESET 6 +/** auto fw reload enable */ +#define AUTO_FW_RELOAD_ENABLE MBIT(0) +/** auto fw reload enable pcie inband reset */ +#define AUTO_FW_RELOAD_PCIE_INBAND_RESET MBIT(1) + #ifdef PCIE /* Interrupt type */ enum { RX_DATA, RX_EVENT, TX_COMPLETE, RX_CMD_RESP, RX_CMD_DNLD }; @@ -747,6 +753,7 @@ typedef enum _mlan_bss_type { #ifdef WIFI_DIRECT_SUPPORT MLAN_BSS_TYPE_WIFIDIRECT = 2, #endif + MLAN_BSS_TYPE_NAN = 4, MLAN_BSS_TYPE_DFS = 8, MLAN_BSS_TYPE_ANY = 0xff, } mlan_bss_type; @@ -803,6 +810,8 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_FW_RADAR_DETECTED = 0x00000024, MLAN_EVENT_ID_FW_CHANNEL_REPORT_RDY = 0x00000025, MLAN_EVENT_ID_FW_BW_CHANGED = 0x00000026, + MLAN_EVENT_ID_FW_IBSS_CONNECT = 0x00000028, + MLAN_EVENT_ID_FW_IBSS_DISCONNECT = 0x00000029, MLAN_EVENT_ID_FW_REMAIN_ON_CHAN_EXPIRED = 0x0000002B, #ifdef UAP_SUPPORT @@ -845,6 +854,7 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_UAP_CHAN_INFO = 0x80000020, #endif MLAN_EVENT_ID_FW_ROAM_OFFLOAD_RESULT = 0x80000023, + MLAN_EVENT_ID_NAN_STARTED = 0x80000024, MLAN_EVENT_ID_DRV_RTT_RESULT = 0x80000025, MLAN_EVENT_ID_DRV_ASSOC_FAILURE_LOGGER = 0x80000026, MLAN_EVENT_ID_DRV_ASSOC_SUCC_LOGGER = 0x80000027, @@ -857,7 +867,9 @@ typedef enum _mlan_event_id { MLAN_EVENT_ID_DRV_DEFER_RX_EVENT = 0x80000033, MLAN_EVENT_ID_DRV_DEFER_CMDRESP = 0x80000034, MLAN_EVENT_ID_DRV_DEFER_TX_COMPLTE = 0x80000035, + MLAN_EVENT_ID_DRV_DELAY_TX_COMPLETE = 0x80000036, #endif + MLAN_EVENT_ID_DRV_RGPWR_KEY_MISMATCH = 0x80000037, } mlan_event_id; /** Data Structures */ @@ -907,7 +919,9 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t { #define OID_TYPE_CAL 0x2 #define OID_TYPE_DPD 0xa +#define NONE_TYPE_DPD 0xb #define UNKNOW_DPD_LENGTH 0xffffffff +#define NONE_DPD_LENGTH 0xfafafafa /** Custom data structure */ typedef struct _mlan_init_param { @@ -1296,7 +1310,19 @@ typedef MLAN_PACK_START struct _mc_txcontrol { /** mc_pkt_flags */ t_u8 mc_pkt_flags; } MLAN_PACK_END mc_txcontrol, *pmc_txcontrol; - +typedef MLAN_PACK_START struct MAPP_Stats_Mcast_drv { + t_u32 cycle_recv_under_2300usec; + t_u32 cycle_recv_in_time; + t_u32 cycle_recv_over_2900usec; + t_u32 cycle_recv_over_3500usec; + t_u32 cycle_recv_over_5000usec; + t_u32 cycle_recv_over_10000usec; + t_u32 cycle_recv_over_15000usec; + t_u32 spent_time_under_1000usec; + t_u32 spent_time_over_1000usec; + t_u32 spent_time_over_2000usec; + t_u32 spent_time_over_3000usec; +} MLAN_PACK_END Stats_mcast_drv_t, *pStats_mcast_drv_t; /** mlan_buffer data structure */ typedef struct _mlan_buffer { /** Pointer to previous mlan_buffer */ @@ -2787,4 +2813,97 @@ MLAN_API void mlan_process_pcie_interrupt_cb(t_void *pmadapter, int type); #define CSI_SIGNATURE 0xABCD +/** secure add/sub **/ +#ifndef SINT8_MAX +#define SINT8_MAX 0x7f +#endif + +#ifndef SINT8_MIN +#define SINT8_MIN 0x80 +#endif + +#ifndef UINT8_MAX +#define UINT8_MAX 0xff +#endif + +#ifndef SINT16_MAX +#define SINT16_MAX 0x7fff +#endif + +#ifndef SINT16_MIN +#define SINT16_MIN 0x8000 +#endif + +#ifndef UINT16_MAX +#define UINT16_MAX 0xffff +#endif + +#ifndef SINT32_MAX +#define SINT32_MAX 0x7fffffff +#endif + +#ifndef SINT32_MIN +#define SINT32_MIN 0x80000000 +#endif + +#ifndef UINT32_MAX +#define UINT32_MAX 0xffffffff +#endif + +#ifndef SINT64_MAX +#define SINT64_MAX 0x7fffffffffffffff +#endif + +#ifndef SINT64_MIN +#define SINT64_MIN 0x8000000000000000 +#endif + +#ifndef UINT64_MAX +#define UINT64_MAX 0xffffffffffffffff +#endif + +#ifndef PTR_MAX +#ifdef MLAN_64BIT +#define PTR_MAX UINT64_MAX +#else +#define PTR_MAX UINT32_MAX +#endif +#endif + +#ifndef SINT_MAX +#ifdef MLAN_64BIT +#define SINT_MAX SINT64_MAX +#else +#define SINT_MAX SINT32_MAX +#endif +#endif + +#ifndef SINT_MIN +#ifdef MLAN_64BIT +#define SINT_MIN SINT64_MIN +#else +#define SINT_MIN SINT32_MIN +#endif +#endif + +#ifndef UINT_MAX +#ifdef MLAN_64BIT +#define UINT_MAX UINT64_MAX +#else +#define UINT_MAX UINT32_MAX +#endif +#endif + +typedef enum { + TYPE_SINT8, + TYPE_UINT8, + TYPE_SINT16, + TYPE_UINT16, + TYPE_SINT32, + TYPE_UINT32, + TYPE_SINT64, + TYPE_UINT64, + TYPE_PTR, +} data_type; + #endif /* !_MLAN_DECL_H_ */ diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h b/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h index e0a73ad..f238a01 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h @@ -319,6 +319,27 @@ typedef MLAN_PACK_START struct { t_u8 variablep[]; } MLAN_PACK_END IEEEtypes_assoc_req; +/** Assoc Request */ +#define SUBTYPE_ASSOC_REQUEST 0 +/** Assoc Response */ +#define SUBTYPE_ASSOC_RESP 1 +/** ReAssoc Request */ +#define SUBTYPE_REASSOC_REQUEST 2 +/** ReAssoc Request */ +#define SUBTYPE_REASSOC_RESP 3 +/** Probe Resp */ +#define SUBTYPE_PROBE_RESP 5 +/** Disassoc Request */ +#define SUBTYPE_DISASSOC 10 +/** Auth Request */ +#define SUBTYPE_AUTH 11 +/** Deauth Request */ +#define SUBTYPE_DEAUTH 12 +/** Action frame */ +#define SUBTYPE_ACTION 13 +/** beacon */ +#define SUBTYPE_BEACON 8 + /*Mgmt frame*/ typedef MLAN_PACK_START struct { /** frame control */ diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h index b234715..2d679d3 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h @@ -89,6 +89,7 @@ enum _mlan_ioctl_req_id { #ifdef UAP_SUPPORT MLAN_OID_ACTION_CHAN_SWITCH = 0x0002001E, #endif + MLAN_OID_BSS_HOST_MLME = 0x0002001F, /* Radio Configuration Group */ MLAN_IOCTL_RADIO_CFG = 0x00030000, @@ -376,6 +377,10 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_REORDER_FLUSH_TIME = 0x0020008F, MLAN_OID_MISC_NAV_MITIGATION = 0x00200090, MLAN_OID_MISC_LED_CONFIG = 0x00200091, + MLAN_OID_MISC_TX_FRAME = 0x00200092, + MLAN_OID_MISC_EDMAC_CONFIG = 0x00200093, + MLAN_OID_MISC_GPIO_CFG = 0x00200094, + MLAN_OID_MISC_REGION_POWER_CFG = 0x00200095, }; /** Sub command size */ @@ -390,7 +395,6 @@ enum _mlan_act_ioctl { MLAN_ACT_RESET, MLAN_ACT_DEFAULT }; - /** Enumeration for generic enable/disable */ enum _mlan_act_generic { MLAN_ACT_DISABLE = 0, MLAN_ACT_ENABLE = 1 }; @@ -1965,6 +1969,9 @@ typedef struct _mlan_fw_info { /* higher 8 bytes of uuid */ t_u64 uuid_hi; + /* FW support tx data by cmd */ + t_u8 cmd_tx_data; + t_u8 sec_rgpower; } mlan_fw_info, *pmlan_fw_info; /** Version string buffer length */ @@ -4104,7 +4111,9 @@ typedef struct _mlan_ds_11ax_llde_cmd { t_u8 triggerlimit; // cap airtime limit index: auto=0xff t_u8 peakULrate; // cap peak UL rate t_u8 dl_llde; // Downlink LLDE: enable=1,disable=0 - t_u16 triggerinterval; // Set trigger frame interval(us): auto=0 + t_u16 pollinterval; // Set trigger frame interval(us): auto=0 + t_u16 txOpDuration; // Set TxOp duration + t_u16 llde_ctrl; // for other configurations t_u16 mu_rts_successcnt; t_u16 mu_rts_failcnt; t_u16 basic_trigger_successcnt; @@ -4286,11 +4295,20 @@ enum _mlan_reg_type { MLAN_REG_CAU = 5, MLAN_REG_PSU = 6, 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) MLAN_REG_CIU = 8, +#endif +#if defined(PCIE9098) || defined(SD9098) || defined(USB9098) || \ + defined(PCIE9097) || defined(USB9097) || defined(SDIW624) || \ + defined(PCIEIW624) || defined(USBIW624) || defined(SD9097) MLAN_REG_MAC2 = 0x81, MLAN_REG_BBP2 = 0x82, MLAN_REG_RF2 = 0x83, MLAN_REG_BCA2 = 0x87 +#endif }; /** Type definition of mlan_ds_reg_rw for MLAN_OID_REG_RW */ @@ -4490,6 +4508,26 @@ typedef struct _mlan_ds_misc_cmd { t_u8 cmd[MRVDRV_SIZE_OF_CMD_BUFFER]; } mlan_ds_misc_cmd; +/** Type definition of mlan_ds_misc_tx_frame for MLAN_OID_MISC_TX_FRAME */ +typedef struct _mlan_ds_misc_tx_frame { + /** Band Configuration */ + Band_Config_t bandcfg; + /** channel */ + t_u8 channel; + /** Buffer type: data, cmd, event etc. */ + mlan_buf_type buf_type; + /** QoS priority */ + t_u32 priority; + /** Flags for this buffer */ + t_u32 flags; + /** tx_seq_num */ + t_u32 tx_seq_num; + /** tx_buf length */ + t_u16 data_len; + /** Tx buffer */ + t_u8 tx_buf[MRVDRV_SIZE_OF_CMD_BUFFER]; +} mlan_ds_misc_tx_frame; + /** Maximum number of system clocks */ #define MLAN_MAX_CLK_NUM 16 @@ -4766,6 +4804,18 @@ typedef struct _mlan_ds_misc_country_code { t_u8 country_code[COUNTRY_CODE_LEN]; } mlan_ds_misc_country_code; +/** Type defination of mlan_ds_gpio_cfg_ops */ +typedef struct _mlan_ds_gpio_cfg_ops { + /** Get or Set action */ + t_u8 action; + /** Operation type */ + t_u8 opsType; + /** pin number */ + t_u8 pin_num; + /** pin value */ + t_u8 value; +} mlan_ds_gpio_cfg_ops; + /** action for set */ #define SUBSCRIBE_EVT_ACT_BITWISE_SET 0x0002 /** action for clear */ @@ -5490,22 +5540,6 @@ typedef MLAN_PACK_START struct _mlan_ds_misc_tx_rx_histogram { t_u8 value[1]; } MLAN_PACK_END mlan_ds_misc_tx_rx_histogram; -typedef MLAN_PACK_START struct _mlan_ds_cw_mode_ctrl { - /** Mode of Operation 0: Disable 1: Tx Continuous Packet 2: Tx - * Continuous Wave */ - t_u8 mode; - /*channel*/ - t_u8 channel; - /* channel info*/ - t_u8 chanInfo; - /** Tx Power level in dBm */ - t_u16 txPower; - /** Packet Length */ - t_u16 pktLength; - /** bit rate Info */ - t_u32 rateInfo; -} MLAN_PACK_END mlan_ds_cw_mode_ctrl; - #define RX_PKT_INFO MBIT(1) /** Struct for per-packet configuration */ typedef struct _mlan_per_pkt_cfg { @@ -6124,6 +6158,20 @@ typedef struct _mlan_ds_reorder_flush_time { t_u16 flush_time_ac_vi_vo; } mlan_ds_reorder_flush_time; +/** EDMAC configuration parameters */ +typedef struct _mlan_ds_ed_mac_cfg { + /** EU adaptivity for 2.4ghz band */ + t_u16 ed_ctrl_2g; + /** Energy detect threshold offset for 2.4ghz */ + t_s16 ed_offset_2g; + /** EU adaptivity for 5ghz band */ + t_u16 ed_ctrl_5g; + /** Energy detect threshold offset for 5ghz */ + t_s16 ed_offset_5g; + + t_u32 ed_bitmap_txq_lock; +} mlan_ds_ed_mac_cfg; + /** Type definition of mlan_ds_misc_cfg for MLAN_IOCTL_MISC_CFG */ typedef struct _mlan_ds_misc_cfg { /** Sub-command */ @@ -6140,6 +6188,8 @@ typedef struct _mlan_ds_misc_cfg { #endif /** Hostcmd for MLAN_OID_MISC_HOST_CMD */ mlan_ds_misc_cmd hostcmd; + /** tx_frame for MLAN_OID_MISC_TX_FRAME */ + mlan_ds_misc_tx_frame tx_frame; /** System clock for MLAN_OID_MISC_SYS_CLOCK */ mlan_ds_misc_sys_clock sys_clock; /** WWS set/get for MLAN_OID_MISC_WWS */ @@ -6241,7 +6291,6 @@ typedef struct _mlan_ds_misc_cfg { mlan_ds_misc_keep_alive keep_alive; mlan_ds_misc_keep_alive_rx keep_alive_rx; mlan_ds_misc_tx_rx_histogram tx_rx_histogram; - mlan_ds_cw_mode_ctrl cwmode; /** Tx/Rx per-packet control */ t_u8 txrx_pkt_ctrl; mlan_ds_misc_robustcoex_params robustcoexparams; @@ -6294,6 +6343,8 @@ typedef struct _mlan_ds_misc_cfg { mlan_ds_ch_load ch_load; mlan_ds_cross_chip_synch cross_chip_synch; mlan_ds_reorder_flush_time flush_time; + mlan_ds_ed_mac_cfg edmac_cfg; + mlan_ds_gpio_cfg_ops gpio_cfg_ops; } param; } mlan_ds_misc_cfg, *pmlan_ds_misc_cfg; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c index 75009a7..e222743 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c @@ -353,6 +353,7 @@ t_u8 woal_ieee_band_to_radio_type(t_u8 ieee_band) * @param key_index Key index * @param addr Mac for which key is to be set * @param disable Key disabled or not + * @param pairwise pairwise flag * @param wait_option wait option * * @return MLAN_STATUS_SUCCESS -- success, otherwise fail @@ -360,7 +361,7 @@ t_u8 woal_ieee_band_to_radio_type(t_u8 ieee_band) mlan_status woal_cfg80211_set_key(moal_private *priv, t_u8 is_enable_wep, t_u32 cipher, const t_u8 *key, int key_len, const t_u8 *seq, int seq_len, t_u8 key_index, - const t_u8 *addr, int disable, + const t_u8 *addr, int disable, t_u8 pairwise, t_u8 wait_option) { mlan_ioctl_req *req = NULL; @@ -462,9 +463,16 @@ mlan_status woal_cfg80211_set_key(moal_private *priv, t_u8 is_enable_wep, ETH_ALEN) == 0) sec->param.encrypt_key.key_flags = KEY_FLAG_GROUP_KEY; - else - sec->param.encrypt_key.key_flags = - KEY_FLAG_SET_TX_KEY; + else { +#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE + if (!pairwise) + sec->param.encrypt_key.key_flags = + KEY_FLAG_GROUP_KEY; + else +#endif + sec->param.encrypt_key.key_flags = + KEY_FLAG_SET_TX_KEY; + } } else { moal_memcpy_ext(priv->phandle, sec->param.encrypt_key.mac_addr, @@ -562,13 +570,13 @@ mlan_status woal_cfg80211_set_wep_keys(moal_private *priv, const t_u8 *key, else cipher = WLAN_CIPHER_SUITE_WEP104; ret = woal_cfg80211_set_key(priv, 0, cipher, key, key_len, NULL, - 0, index, NULL, 0, wait_option); + 0, index, NULL, 0, 0, wait_option); } else { /* No key provided so it is enable key. We * want to just set the transmit key index */ ret = woal_cfg80211_set_key(priv, 1, cipher, key, key_len, NULL, - 0, index, NULL, 0, wait_option); + 0, index, NULL, 0, 0, wait_option); } if (ret != MLAN_STATUS_SUCCESS) PRINTM(MERROR, "woal_cfg80211_set_wep_keys Fail\n"); @@ -1523,6 +1531,7 @@ int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, const t_u8 *mac_addr, struct key_params *params) { moal_private *priv = (moal_private *)woal_get_netdev_priv(netdev); + t_u8 pairwise_key = MFALSE; ENTER(); if (priv->ft_pre_connect) { @@ -1533,9 +1542,25 @@ int woal_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev, /** cancel pending scan */ woal_cancel_scan(priv, MOAL_IOCTL_WAIT); +#if KERNEL_VERSION(2, 6, 36) < CFG80211_VERSION_CODE + if (pairwise) + pairwise_key = MTRUE; + if (mac_addr) + PRINTM(MCMND, + "wlan: set_key key_index=%d pairwise=%d " MACSTR + " cipher=0x%x key_len=%d seq_len=%d\n", + key_index, pairwise, MAC2STR(mac_addr), params->cipher, + params->key_len, params->seq_len); + else + PRINTM(MCMND, + "wlan: set_key key_index=%d pairwise=%d cipher=0x%x key_len=%d seq_len=%d\n", + key_index, pairwise, params->cipher, params->key_len, + params->seq_len); +#endif if (woal_cfg80211_set_key(priv, 0, params->cipher, params->key, params->key_len, params->seq, params->seq_len, - key_index, mac_addr, 0, MOAL_IOCTL_WAIT)) { + key_index, mac_addr, 0, pairwise_key, + MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Error adding the crypto keys\n"); LEAVE(); return -EFAULT; @@ -1595,7 +1620,7 @@ int woal_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev, */ if (MLAN_STATUS_FAILURE == woal_cfg80211_set_key(priv, 0, 0, NULL, 0, NULL, 0, key_index, - mac_addr, 1, MOAL_NO_WAIT)) { + mac_addr, 1, 0, MOAL_NO_WAIT)) { PRINTM(MERROR, "Error deleting the crypto keys\n"); LEAVE(); return -EFAULT; @@ -2659,6 +2684,242 @@ t_u8 woal_check_mgmt_tx_channel(moal_private *priv, } #endif +/* + * @brief transmit management packet + * + * @param priv A pointer moal_private structure + * @param buf Frame buffer + * @param len Frame length + * @param chan A pointer to ieee80211_channel structure + * @param cookie Frame cookie + * @param wait Duration to wait + * + * @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) +{ + int ret = 0; + pmlan_buffer pmbuf = NULL; + t_u8 *pbuf = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + t_u8 addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + t_u16 packet_len = 0; + t_u16 pkt_len = 0; + t_u32 pkt_type; + t_u32 tx_control; + unsigned long flags; + struct sk_buff *skb = NULL; + struct tx_status_info *tx_info = NULL; + t_u32 remain_len = 0; + t_u32 buf_flags = 0; + t_u8 tx_seq_num = 0; + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + + ENTER(); + + /* pkt_type + tx_control */ +#define HEADER_SIZE 8 + packet_len = (t_u16)(len + MLAN_MAC_ADDR_LENGTH); + + if (priv->phandle->cmd_tx_data) { + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TX_FRAME; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + if (chan) { + misc->param.tx_frame.bandcfg.chanBand = + woal_ieee_band_to_radio_type(chan->band); + misc->param.tx_frame.channel = chan->hw_value; + } + pbuf = misc->param.tx_frame.tx_buf; + } else { + pmbuf = woal_alloc_mlan_buffer( + priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + + packet_len + sizeof(packet_len)); + if (!pmbuf) { + PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); + ret = -ENOMEM; + goto done; + } + + pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; + pbuf = pmbuf->pbuf + pmbuf->data_offset; + } + pkt_type = MRVL_PKT_TYPE_MGMT_FRAME; + tx_control = 0; + remain_len = HEADER_SIZE + packet_len + sizeof(packet_len); + /* Add pkt_type and tx_control */ + moal_memcpy_ext(priv->phandle, pbuf, &pkt_type, sizeof(pkt_type), + remain_len); + remain_len -= sizeof(pkt_type); + moal_memcpy_ext(priv->phandle, pbuf + sizeof(pkt_type), &tx_control, + sizeof(tx_control), remain_len); + remain_len -= sizeof(tx_control); + /* frmctl + durationid + addr1 + addr2 + addr3 + seqctl */ +#define PACKET_ADDR4_POS (2 + 2 + 6 + 6 + 6 + 2) + pkt_len = woal_cpu_to_le16(packet_len); + moal_memcpy_ext(priv->phandle, pbuf + HEADER_SIZE, &pkt_len, + sizeof(pkt_len), remain_len); + remain_len -= sizeof(packet_len); + moal_memcpy_ext(priv->phandle, pbuf + HEADER_SIZE + sizeof(packet_len), + buf, PACKET_ADDR4_POS, remain_len); + remain_len -= PACKET_ADDR4_POS; + moal_memcpy_ext(priv->phandle, + pbuf + HEADER_SIZE + sizeof(packet_len) + + PACKET_ADDR4_POS, + addr, MLAN_MAC_ADDR_LENGTH, remain_len); + remain_len -= MLAN_MAC_ADDR_LENGTH; + moal_memcpy_ext(priv->phandle, + pbuf + HEADER_SIZE + sizeof(packet_len) + + PACKET_ADDR4_POS + MLAN_MAC_ADDR_LENGTH, + buf + PACKET_ADDR4_POS, len - PACKET_ADDR4_POS, + remain_len); + + DBG_HEXDUMP(MDAT_D, "Mgmt Tx", pbuf, + HEADER_SIZE + packet_len + sizeof(packet_len)); + if ((ieee80211_is_action(((struct ieee80211_mgmt *)buf)->frame_control)) +#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE + || moal_extflg_isset(priv->phandle, EXT_HOST_MLME) +#endif + ) { + buf_flags = MLAN_BUF_FLAG_TX_STATUS; + if (!priv->tx_seq_num) + priv->tx_seq_num++; + tx_seq_num = priv->tx_seq_num++; + tx_info = kzalloc(sizeof(struct tx_status_info), GFP_ATOMIC); + if (tx_info) { + skb = alloc_skb(len, GFP_ATOMIC); + if (skb) { + moal_memcpy_ext(priv->phandle, skb->data, buf, + len, len); + skb_put(skb, len); + spin_lock_irqsave(&priv->tx_stat_lock, flags); + tx_info->tx_cookie = cookie; + tx_info->tx_skb = skb; + tx_info->tx_seq_num = tx_seq_num; + if ((priv->bss_role == MLAN_BSS_ROLE_UAP) && + (priv->phandle->remain_on_channel && !wait)) + tx_info->cancel_remain_on_channel = + MTRUE; + INIT_LIST_HEAD(&tx_info->link); + list_add_tail(&tx_info->link, + &priv->tx_stat_queue); + spin_unlock_irqrestore(&priv->tx_stat_lock, + flags); + } else { + kfree(tx_info); + tx_info = NULL; + } + } + } + if (priv->phandle->cmd_tx_data) { + misc->param.tx_frame.data_len = + HEADER_SIZE + packet_len + sizeof(packet_len); + misc->param.tx_frame.buf_type = MLAN_BUF_TYPE_RAW_DATA; + misc->param.tx_frame.priority = 7; + misc->param.tx_frame.flags = buf_flags; + misc->param.tx_frame.tx_seq_num = tx_seq_num; + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "Fail to send packet status=%d\n", + status); + if (tx_info) + woal_remove_tx_info(priv, tx_info->tx_seq_num); + ret = -EFAULT; + goto done; + } + if (!tx_info) { + /* Delay 30ms to guarantee the packet has been already + * tx'ed, because if we call cfg80211_mgmt_tx_status() + * immediately, then wpa_supplicant will call + * cancel_remain_on_channel(), which may affect the mgmt + * frame tx. Meanwhile it is only necessary for P2P + * action handshake to wait 30ms. + */ + if (buf_flags == MLAN_BUF_FLAG_TX_STATUS) + woal_sched_timeout(30); + /* Notify the mgmt tx status */ +#if KERNEL_VERSION(2, 6, 37) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE + cfg80211_mgmt_tx_status(dev, cookie, buf, len, true, + GFP_ATOMIC); +#else + cfg80211_mgmt_tx_status(priv->wdev, cookie, buf, len, + true, GFP_ATOMIC); +#endif +#endif + } + } else { + pmbuf->data_len = HEADER_SIZE + packet_len + sizeof(packet_len); + pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; + pmbuf->bss_index = priv->bss_index; + pmbuf->flags = buf_flags; + pmbuf->tx_seq_num = tx_seq_num; + + status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); + + switch (status) { + case MLAN_STATUS_PENDING: + atomic_inc(&priv->phandle->tx_pending); + queue_work(priv->phandle->workqueue, + &priv->phandle->main_work); + + /* Delay 30ms to guarantee the packet has been already + * tx'ed, because if we call cfg80211_mgmt_tx_status() + * immediately, then wpa_supplicant will call + * cancel_remain_on_channel(), which may affect the mgmt + * frame tx. Meanwhile it is only necessary for P2P + * action handshake to wait 30ms. + */ + if (buf_flags == MLAN_BUF_FLAG_TX_STATUS) { + if (tx_info) + break; + else + woal_sched_timeout(30); + } + /* Notify the mgmt tx status */ +#if KERNEL_VERSION(2, 6, 37) <= CFG80211_VERSION_CODE +#if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE + cfg80211_mgmt_tx_status(dev, cookie, buf, len, true, + GFP_ATOMIC); +#else + cfg80211_mgmt_tx_status(priv->wdev, cookie, buf, len, + true, GFP_ATOMIC); +#endif +#endif + break; + case MLAN_STATUS_SUCCESS: + woal_free_mlan_buffer(priv->phandle, pmbuf); + break; + case MLAN_STATUS_FAILURE: + default: + woal_free_mlan_buffer(priv->phandle, pmbuf); + ret = -EFAULT; + break; + } + } +done: + if (priv->phandle->cmd_tx_data) { + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + } else { + if (status != MLAN_STATUS_PENDING) { + if (tx_info) + woal_remove_tx_info(priv, tx_info->tx_seq_num); + } + } + + LEAVE(); + return ret; +} + #if KERNEL_VERSION(3, 2, 0) <= CFG80211_VERSION_CODE #if KERNEL_VERSION(3, 3, 0) <= CFG80211_VERSION_CODE #if KERNEL_VERSION(3, 6, 0) <= CFG80211_VERSION_CODE @@ -2804,25 +3065,13 @@ int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, #endif moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); int ret = 0; - pmlan_buffer pmbuf = NULL; - mlan_status status = MLAN_STATUS_SUCCESS; - t_u16 packet_len = 0; - t_u16 pkt_len = 0; - t_u8 addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - t_u32 pkt_type; - t_u32 tx_control; + #if KERNEL_VERSION(2, 6, 39) <= CFG80211_VERSION_CODE t_u8 channel_status; t_u32 duration; moal_private *remain_priv = NULL; #endif - - unsigned long flags; - struct sk_buff *skb = NULL; - struct tx_status_info *tx_info = NULL; - t_u32 remain_len = 0; t_u16 fc, type, stype; - ENTER(); if (buf == NULL || len == 0) { @@ -2856,7 +3105,8 @@ int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, case IEEE80211_STYPE_DEAUTH: case IEEE80211_STYPE_DISASSOC: #ifdef UAP_SUPPORT - if (!priv->bss_started) { + if ((priv->bss_role == MLAN_BSS_ROLE_UAP) && + !priv->bss_started) { PRINTM(MCMND, "Drop deauth packet before AP started\n"); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) @@ -2997,17 +3247,6 @@ int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, } #endif - /* pkt_type + tx_control */ -#define HEADER_SIZE 8 - packet_len = (t_u16)(len + MLAN_MAC_ADDR_LENGTH); - pmbuf = woal_alloc_mlan_buffer(priv->phandle, - MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + - packet_len + sizeof(packet_len)); - if (!pmbuf) { - PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); - ret = -ENOMEM; - goto done; - } #if KERNEL_VERSION(3, 8, 0) > LINUX_VERSION_CODE *cookie = random32() | 1; #else @@ -3017,133 +3256,9 @@ int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, *cookie = get_random_u32() | 1; #endif #endif - pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; - pkt_type = MRVL_PKT_TYPE_MGMT_FRAME; - tx_control = 0; - remain_len = HEADER_SIZE + packet_len + sizeof(packet_len); - /* Add pkt_type and tx_control */ - moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset, - &pkt_type, sizeof(pkt_type), remain_len); - remain_len -= sizeof(pkt_type); - moal_memcpy_ext(priv->phandle, - pmbuf->pbuf + pmbuf->data_offset + sizeof(pkt_type), - &tx_control, sizeof(tx_control), remain_len); - remain_len -= sizeof(tx_control); - /* frmctl + durationid + addr1 + addr2 + addr3 + seqctl */ -#define PACKET_ADDR4_POS (2 + 2 + 6 + 6 + 6 + 2) - pkt_len = woal_cpu_to_le16(packet_len); - moal_memcpy_ext(priv->phandle, - pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE, - &pkt_len, sizeof(pkt_len), remain_len); - remain_len -= sizeof(packet_len); - moal_memcpy_ext(priv->phandle, - pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE + - sizeof(packet_len), - buf, PACKET_ADDR4_POS, remain_len); - remain_len -= PACKET_ADDR4_POS; - moal_memcpy_ext(priv->phandle, - pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE + - sizeof(packet_len) + PACKET_ADDR4_POS, - addr, MLAN_MAC_ADDR_LENGTH, remain_len); - remain_len -= MLAN_MAC_ADDR_LENGTH; - moal_memcpy_ext(priv->phandle, - pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE + - sizeof(packet_len) + PACKET_ADDR4_POS + - MLAN_MAC_ADDR_LENGTH, - buf + PACKET_ADDR4_POS, len - PACKET_ADDR4_POS, - remain_len); - - pmbuf->data_len = HEADER_SIZE + packet_len + sizeof(packet_len); - pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; - pmbuf->bss_index = priv->bss_index; - if ((ieee80211_is_action(((struct ieee80211_mgmt *)buf)->frame_control)) -#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE - || moal_extflg_isset(priv->phandle, EXT_HOST_MLME) -#endif - ) { - pmbuf->flags = MLAN_BUF_FLAG_TX_STATUS; - if (!priv->tx_seq_num) - priv->tx_seq_num++; - pmbuf->tx_seq_num = priv->tx_seq_num++; - tx_info = kzalloc(sizeof(struct tx_status_info), GFP_ATOMIC); - if (tx_info) { - skb = alloc_skb(len, GFP_ATOMIC); - if (skb) { - moal_memcpy_ext(priv->phandle, skb->data, buf, - len, len); - skb_put(skb, len); - spin_lock_irqsave(&priv->tx_stat_lock, flags); - tx_info->tx_cookie = *cookie; - tx_info->tx_skb = skb; - tx_info->tx_seq_num = pmbuf->tx_seq_num; - if ((priv->bss_role == MLAN_BSS_ROLE_UAP) && - (priv->phandle->remain_on_channel && !wait)) - tx_info->cancel_remain_on_channel = - MTRUE; - INIT_LIST_HEAD(&tx_info->link); - list_add_tail(&tx_info->link, - &priv->tx_stat_queue); - spin_unlock_irqrestore(&priv->tx_stat_lock, - flags); - } else { - kfree(tx_info); - tx_info = NULL; - } - } - } - - status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); - - switch (status) { - case MLAN_STATUS_PENDING: - atomic_inc(&priv->phandle->tx_pending); - queue_work(priv->phandle->workqueue, &priv->phandle->main_work); - - /* Delay 30ms to guarantee the packet has been already tx'ed, - * because if we call cfg80211_mgmt_tx_status() immediately, - * then wpa_supplicant will call cancel_remain_on_channel(), - * which may affect the mgmt frame tx. Meanwhile it is only - * necessary for P2P action handshake to wait 30ms. - */ - if ((ieee80211_is_action( - ((struct ieee80211_mgmt *)buf)->frame_control)) -#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE - || moal_extflg_isset(priv->phandle, EXT_HOST_MLME) -#endif - ) { - if (tx_info) - break; - else - woal_sched_timeout(30); - } - /* Notify the mgmt tx status */ -#if KERNEL_VERSION(2, 6, 37) <= CFG80211_VERSION_CODE -#if KERNEL_VERSION(3, 6, 0) > CFG80211_VERSION_CODE - cfg80211_mgmt_tx_status(dev, *cookie, buf, len, true, - GFP_ATOMIC); -#else - cfg80211_mgmt_tx_status(priv->wdev, *cookie, buf, len, true, - GFP_ATOMIC); -#endif -#endif - break; - case MLAN_STATUS_SUCCESS: - woal_free_mlan_buffer(priv->phandle, pmbuf); - break; - case MLAN_STATUS_FAILURE: - default: - woal_free_mlan_buffer(priv->phandle, pmbuf); - ret = -EFAULT; - break; - } + ret = woal_mgmt_tx(priv, buf, len, chan, *cookie, wait); done: - - if (status != MLAN_STATUS_PENDING) { - if (tx_info) - woal_remove_tx_info(priv, tx_info->tx_seq_num); - } - LEAVE(); return ret; } @@ -4596,6 +4711,7 @@ Bit18: 0x1 (STBC Tx <= 80 MHz) Bit19: 0x1 (STBC Rx <= 80 MHz) Bit20: 0x1 (Doppler Tx) Bit21: 0x1 (Doppler Rx) +Bit24-25: 0x1 (DCM Max Constellation Tx) Bit27-28: 0x1 (DCM Max Constellation Rx) Bit31: 0x1 (SU Beamformer) Bit32: 0x1 (SU BeamFormee) @@ -4609,16 +4725,16 @@ Bit59-61: 0x1 (Max Nc) Bit75: 0x1 (Rx 1024-QAM Support < 242-tone RU) */ -#define UAP_HE_MAC_CAP0_MASK 0x00 +#define UAP_HE_MAC_CAP0_MASK 0x06 #define UAP_HE_MAC_CAP1_MASK 0x00 -#define UAP_HE_MAC_CAP2_MASK 0x00 +#define UAP_HE_MAC_CAP2_MASK 0x10 #define UAP_HE_MAC_CAP3_MASK 0x02 #define UAP_HE_MAC_CAP4_MASK 0x00 #define UAP_HE_MAC_CAP5_MASK 0x00 #define UAP_HE_PHY_CAP0_MASK 0x04 #define UAP_HE_PHY_CAP1_MASK 0x23 #define UAP_HE_PHY_CAP2_MASK 0x3E -#define UAP_HE_PHY_CAP3_MASK 0x88 +#define UAP_HE_PHY_CAP3_MASK 0x89 #define UAP_HE_PHY_CAP4_MASK 0x1D #define UAP_HE_PHY_CAP5_MASK 0x01 #define UAP_HE_PHY_CAP6_MASK 0xA0 @@ -4645,6 +4761,7 @@ Bit18: 0x1 (STBC Tx <= 80 MHz) Bit19: 0x1 (STBC Rx <= 80 MHz) Bit20: 0x1 (Doppler Tx) Bit21: 0x1 (Doppler Rx) +Bit24-25: 0x1 (DCM Max Constellation Tx) Bit27-28: 0x1 (DCM Max Constellation Rx) Bit31: 0x1 (SU Beamformer) Bit32: 0x1 (SU BeamFormee) @@ -4666,7 +4783,7 @@ Bit75: 0x1 (Rx 1024-QAM Support < 242-tone RU) #define UAP_HE_2G_PHY_CAP0_MASK 0x02 #define UAP_HE_2G_PHY_CAP1_MASK 0x20 #define UAP_HE_2G_PHY_CAP2_MASK 0x3E -#define UAP_HE_2G_PHY_CAP3_MASK 0x88 +#define UAP_HE_2G_PHY_CAP3_MASK 0x89 #define UAP_HE_2G_PHY_CAP4_MASK 0x1D #define UAP_HE_2G_PHY_CAP5_MASK 0x01 #define UAP_HE_2G_PHY_CAP6_MASK 0xA0 diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h index 402c1aa..ada292a 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.h @@ -73,7 +73,7 @@ mlan_status woal_cfg80211_set_key(moal_private *priv, t_u8 is_enable_wep, t_u32 cipher, const t_u8 *key, int key_len, const t_u8 *seq, int seq_len, t_u8 key_index, - const t_u8 *addr, int disable, + const t_u8 *addr, int disable, t_u8 pairwise, t_u8 wait_option); mlan_status woal_cfg80211_set_wep_keys(moal_private *priv, const t_u8 *key, diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c index 5f3d637..e881d67 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.c @@ -146,10 +146,9 @@ static const struct nla_policy woal_attr_policy[ATTR_WIFI_MAX + 1] = { [ATTR_GET_CONCURRENCY_MATRIX_SET_SIZE_MAX] = {.type = NLA_U32}, [ATTR_SCAN_BAND_SET] = {.type = NLA_U8}, }; - // clang-format off static const struct nla_policy - woal_nd_offload_policy[ATTR_ND_OFFLOAD_MAX + 1] = { + woal_nd_offload_policy[ATTR_ND_OFFLOAD_MAX + 1] = { [ATTR_ND_OFFLOAD_CONTROL] = {.type = NLA_U8}, }; // clang-format on @@ -3935,9 +3934,8 @@ done: LEAVE(); return ret; } - /** - * @brief vendor command to set scan band + * @brief vendor command to * * @param wiphy A pointer to wiphy struct * @param wdev A pointer to wireless_dev struct diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h index ee6da96..4624787 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211_util.h @@ -620,7 +620,6 @@ typedef enum wifi_attr { ATTR_WIFI_AFTER_LAST, ATTR_WIFI_MAX = ATTR_WIFI_AFTER_LAST - 1 } wifi_attr_t; - enum mrvl_wlan_vendor_attr_wifi_logger { MRVL_WLAN_VENDOR_ATTR_NAME = 10, }; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_debug.c b/mxm_wifiex/wlan_src/mlinux/moal_debug.c index c584624..be67a56 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_debug.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_debug.c @@ -1202,6 +1202,7 @@ static ssize_t woal_debug_write(struct file *f, const char __user *buf, t_u32 last_drvdbg = drvdbg; #endif gfp_t flag; + t_u32 temp_count = 0; ENTER(); @@ -1210,7 +1211,11 @@ static ssize_t woal_debug_write(struct file *f, const char __user *buf, return MLAN_STATUS_FAILURE; } flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; - pdata = kzalloc(count + 1, flag); + + if (!woal_secure_add(&count, 1, &temp_count, TYPE_UINT32)) + PRINTM(MERROR, "%s:count param overflow \n", __func__); + + pdata = kzalloc(temp_count, flag); if (pdata == NULL) { MODULE_PUT; LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c index 7ed14ce..a6cf9c0 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c @@ -325,6 +325,7 @@ static int woal_get_priv_driver_version(moal_private *priv, t_u8 *respbuf, { int len = 0, ret = -1; char buf[MLAN_MAX_VER_STR_LEN]; + t_u32 temp_buf_len = 0; ENTER(); @@ -340,9 +341,13 @@ static int woal_get_priv_driver_version(moal_private *priv, t_u8 *respbuf, len = strlen(buf); if (len) { + if (!woal_secure_sub(&respbuflen, 1, &temp_buf_len, + TYPE_UINT32)) { + PRINTM(MERROR, "%s:respbuflen underflow \n", __func__); + } /* Copy back the retrieved version string */ PRINTM(MINFO, "MOAL VERSION: %s\n", buf); - ret = MIN(len, (int)(respbuflen - 1)); + ret = MIN(len, (int)temp_buf_len); moal_memcpy_ext(priv->phandle, respbuf, buf, ret, respbuflen - 1); } else { @@ -450,7 +455,7 @@ static int woal_setget_priv_11axcmdcfg(moal_private *priv, t_u8 *respbuf, int ret = 0; mlan_status status = MLAN_STATUS_SUCCESS; int header_len = 0, user_data_len = 0; - int data[8] = {0}; + int data[10] = {0}; ENTER(); req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11ax_cmd_cfg)); @@ -470,7 +475,7 @@ static int woal_setget_priv_11axcmdcfg(moal_private *priv, t_u8 *respbuf, PRINTM(MINFO, "data_len=%d,data=%d,%d,%d\n", user_data_len, data[0], data[1], data[2]); - if (user_data_len > 8 || user_data_len == 0) { + if (user_data_len > 10 || user_data_len == 0) { PRINTM(MERROR, "Invalid parameters\n"); ret = -EFAULT; goto done; @@ -526,7 +531,9 @@ static int woal_setget_priv_11axcmdcfg(moal_private *priv, t_u8 *respbuf, cfg->param.llde_cfg.triggerlimit = data[4]; cfg->param.llde_cfg.peakULrate = data[5]; cfg->param.llde_cfg.dl_llde = data[6]; - cfg->param.llde_cfg.triggerinterval = data[7]; + cfg->param.llde_cfg.pollinterval = data[7]; + cfg->param.llde_cfg.txOpDuration = data[8]; + cfg->param.llde_cfg.llde_ctrl = data[9]; break; default: PRINTM(MERROR, "unknown 11axcmd\n"); @@ -3978,7 +3985,8 @@ static int woal_priv_get_cfpinfo(moal_private *priv, t_u8 *respbuf, } /* Allocate an IOCTL request buffer */ - req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + req = woal_alloc_mlan_ioctl_req( + MAX(CMD_BUF_LEN, sizeof(mlan_ds_misc_cfg))); if (req == NULL) { ret = -ENOMEM; goto done; @@ -12283,7 +12291,8 @@ static void woal_get_dfs_chan_list(moal_private *priv) for (i = 0; i < sband->n_channels; i++) { if ((sband->channels[i].flags & IEEE80211_CHAN_RADAR) && - (priv->auto_dfs_cfg.num_of_chan <= 0xFF)) { + (priv->auto_dfs_cfg.num_of_chan < + MAX_DFS_CHAN_LIST)) { priv->auto_dfs_cfg.dfs_chan_list [priv->auto_dfs_cfg.num_of_chan] = sband->channels[i].hw_value; @@ -13428,16 +13437,22 @@ static int woal_priv_set_get_tx_rx_ant(moal_private *priv, t_u8 *respbuf, #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (IS_CARD9098(priv->phandle->card_type) || IS_CARD9097(priv->phandle->card_type) || - IS_CARDIW624(priv->phandle->card_type)) { + IS_CARDIW624(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { woal_cfg80211_notify_antcfg( priv, priv->phandle->wiphy, radio); } #endif } else { radio->param.ant_cfg_1x1.antenna = data[0]; - if (user_data_len == 2) + if (user_data_len == 2) { + if (data[1] > 0xffff) { + ret = -EINVAL; + goto done; + } radio->param.ant_cfg_1x1.evaluate_time = data[1]; + } } req->action = MLAN_ACT_SET; } @@ -13472,79 +13487,6 @@ done: return ret; } -/* - * @brief Set/Get CWMode - * - * @param priv Pointer to moal_private structure - * @param respbuf Pointer to response buffer - * @param resplen Response buffer length - * - * @return Number of bytes written, negative for failure. - */ -static int woal_priv_set_get_cwmode(moal_private *priv, t_u8 *respbuf, - t_u32 respbuflen) -{ - mlan_ioctl_req *ioctl_req = NULL; - mlan_ds_misc_cfg *misc = NULL; - mlan_status status = MLAN_STATUS_SUCCESS; - mlan_ds_cw_mode_ctrl *cwmode; - int ret = 0; - int header_len = 0; - - ENTER(); - - if (!priv || !priv->phandle) { - PRINTM(MERROR, "priv or handle is null\n"); - ret = -EFAULT; - goto done; - } - - ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); - if (ioctl_req == NULL) { - ret = -ENOMEM; - goto done; - } - - misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; - misc->sub_command = MLAN_OID_MISC_CWMODE_CTRL; - ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; - - header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_CWMODE); - if ((int)strlen(respbuf) == header_len) { - /* GET operation */ - ioctl_req->action = MLAN_ACT_GET; - } else { - /* SET operation */ - ioctl_req->action = MLAN_ACT_SET; - - cwmode = (mlan_ds_cw_mode_ctrl *)(respbuf + header_len + - sizeof(t_u8)); - misc->param.cwmode.mode = cwmode->mode; - misc->param.cwmode.txPower = cwmode->txPower; - misc->param.cwmode.rateInfo = cwmode->rateInfo; - misc->param.cwmode.channel = cwmode->channel; - misc->param.cwmode.chanInfo = cwmode->chanInfo; - misc->param.cwmode.pktLength = cwmode->pktLength; - } - - status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); - if (status != MLAN_STATUS_SUCCESS) { - ret = -EFAULT; - goto done; - } - - moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)&misc->param.cwmode, - sizeof(misc->param.cwmode), respbuflen); - ret = sizeof(misc->param.cwmode); - -done: - if (status != MLAN_STATUS_PENDING) - kfree(ioctl_req); - - LEAVE(); - return ret; -} - /** * @brief Set/Get out band independent reset * @@ -14643,6 +14585,92 @@ done: return ret; } +/** + * @brief Set and get gpio pin Configurations + * + * @param priv Pointer to moal_private structure + * @param respbuf Pointer to response buffer + * @param resplen Response buffer length + * + * @return Number of bytes written, negative for failure. + */ +static int woal_priv_gpiocfg(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_ds_gpio_cfg_ops *gpio_cfg = NULL; + int ret = 0; + int data[3] = {0}; + int user_data_len = 0, header_len = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + + ENTER(); + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + ret = -ENOMEM; + goto done; + } + + misc = (mlan_ds_misc_cfg *)req->pbuf; + misc->sub_command = MLAN_OID_MISC_GPIO_CFG; + req->req_id = MLAN_IOCTL_MISC_CFG; + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_GPIOCFG); + + if ((int)strlen(respbuf) == header_len) { + ret = -EINVAL; + goto done; + } + /* SET operation */ + memset((t_u8 *)data, 0, sizeof(data)); + + parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data), + &user_data_len); + + if (user_data_len == 1) { + PRINTM(MINFO, "GPIO_CFG: GET\n"); + req->action = MLAN_ACT_GET; + } else if (user_data_len >= 2) { + PRINTM(MINFO, "GPIO_CFG: SET\n"); + req->action = MLAN_ACT_SET; + } else { + ret = -EINVAL; + goto done; + } + + gpio_cfg = (mlan_ds_gpio_cfg_ops *)&misc->param.gpio_cfg_ops; + if (gpio_cfg) { + gpio_cfg->pin_num = (t_u8)data[0]; + if (user_data_len >= 2) + gpio_cfg->opsType = (t_u8)data[1]; + if (user_data_len == 3) + gpio_cfg->value = (t_u8)data[2]; + } else { + ret = -EFAULT; + goto done; + } + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; + } + gpio_cfg = (mlan_ds_gpio_cfg_ops *)&misc->param.gpio_cfg_ops; + if (req->action == MLAN_ACT_GET) { + moal_memcpy_ext(priv->phandle, respbuf, gpio_cfg, + sizeof(gpio_cfg), respbuflen); + ret = sizeof(gpio_cfg); + } + +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + /** * @brief Set and get boot sleep configure * @param priv Pointer to moal_private structure @@ -17906,10 +17934,11 @@ static int woal_priv_set_roam_passphrase(moal_private *priv, t_u8 *respbuf, goto done; } ssid_passphrase->ssid.ssid_len = strlen(item); - strncpy((char *)ssid_passphrase->ssid.ssid, - item, - MIN(strlen(item), - MLAN_MAX_SSID_LENGTH)); + moal_memcpy_ext( + priv->phandle, + (char *)ssid_passphrase->ssid.ssid, + item, strlen(item), + MLAN_MAX_SSID_LENGTH); PRINTM(MINFO, "ssid=%s, len=%d\n", ssid_passphrase->ssid.ssid, (int)ssid_passphrase->ssid.ssid_len); @@ -19521,7 +19550,8 @@ static int woal_priv_set_get_lpm(moal_private *priv, t_u8 *respbuf, ENTER(); if (IS_CARD9098(priv->phandle->card_type) || - IS_CARD9097(priv->phandle->card_type)) { + IS_CARD9097(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_LPM); if ((int)strlen(respbuf) == header_len) { /* GET operation */ @@ -20495,6 +20525,10 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) /* Memory Read/Write */ len = woal_priv_memrdwr(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_GPIOCFG, + strlen(PRIV_CMD_GPIOCFG)) == 0) { + len = woal_priv_gpiocfg(priv, buf, priv_cmd.total_len); + goto handled; #ifdef SDIO } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_SDCMD52RW, strlen(PRIV_CMD_SDCMD52RW)) == 0) { @@ -20988,12 +21022,6 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) /* Set/Get CFP table codes */ len = woal_priv_cfp_code(priv, buf, priv_cmd.total_len); goto handled; - } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_CWMODE, - strlen(PRIV_CMD_CWMODE)) == 0) { - /* Set/Get Tx CWMode */ - len = woal_priv_set_get_cwmode(priv, buf, - priv_cmd.total_len); - goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_ANT_CFG, strlen(PRIV_CMD_ANT_CFG)) == 0) { /* Set/Get Tx/Rx antenna */ @@ -21452,8 +21480,8 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) PRINTM(MIOCTL, "Set COUNTRY %s\n", country_code); if (priv->phandle->params.cntry_txpwr) { if (MLAN_STATUS_SUCCESS != - woal_request_country_power_table(priv, - country_code)) { + woal_request_country_power_table(priv, country_code, + MOAL_IOCTL_WAIT)) { ret = -EFAULT; goto done; } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h index ad1e549..2776d5b 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h @@ -151,6 +151,7 @@ typedef struct _chan_stats { #define PRIV_CMD_REGRDWR "regrdwr" #define PRIV_CMD_RDEEPROM "rdeeprom" #define PRIV_CMD_MEMRDWR "memrdwr" +#define PRIV_CMD_GPIOCFG "gpiocfg" #ifdef SDIO #define PRIV_CMD_SDCMD52RW "sdcmd52rw" #endif @@ -229,7 +230,6 @@ typedef struct _chan_stats { #define PRIV_CMD_DFS_CAC "dfs_cac" #define PRIV_CMD_AUTODFS "autodfs" #define PRIV_CMD_CFP_CODE "cfpcode" -#define PRIV_CMD_CWMODE "cwmode" #define PRIV_CMD_ANT_CFG "antcfg" #define PRIV_CMD_SYSCLOCK "sysclock" #define PRIV_CMD_GET_KEY "getkey" @@ -737,13 +737,6 @@ typedef struct _tx_rx_histogram { t_u8 action; } __ATTRIB_PACK__ tx_rx_histogram; -/* Enum for different CW mode type */ -typedef enum _cw_modes_e { - CWMODE_DISABLE, - CWMODE_TXCONTPKT, - CWMODE_TXCONTWAVE, -} cw_modes_e; - /** wlan_ieee80211_chan */ typedef struct { /** center freq */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_init.c b/mxm_wifiex/wlan_src/mlinux/moal_init.c index 7038666..047a71c 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_init.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_init.c @@ -29,7 +29,11 @@ extern pmoal_handle m_handle[]; static char *fw_name; static int req_fw_nowait; int fw_reload; -int auto_fw_reload; +#ifdef PCIE +int auto_fw_reload = AUTO_FW_RELOAD_ENABLE | AUTO_FW_RELOAD_PCIE_INBAND_RESET; +#else +int auto_fw_reload = AUTO_FW_RELOAD_ENABLE; +#endif static char *hw_name; @@ -78,7 +82,7 @@ static int auto_ds; /** net_rx mode*/ static int net_rx; /** amsdu deaggr mode */ -static int amsdu_deaggr; +static int amsdu_deaggr = 1; static int ext_scan; @@ -122,6 +126,11 @@ static int max_vir_bss = DEF_VIRTUAL_BSS; #endif #endif +/** Max NAN interfaces */ +static int max_nan_bss = DEF_NAN_BSS; +/** NAN interface name */ +static char *nan_name; + /** PM keep power */ static int pm_keep_power = 1; #ifdef SDIO_SUSPEND_RESUME @@ -152,6 +161,12 @@ static int rps = 0; #endif #endif +/** + * EDMAC for EU adaptivity + * Default value of 0 keeps edmac disabled by default + */ +static int edmac_ctrl = 0; + static int tx_skb_clone = 0; #ifdef IMX_SUPPORT static int pmqos = 1; @@ -301,6 +316,8 @@ static int mon_filter = DEFAULT_NETMON_FILTER; #endif #endif +int dual_nb; + #ifdef DEBUG_LEVEL1 #ifdef DEBUG_LEVEL2 #define DEFAULT_DEBUG_MASK (0xffffffff) @@ -345,7 +362,6 @@ static card_type_entry card_type_map_tbl[] = { #ifdef SDIW624 {CARD_TYPE_SDIW624, 0, CARD_SDIW624}, #endif - {CARD_TYPE_SDAW693, 0, CARD_SDAW693}, #ifdef PCIE8897 {CARD_TYPE_PCIE8897, 0, CARD_PCIE8897}, #endif @@ -358,7 +374,6 @@ static card_type_entry card_type_map_tbl[] = { #ifdef PCIE9098 {CARD_TYPE_PCIE9098, 0, CARD_PCIE9098}, #endif - {CARD_TYPE_PCIEAW693, 0, CARD_PCIEAW693}, #ifdef PCIEIW624 {CARD_TYPE_PCIEIW624, 0, CARD_PCIEIW624}, #endif @@ -553,7 +568,9 @@ static mlan_status parse_line_read_card_info(t_u8 *line, char **type, p = strstr(line, "_"); if (p != NULL) { - *p++ = '\0'; + *p = '\0'; + if (!woal_secure_add(&p, 1, &p, TYPE_PTR)) + PRINTM(MERROR, "%s:ERR:pointer overflow \n", __func__); *if_id = p; } else { *if_id = NULL; @@ -772,7 +789,20 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size, } #endif #endif - else if (strncmp(line, "auto_ds", strlen("auto_ds")) == 0) { + else if (strncmp(line, "nan_name", strlen("nan_name")) == 0) { + if (parse_line_read_string(line, &out_str) != + MLAN_STATUS_SUCCESS) + goto err; + woal_dup_string(¶ms->nan_name, out_str); + PRINTM(MMSG, "nan_name=%s\n", params->nan_name); + } else if (strncmp(line, "max_nan_bss", + strlen("max_nan_bss")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + params->max_nan_bss = out_data; + PRINTM(MMSG, "max_nan_bss = %d\n", params->max_nan_bss); + } else if (strncmp(line, "auto_ds", strlen("auto_ds")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1237,8 +1267,17 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size, } #endif #endif - else if (strncmp(line, "tx_skb_clone", - strlen("tx_skb_clone")) == 0) { + else if (strncmp(line, "edmac_ctrl", strlen("edmac_ctrl")) == + 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + + handle->params.edmac_ctrl = out_data; + PRINTM(MMSG, "edmac_ctrl set to %x from cfg\n", + handle->params.edmac_ctrl); + } else if (strncmp(line, "tx_skb_clone", + strlen("tx_skb_clone")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1452,6 +1491,12 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size, goto err; params->auto_11ax = out_data; PRINTM(MMSG, "auto_11ax=%d\n", params->auto_11ax); + } else if (strncmp(line, "dual_nb", strlen("dual_nb")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + params->dual_nb = out_data; + PRINTM(MMSG, "dual_nb=%d\n", params->dual_nb); } } if (end) @@ -1570,6 +1615,12 @@ static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params) handle->params.max_vir_bss = params->max_vir_bss; #endif #endif /* WIFI_DIRECT_SUPPORT */ + handle->params.max_nan_bss = max_nan_bss; + woal_dup_string(&handle->params.nan_name, nan_name); + if (params) { + handle->params.max_nan_bss = params->max_nan_bss; + woal_dup_string(&handle->params.nan_name, params->nan_name); + } handle->params.auto_ds = auto_ds; if (params) handle->params.auto_ds = params->auto_ds; @@ -1738,6 +1789,7 @@ static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params) PRINTM(MMSG, "rps set to %x from module param\n", handle->params.rps); #endif #endif + handle->params.edmac_ctrl = edmac_ctrl; if (tx_skb_clone) moal_extflg_set(handle, EXT_TX_SKB_CLONE); @@ -1804,6 +1856,9 @@ static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params) } handle->params.keep_previous_scan = keep_previous_scan; handle->params.auto_11ax = auto_11ax; + handle->params.dual_nb = dual_nb; + if (params) + handle->params.dual_nb = params->dual_nb; } /** @@ -1848,6 +1903,10 @@ void woal_free_module_param(moal_handle *handle) params->wfd_name = NULL; } #endif /* WIFI_DIRECT_SUPPORT */ + if (params->nan_name) { + kfree(params->nan_name); + params->nan_name = NULL; + } if (params->dpd_data_cfg) { kfree(params->dpd_data_cfg); params->dpd_data_cfg = NULL; @@ -1987,8 +2046,14 @@ void woal_init_from_dev_tree(void) } #endif #endif - else if (!strncmp(prop->name, "tx_skb_clone", - strlen("tx_skb_clone"))) { + else if (!strncmp(prop->name, "edmac_ctrl", + strlen("edmac_ctrl"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + PRINTM(MIOCTL, "edmac_ctrl=0x%x\n", data); + edmac_ctrl = data; + } + } else if (!strncmp(prop->name, "tx_skb_clone", + strlen("tx_skb_clone"))) { if (!of_property_read_u32(dt_node, prop->name, &data)) { PRINTM(MIOCTL, "tx_skb_clone=0x%x\n", data); tx_skb_clone = data; @@ -2551,8 +2616,9 @@ MODULE_PARM_DESC(fw_reload, "0: disable fw_reload; 1: enable fw reload feature"); module_param(auto_fw_reload, int, 0); #ifdef PCIE -MODULE_PARM_DESC(auto_fw_reload, - "BIT0: enable auto fw_reload; BIT1:enable PCIe in-band reset"); +MODULE_PARM_DESC( + auto_fw_reload, + "BIT0: enable auto fw_reload; BIT1: 0: enable PCIE FLR, 1: enable PCIe in-band reset"); #else MODULE_PARM_DESC(auto_fw_reload, "BIT0: enable auto fw_reload"); #endif @@ -2573,8 +2639,9 @@ MODULE_PARM_DESC( rf_test_mode, "0: Download normal firmware; 1: Download RF_TEST_MODE firmware"); module_param(drv_mode, int, 0660); -MODULE_PARM_DESC(drv_mode, - "Bit 0: STA; Bit 1: uAP; Bit 2: WIFIDIRECT; Bit 7: ZERO_DFS"); +MODULE_PARM_DESC( + drv_mode, + "Bit 0: STA; Bit 1: uAP; Bit 2: WIFIDIRECT; Bit 4: NAN; Bit 7: ZERO_DFS"); #ifdef STA_SUPPORT module_param(max_sta_bss, int, 0); @@ -2598,6 +2665,10 @@ module_param(max_vir_bss, int, 0); MODULE_PARM_DESC(max_vir_bss, "Number of Virtual interfaces (0)"); #endif #endif /* WIFI_DIRECT_SUPPORT */ +module_param(nan_name, charp, 0); +MODULE_PARM_DESC(nan_name, "NAN interface name"); +module_param(max_nan_bss, int, 0); +MODULE_PARM_DESC(max_nan_bss, "Number of NAN interfaces (1)"); #ifdef DEBUG_LEVEL1 module_param(drvdbg, uint, 0660); MODULE_PARM_DESC(drvdbg, "Driver debug"); @@ -2663,6 +2734,8 @@ MODULE_PARM_DESC( "bit0-bit4(0x1 - 0xf): Enables rps on specific cpu ; 0: Disables rps"); #endif #endif +module_param(edmac_ctrl, int, 0660); +MODULE_PARM_DESC(edmac_ctrl, "0: Disable edmac; 1: Enable edmac"); module_param(tx_skb_clone, uint, 0660); MODULE_PARM_DESC(tx_skb_clone, "1: Enable tx_skb_clone; 0: Disable tx_skb_clone"); @@ -2741,8 +2814,9 @@ module_param(net_rx, int, 0); MODULE_PARM_DESC(net_rx, "0: use netif_rx_ni in rx; 1: use netif_receive_skb in rx"); module_param(amsdu_deaggr, int, 0); -MODULE_PARM_DESC(amsdu_deaggr, - "0: default; 1: Try to avoid buf copy in amsud deaggregation"); +MODULE_PARM_DESC( + amsdu_deaggr, + "0: buf copy in amsud deaggregation; 1: avoid buf copy in amsud deaggregation (default)"); #ifdef SDIO #endif @@ -2884,3 +2958,6 @@ MODULE_PARM_DESC( "Bit6:TX frames excluding control; Bit5:non-bss beacons; Bit3:unicast destined non-promiscuous frames only; Bit2:data frames; Bit1:control frames; Bit0:management frames"); #endif #endif + +module_param(dual_nb, int, 0); +MODULE_PARM_DESC(dual_nb, "0: Single BT (Default); 1: Dual BT"); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c index e38942b..97a2ef7 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c @@ -2150,6 +2150,8 @@ mlan_status woal_request_get_fw_info(moal_private *priv, t_u8 wait_option, info->param.fw_info.hotfix_version; priv->phandle->fw_ecsa_enable = info->param.fw_info.ecsa_enable; priv->phandle->fw_bands = info->param.fw_info.fw_bands; + priv->phandle->cmd_tx_data = info->param.fw_info.cmd_tx_data; + priv->phandle->sec_rgpower = info->param.fw_info.sec_rgpower; priv->phandle->fw_getlog_enable = info->param.fw_info.getlog_enable; priv->phandle->fw_roaming_support = @@ -2583,6 +2585,43 @@ done: return ret; } +/** + * @brief send mgmt packet through ioctl + * + * @param priv A pointer to moal_private structure + * @param pmbuf A pointer to mlan_buffer which hold mgmt packet + * @return N/A + */ +static mlan_status woal_send_mgmt_packet(moal_private *priv, pmlan_buffer pmbuf) +{ + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + ENTER(); + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) + goto done; + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TX_FRAME; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + misc->param.tx_frame.data_len = pmbuf->data_len; + misc->param.tx_frame.buf_type = MLAN_BUF_TYPE_RAW_DATA; + misc->param.tx_frame.priority = 7; + if (pmbuf->tx_seq_num) + misc->param.tx_frame.flags = MLAN_BUF_FLAG_TX_STATUS; + misc->param.tx_frame.tx_seq_num = pmbuf->tx_seq_num; + moal_memcpy_ext(priv->phandle, misc->param.tx_frame.tx_buf, + pmbuf->pbuf + pmbuf->data_offset, pmbuf->data_len, + MRVDRV_SIZE_OF_CMD_BUFFER); + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); +done: + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + LEAVE(); + return status; +} + /** * @brief send raw data packet ioctl function * @@ -2596,6 +2635,7 @@ int woal_send_host_packet(struct net_device *dev, struct ifreq *req) t_u32 packet_len = 0; int ret = 0; pmlan_buffer pmbuf = NULL; + IEEE80211_MGMT *mgmt = NULL; mlan_status status; ENTER(); @@ -2619,6 +2659,7 @@ int woal_send_host_packet(struct net_device *dev, struct ifreq *req) goto done; } #define PACKET_HEADER_LEN 8 +#define FRAME_LEN 2 #define MV_ETH_FRAME_LEN 1514 if (packet_len > MV_ETH_FRAME_LEN) { PRINTM(MERROR, "Invalid packet length %d\n", packet_len); @@ -2648,6 +2689,15 @@ int woal_send_host_packet(struct net_device *dev, struct ifreq *req) pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; pmbuf->bss_index = priv->bss_index; + mgmt = (IEEE80211_MGMT *)(pmbuf->pbuf + pmbuf->data_offset + + PACKET_HEADER_LEN + FRAME_LEN); + + if (priv->phandle->cmd_tx_data && + ((mgmt->frame_control & IEEE80211_FC_MGMT_FRAME_TYPE_MASK) == 0)) { + status = woal_send_mgmt_packet(priv, pmbuf); + woal_free_mlan_buffer(priv->phandle, pmbuf); + goto done; + } status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); switch (status) { case MLAN_STATUS_PENDING: @@ -3862,6 +3912,34 @@ done: return ret; } +/** @brief This function set rgpower table + * + * @param priv A Pointer to the moal_private structure + * @return MTRUE or MFALSE + */ +mlan_status woal_set_rgpower_table(moal_handle *handle) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *misc = NULL; + + ENTER(); + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req) { + misc = (mlan_ds_misc_cfg *)req->pbuf; + misc->sub_command = MLAN_OID_MISC_REGION_POWER_CFG; + req->req_id = MLAN_IOCTL_MISC_CFG; + req->action = MLAN_ACT_SET; + ret = woal_request_ioctl(woal_get_priv(handle, + MLAN_BSS_ROLE_ANY), + req, MOAL_IOCTL_WAIT); + } + if (ret != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return ret; +} + /** @brief This function enables the host sleep * * @param priv A Pointer to the moal_private structure @@ -8160,6 +8238,7 @@ void woal_ioctl_get_misc_conf(moal_private *priv, mlan_ds_misc_cfg *info) #define TX_FRAME_STR_LEN 200 #define TRIGGER_FRAME_STR_LEN 250 #define HE_TB_TX_STR_LEN 30 +#define MAX_RADIO_MODE 21 /* * @brief Parse mfg cmd radio mode string @@ -8206,7 +8285,7 @@ static int parse_radio_mode_string(const char *s, size_t len, if (pos) d->data2 = (t_u32)woal_string_to_number(pos); - if ((d->data1 > 14) || (d->data2 > 14)) + if ((d->data1 > MAX_RADIO_MODE) || (d->data2 > MAX_RADIO_MODE)) ret = -EINVAL; kfree(tmp); @@ -8214,7 +8293,6 @@ static int parse_radio_mode_string(const char *s, size_t len, return ret; } -#ifdef SD9177 /* * @brief PowerLevelToDUT11Bits * @@ -8238,7 +8316,6 @@ static void PowerLevelToDUT11Bits(int Pwr, t_u32 *PowerLevel) return; } -#endif /* * @brief Parse mfg cmd tx pwr string @@ -8258,21 +8335,24 @@ static int parse_tx_pwr_string(moal_handle *handle, const char *s, size_t len, char *tmp = NULL; char *pos = NULL; gfp_t flag; -#ifdef SD9177 t_u32 tx_pwr_converted = 0xffffffff; int tx_pwr_local = 0; - t_u8 fc_card = MFALSE; -#endif + t_u8 pow_conv = MFALSE; + t_u32 pow_limit = 24; + t_u8 card_type; ENTER(); if (!s || !d) { LEAVE(); return -EINVAL; } -#ifdef SD9177 - if (IS_SD9177(handle->card_type)) - fc_card = MTRUE; -#endif + + card_type = (handle->card_type) & 0xff; + if ((card_type == CARD_TYPE_9098) || (card_type == CARD_TYPE_9097) || + (card_type == CARD_TYPE_9177) || (card_type == CARD_TYPE_IW624) || + (card_type == CARD_TYPE_AW693)) + pow_conv = MTRUE; + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; string = kzalloc(TX_PWR_STR_LEN, flag); if (string == NULL) { @@ -8288,16 +8368,14 @@ static int parse_tx_pwr_string(moal_handle *handle, const char *s, size_t len, /* tx power value */ pos = strsep(&string, " \t"); -#ifdef SD9177 - if (fc_card && pos) { - /* for sd9177 we need to convert user power vals including -ve - * vals as per labtool */ + if (pow_conv && pos) { + /* for SH and later chipsets 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; - } else -#endif - if (pos) { + pow_limit = 384; + } else if (pos) { d->data1 = (t_u32)woal_string_to_number(pos); } /* modulation */ @@ -8310,12 +8388,8 @@ static int parse_tx_pwr_string(moal_handle *handle, const char *s, size_t len, if (pos) d->data3 = (t_u32)woal_string_to_number(pos); -#ifdef SD9177 - if (((!fc_card) && ((d->data1 > 24) && (d->data1 != 0xffffffff))) || + if (((d->data1 > pow_limit) && (d->data1 != 0xffffffff)) || (d->data2 > 2)) -#else - if (((d->data1 > 24) && (d->data1 != 0xffffffff)) || (d->data2 > 2)) -#endif ret = -EINVAL; kfree(tmp); @@ -9112,3 +9186,59 @@ done: return ret; } #endif /* RF_TEST_MODE */ + +/** + * @brief Configures edmac parameters based on region + * + * @param priv A pointer to moal_private structure + * @param country_code A pointer to country code + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING on success, + * otherwise failure code + */ +mlan_status woal_edmac_cfg(moal_private *priv, t_u8 *country_code) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_misc_cfg *cfg = NULL; + mlan_status status = MLAN_STATUS_SUCCESS; + BOOLEAN is_etsi = MFALSE; + + ENTER(); + + is_etsi = woal_is_etsi_country(country_code); + if (is_etsi == MFALSE && priv->phandle->is_edmac_enabled == MFALSE) + return MLAN_STATUS_SUCCESS; + + if (is_etsi == MTRUE && priv->phandle->is_edmac_enabled == MTRUE) + return MLAN_STATUS_SUCCESS; + + req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (req == NULL) { + status = MLAN_STATUS_FAILURE; + goto done; + } + + cfg = (mlan_ds_misc_cfg *)req->pbuf; + cfg->sub_command = MLAN_OID_MISC_EDMAC_CONFIG; + req->req_id = MLAN_IOCTL_MISC_CFG; + + if (is_etsi) + req->action = MLAN_ACT_SET; + else + req->action = MLAN_ACT_CLEAR; + + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + PRINTM(MMSG, "Failed to configure edmac\n"); + goto done; + } + + if (is_etsi) + priv->phandle->is_edmac_enabled = MTRUE; + else + priv->phandle->is_edmac_enabled = MFALSE; +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return status; +} diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.c b/mxm_wifiex/wlan_src/mlinux/moal_main.c index e698f43..4f20fa9 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.c @@ -488,45 +488,6 @@ static struct _card_info card_info_SDIW624 = { }; #endif -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_reset_reg = 0x0EE, - .fw_reset_val = 0x99, - .slew_rate_reg = 0x90002328, - .slew_rate_bit_offset = 12, -#endif - .sniffer_support = 1, - .per_pkt_cfg_support = 1, - .host_mlme_required = 1, -}; - #ifdef SD9177 static struct _card_info card_info_SD9177 = { .embedded_supp = 1, @@ -672,30 +633,6 @@ static struct _card_info card_info_PCIEIW624 = { }; #endif -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_reset_reg = 0x1c94, - .fw_reset_val = 0x98, - .sniffer_support = 1, - .per_pkt_cfg_support = 1, - .host_mlme_required = 1, -}; - #ifdef USB8801 static struct _card_info card_info_USB8801 = { .embedded_supp = 0, @@ -1210,9 +1147,8 @@ static void woal_hang_work_queue(struct work_struct *work) } #ifdef PCIE else if (IS_PCIE(reset_handle->card_type)) { -#define FW_RELOAD_PCIE_IN_BAND_RESET 3 - if (reset_handle->params.auto_fw_reload == - FW_RELOAD_PCIE_IN_BAND_RESET) { + if (reset_handle->params.auto_fw_reload & + AUTO_FW_RELOAD_PCIE_INBAND_RESET) { PRINTM(MMSG, "WIFI auto_fw_reload: fw_reload=6\n"); ret = woal_request_fw_reload( @@ -1466,7 +1402,7 @@ static int woal_netdevice_event(struct notifier_block *nb, unsigned long event, #ifdef WIFI_DIRECT_SUPPORT && priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT #endif - ) { + && priv->bss_type != MLAN_BSS_TYPE_NAN) { PRINTM(MIOCTL, "Bss type [%d] is not STA/P2P, ignore\n", (int)priv->bss_type); ret = NOTIFY_DONE; @@ -1577,7 +1513,7 @@ static int woal_inet6_netdeive_event(struct notifier_block *nb, #ifdef WIFI_DIRECT_SUPPORT && priv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT #endif - ) { + && priv->bss_type != MLAN_BSS_TYPE_NAN) { PRINTM(MIOCTL, "Bss type [%d] is not STA/P2P, ignore\n", (int)priv->bss_type); ret = NOTIFY_DONE; @@ -1931,6 +1867,7 @@ mlan_status woal_update_drv_tbl(moal_handle *handle, int drv_mode_local) #ifdef WIFI_DIRECT_SUPPORT int max_wfd_bss = handle->params.max_wfd_bss; #endif + int max_nan_bss = handle->params.max_nan_bss; int max_dfs_bss = MAX_DFS_BSS; ENTER(); @@ -1979,6 +1916,17 @@ mlan_status woal_update_drv_tbl(moal_handle *handle, int drv_mode_local) #endif /* WIFI_DIRECT_SUPPORT */ + if (drv_mode_local & DRV_MODE_NAN) { + if ((max_nan_bss < 1) || (max_nan_bss > MAX_NAN_BSS)) { + PRINTM(MWARN, + "Unsupported max_nan_bss (%d), setting to default\n", + max_nan_bss); + max_nan_bss = DEF_NAN_BSS; + } + intf_num += max_nan_bss; + handle->params.max_nan_bss = max_nan_bss; + } + if (drv_mode_local & DRV_MODE_DFS) intf_num += max_dfs_bss; /* Create BSS attribute table */ @@ -2049,6 +1997,20 @@ mlan_status woal_update_drv_tbl(moal_handle *handle, int drv_mode_local) } #endif /* WIFI_DIRECT_SUPPORT */ + if (drv_mode_local & DRV_MODE_NAN) { + for (j = 0; j < max_nan_bss; j++) { + if (i >= (int)intf_num) + break; + bss_tbl[i].bss_type = MLAN_BSS_TYPE_NAN; + bss_tbl[i].frame_type = MLAN_DATA_FRAME_TYPE_ETH_II; + bss_tbl[i].active = MTRUE; + bss_tbl[i].bss_priority = 0; + bss_tbl[i].bss_num = j; + bss_tbl[i].bss_virtual = MFALSE; + i++; + } + } + if (drv_mode_local & DRV_MODE_DFS) { for (j = 0; j < max_dfs_bss; j++) { if (i >= (int)intf_num) @@ -2117,6 +2079,12 @@ mlan_status woal_init_sw(moal_handle *handle) handle->hardware_status = HardwareStatusInitializing; handle->main_state = MOAL_STATE_IDLE; +#ifdef DEBUG_LEVEL1 + drvdbg = handle->params.drvdbg; +#endif + + handle->fw_dump_status = MFALSE; + #ifdef STA_SUPPORT if ((handle->params.drv_mode & DRV_MODE_STA) #ifdef STA_WEXT @@ -2281,6 +2249,7 @@ mlan_status woal_init_sw(moal_handle *handle) BW_20_SUPPORT | BW_40_SUPPORT | BW_80_SUPPORT; handle->rtt_capa.responder_supported = MTRUE; handle->rtt_capa.mc_version = 60; + handle->is_edmac_enabled = MFALSE; /* Register to MLAN */ memset(&device, 0, sizeof(mlan_device)); @@ -2670,9 +2639,11 @@ static t_u32 woal_set_sdio_slew_rate(moal_handle *handle) if ((handle->card_info->slew_rate_reg != 0) && (handle->params.slew_rate > 3 || handle->params.slew_rate < 0)) return MLAN_STATUS_FAILURE; +#if defined(SD9098) || defined(SD9097) || defined(SDIW624) || defined(SD9177) if (IS_SD9098(handle->card_type) || IS_SD9097(handle->card_type) || IS_SDIW624(handle->card_type) || IS_SD9177(handle->card_type)) reg_type = MLAN_REG_CIU; +#endif status = woal_getset_regrdwr(priv, MLAN_ACT_GET, reg_type, handle->card_info->slew_rate_reg, &value); @@ -3772,6 +3743,14 @@ static mlan_status woal_add_card_dpc(moal_handle *handle) goto err; } } + if (handle->sec_rgpower && + handle->params.cntry_txpwr != CNTRY_RGPOWER_MODE) { + PRINTM(MERROR, "wlan: invalid cntry_txpwr mode=%d\n", + handle->params.cntry_txpwr); + woal_set_rgpower_table(handle); + ret = MLAN_STATUS_FAILURE; + goto err; + } woal_get_version(handle, str_buf, sizeof(str_buf) - 1); PRINTM(MMSG, "wlan: version = %s\n", str_buf); @@ -3931,7 +3910,7 @@ static mlan_status woal_req_dpd_data(moal_handle *handle, ENTER(); - if (dpd_data_cfg && strncmp(dpd_data_cfg, "none", strlen("none"))) { + if (dpd_data_cfg) { PRINTM(MMSG, "Request firmware: %s\n", dpd_data_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) @@ -3987,6 +3966,8 @@ static mlan_status woal_req_dpd_data(moal_handle *handle, } else { param->dpd_data_len = UNKNOW_DPD_LENGTH; } + } else { + param->dpd_data_len = NONE_DPD_LENGTH; } done: @@ -4558,7 +4539,11 @@ mlan_status woal_init_fw(moal_handle *handle) void woal_fill_mlan_buffer(moal_private *priv, mlan_buffer *pmbuf, struct sk_buff *skb) { - wifi_timeval tstamp; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) + struct timespec64 ts; +#else + struct timespec ts; +#endif struct ethhdr *eth; dot11_txcontrol *txcontrol; t_u8 tx_ctrl_flag = MFALSE; @@ -4630,9 +4615,13 @@ void woal_fill_mlan_buffer(moal_private *priv, mlan_buffer *pmbuf, * packet to the firmware for aggregate delay calculation for stats * and MSDU lifetime expiry. */ - woal_get_monotonic_time(&tstamp); - skb->tstamp = ktime_get_real(); - +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0) + ktime_get_raw_ts64(&ts); + skb->tstamp = timespec64_to_ktime(ts); +#else + getrawmonotonic(&ts); + skb->tstamp = timespec_to_ktime(ts); +#endif pmbuf->pdesc = skb; pmbuf->pbuf = skb->head + sizeof(mlan_buffer); #ifdef PCIE @@ -4644,9 +4633,8 @@ void woal_fill_mlan_buffer(moal_private *priv, mlan_buffer *pmbuf, pmbuf->data_len = skb->len; pmbuf->priority = skb->priority; pmbuf->buf_type = 0; - pmbuf->in_ts_sec = tstamp.time_sec; - pmbuf->in_ts_usec = tstamp.time_usec; - + pmbuf->in_ts_sec = (t_u32)ts.tv_sec; + pmbuf->in_ts_usec = (t_u32)ts.tv_nsec / 1000; LEAVE(); return; } @@ -5193,6 +5181,15 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, snprintf(name, sizeof(name), "%s", default_wfd_name); break; #endif + case MLAN_BSS_TYPE_NAN: + if (handle->params.nan_name) + snprintf(name, sizeof(name), "%s%%d", + handle->params.nan_name); + else if (handle->second_mac) + snprintf(name, sizeof(name), "m%s", default_nan_name); + else + snprintf(name, sizeof(name), "%s", default_nan_name); + break; case MLAN_BSS_TYPE_DFS: if (handle->second_mac) snprintf(name, sizeof(name), "m%s", default_dfs_name); @@ -5238,6 +5235,8 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, else if (bss_type == MLAN_BSS_TYPE_WIFIDIRECT) priv->bss_role = MLAN_BSS_ROLE_STA; #endif + else if (bss_type == MLAN_BSS_TYPE_NAN) + priv->bss_role = MLAN_BSS_ROLE_STA; else if (bss_type == MLAN_BSS_TYPE_DFS) priv->bss_role = MLAN_BSS_ROLE_UAP; @@ -5276,7 +5275,7 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, #ifdef WIFI_DIRECT_SUPPORT || bss_type == MLAN_BSS_TYPE_WIFIDIRECT #endif - ) + || bss_type == MLAN_BSS_TYPE_NAN) woal_init_sta_dev(dev, priv); #endif #ifdef UAP_SUPPORT @@ -5348,7 +5347,7 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index, || bss_type == MLAN_BSS_TYPE_WIFIDIRECT #endif #endif - ) + || bss_type == MLAN_BSS_TYPE_NAN) /* Register cfg80211 for STA or Wifi direct */ if (woal_register_sta_cfg80211(dev, bss_type)) { PRINTM(MERROR, @@ -5737,7 +5736,8 @@ mlan_status woal_set_user_antcfg(moal_handle *handle, t_u8 wait_option) if (handle->feature_control & FEATURE_CTRL_STREAM_2X2) { if (IS_CARD9098(handle->card_type) || IS_CARD9097(handle->card_type) || - IS_CARDIW624(handle->card_type)) { + IS_CARDIW624(handle->card_type) || + IS_CARDAW693(handle->card_type)) { radio->param.ant_cfg.tx_antenna = radio->param.ant_cfg.rx_antenna = antcfg; #if defined(STA_CFG80211) || defined(UAP_CFG80211) @@ -6002,6 +6002,7 @@ void woal_flush_workqueue(moal_handle *handle) flush_workqueue(handle->pcie_rx_event_workqueue); if (handle->pcie_cmd_resp_workqueue) flush_workqueue(handle->pcie_cmd_resp_workqueue); + cancel_delayed_work_sync(&handle->pcie_delayed_tx_work); #ifdef TASKLET_SUPPORT tasklet_kill(&handle->pcie_tx_complete_task); tasklet_kill(&handle->pcie_rx_task); @@ -6066,6 +6067,7 @@ void woal_terminate_workqueue(moal_handle *handle) destroy_workqueue(handle->pcie_cmd_resp_workqueue); handle->pcie_cmd_resp_workqueue = NULL; } + cancel_delayed_work_sync(&handle->pcie_delayed_tx_work); #ifdef TASKLET_SUPPORT tasklet_kill(&handle->pcie_tx_complete_task); tasklet_kill(&handle->pcie_rx_task); @@ -6182,7 +6184,8 @@ int woal_open(struct net_device *dev) #if defined(UAP_CFG80211) || defined(STA_CFG80211) if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { - if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP_VLAN) + if ((dev->ieee80211_ptr) && + (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP_VLAN)) carrier_on = MTRUE; } #endif @@ -6227,7 +6230,8 @@ int woal_close(struct net_device *dev) #if defined(UAP_CFG80211) || defined(STA_CFG80211) if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { /** For multi-ap virtual interface */ - if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP_VLAN) { + if ((dev->ieee80211_ptr) && + (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP_VLAN)) { woal_stop_queue(priv->netdev); MODULE_PUT; LEAVE(); @@ -6261,9 +6265,11 @@ int woal_close(struct net_device *dev) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) #if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 19, 2)) || IMX_ANDROID_13 || \ IMX_ANDROID_12_BACKPORT) - if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->connected) { + if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev && + priv->wdev->connected) { #else - if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev->current_bss) { + if (IS_STA_CFG80211(cfg80211_wext) && priv->wdev && + priv->wdev->current_bss) { #endif priv->cfg_disconnect = MTRUE; cfg80211_disconnected(priv->netdev, 0, NULL, 0, @@ -6275,7 +6281,8 @@ int woal_close(struct net_device *dev) #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) - if (IS_STA_CFG80211(cfg80211_wext) && priv->sched_scanning) { + if (IS_STA_CFG80211(cfg80211_wext) && priv->sched_scanning && + priv->wdev) { woal_stop_bg_scan(priv, MOAL_IOCTL_WAIT); priv->bg_scan_start = MFALSE; priv->bg_scan_reported = MFALSE; @@ -7579,11 +7586,12 @@ void woal_send_tx_pkt_to_mon_if(moal_private *priv, pmlan_buffer pmbuf) struct radiotap_info *rt = NULL; pmlan_buffer pmbuf2 = NULL; t_u8 *ptr = NULL; - int len, hdr_len; + int hdr_len; + int len = 0; t_u16 fc; t_u8 rfc1042_eth_hdr[ETH_ALEN] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00}; moal_handle *handle = NULL; - + t_u32 temp_len = 0; if (!priv || !pmbuf) return; @@ -7594,7 +7602,12 @@ void woal_send_tx_pkt_to_mon_if(moal_private *priv, pmlan_buffer pmbuf) return; ENTER(); - pmbuf2 = woal_alloc_mlan_buffer(handle, pmbuf->data_len + 64); + + if (!woal_secure_add(&pmbuf->data_len, 64, &temp_len, TYPE_UINT32)) + PRINTM(MERROR, "%s: len to allocate pmbuf2 is invalid\n", + __func__); + + pmbuf2 = woal_alloc_mlan_buffer(handle, temp_len); if (!pmbuf2) { PRINTM(MERROR, "Failed to allocate mlan_buffer for Tx sniffer packet"); @@ -7648,7 +7661,11 @@ void woal_send_tx_pkt_to_mon_if(moal_private *priv, pmlan_buffer pmbuf) memcpy((t_u8 *)dot11_hdr + hdr_len, &rfc1042_eth_hdr, ETH_ALEN); /* Copy out rest of the data frame */ - len = pmbuf->data_len - 2 * ETH_ALEN; + if (!woal_secure_sub(&pmbuf->data_len, 2 * ETH_ALEN, &len, + TYPE_UINT32)) { + PRINTM(MERROR, "%s: data_len underflow\n", __func__); + } + ptr += 2 * ETH_ALEN; memcpy(pmbuf2->pbuf + pmbuf2->data_offset + hdr_len + sizeof(rfc1042_eth_hdr), @@ -8633,13 +8650,18 @@ pmlan_ioctl_req woal_alloc_mlan_ioctl_req(int size) { mlan_ioctl_req *req = NULL; gfp_t flag; - + t_s32 temp_size = 0; ENTER(); flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; - req = kzalloc((sizeof(mlan_ioctl_req) + size + sizeof(int) + - sizeof(wait_queue)), - flag); + + if (!woal_secure_add( + &size, + (sizeof(mlan_ioctl_req) + sizeof(int) + sizeof(wait_queue)), + &temp_size, TYPE_SINT32)) + PRINTM(MERROR, "%s:ioctl size overflow \n", __func__); + + req = kzalloc(temp_size, flag); if (!req) { PRINTM(MERROR, "%s: Fail to alloc ioctl buffer\n", __func__); LEAVE(); @@ -8740,9 +8762,6 @@ static int woal_get_card_info(moal_handle *phandle) phandle->card_info = &card_info_SD9097; break; #endif - case CARD_TYPE_SDAW693: - phandle->card_info = &card_info_SDAW693; - break; #ifdef SDIW624 case CARD_TYPE_SDIW624: phandle->card_info = &card_info_SDIW624; @@ -8751,7 +8770,7 @@ static int woal_get_card_info(moal_handle *phandle) #ifdef SD9177 case CARD_TYPE_SD9177: phandle->card_info = &card_info_SD9177; - phandle->event_fw_dump = MFALSE; + phandle->event_fw_dump = MTRUE; break; #endif #ifdef PCIE8997 @@ -8764,12 +8783,10 @@ static int woal_get_card_info(moal_handle *phandle) phandle->card_info = &card_info_PCIE9097; break; #endif - case CARD_TYPE_PCIEAW693: - phandle->card_info = &card_info_PCIEAW693; - break; #ifdef PCIEIW624 case CARD_TYPE_PCIEIW624: phandle->card_info = &card_info_PCIEIW624; + phandle->event_fw_dump = MTRUE; break; #endif #ifdef PCIE9098 @@ -9702,8 +9719,10 @@ t_void woal_store_ssu_dump(moal_handle *phandle, mlan_event *pmevent) } #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0) vfs_mkdir(path.dentry->d_inode, dentry, 0777); -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) vfs_mkdir(&init_user_ns, path.dentry->d_inode, dentry, 0777); +#else + vfs_mkdir(&nop_mnt_idmap, path.dentry->d_inode, dentry, 0777); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) mutex_unlock(&path.dentry->d_inode->i_mutex); @@ -9778,8 +9797,10 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) if (seqnum == 1) { #ifdef DEBUG_LEVEL1 - if (drvdbg & MFW_D) + if (drvdbg & MFW_D) { + drvdbg &= ~MFW_D; phandle->fw_dump_status = MTRUE; + } #endif if (phandle->fw_dump == MFALSE) { PRINTM(MMSG, "=====FW trigger dump====\n"); @@ -9863,8 +9884,10 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) if (seqnum == 1) { #ifdef DEBUG_LEVEL1 - if (drvdbg & MFW_D) + if (drvdbg & MFW_D) { phandle->fw_dump_status = MTRUE; + drvdbg &= ~MFW_D; + } #endif if (phandle->fw_dump == MFALSE) { PRINTM(MMSG, "=====FW trigger dump====\n"); @@ -10438,9 +10461,6 @@ t_void woal_save_host_cmdresp(moal_handle *phandle, mlan_cmdresp_event *pevent) if (dpd_data_cfg) snprintf(file_path, sizeof(file_path), "%s%s", DEF_FW_PATH, dpd_data_cfg); - else - snprintf(file_path, sizeof(file_path), "%s", - DEF_HOSTCMD_PATH); break; default: snprintf(file_path, sizeof(file_path), "%s", DEF_HOSTCMD_PATH); @@ -10679,8 +10699,10 @@ void woal_create_dump_dir(moal_handle *phandle, char *dir_buf, int buf_size) } #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 12, 0) ret = vfs_mkdir(path.dentry->d_inode, dentry, 0777); -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0) ret = vfs_mkdir(&init_user_ns, path.dentry->d_inode, dentry, 0777); +#else + ret = vfs_mkdir(&nop_mnt_idmap, path.dentry->d_inode, dentry, 0777); #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0) mutex_unlock(&path.dentry->d_inode->i_mutex); @@ -11114,7 +11136,8 @@ void woal_moal_debug_info(moal_private *priv, moal_handle *handle, u8 flag) * * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE */ -mlan_status woal_request_country_power_table(moal_private *priv, char *country) +mlan_status woal_request_country_power_table(moal_private *priv, char *country, + t_u8 wait_option) { mlan_status ret = MLAN_STATUS_SUCCESS; moal_handle *handle = NULL; @@ -11189,44 +11212,63 @@ mlan_status woal_request_country_power_table(moal_private *priv, char *country) } PRINTM(MMSG, "Trying download country_power_tble: %s\n", file_path); - ret = woal_set_user_init_data(handle, COUNTRY_POWER_TABLE, - MOAL_IOCTL_WAIT, file_path); + ret = woal_set_user_init_data(handle, COUNTRY_POWER_TABLE, wait_option, + file_path); #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) /* Try download WW rgpowertable */ if ((handle->params.cntry_txpwr == CNTRY_RGPOWER_MODE) && (ret == MLAN_STATUS_FILE_ERR)) { - memset(country_name, 0, sizeof(country_name)); - if (handle->params.hw_name) - snprintf(country_name, sizeof(country_name), - "%s_rgpower_WW.bin", handle->params.hw_name); - else - memcpy(country_name, "rgpower_WW.bin", - strlen("rgpower_WW.bin")); - last_slash = strrchr(file_path, '/'); - if (last_slash) - memset(last_slash + 1, 0, - sizeof(file_path) - 1 - - (last_slash - file_path)); - else - memset(file_path, 0, sizeof(file_path)); - if ((strlen(file_path) + strlen(country_name)) < - (sizeof(file_path) - 1)) - strncpy(file_path + strlen(file_path), country_name, - sizeof(file_path) - strlen(file_path) - 1); - else { - PRINTM(MERROR, - "file path buffer too small, fail to dnld power table\n"); - LEAVE(); - return MLAN_STATUS_FAILURE; - } - PRINTM(MMSG, "Trying again download country_power_tble: %s\n", - file_path); - ret = woal_set_user_init_data(handle, COUNTRY_POWER_TABLE, - MOAL_IOCTL_WAIT, file_path); - if (!ret) { - handle->country_code[0] = '0'; - handle->country_code[1] = '0'; + if (country[0] == 'W' && country[1] == 'W') { + if (handle->sec_rgpower) { + PRINTM(MERROR, + "wlan: rgpower_WW.bin not exist\n"); + woal_set_rgpower_table(handle); + } + } else { + memset(country_name, 0, sizeof(country_name)); + if (handle->params.hw_name) + snprintf(country_name, sizeof(country_name), + "%s_rgpower_WW.bin", + handle->params.hw_name); + else + memcpy(country_name, "rgpower_WW.bin", + strlen("rgpower_WW.bin")); + last_slash = strrchr(file_path, '/'); + if (last_slash) + memset(last_slash + 1, 0, + sizeof(file_path) - 1 - + (last_slash - file_path)); + else + memset(file_path, 0, sizeof(file_path)); + if ((strlen(file_path) + strlen(country_name)) < + (sizeof(file_path) - 1)) + strncpy(file_path + strlen(file_path), + country_name, + sizeof(file_path) - strlen(file_path) - + 1); + else { + PRINTM(MERROR, + "file path buffer too small, fail to dnld power table\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + PRINTM(MMSG, + "Trying again download country_power_tble: %s\n", + file_path); + ret = woal_set_user_init_data(handle, + COUNTRY_POWER_TABLE, + wait_option, file_path); + if (!ret) { + handle->country_code[0] = '0'; + handle->country_code[1] = '0'; + } else if (ret == MLAN_STATUS_FILE_ERR) { + if (handle->sec_rgpower) { + PRINTM(MERROR, + "wlan: rgpower_WW.bin not exist\n"); + woal_set_rgpower_table(handle); + } + } } } #endif @@ -11351,6 +11393,7 @@ t_void woal_evt_work_queue(struct work_struct *work) moal_handle *handle = container_of(work, moal_handle, evt_work); struct woal_event *evt; unsigned long flags; + t_u8 country_code[COUNTRY_CODE_LEN]; #if defined(UAP_CFG80211) || defined(STA_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) moal_private *priv; @@ -11433,6 +11476,26 @@ t_void woal_evt_work_queue(struct work_struct *work) break; #endif #endif + case WOAL_EVENT_RGPWR_KEY_MISMATCH: + if (handle->country_code[0] == '0' && + handle->country_code[1] == '0') { + PRINTM(MERROR, + "wlan: rgpower_WW.bin key mismatch!"); + woal_set_rgpower_table(handle); + } else { + memset(country_code, 0, sizeof(country_code)); + handle->country_code[0] = '0'; + handle->country_code[1] = '0'; + country_code[0] = 'W'; + country_code[1] = 'W'; + if (MLAN_STATUS_SUCCESS != + woal_request_country_power_table( + evt->priv, country_code, + MOAL_NO_WAIT)) + PRINTM(MERROR, + "Fail to request country power table\n"); + } + break; default: break; } @@ -11666,6 +11729,27 @@ t_void woal_pcie_cmd_resp_work_queue(struct work_struct *work) mlan_process_pcie_interrupt_cb(handle->pmlan_adapter, RX_CMD_RESP); LEAVE(); } + +/** + * @brief This workqueue handle delayed_tx_work + * + * @param work A pointer to work_struct + * + * @return N/A + */ +t_void woal_pcie_delayed_tx_work(struct work_struct *work) +{ + struct delayed_work *delayed_work = to_delayed_work(work); + moal_handle *handle = + container_of(delayed_work, moal_handle, pcie_delayed_tx_work); + ENTER(); + if (!handle || handle->surprise_removed == MTRUE) { + LEAVE(); + return; + } + mlan_process_pcie_interrupt_cb(handle->pmlan_adapter, TX_COMPLETE); + LEAVE(); +} #endif // PCIE /** @@ -11780,6 +11864,9 @@ t_void woal_main_work_queue(struct work_struct *work) } if (handle->fw_dbg == MTRUE) { handle->fw_dbg = MFALSE; +#ifdef DEBUG_LEVEL1 + drvdbg &= ~MFW_D; +#endif if (handle->ops.dump_fw_info) handle->ops.dump_fw_info(handle); LEAVE(); @@ -12271,6 +12358,9 @@ moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, } MLAN_INIT_WORK(&handle->pcie_cmd_resp_work, woal_pcie_cmd_resp_work_queue); + + INIT_DELAYED_WORK(&handle->pcie_delayed_tx_work, + woal_pcie_delayed_tx_work); #ifdef TASKLET_SUPPORT tasklet_init(&handle->pcie_tx_complete_task, woal_pcie_tx_complete_task, (unsigned long)handle); @@ -12407,6 +12497,11 @@ moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, return handle; err_init_fw: + if (handle->is_fw_dump_timer_set) { + woal_cancel_timer(&handle->fw_dump_timer); + handle->is_fw_dump_timer_set = MFALSE; + } + if ((handle->hardware_status == HardwareStatusFwReady) || (handle->hardware_status == HardwareStatusReady)) { PRINTM(MINFO, "shutdown mlan\n"); @@ -12812,10 +12907,12 @@ static int woal_reset_and_reload_fw(moal_handle *handle, t_u8 mode) ret = -EFAULT; goto done; } +#if defined(SD9098) || defined(SD9097) || defined(SDIW624) || defined(SD9177) if (IS_SD9098(handle->card_type) || IS_SD9097(handle->card_type) || IS_SDIW624(handle->card_type) || IS_SD9177(handle->card_type) || IS_SDAW693(handle->card_type)) handle->ops.write_reg(handle, 0x00, 0x10); +#endif /* Poll register around 100 ms */ for (tries = 0; tries < FW_POLL_TRIES; ++tries) { handle->ops.read_reg(handle, reset_reg, &value); @@ -12862,6 +12959,8 @@ static int woal_pcie_reset_and_reload_fw(moal_handle *handle) t_u8 reset_val = handle->card_info->fw_reset_val; ENTER(); +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIEIW62X) if (!IS_PCIE9098(handle->card_type) && !IS_PCIEIW624(handle->card_type) && !IS_PCIEAW693(handle->card_type) && @@ -12870,6 +12969,7 @@ static int woal_pcie_reset_and_reload_fw(moal_handle *handle) PRINTM(MERROR, "HW don't support PCIE in-band reset\n"); return -EFAULT; } +#endif mlan_pm_wakeup_card(handle->pmlan_adapter, MTRUE); @@ -13050,6 +13150,8 @@ static void woal_post_reset(moal_handle *handle) #ifdef STA_CFG80211 handle->scan_timeout = SCAN_TIMEOUT_25S; #endif + handle->is_edmac_enabled = MFALSE; + if (priv && (MLAN_STATUS_SUCCESS != woal_request_get_fw_info(priv, MOAL_IOCTL_WAIT, &fw_info))) { @@ -13144,8 +13246,8 @@ static void woal_post_reset(moal_handle *handle) if (handle->params.cntry_txpwr && priv) if (MLAN_STATUS_SUCCESS != - woal_request_country_power_table(priv, - country_code)) { + woal_request_country_power_table(priv, country_code, + MOAL_IOCTL_WAIT)) { PRINTM(MERROR, "Failed to get country power table\n"); } @@ -13677,6 +13779,188 @@ __setup("mfg_mode=", mfg_mode_setup); #endif #endif +/** + * @brief Add 2 variables securely, to prevent overflow. + * + * @param datain Pointer to 1st variable + * @param add 2nd variable value to add to 1st variable + * @param dataout Pointer to variable where sum is to be stored + * @param type Datatype of 1st and 2nd variable + * + * @return MTRUE if success or MFALSE if overflow error + */ +t_bool woal_secure_add(t_void *datain, t_s32 add, t_void *dataout, + data_type type) +{ + t_bool status = MTRUE; + + switch (type) { + case TYPE_SINT8: + if (add > SINT8_MAX || *(t_s8 *)datain > SINT8_MAX - add) + goto fail; + else + *(t_s8 *)dataout = *(t_s8 *)datain + add; + break; + + case TYPE_UINT8: + if (add > UINT8_MAX || *(t_u8 *)datain > UINT8_MAX - add) + goto fail; + else + *(t_u8 *)dataout = *(t_u8 *)datain + add; + break; + + case TYPE_SINT16: + if (add > SINT16_MAX || *(t_s16 *)datain > SINT16_MAX - add) + goto fail; + else + *(t_s16 *)dataout = *(t_s16 *)datain + add; + break; + + case TYPE_UINT16: + if (add > UINT16_MAX || *(t_u16 *)datain > UINT16_MAX - add) + goto fail; + else + *(t_u16 *)dataout = *(t_u16 *)datain + add; + break; + + case TYPE_SINT32: + if (*(t_s32 *)datain > SINT32_MAX - add) + goto fail; + else + *(t_s32 *)dataout = *(t_s32 *)datain + add; + break; + + case TYPE_UINT32: + if (*(t_u32 *)datain > UINT32_MAX - add) + goto fail; + else + *(t_u32 *)dataout = *(t_u32 *)datain + add; + break; + + case TYPE_SINT64: + if (*(t_s64 *)datain > SINT64_MAX - add) + goto fail; + else + *(t_s64 *)dataout = *(t_s64 *)datain + add; + break; + + case TYPE_UINT64: + if (*(t_u64 *)datain > UINT64_MAX - add) + goto fail; + else + *(t_u64 *)dataout = *(t_u64 *)datain + add; + break; + + case TYPE_PTR: + if (*(t_ptr *)datain > PTR_MAX - add) + goto fail; + else + *(t_ptr *)dataout = *(t_ptr *)datain + add; + break; + + default: + status = MFALSE; + break; + } +ret: + return status; + +fail: + status = MFALSE; + goto ret; +} + +/** + * @brief Subtract 2 variables securely, to prevent underflow. + * + * @param datain Pointer to 1st variable + * @param add 2nd variable value to subtract from 1st variable + * @param dataout Pointer to variable where diff is to be stored + * @param type Datatype of 1st and 2nd variable + * + * @return MTRUE if success or MFALSE if underflow error + */ +t_bool woal_secure_sub(t_void *datain, t_s32 sub, t_void *dataout, + data_type type) +{ + t_u8 status = MTRUE; + + switch (type) { + case TYPE_SINT8: + if (*(t_s8 *)datain >= (t_s8)SINT8_MIN + sub) + *(t_s8 *)dataout = *(t_s8 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT8: + if (*(t_u8 *)datain >= sub) + *(t_u8 *)dataout = *(t_u8 *)datain - sub; + else + goto fail; + break; + + case TYPE_SINT16: + if (*(t_s16 *)datain >= (t_s16)SINT16_MIN + sub) + *(t_s16 *)dataout = *(t_s16 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT16: + if (*(t_u16 *)datain >= sub) + *(t_u16 *)dataout = *(t_u16 *)datain - sub; + else + goto fail; + break; + + case TYPE_SINT32: + if (*(t_s32 *)datain >= (t_s32)SINT32_MIN + sub) + *(t_s32 *)dataout = *(t_s32 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT32: + if (*(t_u32 *)datain >= sub) + *(t_u32 *)dataout = *(t_u32 *)datain - sub; + else + goto fail; + break; + + case TYPE_SINT64: + if (*(t_s64 *)datain >= (t_s64)SINT64_MIN + sub) + *(t_s64 *)dataout = *(t_s64 *)datain - sub; + else + goto fail; + break; + + case TYPE_UINT64: + if (*(t_u64 *)datain >= sub) + *(t_u64 *)dataout = *(t_u64 *)datain - sub; + else + goto fail; + break; + + case TYPE_PTR: + if (*(t_ptr *)datain >= sub) + *(t_ptr *)dataout = *(t_ptr *)datain - sub; + else + goto fail; + break; + + default: + status = MFALSE; + break; + } +ret: + return status; + +fail: + status = MFALSE; + goto ret; +} + module_init(woal_init_module); module_exit(woal_cleanup_module); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.h b/mxm_wifiex/wlan_src/mlinux/moal_main.h index 6d2d451..b4b9645 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.h @@ -118,6 +118,10 @@ Change log: #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 6, 0) +#include +#endif + #include "mlan.h" #include "moal_shim.h" /* Wireless header */ @@ -282,12 +286,16 @@ typedef t_u8 BOOLEAN; #define CARD_TYPE_PCIE_USB 7 /** card type SD9177_UART */ #define CARD_TYPE_SD9177_UART 1 // As per datasheet/SoC design -/** card type SDIW624_UART */ -#define CARD_TYPE_SDIW624_UART 0 // As per datasheet/SoC design -/** card type PCIEIW624_USB */ -#define CARD_TYPE_PCIEIW624_USB 4 // As per datasheet/SoC design -/** card type PCIEIW624_UART */ -#define CARD_TYPE_PCIEIW624_UART 7 // As per datasheet/SoC design +/** card type SDIW624_UARTSPI */ +#define CARD_TYPE_SDIW624_UARTSPI 0 // As per datasheet/SoC design +/** card type SDIW624_UARTUART */ +#define CARD_TYPE_SDIW624_UARTUART 2 // As per datasheet/SoC design +/** card type PCIEIW624_USBUSB */ +#define CARD_TYPE_PCIEIW624_USBUSB 4 // As per datasheet/SoC design +/** card type PCIEIW624_UARTUART */ +#define CARD_TYPE_PCIEIW624_UARTUART 7 // As per datasheet/SoC design +/** card type PCIEIW624_UARTSPI */ +#define CARD_TYPE_PCIEIW624_UARTSPI 5 // As per datasheet/SoC design /* Max buffer size */ #define MAX_BUF_LEN 512 @@ -858,6 +866,7 @@ typedef enum { CONTROL_FRAME_MATCHED, // 8. Control frame matched MANAGEMENT_FRAME_MATCHED, // 9. Management frame matched GTK_REKEY_FAILURE, // 10. GTK rekey failure + MGMT_FRAME_FILTER_EXT_MATCHED, // 11. Management frame filter matched RESERVED // Others: reserved } HSWakeupReason_t; @@ -888,6 +897,11 @@ mlan_status woal_do_dfs_cac(moal_private *priv, /** Custom indiciation message sent to the application layer for WMM changes */ #define WMM_CONFIG_CHANGE_INDICATION "WMM_CONFIG_CHANGE.indication" +/** Custom event : IBSS STA connect attempt */ +#define CUS_EVT_IBSS_CONNECT_ATTEMPT "EVENT=IBSS_CONNECT_ATTEMPT_" +/** Custom event : IBSS STA dis-connect attempt */ +#define CUS_EVT_IBSS_DISCONNECT_ATTEMPT "EVENT=IBSS_DISCONNECT_ATTEMPT_" + #define CUS_EVT_FW_DUMP_DONE "EVENT=FW_DUMP_DONE" #ifdef UAP_SUPPORT @@ -1046,6 +1060,12 @@ typedef struct _wait_queue { #define DEF_VIRTUAL_BSS 0 #endif #endif /* WIFI_DIRECT_SUPPORT */ +/** Driver mode NAN bit */ +#define DRV_MODE_NAN MBIT(4) +/** Maximum NAN BSS */ +#define MAX_NAN_BSS 1 +/** Default NAN BSS */ +#define DEF_NAN_BSS 1 /**Driver mode 0DFS bit**/ #define DRV_MODE_DFS MBIT(7) @@ -1174,6 +1194,7 @@ enum woal_event_type { WOAL_EVENT_CANCEL_CHANRPT, #endif #endif + WOAL_EVENT_RGPWR_KEY_MISMATCH, }; /** chan_rpt_info */ @@ -2416,6 +2437,8 @@ typedef struct _moal_mod_para { int max_vir_bss; #endif #endif /* WIFI_DIRECT_SUPPORT */ + char *nan_name; + int max_nan_bss; int auto_ds; int net_rx; int amsdu_deaggr; @@ -2480,10 +2503,13 @@ typedef struct _moal_mod_para { int rps; #endif #endif + int edmac_ctrl; int keep_previous_scan; int auto_11ax; /** hs_auto_arp setting */ int hs_auto_arp; + /** Dual-BT **/ + int dual_nb; } moal_mod_para; void woal_tp_acnt_timer_func(void *context); @@ -2618,6 +2644,10 @@ struct _moal_handle { t_u16 fw_bands; /** ECSA support */ t_u8 fw_ecsa_enable; + /* Firmware support cmd_tx_data */ + t_u8 cmd_tx_data; + /** FW support security key for rgpower table */ + t_u8 sec_rgpower; /** FW ROAMING support */ t_u8 fw_roam_enable; /** FW ROAMING capability in fw */ @@ -2736,6 +2766,8 @@ struct _moal_handle { struct workqueue_struct *pcie_cmd_resp_workqueue; /** pcie rx cmd resp work */ struct work_struct pcie_cmd_resp_work; + /** pcie delayed work */ + struct delayed_work pcie_delayed_tx_work; #ifdef TASKLET_SUPPORT /* pcie rx data tasklet */ struct tasklet_struct pcie_rx_task; @@ -3023,6 +3055,7 @@ struct _moal_handle { #endif #endif t_u32 ips_ctrl; + BOOLEAN is_edmac_enabled; }; /** @@ -3630,6 +3663,7 @@ void woal_init_from_dev_tree(void); mlan_status woal_init_sw(moal_handle *handle); /** update the default firmware name */ void woal_update_firmware_name(moal_handle *handle); +mlan_status woal_set_rgpower_table(moal_handle *handle); /** cancel all works in the queue */ void woal_terminate_workqueue(moal_handle *handle); void woal_flush_workqueue(moal_handle *handle); @@ -4051,6 +4085,7 @@ t_void woal_mclist_work_queue(struct work_struct *work); #ifdef PCIE t_void woal_pcie_rx_event_work_queue(struct work_struct *work); t_void woal_pcie_cmd_resp_work_queue(struct work_struct *work); +t_void woal_pcie_delayed_tx_work(struct work_struct *work); #ifndef TASKLET_SUPPORT t_void woal_pcie_rx_work_queue(struct work_struct *work); t_void woal_pcie_tx_complete_work_queue(struct work_struct *work); @@ -4156,7 +4191,8 @@ t_void woal_add_mcast_node(moal_private *priv, t_u8 *mcast_addr); void woal_remove_mcast_node(moal_private *priv, t_u8 *mcast_addr); t_u8 woal_find_mcast_node_tx(moal_private *priv, struct sk_buff *skb); -mlan_status woal_request_country_power_table(moal_private *priv, char *region); +mlan_status woal_request_country_power_table(moal_private *priv, char *region, + t_u8 wait_option); mlan_status woal_mc_policy_cfg(moal_private *priv, t_u16 *enable, t_u8 wait_option, t_u8 action); #ifdef UAP_SUPPORT @@ -4263,4 +4299,12 @@ void woal_disable_oob_wakeup_irq(moal_handle *handle); void woal_enable_oob_wakeup_irq(moal_handle *handle); irqreturn_t woal_oob_wakeup_irq_handler(int irq, void *priv); #endif /* IMX_SUPPORT */ + +t_bool woal_secure_add(t_void *datain, t_s32 add, t_void *dataout, + data_type type); +t_bool woal_secure_sub(t_void *datain, t_s32 sub, t_void *dataout, + data_type type); + +mlan_status woal_edmac_cfg(moal_private *priv, t_u8 *country_code); + #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 0d35177..9f8b037 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_pcie.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_pcie.c @@ -116,22 +116,6 @@ static const struct pci_device_id wlan_ids[] = { 0, }, #endif - { - 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, - }, #ifdef PCIEIW624 { PCIE_VENDOR_ID_NXP, @@ -159,8 +143,11 @@ 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) static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, t_u8 resetflag); +#endif /** @brief This function updates the card types * @@ -228,18 +215,6 @@ static t_u16 woal_update_card_type(t_void *card) strlen(KERN_VERSION)); } #endif - 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), - V17, strlen(V17), - strlen(driver_version) - strlen(INTF_CARDTYPE) - - strlen(KERN_VERSION)); - } #ifdef PCIEIW624 if (cardp_pcie->dev->device == PCIE_DEVICE_ID_88WIW624) { card_type = CARD_TYPE_PCIEIW624; @@ -387,10 +362,12 @@ perform_init: goto err_init_fw; } +#if defined(PCIE9098) 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); else +#endif /* Update pcie_int_mode in mlan adapter */ mlan_set_int_mode(handle->pmlan_adapter, handle->params.pcie_int_mode, 0); @@ -600,12 +577,14 @@ 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 (IS_PCIE9098(handle->card_type) || IS_PCIEIW624(handle->card_type) || IS_PCIEAW693(handle->card_type) || IS_PCIE9097(handle->card_type)) { if (RDWR_STATUS_FAILURE != woal_pcie_rdwr_firmware(handle, 0, 1)) PRINTM(MMSG, "wlan: start in-bound IR...\n"); } +#endif done: handle->surprise_removed = MTRUE; pci_disable_device(dev); @@ -1441,10 +1420,12 @@ static mlan_status woal_pcie_register_dev(moal_handle *handle) break; } +#if defined(PCIE9098) 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); else +#endif mlan_set_int_mode(handle->pmlan_adapter, pcie_int_mode, 0); done: @@ -1567,20 +1548,24 @@ void woal_pcie_bus_unregister(void) LEAVE(); } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) #define PCIE9098_DUMP_CTRL_REG 0x1C94 #define PCIE9098_DUMP_START_REG 0x1C98 #define PCIE9098_DUMP_END_REG 0x1C9F +#endif #if defined(PCIE8897) || defined(PCIE8997) #define DEBUG_DUMP_CTRL_REG 0xCF4 #define DEBUG_DUMP_START_REG 0xCF8 #define DEBUG_DUMP_END_REG 0xCFF #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) #define PCIE9098_SCRATCH_12_REG 0x1C90 #define PCIE9098_SCRATCH_14_REG 0x1C98 #define PCIE9098_SCRATCH_15_REG 0x1C9C #define PCIE9098_DUMP_REG_START 0x1C20 #define PCIE9098_DUMP_REG_END 0x1C9C +#endif #if defined(PCIE8997) || defined(PCIE8897) #define PCIE_SCRATCH_12_REG 0x0CF0; @@ -1610,9 +1595,11 @@ 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) /* Tx/Rx/Event AMDA start address */ t_u32 adma_reg_table[] = {0x10000, 0x10800, 0x10880, 0x11000, 0x11080}; t_u8 j; +#endif ENTER(); mlan_pm_wakeup_card(phandle->pmlan_adapter, MTRUE); drv_ptr += sprintf(drv_ptr, @@ -1636,6 +1623,7 @@ static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1646,6 +1634,7 @@ static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) scratch_14_reg = PCIE9098_SCRATCH_14_REG; scratch_15_reg = PCIE9098_SCRATCH_15_REG; } +#endif woal_pcie_read_reg(phandle, reg, &value); drv_ptr += sprintf(drv_ptr, "reg:0x%x value=0x%x\n", reg, value); @@ -1679,6 +1668,7 @@ static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) } i++; } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1730,6 +1720,7 @@ static int woal_pcie_dump_reg_info(moal_handle *phandle, t_u8 *buffer) drv_ptr += sprintf(drv_ptr, "%s\n", buf); } } +#endif drv_ptr += sprintf(drv_ptr, "-----------PCIe Registers dump End-----------\n"); mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); @@ -1756,9 +1747,11 @@ 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) /* Tx/Rx/Event AMDA start address */ t_u32 adma_reg_table[] = {0x10000, 0x10800, 0x10880, 0x11000, 0x11080}; t_u8 j; +#endif mlan_pm_wakeup_card(phandle->pmlan_adapter, MTRUE); PRINTM(MMSG, "Config Space Registers:\n"); for (i = 0; i < ARRAY_SIZE(config_reg_table); i++) { @@ -1778,6 +1771,7 @@ static void woal_pcie_reg_dbg(moal_handle *phandle) } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1788,6 +1782,7 @@ static void woal_pcie_reg_dbg(moal_handle *phandle) scratch_14_reg = PCIE9098_SCRATCH_14_REG; scratch_15_reg = PCIE9098_SCRATCH_15_REG; } +#endif woal_pcie_read_reg(phandle, reg, &value); PRINTM(MERROR, "reg:0x%x value=0x%x\n", reg, value); for (i = 0; i < 2; i++) { @@ -1816,6 +1811,7 @@ static void woal_pcie_reg_dbg(moal_handle *phandle) } i++; } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1862,6 +1858,7 @@ static void woal_pcie_reg_dbg(moal_handle *phandle) PRINTM(MMSG, "%s\n", buf); } } +#endif mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); } @@ -1904,12 +1901,18 @@ static memory_type_mapping mem_type_mapping_tbl_8897[] = { }; #endif +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIEIW624) #define DEBUG_HOST_READY_8997 0xCC #define DEBUG_HOST_EVENT_READY 0xAA #define DEBUG_HOST_RESET_READY 0x99 static memory_type_mapping mem_type_mapping_tbl_8997 = {"DUMP", NULL, NULL, 0xDD, 0x00}; +#endif + +#if defined(PCIE8897) || defined(PCIE8997) || defined(PCIE9098) || \ + defined(PCIE9097) || defined(PCIEIW624) /** * @brief This function reads data by 8 bit from card register * @@ -1959,6 +1962,7 @@ static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, } #endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) if (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1971,6 +1975,7 @@ static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, debug_host_ready = DEBUG_HOST_RESET_READY; dump_ctrl_reg = PCIE9098_DUMP_CTRL_REG; } +#endif ret = woal_pcie_write_reg(phandle, dump_ctrl_reg, debug_host_ready); if (ret) { @@ -1978,6 +1983,7 @@ 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 (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -1985,6 +1991,7 @@ static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, if (phandle->event_fw_dump || resetflag) return RDWR_STATUS_SUCCESS; } +#endif ret = woal_pcie_read_reg(phandle, dump_ctrl_reg, ®_data); if (ret) { PRINTM(MERROR, "PCIE Read DEBUG_DUMP_CTRL_REG 0x%x fail\n", @@ -2027,6 +2034,7 @@ static rdwr_status woal_pcie_rdwr_firmware(moal_handle *phandle, t_u8 doneflag, } return RDWR_STATUS_SUCCESS; } +#endif #ifdef PCIE8897 /** @@ -2227,6 +2235,8 @@ done: } #endif +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIEIW624) /** * @brief This function dump firmware memory to file * @@ -2258,6 +2268,7 @@ 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 (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -2271,6 +2282,7 @@ static void woal_pcie_dump_fw_info_v2(moal_handle *phandle) } } } +#endif #ifndef DUMP_TO_PROC #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) /** Create dump directory*/ @@ -2294,6 +2306,7 @@ 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 (IS_PCIE9098(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || @@ -2301,6 +2314,7 @@ static void woal_pcie_dump_fw_info_v2(moal_handle *phandle) dump_start_reg = PCIE9098_DUMP_START_REG; dump_end_reg = PCIE9098_DUMP_END_REG; } +#endif #ifdef PCIE8997 if (IS_PCIE8997(phandle->card_type)) { dump_start_reg = DEBUG_DUMP_START_REG; @@ -2429,6 +2443,7 @@ done: return; } +#endif /** * @brief This function check if this is second mac @@ -2439,10 +2454,12 @@ done: */ static t_u8 woal_pcie_is_second_mac(moal_handle *handle) { +#if defined(PCIE9098) 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)) return MTRUE; +#endif return MFALSE; } @@ -2460,6 +2477,8 @@ static void woal_pcie_dump_fw_info(moal_handle *phandle) if (IS_PCIE8897(phandle->card_type)) woal_pcie_dump_fw_info_v1(phandle); #endif +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIEIW624) if (IS_PCIE8997(phandle->card_type) || IS_PCIEAW693(phandle->card_type) || IS_PCIEIW624(phandle->card_type) || @@ -2474,6 +2493,7 @@ static void woal_pcie_dump_fw_info(moal_handle *phandle) return; } } +#endif phandle->fw_dump = MFALSE; if (!phandle->priv_num) return; @@ -2487,16 +2507,24 @@ 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) pcie_service_card *card = (pcie_service_card *)handle->card; moal_handle *ref_handle = NULL; +#endif +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + 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) t_u32 host_strap_reg = handle->card_info->host_strap_reg; t_u32 magic_reg = handle->card_info->magic_reg; t_u32 strap = 0; t_u32 magic = 0; +#endif #ifdef PCIEIW624 t_u32 boot_mode_reg = handle->card_info->boot_mode_reg; t_u32 boot_mode; @@ -2653,35 +2681,6 @@ static mlan_status woal_pcie_get_fw_name(moal_handle *handle) } } #endif - 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); - } - } - } #ifdef PCIEIW624 if (IS_PCIEIW624(handle->card_type)) { woal_pcie_read_reg(handle, rev_id_reg, &revision_id); @@ -2697,12 +2696,28 @@ static mlan_status woal_pcie_get_fw_name(moal_handle *handle) magic, boot_mode, strap, revision_id); if (boot_mode == 0x03) PRINTM(MMSG, "wlan: PCIE-IW624 in secure-boot mode\n"); - if (strap == CARD_TYPE_PCIEIW624_UART) - strcpy(handle->card_info->fw_name, - PCIEUARTIW624_DEFAULT_COMBO_FW_NAME); - else - strcpy(handle->card_info->fw_name, - PCIEUSBIW624_DEFAULT_COMBO_FW_NAME); + if (strap == CARD_TYPE_PCIEIW624_UARTUART) { + if (handle->params.dual_nb) + strcpy(handle->card_info->fw_name, + PCIEUARTUARTIW624_DEFAULT_COMBO_FW_NAME); + else + strcpy(handle->card_info->fw_name, + PCIEUARTIW624_DEFAULT_COMBO_FW_NAME); + } else if (strap == CARD_TYPE_PCIEIW624_UARTSPI) { + if (handle->params.dual_nb) + strcpy(handle->card_info->fw_name, + PCIEUARTSPIIW624_DEFAULT_COMBO_FW_NAME); + else + strcpy(handle->card_info->fw_name, + PCIEUARTIW624_DEFAULT_COMBO_FW_NAME); + } else { + if (handle->params.dual_nb) + strcpy(handle->card_info->fw_name, + PCIEUSBUSBIW624_DEFAULT_COMBO_FW_NAME); + else + strcpy(handle->card_info->fw_name, + PCIEUSBIW624_DEFAULT_COMBO_FW_NAME); + } } #endif done: diff --git a/mxm_wifiex/wlan_src/mlinux/moal_pcie.h b/mxm_wifiex/wlan_src/mlinux/moal_pcie.h index 3037d71..24f2116 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_pcie.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_pcie.h @@ -47,20 +47,24 @@ Change log: #define PCIE_DEVICE_ID_88W9097 (0x2b56) #endif +#if defined(PCIE9098) /** PCIE device ID for 9098 card FN0 */ #define PCIE_DEVICE_ID_88W9098P_FN0 (0x2b43) /** PCIE device ID for 9098 card FN1 */ #define PCIE_DEVICE_ID_88W9098P_FN1 (0x2b44) +#endif #ifdef PCIEIW624 /** PCIE device ID for IW624 card FN0 */ #define PCIE_DEVICE_ID_88WIW624 (0x3000) #endif +#if defined(PCIE9098) /** PCIE device ID for AW693 card FN0 */ #define PCIE_DEVICE_ID_88WAW693_FN0 (0x3003) /** PCIE device ID for AW693 card FN1 */ #define PCIE_DEVICE_ID_88WAW693_FN1 (0x3004) +#endif #include #include @@ -87,10 +91,6 @@ Change log: #define PCIE8897_DEFAULT_WLAN_FW_NAME "nxp/pcie8897_wlan.bin" #endif /* PCIE8897*/ -#define PCIEUARTAW693_DEFAULT_COMBO_FW_NAME "nxp/pcieuartAW693_combo.bin" -#define PCIEAW693_DEFAULT_COMBO_FW_NAME "nxp/pcieAW693_wlan.bin" -#define PCIEAW693_DEFAULT_WLAN_FW_NAME "nxp/pcieAW693_wlan.bin" - #ifdef PCIE9098 #define PCIE9098_Z1Z2 0x00 #define PCIE9098_A0 0x01 @@ -124,10 +124,18 @@ Change log: #define PCIEIW624_DEFAULT_COMBO_FW_NAME "nxp/pcieusbiw624_combo.bin" #define PCIEUARTIW624_DEFAULT_COMBO_FW_NAME "nxp/pcieuartiw624_combo.bin" #define PCIEUSBIW624_DEFAULT_COMBO_FW_NAME "nxp/pcieusbiw624_combo.bin" +#define PCIEUARTUARTIW624_DEFAULT_COMBO_FW_NAME \ + "nxp/pcieuartuartiw624_combo.bin" +#define PCIEUARTSPIIW624_DEFAULT_COMBO_FW_NAME "nxp/pcieuartspiiw624_combo.bin" +#define PCIEUSBUSBIW624_DEFAULT_COMBO_FW_NAME "nxp/pcieusbusbiw624_combo.bin" #define PCIEIW624_DEFAULT_WLAN_FW_NAME "nxp/pcieiw624_wlan.bin" #endif /* PCIEIW624 */ +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) #define PCIE_NUM_MSIX_VECTORS 32 +#else +#define PCIE_NUM_MSIX_VECTORS 4 +#endif typedef struct _msix_context { /** pci_dev structure pointer */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_priv.c b/mxm_wifiex/wlan_src/mlinux/moal_priv.c index ce182ab..3fe16b9 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_priv.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_priv.c @@ -6421,9 +6421,14 @@ static int woal_set_get_tx_rx_ant(moal_private *priv, struct iwreq *wrq) radio->param.ant_cfg.rx_antenna = data[1]; } else { radio->param.ant_cfg_1x1.antenna = data[0]; - if (wrq->u.data.length == 2) + if (wrq->u.data.length == 2) { + if (data[1] > 0xffff) { + ret = -EINVAL; + goto done; + } radio->param.ant_cfg_1x1.evaluate_time = data[1]; + } } req->action = MLAN_ACT_SET; } else diff --git a/mxm_wifiex/wlan_src/mlinux/moal_proc.c b/mxm_wifiex/wlan_src/mlinux/moal_proc.c index 73058c4..d8bf019 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_proc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_proc.c @@ -566,15 +566,22 @@ mlan_status woal_priv_set_tx_rx_ant(moal_handle *handle, char *line) #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (IS_CARD9098(priv->phandle->card_type) || IS_CARD9097(priv->phandle->card_type) || - IS_CARDIW624(priv->phandle->card_type)) { + IS_CARDIW624(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { woal_cfg80211_notify_antcfg(priv, priv->phandle->wiphy, radio); } #endif } else radio->param.ant_cfg_1x1.antenna = data[0]; - if (user_data_len == 2) + if (user_data_len == 2) { + if (data[1] > 0xffff) { + kfree(req); + LEAVE(); + return MLAN_STATUS_FAILURE; + } radio->param.ant_cfg_1x1.evaluate_time = data[1]; + } /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); if (status != MLAN_STATUS_PENDING) @@ -669,7 +676,7 @@ static ssize_t woal_config_write(struct file *f, const char __user *buf, if (ref_handle) { priv = woal_get_priv(ref_handle, MLAN_BSS_ROLE_ANY); if (priv) { - handle->fw_dump_status = MTRUE; + ref_handle->fw_dump_status = MTRUE; woal_mlan_debug_info(priv); woal_moal_debug_info(priv, NULL, MFALSE); } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sdio.h b/mxm_wifiex/wlan_src/mlinux/moal_sdio.h index ed83b79..9e0ae7e 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sdio.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_sdio.h @@ -142,15 +142,12 @@ Change log: #ifdef SDIW624 #define SDIW624_DEFAULT_COMBO_FW_NAME "nxp/sdsdiw624_combo.bin" #define SDUARTIW624_COMBO_FW_NAME "nxp/sduartiw624_combo.bin" +#define SDUARTSPIIW624_COMBO_FW_NAME "nxp/sduartspiiw624_combo.bin" +#define SDUARTUARTIW624_COMBO_FW_NAME "nxp/sduartuartiw624_combo.bin" #define SDSDIW624_COMBO_FW_NAME "sdsdiw624_combo.bin" #define SDIW624_DEFAULT_WLAN_FW_NAME "nxp/sdiw624_wlan.bin" #endif /* SDIW624 */ -#define SDAW693_DEFAULT_COMBO_FW_NAME "nxp/sdsd_aw693.bin" -#define SDUARTAW693_COMBO_FW_NAME "nxp/sduart_aw693.bin" -#define SDSDAW693_COMBO_FW_NAME "sdsd_aw693.bin" -#define SDAW693_DEFAULT_WLAN_FW_NAME "nxp/sd_aw693.bin" - #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 3d95ab7..20c868d 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c @@ -71,10 +71,6 @@ static moal_if_ops sdiommc_ops; /** Device ID for SD8987 */ #define SD_DEVICE_ID_8987 (0x9149) #endif -/** Device ID for SDAW693 */ -#define SD_DEVICE_ID_AW693_FN1 (0x0211) -/** Device ID for SDAW693 */ -#define SD_DEVICE_ID_AW693_FN2 (0x0212) #ifdef SD9098 /** Device ID for SD9098 */ #define SD_DEVICE_ID_9098_FN1 (0x914D) @@ -117,8 +113,6 @@ static const struct sdio_device_id wlan_ids[] = { #ifdef SD8987 {SDIO_DEVICE(MRVL_VENDOR_ID, SD_DEVICE_ID_8987)}, #endif - {SDIO_DEVICE(NXP_VENDOR_ID, SD_DEVICE_ID_AW693_FN1)}, - {SDIO_DEVICE(NXP_VENDOR_ID, SD_DEVICE_ID_AW693_FN2)}, #ifdef SD9098 {SDIO_DEVICE(MRVL_VENDOR_ID, SD_DEVICE_ID_9098_FN1)}, {SDIO_DEVICE(MRVL_VENDOR_ID, SD_DEVICE_ID_9098_FN2)}, @@ -419,19 +413,6 @@ static t_u16 woal_update_card_type(t_void *card) (strlen(INTF_CARDTYPE) + strlen(KERN_VERSION))); } #endif - 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))); - } #ifdef SD9097 if (cardp_sd->func->device == SD_DEVICE_ID_9097) { card_type = CARD_TYPE_SD9097; @@ -1377,10 +1358,10 @@ 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) struct sdio_mmc_card *card = (struct sdio_mmc_card *)handle->card; +#endif - if (card->func->device == SD_DEVICE_ID_AW693_FN2) - return MTRUE; #ifdef SD9098 if (card->func->device == SD_DEVICE_ID_9098_FN2) return MTRUE; @@ -1397,10 +1378,14 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) t_u32 revision_id = 0; 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) t_u32 magic_reg = handle->card_info->magic_reg; t_u32 magic = 0; t_u32 host_strap_reg = handle->card_info->host_strap_reg; t_u32 strap = 0; +#endif ENTER(); @@ -1414,6 +1399,9 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) woal_sdiommc_read_reg(handle, rev_id_reg, &revision_id); PRINTM(MCMND, "revision_id=0x%x\n", revision_id); +#if defined(SD8987) || defined(SD8997) || defined(SD9098) || \ + defined(SD9097) || defined(SDIW624) || defined(SD8978) || \ + defined(SD9177) /** Revision ID register */ woal_sdiommc_read_reg(handle, magic_reg, &magic); /** Revision ID register */ @@ -1422,6 +1410,7 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) magic &= 0xFF; /* 1 = SDSD, 0 --SD UART */ PRINTM(MCMND, "magic=0x%x strap=0x%x\n", magic, strap); +#endif #if defined(SD8977) if (IS_SD8977(handle->card_type)) { switch (revision_id) { @@ -1577,30 +1566,34 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) } } #endif - 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); - } - } #ifdef SDIW624 if (IS_SDIW624(handle->card_type)) { magic &= 0x03; if (magic == 0x03) PRINTM(MMSG, "wlan: SDIW624 in secure-boot mode\n"); - if (strap == CARD_TYPE_SDIW624_UART) - strncpy(handle->card_info->fw_name, - SDUARTIW624_COMBO_FW_NAME, FW_NAMW_MAX_LEN); - else + if (strap == CARD_TYPE_SDIW624_UARTSPI) { + if (handle->params.dual_nb) + strncpy(handle->card_info->fw_name, + SDUARTSPIIW624_COMBO_FW_NAME, + FW_NAMW_MAX_LEN); + else + strncpy(handle->card_info->fw_name, + SDUARTIW624_COMBO_FW_NAME, + FW_NAMW_MAX_LEN); + } else if (strap == CARD_TYPE_SDIW624_UARTUART) { + if (handle->params.dual_nb) + strncpy(handle->card_info->fw_name, + SDUARTUARTIW624_COMBO_FW_NAME, + FW_NAMW_MAX_LEN); + else + strncpy(handle->card_info->fw_name, + SDUARTIW624_COMBO_FW_NAME, + FW_NAMW_MAX_LEN); + } else { strncpy(handle->card_info->fw_name, SDSDIW624_COMBO_FW_NAME, FW_NAMW_MAX_LEN); + } } #endif @@ -2129,8 +2122,11 @@ void woal_dump_firmware_info_v2(moal_handle *phandle) PRINTM(MMSG, "==== DEBUG MODE OUTPUT START: %u.%06u ====\n", sec, usec); /* read the number of the memories which will dump */ if (RDWR_STATUS_FAILURE == - woal_cmd52_rdwr_firmware(phandle, doneflag, MTRUE)) - goto done; + woal_cmd52_rdwr_firmware(phandle, doneflag, MFALSE)) { + if (RDWR_STATUS_FAILURE == + woal_cmd52_rdwr_firmware(phandle, doneflag, MTRUE)) + goto done; + } reg = dbg_dump_start_reg; ret = woal_sdio_readb(phandle, reg, &dump_num); if (ret) { @@ -2307,6 +2303,13 @@ void woal_dump_firmware_info_v3(moal_handle *phandle) #ifdef SD9177 if (IS_SD9177(phandle->card_type)) { if (phandle->event_fw_dump) { + if (RDWR_STATUS_FAILURE != + woal_cmd52_rdwr_firmware(phandle, doneflag, + MFALSE)) { + PRINTM(MMSG, + "====SDIO FW DUMP EVENT MODE START ====\n"); + return; + } if (RDWR_STATUS_FAILURE != woal_cmd52_rdwr_firmware(phandle, doneflag, MTRUE)) { @@ -2341,8 +2344,11 @@ void woal_dump_firmware_info_v3(moal_handle *phandle) PRINTM(MMSG, "==== DEBUG MODE OUTPUT START: %u.%06u ====\n", sec, usec); /* read the number of the memories which will dump */ if (RDWR_STATUS_FAILURE == - woal_cmd52_rdwr_firmware(phandle, doneflag, MTRUE)) - goto done; + woal_cmd52_rdwr_firmware(phandle, doneflag, MFALSE)) { + if (RDWR_STATUS_FAILURE == + woal_cmd52_rdwr_firmware(phandle, doneflag, MTRUE)) + goto done; + } /** check the reg which indicate dump starting */ for (reg = dbg_dump_start_reg; reg <= dbg_dump_end_reg; reg++) { @@ -2526,7 +2532,7 @@ static void woal_sdiommc_reg_dbg(moal_handle *phandle) mdelay(100); func = 1; reg_start = scratch_reg; - reg_end = scratch_reg + 10; + reg_end = scratch_reg + 23; } if (loop != 2) ptr += snprintf(ptr, sizeof(buf), @@ -2602,6 +2608,7 @@ static void woal_sdiommc_dump_fw_info(moal_handle *phandle) } #endif phandle->fw_dump = MFALSE; + woal_sdiommc_reg_dbg(phandle); if (!phandle->priv_num) return; woal_send_fw_dump_complete_event( @@ -2711,7 +2718,7 @@ static int woal_sdiommc_dump_reg_info(moal_handle *phandle, t_u8 *drv_buf) mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); LEAVE(); - return drv_ptr - (char *)drv_buf; + return (int)(drv_ptr - (char *)drv_buf); } /** diff --git a/mxm_wifiex/wlan_src/mlinux/moal_shim.c b/mxm_wifiex/wlan_src/mlinux/moal_shim.c index 961affe..4e0546c 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-2022 NXP + * Copyright 2008-2023 NXP * * This software file (the File) is distributed by NXP * under the terms of the GNU General Public License Version 2, June 1991 @@ -924,6 +924,8 @@ mlan_status moal_get_hw_spec_complete(t_void *pmoal, mlan_status status, MLAN_MAX_VER_STR_LEN - 1); } #endif + if (phw->fw_cap & FW_CAPINFO_DISABLE_NAN) + handle->params.drv_mode &= ~DRV_MODE_NAN; /** FW should only enable DFS on one mac */ if (!(phw->fw_cap & FW_CAPINFO_ZERO_DFS)) handle->params.drv_mode &= ~DRV_MODE_DFS; @@ -2561,6 +2563,31 @@ static void woal_rx_mgmt_pkt_event(moal_private *priv, t_u8 *pkt, t_u16 len) #endif #endif +/** + * @brief This function handles rgpower key mismatch event + * + * @param priv pointer to the moal_private structure. + * + * @return N/A + */ +void woal_rgpower_key_mismatch_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) { + evt->priv = priv; + evt->type = WOAL_EVENT_RGPWR_KEY_MISMATCH; + 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); + } +} + /** * @brief This function handles defer event receive * @@ -2603,6 +2630,10 @@ static mlan_status wlan_process_defer_event(moal_handle *handle, &handle->pcie_tx_complete_work); #endif break; + case MLAN_EVENT_ID_DRV_DELAY_TX_COMPLETE: + status = MLAN_STATUS_SUCCESS; + schedule_delayed_work(&handle->pcie_delayed_tx_work, 1); + break; #endif /* PCIE */ case MLAN_EVENT_ID_DRV_FLUSH_RX_WORK: @@ -2681,6 +2712,13 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #if defined(STA_SUPPORT) || defined(UAP_SUPPORT) moal_private *pmpriv = NULL; #endif + +#if defined(STA_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + struct station_info *sinfo = NULL; +#endif +#endif + char concat_str[64], peer_mac_str[20]; #if defined(STA_WEXT) || defined(UAP_WEXT) #if defined(STA_SUPPORT) || defined(UAP_WEXT) #if defined(UAP_SUPPORT) || defined(STA_WEXT) @@ -3724,12 +3762,6 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) break; PRINTM(MMSG, "OLD BW = %d NEW BW = %d", priv->bandwidth, pchan_info->bandcfg.chanWidth); - -#ifdef UAP_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - woal_update_uap_channel_dfs_state(priv); -#endif -#endif priv->channel = pchan_info->channel; priv->bandwidth = pchan_info->bandcfg.chanWidth; @@ -4089,10 +4121,18 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) PRINTM(MCMND, "deauth reason code =0x%x\n", reason_code); /** BIT 14 indicate deauth is initiated by FW */ - if (reason_code & MBIT(14)) - woal_host_mlme_disconnect( - priv, 0, - pmevent->event_buf + 2); + if (reason_code & MBIT(14)) { + if (reason_code & MBIT(1)) { + reason_code = + MLAN_REASON_DISASSOC_DUE_TO_INACTIVITY; + woal_host_mlme_disconnect( + priv, reason_code, + pmevent->event_buf + 2); + } else + woal_host_mlme_disconnect( + priv, 0, + pmevent->event_buf + 2); + } } else #endif if (priv->netdev && priv->wdev) @@ -4137,7 +4177,7 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) { #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) - if (priv->netdev && + if (priv->netdev && priv->netdev->ieee80211_ptr && priv->netdev->ieee80211_ptr->wiphy->mgmt_stypes && priv->mgmt_subtype_mask) { /* frmctl + durationid + addr1 + addr2 + addr3 + @@ -4375,6 +4415,82 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) woal_broadcast_event(priv, pmevent->event_buf, pmevent->event_len); break; + case MLAN_EVENT_ID_FW_IBSS_CONNECT: + PRINTM(MINFO, "STA Connect attempt\n"); + DBG_HEXDUMP(MCMD_D, "IBSS Connect", pmevent->event_buf, + pmevent->event_len); + memset(concat_str, 0, sizeof(concat_str)); + snprintf(peer_mac_str, sizeof(peer_mac_str), + "%02x%02x%02x%02x%02x%02x", *(pmevent->event_buf + 6), + *(pmevent->event_buf + 7), *(pmevent->event_buf + 8), + *(pmevent->event_buf + 9), *(pmevent->event_buf + 10), + *(pmevent->event_buf + 11)); + + peer_mac_str[ETH_ALEN * 2] = '\0'; + +#if defined(STA_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + if (IS_STA_CFG80211(cfg80211_wext)) { + sinfo = kzalloc(sizeof(struct station_info), + GFP_KERNEL); + + if (sinfo) { + /* Notify user space about new station */ + cfg80211_new_sta(priv->netdev, + pmevent->event_buf + 6, sinfo, + GFP_KERNEL); + kfree(sinfo); + } else { + PRINTM(MERROR, + "IBSS:Failed to allocate memory to new station"); + } + } +#endif +#endif + snprintf(concat_str, sizeof(concat_str), "%s%s", + CUS_EVT_IBSS_CONNECT_ATTEMPT, peer_mac_str); + woal_broadcast_event(priv, concat_str, strlen(concat_str)); +#ifdef STA_WEXT +#ifdef STA_SUPPORT + if (IS_STA_WEXT(cfg80211_wext)) { + woal_send_iwevcustom_event(priv, concat_str); + } +#endif +#endif + break; + case MLAN_EVENT_ID_FW_IBSS_DISCONNECT: + PRINTM(MINFO, "STA Disconnect attempt\n"); + DBG_HEXDUMP(MCMD_D, "IBSS DisConnect", pmevent->event_buf, + pmevent->event_len); + memset(concat_str, 0, sizeof(concat_str)); + snprintf(peer_mac_str, sizeof(peer_mac_str), + "%02x%02x%02x%02x%02x%02x", *(pmevent->event_buf + 6), + *(pmevent->event_buf + 7), *(pmevent->event_buf + 8), + *(pmevent->event_buf + 9), *(pmevent->event_buf + 10), + *(pmevent->event_buf + 11)); + + peer_mac_str[ETH_ALEN * 2] = '\0'; + + snprintf(concat_str, sizeof(concat_str), "%s%s", + CUS_EVT_IBSS_DISCONNECT_ATTEMPT, peer_mac_str); + woal_broadcast_event(priv, concat_str, strlen(concat_str)); +#ifdef STA_WEXT +#ifdef STA_SUPPORT + if (IS_STA_WEXT(cfg80211_wext)) { + woal_send_iwevcustom_event(priv, concat_str); + } +#endif +#endif + +#if defined(STA_CFG80211) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + if (IS_STA_CFG80211(cfg80211_wext)) { + cfg80211_del_sta(priv->netdev, pmevent->event_buf + 6, + GFP_KERNEL); + } +#endif +#endif + break; case MLAN_EVENT_ID_DRV_ASSOC_FAILURE_REPORT: PRINTM(MINFO, "Assoc result\n"); @@ -4719,6 +4835,10 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) custom_len + csi_len); priv->csi_seq++; break; + case MLAN_EVENT_ID_DRV_RGPWR_KEY_MISMATCH: + if (handle->sec_rgpower) + woal_rgpower_key_mismatch_event(priv); + break; default: break; } diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c index 5c569c8..fd08276 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c @@ -462,9 +462,12 @@ static const struct ieee80211_txrx_stypes ieee80211_mgmt_stypes[NUM_NL80211_IFTYPES] = { [NL80211_IFTYPE_STATION] = { .tx = MBIT(IEEE80211_STYPE_ACTION >> 4) | - MBIT(IEEE80211_STYPE_PROBE_RESP >> 4), + MBIT(IEEE80211_STYPE_PROBE_RESP >> 4)| + MBIT(IEEE80211_STYPE_AUTH >> 4)| + MBIT(IEEE80211_STYPE_DEAUTH >> 4), .rx = MBIT(IEEE80211_STYPE_ACTION >> 4) | - MBIT(IEEE80211_STYPE_PROBE_REQ >> 4), + MBIT(IEEE80211_STYPE_PROBE_REQ >> 4)| + MBIT(IEEE80211_STYPE_AUTH >> 4), }, [NL80211_IFTYPE_AP] = { .tx = 0xffff, @@ -1067,6 +1070,8 @@ static int woal_cfg80211_assoc_ies_cfg(moal_private *priv, t_u8 *ie, pcurrent_ptr, &total_ie_len, wait_option)) { PRINTM(MERROR, "Fail to set GEN IE\n"); + DBG_HEXDUMP(MCMD_D, "GEN IE", pcurrent_ptr, + total_ie_len); ret = -EFAULT; goto done; } @@ -1246,7 +1251,7 @@ static mlan_status woal_send_domain_info_cmd_fw(moal_private *priv, priv->phandle->country_code[1]; } cfg_11d->param.domain_info.country_code[2] = ' '; - cfg_11d->param.domain_info.band = band; + cfg_11d->param.domain_info.band = woal_ieee_band_to_radio_type(band); sband = priv->wdev->wiphy->bands[band]; for (i = 0; (i < sband->n_channels) && @@ -2152,6 +2157,43 @@ static int woal_cfg80211_auth_scan(moal_private *priv, return ret; } +/** + * @brief Send set host_mlme request to MLAN + * + * @param priv A pointer to moal_private structure + * + * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING + * -- success, otherwise fail + */ +mlan_status woal_request_set_host_mlme(moal_private *priv) +{ + mlan_ioctl_req *req = NULL; + mlan_ds_bss *bss = NULL; + mlan_status status; + ENTER(); + + /* Allocate an IOCTL request buffer */ + req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); + if (req == NULL) { + status = MLAN_STATUS_FAILURE; + goto done; + } + + /* Fill request buffer */ + bss = (mlan_ds_bss *)req->pbuf; + bss->sub_command = MLAN_OID_BSS_HOST_MLME; + req->req_id = MLAN_IOCTL_BSS; + req->action = MLAN_ACT_SET; + + /* Send IOCTL request to MLAN */ + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); +done: + if (status != MLAN_STATUS_PENDING) + kfree(req); + LEAVE(); + return status; +} + /** * @brief This function is authentication handler when host MLME * enable. @@ -2173,12 +2215,14 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, IEEE80211_MGMT *mgmt = NULL; mlan_status status = MLAN_STATUS_SUCCESS; pmlan_buffer pmbuf = NULL; + mlan_ioctl_req *ioctl_req = NULL; + mlan_ds_misc_cfg *misc = NULL; + t_u8 *pbuf = NULL; t_u32 pkt_type, tx_control; t_u16 packet_len = 0, auth_alg; t_u16 pkt_len; t_u8 addr[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; int ret = 0; - t_u8 trans = 1, status_code = 0; t_u8 *varptr = NULL; moal_handle *handle = priv->phandle; @@ -2295,31 +2339,9 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, woal_mgmt_frame_register(priv, IEEE80211_STYPE_DISASSOC, MTRUE); } -#define HEADER_SIZE 8 - // frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4 -#define MGMT_HEADER_LEN (2 + 2 + 6 + 6 + 6 + 2 + 6) - // 6 = auth_alg + auth_transaction +auth_status -#define AUTH_BODY_LEN 6 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) - packet_len = (t_u16)req->ie_len + req->auth_data_len + MGMT_HEADER_LEN + - AUTH_BODY_LEN; -#else - packet_len = (t_u16)req->ie_len + req->sae_data_len + MGMT_HEADER_LEN + - AUTH_BODY_LEN; -#endif - pmbuf = woal_alloc_mlan_buffer(priv->phandle, - MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + - packet_len + sizeof(packet_len)); - - if (!pmbuf) { - PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); - ret = -ENOMEM; - goto done; - } - if (MLAN_STATUS_SUCCESS != woal_cfg80211_set_key(priv, 0, 0, NULL, 0, NULL, 0, - KEY_INDEX_CLEAR_ALL, NULL, 1, + KEY_INDEX_CLEAR_ALL, NULL, 1, 0, MOAL_IOCTL_WAIT)) { /* Disable keys and clear all previous security settings */ PRINTM(MERROR, "Fail to clear previous keys\n"); @@ -2401,19 +2423,54 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, dev->name, status); } } +#define HEADER_SIZE 8 + // frmctl + durationid + addr1 + addr2 + addr3 + seqctl + addr4 +#define MGMT_HEADER_LEN (2 + 2 + 6 + 6 + 6 + 2 + 6) + // 6 = auth_alg + auth_transaction +auth_status +#define AUTH_BODY_LEN 6 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 10, 0) + packet_len = (t_u16)req->ie_len + req->auth_data_len + MGMT_HEADER_LEN + + AUTH_BODY_LEN; +#else + packet_len = (t_u16)req->ie_len + req->sae_data_len + MGMT_HEADER_LEN + + AUTH_BODY_LEN; +#endif + if (priv->phandle->cmd_tx_data) { + ioctl_req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_misc_cfg)); + if (ioctl_req == NULL) { + ret = -ENOMEM; + goto done; + } + misc = (mlan_ds_misc_cfg *)ioctl_req->pbuf; + misc->sub_command = MLAN_OID_MISC_TX_FRAME; + ioctl_req->req_id = MLAN_IOCTL_MISC_CFG; + ioctl_req->action = MLAN_ACT_SET; + misc->param.tx_frame.bandcfg.chanBand = + woal_ieee_band_to_radio_type(req->bss->channel->band); + misc->param.tx_frame.channel = req->bss->channel->hw_value; + pbuf = misc->param.tx_frame.tx_buf; + } else { + pmbuf = woal_alloc_mlan_buffer( + priv->phandle, MLAN_MIN_DATA_HEADER_LEN + HEADER_SIZE + + packet_len + sizeof(packet_len)); - pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; + if (!pmbuf) { + PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); + ret = -ENOMEM; + goto done; + } + pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; + pbuf = pmbuf->pbuf + pmbuf->data_offset; + } pkt_type = MRVL_PKT_TYPE_MGMT_FRAME; tx_control = 0; /* Add pkt_type and tx_control */ - moal_memcpy_ext(priv->phandle, pmbuf->pbuf + pmbuf->data_offset, - &pkt_type, sizeof(pkt_type), sizeof(pkt_type)); - moal_memcpy_ext(priv->phandle, - pmbuf->pbuf + pmbuf->data_offset + sizeof(pkt_type), - &tx_control, sizeof(tx_control), sizeof(tx_control)); + moal_memcpy_ext(priv->phandle, pbuf, &pkt_type, sizeof(pkt_type), + sizeof(pkt_type)); + moal_memcpy_ext(priv->phandle, pbuf + sizeof(pkt_type), &tx_control, + sizeof(tx_control), sizeof(tx_control)); - mgmt = (IEEE80211_MGMT *)(pmbuf->pbuf + pmbuf->data_offset + - HEADER_SIZE + sizeof(packet_len)); + mgmt = (IEEE80211_MGMT *)(pbuf + HEADER_SIZE + sizeof(packet_len)); memset(mgmt, 0, MGMT_HEADER_LEN); /**Authentication Frame: Frame Control*/ mgmt->frame_control = @@ -2463,9 +2520,8 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, #endif /*Add packet len*/ pkt_len = woal_cpu_to_le16(packet_len); - moal_memcpy_ext(priv->phandle, - pmbuf->pbuf + pmbuf->data_offset + HEADER_SIZE, - &pkt_len, sizeof(pkt_len), sizeof(pkt_len)); + moal_memcpy_ext(priv->phandle, pbuf + HEADER_SIZE, &pkt_len, + sizeof(pkt_len), sizeof(pkt_len)); /**Authentication Frame: Authentication Alg*/ mgmt->u.auth.auth_alg = woal_cpu_to_le16(auth_alg); @@ -2481,50 +2537,74 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, req->ie_len, req->ie_len); } - pmbuf->data_len = HEADER_SIZE + packet_len + sizeof(packet_len); - pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; - pmbuf->bss_index = priv->bss_index; - pmbuf->priority = 7; - priv->host_mlme = MTRUE; priv->auth_flag = HOST_MLME_AUTH_PENDING; priv->auth_alg = woal_cpu_to_le16(auth_alg); + woal_save_auth_params(priv, req); + woal_request_set_host_mlme(priv); PRINTM(MMSG, "wlan: HostMlme %s send auth to bssid " MACSTR "\n", dev->name, MAC2STR(req->bss->bssid)); - DBG_HEXDUMP(MDAT_D, "Auth:", pmbuf->pbuf + pmbuf->data_offset, - pmbuf->data_len); - woal_save_auth_params(priv, req); - status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); - - switch (status) { - case MLAN_STATUS_PENDING: - atomic_inc(&priv->phandle->tx_pending); - queue_work(priv->phandle->workqueue, &priv->phandle->main_work); -#define MAX_AUTH_COUNTER 5 - priv->auth_tx_cnt++; - if (priv->auth_tx_cnt >= MAX_AUTH_COUNTER) { - if (woal_reset_wifi(priv->phandle, priv->auth_tx_cnt, - "auth timeout") == - MLAN_STATUS_SUCCESS) { - priv->auth_tx_cnt = 0; - } + DBG_HEXDUMP(MDAT_D, "Auth:", pbuf, + HEADER_SIZE + packet_len + sizeof(packet_len)); + if (priv->phandle->cmd_tx_data) { + misc->param.tx_frame.data_len = + HEADER_SIZE + packet_len + sizeof(packet_len); + misc->param.tx_frame.buf_type = MLAN_BUF_TYPE_RAW_DATA; + misc->param.tx_frame.priority = 7; + status = woal_request_ioctl(priv, ioctl_req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + priv->host_mlme = MFALSE; + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + ret = -EFAULT; + PRINTM(MERROR, "Fail to send packet status=%d\n", + status); + } + } else { + pmbuf->data_len = HEADER_SIZE + packet_len + sizeof(packet_len); + pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; + pmbuf->bss_index = priv->bss_index; + pmbuf->priority = 7; + + status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); + + switch (status) { + case MLAN_STATUS_PENDING: + atomic_inc(&priv->phandle->tx_pending); + queue_work(priv->phandle->workqueue, + &priv->phandle->main_work); +#define MAX_AUTH_COUNTER 5 + priv->auth_tx_cnt++; + if (priv->auth_tx_cnt >= MAX_AUTH_COUNTER) { + if (woal_reset_wifi(priv->phandle, + priv->auth_tx_cnt, + "auth timeout") == + MLAN_STATUS_SUCCESS) { + priv->auth_tx_cnt = 0; + } + } + break; + case MLAN_STATUS_SUCCESS: + woal_free_mlan_buffer(priv->phandle, pmbuf); + break; + case MLAN_STATUS_FAILURE: + default: + woal_free_mlan_buffer(priv->phandle, pmbuf); + priv->host_mlme = MFALSE; + priv->auth_flag = 0; + priv->auth_alg = 0xFFFF; + ret = -EFAULT; + PRINTM(MERROR, "Fail to send packet status=%d\n", + status); + break; } - break; - case MLAN_STATUS_SUCCESS: - woal_free_mlan_buffer(priv->phandle, pmbuf); - break; - case MLAN_STATUS_FAILURE: - default: - woal_free_mlan_buffer(priv->phandle, pmbuf); - priv->host_mlme = MFALSE; - priv->auth_flag = 0; - priv->auth_alg = 0xFFFF; - ret = -EFAULT; - PRINTM(MERROR, "Fail to send packet status=%d\n", status); - break; } done: + if (priv->phandle->cmd_tx_data) { + if (status != MLAN_STATUS_PENDING) + kfree(ioctl_req); + } if (ret) { woal_mgmt_frame_register(priv, IEEE80211_STYPE_AUTH, MFALSE); if (priv->phandle->remain_on_channel) { @@ -2770,6 +2850,13 @@ static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, mlan_status status = MLAN_STATUS_SUCCESS; ENTER(); + if (!priv->auth_flag && !priv->host_mlme) { + PRINTM(MINFO, + "wlan: HostMlme %s can not proceed with this Assoc, as Auth is not done yet \n", + priv->netdev->name); + ret = -EFAULT; + goto done; + } priv->cfg_disconnect = MFALSE; @@ -2874,8 +2961,7 @@ static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, if (MLAN_STATUS_SUCCESS != woal_cfg80211_assoc_ies_cfg(priv, (t_u8 *)req->ie, req->ie_len, MOAL_IOCTL_WAIT)) { - ret = -EFAULT; - goto done; + PRINTM(MINFO, "Fail to woal_cfg80211_assoc_ies_cfg\n"); } } @@ -3156,7 +3242,8 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, if (MLAN_STATUS_SUCCESS != woal_cfg80211_set_key(priv, 0, 0, NULL, 0, NULL, 0, - KEY_INDEX_CLEAR_ALL, NULL, 1, wait_option)) { + KEY_INDEX_CLEAR_ALL, NULL, 1, 0, + wait_option)) { /* Disable keys and clear all previous security settings */ ret = -EFAULT; goto done; @@ -3185,8 +3272,7 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, if (MLAN_STATUS_SUCCESS != woal_cfg80211_assoc_ies_cfg(priv, ie, ie_len, wait_option)) { - ret = -EFAULT; - goto done; + PRINTM(MINFO, "Fail to woal_cfg80211_assoc_ies_cfg\n"); } } @@ -3844,7 +3930,6 @@ create_custom_regdomain(moal_private *priv, sort(&custom_reg->cfp_tbl[custom_reg->num_bg_chan], custom_reg->num_a_chan, sizeof(chan_freq_power_t), &compare, NULL); - regd_size = sizeof(struct ieee80211_regdomain) + num_chan * sizeof(struct ieee80211_reg_rule); @@ -4175,8 +4260,8 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, country_code[1] = request->alpha2[1]; } if (MLAN_STATUS_SUCCESS != - woal_request_country_power_table(priv, - country_code)) { + woal_request_country_power_table(priv, country_code, + MOAL_IOCTL_WAIT)) { #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 9, 0) return -EFAULT; #else @@ -4245,6 +4330,9 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, priv->phandle->band = band; } + if (handle->params.edmac_ctrl && IS_CARD9098(priv->phandle->card_type)) + woal_edmac_cfg(priv, priv->phandle->country_code); + LEAVE(); #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 9, 0) return ret; @@ -6753,12 +6841,14 @@ int woal_cfg80211_resume(struct wiphy *wiphy) wiphy->wowlan_config->gtk_rekey_failure) wakeup_report.gtk_rekey_failure = true; break; + case MGMT_FRAME_FILTER_EXT_MATCHED: + break; default: break; } if ((wakeup_reason.hs_wakeup_reason > 0) && - (wakeup_reason.hs_wakeup_reason <= 10)) { + (wakeup_reason.hs_wakeup_reason <= 11)) { cfg80211_report_wowlan_wakeup(priv->wdev, &wakeup_report, GFP_KERNEL); } @@ -9732,6 +9822,8 @@ mlan_status woal_register_sta_cfg80211(struct net_device *dev, t_u8 bss_type) wdev->iftype = NL80211_IFTYPE_STATION; #endif #endif + if (bss_type == MLAN_BSS_TYPE_NAN) + wdev->iftype = NL80211_IFTYPE_STATION; dev_net_set(dev, wiphy_net(wdev->wiphy)); dev->ieee80211_ptr = wdev; SET_NETDEV_DEV(dev, wiphy_dev(wdev->wiphy)); @@ -9829,7 +9921,8 @@ static mlan_status woal_cfg80211_init_wiphy(moal_private *priv, /* Initialize parameters for 2GHz and 5GHz bands */ if (wiphy->bands[IEEE80211_BAND_2GHZ]) { if (IS_CARD9098(priv->phandle->card_type) || - IS_CARD9097(priv->phandle->card_type)) { + IS_CARD9097(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { mcs_supp = priv->phandle->params.antcfg & 0xf; if (mcs_supp != 3 && mcs_supp != 0) cfg_11n->param.supported_mcs_set[1] = 0; @@ -9850,7 +9943,8 @@ static mlan_status woal_cfg80211_init_wiphy(moal_private *priv, /* For 2.4G band only card, this shouldn't be set */ if (wiphy->bands[IEEE80211_BAND_5GHZ]) { if (IS_CARD9098(priv->phandle->card_type) || - IS_CARD9097(priv->phandle->card_type)) { + IS_CARD9097(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { mcs_supp = (priv->phandle->params.antcfg & 0xf00) >> 8; if (mcs_supp != 3 && mcs_supp != 0) cfg_11n->param.supported_mcs_set[1] = 0; @@ -9895,7 +9989,8 @@ static mlan_status woal_cfg80211_init_wiphy(moal_private *priv, #endif if (IS_CARD9098(priv->phandle->card_type) || IS_CARD9097(priv->phandle->card_type) || - IS_CARDIW624(priv->phandle->card_type)) { + IS_CARDIW624(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { woal_cfg80211_notify_antcfg(priv, wiphy, radio); } wiphy->available_antennas_tx = radio->param.ant_cfg.tx_antenna; @@ -10151,7 +10246,8 @@ mlan_status woal_register_cfg80211(moal_private *priv) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) if ((moal_extflg_isset(priv->phandle, EXT_CFG80211_DRCS) && priv->phandle->card_info->drcs) || - IS_CARD9098(priv->phandle->card_type)) { + IS_CARD9098(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { cfg80211_iface_comb_ap_sta.num_different_channels = 2; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0) cfg80211_iface_comb_ap_sta.radar_detect_widths = 0; @@ -10241,6 +10337,7 @@ mlan_status woal_register_cfg80211(moal_private *priv) #endif wiphy->flags |= WIPHY_FLAG_4ADDR_AP; wiphy->flags |= WIPHY_FLAG_4ADDR_STATION; + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) wiphy->features |= NL80211_FEATURE_NEED_OBSS_SCAN; #endif diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap.c b/mxm_wifiex/wlan_src/mlinux/moal_uap.c index 1268079..c9fb521 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap.c @@ -1928,7 +1928,8 @@ static int woal_uap_antenna_cfg(struct net_device *dev, struct ifreq *req) #if defined(STA_CFG80211) || defined(UAP_CFG80211) if (IS_CARD9098(priv->phandle->card_type) || IS_CARD9097(priv->phandle->card_type) || - IS_CARDIW624(priv->phandle->card_type)) { + IS_CARDIW624(priv->phandle->card_type) || + IS_CARDAW693(priv->phandle->card_type)) { if (IS_STA_CFG80211( priv->phandle->params.cfg80211_wext)) woal_cfg80211_notify_antcfg( @@ -3861,10 +3862,6 @@ int woal_uap_set_11ax_status(moal_private *priv, t_u8 action, t_u8 band, &hecap_ie->ext_id, he_cfg.he_cap.len, he_cfg.he_cap.len); } -#define HE_MAC_CAP_TWT_REQ_SUPPORT MBIT(1) - /* uap mode clear TWT request bit */ - he_cfg.he_cap.he_mac_cap[0] &= ~HE_MAC_CAP_TWT_REQ_SUPPORT; - if (action == MLAN_ACT_DISABLE) { if (he_cfg.he_cap.len && (he_cfg.he_cap.ext_id == HE_CAPABILITY)) { diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c index dbd3f69..0f6d726 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c @@ -2975,6 +2975,11 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) LEAVE(); return ret; } +#ifdef UAP_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + woal_update_uap_channel_dfs_state(priv); +#endif +#endif priv->uap_host_based = MFALSE; PRINTM(MMSG, "wlan: Stoping AP\n"); #ifdef STA_SUPPORT @@ -3042,7 +3047,6 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) } } #endif - priv->cipher = 0; memset(priv->uap_wep_key, 0, sizeof(priv->uap_wep_key)); priv->channel = 0; @@ -3628,20 +3632,7 @@ int woal_cfg80211_set_radar_background(struct wiphy *wiphy, } chan_rpt_req.startFreq = START_FREQ_11A_BAND; chan_rpt_req.chanNum = (t_u8)chandef->chan->hw_value; - chan_rpt_req.bandcfg.chanBand = BAND_5GHZ; - switch (chandef->width) { - case NL80211_CHAN_WIDTH_40: - chan_rpt_req.bandcfg.chanWidth = CHAN_BW_40MHZ; - break; - case NL80211_CHAN_WIDTH_80: - chan_rpt_req.bandcfg.chanWidth = CHAN_BW_80MHZ; - break; - case NL80211_CHAN_WIDTH_20: - case NL80211_CHAN_WIDTH_20_NOHT: - default: - chan_rpt_req.bandcfg.chanWidth = CHAN_BW_20MHZ; - break; - } + woal_convert_chan_to_bandconfig(priv, &chan_rpt_req.bandcfg, chandef); chan_rpt_req.millisec_dwell_time = cac_time_ms; chan_rpt_req.host_based = MTRUE; moal_memcpy_ext(priv->phandle, &priv->chan_rpt_req, &chan_rpt_req, diff --git a/mxm_wifiex/wlan_src/mlinux/moal_usb.c b/mxm_wifiex/wlan_src/mlinux/moal_usb.c index 3babcbd..166f92a 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_usb.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_usb.c @@ -1237,6 +1237,7 @@ static int woal_usb_suspend(struct usb_interface *intf, pm_message_t message) { struct usb_card_rec *cardp = usb_get_intfdata(intf); moal_handle *handle = NULL; + mlan_ds_ps_info pm_info; int i; int ret = 0; @@ -1261,6 +1262,27 @@ static int woal_usb_suspend(struct usb_interface *intf, pm_message_t message) woal_cancel_scan(handle->priv[i], MOAL_IOCTL_WAIT); } #endif + + memset(&pm_info, 0, sizeof(pm_info)); +#define MAX_RETRY_USB 8 + for (i = 0; i < MAX_RETRY_USB; i++) { + if (MLAN_STATUS_SUCCESS == + woal_get_pm_info(woal_get_priv(handle, MLAN_BSS_ROLE_ANY), + &pm_info)) { + if (pm_info.is_suspend_allowed == MTRUE) + break; + else + PRINTM(MMSG, + "Suspend not allowed and retry again\n"); + } + woal_sched_timeout(100); + } + if (pm_info.is_suspend_allowed == MFALSE) { + PRINTM(MMSG, "Suspend not allowed\n"); + ret = -EBUSY; + goto done; + } + /* Enable Host Sleep */ woal_enable_hs(woal_get_priv(handle, MLAN_BSS_ROLE_ANY));