diff --git a/mxm_wifiex/wlan_src/Makefile b/mxm_wifiex/wlan_src/Makefile index 166b409..d120a18 100644 --- a/mxm_wifiex/wlan_src/Makefile +++ b/mxm_wifiex/wlan_src/Makefile @@ -148,6 +148,7 @@ APPDIR= $(shell if test -d "mapp"; then echo mapp; fi) ############################################################################# ccflags-y += -I$(KERNELDIR)/include + ccflags-y += -DMLAN_RELEASE_VERSION='"437"' ccflags-y += -DFPNUM='"92"' diff --git a/mxm_wifiex/wlan_src/README b/mxm_wifiex/wlan_src/README index ad858d2..4519a9e 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.5.4. + The driver code supports Linux kernel from 2.6.32 to 6.6.2. 2) FOR DRIVER INSTALL @@ -1066,6 +1066,13 @@ echo "tx_frame=1 0x1102 0xabababab 200" >/proc/mwlan/adapter0/config + OTP Read/Write + Example: Read OTP MAC address. + echo "otp_mac_add_rd_wr=0" > /proc/mwlan/adapter0/config + + Example: Write OTP MAC addres. + echo "otp_mac_add_rd_wr=1 AA:BB:CC:DD:EE:FF" > /proc/mwlan/adapter0/config + #endif #ifdef HS_SUPPORT diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c index 769351a..dd8d384 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ac.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ac.c @@ -1443,12 +1443,7 @@ void wlan_update_11ac_cap(mlan_private *pmpriv) */ t_u8 wlan_11ac_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band) { - if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) { - if (bss_band & BAND_G) - return (pmpriv->adapter->adhoc_start_band & BAND_GAC); - else if (bss_band & BAND_A) - return (pmpriv->adapter->adhoc_start_band & BAND_AAC); - } else { + { if (bss_band & BAND_G) return (pmpriv->config_bands & BAND_GAC); else if (bss_band & BAND_A) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c index ff26f97..4d4faf2 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11ax.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11ax.c @@ -629,12 +629,7 @@ t_u16 wlan_11ax_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band = pbss_desc->bss_band; if (pbss_desc->disable_11n) return MFALSE; - if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) { - if (bss_band & BAND_G) - return (pmpriv->adapter->adhoc_start_band & BAND_GAX); - else if (bss_band & BAND_A) - return (pmpriv->adapter->adhoc_start_band & BAND_AAX); - } else { + { if (bss_band & BAND_G) return (pmpriv->config_bands & BAND_GAX); else if (bss_band & BAND_A) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11d.c b/mxm_wifiex/wlan_src/mlan/mlan_11d.c index 9b9d917..3056a46 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11d.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11d.c @@ -1569,8 +1569,7 @@ mlan_status wlan_11d_cfg_domain_info(pmlan_adapter pmadapter, else pmadapter->region_code = 0; if (wlan_set_regiontable(pmpriv, pmadapter->region_code, - pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->config_bands)) { PRINTM(MIOCTL, "Fail to set regiontabl\n"); goto done; } @@ -1625,8 +1624,7 @@ mlan_status wlan_11d_handle_uap_domain_info(mlan_private *pmpriv, t_u16 band, else pmadapter->region_code = 0; if (wlan_set_regiontable(pmpriv, pmadapter->region_code, - pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->config_bands)) { ret = MLAN_STATUS_FAILURE; goto done; } diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11h.c b/mxm_wifiex/wlan_src/mlan/mlan_11h.c index bcb0b78..b6760d7 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11h.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11h.c @@ -156,50 +156,6 @@ static t_u32 wlan_11h_get_random_num(pmlan_adapter pmadapter) return (usec << 16) | sec; } -/** - * @brief Convert an IEEE formatted IE to 16-bit ID/Len NXP - * proprietary format - * - * @param pmadapter Pointer to mlan_adapter - * @param pout_buf Output parameter: Buffer to output NXP formatted IE - * @param pin_ie Pointer to IEEE IE to be converted to NXP format - * - * @return Number of bytes output to pout_buf parameter return - */ -static t_u32 wlan_11h_convert_ieee_to_mrvl_ie(mlan_adapter *pmadapter, - t_u8 *pout_buf, - const t_u8 *pin_ie) -{ - MrvlIEtypesHeader_t mrvl_ie_hdr; - t_u8 *ptmp_buf = pout_buf; - - ENTER(); - /* Assign the Element Id and Len to the NXP struct attributes */ - mrvl_ie_hdr.type = wlan_cpu_to_le16(pin_ie[0]); - mrvl_ie_hdr.len = wlan_cpu_to_le16(pin_ie[1]); - - /* If the element ID is zero, return without doing any copying */ - if (!mrvl_ie_hdr.type) { - LEAVE(); - return 0; - } - - /* Copy the header to the buffer pointer */ - memcpy_ext(pmadapter, ptmp_buf, &mrvl_ie_hdr, sizeof(mrvl_ie_hdr), - sizeof(mrvl_ie_hdr)); - - /* Increment the temp buffer pointer by the size appended */ - ptmp_buf += sizeof(mrvl_ie_hdr); - - /* Append the data section of the IE; length given by the IEEE IE length - */ - memcpy_ext(pmadapter, ptmp_buf, pin_ie + 2, pin_ie[1], pin_ie[1]); - - LEAVE(); - /* Return the number of bytes appended to pout_buf */ - return (t_u32)(sizeof(mrvl_ie_hdr) + pin_ie[1]); -} - /** * @brief find all bonded channel. * @@ -311,88 +267,6 @@ t_void wlan_11h_reset_dfs_checking_chan_dfs_state(mlan_private *priv, LEAVE(); } -#ifdef STA_SUPPORT -/** - * @brief Setup the IBSS DFS element passed to the firmware in adhoc start - * and join commands - * - * The DFS Owner and recovery fields are set to be our MAC address and - * a predetermined constant recovery value. If we are joining an adhoc - * network, these values are replaced with the existing IBSS values. - * They are valid only when starting a new IBSS. - * - * The IBSS DFS Element is variable in size based on the number of - * channels supported in our current region. - * - * @param priv Private driver information structure - * @param pdfs Output parameter: Pointer to the IBSS DFS element setup by - * this function. - * - * @return - * - Length of the returned element in pdfs output parameter - * - 0 if returned element is not setup - */ -static t_u32 wlan_11h_set_ibss_dfs_ie(mlan_private *priv, - IEEEtypes_IBSS_DFS_t *pdfs) -{ - t_u8 num_chans = 0; - MeasRptBasicMap_t initial_map; - mlan_adapter *adapter = priv->adapter; - - ENTER(); - - memset(adapter, pdfs, 0x00, sizeof(IEEEtypes_IBSS_DFS_t)); - - /* - * A basic measurement report is included with each channel in the - * map field. Initial value for the map for each supported channel - * is with only the unmeasured bit set. - */ - memset(adapter, &initial_map, 0x00, sizeof(initial_map)); - initial_map.unmeasured = 1; - - /* Set the DFS Owner and recovery interval fields */ - memcpy_ext(adapter, pdfs->dfs_owner, priv->curr_addr, - sizeof(pdfs->dfs_owner), sizeof(pdfs->dfs_owner)); - pdfs->dfs_recovery_interval = WLAN_11H_DEFAULT_DFS_RECOVERY_INTERVAL; - - for (; (num_chans < adapter->parsed_region_chan.no_of_chan) && - (num_chans < WLAN_11H_MAX_IBSS_DFS_CHANNELS); - num_chans++) { - pdfs->channel_map[num_chans].channel_number = - adapter->parsed_region_chan.chan_pwr[num_chans].chan; - - /* - * Set the initial map field with a basic measurement - */ - pdfs->channel_map[num_chans].rpt_map = initial_map; - } - - /* - * If we have an established channel map, include it and return - * a valid DFS element - */ - if (num_chans) { - PRINTM(MINFO, "11h: Added %d channels to IBSS DFS Map\n", - num_chans); - - pdfs->element_id = IBSS_DFS; - pdfs->len = (sizeof(pdfs->dfs_owner) + - sizeof(pdfs->dfs_recovery_interval) + - num_chans * sizeof(IEEEtypes_ChannelMap_t)); - - LEAVE(); - return pdfs->len + sizeof(pdfs->len) + sizeof(pdfs->element_id); - } - - /* Ensure the element is zeroed out for an invalid return */ - memset(adapter, pdfs, 0x00, sizeof(IEEEtypes_IBSS_DFS_t)); - - LEAVE(); - return 0; -} -#endif - /** * @brief Setup the Supported Channel IE sent in association requests * @@ -939,113 +813,7 @@ static t_u32 wlan_11h_process_infra_join(mlan_private *priv, t_u8 **ppbuffer, return ret_len; } -/** - * @brief Utility function to process a start or join to an adhoc network - * - * Add the elements to the TLV buffer needed in the start/join adhoc commands: - * - IBSS DFS IE - * - Quiet IE - * - * Also send the local constraint to the firmware in a TPC_INFO command. - * - * @param priv Private driver information structure - * @param ppbuffer Output parameter: Pointer to the TLV output buffer, - * modified on return to point after the appended 11h TLVs - * @param channel Channel on which we are starting/joining the IBSS - * @param p11h_bss_info Pointer to the 11h BSS information for this network - * that was parsed out of the scan response. NULL - * indicates we are starting the adhoc network - * - * @return Integer number of bytes appended to the TLV output - * buffer (ppbuffer) - */ -static t_u32 wlan_11h_process_adhoc(mlan_private *priv, t_u8 **ppbuffer, - t_u32 channel, - wlan_11h_bss_info_t *p11h_bss_info) -{ - IEEEtypes_IBSS_DFS_t dfs_elem; - t_u32 size_appended; - t_u32 ret_len = 0; - t_s8 local_constraint = 0; - mlan_adapter *adapter = priv->adapter; - - ENTER(); - -#ifdef STA_SUPPORT - /* Format our own IBSS DFS Element. Include our channel map fields */ - wlan_11h_set_ibss_dfs_ie(priv, &dfs_elem); -#endif - - if (p11h_bss_info) { - /* - * Copy the DFS Owner/Recovery Interval from the BSS - * we are joining - */ - memcpy_ext(adapter, dfs_elem.dfs_owner, - p11h_bss_info->ibss_dfs.dfs_owner, - sizeof(dfs_elem.dfs_owner), - sizeof(dfs_elem.dfs_owner)); - dfs_elem.dfs_recovery_interval = - p11h_bss_info->ibss_dfs.dfs_recovery_interval; - } - - /* Append the dfs element to the TLV buffer */ - size_appended = wlan_11h_convert_ieee_to_mrvl_ie( - adapter, (t_u8 *)*ppbuffer, (t_u8 *)&dfs_elem); - - HEXDUMP("11h: IBSS-DFS", (t_u8 *)*ppbuffer, size_appended); - *ppbuffer += size_appended; - ret_len += size_appended; - - /* - * Check to see if we are joining a network. Join is indicated by the - * BSS Info pointer being valid (not NULL) - */ - if (p11h_bss_info) { - /* - * If there was a quiet element, include it in - * adhoc join command - */ - if (p11h_bss_info->quiet.element_id == QUIET) { - size_appended = wlan_11h_convert_ieee_to_mrvl_ie( - adapter, (t_u8 *)*ppbuffer, - (t_u8 *)&p11h_bss_info->quiet); - HEXDUMP("11h: Quiet", (t_u8 *)*ppbuffer, size_appended); - *ppbuffer += size_appended; - ret_len += size_appended; - } - - /* Copy the local constraint from the network */ - local_constraint = - p11h_bss_info->power_constraint.local_constraint; - } else { - /* - * If we are the adhoc starter, we can add a quiet element - */ - if (adapter->state_11h.quiet_ie.quiet_period) { - size_appended = wlan_11h_convert_ieee_to_mrvl_ie( - adapter, (t_u8 *)*ppbuffer, - (t_u8 *)&adapter->state_11h.quiet_ie); - HEXDUMP("11h: Quiet", (t_u8 *)*ppbuffer, size_appended); - *ppbuffer += size_appended; - ret_len += size_appended; - } - /* Use the local_constraint configured in the driver state */ - local_constraint = adapter->state_11h.usr_def_power_constraint; - } - - PRINTM(MINFO, "WEILIE 1: ppbuffer = %p\n", *ppbuffer); - - ret_len += wlan_11h_set_local_power_constraint_tlv( - ppbuffer, (t_u8)channel, (t_u8)local_constraint, - (t_u8)priv->adapter->state_11h.min_tx_power_capability, - (t_u8)priv->adapter->state_11h.max_tx_power_capability); - PRINTM(MINFO, "WEILIE 2: ppbuffer = %p\n", *ppbuffer); - - LEAVE(); - return ret_len; -} - +#if defined(UAP_SUPPORT) /** * @brief Return whether the driver has enabled 11h for the interface * @@ -1064,6 +832,7 @@ static t_bool wlan_11h_is_enabled(mlan_private *priv) LEAVE(); return priv->intf_state_11h.is_11h_enabled; } +#endif /** * @brief Return whether the device has activated slave radar detection. @@ -1150,11 +919,6 @@ static t_bool wlan_11h_is_master_active_on_dfs_chan(mlan_private *priv) ENTER(); if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) { /* Ad-hoc creator */ - if (((priv->media_connected == MTRUE) || - (priv->adhoc_state == ADHOC_STARTING)) && - (priv->adapter->adhoc_start_band & BAND_A) && - wlan_11h_radar_detect_required(priv, priv->adhoc_channel)) - ret = MTRUE; } else if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { /* UAP */ #ifdef UAP_SUPPORT @@ -1185,13 +949,6 @@ static t_bool wlan_11h_is_dfs_master(mlan_private *priv) if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) ret = MTRUE; - /* STA: only ad-hoc creator is master */ - else if ((GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) && - (priv->bss_mode == MLAN_BSS_MODE_IBSS) && - (priv->adhoc_state == ADHOC_STARTED || - priv->adhoc_state == ADHOC_STARTING)) - ret = MTRUE; - /* all other cases = slave interface */ LEAVE(); return ret; @@ -2366,98 +2123,6 @@ t_void wlan_11h_priv_init(mlan_private *pmpriv) LEAVE(); } -/** - * @brief Retrieve a randomly selected starting channel if needed for 11h - * - * If 11h is enabled and an A-Band channel start band preference - * configured in the driver, the start channel must be random in order - * to meet with - * - * @param priv Private driver information structure - * - * @return Starting channel - */ -t_u8 wlan_11h_get_adhoc_start_channel(mlan_private *priv) -{ - t_u8 start_chn; - mlan_adapter *adapter = priv->adapter; - t_u32 region; - t_u32 rand_entry; - region_chan_t *chn_tbl; - t_u8 rand_tries = 0; - - ENTER(); - - /* - * Set start_chn to the Default. Used if 11h is disabled or the band - * does not require 11h support. - */ - start_chn = DEFAULT_AD_HOC_CHANNEL; - - /* - * Check that we are looking for a channel in the A Band - */ - if ((adapter->adhoc_start_band & BAND_A)) { - /* - * Set default to the A Band default. - * Used if random selection fails - * or if 11h is not enabled - */ - start_chn = DEFAULT_AD_HOC_CHANNEL_A; - - /* - * Check that 11h is enabled in the driver - */ - if (wlan_11h_is_enabled(priv)) { - /* - * Search the region_channel tables for a channel table - * that is marked for the A Band. - */ - for (region = 0; (region < MAX_REGION_CHANNEL_NUM); - region++) { - chn_tbl = &adapter->region_channel[region]; - - /* Check if table is valid and marked for A Band - */ - if (chn_tbl->valid && - chn_tbl->region == adapter->region_code && - chn_tbl->band & BAND_A) { - /* - * Set the start channel. Get a random - * number and use it to pick an entry - * in the table between 0 and the number - * of channels in the table (NumCFP). - */ - do { - rand_entry = - wlan_11h_get_random_num( - adapter) % - chn_tbl->num_cfp; - start_chn = - (t_u8)chn_tbl - ->pcfp[rand_entry] - .channel; - } while ( - (wlan_11h_is_channel_under_nop( - adapter, start_chn) || - ((adapter->state_rdh.stage == - RDH_GET_INFO_CHANNEL) && - wlan_11h_radar_detect_required( - priv, start_chn))) && - (++rand_tries < - MAX_RANDOM_CHANNEL_RETRIES)); - } - } - } - } - - PRINTM(MINFO, "11h: %s: AdHoc Channel set to %u\n", - wlan_11h_is_enabled(priv) ? "Enabled" : "Disabled", start_chn); - - LEAVE(); - return start_chn; -} - /** * @brief Retrieve channel closed for operation by Channel Switch Announcement * @@ -2745,93 +2410,6 @@ mlan_status wlan_11h_check_chan_report(mlan_private *priv, t_u8 chan) return ret; } -/** - * @brief Process an TLV buffer for a pending BSS Adhoc start command. - * - * Activate 11h functionality in the firmware if driver has is enabled - * for 11h (configured by the application via IOCTL). - * - * @param priv Private driver information structure - * @param ppbuffer Output parameter: Pointer to the TLV output buffer, - * modified on return to point after the appended 11h TLVs - * @param pcap_info Pointer to the capability info for the BSS to join - * @param channel Channel on which we are starting the IBSS - * @param p11h_bss_info Input/Output parameter: Pointer to the 11h BSS - * information for this network that we are establishing. - * 11h sensed flag set on output if warranted. - * - * @return - * - MLAN_STATUS_SUCCESS if 11h is disabled - * - Integer number of bytes appended to the TLV output buffer (ppbuffer) - * - < 0 for error (e.g. radar detected on channel) - */ -t_s32 wlan_11h_process_start(mlan_private *priv, t_u8 **ppbuffer, - IEEEtypes_CapInfo_t *pcap_info, t_u32 channel, - wlan_11h_bss_info_t *p11h_bss_info) -{ - mlan_adapter *adapter = priv->adapter; - t_s32 ret = MLAN_STATUS_SUCCESS; - t_bool is_dfs_chan = MFALSE; - - ENTER(); - if (wlan_11h_is_enabled(priv) && - ((adapter->adhoc_start_band & BAND_A))) { - if (!wlan_fw_11d_is_enabled(priv)) { - /* No use having 11h enabled without 11d enabled */ - if (wlan_11d_enable(priv, MNULL, ENABLE_11D)) { - ret = MLAN_STATUS_FAILURE; - LEAVE(); - return ret; - } -#ifdef STA_SUPPORT - if (wlan_11d_create_dnld_countryinfo( - priv, adapter->adhoc_start_band)) - PRINTM(MERROR, "Dnld_countryinfo_11d failed\n"); -#endif - } - - /* - * Activate 11h functions in firmware, - * turns on capability bit - */ - wlan_11h_activate(priv, MNULL, MTRUE); - pcap_info->spectrum_mgmt = MTRUE; - - /* If using a DFS channel, enable radar detection. */ - is_dfs_chan = wlan_11h_radar_detect_required(priv, channel); - if (is_dfs_chan) { - if (!wlan_11h_is_master_radar_det_active(priv)) - wlan_11h_config_master_radar_det(priv, MTRUE); - } - wlan_11h_check_update_radar_det_state(priv); - - /* Set flag indicating this BSS we are starting is using 11h */ - p11h_bss_info->sensed_11h = MTRUE; - - if (is_dfs_chan) { - /* check if this channel is under NOP */ - if (wlan_11h_is_channel_under_nop(adapter, channel)) - ret = MLAN_STATUS_FAILURE; - /* check last channel report, if this channel is free of - * radar */ - if (ret == MLAN_STATUS_SUCCESS) - ret = wlan_11h_check_chan_report(priv, channel); - } - if (ret == MLAN_STATUS_SUCCESS) - ret = wlan_11h_process_adhoc(priv, ppbuffer, channel, - MNULL); - else - ret = MLAN_STATUS_FAILURE; - } else { - /* Deactivate 11h functions in the firmware */ - wlan_11h_activate(priv, MNULL, MFALSE); - pcap_info->spectrum_mgmt = MFALSE; - wlan_11h_check_update_radar_det_state(priv); - } - LEAVE(); - return ret; -} - /** * @brief Process an TLV buffer for a pending BSS Join command for * both adhoc and infra networks @@ -2912,22 +2490,12 @@ t_s32 wlan_11h_process_join(mlan_private *priv, t_u8 **ppbuffer, } wlan_11h_check_update_radar_det_state(priv); - if (pcap_info->ibss) { - PRINTM(MINFO, "11h: Adhoc join: Sensed\n"); - ret = wlan_11h_process_adhoc(priv, ppbuffer, channel, - p11h_bss_info); - } else { + { PRINTM(MINFO, "11h: Infra join: Sensed\n"); ret = wlan_11h_process_infra_join( priv, ppbuffer, band, channel, p11h_bss_info); } } else { - if (pcap_info->ibss) { - /* Deactivate 11h functions in the firmware */ - wlan_11h_activate(priv, MNULL, MFALSE); - pcap_info->spectrum_mgmt = MFALSE; - wlan_11h_check_update_radar_det_state(priv); - } } LEAVE(); @@ -3142,17 +2710,6 @@ mlan_status wlan_11h_process_bss_elem(mlan_adapter *pmadapter, sizeof(IEEEtypes_Header_t))); break; - case IBSS_DFS: - PRINTM(MINFO, "11h: Ibss Dfs IE Found\n"); - p11h_bss_info->sensed_11h = MTRUE; - memcpy_ext(pmadapter, &p11h_bss_info->ibss_dfs, pelement, - element_len + sizeof(IEEEtypes_Header_t), - sizeof(IEEEtypes_IBSS_DFS_t)); - p11h_bss_info->ibss_dfs.len = - MIN(element_len, (sizeof(IEEEtypes_IBSS_DFS_t) - - sizeof(IEEEtypes_Header_t))); - break; - case SUPPORTED_CHANNELS: case TPC_REQUEST: /* @@ -4205,12 +3762,10 @@ mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter, pmpriv->uap_state_chan_cb.bandcfg); else #endif - pstate_rdh->new_channel = - wlan_11h_get_adhoc_start_channel(pmpriv); - if (!pstate_rdh->new_channel || - (pstate_rdh->new_channel == - pstate_rdh->curr_channel)) { /* report error */ + if (!pstate_rdh->new_channel || + (pstate_rdh->new_channel == + pstate_rdh->curr_channel)) { /* report error */ PRINTM(MERROR, "%s(): ERROR - Failed to choose new_chan" " (!= curr_chan) !!\n", @@ -4294,9 +3849,7 @@ mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter, t_u16 bcn_dtim_msec; /* adhoc creator */ - if (wlan_11h_is_dfs_master(pmpriv)) { - bcn_pd_msec = pmpriv->beacon_period; - } else { + { bcn_pd_msec = pmpriv->curr_bss_params .bss_descriptor .beacon_period; @@ -4460,12 +4013,6 @@ mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter, #endif #ifdef STA_SUPPORT if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) { - if (wlan_11h_is_dfs_master(pmpriv)) { - /* Save ad-hoc creator state before stop - * clears it */ - pmpriv->adhoc_state_prev = - pmpriv->adhoc_state; - } if (pmpriv->media_connected == MTRUE) { wlan_disconnect(pmpriv, MNULL, MNULL); break; /* leads to exit case */ @@ -4567,56 +4114,6 @@ mlan_status wlan_11h_radar_detected_handling(mlan_adapter *pmadapter, } #endif #ifdef STA_SUPPORT - if (GET_BSS_ROLE(pmpriv) == MLAN_BSS_ROLE_STA) { - /* Check previous state to find former - * Ad-hoc creator interface. Set new - * state to Starting, so it'll be seen - * as a DFS master. */ - if (pmpriv->adhoc_state_prev == ADHOC_STARTED) { - pmpriv->adhoc_state = ADHOC_STARTING; - pmpriv->adhoc_state_prev = ADHOC_IDLE; - } - if (wlan_11h_is_dfs_master(pmpriv)) { - /* set new adhoc channel here */ - pmpriv->adhoc_channel = - pstate_rdh->new_channel; - if (wlan_11h_radar_detect_required( - pmpriv, - pstate_rdh->new_channel)) { - /* Radar detection is required - for this channel, make sure - 11h is activated in the - firmware */ - ret = wlan_11h_activate( - pmpriv, MNULL, MTRUE); - if (ret) - break; - ret = wlan_11h_config_master_radar_det( - pmpriv, MTRUE); - if (ret) - break; - ret = wlan_11h_check_update_radar_det_state( - pmpriv); - if (ret) - break; - } - ret = wlan_prepare_cmd( - pmpriv, - HostCmd_CMD_802_11_AD_HOC_START, - HostCmd_ACT_GEN_SET, 0, MNULL, - &pmpriv->adhoc_last_start_ssid); - break; /* leads to exit case */ - } - - /* NOTE: DON'T reconnect slave STA intfs - - * infra/adhoc_joiner Do we want to return to - * same AP/network (on radar channel)? If want - * to connect back, depend on either: - * 1. driver's reassoc thread - * 2. wpa_supplicant, or other user-space - * app - */ - } #endif } diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11h.h b/mxm_wifiex/wlan_src/mlan/mlan_11h.h index 21ea742..8876d1a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11h.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_11h.h @@ -94,9 +94,6 @@ extern void wlan_11h_cleanup(mlan_adapter *pmadapter); /** Initialize the 11h interface structure */ extern void wlan_11h_priv_init(mlan_private *pmpriv); -/** Get an initial random channel to start an adhoc network on */ -extern t_u8 wlan_11h_get_adhoc_start_channel(mlan_private *priv); - /** Get channel that has been closed via Channel Switch Announcement */ extern t_u8 wlan_11h_get_csa_closed_channel(mlan_private *priv); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11n.c b/mxm_wifiex/wlan_src/mlan/mlan_11n.c index f106ea3..c6fb9e4 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n.c @@ -622,75 +622,6 @@ static mlan_status wlan_11n_ioctl_addba_reject(pmlan_adapter pmadapter, return ret; } -/** - * @brief Set/get ibss ampdu param - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pioctl_req A pointer to ioctl request buffer - * - * @return MLAN_STATUS_SUCCESS --success, otherwise fail - */ -static mlan_status wlan_11n_ioctl_ibss_ampdu_param(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) -{ - int i = 0; - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; - mlan_ds_11n_cfg *cfg = MNULL; - - ENTER(); - - cfg = (mlan_ds_11n_cfg *)pioctl_req->pbuf; - - if (pioctl_req->action == MLAN_ACT_GET) { - PRINTM(MINFO, "Get IBSS AMPDU param\n"); - for (i = 0; i < MAX_NUM_TID; i++) { - cfg->param.ibss_ampdu.ampdu[i] = pmpriv->ibss_ampdu[i]; - cfg->param.ibss_ampdu.addba_reject[i] = - pmpriv->ibss_addba_reject[i]; - } - } else { - for (i = 0; i < MAX_NUM_TID; i++) { - /* For AMPDU RX*/ - if (cfg->param.ibss_ampdu.addba_reject[i] > - ADDBA_RSP_STATUS_REJECT) { - pioctl_req->status_code = - MLAN_ERROR_INVALID_PARAMETER; - ret = MLAN_STATUS_FAILURE; - break; - } - pmpriv->ibss_addba_reject[i] = - cfg->param.ibss_ampdu.addba_reject[i]; - /* For AMPDU TX*/ - if ((cfg->param.ibss_ampdu.ampdu[i] > HIGH_PRIO_TID) && - (cfg->param.ibss_ampdu.ampdu[i] != - BA_STREAM_NOT_ALLOWED)) { - pioctl_req->status_code = - MLAN_ERROR_INVALID_PARAMETER; - ret = MLAN_STATUS_FAILURE; - break; - } - pmpriv->ibss_ampdu[i] = cfg->param.ibss_ampdu.ampdu[i]; - } - PRINTM(MMSG, "IBSS addba reject: %d %d %d %d %d %d %d %d\n", - pmpriv->ibss_addba_reject[0], - pmpriv->ibss_addba_reject[1], - pmpriv->ibss_addba_reject[2], - pmpriv->ibss_addba_reject[3], - pmpriv->ibss_addba_reject[4], - pmpriv->ibss_addba_reject[5], - pmpriv->ibss_addba_reject[6], - pmpriv->ibss_addba_reject[7]); - PRINTM(MMSG, "IBSS ampdu %d %d %d %d %d %d %d %d\n", - pmpriv->ibss_ampdu[0], pmpriv->ibss_ampdu[1], - pmpriv->ibss_ampdu[2], pmpriv->ibss_ampdu[3], - pmpriv->ibss_ampdu[4], pmpriv->ibss_ampdu[5], - pmpriv->ibss_ampdu[6], pmpriv->ibss_ampdu[7]); - } - LEAVE(); - return ret; -} - /** * @brief Set/Get Minimum BA Threshold * @@ -2552,10 +2483,7 @@ int wlan_cmd_append_11n_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc, else usr_dot_11n_dev_cap = pmpriv->usr_dot_11n_dev_cap_bg; - if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) - usr_dot_11ac_bw = BW_FOLLOW_VHTCAP; - else - usr_dot_11ac_bw = pmpriv->usr_dot_11ac_bw; + usr_dot_11ac_bw = pmpriv->usr_dot_11ac_bw; if ((pbss_desc->bss_band & (BAND_B | BAND_G | BAND_A)) && ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap) && !wlan_check_chan_width_ht40_by_region(pmpriv, pbss_desc)) { @@ -2779,9 +2707,6 @@ mlan_status wlan_11n_cfg_ioctl(pmlan_adapter pmadapter, case MLAN_OID_11N_CFG_TX_AGGR_CTRL: status = wlan_11n_ioctl_txaggrctrl(pmadapter, pioctl_req); break; - case MLAN_OID_11N_CFG_IBSS_AMPDU_PARAM: - status = wlan_11n_ioctl_ibss_ampdu_param(pmadapter, pioctl_req); - break; case MLAN_OID_11N_CFG_MIN_BA_THRESHOLD: status = wlan_11n_ioctl_min_ba_threshold_cfg(pmadapter, pioctl_req); @@ -3239,12 +3164,7 @@ int wlan_get_txbastream_tbl(mlan_private *priv, tx_ba_stream_tbl *buf) */ t_u8 wlan_11n_bandconfig_allowed(mlan_private *pmpriv, t_u16 bss_band) { - if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) { - if (bss_band & BAND_G) - return (pmpriv->adapter->adhoc_start_band & BAND_GN); - else if (bss_band & BAND_A) - return (pmpriv->adapter->adhoc_start_band & BAND_AN); - } else { + { if (bss_band & BAND_G) return (pmpriv->config_bands & BAND_GN); else if (bss_band & BAND_A) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c b/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c index b0f96ed..56cd1da 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_11n_aggr.c @@ -319,6 +319,12 @@ mlan_status wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf) ret = pmadapter->callbacks.moal_recv_amsdu_packet( pmadapter->pmoal_handle, pmbuf); if (ret == MLAN_STATUS_PENDING) { +#ifdef USB + if (IS_USB(pmadapter->card_type)) + pmadapter->callbacks.moal_recv_complete( + pmadapter->pmoal_handle, MNULL, + pmadapter->rx_data_ep, ret); +#endif priv->msdu_in_rx_amsdu_cnt += num_subframes; priv->amsdu_rx_cnt++; return ret; @@ -507,8 +513,9 @@ int wlan_11n_aggregate_pkt(mlan_private *priv, raListTbl *pra_list, pmadapter->pmoal_handle, &pra_list->buf_head, MNULL, MNULL); if (pmbuf_src) { pmbuf_aggr = wlan_alloc_mlan_buffer( - pmadapter, pmadapter->tx_buf_size, 0, - MOAL_MALLOC_BUFFER | MOAL_MEM_FLAG_ATOMIC); + pmadapter, pmadapter->tx_buf_size, headroom, + MOAL_MEM_FLAG_DIRTY | MOAL_MALLOC_BUFFER | + MOAL_MEM_FLAG_ATOMIC); if (!pmbuf_aggr) { PRINTM(MERROR, "Error allocating mlan_buffer\n"); pmadapter->callbacks.moal_spin_unlock( diff --git a/mxm_wifiex/wlan_src/mlan/mlan_cfp.c b/mxm_wifiex/wlan_src/mlan/mlan_cfp.c index d4ff63a..61ddb09 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_cfp.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_cfp.c @@ -978,30 +978,6 @@ t_u16 region_code_index[MRVDRV_MAX_REGION_CODE] = {0x00, 0x10, 0x20, 0x30, 0x40, /** The table to keep CFP code for A */ t_u16 cfp_code_index_a[MRVDRV_MAX_CFP_CODE_A] = {0x1, 0x2, 0x3, 0x4, 0x5}; -/** - * The rates supported for ad-hoc B mode - */ -t_u8 AdhocRates_B[B_SUPPORTED_RATES] = {0x82, 0x84, 0x8b, 0x96, 0}; - -/** - * The rates supported for ad-hoc G mode - */ -t_u8 AdhocRates_G[G_SUPPORTED_RATES] = {0x8c, 0x12, 0x98, 0x24, 0xb0, - 0x48, 0x60, 0x6c, 0x00}; - -/** - * The rates supported for ad-hoc BG mode - */ -t_u8 AdhocRates_BG[BG_SUPPORTED_RATES] = {0x82, 0x84, 0x8b, 0x96, 0x0c, - 0x12, 0x18, 0x24, 0x30, 0x48, - 0x60, 0x6c, 0x00}; - -/** - * The rates supported in A mode for ad-hoc - */ -t_u8 AdhocRates_A[A_SUPPORTED_RATES] = {0x8c, 0x12, 0x98, 0x24, 0xb0, - 0x48, 0x60, 0x6c, 0x00}; - /** * The rates supported in A mode (used for BAND_A) */ @@ -2267,30 +2243,6 @@ t_u32 wlan_get_supported_rates(mlan_private *pmpriv, t_u32 bss_mode, k = wlan_copy_rates(rates, k, SupportedRates_A, sizeof(SupportedRates_A)); } - } else { - /* Adhoc. mode */ - if (bands == BAND_B) { - /* B only */ - PRINTM(MINFO, "Band: Adhoc B\n"); - k = wlan_copy_rates(rates, k, AdhocRates_B, - sizeof(AdhocRates_B)); - } else if (bands == BAND_G) { - /* G only */ - PRINTM(MINFO, "Band: Adhoc G\n"); - k = wlan_copy_rates(rates, k, AdhocRates_G, - sizeof(AdhocRates_G)); - - } else if (bands & BAND_A) { - /* support A */ - PRINTM(MINFO, "Band: Adhoc A\n"); - k = wlan_copy_rates(rates, k, AdhocRates_A, - sizeof(AdhocRates_A)); - - } else { - PRINTM(MINFO, "Band: Adhoc BG\n"); - k = wlan_copy_rates(rates, k, AdhocRates_BG, - sizeof(AdhocRates_BG)); - } } LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c index 7bc55f3..230ef3b 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_cmdevt.c @@ -169,9 +169,6 @@ static t_u8 wlan_is_cmd_allowed_during_scan(t_u16 cmd_id) case HostCmd_CMD_802_11_ASSOCIATE: case HostCmd_CMD_802_11_DEAUTHENTICATE: case HostCmd_CMD_802_11_DISASSOCIATE: - case HostCmd_CMD_802_11_AD_HOC_START: - case HostCmd_CMD_802_11_AD_HOC_JOIN: - case HostCmd_CMD_802_11_AD_HOC_STOP: case HostCmd_CMD_11N_ADDBA_REQ: case HostCmd_CMD_11N_ADDBA_RSP: case HostCmd_CMD_11N_DELBA: @@ -739,7 +736,9 @@ static t_u8 *wlan_strchr(t_u8 *s, int c) while (*pos != '\0') { if (*pos == (t_u8)c) return pos; - pos++; + if (!wlan_secure_add(pos, 1, pos, TYPE_PTR)) { + PRINTM(MERROR, "pos is invalid\n"); + } } return MNULL; } @@ -1201,9 +1200,6 @@ static t_u32 wlan_get_cmd_timeout(t_u16 cmd_id) case HostCmd_CMD_802_11_ASSOCIATE: case HostCmd_CMD_802_11_DEAUTHENTICATE: case HostCmd_CMD_802_11_DISASSOCIATE: - case HostCmd_CMD_802_11_AD_HOC_START: - case HostCmd_CMD_802_11_AD_HOC_JOIN: - case HostCmd_CMD_802_11_AD_HOC_STOP: case HostCmd_CMD_11N_ADDBA_REQ: case HostCmd_CMD_11N_ADDBA_RSP: case HostCmd_CMD_11N_DELBA: @@ -4442,6 +4438,55 @@ mlan_status wlan_cmd_ssu(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, } #endif +/** + * @brief This function enable/disable CSI support. + * + * @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_csi(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf) +{ + HostCmd_DS_CSI_CFG *csi_cfg_cmd = &cmd->params.csi_params; + mlan_ds_csi_params *csi_params = MNULL; + + ENTER(); + + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_CSI); + cmd->size = sizeof(HostCmd_DS_CSI_CFG) + S_DS_GEN; + csi_cfg_cmd->action = wlan_cpu_to_le16(cmd_action); + switch (cmd_action) { + case CSI_CMD_ENABLE: + csi_params = (mlan_ds_csi_params *)pdata_buf; + csi_cfg_cmd->head_id = wlan_cpu_to_le32(csi_params->head_id); + csi_cfg_cmd->tail_id = wlan_cpu_to_le32(csi_params->tail_id); + csi_cfg_cmd->chip_id = csi_params->chip_id; + csi_cfg_cmd->csi_filter_cnt = csi_params->csi_filter_cnt; + if (csi_cfg_cmd->csi_filter_cnt > CSI_FILTER_MAX) + csi_cfg_cmd->csi_filter_cnt = CSI_FILTER_MAX; + memcpy_ext(pmpriv->adapter, (t_u8 *)csi_cfg_cmd->csi_filter, + (t_u8 *)csi_params->csi_filter, + sizeof(mlan_csi_filter_t) * + csi_cfg_cmd->csi_filter_cnt, + sizeof(csi_cfg_cmd->csi_filter)); + DBG_HEXDUMP(MCMD_D, "Enable CSI", csi_cfg_cmd, + sizeof(HostCmd_DS_CSI_CFG)); + break; + case CSI_CMD_DISABLE: + DBG_HEXDUMP(MCMD_D, "Disable CSI", csi_cfg_cmd, + sizeof(HostCmd_DS_CSI_CFG)); + default: + break; + } + cmd->size = wlan_cpu_to_le16(cmd->size); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /** * @brief This function prepares command of dmcs config. * @@ -5010,7 +5055,6 @@ mlan_status wlan_adapter_init_cmd(pmlan_adapter pmadapter) } } #endif - #ifdef STA_SUPPORT if (pmpriv_sta && (pmadapter->ps_mode == Wlan802_11PowerModePSP)) { ret = wlan_prepare_cmd(pmpriv_sta, @@ -5043,6 +5087,18 @@ mlan_status wlan_adapter_init_cmd(pmlan_adapter pmadapter) goto done; } + if (pmadapter->init_para.antcfg) + wlan_handle_antcfg(pmpriv, pmadapter->init_para.antcfg); + + if (pmadapter->init_para.dmcs) { + mlan_ds_misc_mapping_policy dmcs_policy; + dmcs_policy.subcmd = 0; + dmcs_policy.mapping_policy = pmadapter->init_para.dmcs; + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_DMCS_CONFIG, + HostCmd_ACT_GEN_SET, 0, (t_void *)MNULL, + &dmcs_policy); + } + #define DEF_AUTO_NULL_PKT_PERIOD 30 if (pmpriv_sta) { t_u32 value = DEF_AUTO_NULL_PKT_PERIOD; @@ -5348,6 +5404,31 @@ mlan_status wlan_process_vdll_event(pmlan_private pmpriv, pmlan_buffer pevent) case VDLL_IND_TYPE_SEC_ERR_ID: PRINTM(MERROR, "VDLL_IND (SECURE ERR).\n"); break; + case VDLL_IND_TYPE_INTF_RESET: + PRINTM(MEVENT, "VDLL_IND (INTF_RESET)\n"); +#ifdef PCIE8997 + /* For PCIe PFU, need to reset both Tx and Rx rd/wrptr */ + if (IS_PCIE8997(pmadapter->card_type)) { + pmadapter->pcard_pcie->txbd_wrptr = 0; + pmadapter->pcard_pcie->txbd_rdptr = 0; + pmadapter->pcard_pcie->rxbd_wrptr = + pmadapter->pcard_pcie->reg + ->txrx_rw_ptr_rollover_ind; + pmadapter->pcard_pcie->rxbd_rdptr = 0; + } +#endif +#if defined(SD8997) || defined(SD8987) || defined(SD8978) + /* For SDIO, need to reset wr_port only */ + if (IS_SD8997(pmadapter->card_type) || + IS_SD8987(pmadapter->card_type) || + IS_SD8978(pmadapter->card_type)) { + pmadapter->pcard_sd->curr_wr_port = + pmadapter->pcard_sd->reg->start_wr_port; + pmadapter->pcard_sd->mpa_tx.start_port = + pmadapter->pcard_sd->reg->start_wr_port; + } +#endif + break; default: PRINTM(MERROR, "unknow vdll ind type=%d\n", ind->type); break; @@ -6119,14 +6200,7 @@ mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, BAND_GAC; } } - pmadapter->adhoc_start_band = BAND_A; - pmpriv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL_A; - } else if (pmadapter->fw_bands & BAND_G) { - pmadapter->adhoc_start_band = BAND_G | BAND_B; - pmpriv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; - } else if (pmadapter->fw_bands & BAND_B) { - pmadapter->adhoc_start_band = BAND_B; - pmpriv->adhoc_channel = DEFAULT_AD_HOC_CHANNEL; + } else { } #endif /* STA_SUPPORT */ @@ -6358,6 +6432,12 @@ mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, tlv = (MrvlIEtypesHeader_t *)((t_u8 *)tlv + tlv_len + sizeof(MrvlIEtypesHeader_t)); } +#ifdef PCIE + if (IS_PCIE(pmadapter->card_type) && + IS_FW_SUPPORT_RX_SW_INT(pmadapter)) { + pmadapter->ops.select_host_int(pmadapter); + } +#endif if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, pmadapter->fw_bands)) { if (pioctl_req) @@ -9572,7 +9652,11 @@ mlan_status wlan_ret_led_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_led_cfg->enable = resp->params.ledcntrcfg.enable; left_len = cmdrsp_len - (S_DS_GEN + sizeof(HostCmd_DS_CMD_LED_CFG)); - tlv = (t_u8 *)resp + (S_DS_GEN + sizeof(HostCmd_DS_CMD_LED_CFG)); + if (!wlan_secure_add(&resp, (S_DS_GEN + sizeof(HostCmd_DS_CMD_LED_CFG)), + &tlv, TYPE_PTR)) { + PRINTM(MERROR, "tlv is invalid\n"); + } + for (i = 0; i < MAX_FW_STATES; i++) { mlan_led_cfg->misc_led_behvr[i].firmwarestate = *tlv; tlv++; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_decl.h b/mxm_wifiex/wlan_src/mlan/mlan_decl.h index 29eb7f6..b148977 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_decl.h @@ -23,9 +23,6 @@ #ifndef _MLAN_DECL_H_ #define _MLAN_DECL_H_ -/** MLAN release version */ -#define MLAN_RELEASE_VERSION "423.p6" - /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ typedef signed char t_s8, *t_ps8; @@ -661,6 +658,8 @@ typedef enum { #define MLAN_MEM_DMA MBIT(0) /** Memory allocation flag: ATOMIC */ #define MLAN_MEM_FLAG_ATOMIC MBIT(1) +/** Memory allocation flag: DIRTY - do not memset to 0 buffer */ +#define MLAN_MEM_FLAG_DIRTY MBIT(2) /** Default memory allocation flag */ #define MLAN_MEM_DEF 0 @@ -781,8 +780,6 @@ typedef enum _mlan_data_frame_type { typedef enum _mlan_event_id { /* Event generated by firmware (MSB=0) */ MLAN_EVENT_ID_FW_UNKNOWN = 0x00000001, - MLAN_EVENT_ID_FW_ADHOC_LINK_SENSED = 0x00000002, - MLAN_EVENT_ID_FW_ADHOC_LINK_LOST = 0x00000003, MLAN_EVENT_ID_FW_DISCONNECTED = 0x00000004, MLAN_EVENT_ID_FW_MIC_ERR_UNI = 0x00000005, MLAN_EVENT_ID_FW_MIC_ERR_MUL = 0x00000006, @@ -810,8 +807,6 @@ 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 @@ -1013,14 +1008,14 @@ typedef enum _dfs_moe_t { /** Band_Config_t */ typedef MLAN_PACK_START struct _Band_Config_t { #ifdef BIG_ENDIAN_SUPPORT - /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ - t_u8 chanWidth : 2; - /** Band Info - (00)=2.4GHz, (01)=5GHz, (10)=6GHz */ - t_u8 chanBand : 2; /** Channel Selection Mode - (00)=manual, (01)=ACS, (02)=user*/ t_u8 scanMode : 2; /** Secondary Channel Offset - (00)=None, (01)=Above, (11)=Below */ t_u8 chan2Offset : 2; + /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ + t_u8 chanWidth : 2; + /** Band Info - (00)=2.4GHz, (01)=5GHz, (10)=6GHz */ + t_u8 chanBand : 2; #else /** Band Info - (00)=2.4GHz, (01)=5GHz, (10)=6GHz */ t_u8 chanBand : 2; @@ -1856,7 +1851,6 @@ typedef enum { typedef enum { MLAN_INTERFACE_STA = 0, MLAN_INTERFACE_SOFTAP = 1, - MLAN_INTERFACE_IBSS = 2, MLAN_INTERFACE_P2P_CLIENT = 3, MLAN_INTERFACE_P2P_GO = 4, MLAN_INTERFACE_NAN = 5, @@ -2722,6 +2716,10 @@ typedef struct _mlan_device { t_u8 second_mac; /** napi */ t_u8 napi; + /** antcfg */ + t_u32 antcfg; + /** dmcs */ + t_u8 dmcs; } mlan_device, *pmlan_device; /** MLAN API function prototype */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h b/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h index 56d3e55..cfbd78e 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_event_ids.h @@ -47,9 +47,6 @@ ENUM_ELEMENT(EVENT_DUMMY_HOST_WAKEUP_SIGNAL, 0x0001), /** Card Event definition : MIC error unicast */ ENUM_ELEMENT(EVENT_MIC_ERR_UNICAST, 0x000e), - /** Card Event definition : Ad-Hoc BCN lost */ - ENUM_ELEMENT(EVENT_ADHOC_BCN_LOST, 0x0011), - /** Card Event definition : Stop Tx */ ENUM_ELEMENT(EVENT_STOP_TX, 0x0013), /** Card Event definition : Start Tx */ @@ -79,14 +76,6 @@ ENUM_ELEMENT(EVENT_DUMMY_HOST_WAKEUP_SIGNAL, 0x0001), /** Card Event definition : Beacon SNR high */ ENUM_ELEMENT(EVENT_SNR_HIGH, 0x001d), - /** Card Event definition : IBSS coalsced */ - ENUM_ELEMENT(EVENT_IBSS_COALESCED, 0x001e), - - /** Event definition : IBSS station connected */ - ENUM_ELEMENT(EVENT_IBSS_STATION_CONNECT, 0x0020), - /** Event definition : IBSS station dis-connected */ - ENUM_ELEMENT(EVENT_IBSS_STATION_DISCONNECT, 0x0021), - /** Card Event definition : Data RSSI low */ ENUM_ELEMENT(EVENT_DATA_RSSI_LOW, 0x0024), /** Card Event definition : Data SNR low */ diff --git a/mxm_wifiex/wlan_src/mlan/mlan_fw.h b/mxm_wifiex/wlan_src/mlan/mlan_fw.h index 02be5d1..7fd4478 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_fw.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_fw.h @@ -153,10 +153,6 @@ extern t_u8 SupportedRates_G[G_SUPPORTED_RATES]; extern t_u8 SupportedRates_BG[BG_SUPPORTED_RATES]; extern t_u8 SupportedRates_A[A_SUPPORTED_RATES]; extern t_u8 SupportedRates_N[N_SUPPORTED_RATES]; -extern t_u8 AdhocRates_G[G_SUPPORTED_RATES]; -extern t_u8 AdhocRates_B[B_SUPPORTED_RATES]; -extern t_u8 AdhocRates_BG[BG_SUPPORTED_RATES]; -extern t_u8 AdhocRates_A[A_SUPPORTED_RATES]; /** Default auto deep sleep mode */ #define DEFAULT_AUTO_DS_MODE MTRUE @@ -315,8 +311,6 @@ typedef enum _WLAN_802_11_WEP_STATUS { #define TLV_TYPE_PHY_DS 0x0003 /** TLV type : CF */ #define TLV_TYPE_CF 0x0004 -/** TLV type : IBSS */ -#define TLV_TYPE_IBSS 0x0006 /** TLV type : Domain */ #define TLV_TYPE_DOMAIN 0x0007 @@ -1175,12 +1169,6 @@ enum host_cmd_id { /** fw_cap_info bit23 for firmware roaming*/ #define FW_ROAMING_SUPPORT MBIT(23) -/** fw_cap_info bit25 for adhoc support*/ -#define FW_CAPINFO_ADHOC_SUPPORT MBIT(25) -/** Check if adhoc is supported by firmware */ -#define IS_FW_SUPPORT_ADHOC(_adapter) \ - (_adapter->fw_cap_info & FW_CAPINFO_ADHOC_SUPPORT) - /** Check if supplicant is supported by firmware */ #define IS_FW_SUPPORT_SUPPLICANT(_adapter) \ (_adapter->fw_cap_info & FW_CAPINFO_SUPPLICANT_SUPPORT) @@ -1223,6 +1211,8 @@ enum host_cmd_id { #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) +/** FW cap info bit 20: RX_SW_INT */ +#define FW_CAPINFO_EXT_RX_SW_INT MBIT(20) /** Check if 5G 1x1 only is supported by firmware */ #define IS_FW_SUPPORT_5G_1X1_ONLY(_adapter) \ @@ -1267,6 +1257,8 @@ enum host_cmd_id { /** Check if security rgpower table supported by firmware */ #define IS_FW_SUPPORT_SEC_RG_POWER(_adapter) \ (_adapter->fw_cap_ext & FW_CAPINFO_EXT_SEC_RG_POWER) +#define IS_FW_SUPPORT_RX_SW_INT(_adapter) \ + (_adapter->fw_cap_ext & FW_CAPINFO_EXT_RX_SW_INT) /** MrvlIEtypes_PrevBssid_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_PrevBssid_t { @@ -1511,8 +1503,6 @@ typedef enum _ENH_PS_MODES { #define HostCmd_ACT_MAC_STRICT_PROTECTION_ENABLE 0x0400 /** MAC action : Force 11n protection disable */ #define HostCmd_ACT_MAC_FORCE_11N_PROTECTION_OFF 0x0800 -/** MAC action : Ad-Hoc G protection on */ -#define HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON 0x2000 /** MAC action : Static-Dynamic BW enable */ #define HostCmd_ACT_MAC_STATIC_DYNAMIC_BW_ENABLE MBIT(16) /** MAC action : Dynamic BW */ @@ -1521,8 +1511,6 @@ typedef enum _ENH_PS_MODES { /* Define action or option for HostCmd_CMD_802_11_SCAN */ /** Scan type : BSS */ #define HostCmd_BSS_MODE_BSS 0x0001 -/** Scan type : IBSS */ -#define HostCmd_BSS_MODE_IBSS 0x0002 /** Scan type : Any */ #define HostCmd_BSS_MODE_ANY 0x0003 @@ -2302,12 +2290,6 @@ typedef MLAN_PACK_START struct _CfParamSet_t { t_u16 cfp_duration_remaining; } MLAN_PACK_END CfParamSet_t; -/** IbssParamSet_t */ -typedef MLAN_PACK_START struct _IbssParamSet_t { - /** ATIM window value */ - t_u16 atim_window; -} MLAN_PACK_END IbssParamSet_t; - /** MrvlIEtypes_SsParamSet_t */ typedef MLAN_PACK_START struct _MrvlIEtypes_SsParamSet_t { /** Header */ @@ -2316,8 +2298,6 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_SsParamSet_t { union { /** CF parameter set */ CfParamSet_t cf_param_set[1]; - /** IBSS parameter set */ - IbssParamSet_t ibss_param_set[1]; } cf_ibss; } MLAN_PACK_END MrvlIEtypes_SsParamSet_t; @@ -2868,8 +2848,7 @@ typedef MLAN_PACK_START struct __ps_param { t_u16 bcn_miss_timeout; /** local listen interval */ t_u16 local_listen_interval; - /** Adhoc awake period */ - t_u16 adhoc_wake_period; + t_u16 rsrvd; /** mode - (0x01 - firmware to automatically choose PS_POLL or NULL * mode, 0x02 - PS_POLL, 0x03 - NULL mode ) */ @@ -3162,13 +3141,15 @@ typedef MLAN_PACK_START struct _HostCmd_DS_MC_AGGR_CFG { * bit 0 MC aggregation * bit 1 packet expiry * bit 2 CTS2Self - * bit 3 CTS2Self duration offset*/ + * bit 3 CTS2Self duration offset + * bit 6 UC non aggregation*/ t_u8 enable_bitmap; /* 1 valid, 0 invalid * bit 0 MC aggregation * bit 1 packet expiry * bit 2 CTS2Self - * bit 3 CTS2Self duration offset*/ + * bit 3 CTS2Self duration offset + * bit 6 UC non aggregation*/ t_u8 mask_bitmap; /** CTS2Self duration offset */ t_u16 cts2self_offset; @@ -3340,88 +3321,6 @@ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_ASSOCIATE_RSP { IEEEtypes_AssocRsp_t assoc_rsp; } MLAN_PACK_END HostCmd_DS_802_11_ASSOCIATE_RSP; -/** HostCmd_DS_802_11_AD_HOC_START*/ -typedef MLAN_PACK_START struct _HostCmd_DS_802_11_AD_HOC_START { - /** AdHoc SSID */ - t_u8 ssid[MLAN_MAX_SSID_LENGTH]; - /** BSS mode */ - t_u8 bss_mode; - /** Beacon period */ - t_u16 beacon_period; - /** DTIM period */ - t_u8 dtim_period; - /** SS parameter set */ - IEEEtypes_SsParamSet_t ss_param_set; - /** PHY parameter set */ - IEEEtypes_PhyParamSet_t phy_param_set; - /** Reserved field */ - t_u16 reserved1; - /** Capability information */ - IEEEtypes_CapInfo_t cap; - /** Supported data rates */ - t_u8 DataRate[HOSTCMD_SUPPORTED_RATES]; -} MLAN_PACK_END HostCmd_DS_802_11_AD_HOC_START; - -/** HostCmd_CMD_802_11_AD_HOC_START response */ -typedef MLAN_PACK_START struct _HostCmd_DS_802_11_AD_HOC_START_RESULT { - /** Padding */ - t_u8 pad[3]; - /** AdHoc BSSID */ - t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; - /** Padding to sync with FW structure*/ - t_u8 pad2[2]; - /** Result */ - t_u8 result; -} MLAN_PACK_END HostCmd_DS_802_11_AD_HOC_START_RESULT; - -/** HostCmd_CMD_802_11_AD_HOC_START response */ -typedef MLAN_PACK_START struct _HostCmd_DS_802_11_AD_HOC_JOIN_RESULT { - /** Result */ - t_u8 result; -} MLAN_PACK_END HostCmd_DS_802_11_AD_HOC_JOIN_RESULT; - -/** AdHoc_BssDesc_t */ -typedef MLAN_PACK_START struct _AdHoc_BssDesc_t { - /** BSSID */ - t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; - /** SSID */ - t_u8 ssid[MLAN_MAX_SSID_LENGTH]; - /** BSS mode */ - t_u8 bss_mode; - /** Beacon period */ - t_u16 beacon_period; - /** DTIM period */ - t_u8 dtim_period; - /** Timestamp */ - t_u8 time_stamp[8]; - /** Local time */ - t_u8 local_time[8]; - /** PHY parameter set */ - IEEEtypes_PhyParamSet_t phy_param_set; - /** SS parameter set */ - IEEEtypes_SsParamSet_t ss_param_set; - /** Capability information */ - IEEEtypes_CapInfo_t cap; - /** Supported data rates */ - t_u8 data_rates[HOSTCMD_SUPPORTED_RATES]; - - /* - * DO NOT ADD ANY FIELDS TO THIS STRUCTURE. - * It is used in the Adhoc join command and will cause a - * binary layout mismatch with the firmware - */ -} MLAN_PACK_END AdHoc_BssDesc_t; - -/** HostCmd_DS_802_11_AD_HOC_JOIN */ -typedef MLAN_PACK_START struct _HostCmd_DS_802_11_AD_HOC_JOIN { - /** AdHoc BSS descriptor */ - AdHoc_BssDesc_t bss_descriptor; - /** Reserved field */ - t_u16 reserved1; - /** Reserved field */ - t_u16 reserved2; -} MLAN_PACK_END HostCmd_DS_802_11_AD_HOC_JOIN; - #if defined(SDIO) /** Interrupt Raising Edge */ #define INT_RASING_EDGE 0 @@ -4150,8 +4049,6 @@ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_RF_TX_POWER { /** Connection type infra */ #define CONNECTION_TYPE_INFRA 0 -/** Connection type adhoc */ -#define CONNECTION_TYPE_ADHOC 1 #ifdef WIFI_DIRECT_SUPPORT /** BSS Mode: WIFIDIRECT Client */ #define BSS_MODE_WIFIDIRECT_CLIENT 0 @@ -5506,22 +5403,6 @@ typedef MLAN_PACK_START struct _HostCmd_DS_802_11_RF_ANTENNA { t_u16 rx_antenna_mode; } MLAN_PACK_END HostCmd_DS_802_11_RF_ANTENNA; -/** HostCmd_DS_802_11_IBSS_STATUS */ -typedef MLAN_PACK_START struct _HostCmd_DS_802_11_IBSS_STATUS { - /** Action */ - t_u16 action; - /** Enable */ - t_u16 enable; - /** BSSID */ - t_u8 bssid[MLAN_MAC_ADDR_LENGTH]; - /** Beacon interval */ - t_u16 beacon_interval; - /** ATIM window interval */ - t_u16 atim_window; - /** User G rate protection */ - t_u16 use_g_rate_protect; -} MLAN_PACK_END HostCmd_DS_802_11_IBSS_STATUS; - /** HostCmd_DS_MGMT_IE_LIST_CFG */ typedef MLAN_PACK_START struct _HostCmd_DS_MGMT_IE_LIST { /** Action */ @@ -7873,14 +7754,6 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { HostCmd_DS_802_11_ASSOCIATE_RSP associate_rsp; /** Deauthenticate */ HostCmd_DS_802_11_DEAUTHENTICATE deauth; - /** Ad-Hoc start */ - HostCmd_DS_802_11_AD_HOC_START adhoc_start; - /** Ad-Hoc start result */ - HostCmd_DS_802_11_AD_HOC_START_RESULT adhoc_start_result; - /** Ad-Hoc join result */ - HostCmd_DS_802_11_AD_HOC_JOIN_RESULT adhoc_join_result; - /** Ad-Hoc join */ - HostCmd_DS_802_11_AD_HOC_JOIN adhoc_join; /** Domain information */ HostCmd_DS_802_11D_DOMAIN_INFO domain_info; /** Domain information response */ @@ -7936,8 +7809,6 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { HostCmd_DS_802_11_SUPPLICANT_PROFILE esupplicant_profile; /** Extended version */ HostCmd_DS_VERSION_EXT verext; - /** Adhoc Coalescing */ - HostCmd_DS_802_11_IBSS_STATUS ibss_coalescing; /** Mgmt IE list configuration */ HostCmd_DS_MGMT_IE_LIST_CFG mgmt_ie_list; /** TDLS configuration command */ @@ -8068,6 +7939,7 @@ typedef struct MLAN_PACK_START _HostCmd_DS_COMMAND { struct mfg_cmd_tx_frame2 mfg_tx_frame2; struct mfg_Cmd_HE_TBTx_t mfg_he_power; mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; + mfg_cmd_otp_mac_addr_rd_wr_t mfg_otp_mac_addr_rd_wr; HostCmd_DS_CMD_ARB_CONFIG arb_cfg; HostCmd_DS_CMD_DOT11MC_UNASSOC_FTM_CFG dot11mc_unassoc_ftm_cfg; HostCmd_DS_HAL_PHY_CFG hal_phy_cfg_params; @@ -8126,6 +7998,8 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Secure_Boot_Uuid_t { #define VDLL_IND_TYPE_ERR_ID 3 /** notify vdll download error: Secure error */ #define VDLL_IND_TYPE_SEC_ERR_ID 4 +/** req host side interface reset */ +#define VDLL_IND_TYPE_INTF_RESET 5 /** vdll indicate event structure */ typedef MLAN_PACK_START struct _vdll_ind { diff --git a/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h b/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h index aa104f6..aebb972 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_hostcmd_ids.h @@ -68,16 +68,10 @@ ENUM_ELEMENT(HostCmd_CMD_GET_HW_SPEC, 0x0003), ENUM_ELEMENT(HostCmd_CMD_802_11_DISASSOCIATE, 0x0026), /** Host Command ID : MAC control */ ENUM_ELEMENT(HostCmd_CMD_MAC_CONTROL, 0x0028), - /** Host Command ID : 802.11 Ad-Hoc start */ - ENUM_ELEMENT(HostCmd_CMD_802_11_AD_HOC_START, 0x002b), - /** Host Command ID : 802.11 Ad-Hoc join */ - ENUM_ELEMENT(HostCmd_CMD_802_11_AD_HOC_JOIN, 0x002c), /** 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), @@ -146,9 +140,6 @@ ENUM_ELEMENT(HostCmd_CMD_GET_HW_SPEC, 0x0003), /** Host Command ID : KEEP ALIVE command */ ENUM_ELEMENT(HostCmd_CMD_AUTO_TX, 0x0082), - /** Host Command ID : 802.11 IBSS coalescing status */ - ENUM_ELEMENT(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, 0x0083), - /** Host Command ID : Memory access */ ENUM_ELEMENT(HostCmd_CMD_MEM_ACCESS, 0x0086), @@ -461,6 +452,8 @@ ENUM_ELEMENT(HostCmd_CMD_GET_HW_SPEC, 0x0003), /** Host Command ID: Tx Frame */ ENUM_ELEMENT(HostCmd_CMD_802_11_TX_FRAME, 0x0283), + /** Host Command ID: PCIE ADMA INIT */ + ENUM_ELEMENT(HostCmd_CMD_PCIE_ADMA_INIT, 0x0284), /* 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 f238a01..cc0f8a0 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_ieee.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_ieee.h @@ -80,7 +80,6 @@ typedef MLAN_PACK_START enum _IEEEtypes_ElementId_e { DS_PARAM_SET = 3, CF_PARAM_SET = 4, - IBSS_PARAM_SET = 6, COUNTRY_INFO = 7, POWER_CONSTRAINT = 32, POWER_CAPABILITY = 33, @@ -89,7 +88,6 @@ typedef MLAN_PACK_START enum _IEEEtypes_ElementId_e { CHANNEL_SWITCH_ANN = 37, EXTEND_CHANNEL_SWITCH_ANN = 60, QUIET = 40, - IBSS_DFS = 41, MEASUREMENT_REQUEST = 38, MEASUREMENT_REPORT = 39, SUPPORTED_CHANNELS = 36, @@ -391,15 +389,14 @@ typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { t_u8 privacy : 1; t_u8 cf_poll_rqst : 1; t_u8 cf_pollable : 1; - t_u8 ibss : 1; + t_u8 rsrvd4 : 1; t_u8 ess : 1; } MLAN_PACK_END IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t; #else typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { /** Capability Bit Map : ESS */ t_u8 ess : 1; - /** Capability Bit Map : IBSS */ - t_u8 ibss : 1; + t_u8 rsrvd4 : 1; /** Capability Bit Map : CF pollable */ t_u8 cf_pollable : 1; /** Capability Bit Map : CF poll request */ @@ -455,22 +452,10 @@ typedef MLAN_PACK_START struct _IEEEtypes_CfParamSet_t { t_u16 cfp_duration_remaining; } MLAN_PACK_END IEEEtypes_CfParamSet_t, *pIEEEtypes_CfParamSet_t; -/** IEEEtypes_IbssParamSet_t */ -typedef MLAN_PACK_START struct _IEEEtypes_IbssParamSet_t { - /** Element ID */ - t_u8 element_id; - /** Length */ - t_u8 len; - /** ATIM window value in milliseconds */ - t_u16 atim_window; -} MLAN_PACK_END IEEEtypes_IbssParamSet_t, *pIEEEtypes_IbssParamSet_t; - /** IEEEtypes_SsParamSet_t */ typedef MLAN_PACK_START union _IEEEtypes_SsParamSet_t { /** SS parameter : CF parameter set */ IEEEtypes_CfParamSet_t cf_param_set; - /** SS parameter : IBSS parameter set */ - IEEEtypes_IbssParamSet_t ibss_param_set; } MLAN_PACK_END IEEEtypes_SsParamSet_t, *pIEEEtypes_SsParamSet_t; /** IEEEtypes_FhParamSet_t */ @@ -1492,8 +1477,6 @@ typedef MLAN_PACK_START struct { /** Maximum number of subbands in the IEEEtypes_SupportedChannels_t structure */ #define WLAN_11H_MAX_SUBBANDS 6 -/** Maximum number of DFS channels configured in IEEEtypes_IBSS_DFS_t */ -#define WLAN_11H_MAX_IBSS_DFS_CHANNELS 25 /** IEEE Power Constraint element (7.3.2.15) */ typedef MLAN_PACK_START struct { @@ -1642,24 +1625,6 @@ typedef MLAN_PACK_START struct { } MLAN_PACK_END IEEEtypes_ChannelMap_t; -/* IEEE IBSS DFS Element (7.3.2.24) */ -/** - * IBSS DFS element included in ad hoc beacons and probe responses. - * Provides information regarding the IBSS DFS Owner as well as the - * originating STAs supported channels and basic measurement results. - */ -typedef MLAN_PACK_START struct { - t_u8 element_id; /**< IEEE Element ID = 41 */ - t_u8 len; /**< Element length after id and len */ - t_u8 dfs_owner[MLAN_MAC_ADDR_LENGTH]; /**< DFS Owner STA Address */ - t_u8 dfs_recovery_interval; /**< DFS Recovery time in TBTTs */ - - /** Variable length map field, one Map entry for each supported channel - */ - IEEEtypes_ChannelMap_t channel_map[WLAN_11H_MAX_IBSS_DFS_CHANNELS]; - -} MLAN_PACK_END IEEEtypes_IBSS_DFS_t; - /* 802.11h BSS information kept for each BSSID received in scan results */ /** * IEEE BSS information needed from scan results for later processing in @@ -1676,7 +1641,6 @@ typedef struct { IEEEtypes_ChanSwitchAnn_t chan_switch_ann; /**< Channel Switch Announcement IE */ IEEEtypes_Quiet_t quiet; /**< Quiet IE */ - IEEEtypes_IBSS_DFS_t ibss_dfs; /**< IBSS DFS Element IE */ } wlan_11h_bss_info_t; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_init.c b/mxm_wifiex/wlan_src/mlan/mlan_init.c index 4aaac9d..bf7e6fb 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_init.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_init.c @@ -496,14 +496,8 @@ mlan_status wlan_init_priv(pmlan_private priv) #endif #ifdef UAP_SUPPORT priv->num_drop_pkts = 0; -#endif -#if defined(STA_SUPPORT) - priv->adhoc_state_prev = ADHOC_IDLE; - memset(pmadapter, &priv->adhoc_last_start_ssid, 0, - sizeof(priv->adhoc_last_start_ssid)); #endif priv->atim_window = 0; - priv->adhoc_state = ADHOC_IDLE; priv->tx_power_level = 0; priv->max_tx_power_level = 0; priv->min_tx_power_level = 0; @@ -582,8 +576,6 @@ mlan_status wlan_init_priv(pmlan_private priv) priv->addba_reject[i] = ADDBA_RSP_STATUS_ACCEPT; priv->addba_reject[6] = ADDBA_RSP_STATUS_REJECT; priv->addba_reject[7] = ADDBA_RSP_STATUS_REJECT; - memcpy_ext(priv->adapter, priv->ibss_addba_reject, priv->addba_reject, - sizeof(priv->addba_reject), sizeof(priv->ibss_addba_reject)); priv->max_amsdu = 0; #ifdef STA_SUPPORT if (priv->bss_type == MLAN_BSS_TYPE_STA) { @@ -943,7 +935,6 @@ t_void wlan_init_adapter(pmlan_adapter pmadapter) pmadapter->null_pkt_interval = 0; pmadapter->fw_bands = 0; pmadapter->config_bands = 0; - pmadapter->adhoc_start_band = 0; pmadapter->pscan_channels = MNULL; pmadapter->fw_release_number = 0; pmadapter->fw_cap_info = 0; @@ -1576,26 +1567,7 @@ static void wlan_update_hw_spec(pmlan_adapter pmadapter) BAND_AAC; } } - pmadapter->adhoc_start_band = BAND_A; - for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) - pmadapter->priv[i]->adhoc_channel = - DEFAULT_AD_HOC_CHANNEL_A; - } - } else if (pmadapter->fw_bands & BAND_G) { - pmadapter->adhoc_start_band = BAND_G | BAND_B; - for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) - pmadapter->priv[i]->adhoc_channel = - DEFAULT_AD_HOC_CHANNEL; - } - } else if (pmadapter->fw_bands & BAND_B) { - pmadapter->adhoc_start_band = BAND_B; - for (i = 0; i < pmadapter->priv_num; i++) { - if (pmadapter->priv[i]) - pmadapter->priv[i]->adhoc_channel = - DEFAULT_AD_HOC_CHANNEL; - } + } else { } #endif /* STA_SUPPORT */ for (i = 0; i < pmadapter->priv_num; i++) { @@ -2122,10 +2094,11 @@ mlan_status wlan_init_fw_complete(pmlan_adapter pmadapter) if (status == MLAN_STATUS_SUCCESS) { pmpriv = wlan_get_priv(pmadapter, MLAN_BSS_ROLE_STA); if (pmpriv) { - status = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_WMM_PARAM_CONFIG, - HostCmd_ACT_GEN_SET, 0, MNULL, - &pmadapter->ac_params); + status = + wlan_prepare_cmd(pmpriv, + HostCmd_CMD_WMM_PARAM_CONFIG, + HostCmd_ACT_GEN_SET_DEFAULT, 0, + MNULL, &pmadapter->ac_params); if (status != MLAN_STATUS_SUCCESS) PRINTM(MERROR, "ERR: wlan_prepare_cmd returned status=0x%x\n", diff --git a/mxm_wifiex/wlan_src/mlan/mlan_init.h b/mxm_wifiex/wlan_src/mlan/mlan_init.h index 65e8259..8d9bee3 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_init.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_init.h @@ -46,6 +46,8 @@ Change log: #define FW_CMD_7 0x00000007 /** CMD id for CMD10 */ #define FW_CMD_10 0x0000000a +/** CMD id for CMD21 */ +#define FW_CMD_21 0x00000015 /** Firmware data transmit size */ #define FW_DATA_XMIT_SIZE (sizeof(FWHeader) + DataLength + sizeof(t_u32)) diff --git a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h index fa0e679..024c93a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_ioctl.h @@ -205,7 +205,6 @@ enum _mlan_ioctl_req_id { MLAN_OID_11N_CFG_REJECT_ADDBA_REQ = 0x000C000D, MLAN_OID_11N_CFG_COEX_RX_WINSIZE = 0x000C000E, MLAN_OID_11N_CFG_TX_AGGR_CTRL = 0x000C000F, - MLAN_OID_11N_CFG_IBSS_AMPDU_PARAM = 0x000C0010, MLAN_OID_11N_CFG_MIN_BA_THRESHOLD = 0x000C0011, /* 802.11d Configuration Group */ @@ -381,6 +380,7 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_EDMAC_CONFIG = 0x00200093, MLAN_OID_MISC_GPIO_CFG = 0x00200094, MLAN_OID_MISC_REGION_POWER_CFG = 0x00200095, + MLAN_OID_MISC_OTP_MAC_RD_WR = 0x00200097, }; /** Sub command size */ @@ -403,9 +403,8 @@ enum _mlan_act_generic { MLAN_ACT_DISABLE = 0, MLAN_ACT_ENABLE = 1 }; /** Enumeration for scan mode */ enum _mlan_scan_mode { MLAN_SCAN_MODE_UNCHANGED = 0, - MLAN_SCAN_MODE_BSS, - MLAN_SCAN_MODE_IBSS, - MLAN_SCAN_MODE_ANY + MLAN_SCAN_MODE_BSS = 1, + MLAN_SCAN_MODE_ANY = 3 }; /** Enumeration for scan type */ @@ -633,8 +632,8 @@ typedef struct _mlan_ds_scan { /** Enumeration for BSS mode */ enum _mlan_bss_mode { MLAN_BSS_MODE_INFRA = 1, - MLAN_BSS_MODE_IBSS, - MLAN_BSS_MODE_AUTO + MLAN_BSS_MODE_IBSS = 2, + MLAN_BSS_MODE_AUTO = 3 }; /** Maximum key length */ @@ -1369,6 +1368,7 @@ typedef struct _mlan_ds_bss { /** STA info for MLAN_OID_UAP_ADD_STATION */ mlan_ds_sta_info sta_info; #endif + } param; } mlan_ds_bss, *pmlan_ds_bss; @@ -1425,10 +1425,6 @@ enum _mlan_band_def { typedef struct _mlan_ds_band_cfg { /** Infra band */ t_u32 config_bands; - /** Ad-hoc start band */ - t_u32 adhoc_start_band; - /** Ad-hoc start channel */ - t_u32 adhoc_channel; /** fw supported band */ t_u32 fw_bands; } mlan_ds_band_cfg; @@ -1560,13 +1556,6 @@ typedef struct _mlan_ds_snmp_mib { /** Status Information Group */ /*-----------------------------------------------------------------*/ /** Enumeration for ad-hoc status */ -enum _mlan_adhoc_status { - ADHOC_IDLE, - ADHOC_STARTED, - ADHOC_JOINED, - ADHOC_COALESCED, - ADHOC_STARTING -}; typedef struct _mlan_ds_get_stats_org { /** Statistics counter */ @@ -2205,8 +2194,6 @@ typedef struct _mlan_bss_info { t_s32 max_power_level; /** Min power level in dBm */ t_s32 min_power_level; - /** Adhoc state */ - t_u32 adhoc_state; /** NF of last beacon */ t_s32 bcn_nf_last; /** wep status */ @@ -3844,14 +3831,6 @@ typedef struct _mlan_ds_reject_addba_req { t_u32 conditions; } mlan_ds_reject_addba_req, *pmlan_ds_reject_addba_req; -/** Type definition of mlan_ds_ibss_ampdu_param */ -typedef struct _mlan_ds_ibss_ampdu_param { - /** ampdu priority table */ - t_u8 ampdu[MAX_NUM_TID]; - /** rx amdpdu setting */ - t_u8 addba_reject[MAX_NUM_TID]; -} mlan_ds_ibss_ampdu_param, *pmlan_ds_ibss_ampdu_param; - /** Type definition of mlan_ds_11n_cfg for MLAN_IOCTL_11N_CFG */ typedef struct _mlan_ds_11n_cfg { /** Sub-command */ @@ -3888,8 +3867,6 @@ typedef struct _mlan_ds_11n_cfg { t_u32 coex_rx_winsize; /** Control TX AMPDU configuration */ t_u32 txaggrctrl; - /** aggrprirotity table for MLAN_OID_11N_CFG_IBSS_AMPDU_PARAM */ - mlan_ds_ibss_ampdu_param ibss_ampdu; /** Minimum BA Threshold for MLAN_OID_11N_CFG_MIN_BA_THRESHOLD */ t_u8 min_ba_threshold; @@ -4034,6 +4011,7 @@ typedef struct _mlan_ds_11ax_cfg { #define MRVL_DOT11AX_ENABLE_SR_TLV_ID (PROPRIETARY_TLV_BASE_ID + 322) #define MRVL_DOT11AX_OBSS_PD_OFFSET_TLV_ID (PROPRIETARY_TLV_BASE_ID + 323) +#define NXP_6E_INBAND_FRAMES_TLV_ID (PROPRIETARY_TLV_BASE_ID + 345) // 0x0159 /** Type definition of mlan_11axcmdcfg_obss_pd_offset for MLAN_OID_11AX_CMD_CFG */ @@ -5789,6 +5767,8 @@ typedef struct _mlan_ds_misc_chan_trpc_cfg { #define MFG_CMD_RADIO_MODE_CFG 0x1211 #define MFG_CMD_CONFIG_MAC_HE_TB_TX 0x110A #define MFG_CMD_CONFIG_TRIGGER_FRAME 0x110C +#define MFG_CMD_OTP_MAC_ADD 0x108C + /** MFG CMD generic cfg */ struct MLAN_PACK_START mfg_cmd_generic_cfg { /** MFG command code */ @@ -6083,6 +6063,19 @@ typedef MLAN_PACK_START struct _mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t { mfg_cmd_IEEETypes_BasicHETrigUserInfo_t basic_trig_user_info; } MLAN_PACK_END mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t; +typedef MLAN_PACK_START struct _mfg_cmd_otp_mac_addr_rd_wr_t { + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** Destination MAC Address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END mfg_cmd_otp_mac_addr_rd_wr_t; + typedef struct _mlan_ds_misc_chnrgpwr_cfg { /** length */ t_u16 length; @@ -6108,13 +6101,15 @@ typedef struct _mlan_ds_mc_aggr_cfg { * bit 0 MC aggregation * bit 1 packet expiry * bit 2 CTS2Self - * bit 3 CTS2Self duration offset*/ + * bit 3 CTS2Self duration offset + * bit 6 UC non aggregation*/ t_u8 enable_bitmap; /* 1 valid, 0 invalid * bit 0 MC aggregation * bit 1 packet expiry * bit 2 CTS2Self - * bit 3 CTS2Self duration offset*/ + * bit 3 CTS2Self duration offset + * bit 6 UC non aggregation*/ t_u8 mask_bitmap; /** CTS2Self duration offset */ t_u16 cts2self_offset; @@ -6331,6 +6326,7 @@ typedef struct _mlan_ds_misc_cfg { struct mfg_cmd_tx_frame2 mfg_tx_frame2; struct mfg_Cmd_HE_TBTx_t mfg_he_power; mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; + mfg_cmd_otp_mac_addr_rd_wr_t mfg_otp_mac_addr_rd_wr; mlan_ds_misc_arb_cfg arb_cfg; mlan_ds_misc_cfp_tbl cfp; t_u8 range_ext_mode; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_join.c b/mxm_wifiex/wlan_src/mlan/mlan_join.c index 9537f06..65eba9b 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_join.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_join.c @@ -1642,7 +1642,7 @@ mlan_status wlan_ret_802_11_associate(mlan_private *pmpriv, 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, + pmpriv->curr_bss_params.attemp_bssid, MLAN_MAC_ADDR_LENGTH) && ((sub_type == SUBTYPE_ASSOC_RESP) || (sub_type == SUBTYPE_REASSOC_RESP))) { @@ -1916,778 +1916,6 @@ done: return ret; } -/** - * @brief This function prepares command of ad_hoc_start. - * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param pdata_buf A pointer cast of mlan_802_11_ssid structure - * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -mlan_status wlan_cmd_802_11_ad_hoc_start(mlan_private *pmpriv, - HostCmd_DS_COMMAND *cmd, - t_void *pdata_buf) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_adapter *pmadapter = pmpriv->adapter; - HostCmd_DS_802_11_AD_HOC_START *padhoc_start = &cmd->params.adhoc_start; - BSSDescriptor_t *pbss_desc; - t_u32 cmd_append_size = 0; - t_u32 i; - t_u16 tmp_cap; - MrvlIEtypes_ChanListParamSet_t *pchan_tlv; - - MrvlIEtypes_RsnParamSet_t *prsn_ie_tlv; - /* wpa ie for WPA_NONE AES */ - const t_u8 wpa_ie[24] = {0xdd, 0x16, 0x00, 0x50, 0xf2, 0x01, - 0x01, 0x00, 0x00, 0x50, 0xf2, 0x04, - 0x01, 0x00, 0x00, 0x50, 0xf2, 0x00, - 0x01, 0x00, 0x00, 0x50, 0xf2, 0x00}; - t_s32 append_size_11h = 0; - t_u8 *pos = - (t_u8 *)padhoc_start + sizeof(HostCmd_DS_802_11_AD_HOC_START); - - ENTER(); - - if (!pmadapter) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_START); - - pbss_desc = &pmpriv->curr_bss_params.bss_descriptor; - pmpriv->pattempted_bss_desc = pbss_desc; - - /* - * Fill in the parameters for 2 data structures: - * 1. HostCmd_DS_802_11_AD_HOC_START command - * 2. pbss_desc - * Driver will fill up SSID, bss_mode,IBSS param, Physical Param, - * probe delay, and Cap info. - * Firmware will fill up beacon period, Basic rates - * and operational rates. - */ - - memset(pmadapter, padhoc_start->ssid, 0, MLAN_MAX_SSID_LENGTH); - - memcpy_ext(pmadapter, padhoc_start->ssid, - ((mlan_802_11_ssid *)pdata_buf)->ssid, - ((mlan_802_11_ssid *)pdata_buf)->ssid_len, - MLAN_MAX_SSID_LENGTH); - - PRINTM(MINFO, "ADHOC_S_CMD: SSID = %s\n", padhoc_start->ssid); - - memset(pmadapter, pbss_desc->ssid.ssid, 0, MLAN_MAX_SSID_LENGTH); - memcpy_ext(pmadapter, pbss_desc->ssid.ssid, - ((mlan_802_11_ssid *)pdata_buf)->ssid, - ((mlan_802_11_ssid *)pdata_buf)->ssid_len, - MLAN_MAX_SSID_LENGTH); - - pbss_desc->ssid.ssid_len = - MIN(MLAN_MAX_SSID_LENGTH, - ((mlan_802_11_ssid *)pdata_buf)->ssid_len); - - /* Set the BSS mode */ - padhoc_start->bss_mode = HostCmd_BSS_MODE_IBSS; - pbss_desc->bss_mode = MLAN_BSS_MODE_IBSS; - padhoc_start->beacon_period = wlan_cpu_to_le16(pmpriv->beacon_period); - pbss_desc->beacon_period = pmpriv->beacon_period; - - /* Set Physical param set */ -/** Parameter IE Id */ -#define DS_PARA_IE_ID 3 -/** Parameter IE length */ -#define DS_PARA_IE_LEN 1 - - padhoc_start->phy_param_set.ds_param_set.element_id = DS_PARA_IE_ID; - padhoc_start->phy_param_set.ds_param_set.len = DS_PARA_IE_LEN; - - if (!wlan_get_cfp_by_band_and_channel( - pmadapter, pmadapter->adhoc_start_band, - (t_u16)pmpriv->adhoc_channel, pmadapter->region_channel)) { - chan_freq_power_t *cfp; - cfp = wlan_get_cfp_by_band_and_channel( - pmadapter, pmadapter->adhoc_start_band, - FIRST_VALID_CHANNEL, pmadapter->region_channel); - if (cfp) - pmpriv->adhoc_channel = (t_u8)cfp->channel; - } - - MASSERT(pmpriv->adhoc_channel); - - PRINTM(MINFO, "ADHOC_S_CMD: Creating ADHOC on Channel %d\n", - pmpriv->adhoc_channel); - - pmpriv->curr_bss_params.bss_descriptor.channel = pmpriv->adhoc_channel; - pmpriv->curr_bss_params.band = pmadapter->adhoc_start_band; - - pbss_desc->channel = pmpriv->adhoc_channel; - padhoc_start->phy_param_set.ds_param_set.current_chan = - pmpriv->adhoc_channel; - - memcpy_ext(pmadapter, &pbss_desc->phy_param_set, - &padhoc_start->phy_param_set, - sizeof(IEEEtypes_PhyParamSet_t), - sizeof(IEEEtypes_PhyParamSet_t)); - - pbss_desc->network_type_use = Wlan802_11DS; - - /* Set IBSS param set */ -/** IBSS parameter IE Id */ -#define IBSS_PARA_IE_ID 6 -/** IBSS parameter IE length */ -#define IBSS_PARA_IE_LEN 2 - - padhoc_start->ss_param_set.ibss_param_set.element_id = IBSS_PARA_IE_ID; - padhoc_start->ss_param_set.ibss_param_set.len = IBSS_PARA_IE_LEN; - padhoc_start->ss_param_set.ibss_param_set.atim_window = - wlan_cpu_to_le16(pmpriv->atim_window); - pbss_desc->atim_window = pmpriv->atim_window; - memcpy_ext(pmadapter, &pbss_desc->ss_param_set, - &padhoc_start->ss_param_set, sizeof(IEEEtypes_SsParamSet_t), - sizeof(IEEEtypes_SsParamSet_t)); - - /* Set Capability info */ - padhoc_start->cap.ess = 0; - padhoc_start->cap.ibss = 1; - pbss_desc->cap_info.ibss = 1; - - /* Set up privacy in pbss_desc */ - if (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled || - pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) { -/** Ad-Hoc capability privacy on */ -#define AD_HOC_CAP_PRIVACY_ON 1 - PRINTM(MINFO, "ADHOC_S_CMD: wep_status set, Privacy to WEP\n"); - pbss_desc->privacy = Wlan802_11PrivFilter8021xWEP; - padhoc_start->cap.privacy = AD_HOC_CAP_PRIVACY_ON; - } else { - PRINTM(MWARN, "ADHOC_S_CMD: wep_status NOT set, Setting " - "Privacy to ACCEPT ALL\n"); - pbss_desc->privacy = Wlan802_11PrivFilterAcceptAll; - } - - memset(pmadapter, padhoc_start->DataRate, 0, - sizeof(padhoc_start->DataRate)); - - if ((pmpriv->adapter->region_code == COUNTRY_CODE_JP_40 || - pmpriv->adapter->region_code == COUNTRY_CODE_JP_FF) && - (pbss_desc->phy_param_set.ds_param_set.current_chan == 14)) { - wlan_get_active_data_rates(pmpriv, pmpriv->bss_mode, BAND_B, - padhoc_start->DataRate); - } else { - wlan_get_active_data_rates(pmpriv, pmpriv->bss_mode, - pmadapter->adhoc_start_band, - padhoc_start->DataRate); - } - - if ((pmadapter->adhoc_start_band & BAND_G) && - (pmpriv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) { - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, 0, MNULL, - &pmpriv->curr_pkt_filter); - - if (ret) { - PRINTM(MERROR, - "ADHOC_S_CMD: G Protection config failed\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - } - /* Find the last non zero */ - for (i = 0; - i < sizeof(padhoc_start->DataRate) && padhoc_start->DataRate[i]; - i++) - /* XXX Do not delete no-operation line */ - ; - - pmpriv->curr_bss_params.num_of_rates = i; - - /* Copy the ad-hoc creating rates into Current BSS rate structure */ - memcpy_ext(pmadapter, &pmpriv->curr_bss_params.data_rates, - &padhoc_start->DataRate, - pmpriv->curr_bss_params.num_of_rates, WLAN_SUPPORTED_RATES); - - PRINTM(MINFO, "ADHOC_S_CMD: Rates=%02x %02x %02x %02x\n", - padhoc_start->DataRate[0], padhoc_start->DataRate[1], - padhoc_start->DataRate[2], padhoc_start->DataRate[3]); - - PRINTM(MINFO, "ADHOC_S_CMD: AD HOC Start command is ready\n"); - - if (IS_SUPPORT_MULTI_BANDS(pmadapter)) { - /* Append a channel TLV */ - pchan_tlv = (MrvlIEtypes_ChanListParamSet_t *)pos; - pchan_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_CHANLIST); - pchan_tlv->header.len = - wlan_cpu_to_le16(sizeof(ChanScanParamSet_t)); - - memset(pmadapter, pchan_tlv->chan_scan_param, 0x00, - sizeof(ChanScanParamSet_t)); - pchan_tlv->chan_scan_param[0].chan_number = - (t_u8)pmpriv->curr_bss_params.bss_descriptor.channel; - - PRINTM(MINFO, "ADHOC_S_CMD: TLV Chan = %d\n", - pchan_tlv->chan_scan_param[0].chan_number); - - pchan_tlv->chan_scan_param[0].bandcfg.chanBand = - wlan_band_to_radio_type(pmpriv->curr_bss_params.band); - PRINTM(MINFO, "ADHOC_S_CMD: TLV Bandcfg = %x\n", - pchan_tlv->chan_scan_param[0].bandcfg); - pos += sizeof(pchan_tlv->header) + sizeof(ChanScanParamSet_t); - cmd_append_size += - sizeof(pchan_tlv->header) + sizeof(ChanScanParamSet_t); - } - - if (wlan_11d_create_dnld_countryinfo(pmpriv, - pmpriv->curr_bss_params.band)) { - PRINTM(MERROR, "ADHOC_S_CMD: dnld_countryinfo_11d failed\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* - * Call 11h start API to add any 11h flags/elements as TLV parameters - */ - append_size_11h = - wlan_11h_process_start(pmpriv, &pos, &padhoc_start->cap, - pmpriv->adhoc_channel, - &pbss_desc->wlan_11h_bss_info); - if (append_size_11h >= 0) - cmd_append_size += append_size_11h; - else { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - if (pmpriv->sec_info.ewpa_enabled) { - memcpy_ext(pmadapter, pmpriv->wpa_ie, wpa_ie, sizeof(wpa_ie), - sizeof(pmpriv->wpa_ie)); - pmpriv->wpa_ie_len = sizeof(wpa_ie); - } - - if (pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) { - prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; - prsn_ie_tlv->header.type = (t_u16)pmpriv->wpa_ie[0]; - /* WPA_IE or RSN_IE */ - prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; - prsn_ie_tlv->header.type = - wlan_cpu_to_le16(prsn_ie_tlv->header.type); - prsn_ie_tlv->header.len = (t_u16)pmpriv->wpa_ie[1]; - prsn_ie_tlv->header.len = prsn_ie_tlv->header.len & 0x00FF; - if (prsn_ie_tlv->header.len <= (sizeof(pmpriv->wpa_ie) - 2)) - memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, - &pmpriv->wpa_ie[2], prsn_ie_tlv->header.len, - prsn_ie_tlv->header.len); - else { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - DBG_HEXDUMP(MCMD_D, "ADHOC_S_CMD: RSN IE", (t_u8 *)prsn_ie_tlv, - sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); - pos += sizeof(prsn_ie_tlv->header) + prsn_ie_tlv->header.len; - cmd_append_size += - sizeof(prsn_ie_tlv->header) + prsn_ie_tlv->header.len; - prsn_ie_tlv->header.len = - 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)); - - memcpy_ext(pmadapter, &tmp_cap, &padhoc_start->cap, sizeof(t_u16), - sizeof(tmp_cap)); - - if (pmadapter->adhoc_start_band == BAND_B) - SHORT_SLOT_TIME_DISABLED(tmp_cap); - else - SHORT_SLOT_TIME_ENABLED(tmp_cap); - - tmp_cap = wlan_cpu_to_le16(tmp_cap); - memcpy_ext(pmadapter, &padhoc_start->cap, &tmp_cap, sizeof(t_u16), - sizeof(padhoc_start->cap)); - - ret = MLAN_STATUS_SUCCESS; -done: - LEAVE(); - return ret; -} - -/** - * @brief This function prepares command of ad_hoc_join. - * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * @param pdata_buf Void cast of BSSDescriptor_t from the - * scan table to join - * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -mlan_status wlan_cmd_802_11_ad_hoc_join(mlan_private *pmpriv, - HostCmd_DS_COMMAND *cmd, - t_void *pdata_buf) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_adapter *pmadapter = pmpriv->adapter; - HostCmd_DS_802_11_AD_HOC_JOIN *padhoc_join = &cmd->params.adhoc_join; - BSSDescriptor_t *pbss_desc = (BSSDescriptor_t *)pdata_buf; - MrvlIEtypes_ChanListParamSet_t *pchan_tlv; - MrvlIEtypes_RsnParamSet_t *prsn_ie_tlv; - t_u32 cmd_append_size = 0; - t_u16 tmp_cap; - t_u32 i, rates_size = 0; - t_u32 curr_pkt_filter; - t_u8 *pos = (t_u8 *)padhoc_join + sizeof(HostCmd_DS_802_11_AD_HOC_JOIN); - t_s32 append_size_11h = 0; - - ENTER(); - -/** Use G protection */ -#define USE_G_PROTECTION 0x02 - if (pbss_desc->erp_flags & USE_G_PROTECTION) { - curr_pkt_filter = pmpriv->curr_pkt_filter | - HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; - - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MAC_CONTROL, - HostCmd_ACT_GEN_SET, 0, MNULL, - &curr_pkt_filter); - if (ret) { - PRINTM(MERROR, - "ADHOC_J_CMD: G Protection config failed\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - } - - pmpriv->pattempted_bss_desc = pbss_desc; - - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_JOIN); - - padhoc_join->bss_descriptor.bss_mode = HostCmd_BSS_MODE_IBSS; - - padhoc_join->bss_descriptor.beacon_period = - wlan_cpu_to_le16(pbss_desc->beacon_period); - - memcpy_ext(pmadapter, &padhoc_join->bss_descriptor.bssid, - &pbss_desc->mac_address, MLAN_MAC_ADDR_LENGTH, - MLAN_MAC_ADDR_LENGTH); - - memcpy_ext(pmadapter, &padhoc_join->bss_descriptor.ssid, - &pbss_desc->ssid.ssid, pbss_desc->ssid.ssid_len, - MLAN_MAX_SSID_LENGTH); - - memcpy_ext(pmadapter, &padhoc_join->bss_descriptor.phy_param_set, - &pbss_desc->phy_param_set, sizeof(IEEEtypes_PhyParamSet_t), - sizeof(IEEEtypes_PhyParamSet_t)); - - padhoc_join->bss_descriptor.phy_param_set.fh_param_set.dwell_time = - wlan_cpu_to_le16(padhoc_join->bss_descriptor.phy_param_set - .fh_param_set.dwell_time); - - memcpy_ext(pmadapter, &padhoc_join->bss_descriptor.ss_param_set, - &pbss_desc->ss_param_set, sizeof(IEEEtypes_SsParamSet_t), - sizeof(IEEEtypes_SsParamSet_t)); - padhoc_join->bss_descriptor.ss_param_set.ibss_param_set.atim_window = 0; - padhoc_join->bss_descriptor.ss_param_set.ibss_param_set.atim_window = - wlan_cpu_to_le16(padhoc_join->bss_descriptor.ss_param_set - .ibss_param_set.atim_window); - - memcpy_ext(pmadapter, &tmp_cap, &pbss_desc->cap_info, - sizeof(IEEEtypes_CapInfo_t), sizeof(IEEEtypes_CapInfo_t)); - - tmp_cap &= CAPINFO_MASK; - - PRINTM(MINFO, "ADHOC_J_CMD: tmp_cap=%4X CAPINFO_MASK=%4lX\n", tmp_cap, - CAPINFO_MASK); - memcpy_ext(pmadapter, &padhoc_join->bss_descriptor.cap, &tmp_cap, - sizeof(IEEEtypes_CapInfo_t), sizeof(IEEEtypes_CapInfo_t)); - - /* Information on BSSID descriptor passed to FW */ - PRINTM(MINFO, "ADHOC_J_CMD: BSSID = " MACSTR ", SSID = %s\n", - MAC2STR(padhoc_join->bss_descriptor.bssid), - padhoc_join->bss_descriptor.ssid); - - for (i = 0; i < WLAN_SUPPORTED_RATES && pbss_desc->supported_rates[i]; - i++) - /* XXX Do not delete no-operation line */ - ; - rates_size = i; - - /* Copy Data Rates from the Rates recorded in scan response */ - memset(pmadapter, padhoc_join->bss_descriptor.data_rates, 0, - sizeof(padhoc_join->bss_descriptor.data_rates)); - memcpy_ext(pmadapter, padhoc_join->bss_descriptor.data_rates, - pbss_desc->supported_rates, rates_size, - WLAN_SUPPORTED_RATES); - - HEXDUMP("Adapted Rates:", padhoc_join->bss_descriptor.data_rates, - rates_size); - - /* Copy the adhoc join rates into Current BSS state structure */ - pmpriv->curr_bss_params.num_of_rates = rates_size; - memcpy_ext(pmadapter, &pmpriv->curr_bss_params.data_rates, - pbss_desc->supported_rates, rates_size, - WLAN_SUPPORTED_RATES); - - /* Copy the channel information */ - pmpriv->curr_bss_params.bss_descriptor.channel = pbss_desc->channel; - pmpriv->curr_bss_params.band = pbss_desc->bss_band; - - if (pmpriv->sec_info.wep_status == Wlan802_11WEPEnabled || - pmpriv->sec_info.wpa_enabled || pmpriv->sec_info.ewpa_enabled) - padhoc_join->bss_descriptor.cap.privacy = AD_HOC_CAP_PRIVACY_ON; - - if (IS_SUPPORT_MULTI_BANDS(pmadapter)) { - /* Append a channel TLV */ - pchan_tlv = (MrvlIEtypes_ChanListParamSet_t *)pos; - pchan_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_CHANLIST); - pchan_tlv->header.len = - wlan_cpu_to_le16(sizeof(ChanScanParamSet_t)); - - memset(pmadapter, pchan_tlv->chan_scan_param, 0x00, - sizeof(ChanScanParamSet_t)); - pchan_tlv->chan_scan_param[0].chan_number = - (pbss_desc->phy_param_set.ds_param_set.current_chan); - PRINTM(MINFO, "ADHOC_J_CMD: TLV Chan = %d\n", - pchan_tlv->chan_scan_param[0].chan_number); - - pchan_tlv->chan_scan_param[0].bandcfg.chanBand = - wlan_band_to_radio_type(pbss_desc->bss_band); - - PRINTM(MINFO, "ADHOC_J_CMD: TLV Bandcfg = %x\n", - pchan_tlv->chan_scan_param[0].bandcfg); - pos += sizeof(pchan_tlv->header) + sizeof(ChanScanParamSet_t); - cmd_append_size += - sizeof(pchan_tlv->header) + sizeof(ChanScanParamSet_t); - } - - if (wlan_11d_create_dnld_countryinfo(pmpriv, pbss_desc->bss_band)) { - PRINTM(MERROR, "Dnld_countryinfo_11d failed\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - if (wlan_11d_parse_dnld_countryinfo(pmpriv, - pmpriv->pattempted_bss_desc)) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* - * Call 11h join API after capability bits are set so - * adhoc/infra 11h behavior can be properly triggered. - * pos modified if data is appended - */ - append_size_11h += - wlan_11h_process_join(pmpriv, &pos, - &padhoc_join->bss_descriptor.cap, - pbss_desc->bss_band, pbss_desc->channel, - &pbss_desc->wlan_11h_bss_info); - if (append_size_11h >= 0) - cmd_append_size += append_size_11h; - else { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - if (pmpriv->sec_info.wpa_enabled) { - prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; - /* WPA_IE or RSN_IE */ - prsn_ie_tlv->header.type = (t_u16)pmpriv->wpa_ie[0]; - prsn_ie_tlv->header.type = prsn_ie_tlv->header.type & 0x00FF; - prsn_ie_tlv->header.type = - wlan_cpu_to_le16(prsn_ie_tlv->header.type); - prsn_ie_tlv->header.len = (t_u16)pmpriv->wpa_ie[1]; - prsn_ie_tlv->header.len = prsn_ie_tlv->header.len & 0x00FF; - if (prsn_ie_tlv->header.len <= (sizeof(pmpriv->wpa_ie) - 2)) - memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, - &pmpriv->wpa_ie[2], prsn_ie_tlv->header.len, - prsn_ie_tlv->header.len); - else { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - HEXDUMP("ADHOC_JOIN: RSN IE", (t_u8 *)prsn_ie_tlv, - sizeof(prsn_ie_tlv->header) + prsn_ie_tlv->header.len); - pos += sizeof(prsn_ie_tlv->header) + prsn_ie_tlv->header.len; - cmd_append_size += - sizeof(prsn_ie_tlv->header) + prsn_ie_tlv->header.len; - prsn_ie_tlv->header.len = - wlan_cpu_to_le16(prsn_ie_tlv->header.len); - } else if (pmpriv->sec_info.ewpa_enabled) { - prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; - if (pbss_desc->pwpa_ie) { - prsn_ie_tlv->header.type = - (t_u16)(*(pbss_desc->pwpa_ie)) - .vend_hdr.element_id; - prsn_ie_tlv->header.type = - prsn_ie_tlv->header.type & 0x00FF; - prsn_ie_tlv->header.type = - wlan_cpu_to_le16(prsn_ie_tlv->header.type); - prsn_ie_tlv->header.len = - (t_u16)(*(pbss_desc->pwpa_ie)).vend_hdr.len; - prsn_ie_tlv->header.len = - prsn_ie_tlv->header.len & 0x00FF; - if (prsn_ie_tlv->header.len <= - (sizeof(pmpriv->wpa_ie))) { - memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, - &((*(pbss_desc->pwpa_ie)) - .vend_hdr.oui[0]), - prsn_ie_tlv->header.len, - prsn_ie_tlv->header.len); - } else { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - HEXDUMP("ADHOC_JOIN: RSN IE", (t_u8 *)prsn_ie_tlv, - sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); - pos += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; - cmd_append_size += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; - prsn_ie_tlv->header.len = - wlan_cpu_to_le16(prsn_ie_tlv->header.len); - } - if (pbss_desc->prsn_ie) { - prsn_ie_tlv = (MrvlIEtypes_RsnParamSet_t *)pos; - prsn_ie_tlv->header.type = - (t_u16)(*(pbss_desc->prsn_ie)) - .ieee_hdr.element_id; - prsn_ie_tlv->header.type = - prsn_ie_tlv->header.type & 0x00FF; - prsn_ie_tlv->header.type = - wlan_cpu_to_le16(prsn_ie_tlv->header.type); - prsn_ie_tlv->header.len = - (t_u16)(*(pbss_desc->prsn_ie)).ieee_hdr.len; - prsn_ie_tlv->header.len = - prsn_ie_tlv->header.len & 0x00FF; - if (prsn_ie_tlv->header.len <= - (sizeof(pmpriv->wpa_ie))) { - memcpy_ext(pmadapter, prsn_ie_tlv->rsn_ie, - &((*(pbss_desc->prsn_ie)).data[0]), - prsn_ie_tlv->header.len, - prsn_ie_tlv->header.len); - } else { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - HEXDUMP("ADHOC_JOIN: RSN IE", (t_u8 *)prsn_ie_tlv, - sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len); - pos += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; - cmd_append_size += sizeof(prsn_ie_tlv->header) + - prsn_ie_tlv->header.len; - prsn_ie_tlv->header.len = - 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_JOIN) + S_DS_GEN + - cmd_append_size)); - - memcpy_ext(pmadapter, &tmp_cap, &padhoc_join->bss_descriptor.cap, - sizeof(IEEEtypes_CapInfo_t), sizeof(IEEEtypes_CapInfo_t)); - tmp_cap = wlan_cpu_to_le16(tmp_cap); - - memcpy_ext(pmadapter, &padhoc_join->bss_descriptor.cap, &tmp_cap, - sizeof(IEEEtypes_CapInfo_t), sizeof(IEEEtypes_CapInfo_t)); - -done: - LEAVE(); - return ret; -} - -/** - * @brief This function handles the command response of ad_hoc_start and - * ad_hoc_join - * - * @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 or MLAN_STATUS_FAILURE - */ -mlan_status wlan_ret_802_11_ad_hoc(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, t_void *pioctl_buf) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_ioctl_req *pioctl_req = (mlan_ioctl_req *)pioctl_buf; - HostCmd_DS_802_11_AD_HOC_START_RESULT *padhoc_start_result = - &resp->params.adhoc_start_result; - HostCmd_DS_802_11_AD_HOC_JOIN_RESULT *padhoc_join_result = - &resp->params.adhoc_join_result; - BSSDescriptor_t *pbss_desc; - t_u16 command = resp->command; - t_u8 result = 0; - t_u8 event_buf[100]; - mlan_event *pevent = (mlan_event *)event_buf; - int ie_len = 0; - IEEEtypes_WmmParameter_t *pwmm_param_ie = MNULL; - mlan_adapter *pmadapter = pmpriv->adapter; - const t_u8 wmm_oui[4] = {0x00, 0x50, 0xf2, 0x02}; - - ENTER(); - - pmpriv->wmm_enabled = MFALSE; - if (command == HostCmd_CMD_802_11_AD_HOC_START) { - result = padhoc_start_result->result; - ie_len = resp->size - - (sizeof(HostCmd_DS_802_11_AD_HOC_START_RESULT) + - S_DS_GEN); - pwmm_param_ie = - (IEEEtypes_WmmParameter_t - *)((t_u8 *)resp + - (sizeof(HostCmd_DS_802_11_AD_HOC_START_RESULT) + - S_DS_GEN)); - } else { - result = padhoc_join_result->result; - ie_len = resp->size - - (sizeof(HostCmd_DS_802_11_AD_HOC_JOIN_RESULT) + - S_DS_GEN); - pwmm_param_ie = - (IEEEtypes_WmmParameter_t - *)((t_u8 *)resp + - (sizeof(HostCmd_DS_802_11_AD_HOC_JOIN_RESULT) + - S_DS_GEN)); - } - - pbss_desc = pmpriv->pattempted_bss_desc; - - /* - * Join result code 0 --> SUCCESS - */ - if (result) { - PRINTM(MERROR, "ADHOC_RESP Failed 0x%x\n", result); - if (pmpriv->media_connected == MTRUE) - wlan_reset_connect_state(pmpriv, MTRUE); - if (pmpriv->adhoc_state == ADHOC_STARTING) - pmpriv->adhoc_state = ADHOC_IDLE; - - memset(pmpriv->adapter, &pmpriv->curr_bss_params.bss_descriptor, - 0x00, sizeof(BSSDescriptor_t)); - - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Send a Media Connected event, according to the Spec */ - pmpriv->media_connected = MTRUE; - - if (command == HostCmd_CMD_802_11_AD_HOC_START) { - PRINTM(MINFO, "ADHOC_S_RESP %s\n", pbss_desc->ssid.ssid); - - /* Update the created network descriptor with the new BSSID */ - memcpy_ext(pmpriv->adapter, pbss_desc->mac_address, - padhoc_start_result->bssid, MLAN_MAC_ADDR_LENGTH, - MLAN_MAC_ADDR_LENGTH); - - pmpriv->adhoc_state = ADHOC_STARTED; - if (pmpriv->adapter->state_rdh.stage == RDH_RESTART_INTFS) - wlan_11h_radar_detected_callback((t_void *)pmpriv); - } else { - /* - * Now the join cmd should be successful. - * If BSSID has changed use SSID to compare instead of BSSID - */ - PRINTM(MINFO, "ADHOC_J_RESP %s\n", pbss_desc->ssid.ssid); - - /* - * Make a copy of current BSSID descriptor, only needed - * for join since the current descriptor is already - * being used for adhoc start - */ - memcpy_ext(pmpriv->adapter, - &pmpriv->curr_bss_params.bss_descriptor, pbss_desc, - sizeof(BSSDescriptor_t), sizeof(BSSDescriptor_t)); - - pmpriv->adhoc_state = ADHOC_JOINED; - } - - /** process wmm ie */ - if (ie_len >= (int)sizeof(IEEEtypes_VendorHeader_t)) { - if ((pwmm_param_ie->vend_hdr.element_id == - VENDOR_SPECIFIC_221) && - !memcmp(pmadapter, pwmm_param_ie->vend_hdr.oui, wmm_oui, - sizeof(wmm_oui)) && - (pwmm_param_ie->vend_hdr.len + 2 == ie_len)) { - DBG_HEXDUMP(MCMD_D, "WMM Param", (t_u8 *)pwmm_param_ie, - ie_len); - memcpy_ext(pmpriv->adapter, - (t_u8 *)&pmpriv->curr_bss_params - .bss_descriptor.wmm_ie, - pwmm_param_ie, - (pwmm_param_ie->vend_hdr.len + 2), - sizeof(IEEEtypes_WmmParameter_t)); - pmpriv->wmm_enabled = MTRUE; - wlan_wmm_setup_queue_priorities(pmpriv, pwmm_param_ie); - wlan_wmm_setup_ac_downgrade(pmpriv); - } - } - /* Since WMM is not enabled, setup the queues with the defaults */ - if (!pmpriv->wmm_enabled) - wlan_wmm_setup_queues(pmpriv); - - PRINTM(MINFO, "ADHOC_RESP: Channel = %d\n", pmpriv->adhoc_channel); - PRINTM(MINFO, "ADHOC_RESP: BSSID = " MACSTR "\n", - MAC2STR(pmpriv->curr_bss_params.bss_descriptor.mac_address)); - - pevent->bss_index = pmpriv->bss_index; - pevent->event_id = MLAN_EVENT_ID_DRV_CONNECTED; - pevent->event_len = MLAN_MAC_ADDR_LENGTH; - memcpy_ext(pmpriv->adapter, (t_u8 *)pevent->event_buf, - (t_u8 *)pmpriv->curr_bss_params.bss_descriptor.mac_address, - MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); - wlan_recv_event(pmpriv, MLAN_EVENT_ID_DRV_CONNECTED, pevent); - wlan_save_curr_bcn(pmpriv); - -done: - /* Need to indicate IOCTL complete */ - if (pioctl_req != MNULL) { - if (ret != MLAN_STATUS_SUCCESS) - pioctl_req->status_code = MLAN_ERROR_CMD_ASSOC_FAIL; - else - pioctl_req->status_code = MLAN_ERROR_NO_ERROR; - } - - LEAVE(); - return ret; -} - /** * @brief Associated to a specific BSS discovered in a scan * @@ -2731,117 +1959,6 @@ mlan_status wlan_associate(mlan_private *pmpriv, t_void *pioctl_buf, return ret; } -/** - * @brief Start an Adhoc Network - * - * @param pmpriv A pointer to mlan_private structure - * @param pioctl_buf A pointer to MLAN IOCTL Request buffer - * @param padhoc_ssid The ssid of the Adhoc Network - * - * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail - */ -mlan_status wlan_adhoc_start(mlan_private *pmpriv, t_void *pioctl_buf, - mlan_802_11_ssid *padhoc_ssid) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - wlan_meas_state_t *pmeas_state = &pmpriv->adapter->state_meas; - t_u8 radar = MFALSE; - pmlan_ioctl_req pioctl_req = (mlan_ioctl_req *)pioctl_buf; - - ENTER(); - - /* - * If the report indicates no measurement was done, leave the default - * return value alone. - */ - if (!pmeas_state->meas_rpt_returned.rpt.basic.map.unmeasured) { - radar = pmeas_state->meas_rpt_returned.rpt.basic.map.radar ? - MTRUE : - MFALSE; - } - - if (radar) { - if (pioctl_req) - pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; - ret = MLAN_STATUS_FAILURE; - LEAVE(); - return ret; - } - - PRINTM(MINFO, "Adhoc Channel = %d\n", pmpriv->adhoc_channel); - PRINTM(MINFO, "curr_bss_params.channel = %d\n", - pmpriv->curr_bss_params.bss_descriptor.channel); - PRINTM(MINFO, "curr_bss_params.band = %d\n", - pmpriv->curr_bss_params.band); - - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_AD_HOC_START, - HostCmd_ACT_GEN_SET, 0, pioctl_buf, padhoc_ssid); -#if defined(STA_SUPPORT) - if (ret == MLAN_STATUS_SUCCESS) - memcpy_ext(pmpriv->adapter, &pmpriv->adhoc_last_start_ssid, - padhoc_ssid, sizeof(mlan_802_11_ssid), - sizeof(mlan_802_11_ssid)); -#endif - - LEAVE(); - return ret; -} - -/** - * @brief Join an adhoc network found in a previous scan - * - * @param pmpriv A pointer to mlan_private structure - * @param pioctl_buf A pointer to MLAN IOCTL Request buffer - * @param pbss_desc A pointer to the BSS descriptor found in a previous - * scan to attempt to join - * - * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail - */ -mlan_status wlan_adhoc_join(mlan_private *pmpriv, t_void *pioctl_buf, - BSSDescriptor_t *pbss_desc) -{ - pmlan_adapter pmadapter = pmpriv->adapter; - mlan_status ret = MLAN_STATUS_SUCCESS; - pmlan_ioctl_req pioctl_req = (mlan_ioctl_req *)pioctl_buf; - - ENTER(); - - PRINTM(MINFO, "wlan_adhoc_join: CurBss.ssid =%s\n", - pmpriv->curr_bss_params.bss_descriptor.ssid.ssid); - PRINTM(MINFO, "wlan_adhoc_join: CurBss.ssid_len =%u\n", - pmpriv->curr_bss_params.bss_descriptor.ssid.ssid_len); - PRINTM(MINFO, "wlan_adhoc_join: ssid =%s\n", pbss_desc->ssid.ssid); - PRINTM(MINFO, "wlan_adhoc_join: ssid len =%u\n", - pbss_desc->ssid.ssid_len); - - /* Check if the requested SSID is already joined */ - if (pmpriv->curr_bss_params.bss_descriptor.ssid.ssid_len && - !wlan_ssid_cmp(pmadapter, &pbss_desc->ssid, - &pmpriv->curr_bss_params.bss_descriptor.ssid) && - (pmpriv->curr_bss_params.bss_descriptor.bss_mode == - MLAN_BSS_MODE_IBSS)) { - PRINTM(MINFO, - "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " - "not attempting to re-join\n"); - - if (pioctl_req) - pioctl_req->status_code = MLAN_ERROR_IOCTL_INVALID; - LEAVE(); - return MLAN_STATUS_FAILURE; - } - - PRINTM(MINFO, "curr_bss_params.channel = %d\n", - pmpriv->curr_bss_params.bss_descriptor.channel); - PRINTM(MINFO, "curr_bss_params.band = %d\n", - pmpriv->curr_bss_params.band); - - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_AD_HOC_JOIN, - HostCmd_ACT_GEN_SET, 0, pioctl_buf, pbss_desc); - - LEAVE(); - return ret; -} - /** * @brief Send Deauthentication Request or Stop the AdHoc network depending on * mode @@ -2867,6 +1984,7 @@ mlan_status wlan_disconnect(mlan_private *pmpriv, mlan_ioctl_req *pioctl_req, memcpy_ext(pmpriv->adapter, &local_param, deauth_param, sizeof(*deauth_param), sizeof(local_param)); if (pmpriv->media_connected == MTRUE) { + wlan_clean_txrx(pmpriv); if (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) { if (!deauth_param || !memcmp(pmpriv->adapter, deauth_param->mac_addr, @@ -2893,15 +2011,6 @@ mlan_status wlan_disconnect(mlan_private *pmpriv, mlan_ioctl_req *pioctl_req, if (ret == MLAN_STATUS_SUCCESS && pioctl_req) ret = MLAN_STATUS_PENDING; - - } else if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) { - ret = wlan_prepare_cmd(pmpriv, - HostCmd_CMD_802_11_AD_HOC_STOP, - HostCmd_ACT_GEN_SET, 0, - (t_void *)pioctl_req, MNULL); - - if (ret == MLAN_STATUS_SUCCESS && pioctl_req) - ret = MLAN_STATUS_PENDING; } } diff --git a/mxm_wifiex/wlan_src/mlan/mlan_main.h b/mxm_wifiex/wlan_src/mlan/mlan_main.h index b88cd01..6c1e1bb 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_main.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_main.h @@ -1176,18 +1176,6 @@ typedef struct _mlan_private { /** ATIM window */ t_u16 atim_window; - /** AdHoc channel */ - t_u8 adhoc_channel; - /** AdHoc link sensed flag */ - t_u8 adhoc_is_link_sensed; - /** AdHoc operating state */ - t_u8 adhoc_state; -#if defined(STA_SUPPORT) - /** AdHoc operating state backup */ - t_u8 adhoc_state_prev; - /** AdHoc previous ssid used for Start */ - mlan_802_11_ssid adhoc_last_start_ssid; -#endif mlan_ds_11h_chan_rep_req chan_rep_req; /** FSM variable for 11d support */ wlan_802_11d_state_t state_11d; @@ -1276,10 +1264,6 @@ typedef struct _mlan_private { tx_aggr_t aggr_prio_tbl[MAX_NUM_TID]; /** Pointer to the priorities for AMSDU/AMPDU table*/ t_u8 addba_reject[MAX_NUM_TID]; - /** Pointer to the priorities for AMSDU/AMPDU table*/ - t_u8 ibss_ampdu[MAX_NUM_TID]; - /** Pointer to the priorities for AMSDU/AMPDU table*/ - t_u8 ibss_addba_reject[MAX_NUM_TID]; /** Struct to store ADDBA parameters */ add_ba_param_t add_ba_param; /** user rx_win_size */ @@ -1948,6 +1932,10 @@ typedef struct _mlan_init_para { #endif t_u8 ext_scan; t_u8 mcs32; + /** antcfg */ + t_u32 antcfg; + /** dmcs*/ + t_u8 dmcs; } mlan_init_para, *pmlan_init_para; #ifdef SDIO @@ -2199,7 +2187,7 @@ typedef struct _mlan_pcie_card { /** rx interrupt pending */ t_u8 rx_pending; /** pending num of tx ring buffer in firmware */ - t_u8 txbd_pending; + t_u16 txbd_pending; /** Write pointer for TXBD ring */ t_u32 txbd_wrptr; /** Shadow copy of TXBD read pointer */ @@ -2336,6 +2324,8 @@ typedef struct _adapter_operations { mlan_status (*disable_host_int)(mlan_adapter *pmadapter); /** enable host interrupt */ mlan_status (*enable_host_int)(mlan_adapter *pmadapter); + /** select host interrupt */ + mlan_status (*select_host_int)(mlan_adapter *pmadapter); /**Interface header length*/ t_u32 intf_header_len; } mlan_adapter_operations; @@ -2660,8 +2650,6 @@ struct _mlan_adapter { /** F/W supported bands */ t_u16 fw_bands; - /** User selected band to start adhoc network */ - t_u16 adhoc_start_band; /** User selected bands */ t_u16 config_bands; /** Pointer to channel list last sent to the firmware for scanning */ @@ -3053,6 +3041,8 @@ mlan_status wlan_misc_ssu(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); #endif mlan_status wlan_misc_csi(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); +mlan_status wlan_cmd_csi(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 cmd_action, t_u16 *pdata_buf); mlan_status wlan_process_csi_event(pmlan_private pmpriv); mlan_status wlan_misc_hal_phy_cfg(pmlan_adapter pmadapter, @@ -3222,6 +3212,7 @@ t_u8 wlan_check_last_packet_indication(pmlan_private priv); #define MOAL_ALLOC_MLAN_BUFFER MBIT(0) #define MOAL_MALLOC_BUFFER MBIT(1) #define MOAL_MEM_FLAG_ATOMIC MBIT(2) +#define MOAL_MEM_FLAG_DIRTY MBIT(3) #ifdef PCIE /* This defines the direction arg to the DMA mapping routines. */ @@ -3376,6 +3367,7 @@ mlan_status wlan_radio_ioctl_radio_ctl(pmlan_adapter pmadapter, mlan_status wlan_radio_ioctl_ant_cfg(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req); +mlan_status wlan_handle_antcfg(mlan_private *pmpriv, t_u32 init_antcfg); mlan_status wlan_cmd_tx_rate_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_void *pdata_buf, @@ -3421,6 +3413,10 @@ mlan_status wlan_ret_dmcs_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, mlan_status wlan_cmd_ssu(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, t_u16 cmd_action, t_u16 *pdata_buf); #endif +#ifdef PCIE +/** Init write pointer */ +mlan_status wlan_pcie_init_fw(pmlan_adapter pmadapter); +#endif /** send get hw spec command to firmware */ mlan_status wlan_adapter_get_hw_spec(pmlan_adapter pmadapter); @@ -3595,29 +3591,6 @@ t_u16 radio_type_to_band(t_u8 chanBand); mlan_status wlan_disconnect(mlan_private *pmpriv, mlan_ioctl_req *pioctl_req, mlan_deauth_param *deauth_param); -/** Ad-Hoc start */ -mlan_status wlan_adhoc_start(mlan_private *pmpriv, t_void *pioctl_buf, - mlan_802_11_ssid *padhoc_ssid); - -/** Ad-Hoc join */ -mlan_status wlan_adhoc_join(mlan_private *pmpriv, t_void *pioctl_buf, - BSSDescriptor_t *pBSSDesc); - -/** Ad-Hoc start command handler */ -mlan_status wlan_cmd_802_11_ad_hoc_start(mlan_private *pmpriv, - HostCmd_DS_COMMAND *cmd, - t_void *pdata_buf); - -/** Ad-Hoc command handler */ -mlan_status wlan_cmd_802_11_ad_hoc_join(mlan_private *pmpriv, - HostCmd_DS_COMMAND *cmd, - t_void *pdata_buf); - -/** Handler for Ad-Hoc commands */ -mlan_status wlan_ret_802_11_ad_hoc(mlan_private *pmpriv, - HostCmd_DS_COMMAND *resp, - t_void *pioctl_buf); - /** Handler for bgscan query commands */ mlan_status wlan_cmd_802_11_bg_scan_query(mlan_private *pmpriv, HostCmd_DS_COMMAND *pcmd, diff --git a/mxm_wifiex/wlan_src/mlan/mlan_misc.c b/mxm_wifiex/wlan_src/mlan/mlan_misc.c index dc923ab..87b71ca 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_misc.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_misc.c @@ -1063,6 +1063,8 @@ pmlan_buffer wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, (t_u32)(sizeof(mlan_buffer) + data_len + DMA_ALIGNMENT); if (malloc_flag & MOAL_MEM_FLAG_ATOMIC) mem_flags |= MLAN_MEM_FLAG_ATOMIC; + if (malloc_flag & MOAL_MEM_FLAG_DIRTY) + mem_flags |= MLAN_MEM_FLAG_DIRTY; ret = pcb->moal_malloc(pmadapter->pmoal_handle, buf_size, mem_flags, (t_u8 **)&pmbuf); if ((ret != MLAN_STATUS_SUCCESS) || !pmbuf) { @@ -1070,6 +1072,10 @@ pmlan_buffer wlan_alloc_mlan_buffer(mlan_adapter *pmadapter, t_u32 data_len, goto exit; } + if (malloc_flag & MOAL_MEM_FLAG_DIRTY) + memset(pmadapter, pmbuf, 0x00, + sizeof(*pmbuf) + head_room); + pmbuf->pdesc = MNULL; /* Align address */ pmbuf->pbuf = (t_u8 *)ALIGN_ADDR( @@ -1233,7 +1239,8 @@ mlan_status wlan_bss_ioctl_bss_role(pmlan_adapter pmadapter, #if defined(WIFI_DIRECT_SUPPORT) t_u8 bss_mode; #endif - t_u8 i, global_band = 0; + t_u8 i; + t_u16 global_band = 0; int j; ENTER(); @@ -1293,19 +1300,15 @@ mlan_status wlan_bss_ioctl_bss_role(pmlan_adapter pmadapter, } if (global_band != pmadapter->config_bands) { - if (wlan_set_regiontable( - pmpriv, (t_u8)pmadapter->region_code, - global_band | - pmadapter->adhoc_start_band)) { + if (wlan_set_regiontable(pmpriv, + (t_u8)pmadapter->region_code, + global_band)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; LEAVE(); return MLAN_STATUS_FAILURE; } - if (wlan_11d_set_universaltable( - pmpriv, - global_band | - pmadapter->adhoc_start_band)) { + if (wlan_11d_set_universaltable(pmpriv, global_band)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; LEAVE(); return MLAN_STATUS_FAILURE; @@ -3328,11 +3331,17 @@ mlan_status wlan_process_802dot11_mgmt_pkt(mlan_private *priv, t_u8 *payload, } #endif if (priv->bss_role == MLAN_BSS_ROLE_STA) { + /* Igone DeAuth/DisAssoc frame from OLD AP during + * Roaming */ if (priv->curr_bss_params.host_mlme) { - if (memcmp(pmadapter, pieee_pkt_hdr->addr3, - (t_u8 *)priv->curr_bss_params - .bss_descriptor.mac_address, - MLAN_MAC_ADDR_LENGTH)) { + if ((memcmp(pmadapter, pieee_pkt_hdr->addr3, + (t_u8 *)priv->curr_bss_params + .bss_descriptor.mac_address, + MLAN_MAC_ADDR_LENGTH)) || + !memcmp(pmadapter, pieee_pkt_hdr->addr3, + (t_u8 *)priv->curr_bss_params + .prev_bssid, + MLAN_MAC_ADDR_LENGTH)) { PRINTM(MCMND, "Dropping Deauth frame from other bssid: type=%d " MACSTR "\n", @@ -4283,6 +4292,127 @@ exit: return ret; } +/** + * @brief Set antenna configuration + * + * @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_handle_antcfg(mlan_private *pmpriv, t_u32 init_antcfg) +{ + mlan_ds_ant_cfg ant_cfg; + mlan_ds_ant_cfg_1x1 ant_cfg_1x1; + mlan_status ret = MLAN_STATUS_SUCCESS; + pmlan_adapter pmadapter = pmpriv->adapter; + ENTER(); + + memset(pmadapter, &ant_cfg, 0, sizeof(ant_cfg)); + memset(pmadapter, &ant_cfg_1x1, 0, sizeof(ant_cfg_1x1)); + if (IS_STREAM_2X2(pmadapter->feature_control)) { + if (IS_CARD9098(pmadapter->card_type) || + IS_CARD9097(pmadapter->card_type) || + IS_CARDIW624(pmadapter->card_type) || + IS_CARDAW693(pmadapter->card_type)) { + ant_cfg.tx_antenna = ant_cfg.rx_antenna = init_antcfg; + } else { + ant_cfg.tx_antenna = (init_antcfg & 0x0030) >> 4; + ant_cfg.rx_antenna = init_antcfg & 0x0003; + } + } else + ant_cfg_1x1.antenna = init_antcfg; + + /* 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) || + IS_CARDIW624(pmadapter->card_type)) { + ant_cfg.tx_antenna &= 0x0303; + ant_cfg.rx_antenna &= 0x0303; + /** 2G antcfg TX */ + if (ant_cfg.tx_antenna & 0x00FF) { + pmadapter->user_htstream &= ~0xF0; + pmadapter->user_htstream |= + (bitcount(ant_cfg.tx_antenna & 0x00FF) + << 4); + } + /* 5G antcfg tx */ + if (ant_cfg.tx_antenna & 0xFF00) { + pmadapter->user_htstream &= ~0xF000; + pmadapter->user_htstream |= + (bitcount(ant_cfg.tx_antenna & 0xFF00) + << 12); + } + /* 2G antcfg RX */ + if (ant_cfg.rx_antenna & 0x00FF) { + pmadapter->user_htstream &= ~0xF; + pmadapter->user_htstream |= + bitcount(ant_cfg.rx_antenna & 0x00FF); + } + /* 5G antcfg RX */ + if (ant_cfg.rx_antenna & 0xFF00) { + pmadapter->user_htstream &= ~0xF00; + pmadapter->user_htstream |= + (bitcount(ant_cfg.rx_antenna & 0xFF00) + << 8); + } + PRINTM(MCMND, + "user_htstream=0x%x, tx_antenna=0x%x >rx_antenna=0x%x\n", + pmadapter->user_htstream, 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 || + bitcount(ant_cfg.tx_antenna & 0xFF00) > + pmadapter->number_of_antenna) { + PRINTM(MERROR, "Invalid TX antenna setting: 0x%x\n", + ant_cfg.tx_antenna); + goto exit; + } + if (ant_cfg.rx_antenna) { + if (bitcount(ant_cfg.rx_antenna & 0x00FF) > + pmadapter->number_of_antenna || + bitcount(ant_cfg.rx_antenna & 0xFF00) > + pmadapter->number_of_antenna) { + PRINTM(MERROR, + "Invalid RX antenna setting: 0x%x\n", + ant_cfg.rx_antenna); + goto exit; + } + } else + ant_cfg.rx_antenna = ant_cfg.tx_antenna; + } else if (!ant_cfg_1x1.antenna || + ((ant_cfg_1x1.antenna != RF_ANTENNA_AUTO) && + (ant_cfg_1x1.antenna & 0xFFFC))) { + PRINTM(MERROR, "Invalid antenna setting\n"); + goto exit; + } + + /* Send request to firmware */ + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_RF_ANTENNA, + HostCmd_ACT_GEN_SET, 0, MNULL, + (IS_STREAM_2X2(pmadapter->feature_control)) ? + (t_void *)&ant_cfg : + (t_void *)&ant_cfg_1x1); +exit: + LEAVE(); + return ret; +} + /** * @brief Get rate bitmap * @@ -4456,11 +4586,7 @@ static mlan_status wlan_rate_ioctl_set_rate_value(pmlan_adapter pmadapter, } else { memset(pmadapter, rates, 0, sizeof(rates)); wlan_get_active_data_rates(pmpriv, pmpriv->bss_mode, - (pmpriv->bss_mode == - MLAN_BSS_MODE_INFRA) ? - pmpriv->config_bands : - pmadapter->adhoc_start_band, - rates); + pmpriv->config_bands, rates); rate = rates; for (i = 0; (rate[i] && i < WLAN_SUPPORTED_RATES); i++) { PRINTM(MINFO, "Rate=0x%X Wanted=0x%X\n", rate[i], @@ -6154,8 +6280,7 @@ mlan_status wlan_misc_ioctl_region(pmlan_adapter pmadapter, pmadapter->cfp_code_bg = misc->param.region_code; pmadapter->cfp_code_a = misc->param.region_code; if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, - pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->config_bands)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; ret = MLAN_STATUS_FAILURE; } @@ -6738,8 +6863,6 @@ mlan_status wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, { t_u32 i, global_band = 0; t_u32 infra_band = 0; - t_u32 adhoc_band = 0; - t_u32 adhoc_channel = 0; mlan_ds_radio_cfg *radio_cfg = MNULL; mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; @@ -6748,8 +6871,6 @@ mlan_status wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, radio_cfg = (mlan_ds_radio_cfg *)pioctl_req->pbuf; if (pioctl_req->action == MLAN_ACT_SET) { infra_band = radio_cfg->param.band_cfg.config_bands; - adhoc_band = radio_cfg->param.band_cfg.adhoc_start_band; - adhoc_channel = radio_cfg->param.band_cfg.adhoc_channel; /* SET Infra band */ if ((infra_band | pmadapter->fw_bands) & ~pmadapter->fw_bands) { @@ -6758,15 +6879,6 @@ mlan_status wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, return MLAN_STATUS_FAILURE; } - /* SET Ad-hoc Band */ - if ((adhoc_band | pmadapter->fw_bands) & ~pmadapter->fw_bands) { - pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; - LEAVE(); - return MLAN_STATUS_FAILURE; - } - if (!adhoc_band) - adhoc_band = pmadapter->adhoc_start_band; - for (i = 0; i < pmadapter->priv_num; i++) { if (pmadapter->priv[i] && pmadapter->priv[i] != pmpriv && @@ -6778,14 +6890,13 @@ mlan_status wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, global_band |= infra_band; if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, - global_band | adhoc_band)) { + global_band)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; LEAVE(); return MLAN_STATUS_FAILURE; } #ifdef STA_SUPPORT - if (wlan_11d_set_universaltable(pmpriv, - global_band | adhoc_band)) { + if (wlan_11d_set_universaltable(pmpriv, global_band)) { pioctl_req->status_code = MLAN_ERROR_IOCTL_FAIL; LEAVE(); return MLAN_STATUS_FAILURE; @@ -6794,51 +6905,12 @@ mlan_status wlan_radio_ioctl_band_cfg(pmlan_adapter pmadapter, pmpriv->config_bands = infra_band; pmadapter->config_bands = global_band; - pmadapter->adhoc_start_band = adhoc_band; - pmpriv->intf_state_11h.adhoc_auto_sel_chan = MFALSE; - #ifdef STA_SUPPORT - /* - * If no adhoc_channel is supplied verify if the existing - * adhoc channel compiles with new adhoc_band - */ - if (!adhoc_channel) { - if (!wlan_find_cfp_by_band_and_channel( - pmadapter, pmadapter->adhoc_start_band, - pmpriv->adhoc_channel)) { - /* Pass back the default channel */ - radio_cfg->param.band_cfg.adhoc_channel = - DEFAULT_AD_HOC_CHANNEL; - if ((pmadapter->adhoc_start_band & BAND_A)) { - radio_cfg->param.band_cfg.adhoc_channel = - DEFAULT_AD_HOC_CHANNEL_A; - } - } - } else { - /* Return error if adhoc_band and adhoc_channel - * combination is invalid - */ - if (!wlan_find_cfp_by_band_and_channel( - pmadapter, pmadapter->adhoc_start_band, - (t_u16)adhoc_channel)) { - pioctl_req->status_code = - MLAN_ERROR_INVALID_PARAMETER; - LEAVE(); - return MLAN_STATUS_FAILURE; - } - pmpriv->adhoc_channel = (t_u8)adhoc_channel; - } - #endif } else { /* Infra Bands */ radio_cfg->param.band_cfg.config_bands = pmpriv->config_bands; - /* Adhoc Band */ - radio_cfg->param.band_cfg.adhoc_start_band = - pmadapter->adhoc_start_band; - /* Adhoc Channel */ - radio_cfg->param.band_cfg.adhoc_channel = pmpriv->adhoc_channel; /* FW support Bands */ radio_cfg->param.band_cfg.fw_bands = pmadapter->fw_bands; PRINTM(MINFO, "Global config band = %d\n", @@ -7298,6 +7370,21 @@ mlan_status wlan_misc_ioctl_rf_test_cfg(pmlan_adapter pmadapter, cmd_action, 0, (t_void *)pioctl_req, &(pmisc->param.mfg_he_power)); break; + + case MLAN_OID_MISC_OTP_MAC_RD_WR: + if (pioctl_req->action == MLAN_ACT_SET) + cmd_action = HostCmd_ACT_GEN_SET; + else if (pioctl_req->action == MLAN_ACT_GET) + cmd_action = HostCmd_ACT_GEN_GET; + else { + PRINTM(MERROR, "Unsupported cmd_action\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_MFG_COMMAND, + cmd_action, 0, (t_void *)pioctl_req, + &(pmisc->param.mfg_otp_mac_addr_rd_wr)); + break; } if (ret == MLAN_STATUS_SUCCESS) @@ -7581,8 +7668,7 @@ mlan_status wlan_misc_ioctl_country_code(pmlan_adapter pmadapter, else pmadapter->region_code = 0; if (wlan_set_regiontable(pmpriv, pmadapter->region_code, - pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->config_bands)) { pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; ret = MLAN_STATUS_FAILURE; goto done; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c index fb05805..f378721 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_pcie.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_pcie.c @@ -104,6 +104,7 @@ static const struct _mlan_pcie_card_reg mlan_reg_pcie8997 = { .host_intr_upld_rdy = HOST_INTR_UPLD_RDY, .host_intr_cmd_done = HOST_INTR_CMD_DONE, .host_intr_event_rdy = HOST_INTR_EVENT_RDY, + .host_intr_cmd_dnld = HOST_INTR_CMD_DNLD, .txrx_rw_ptr_mask = 0x00000FFF, .txrx_rw_ptr_wrap_mask = 0x00001FFF, .txrx_rw_ptr_rollover_ind = MBIT(12), @@ -190,7 +191,9 @@ static const struct _mlan_pcie_card_reg mlan_reg_pcie9098 = { .use_adma = MTRUE, .msi_int_wr_clr = MTRUE, }; +#endif +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) static const struct _mlan_card_info mlan_card_info_pcie9098 = { .max_tx_buf_size = MLAN_TX_DATA_BUF_SIZE_4K, .v16_fw_api = 1, @@ -212,6 +215,138 @@ 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 program dma_cfg/dma_cfg2/dma_cfg3 registers + * + * @param pmadapter A pointer to mlan_adapter structure + * @param q_addr adma queue address + * @param direction adma direction (ADMA_DEVICE_TO_HOST/ADMA_HOST_TO_DEVICE) + * @param dma_mode dma mode (DMA_MODE_DUAL_DESC/DMA_MODE_DIRECT) + * @param size desc num/dma_size + * @param init init flag + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_init_dma_cfg_registers(mlan_adapter *pmadapter, + t_u32 q_addr, t_u8 direction, + t_u8 dma_mode, t_u16 size, + t_u8 init) +{ + t_u32 dma_cfg, dma_cfg2, dma_cfg3; + pmlan_callbacks pcb = &pmadapter->callbacks; + mlan_status ret = MLAN_STATUS_SUCCESS; + + ENTER(); + if (init) { + /* Read the dma_cfg2 register */ + if (pcb->moal_read_reg(pmadapter->pmoal_handle, + q_addr + ADMA_DMA_CFG2, &dma_cfg2)) { + PRINTM(MERROR, "Fail to read DMA CFG2 register\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + dma_cfg2 &= ~(ADMA_SRC_DMA_DONE_INT_BYPASS_EN | + ADMA_DST_DMA_DONE_INT_BYPASS_EN | + ADMA_MSI_LEGACY_SRC_DMA_DONE_INT_BYPASS_EN | + ADMA_MSI_LEGACY_DST_DMA_DONE_INT_BYPASS_EN | + ADMA_MSI_LEGACY_ENABLE | ADMA_MSIX_ENABLE | + ADMA_MSIX_INT_SRC_DST_SEL); + + if (dma_mode == DMA_MODE_DUAL_DESC) { + if (direction == ADMA_HOST_TO_DEVICE) { + dma_cfg2 |= ADMA_SRC_DMA_DONE_INT_BYPASS_EN; + if (pmadapter->pcard_pcie->pcie_int_mode != + PCIE_INT_MODE_MSIX) + dma_cfg2 |= + ADMA_MSI_LEGACY_SRC_DMA_DONE_INT_BYPASS_EN; + } else { + /* Read the dma_cfg3 register */ + if (pcb->moal_read_reg(pmadapter->pmoal_handle, + q_addr + ADMA_DMA_CFG3, + &dma_cfg3)) { + PRINTM(MERROR, + "Fail to read DMA CFG3 register\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + dma_cfg3 |= ADMA_Q_PTR_CLR; + if (pcb->moal_write_reg(pmadapter->pmoal_handle, + q_addr + ADMA_DMA_CFG3, + (t_u32)dma_cfg3)) { + PRINTM(MERROR, + "Failed to write ADMA_DMA_CFG3.\n"); + ret = MLAN_STATUS_FAILURE; + } + dma_cfg2 |= ADMA_DST_DMA_DONE_INT_BYPASS_EN; + if (pmadapter->pcard_pcie->pcie_int_mode != + PCIE_INT_MODE_MSIX) + dma_cfg2 |= + ADMA_MSI_LEGACY_DST_DMA_DONE_INT_BYPASS_EN; + } + } else { + if (direction == ADMA_HOST_TO_DEVICE) + dma_cfg2 |= ADMA_SRC_ADDR_IS_HOST; + else + dma_cfg2 |= ADMA_DST_ADDR_IS_HOST; + } + if (pmadapter->pcard_pcie->pcie_int_mode == PCIE_INT_MODE_MSIX) + dma_cfg2 |= ADMA_MSIX_ENABLE; + else + dma_cfg2 |= ADMA_MSI_LEGACY_ENABLE; + PRINTM(MCMND, "dma_cfg2=0x%x\n", dma_cfg2); + + /* enable INT_BYPASS_EN in the dma_cfg2 register */ + if (pcb->moal_write_reg(pmadapter->pmoal_handle, + q_addr + ADMA_DMA_CFG2, + (t_u32)dma_cfg2)) { + PRINTM(MERROR, "Failed to write DMA CFG2.\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + } + /* Read the TX ring read pointer set by firmware */ + if (pcb->moal_read_reg(pmadapter->pmoal_handle, q_addr + ADMA_DMA_CFG, + &dma_cfg)) { + PRINTM(MERROR, "Fail to read DMA CFG register\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + if (direction == ADMA_HOST_TO_DEVICE) { + if (dma_mode == DMA_MODE_DUAL_DESC) { + dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | + SRC_NUM_DESC_MASK | DMA_SIZE_MASK); + dma_cfg |= (t_u32)size << SRC_NUM_DESC_BIT; + dma_cfg |= DESC_MODE_RING << 2; + } else { + dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | + SRC_NUM_DESC_MASK | DST_NUM_DESC_MASK | + DMA_SIZE_MASK); + dma_cfg |= (t_u32)size << DMA_SIZE_BIT; + } + } else { + if (dma_mode == DMA_MODE_DUAL_DESC) { + dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | + DST_NUM_DESC_MASK | DMA_SIZE_MASK); + dma_cfg |= (t_u32)size << DST_NUM_DESC_BIT; + dma_cfg |= DESC_MODE_RING << 2; + } else { + dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | + SRC_NUM_DESC_MASK | DST_NUM_DESC_MASK); + } + } + dma_cfg |= (t_u32)dma_mode; + PRINTM(MINFO, "dma_cfg=0x%x\n", dma_cfg); + if (pcb->moal_write_reg(pmadapter->pmoal_handle, q_addr + ADMA_DMA_CFG, + dma_cfg)) { + PRINTM(MERROR, "Fail to set DMA CFG register\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } +done: + LEAVE(); + return ret; +} + /** * @brief This function init the adma setting * @@ -226,7 +361,7 @@ static mlan_status wlan_pcie_delete_rxbd_ring(pmlan_adapter pmadapter); static mlan_status wlan_init_adma(mlan_adapter *pmadapter, t_u8 type, t_u64 pbase, t_u16 size, t_u8 init) { - t_u32 dma_cfg, dma_cfg2, dma_cfg3, int_mapping; + t_u32 int_mapping; mlan_status ret = MLAN_STATUS_SUCCESS; t_u32 q_addr = 0; t_u8 direction = 0; @@ -295,60 +430,6 @@ static mlan_status wlan_init_adma(mlan_adapter *pmadapter, t_u8 type, goto done; } - /* Read the dma_cfg2 register */ - if (pcb->moal_read_reg(pmadapter->pmoal_handle, - q_addr + ADMA_DMA_CFG2, &dma_cfg2)) { - PRINTM(MERROR, "Fail to read DMA CFG2 register\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - dma_cfg2 &= ~(ADMA_SRC_DMA_DONE_INT_BYPASS_EN | - ADMA_DST_DMA_DONE_INT_BYPASS_EN | - ADMA_MSI_LEGACY_SRC_DMA_DONE_INT_BYPASS_EN | - ADMA_MSI_LEGACY_DST_DMA_DONE_INT_BYPASS_EN | - ADMA_MSI_LEGACY_ENABLE | ADMA_MSIX_ENABLE | - ADMA_MSIX_INT_SRC_DST_SEL); - - if (dma_mode == DMA_MODE_DUAL_DESC) { - if (direction == ADMA_HOST_TO_DEVICE) { - dma_cfg2 |= ADMA_SRC_DMA_DONE_INT_BYPASS_EN; - if (pmadapter->pcard_pcie->pcie_int_mode != - PCIE_INT_MODE_MSIX) - dma_cfg2 |= - ADMA_MSI_LEGACY_SRC_DMA_DONE_INT_BYPASS_EN; - } else { - /* Read the dma_cfg3 register */ - if (pcb->moal_read_reg(pmadapter->pmoal_handle, - q_addr + ADMA_DMA_CFG3, - &dma_cfg3)) { - PRINTM(MERROR, - "Fail to read DMA CFG3 register\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - dma_cfg3 |= ADMA_Q_PTR_CLR; - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - q_addr + ADMA_DMA_CFG3, - (t_u32)dma_cfg3)) { - PRINTM(MERROR, - "Failed to write ADMA_DMA_CFG3.\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - dma_cfg2 |= ADMA_DST_DMA_DONE_INT_BYPASS_EN; - if (pmadapter->pcard_pcie->pcie_int_mode != - PCIE_INT_MODE_MSIX) - dma_cfg2 |= - ADMA_MSI_LEGACY_DST_DMA_DONE_INT_BYPASS_EN; - } - } else { - if (direction == ADMA_HOST_TO_DEVICE) - dma_cfg2 |= ADMA_SRC_ADDR_IS_HOST; - else - dma_cfg2 |= ADMA_DST_ADDR_IS_HOST; - } - if (pmadapter->pcard_pcie->pcie_int_mode == PCIE_INT_MODE_MSIX) { if (pcb->moal_read_reg(pmadapter->pmoal_handle, @@ -374,27 +455,9 @@ static mlan_status wlan_init_adma(mlan_adapter *pmadapter, t_u8 type, ret = MLAN_STATUS_FAILURE; goto done; } - dma_cfg2 |= ADMA_MSIX_ENABLE; - } else - dma_cfg2 |= ADMA_MSI_LEGACY_ENABLE; - PRINTM(MCMND, "dma_cfg2=0x%x\n", dma_cfg2); - - /* enable INT_BYPASS_EN in the dma_cfg2 register */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - q_addr + ADMA_DMA_CFG2, - (t_u32)dma_cfg2)) { - PRINTM(MERROR, "Failed to write DMA CFG2.\n"); - ret = MLAN_STATUS_FAILURE; - goto done; } } - /* Read the TX ring read pointer set by firmware */ - if (pcb->moal_read_reg(pmadapter->pmoal_handle, q_addr + ADMA_DMA_CFG, - &dma_cfg)) { - PRINTM(MERROR, "Fail to read DMA CFG register\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } + if (direction == ADMA_HOST_TO_DEVICE) { /* Write the lower 32bits of the physical address to * ADMA_SRC_LOW */ @@ -433,17 +496,6 @@ static mlan_status wlan_init_adma(mlan_adapter *pmadapter, t_u8 type, goto done; } } - if (dma_mode == DMA_MODE_DUAL_DESC) { - dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | - SRC_NUM_DESC_MASK | DMA_SIZE_MASK); - dma_cfg |= (t_u32)size << SRC_NUM_DESC_BIT; - dma_cfg |= DESC_MODE_RING << 2; - } else { - dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | - SRC_NUM_DESC_MASK | DST_NUM_DESC_MASK | - DMA_SIZE_MASK); - dma_cfg |= (t_u32)size << DMA_SIZE_BIT; - } } else { /* Write the lower 32bits of the physical address to * ADMA_DST_LOW */ @@ -482,23 +534,14 @@ static mlan_status wlan_init_adma(mlan_adapter *pmadapter, t_u8 type, goto done; } } - if (dma_mode == DMA_MODE_DUAL_DESC) { - dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | - DST_NUM_DESC_MASK | DMA_SIZE_MASK); - dma_cfg |= (t_u32)size << DST_NUM_DESC_BIT; - dma_cfg |= DESC_MODE_RING << 2; - } else { - dma_cfg &= ~(DESC_MODE_MASK | DMA_MODE_MASK | - SRC_NUM_DESC_MASK | DST_NUM_DESC_MASK); - } } - dma_cfg |= (t_u32)dma_mode; - if (pcb->moal_write_reg(pmadapter->pmoal_handle, q_addr + ADMA_DMA_CFG, - dma_cfg)) { - PRINTM(MERROR, "Fail to set DMA CFG register\n"); - LEAVE(); - return MLAN_STATUS_FAILURE; + if (wlan_init_dma_cfg_registers(pmadapter, q_addr, direction, dma_mode, + size, init)) { + PRINTM(MERROR, "Failed to configure dma_cfg registers\n"); + ret = MLAN_STATUS_FAILURE; + goto done; } + if (type == ADMA_CMD && !init) { /* Write 1 to src_wr_ptr to trigger direct dma */ if (pcb->moal_write_reg(pmadapter->pmoal_handle, @@ -550,6 +593,7 @@ static void wlan_pcie_init_adma_ring_size(mlan_adapter *pmadapter) #endif #if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) + /** * @brief This function enables tx_done interrupt in pending descriptor if * needed. @@ -593,6 +637,30 @@ static t_u16 wlan_get_adma_buf_flag(mlan_adapter *pmadapter, t_u32 num_tx_buffs, return flags; } +/** + * @brief This function set the host interrupt select mask + * + * @param pmadapter A pointer to mlan_adapter structure + * + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_pcie_set_host_int_select_reg(mlan_adapter *pmadapter, + t_u32 int_sel_mask) +{ + pmlan_callbacks pcb = &pmadapter->callbacks; + ENTER(); + /* Simply write the mask to the register */ + if (pcb->moal_write_reg(pmadapter->pmoal_handle, PCIE9098_HOST_INT_SEL, + int_sel_mask)) { + PRINTM(MWARN, "Set host interrupt select register failed\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /** * @brief This function set the host interrupt select mask * @@ -640,7 +708,101 @@ static mlan_status wlan_pcie_set_host_int_select_mask(mlan_adapter *pmadapter, } #endif -#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) +/** + * @brief This function downloads boot command to the card. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param pmbuf A pointer to mlan_buffer + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_pcie_send_boot_cmd(mlan_adapter *pmadapter, + mlan_buffer *pmbuf) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; + pmlan_callbacks pcb = &pmadapter->callbacks; + + ENTER(); + + if (!pmadapter || !pmbuf) { + PRINTM(MERROR, "NULL Pointer\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + if (MLAN_STATUS_FAILURE == + pcb->moal_map_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + &pmbuf->buf_pa, WLAN_UPLD_SIZE, PCI_DMA_TODEVICE)) { + PRINTM(MERROR, "BootCmd: failed to moal_map_memory\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } + + if (!(pmbuf->pbuf && pmbuf->data_len && pmbuf->buf_pa)) { + PRINTM(MERROR, "%s: Invalid buffer <%p, %#x:%x, len=%d>\n", + __func__, pmbuf->pbuf, + (t_u32)((t_u64)pmbuf->buf_pa >> 32), + (t_u32)pmbuf->buf_pa, pmbuf->data_len); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + /* Write the lower 32bits of the physical address to scratch + * register 0 */ + if (pcb->moal_write_reg(pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_scratch_0, + (t_u32)pmbuf->buf_pa)) { + PRINTM(MERROR, + "Failed to write download command to boot code\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + /* Write the upper 32bits of the physical address to scratch + * register 1 */ + if (pcb->moal_write_reg(pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_scratch_1, + (t_u32)((t_u64)pmbuf->buf_pa >> 32))) { + PRINTM(MERROR, + "Failed to write download command to boot code\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + /* Write the command length to scratch register 2 */ + if (pcb->moal_write_reg(pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_scratch_2, + pmbuf->data_len)) { + PRINTM(MERROR, + "Failed to write command length to scratch register 2\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + /* Ring the door bell */ + if (pcb->moal_write_reg(pmadapter->pmoal_handle, + pmadapter->pcard_pcie->reg->reg_cpu_int_event, + CPU_INTR_DOOR_BELL)) { + PRINTM(MERROR, "Failed to assert door-bell interrupt\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + + LEAVE(); + return ret; + +done: + if (MLAN_STATUS_FAILURE == + pcb->moal_unmap_memory( + pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, + pmbuf->buf_pa, WLAN_UPLD_SIZE, PCI_DMA_TODEVICE)) + PRINTM(MERROR, "BootCmd: failed to moal_unmap_memory\n"); + LEAVE(); + return ret; +} + +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIEIW624) /** * @brief This function handles command response completion * @@ -703,10 +865,25 @@ static mlan_status wlan_pcie_send_vdll(mlan_adapter *pmadapter, goto done; } pmadapter->pcard_pcie->vdll_cmd_buf = pmbuf; + +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) /* issue the DMA */ - /* send the VDLL block down to the firmware */ - wlan_init_adma(pmadapter, ADMA_CMD, pmbuf->buf_pa, pmbuf->data_len, - MFALSE); + if (pmadapter->pcard_pcie->reg->use_adma) { + /* send the VDLL block down to the firmware */ + wlan_init_adma(pmadapter, ADMA_CMD, pmbuf->buf_pa, + pmbuf->data_len, MFALSE); + } +#endif + +#ifdef PCIE8997 + if (!pmadapter->pcard_pcie->reg->use_adma) { + if (wlan_pcie_send_boot_cmd(pmadapter, pmbuf)) { + PRINTM(MERROR, "Failed to send vdll block to device\n"); + ret = MLAN_STATUS_FAILURE; + goto done; + } + } +#endif PRINTM(MINFO, "PCIE - Download VDLL Block: successful.\n"); done: @@ -1756,6 +1933,10 @@ static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) ENTER(); + if (!wlan_is_tx_pending(pmadapter)) { + LEAVE(); + return ret; + } /* Read the TX ring read pointer set by firmware */ if (pcb->moal_read_reg(pmadapter->pmoal_handle, pmadapter->pcard_pcie->reg->reg_txbd_rdptr, @@ -1849,8 +2030,6 @@ static mlan_status wlan_pcie_send_data_complete(mlan_adapter *pmadapter) #endif } - if (unmap_count) - pmadapter->data_sent = MFALSE; #if defined(PCIE8997) || defined(PCIE8897) if (pmadapter->pcard_pcie->txbd_flush) { if (PCIE_TXBD_EMPTY(pmadapter->pcard_pcie->txbd_wrptr, @@ -1865,6 +2044,9 @@ done: pcb->moal_spin_lock(pmadapter->pmoal_handle, pmadapter->pmlan_pcie_lock); pmadapter->pcard_pcie->txbd_pending -= unmap_count; + if (unmap_count) { + pmadapter->data_sent = MFALSE; + } pcb->moal_spin_unlock(pmadapter->pmoal_handle, pmadapter->pmlan_pcie_lock); @@ -1959,6 +2141,10 @@ static t_u8 wlan_check_txbd_not_full(mlan_adapter *pmadapter) return MFALSE; } +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) + +#endif + /** * @brief This function downloads data to the card. * @@ -2126,9 +2312,9 @@ static mlan_status wlan_pcie_send_data(mlan_adapter *pmadapter, t_u8 type, pmadapter->pcard_pcie->txbd_rdptr, pmadapter->pcard_pcie->txbd_wrptr); - if (wlan_check_txbd_not_full(pmadapter)) + if (wlan_check_txbd_not_full(pmadapter)) { pmadapter->data_sent = MFALSE; - else + } else wlan_pcie_process_tx_complete(pmadapter); if (pmadapter->data_sent) pmadapter->data_sent_cnt++; @@ -2638,47 +2824,8 @@ static mlan_status wlan_pcie_send_cmd(mlan_adapter *pmadapter, goto done; } } - - /* Write the lower 32bits of the physical address to - * REG_CMD_ADDR_LO */ - if (pcb->moal_write_reg( - pmadapter->pmoal_handle, REG_CMD_ADDR_LO, - (t_u32)pmadapter->pcard_pcie->cmd_buf->buf_pa)) { - PRINTM(MERROR, - "Failed to write download command to boot code.\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - /* Write the upper 32bits of the physical address to - * REG_CMD_ADDR_HI */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - REG_CMD_ADDR_HI, - (t_u32)((t_u64)pmadapter->pcard_pcie - ->cmd_buf->buf_pa >> - 32))) { - PRINTM(MERROR, - "Failed to write download command to boot code.\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Write the command length to REG_CMD_SIZE */ - if (pcb->moal_write_reg( - pmadapter->pmoal_handle, REG_CMD_SIZE, - pmadapter->pcard_pcie->cmd_buf->data_len)) { - PRINTM(MERROR, - "Failed to write command length to REG_CMD_SIZE\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Ring the door bell */ - if (pcb->moal_write_reg( - pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg->reg_cpu_int_event, - CPU_INTR_DOOR_BELL)) { - PRINTM(MERROR, - "Failed to assert door-bell interrupt.\n"); + if (wlan_pcie_send_boot_cmd(pmadapter, pmbuf)) { + PRINTM(MERROR, "Failed to send hostcmd to device\n"); ret = MLAN_STATUS_FAILURE; goto done; } @@ -3264,100 +3411,6 @@ done: return ret; } -/** - * @brief This function downloads boot command to the card. - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pmbuf A pointer to mlan_buffer - * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -static mlan_status wlan_pcie_send_boot_cmd(mlan_adapter *pmadapter, - mlan_buffer *pmbuf) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - pmlan_callbacks pcb = &pmadapter->callbacks; - - ENTER(); - - if (!pmadapter || !pmbuf) { - PRINTM(MERROR, "NULL Pointer\n"); - LEAVE(); - return MLAN_STATUS_FAILURE; - } - - if (MLAN_STATUS_FAILURE == - pcb->moal_map_memory( - pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, - &pmbuf->buf_pa, WLAN_UPLD_SIZE, PCI_DMA_TODEVICE)) { - PRINTM(MERROR, "BootCmd: failed to moal_map_memory\n"); - LEAVE(); - return MLAN_STATUS_FAILURE; - } - - if (!(pmbuf->pbuf && pmbuf->data_len && pmbuf->buf_pa)) { - PRINTM(MERROR, "%s: Invalid buffer <%p, %#x:%x, len=%d>\n", - __func__, pmbuf->pbuf, - (t_u32)((t_u64)pmbuf->buf_pa >> 32), - (t_u32)pmbuf->buf_pa, pmbuf->data_len); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Write the lower 32bits of the physical address to scratch - * register 0 */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg->reg_scratch_0, - (t_u32)pmbuf->buf_pa)) { - PRINTM(MERROR, - "Failed to write download command to boot code\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Write the upper 32bits of the physical address to scratch - * register 1 */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg->reg_scratch_1, - (t_u32)((t_u64)pmbuf->buf_pa >> 32))) { - PRINTM(MERROR, - "Failed to write download command to boot code\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Write the command length to scratch register 2 */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg->reg_scratch_2, - pmbuf->data_len)) { - PRINTM(MERROR, - "Failed to write command length to scratch register 2\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Ring the door bell */ - if (pcb->moal_write_reg(pmadapter->pmoal_handle, - pmadapter->pcard_pcie->reg->reg_cpu_int_event, - CPU_INTR_DOOR_BELL)) { - PRINTM(MERROR, "Failed to assert door-bell interrupt\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - LEAVE(); - return ret; - -done: - if (MLAN_STATUS_FAILURE == - pcb->moal_unmap_memory( - pmadapter->pmoal_handle, pmbuf->pbuf + pmbuf->data_offset, - pmbuf->buf_pa, WLAN_UPLD_SIZE, PCI_DMA_TODEVICE)) - PRINTM(MERROR, "BootCmd: failed to moal_unmap_memory\n"); - LEAVE(); - return ret; -} - /** * @brief This function init rx port in firmware * @@ -3857,6 +3910,10 @@ mlan_status wlan_process_msix_int(mlan_adapter *pmadapter) pmadapter->pmlan_rx_lock); wlan_recv_event(wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), MLAN_EVENT_ID_DRV_DEFER_RX_DATA, MNULL); + if (wlan_is_tx_pending(pmadapter)) + wlan_recv_event( + wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DEFER_TX_COMPLTE, MNULL); } if (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_event_rdy) { PRINTM(MINFO, "Rx EVENT\n"); @@ -3871,7 +3928,8 @@ 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 defined(PCIE8997) || 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; @@ -3975,6 +4033,12 @@ static mlan_status wlan_process_pcie_int_status(mlan_adapter *pmadapter) wlan_recv_event(wlan_get_priv(pmadapter, MLAN_BSS_ROLE_ANY), MLAN_EVENT_ID_DRV_DEFER_RX_DATA, MNULL); + if (wlan_is_tx_pending(pmadapter)) + wlan_recv_event( + wlan_get_priv(pmadapter, + MLAN_BSS_ROLE_ANY), + MLAN_EVENT_ID_DRV_DEFER_TX_COMPLTE, + MNULL); } if (pcie_ireg & pmadapter->pcard_pcie->reg->host_intr_event_rdy) { @@ -3998,7 +4062,8 @@ 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 defined(PCIE8997) || 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)) { @@ -4294,7 +4359,8 @@ 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) +#if defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIEIW624) else if (type == MLAN_TYPE_VDLL) ret = wlan_pcie_send_vdll(pmadapter, pmbuf); #endif @@ -4773,7 +4839,8 @@ 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 defined(PCIE8997) || defined(PCIE9098) || defined(PCIE9097) || \ + defined(PCIEIW624) if (pmadapter->pcard_pcie->vdll_cmd_buf) wlan_pcie_send_vdll_complete(pmadapter); #endif @@ -4817,6 +4884,32 @@ static mlan_status wlan_process_pcie_int_status_ext(mlan_adapter *pmadapter, return MLAN_STATUS_SUCCESS; } +/** + * @brief This function enables rx host interrupts. + * + * @param pmadapter A pointer to mlan_adapter structure + * @param enable 0-disable 1-enable + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status wlan_pcie_select_host_int(mlan_adapter *pmadapter) +{ + mlan_status ret = MLAN_STATUS_SUCCESS; +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) + t_u32 int_sel_mask = + PCIE9098_HOST_INTR_SEL_MASK & ~PCIE9098_HOST_INTR_UPLD_RDY; +#endif + +#if defined(PCIE9098) || defined(PCIE9097) || defined(PCIEIW624) + if (pmadapter->pcard_pcie->reg->use_adma) { + ret = wlan_pcie_set_host_int_select_reg(pmadapter, + int_sel_mask); + PRINTM(MMSG, "set int_sel_mask=0x%x\n", int_sel_mask); + } +#endif + return ret; +} + mlan_adapter_operations mlan_pcie_ops = { .dnld_fw = wlan_pcie_dnld_fw, .interrupt = wlan_pcie_interrupt_ext, @@ -4828,6 +4921,7 @@ mlan_adapter_operations mlan_pcie_ops = { .data_complete = wlan_pcie_data_complete, .cmdrsp_complete = wlan_pcie_cmdrsp_complete, .handle_rx_packet = wlan_handle_rx_packet, + .select_host_int = wlan_pcie_select_host_int, .debug_dump = wlan_pcie_debug_dump, .intf_header_len = PCIE_INTF_HEADER_LEN, }; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_pcie.h b/mxm_wifiex/wlan_src/mlan/mlan_pcie.h index 1c18d09..85ce4e5 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_pcie.h +++ b/mxm_wifiex/wlan_src/mlan/mlan_pcie.h @@ -413,10 +413,13 @@ Change log: #define HOST_INTR_CMD_DONE MBIT(2) /** Event ready interrupt for host */ #define HOST_INTR_EVENT_RDY MBIT(3) +/** Command download interrupt for host */ +#define HOST_INTR_CMD_DNLD MBIT(7) + /** Interrupt mask for host */ #define HOST_INTR_MASK \ (HOST_INTR_DNLD_DONE | HOST_INTR_UPLD_RDY | HOST_INTR_CMD_DONE | \ - HOST_INTR_EVENT_RDY) + HOST_INTR_EVENT_RDY | HOST_INTR_CMD_DNLD) /** Lower 32bits command address holding register */ #define REG_CMD_ADDR_LO PCIE_SCRATCH_0_REG @@ -470,9 +473,6 @@ mlan_status wlan_get_pcie_device(pmlan_adapter pmadapter); /** Set PCIE host buffer configurations */ mlan_status wlan_set_pcie_buf_config(mlan_private *pmpriv); -/** Init write pointer */ -mlan_status wlan_pcie_init_fw(pmlan_adapter pmadapter); - #if defined(PCIE8997) || defined(PCIE8897) /** Prepare command PCIE host buffer config */ mlan_status wlan_cmd_pcie_host_buf_cfg(pmlan_private pmpriv, diff --git a/mxm_wifiex/wlan_src/mlan/mlan_scan.c b/mxm_wifiex/wlan_src/mlan/mlan_scan.c index 6c50265..28e5f17 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_scan.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_scan.c @@ -408,16 +408,6 @@ static t_s32 wlan_find_best_network_in_list(mlan_private *pmpriv) for (i = 0; i < pmadapter->num_in_scan_table; i++) { switch (mode) { case MLAN_BSS_MODE_INFRA: - case MLAN_BSS_MODE_IBSS: - if (wlan_is_network_compatible(pmpriv, i, mode) >= 0) { - if (SCAN_RSSI(pmadapter->pscan_table[i].rssi) > - best_rssi) { - best_rssi = SCAN_RSSI( - pmadapter->pscan_table[i].rssi); - best_net = i; - } - } - break; case MLAN_BSS_MODE_AUTO: default: if (SCAN_RSSI(pmadapter->pscan_table[i].rssi) > @@ -497,12 +487,7 @@ static t_u8 wlan_scan_create_channel_list( "create_channel_list: region=%d band=%d num_cfp=%d\n", pscan_region->region, pscan_region->band, pscan_region->num_cfp); - if ((puser_scan_in && - (puser_scan_in->bss_mode == MLAN_SCAN_MODE_IBSS)) || - pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) - band = pmadapter->adhoc_start_band; - else - band = pmpriv->config_bands; + band = pmpriv->config_bands; if (!wlan_is_band_compatible(band, pscan_region->band)) continue; @@ -1380,12 +1365,8 @@ static mlan_status wlan_scan_setup_scan_config( /* Append rates tlv */ memset(pmadapter, rates, 0, sizeof(rates)); - rates_size = wlan_get_supported_rates( - pmpriv, pmpriv->bss_mode, - (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) ? - pmpriv->config_bands : - pmadapter->adhoc_start_band, - rates); + rates_size = wlan_get_supported_rates(pmpriv, pmpriv->bss_mode, + pmpriv->config_bands, rates); prates_tlv = (MrvlIEtypes_RatesParamSet_t *)ptlv_pos; prates_tlv->header.type = wlan_cpu_to_le16(TLV_TYPE_RATES); @@ -1723,7 +1704,6 @@ static mlan_status wlan_interpret_bss_desc_with_ie(pmlan_adapter pmadapter, IEEEtypes_FhParamSet_t *pfh_param_set; IEEEtypes_DsParamSet_t *pds_param_set; IEEEtypes_CfParamSet_t *pcf_param_set; - IEEEtypes_IbssParamSet_t *pibss_param_set; IEEEtypes_CapInfo_t *pcap_info; WLAN_802_11_FIXED_IEs fixed_ie; t_u8 *pcurrent_ptr; @@ -1856,10 +1836,7 @@ static mlan_status wlan_interpret_bss_desc_with_ie(pmlan_adapter pmadapter, pbss_entry->privacy = Wlan802_11PrivFilterAcceptAll; } - if (pcap_info->ibss == 1) - pbss_entry->bss_mode = MLAN_BSS_MODE_IBSS; - else - pbss_entry->bss_mode = MLAN_BSS_MODE_INFRA; + pbss_entry->bss_mode = MLAN_BSS_MODE_INFRA; if (pcap_info->spectrum_mgmt == 1) { PRINTM(MINFO, "InterpretIE: 11h- Spectrum Management " @@ -1958,20 +1935,6 @@ static mlan_status wlan_interpret_bss_desc_with_ie(pmlan_adapter pmadapter, sizeof(IEEEtypes_Header_t))); break; - case IBSS_PARAM_SET: - pibss_param_set = - (IEEEtypes_IbssParamSet_t *)pcurrent_ptr; - pbss_entry->atim_window = - wlan_le16_to_cpu(pibss_param_set->atim_window); - memcpy_ext(pmadapter, - &pbss_entry->ss_param_set.ibss_param_set, - pibss_param_set, total_ie_len, - sizeof(IEEEtypes_IbssParamSet_t)); - pbss_entry->ss_param_set.ibss_param_set.len = MIN( - element_len, (sizeof(IEEEtypes_IbssParamSet_t) - - sizeof(IEEEtypes_Header_t))); - break; - /* Handle Country Info IE */ case COUNTRY_INFO: pcountry_info = @@ -2009,7 +1972,6 @@ static mlan_status wlan_interpret_bss_desc_with_ie(pmlan_adapter pmadapter, case TPC_REPORT: case CHANNEL_SWITCH_ANN: case QUIET: - case IBSS_DFS: case SUPPORTED_CHANNELS: case TPC_REQUEST: wlan_11h_process_bss_elem( @@ -6199,12 +6161,7 @@ static t_u8 wlan_bgscan_create_channel_list( if (radio_type && (pscan_region->band != BAND_A)) continue; } - if ((pbg_scan_in && - (pbg_scan_in->bss_type == MLAN_SCAN_MODE_IBSS)) || - pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) - band = pmadapter->adhoc_start_band; - else - band = pmpriv->config_bands; + band = pmpriv->config_bands; if (!wlan_is_band_compatible(band, pscan_region->band)) continue; for (next_chan = 0; next_chan < pscan_region->num_cfp; @@ -6463,11 +6420,7 @@ mlan_status wlan_cmd_bgscan_config(mlan_private *pmpriv, bg_scan_in->chan_list[chan_idx].chan_number; chan_idx++) { radio_type = bg_scan_in->chan_list[chan_idx].radio_type; - if (bg_scan_in->bss_type == MLAN_SCAN_MODE_IBSS || - pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) - band = pmadapter->adhoc_start_band; - else - band = pmpriv->config_bands; + band = pmpriv->config_bands; if (!wlan_is_band_compatible( band, radio_type_to_band(radio_type))) continue; @@ -6869,7 +6822,7 @@ t_s32 wlan_find_ssid_in_list(mlan_private *pmpriv, mlan_802_11_ssid *ssid, t_u8 *bssid, t_u32 mode) { mlan_adapter *pmadapter = pmpriv->adapter; - t_s32 net = -1, j; + t_s32 net = -1; t_u8 best_rssi = 0; t_u32 i; @@ -6897,24 +6850,6 @@ t_s32 wlan_find_ssid_in_list(mlan_private *pmpriv, mlan_802_11_ssid *ssid, switch (mode) { case MLAN_BSS_MODE_INFRA: - case MLAN_BSS_MODE_IBSS: - j = wlan_is_network_compatible(pmpriv, i, mode); - - if (j >= 0) { - if (SCAN_RSSI(pmadapter->pscan_table[i] - .rssi) > - best_rssi) { - best_rssi = SCAN_RSSI( - pmadapter - ->pscan_table[i] - .rssi); - net = i; - } - } else { - if (net == -1) - net = j; - } - break; case MLAN_BSS_MODE_AUTO: default: /* @@ -6980,10 +6915,6 @@ t_s32 wlan_find_bssid_in_list(mlan_private *pmpriv, t_u8 *bssid, t_u32 mode) continue; switch (mode) { case MLAN_BSS_MODE_INFRA: - case MLAN_BSS_MODE_IBSS: - net = wlan_is_network_compatible(pmpriv, i, - mode); - break; default: net = i; break; diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c index 474f2e4..ae31fb9 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sdio.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sdio.c @@ -3013,7 +3013,9 @@ exit: return ret; } -#if (defined(SD9098) || defined(SD9097) || defined(SDIW624) || defined(SD9177)) +#if defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ + defined(SD9177) || defined(SD8997) || defined(SD8987) || \ + defined(SD8978) /** * @brief This function sends vdll data to the card. * @@ -3074,7 +3076,9 @@ 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 defined(SD9098) || defined(SD9097) || defined(SDIW624) || \ + defined(SD9177) || defined(SD8997) || defined(SD8987) || \ + defined(SD8978) if (type == MLAN_TYPE_VDLL) return wlan_sdio_send_vdll(pmadapter, pmbuf); #endif diff --git a/mxm_wifiex/wlan_src/mlan/mlan_shim.c b/mxm_wifiex/wlan_src/mlan/mlan_shim.c index 7742e7d..7d43146 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_shim.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_shim.c @@ -326,6 +326,8 @@ mlan_status mlan_register(pmlan_device pmdevice, t_void **ppmlan_adapter) pmadapter->card_rev = pmdevice->card_rev; pmadapter->init_para.uap_max_sta = pmdevice->uap_max_sta; pmadapter->init_para.mcs32 = pmdevice->mcs32; + pmadapter->init_para.antcfg = pmdevice->antcfg; + pmadapter->init_para.dmcs = pmdevice->dmcs; #ifdef SDIO if (IS_SD(pmadapter->card_type)) { @@ -1456,6 +1458,8 @@ mlan_status mlan_send_packet(t_void *padapter, pmlan_buffer pmbuf) (eth_type == MLAN_ETHER_PKT_TYPE_WAPI) || (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) || (pmbuf->buf_type == MLAN_BUF_TYPE_RAW_DATA) + /* Adding the Ucast/Mcast pkt to bypass queue when flag is set*/ + || (pmbuf->flags & MLAN_BUF_FLAG_MC_AGGR_PKT) ) { if (eth_type == MLAN_ETHER_PKT_TYPE_TDLS_ACTION) { diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c index 43eb0e6..2244497 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmd.c @@ -509,6 +509,42 @@ mlan_status wlan_cmd_mfg_he_tb_tx(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, return MLAN_STATUS_SUCCESS; } +/** + * @brief This function prepares command of MFG OTP RW. + * + * @param pmpriv A pointer to mlan_private structure + * @param cmd A pointer to HostCmd_DS_COMMAND structure + * @param action The action: GET or SET + * @param pdata_buf A pointer to data buffer + * + * @return MLAN_STATUS_SUCCESS + */ + +mlan_status wlan_cmd_mfg_otp_rw(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, + t_u16 action, t_void *pdata_buf) +{ + mfg_cmd_otp_mac_addr_rd_wr_t *mcmd = + (mfg_cmd_otp_mac_addr_rd_wr_t *)&cmd->params + .mfg_otp_mac_addr_rd_wr; + mfg_cmd_otp_mac_addr_rd_wr_t *cfg = + (mfg_cmd_otp_mac_addr_rd_wr_t *)pdata_buf; + + ENTER(); + cmd->command = wlan_cpu_to_le16(HostCmd_CMD_MFG_COMMAND); + cmd->size = wlan_cpu_to_le16(sizeof(mfg_cmd_otp_mac_addr_rd_wr_t) + + S_DS_GEN); + + mcmd->mfg_cmd = wlan_cpu_to_le32(cfg->mfg_cmd); + mcmd->action = wlan_cpu_to_le16(cfg->action); + if (action == HostCmd_ACT_GEN_SET) { + memcpy_ext(pmpriv->adapter, mcmd->mac_addr, cfg->mac_addr, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + } + + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /** * @brief This function prepares command of MFG cmd. * @@ -548,6 +584,9 @@ mlan_status wlan_cmd_mfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, ret = wlan_cmd_mfg_config_trigger_frame(pmpriv, cmd, action, pdata_buf); goto cmd_mfg_done; + case MFG_CMD_OTP_MAC_ADD: + ret = wlan_cmd_mfg_otp_rw(pmpriv, cmd, action, pdata_buf); + goto cmd_mfg_done; case MFG_CMD_SET_TEST_MODE: case MFG_CMD_UNSET_TEST_MODE: case MFG_CMD_TX_ANT: @@ -1067,29 +1106,6 @@ static mlan_status wlan_cmd_802_11_deauthenticate(pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } -/** - * @brief This function prepares command of ad_hoc_stop. - * - * @param pmpriv A pointer to mlan_private structure - * @param cmd A pointer to HostCmd_DS_COMMAND structure - * - * @return MLAN_STATUS_SUCCESS - */ -static mlan_status wlan_cmd_802_11_ad_hoc_stop(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd) -{ - ENTER(); - - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_802_11_AD_HOC_STOP); - cmd->size = wlan_cpu_to_le16(S_DS_GEN); - - if (wlan_11h_is_active(pmpriv)) - wlan_11h_activate(pmpriv, MNULL, MFALSE); - - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function prepares command of key_material. * @@ -1598,8 +1614,7 @@ static mlan_status wlan_cmd_802_11_rf_channel(pmlan_private pmpriv, S_DS_GEN); if (cmd_action == HostCmd_ACT_GEN_SET) { - if ((pmpriv->adapter->adhoc_start_band & BAND_A)) - prf_chan->rf_type.bandcfg.chanBand = BAND_5GHZ; + prf_chan->rf_type.bandcfg.chanBand = BAND_5GHZ; prf_chan->rf_type.bandcfg.chanWidth = pmpriv->adapter->chan_bandwidth; prf_chan->current_channel = @@ -1610,51 +1625,6 @@ static mlan_status wlan_cmd_802_11_rf_channel(pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } -/** - * @brief This function prepares command of ibss_coalescing_status. - * - * @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 or MNULL - * - * @return MLAN_STATUS_SUCCESS - */ -static mlan_status wlan_cmd_ibss_coalescing_status(pmlan_private pmpriv, - HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, - t_void *pdata_buf) -{ - HostCmd_DS_802_11_IBSS_STATUS *pibss_coal = - &(cmd->params.ibss_coalescing); - t_u16 enable = 0; - - ENTER(); - - cmd->command = - wlan_cpu_to_le16(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS); - cmd->size = wlan_cpu_to_le16(sizeof(HostCmd_DS_802_11_IBSS_STATUS) + - S_DS_GEN); - cmd->result = 0; - pibss_coal->action = wlan_cpu_to_le16(cmd_action); - - switch (cmd_action) { - case HostCmd_ACT_GEN_SET: - if (pdata_buf != MNULL) - enable = *(t_u16 *)pdata_buf; - pibss_coal->enable = wlan_cpu_to_le16(enable); - break; - - /* In other case.. Nothing to do */ - case HostCmd_ACT_GEN_GET: - default: - break; - } - - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function prepares command of mgmt IE list. * @@ -3625,73 +3595,11 @@ static mlan_status wlan_is_cmd_allowed(mlan_private *priv, t_u16 cmd_no) ENTER(); if (priv->adapter->pcard_info->v16_fw_api) { - if (!IS_FW_SUPPORT_ADHOC(priv->adapter)) { - switch (cmd_no) { - case HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON: - case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS: - case HostCmd_CMD_802_11_AD_HOC_START: - case HostCmd_CMD_802_11_AD_HOC_JOIN: - case HostCmd_CMD_802_11_AD_HOC_STOP: - ret = MLAN_STATUS_FAILURE; - break; - default: - break; - } - } } LEAVE(); return ret; } -/** - * @brief This function enable/disable CSI support. - * - * @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 - */ -static mlan_status wlan_cmd_csi(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd, - t_u16 cmd_action, t_u16 *pdata_buf) -{ - HostCmd_DS_CSI_CFG *csi_cfg_cmd = &cmd->params.csi_params; - mlan_ds_csi_params *csi_params = MNULL; - - ENTER(); - - cmd->command = wlan_cpu_to_le16(HostCmd_CMD_CSI); - cmd->size = sizeof(HostCmd_DS_CSI_CFG) + S_DS_GEN; - csi_cfg_cmd->action = wlan_cpu_to_le16(cmd_action); - switch (cmd_action) { - case CSI_CMD_ENABLE: - csi_params = (mlan_ds_csi_params *)pdata_buf; - csi_cfg_cmd->head_id = wlan_cpu_to_le32(csi_params->head_id); - csi_cfg_cmd->tail_id = wlan_cpu_to_le32(csi_params->tail_id); - csi_cfg_cmd->chip_id = csi_params->chip_id; - csi_cfg_cmd->csi_filter_cnt = csi_params->csi_filter_cnt; - if (csi_cfg_cmd->csi_filter_cnt > CSI_FILTER_MAX) - csi_cfg_cmd->csi_filter_cnt = CSI_FILTER_MAX; - memcpy_ext(pmpriv->adapter, (t_u8 *)csi_cfg_cmd->csi_filter, - (t_u8 *)csi_params->csi_filter, - sizeof(mlan_csi_filter_t) * - csi_cfg_cmd->csi_filter_cnt, - sizeof(csi_cfg_cmd->csi_filter)); - DBG_HEXDUMP(MCMD_D, "Enable CSI", csi_cfg_cmd, - sizeof(HostCmd_DS_CSI_CFG)); - break; - case CSI_CMD_DISABLE: - DBG_HEXDUMP(MCMD_D, "Disable CSI", csi_cfg_cmd, - sizeof(HostCmd_DS_CSI_CFG)); - default: - break; - } - cmd->size = wlan_cpu_to_le16(cmd->size); - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function prepare the command before sending to firmware. * @@ -3819,15 +3727,6 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, ret = wlan_cmd_802_11_deauthenticate(pmpriv, cmd_no, cmd_ptr, pdata_buf); break; - case HostCmd_CMD_802_11_AD_HOC_START: - ret = wlan_cmd_802_11_ad_hoc_start(pmpriv, cmd_ptr, pdata_buf); - break; - case HostCmd_CMD_802_11_AD_HOC_JOIN: - ret = wlan_cmd_802_11_ad_hoc_join(pmpriv, cmd_ptr, pdata_buf); - break; - case HostCmd_CMD_802_11_AD_HOC_STOP: - ret = wlan_cmd_802_11_ad_hoc_stop(pmpriv, cmd_ptr); - break; case HostCmd_CMD_802_11_GET_LOG: ret = wlan_cmd_802_11_get_log(pmpriv, cmd_ptr); break; @@ -3993,10 +3892,6 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, ret = wlan_cmd_wmm_param_config(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; - case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS: - ret = wlan_cmd_ibss_coalescing_status(pmpriv, cmd_ptr, - cmd_action, pdata_buf); - break; case HostCmd_CMD_MGMT_IE_LIST: ret = wlan_cmd_mgmt_ie_list(pmpriv, cmd_ptr, cmd_action, pdata_buf); @@ -4053,10 +3948,7 @@ mlan_status wlan_ops_sta_prepare_cmd(t_void *priv, t_u16 cmd_no, cmd_ptr->params.bss_mode.con_type = *(t_u8 *)pdata_buf; } else #endif - if (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) - cmd_ptr->params.bss_mode.con_type = - CONNECTION_TYPE_ADHOC; - else if (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) + if (pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) cmd_ptr->params.bss_mode.con_type = CONNECTION_TYPE_INFRA; cmd_ptr->size = wlan_cpu_to_le16( diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c index 271b21e..fc41950 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_cmdresp.c @@ -174,11 +174,6 @@ static mlan_status wlan_process_cmdresp_error(mlan_private *pmpriv, /* * We do not re-try enter-ps command in ad-hoc mode. */ - if (wlan_le16_to_cpu(pm->action) == EN_AUTO_PS && - (wlan_le16_to_cpu(pm->params.auto_ps.ps_bitmap) & - BITMAP_STA_PS) && - pmpriv->bss_mode == MLAN_BSS_MODE_IBSS) - pmadapter->ps_mode = Wlan802_11PowerModeCAM; } break; case HostCmd_CMD_802_11_SCAN_EXT: case HostCmd_CMD_802_11_SCAN: @@ -1269,28 +1264,6 @@ static mlan_status wlan_ret_802_11_deauthenticate(pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } -/** - * @brief This function handles the command response of ad_hoc_stop - * - * @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 - */ -static mlan_status wlan_ret_802_11_ad_hoc_stop(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp, - mlan_ioctl_req *pioctl_buf) -{ - ENTER(); - - wlan_reset_connect_state(pmpriv, MTRUE); - if (pmpriv->adapter->state_rdh.stage == RDH_STOP_INTFS) - wlan_11h_radar_detected_callback((t_void *)pmpriv); - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function handles the command response of key_material * @@ -1560,68 +1533,6 @@ static mlan_status wlan_ret_802_11_rf_channel(pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } -/** - * @brief Handle the ibss_coalescing_status resp - * - * @param pmpriv A pointer to mlan_private structure - * @param resp A pointer to HostCmd_DS_COMMAND - * - * @return MLAN_STATUS_SUCCESS - */ -static mlan_status wlan_ret_ibss_coalescing_status(pmlan_private pmpriv, - HostCmd_DS_COMMAND *resp) -{ - HostCmd_DS_802_11_IBSS_STATUS *pibss_coal_resp = - &(resp->params.ibss_coalescing); - t_u8 zero_mac[MLAN_MAC_ADDR_LENGTH] = {0, 0, 0, 0, 0, 0}; - - ENTER(); - - if (wlan_le16_to_cpu(pibss_coal_resp->action) == HostCmd_ACT_GEN_SET) { - LEAVE(); - return MLAN_STATUS_SUCCESS; - } - - PRINTM(MINFO, "New BSSID " MACSTR "\n", - MAC2STR(pibss_coal_resp->bssid)); - - /* If rsp has MNULL BSSID, Just return..... No Action */ - if (!memcmp(pmpriv->adapter, pibss_coal_resp->bssid, zero_mac, - MLAN_MAC_ADDR_LENGTH)) { - PRINTM(MMSG, "New BSSID is MNULL\n"); - LEAVE(); - return MLAN_STATUS_SUCCESS; - } - - /* If BSSID is diff, modify current BSS parameters */ - if (memcmp(pmpriv->adapter, - pmpriv->curr_bss_params.bss_descriptor.mac_address, - pibss_coal_resp->bssid, MLAN_MAC_ADDR_LENGTH)) { - /* BSSID */ - memcpy_ext(pmpriv->adapter, - pmpriv->curr_bss_params.bss_descriptor.mac_address, - pibss_coal_resp->bssid, MLAN_MAC_ADDR_LENGTH, - sizeof(pmpriv->curr_bss_params.bss_descriptor - .mac_address)); - - /* Beacon Interval and ATIM window */ - pmpriv->curr_bss_params.bss_descriptor.beacon_period = - wlan_le16_to_cpu(pibss_coal_resp->beacon_interval); - pmpriv->curr_bss_params.bss_descriptor.atim_window = - wlan_le16_to_cpu(pibss_coal_resp->atim_window); - - /* ERP Information */ - pmpriv->curr_bss_params.bss_descriptor.erp_flags = - (t_u8)wlan_le16_to_cpu( - pibss_coal_resp->use_g_rate_protect); - - pmpriv->adhoc_state = ADHOC_COALESCED; - } - - LEAVE(); - return MLAN_STATUS_SUCCESS; -} - /** * @brief This function handles the command response of MGMT_IE_LIST * @@ -3083,6 +2994,40 @@ static mlan_status wlan_ret_mfg_he_tb_tx(pmlan_private pmpriv, return MLAN_STATUS_SUCCESS; } +/** + * @brief This function prepares command resp of MFG CMD OTP RW + * + * @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 + */ + +static mlan_status wlan_ret_mfg_otp_rw(pmlan_private pmpriv, + HostCmd_DS_COMMAND *resp, + mlan_ioctl_req *pioctl_buf) +{ + mlan_ds_misc_cfg *misc = MNULL; + mfg_cmd_otp_mac_addr_rd_wr_t *cfg = MNULL; + mfg_cmd_otp_mac_addr_rd_wr_t *mcmd = + (mfg_cmd_otp_mac_addr_rd_wr_t *)&resp->params + .mfg_otp_mac_addr_rd_wr; + + ENTER(); + if (!pioctl_buf) { + LEAVE(); + return MLAN_STATUS_FAILURE; + } + misc = (mlan_ds_misc_cfg *)pioctl_buf->pbuf; + cfg = (mfg_cmd_otp_mac_addr_rd_wr_t *)&misc->param + .mfg_otp_mac_addr_rd_wr; + memcpy_ext(pmpriv->adapter, &(cfg->mac_addr[0]), &(mcmd->mac_addr[0]), + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); + LEAVE(); + return MLAN_STATUS_SUCCESS; +} + /** * @brief This function prepares command resp of MFG Cmd * @@ -3100,9 +3045,8 @@ mlan_status wlan_ret_mfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, (struct mfg_cmd_generic_cfg *)&resp->params.mfg_generic_cfg; struct mfg_cmd_generic_cfg *cfg = MNULL; mlan_status ret = MLAN_STATUS_SUCCESS; -#ifdef SD9177 mlan_adapter *pmadapter = pmpriv->adapter; -#endif + t_u16 card_type = pmadapter->card_type; ENTER(); if (!pioctl_buf) { @@ -3123,6 +3067,9 @@ mlan_status wlan_ret_mfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, ret = wlan_ret_mfg_config_trigger_frame(pmpriv, resp, pioctl_buf); goto cmd_mfg_done; + case MFG_CMD_OTP_MAC_ADD: + ret = wlan_ret_mfg_otp_rw(pmpriv, resp, pioctl_buf); + goto cmd_mfg_done; case MFG_CMD_SET_TEST_MODE: case MFG_CMD_UNSET_TEST_MODE: case MFG_CMD_TX_ANT: @@ -3142,19 +3089,17 @@ mlan_status wlan_ret_mfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, cfg = (struct mfg_cmd_generic_cfg *)&misc->param.mfg_generic_cfg; cfg->error = wlan_le32_to_cpu(mcmd->error); - -#ifdef SD9177 - if (IS_SD9177(pmadapter->card_type) && + card_type = 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)) && (wlan_le32_to_cpu(mcmd->mfg_cmd) == MFG_CMD_RFPWR)) { //! TX_POWER was multipied by 16 while passing to fw //! So It is needed to divide by 16 for user vals understanding. cfg->data1 = (wlan_le32_to_cpu(mcmd->data1) >> 4); } else { -#endif cfg->data1 = wlan_le32_to_cpu(mcmd->data1); -#ifdef SD9177 } -#endif cfg->data2 = wlan_le32_to_cpu(mcmd->data2); cfg->data3 = wlan_le32_to_cpu(mcmd->data3); @@ -3317,12 +3262,6 @@ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, case HostCmd_CMD_802_11_DISASSOCIATE: ret = wlan_ret_802_11_deauthenticate(pmpriv, resp, pioctl_buf); break; - case HostCmd_CMD_802_11_AD_HOC_START: - case HostCmd_CMD_802_11_AD_HOC_JOIN: - ret = wlan_ret_802_11_ad_hoc(pmpriv, resp, pioctl_buf); - break; - case HostCmd_CMD_802_11_AD_HOC_STOP: - ret = wlan_ret_802_11_ad_hoc_stop(pmpriv, resp, pioctl_buf); break; case HostCmd_CMD_802_11_GET_LOG: ret = wlan_ret_get_log(pmpriv, resp, pioctl_buf); @@ -3469,8 +3408,6 @@ mlan_status wlan_ops_sta_process_cmdresp(t_void *priv, t_u16 cmdresp_no, case HostCmd_CMD_WMM_PARAM_CONFIG: ret = wlan_ret_wmm_param_config(pmpriv, resp, pioctl_buf); break; - case HostCmd_CMD_802_11_IBSS_COALESCING_STATUS: - ret = wlan_ret_ibss_coalescing_status(pmpriv, resp); break; case HostCmd_CMD_MGMT_IE_LIST: ret = wlan_ret_mgmt_ie_list(pmpriv, resp, pioctl_buf); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c index 6f5cf65..0df959a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_event.c @@ -62,49 +62,6 @@ 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 * @@ -538,12 +495,6 @@ t_void wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect) priv->is_data_rate_auto = MTRUE; priv->data_rate = 0; - if (priv->bss_mode == MLAN_BSS_MODE_IBSS) { - priv->adhoc_state = ADHOC_IDLE; - priv->adhoc_is_link_sensed = MFALSE; - priv->intf_state_11h.adhoc_auto_sel_chan = MTRUE; - } - if (drv_disconnect) { /* Free Tx and Rx packets, report disconnect to upper layer */ wlan_clean_txrx(priv); @@ -822,9 +773,6 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) break; case EVENT_LINK_SENSED: PRINTM(MEVENT, "EVENT: LINK_SENSED\n"); - pmpriv->adhoc_is_link_sensed = MTRUE; - wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_ADHOC_LINK_SENSED, - MNULL); break; case EVENT_DEAUTHENTICATED: @@ -986,15 +934,6 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) case EVENT_INIT_DONE: break; - case EVENT_ADHOC_BCN_LOST: - PRINTM(MEVENT, "EVENT: ADHOC_BCN_LOST\n"); - pmpriv->adhoc_is_link_sensed = MFALSE; - 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); evt_buf = @@ -1262,12 +1201,6 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) PRINTM(MEVENT, "EVENT: Pre-Beacon Lost\n"); wlan_recv_event(pmpriv, MLAN_EVENT_ID_FW_PRE_BCN_LOST, MNULL); break; - case EVENT_IBSS_COALESCED: - PRINTM(MEVENT, "EVENT: IBSS_COALESCED\n"); - ret = wlan_prepare_cmd( - pmpriv, HostCmd_CMD_802_11_IBSS_COALESCING_STATUS, - HostCmd_ACT_GEN_GET, 0, MNULL, MNULL); - break; case EVENT_ADDBA: PRINTM(MEVENT, "EVENT: ADDBA Request\n"); if (pmpriv->media_connected == MTRUE && @@ -1398,24 +1331,6 @@ mlan_status wlan_ops_sta_process_event(t_void *priv) wlan_process_sta_tx_pause_event(priv, pmbuf); 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 t_u8 *pevt_dat = diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c index d9d5198..0b2ca2b 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_ioctl.c @@ -318,9 +318,6 @@ static mlan_status wlan_get_info_bss_info(pmlan_adapter pmadapter, info->param.bss_info.max_power_level = pmpriv->max_tx_power_level; info->param.bss_info.min_power_level = pmpriv->min_tx_power_level; - /* AdHoc state */ - info->param.bss_info.adhoc_state = pmpriv->adhoc_state; - /* Last beacon NF */ info->param.bss_info.bcn_nf_last = pmpriv->bcn_nf_last; @@ -777,9 +774,7 @@ static mlan_status wlan_bss_ioctl_get_channel_list(pmlan_adapter pmadapter, return MLAN_STATUS_FAILURE; } if ((wlan_11d_is_enabled(pmpriv) && pmpriv->media_connected == MTRUE) && - ((pmpriv->bss_mode == MLAN_BSS_MODE_INFRA) || - (pmpriv->bss_mode == MLAN_BSS_MODE_IBSS && - pmpriv->adhoc_state != ADHOC_STARTED))) { + ((pmpriv->bss_mode == MLAN_BSS_MODE_INFRA))) { t_u8 chan_no; t_u16 band; @@ -902,8 +897,6 @@ static mlan_status wlan_bss_ioctl_channel(pmlan_adapter pmadapter, LEAVE(); return MLAN_STATUS_FAILURE; } - if (pmadapter->adhoc_start_band & BAND_A) - pmadapter->adhoc_start_band = BAND_G | BAND_B; if (bss->param.bss_chan.channel) { if (bss->param.bss_chan.channel <= MAX_CHANNEL_BAND_B) cfp = wlan_find_cfp_by_band_and_channel( @@ -914,7 +907,6 @@ static mlan_status wlan_bss_ioctl_channel(pmlan_adapter pmadapter, pmadapter, BAND_A, (t_u16)bss->param.bss_chan.channel); if (cfp) { - pmadapter->adhoc_start_band = BAND_A; } } } else { @@ -925,7 +917,6 @@ static mlan_status wlan_bss_ioctl_channel(pmlan_adapter pmadapter, cfp = wlan_find_cfp_by_band_and_freq( pmadapter, BAND_A, bss->param.bss_chan.freq); if (cfp) { - pmadapter->adhoc_start_band = BAND_A; } } } @@ -936,8 +927,6 @@ static mlan_status wlan_bss_ioctl_channel(pmlan_adapter pmadapter, LEAVE(); return MLAN_STATUS_FAILURE; } - pmpriv->adhoc_channel = (t_u8)cfp->channel; - pmpriv->intf_state_11h.adhoc_auto_sel_chan = MFALSE; bss->param.bss_chan.channel = cfp->channel; bss->param.bss_chan.freq = cfp->freq; @@ -1105,65 +1094,6 @@ static mlan_status wlan_bss_ioctl_start(pmlan_adapter pmadapter, goto start_ssid_done; } } else { - /* Adhoc mode */ - /* If the requested SSID matches current SSID, return */ - if (bss->param.ssid_bssid.ssid.ssid_len && - (!wlan_ssid_cmp(pmadapter, - &pmpriv->curr_bss_params.bss_descriptor.ssid, - &bss->param.ssid_bssid.ssid))) { - ret = MLAN_STATUS_SUCCESS; - goto start_ssid_done; - } - - /* Exit Adhoc mode first */ - PRINTM(MINFO, "Sending Adhoc Stop\n"); - ret = wlan_disconnect(pmpriv, MNULL, MNULL); - if (ret) - goto start_ssid_done; - - pmpriv->adhoc_is_link_sensed = MFALSE; - - if (!bss->param.ssid_bssid.idx || - bss->param.ssid_bssid.idx > pmadapter->num_in_scan_table) { - /* Search for the requested network in the scan table */ - if (bss->param.ssid_bssid.ssid.ssid_len) { - i = wlan_find_ssid_in_list( - pmpriv, &bss->param.ssid_bssid.ssid, - MNULL, MLAN_BSS_MODE_IBSS); - } else { - i = wlan_find_bssid_in_list( - pmpriv, - (t_u8 *)&bss->param.ssid_bssid.bssid, - MLAN_BSS_MODE_IBSS); - } - } else { - /* use bsslist index number to assoicate */ - i = wlan_is_network_compatible( - pmpriv, bss->param.ssid_bssid.idx - 1, - pmpriv->bss_mode); - } - - if (i >= 0) { - PRINTM(MINFO, - "Network found in scan list ... joining ...\n"); - pmpriv->curr_chan_flags = - bss->param.ssid_bssid.channel_flags; - ret = wlan_adhoc_join(pmpriv, pioctl_req, - &pmadapter->pscan_table[i]); - if (ret) - goto start_ssid_done; - } else { /* i >= 0 */ - PRINTM(MINFO, - "Network not found in the list, " - "creating adhoc with ssid = %s\n", - bss->param.ssid_bssid.ssid.ssid); - pmpriv->curr_chan_flags = - bss->param.ssid_bssid.channel_flags; - ret = wlan_adhoc_start(pmpriv, pioctl_req, - &bss->param.ssid_bssid.ssid); - if (ret) - goto start_ssid_done; - } } if (ret == MLAN_STATUS_SUCCESS) @@ -1198,50 +1128,6 @@ static mlan_status wlan_bss_ioctl_stop(pmlan_adapter pmadapter, return ret; } -/** - * @brief Set/Get IBSS channel - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pioctl_req A pointer to ioctl request buffer - * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING --success, - * otherwise fail - */ -static mlan_status wlan_bss_ioctl_ibss_channel(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) -{ - mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; - mlan_ds_bss *bss = MNULL; - mlan_status ret = MLAN_STATUS_SUCCESS; - t_u16 cmd_action; - - ENTER(); - - bss = (mlan_ds_bss *)pioctl_req->pbuf; - if (pioctl_req->action == MLAN_ACT_GET) { - if (pmpriv->media_connected == MFALSE) { - bss->param.bss_chan.channel = pmpriv->adhoc_channel; - goto exit; - } - cmd_action = HostCmd_ACT_GEN_GET; - } else { - cmd_action = HostCmd_ACT_GEN_SET; - pmpriv->adhoc_channel = (t_u8)bss->param.bss_chan.channel; - pmpriv->intf_state_11h.adhoc_auto_sel_chan = MFALSE; - } - - /* Send request to firmware */ - ret = wlan_prepare_cmd(pmpriv, HostCmd_CMD_802_11_RF_CHANNEL, - cmd_action, 0, (t_void *)pioctl_req, - &bss->param.bss_chan.channel); - if (ret == MLAN_STATUS_SUCCESS) - ret = MLAN_STATUS_PENDING; - -exit: - LEAVE(); - return ret; -} - /** * @brief Set/Get Listen Interval * @@ -1269,65 +1155,6 @@ static mlan_status wlan_bss_ioctl_listen_interval(pmlan_adapter pmadapter, return MLAN_STATUS_SUCCESS; } -/* - * @brief Set/Get beacon interval - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pioctl_req A pointer to ioctl request buffer - * - * @return MLAN_STATUS_SUCCESS --success - */ -static mlan_status wlan_bss_ioctl_beacon_interval(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) -{ - mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; - mlan_ds_bss *bss = MNULL; - mlan_status ret = MLAN_STATUS_SUCCESS; - ENTER(); - bss = (mlan_ds_bss *)pioctl_req->pbuf; - if (pioctl_req->action == MLAN_ACT_GET) { - bss->param.bcn_interval = pmpriv->beacon_period; - if (pmpriv->media_connected == MTRUE) - bss->param.bcn_interval = - pmpriv->curr_bss_params.bss_descriptor - .beacon_period; - } else - pmpriv->beacon_period = (t_u16)bss->param.bcn_interval; - pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; - LEAVE(); - return ret; -} - -/** - * @brief Set/Get ATIM window - * - * @param pmadapter A pointer to mlan_adapter structure - * @param pioctl_req A pointer to ioctl request buffer - * - * @return MLAN_STATUS_SUCCESS --success - */ -static mlan_status wlan_bss_ioctl_atim_window(pmlan_adapter pmadapter, - pmlan_ioctl_req pioctl_req) -{ - mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index]; - mlan_ds_bss *bss = MNULL; - mlan_status ret = MLAN_STATUS_SUCCESS; - ENTER(); - bss = (mlan_ds_bss *)pioctl_req->pbuf; - if (pioctl_req->action == MLAN_ACT_GET) { - bss->param.atim_window = pmpriv->atim_window; - if (pmpriv->media_connected == MTRUE) - bss->param.atim_window = - pmpriv->curr_bss_params.bss_descriptor - .atim_window; - } else - pmpriv->atim_window = (t_u16)bss->param.atim_window; - - pioctl_req->data_read_written = sizeof(t_u32) + MLAN_SUB_COMMAND_SIZE; - LEAVE(); - return ret; -} - /** * @brief Query embe * @@ -1526,6 +1353,10 @@ static mlan_status wlan_bss_ioctl(pmlan_adapter pmadapter, switch (bss->sub_command) { case MLAN_OID_BSS_HOST_MLME: pmpriv->curr_bss_params.host_mlme = MTRUE; + memcpy_ext(pmpriv->adapter, + &pmpriv->curr_bss_params.attemp_bssid, + &bss->param.bssid, MLAN_MAC_ADDR_LENGTH, + MLAN_MAC_ADDR_LENGTH); break; case MLAN_OID_BSS_START: status = wlan_bss_ioctl_start(pmadapter, pioctl_req); @@ -1555,15 +1386,6 @@ static mlan_status wlan_bss_ioctl(pmlan_adapter pmadapter, case MLAN_OID_BSS_FIND_BSSID: status = wlan_bss_ioctl_find_bssid(pmadapter, pioctl_req); break; - case MLAN_OID_IBSS_BCN_INTERVAL: - status = wlan_bss_ioctl_beacon_interval(pmadapter, pioctl_req); - break; - case MLAN_OID_IBSS_ATIM_WINDOW: - status = wlan_bss_ioctl_atim_window(pmadapter, pioctl_req); - break; - case MLAN_OID_IBSS_CHANNEL: - status = wlan_bss_ioctl_ibss_channel(pmadapter, pioctl_req); - break; #if defined(STA_SUPPORT) && defined(UAP_SUPPORT) case MLAN_OID_BSS_ROLE: util_enqueue_list_tail(pmadapter->pmoal_handle, @@ -1634,10 +1456,7 @@ wlan_rate_ioctl_get_supported_rate(pmlan_adapter pmadapter, rate->param.rates); else wlan_get_active_data_rates(pmpriv, pmpriv->bss_mode, - (pmpriv->bss_mode == - MLAN_BSS_MODE_INFRA) ? - pmpriv->config_bands : - pmadapter->adhoc_start_band, + pmpriv->config_bands, rate->param.rates); pioctl_req->data_read_written = MLAN_SUPPORTED_RATES + MLAN_SUB_COMMAND_SIZE; @@ -3774,7 +3593,6 @@ static mlan_status wlan_11h_channel_check_req(pmlan_adapter pmadapter, { pmlan_private pmpriv = MNULL; mlan_status ret = MLAN_STATUS_FAILURE; - t_u8 chan_width = CHAN_BW_20MHZ; Band_Config_t bandcfg; ENTER(); @@ -3788,56 +3606,6 @@ static mlan_status wlan_11h_channel_check_req(pmlan_adapter pmadapter, } memset(pmadapter, &bandcfg, 0, sizeof(Band_Config_t)); - pmpriv->adhoc_state = ADHOC_STARTING; - - if ((pmadapter->adhoc_start_band & BAND_A)) { - if (pmpriv->intf_state_11h.adhoc_auto_sel_chan) - pmpriv->adhoc_channel = - wlan_11h_get_adhoc_start_channel(pmpriv); - - /* - * Check if the region and channel requires a channel - * availability check. - */ - if (wlan_11h_radar_detect_required(pmpriv, - pmpriv->adhoc_channel) && - !wlan_11h_is_channel_under_nop(pmadapter, - pmpriv->adhoc_channel)) { - /* - * Radar detection is required for this channel, make - * sure 11h is activated in the firmware - */ - ret = wlan_11h_activate(pmpriv, MNULL, MTRUE); - ret = wlan_11h_config_master_radar_det(pmpriv, MTRUE); - ret = wlan_11h_check_update_radar_det_state(pmpriv); - - /* Check for radar on the channel */ - if ((pmadapter->chan_bandwidth == - CHANNEL_BW_40MHZ_ABOVE) || - (pmadapter->chan_bandwidth == - CHANNEL_BW_40MHZ_BELOW)) { - chan_width = CHAN_BW_40MHZ; - if (pmadapter->chanrpt_param_bandcfg) { - bandcfg.chan2Offset = - pmadapter->chan_bandwidth; - } - } else if (pmadapter->chan_bandwidth == - CHANNEL_BW_80MHZ) - chan_width = CHAN_BW_80MHZ; - if (pmadapter->chanrpt_param_bandcfg) { - bandcfg.chanWidth = chan_width; - bandcfg.chanBand = BAND_5GHZ; - } else { - *((t_u8 *)&bandcfg) = chan_width; - } - - ret = wlan_11h_issue_radar_detect(pmpriv, pioctl_req, - pmpriv->adhoc_channel, - bandcfg); - if (ret == MLAN_STATUS_SUCCESS) - ret = MLAN_STATUS_PENDING; - } - } LEAVE(); return ret; @@ -4654,8 +4422,7 @@ static mlan_status wlan_misc_ioctl_cfp_code_cfg(pmlan_adapter pmadapter, else pmadapter->region_code = 0; if (wlan_set_regiontable(pmpriv, (t_u8)pmadapter->region_code, - pmadapter->config_bands | - pmadapter->adhoc_start_band)) { + pmadapter->config_bands)) { pioctl_req->status_code = MLAN_ERROR_INVALID_PARAMETER; ret = MLAN_STATUS_FAILURE; goto done; @@ -5378,6 +5145,7 @@ static mlan_status wlan_misc_cfg_ioctl(pmlan_adapter pmadapter, case MLAN_OID_MISC_RF_TEST_CONFIG_TRIGGER_FRAME: case MLAN_OID_MISC_RF_TEST_TX_FRAME: case MLAN_OID_MISC_RF_TEST_HE_POWER: + case MLAN_OID_MISC_OTP_MAC_RD_WR: status = wlan_misc_ioctl_rf_test_cfg(pmadapter, pioctl_req); break; case MLAN_OID_MISC_ARB_CONFIG: @@ -5513,6 +5281,15 @@ mlan_status wlan_scan_ioctl(pmlan_adapter pmadapter, pmlan_ioctl_req pioctl_req) LEAVE(); return MLAN_STATUS_FAILURE; } + if (pmadapter->remain_on_channel +#ifdef WIFI_DIRECT_SUPPORT + && (pmpriv->bss_type != MLAN_BSS_TYPE_WIFIDIRECT) +#endif + ) { + PRINTM(MERROR, "Scan is blocked during remain on channel...\n"); + LEAVE(); + return MLAN_STATUS_FAILURE; + } start_config: /* Set scan */ if (pioctl_req->action == MLAN_ACT_SET) { diff --git a/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c b/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c index 7be24cb..4c2f4d7 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_sta_rx.c @@ -661,7 +661,8 @@ done: #ifdef USB else if (IS_USB(pmadapter->card_type)) pmadapter->callbacks.moal_recv_complete(pmadapter->pmoal_handle, - MNULL, MLAN_USB_EP_DATA, + MNULL, + pmadapter->rx_data_ep, MLAN_STATUS_SUCCESS); #endif LEAVE(); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c index 0548354..d2a5e48 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_cmdevent.c @@ -5121,6 +5121,9 @@ mlan_status wlan_ops_uap_prepare_cmd(t_void *priv, t_u16 cmd_no, ret = wlan_cmd_edmac_cfg(pmpriv, cmd_ptr, cmd_action, pdata_buf); break; + case HostCmd_CMD_CSI: + ret = wlan_cmd_csi(pmpriv, cmd_ptr, cmd_action, pdata_buf); + break; default: PRINTM(MERROR, "PREP_CMD: unknown command- %#x\n", cmd_no); if (pioctl_req) @@ -5546,6 +5549,15 @@ mlan_status wlan_ops_uap_process_cmdresp(t_void *priv, t_u16 cmdresp_no, break; case HostCmd_CMD_EDMAC_CFG: break; + case HostCmd_CMD_CSI: + if (resp->params.csi_params.action == CSI_CMD_ENABLE) { + pmadapter->csi_enabled = 1; + PRINTM(MCMND, "CSI ENABLE cmdresp\n"); + } else { + pmadapter->csi_enabled = 0; + PRINTM(MCMND, "CSI DISABLE cmdresp\n"); + } + break; default: PRINTM(MERROR, "CMD_RESP: Unknown command response %#x\n", resp->command); diff --git a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c index 50f6e0c..cd7253d 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_uap_ioctl.c @@ -2345,6 +2345,8 @@ mlan_status wlan_ops_uap_ioctl(t_void *adapter, pmlan_ioctl_req pioctl_req) if (misc->sub_command == MLAN_OID_MISC_EDMAC_CONFIG) status = wlan_misc_ioctl_edmac_cfg(pmadapter, pioctl_req); + if (misc->sub_command == MLAN_OID_MISC_CSI) + status = wlan_misc_csi(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_usb.c b/mxm_wifiex/wlan_src/mlan/mlan_usb.c index d1b3d5d..d28d799 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_usb.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_usb.c @@ -424,6 +424,11 @@ static mlan_status wlan_usb_prog_fw_w_helper(pmlan_adapter pmadapter, FWSeqNum++; PRINTM(MINFO, ".\n"); + /* Add FW ending check for secure download */ + if (((DnldCmd == FW_CMD_21) && (DataLength == 0)) || + (TotalBytes >= pmfw->fw_len)) + break; + } while ((DnldCmd != FW_HAS_LAST_BLOCK) && retries && mic_retry); cleanup: @@ -581,8 +586,9 @@ wlan_usb_copy_buf_to_aggr(pmlan_adapter pmadapter, pmlan_buffer pmbuf_aggr = MNULL; t_u8 i, use_count; pmlan_buffer pmbuf_curr, pmbuf_next; - pmbuf_aggr = wlan_alloc_mlan_buffer(pmadapter, pusb_tx_aggr->aggr_len, - 0, MOAL_MALLOC_BUFFER); + pmbuf_aggr = wlan_alloc_mlan_buffer( + pmadapter, pusb_tx_aggr->aggr_len, 0, + MOAL_MEM_FLAG_DIRTY | MOAL_MALLOC_BUFFER); if (pmbuf_aggr) { pmbuf_curr = pusb_tx_aggr->pmbuf_aggr; pmbuf_aggr->bss_index = pmbuf_curr->bss_index; @@ -1305,7 +1311,8 @@ static mlan_status wlan_usb_host_to_card(pmlan_private pmpriv, t_u8 type, return MLAN_STATUS_FAILURE; } if (type == MLAN_TYPE_CMD -#if (defined(USB9098) || defined(USB9097) || defined(USBIW624)) +#if defined(USB9098) || defined(USB9097) || defined(USBIW624) || \ + defined(USB8997) || defined(USB8978) || type == MLAN_TYPE_VDLL #endif ) { diff --git a/mxm_wifiex/wlan_src/mlan/mlan_wmm.c b/mxm_wifiex/wlan_src/mlan/mlan_wmm.c index 245ea1f..adb6f2a 100644 --- a/mxm_wifiex/wlan_src/mlan/mlan_wmm.c +++ b/mxm_wifiex/wlan_src/mlan/mlan_wmm.c @@ -1838,8 +1838,6 @@ t_void wlan_wmm_init(pmlan_adapter pmadapter) priv->aggr_prio_tbl[i].ampdu_ap = priv->aggr_prio_tbl[i].ampdu_user = tos_to_tid_inv[i]; - priv->ibss_ampdu[i] = - priv->aggr_prio_tbl[i].ampdu_user; priv->wmm.pkts_queued[i] = 0; priv->wmm.pkts_paused[i] = 0; priv->wmm.tid_tbl_ptr[i].ra_list_curr = MNULL; @@ -1851,13 +1849,10 @@ t_void wlan_wmm_init(pmlan_adapter pmadapter) priv->aggr_prio_tbl[6].ampdu_ap = priv->aggr_prio_tbl[6].ampdu_user = BA_STREAM_NOT_ALLOWED; - priv->ibss_ampdu[6] = BA_STREAM_NOT_ALLOWED; priv->aggr_prio_tbl[7].ampdu_ap = priv->aggr_prio_tbl[7].ampdu_user = BA_STREAM_NOT_ALLOWED; - priv->ibss_ampdu[7] = BA_STREAM_NOT_ALLOWED; - priv->add_ba_param.timeout = MLAN_DEFAULT_BLOCK_ACK_TIMEOUT; #ifdef STA_SUPPORT diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h index 29eb7f6..b148977 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_decl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_decl.h @@ -23,9 +23,6 @@ #ifndef _MLAN_DECL_H_ #define _MLAN_DECL_H_ -/** MLAN release version */ -#define MLAN_RELEASE_VERSION "423.p6" - /** Re-define generic data types for MLAN/MOAL */ /** Signed char (1-byte) */ typedef signed char t_s8, *t_ps8; @@ -661,6 +658,8 @@ typedef enum { #define MLAN_MEM_DMA MBIT(0) /** Memory allocation flag: ATOMIC */ #define MLAN_MEM_FLAG_ATOMIC MBIT(1) +/** Memory allocation flag: DIRTY - do not memset to 0 buffer */ +#define MLAN_MEM_FLAG_DIRTY MBIT(2) /** Default memory allocation flag */ #define MLAN_MEM_DEF 0 @@ -781,8 +780,6 @@ typedef enum _mlan_data_frame_type { typedef enum _mlan_event_id { /* Event generated by firmware (MSB=0) */ MLAN_EVENT_ID_FW_UNKNOWN = 0x00000001, - MLAN_EVENT_ID_FW_ADHOC_LINK_SENSED = 0x00000002, - MLAN_EVENT_ID_FW_ADHOC_LINK_LOST = 0x00000003, MLAN_EVENT_ID_FW_DISCONNECTED = 0x00000004, MLAN_EVENT_ID_FW_MIC_ERR_UNI = 0x00000005, MLAN_EVENT_ID_FW_MIC_ERR_MUL = 0x00000006, @@ -810,8 +807,6 @@ 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 @@ -1013,14 +1008,14 @@ typedef enum _dfs_moe_t { /** Band_Config_t */ typedef MLAN_PACK_START struct _Band_Config_t { #ifdef BIG_ENDIAN_SUPPORT - /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ - t_u8 chanWidth : 2; - /** Band Info - (00)=2.4GHz, (01)=5GHz, (10)=6GHz */ - t_u8 chanBand : 2; /** Channel Selection Mode - (00)=manual, (01)=ACS, (02)=user*/ t_u8 scanMode : 2; /** Secondary Channel Offset - (00)=None, (01)=Above, (11)=Below */ t_u8 chan2Offset : 2; + /** Channel Width - (00)=20MHz, (10)=40MHz, (11)=80MHz */ + t_u8 chanWidth : 2; + /** Band Info - (00)=2.4GHz, (01)=5GHz, (10)=6GHz */ + t_u8 chanBand : 2; #else /** Band Info - (00)=2.4GHz, (01)=5GHz, (10)=6GHz */ t_u8 chanBand : 2; @@ -1856,7 +1851,6 @@ typedef enum { typedef enum { MLAN_INTERFACE_STA = 0, MLAN_INTERFACE_SOFTAP = 1, - MLAN_INTERFACE_IBSS = 2, MLAN_INTERFACE_P2P_CLIENT = 3, MLAN_INTERFACE_P2P_GO = 4, MLAN_INTERFACE_NAN = 5, @@ -2722,6 +2716,10 @@ typedef struct _mlan_device { t_u8 second_mac; /** napi */ t_u8 napi; + /** antcfg */ + t_u32 antcfg; + /** dmcs */ + t_u8 dmcs; } mlan_device, *pmlan_device; /** MLAN API function prototype */ diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h b/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h index f238a01..cc0f8a0 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_ieee.h @@ -80,7 +80,6 @@ typedef MLAN_PACK_START enum _IEEEtypes_ElementId_e { DS_PARAM_SET = 3, CF_PARAM_SET = 4, - IBSS_PARAM_SET = 6, COUNTRY_INFO = 7, POWER_CONSTRAINT = 32, POWER_CAPABILITY = 33, @@ -89,7 +88,6 @@ typedef MLAN_PACK_START enum _IEEEtypes_ElementId_e { CHANNEL_SWITCH_ANN = 37, EXTEND_CHANNEL_SWITCH_ANN = 60, QUIET = 40, - IBSS_DFS = 41, MEASUREMENT_REQUEST = 38, MEASUREMENT_REPORT = 39, SUPPORTED_CHANNELS = 36, @@ -391,15 +389,14 @@ typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { t_u8 privacy : 1; t_u8 cf_poll_rqst : 1; t_u8 cf_pollable : 1; - t_u8 ibss : 1; + t_u8 rsrvd4 : 1; t_u8 ess : 1; } MLAN_PACK_END IEEEtypes_CapInfo_t, *pIEEEtypes_CapInfo_t; #else typedef MLAN_PACK_START struct _IEEEtypes_CapInfo_t { /** Capability Bit Map : ESS */ t_u8 ess : 1; - /** Capability Bit Map : IBSS */ - t_u8 ibss : 1; + t_u8 rsrvd4 : 1; /** Capability Bit Map : CF pollable */ t_u8 cf_pollable : 1; /** Capability Bit Map : CF poll request */ @@ -455,22 +452,10 @@ typedef MLAN_PACK_START struct _IEEEtypes_CfParamSet_t { t_u16 cfp_duration_remaining; } MLAN_PACK_END IEEEtypes_CfParamSet_t, *pIEEEtypes_CfParamSet_t; -/** IEEEtypes_IbssParamSet_t */ -typedef MLAN_PACK_START struct _IEEEtypes_IbssParamSet_t { - /** Element ID */ - t_u8 element_id; - /** Length */ - t_u8 len; - /** ATIM window value in milliseconds */ - t_u16 atim_window; -} MLAN_PACK_END IEEEtypes_IbssParamSet_t, *pIEEEtypes_IbssParamSet_t; - /** IEEEtypes_SsParamSet_t */ typedef MLAN_PACK_START union _IEEEtypes_SsParamSet_t { /** SS parameter : CF parameter set */ IEEEtypes_CfParamSet_t cf_param_set; - /** SS parameter : IBSS parameter set */ - IEEEtypes_IbssParamSet_t ibss_param_set; } MLAN_PACK_END IEEEtypes_SsParamSet_t, *pIEEEtypes_SsParamSet_t; /** IEEEtypes_FhParamSet_t */ @@ -1492,8 +1477,6 @@ typedef MLAN_PACK_START struct { /** Maximum number of subbands in the IEEEtypes_SupportedChannels_t structure */ #define WLAN_11H_MAX_SUBBANDS 6 -/** Maximum number of DFS channels configured in IEEEtypes_IBSS_DFS_t */ -#define WLAN_11H_MAX_IBSS_DFS_CHANNELS 25 /** IEEE Power Constraint element (7.3.2.15) */ typedef MLAN_PACK_START struct { @@ -1642,24 +1625,6 @@ typedef MLAN_PACK_START struct { } MLAN_PACK_END IEEEtypes_ChannelMap_t; -/* IEEE IBSS DFS Element (7.3.2.24) */ -/** - * IBSS DFS element included in ad hoc beacons and probe responses. - * Provides information regarding the IBSS DFS Owner as well as the - * originating STAs supported channels and basic measurement results. - */ -typedef MLAN_PACK_START struct { - t_u8 element_id; /**< IEEE Element ID = 41 */ - t_u8 len; /**< Element length after id and len */ - t_u8 dfs_owner[MLAN_MAC_ADDR_LENGTH]; /**< DFS Owner STA Address */ - t_u8 dfs_recovery_interval; /**< DFS Recovery time in TBTTs */ - - /** Variable length map field, one Map entry for each supported channel - */ - IEEEtypes_ChannelMap_t channel_map[WLAN_11H_MAX_IBSS_DFS_CHANNELS]; - -} MLAN_PACK_END IEEEtypes_IBSS_DFS_t; - /* 802.11h BSS information kept for each BSSID received in scan results */ /** * IEEE BSS information needed from scan results for later processing in @@ -1676,7 +1641,6 @@ typedef struct { IEEEtypes_ChanSwitchAnn_t chan_switch_ann; /**< Channel Switch Announcement IE */ IEEEtypes_Quiet_t quiet; /**< Quiet IE */ - IEEEtypes_IBSS_DFS_t ibss_dfs; /**< IBSS DFS Element IE */ } wlan_11h_bss_info_t; diff --git a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h index fa0e679..024c93a 100644 --- a/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/mlan_ioctl.h @@ -205,7 +205,6 @@ enum _mlan_ioctl_req_id { MLAN_OID_11N_CFG_REJECT_ADDBA_REQ = 0x000C000D, MLAN_OID_11N_CFG_COEX_RX_WINSIZE = 0x000C000E, MLAN_OID_11N_CFG_TX_AGGR_CTRL = 0x000C000F, - MLAN_OID_11N_CFG_IBSS_AMPDU_PARAM = 0x000C0010, MLAN_OID_11N_CFG_MIN_BA_THRESHOLD = 0x000C0011, /* 802.11d Configuration Group */ @@ -381,6 +380,7 @@ enum _mlan_ioctl_req_id { MLAN_OID_MISC_EDMAC_CONFIG = 0x00200093, MLAN_OID_MISC_GPIO_CFG = 0x00200094, MLAN_OID_MISC_REGION_POWER_CFG = 0x00200095, + MLAN_OID_MISC_OTP_MAC_RD_WR = 0x00200097, }; /** Sub command size */ @@ -403,9 +403,8 @@ enum _mlan_act_generic { MLAN_ACT_DISABLE = 0, MLAN_ACT_ENABLE = 1 }; /** Enumeration for scan mode */ enum _mlan_scan_mode { MLAN_SCAN_MODE_UNCHANGED = 0, - MLAN_SCAN_MODE_BSS, - MLAN_SCAN_MODE_IBSS, - MLAN_SCAN_MODE_ANY + MLAN_SCAN_MODE_BSS = 1, + MLAN_SCAN_MODE_ANY = 3 }; /** Enumeration for scan type */ @@ -633,8 +632,8 @@ typedef struct _mlan_ds_scan { /** Enumeration for BSS mode */ enum _mlan_bss_mode { MLAN_BSS_MODE_INFRA = 1, - MLAN_BSS_MODE_IBSS, - MLAN_BSS_MODE_AUTO + MLAN_BSS_MODE_IBSS = 2, + MLAN_BSS_MODE_AUTO = 3 }; /** Maximum key length */ @@ -1369,6 +1368,7 @@ typedef struct _mlan_ds_bss { /** STA info for MLAN_OID_UAP_ADD_STATION */ mlan_ds_sta_info sta_info; #endif + } param; } mlan_ds_bss, *pmlan_ds_bss; @@ -1425,10 +1425,6 @@ enum _mlan_band_def { typedef struct _mlan_ds_band_cfg { /** Infra band */ t_u32 config_bands; - /** Ad-hoc start band */ - t_u32 adhoc_start_band; - /** Ad-hoc start channel */ - t_u32 adhoc_channel; /** fw supported band */ t_u32 fw_bands; } mlan_ds_band_cfg; @@ -1560,13 +1556,6 @@ typedef struct _mlan_ds_snmp_mib { /** Status Information Group */ /*-----------------------------------------------------------------*/ /** Enumeration for ad-hoc status */ -enum _mlan_adhoc_status { - ADHOC_IDLE, - ADHOC_STARTED, - ADHOC_JOINED, - ADHOC_COALESCED, - ADHOC_STARTING -}; typedef struct _mlan_ds_get_stats_org { /** Statistics counter */ @@ -2205,8 +2194,6 @@ typedef struct _mlan_bss_info { t_s32 max_power_level; /** Min power level in dBm */ t_s32 min_power_level; - /** Adhoc state */ - t_u32 adhoc_state; /** NF of last beacon */ t_s32 bcn_nf_last; /** wep status */ @@ -3844,14 +3831,6 @@ typedef struct _mlan_ds_reject_addba_req { t_u32 conditions; } mlan_ds_reject_addba_req, *pmlan_ds_reject_addba_req; -/** Type definition of mlan_ds_ibss_ampdu_param */ -typedef struct _mlan_ds_ibss_ampdu_param { - /** ampdu priority table */ - t_u8 ampdu[MAX_NUM_TID]; - /** rx amdpdu setting */ - t_u8 addba_reject[MAX_NUM_TID]; -} mlan_ds_ibss_ampdu_param, *pmlan_ds_ibss_ampdu_param; - /** Type definition of mlan_ds_11n_cfg for MLAN_IOCTL_11N_CFG */ typedef struct _mlan_ds_11n_cfg { /** Sub-command */ @@ -3888,8 +3867,6 @@ typedef struct _mlan_ds_11n_cfg { t_u32 coex_rx_winsize; /** Control TX AMPDU configuration */ t_u32 txaggrctrl; - /** aggrprirotity table for MLAN_OID_11N_CFG_IBSS_AMPDU_PARAM */ - mlan_ds_ibss_ampdu_param ibss_ampdu; /** Minimum BA Threshold for MLAN_OID_11N_CFG_MIN_BA_THRESHOLD */ t_u8 min_ba_threshold; @@ -4034,6 +4011,7 @@ typedef struct _mlan_ds_11ax_cfg { #define MRVL_DOT11AX_ENABLE_SR_TLV_ID (PROPRIETARY_TLV_BASE_ID + 322) #define MRVL_DOT11AX_OBSS_PD_OFFSET_TLV_ID (PROPRIETARY_TLV_BASE_ID + 323) +#define NXP_6E_INBAND_FRAMES_TLV_ID (PROPRIETARY_TLV_BASE_ID + 345) // 0x0159 /** Type definition of mlan_11axcmdcfg_obss_pd_offset for MLAN_OID_11AX_CMD_CFG */ @@ -5789,6 +5767,8 @@ typedef struct _mlan_ds_misc_chan_trpc_cfg { #define MFG_CMD_RADIO_MODE_CFG 0x1211 #define MFG_CMD_CONFIG_MAC_HE_TB_TX 0x110A #define MFG_CMD_CONFIG_TRIGGER_FRAME 0x110C +#define MFG_CMD_OTP_MAC_ADD 0x108C + /** MFG CMD generic cfg */ struct MLAN_PACK_START mfg_cmd_generic_cfg { /** MFG command code */ @@ -6083,6 +6063,19 @@ typedef MLAN_PACK_START struct _mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t { mfg_cmd_IEEETypes_BasicHETrigUserInfo_t basic_trig_user_info; } MLAN_PACK_END mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t; +typedef MLAN_PACK_START struct _mfg_cmd_otp_mac_addr_rd_wr_t { + /** MFG command code */ + t_u32 mfg_cmd; + /** Action */ + t_u16 action; + /** Device ID */ + t_u16 device_id; + /** MFG Error code */ + t_u32 error; + /** Destination MAC Address */ + t_u8 mac_addr[MLAN_MAC_ADDR_LENGTH]; +} MLAN_PACK_END mfg_cmd_otp_mac_addr_rd_wr_t; + typedef struct _mlan_ds_misc_chnrgpwr_cfg { /** length */ t_u16 length; @@ -6108,13 +6101,15 @@ typedef struct _mlan_ds_mc_aggr_cfg { * bit 0 MC aggregation * bit 1 packet expiry * bit 2 CTS2Self - * bit 3 CTS2Self duration offset*/ + * bit 3 CTS2Self duration offset + * bit 6 UC non aggregation*/ t_u8 enable_bitmap; /* 1 valid, 0 invalid * bit 0 MC aggregation * bit 1 packet expiry * bit 2 CTS2Self - * bit 3 CTS2Self duration offset*/ + * bit 3 CTS2Self duration offset + * bit 6 UC non aggregation*/ t_u8 mask_bitmap; /** CTS2Self duration offset */ t_u16 cts2self_offset; @@ -6331,6 +6326,7 @@ typedef struct _mlan_ds_misc_cfg { struct mfg_cmd_tx_frame2 mfg_tx_frame2; struct mfg_Cmd_HE_TBTx_t mfg_he_power; mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; + mfg_cmd_otp_mac_addr_rd_wr_t mfg_otp_mac_addr_rd_wr; mlan_ds_misc_arb_cfg arb_cfg; mlan_ds_misc_cfp_tbl cfp; t_u8 range_ext_mode; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c index e222743..9e68663 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_cfg80211.c @@ -3087,6 +3087,7 @@ int woal_cfg80211_mgmt_tx(struct wiphy *wiphy, * remain_on_channel_cfg in order to receive action frame from peer * device */ + if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) { if (ieee80211_is_probe_resp( ((struct ieee80211_mgmt *)buf)->frame_control)) { diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c index 378701e..91e8749 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.c @@ -98,14 +98,6 @@ static t_u16 SupportedInfraBand[] = { BAND_A | BAND_AN | BAND_AAC | BAND_AAX, }; -/** Bands supported in Ad-Hoc mode */ -static t_u16 SupportedAdhocBand[] = { - BAND_B, - BAND_B | BAND_G, - BAND_G, - BAND_A, -}; - /******************************************************** Global Variables ********************************************************/ @@ -723,11 +715,9 @@ static int woal_setget_priv_bandcfg(moal_private *priv, t_u8 *respbuf, { int ret = 0; unsigned int i; - int data[3]; + int data[1]; int user_data_len = 0; t_u32 infra_band = 0; - t_u32 adhoc_band = 0; - t_u32 adhoc_channel = 0; mlan_ioctl_req *req = NULL; mlan_ds_radio_cfg *radio_cfg = NULL; mlan_ds_band_cfg *band_cfg = NULL; @@ -787,35 +777,9 @@ static int woal_setget_priv_bandcfg(moal_private *priv, t_u8 *respbuf, goto error; } - /* Set Adhoc band */ - if (user_data_len >= 2) { - adhoc_band = data[1]; - for (i = 0; i < (sizeof(SupportedAdhocBand) / - sizeof(SupportedAdhocBand[0])); - i++) - if (adhoc_band == SupportedAdhocBand[i]) - break; - if (i == sizeof(SupportedAdhocBand)) { - ret = -EINVAL; - goto error; - } - } - - /* Set Adhoc channel */ - if (user_data_len >= 3) { - adhoc_channel = data[2]; - if (adhoc_channel == 0) { - /* Check if specified adhoc channel is non-zero - */ - ret = -EINVAL; - goto error; - } - } /* Set config_bands and adhoc_start_band values to MLAN */ req->action = MLAN_ACT_SET; radio_cfg->param.band_cfg.config_bands = infra_band; - radio_cfg->param.band_cfg.adhoc_start_band = adhoc_band; - radio_cfg->param.band_cfg.adhoc_channel = adhoc_channel; } status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); @@ -5842,9 +5806,6 @@ static int woal_priv_set_bss_mode(moal_private *priv, t_u8 *respbuf, case MW_MODE_INFRA: bss->param.bss_mode = MLAN_BSS_MODE_INFRA; break; - case MW_MODE_ADHOC: - bss->param.bss_mode = MLAN_BSS_MODE_IBSS; - break; case MW_MODE_AUTO: bss->param.bss_mode = MLAN_BSS_MODE_AUTO; break; @@ -6984,8 +6945,12 @@ static int woal_priv_regrdwr(moal_private *priv, t_u8 *respbuf, if (*(char *)(space_ind + 1) == '-') { is_negative_val = MTRUE; arguments[space_ind + 1 - arguments] = '\0'; - strncat(arguments, space_ind + 2, - (strlen(respbuf) * sizeof(char)) - 1); + if (strlen(respbuf) > 1) { + strncat(arguments, space_ind + 2, + (strlen(respbuf) * sizeof(char)) - 1); + } else { + PRINTM(MERROR, "strlen(respbuf) is invalid\n"); + } } } parse_arguments(arguments, data, ARRAY_SIZE(data), &user_data_len); @@ -7230,20 +7195,16 @@ static int woal_priv_sdcmd52rw(moal_private *priv, t_u8 *respbuf, if (!rw) { #ifdef SDIO_MMC - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); if (func) data = sdio_readb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, reg, &ret); else data = sdio_f0_readb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, reg, &ret); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_readb: reading register 0x%X failed\n", @@ -7262,20 +7223,16 @@ static int woal_priv_sdcmd52rw(moal_private *priv, t_u8 *respbuf, #endif /* SDIO_MMC */ } else { #ifdef SDIO_MMC - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); if (func) sdio_writeb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, data, reg, &ret); else sdio_f0_writeb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, data, reg, &ret); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_writeb: writing register 0x%X failed\n", @@ -8149,35 +8106,29 @@ static int woal_priv_wmm_delts_req_ioctl(moal_private *priv, t_u8 *respbuf, memset(&delts_ioctl, 0x00, sizeof(delts_ioctl)); - if ((int)strlen(respbuf) > header_len) { - copy_len = MIN(strlen(data_ptr), sizeof(delts_ioctl)); - moal_memcpy_ext(priv->phandle, (t_u8 *)&delts_ioctl, data_ptr, - copy_len, sizeof(delts_ioctl)); + moal_memcpy_ext(priv->phandle, (t_u8 *)&delts_ioctl, data_ptr, + sizeof(delts_ioctl), sizeof(delts_ioctl)); + cfg->param.delts.status_code = (t_u32)delts_ioctl.ieee_reason_code; + cfg->param.delts.ie_data_len = (t_u8)delts_ioctl.ie_data_len; - cfg->param.delts.status_code = - (t_u32)delts_ioctl.ieee_reason_code; - cfg->param.delts.ie_data_len = (t_u8)delts_ioctl.ie_data_len; + moal_memcpy_ext(priv->phandle, cfg->param.delts.ie_data, + delts_ioctl.ie_data, cfg->param.delts.ie_data_len, + MLAN_WMM_TSPEC_SIZE); - moal_memcpy_ext(priv->phandle, cfg->param.delts.ie_data, - delts_ioctl.ie_data, - cfg->param.delts.ie_data_len, - MLAN_WMM_TSPEC_SIZE); - - status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); - if (status != MLAN_STATUS_SUCCESS) { - ret = -EFAULT; - goto done; - } - - /* Return the firmware command result back to the application - * layer */ - delts_ioctl.cmd_result = cfg->param.delts.result; - copy_len = sizeof(delts_ioctl); - moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)&delts_ioctl, - copy_len, respbuflen); - ret = copy_len; + status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); + if (status != MLAN_STATUS_SUCCESS) { + ret = -EFAULT; + goto done; } + /* Return the firmware command result back to the application + * layer */ + delts_ioctl.cmd_result = cfg->param.delts.result; + copy_len = sizeof(delts_ioctl); + moal_memcpy_ext(priv->phandle, respbuf, (t_u8 *)&delts_ioctl, copy_len, + respbuflen); + ret = copy_len; + done: if (status != MLAN_STATUS_PENDING) kfree(req); @@ -11036,6 +10987,49 @@ done: LEAVE(); return ret; } + +/** + * @brief Turn on/off the sdio clock + * + * @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_sdio_buswidth_ioctl(moal_private *priv, t_u8 *respbuf, + t_u32 respbuflen) +{ + int ret = 0; + int data = 0; + int user_data_len = 0, header_len = 0; + + ENTER(); + + header_len = strlen(CMD_NXP) + strlen(PRIV_CMD_SDIO_BUSWIDTH); + if ((int)strlen(respbuf) == header_len) { + PRINTM(MERROR, "Don't support get operation\n"); + ret = -EINVAL; + goto done; + } else { + /* SET operation */ + parse_arguments(respbuf + header_len, &data, 1, &user_data_len); + + if (user_data_len != 1) { + PRINTM(MERROR, "Invalid number of parameters\n"); + ret = -EINVAL; + goto done; + } + } + if ((data != SDIO_BUS_WIDTH_1) && (data != SDIO_BUS_WIDTH_4)) { + ret = -EINVAL; + goto done; + } + ret = woal_sdio_set_buswidth(priv->phandle, data); +done: + LEAVE(); + return ret; +} #endif #ifdef SDIO @@ -13199,6 +13193,12 @@ static int woal_priv_mc_aggr_cfg(moal_private *priv, t_u8 *respbuf, else priv->enable_mc_aggr = MFALSE; } + if (mc_cfg->mask_bitmap & UC_NONAGGR_CTRL) { + if (mc_cfg->enable_bitmap & UC_NONAGGR_CTRL) + priv->enable_uc_nonaggr = MTRUE; + else + priv->enable_uc_nonaggr = MFALSE; + } done: if (status != MLAN_STATUS_PENDING) kfree(ioctl_req); @@ -14263,18 +14263,15 @@ static int woal_priv_cmd53rdwr(moal_private *priv, t_u8 *respbuf, reg, mode, blklen, blknum); if (!rw) { - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); - if (sdio_readsb( - ((struct sdio_mmc_card *)priv->phandle->card)->func, - respbuf, reg, total_len)) { + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_readsb(((sdio_mmc_card *)priv->phandle->card)->func, + respbuf, reg, total_len)) { PRINTM(MERROR, "sdio_readsb: reading memory 0x%x failed\n", reg); goto done; } - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); ret = total_len; } else { int pos = 0; @@ -14285,16 +14282,13 @@ static int woal_priv_cmd53rdwr(moal_private *priv, t_u8 *respbuf, /* Copy/duplicate the pattern to data buffer */ for (pos = 0; pos < (int)total_len; pos++) data[pos] = buf[11 + (pos % pattern_len)]; - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); - if (sdio_writesb( - ((struct sdio_mmc_card *)priv->phandle->card)->func, - reg, data, total_len)) + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_writesb(((sdio_mmc_card *)priv->phandle->card)->func, + reg, data, total_len)) PRINTM(MERROR, "sdio_writesb: writing memory 0x%x failed\n", reg); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); } done: @@ -14660,8 +14654,8 @@ static int woal_priv_gpiocfg(moal_private *priv, t_u8 *respbuf, 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); + sizeof(*gpio_cfg), respbuflen); + ret = sizeof(*gpio_cfg); } done: @@ -20542,6 +20536,13 @@ int woal_android_priv_cmd(struct net_device *dev, struct ifreq *req) len = woal_priv_sdio_clock_ioctl(priv, buf, priv_cmd.total_len); goto handled; + } else if (strnicmp(buf + strlen(CMD_NXP), + PRIV_CMD_SDIO_BUSWIDTH, + strlen(PRIV_CMD_SDIO_BUSWIDTH)) == 0) { + /* change sdio buswidth */ + len = woal_priv_sdio_buswidth_ioctl(priv, buf, + priv_cmd.total_len); + goto handled; } else if (strnicmp(buf + strlen(CMD_NXP), PRIV_CMD_MPA_CTRL, strlen(PRIV_CMD_MPA_CTRL)) == 0) { /* Set SDIO Multi-point aggregation diff --git a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h index 2776d5b..784c946 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_eth_ioctl.h @@ -215,6 +215,7 @@ typedef struct _chan_stats { #define PRIV_CMD_TX_BF_CAP "httxbfcap" #ifdef SDIO #define PRIV_CMD_SDIO_CLOCK "sdioclock" +#define PRIV_CMD_SDIO_BUSWIDTH "sdiobuswidth" #endif #ifdef SDIO #define PRIV_CMD_MPA_CTRL "mpactrl" @@ -556,6 +557,7 @@ typedef struct woal_priv_addba { #define ACTION_REMOVE 3 #define MC_AGGR_CTRL MBIT(0) +#define UC_NONAGGR_CTRL MBIT(6) /* mcast_aggr_group */ typedef struct _mcast_aggr_group { /** action */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_init.c b/mxm_wifiex/wlan_src/mlinux/moal_init.c index 047a71c..bb76b60 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_init.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_init.c @@ -66,6 +66,8 @@ static int beacon_hints; #endif static int cfg80211_drcs; +static int dmcs; + #if defined(STA_CFG80211) || defined(UAP_CFG80211) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) static int host_mlme = 1; @@ -1330,8 +1332,21 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size, moal_extflg_isset(handle, EXT_CFG80211_DRCS) ? "on" : "off"); - } else if (strncmp(line, "drcs_chantime_mode", - strlen("drcs_chantime_mode")) == 0) { + } else if (strncmp(line, "dmcs", strlen("dmcs")) == 0) { + if (parse_line_read_int(line, &out_data) != + MLAN_STATUS_SUCCESS) + goto err; + if (out_data) + moal_extflg_set(handle, EXT_DMCS); + else + moal_extflg_clear(handle, EXT_DMCS); + PRINTM(MMSG, "dmcs %s\n", + moal_extflg_isset(handle, EXT_DMCS) ? "on" : + "off"); + } + + else if (strncmp(line, "drcs_chantime_mode", + strlen("drcs_chantime_mode")) == 0) { if (parse_line_read_int(line, &out_data) != MLAN_STATUS_SUCCESS) goto err; @@ -1813,6 +1828,9 @@ static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params) #endif if (cfg80211_drcs) moal_extflg_set(handle, EXT_CFG80211_DRCS); + if (dmcs) + moal_extflg_set(handle, EXT_DMCS); + handle->params.drcs_chantime_mode = drcs_chantime_mode; if (params) handle->params.drcs_chantime_mode = params->drcs_chantime_mode; @@ -2185,6 +2203,11 @@ void woal_init_from_dev_tree(void) PRINTM(MIOCTL, "cfg80211_drcs=0x%x\n", data); cfg80211_drcs = data; } + } else if (!strncmp(prop->name, "dmcs", strlen("dmcs"))) { + if (!of_property_read_u32(dt_node, prop->name, &data)) { + PRINTM(MIOCTL, "dmcs=0x%x\n", data); + dmcs = data; + } } #endif #endif @@ -2894,6 +2917,9 @@ module_param(cfg80211_drcs, int, 0); MODULE_PARM_DESC(cfg80211_drcs, "1: Enable DRCS support; 0: Disable DRCS support"); +module_param(dmcs, int, 0); +MODULE_PARM_DESC(dmcs, "1: Enable dynamic mapping; 0: Disable dynamic mapping"); + module_param(roamoffload_in_hs, int, 0); MODULE_PARM_DESC( roamoffload_in_hs, diff --git a/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c index 97a2ef7..2b0b547 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_ioctl.c @@ -3,7 +3,7 @@ * @brief This file contains ioctl function to MLAN * * - * Copyright 2008-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 @@ -4146,7 +4146,7 @@ int woal_enable_hs(moal_private *priv) HS_ACTIVE_TIMEOUT); #ifdef SDIO_MMC if (IS_SD(handle->card_type)) { - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); } #endif @@ -4177,7 +4177,7 @@ int woal_enable_hs(moal_private *priv) #endif /* SDIO_SUSPEND_RESUME*/ #ifdef SDIO_MMC if (IS_SD(handle->card_type)) { - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); } #endif if (hs_actived != MTRUE) { @@ -4500,11 +4500,12 @@ int woal_reg_rx_mgmt_ind(moal_private *priv, t_u16 action, ret = woal_request_ioctl(priv, req, wait_option); - if (req->action == MLAN_ACT_GET) + if ((ret == MLAN_STATUS_SUCCESS) && (req->action == MLAN_ACT_GET)) { moal_memcpy_ext(priv->phandle, pmgmt_subtype_mask, &misc->param.mgmt_subtype_mask, sizeof(misc->param.mgmt_subtype_mask), sizeof(misc->param.mgmt_subtype_mask)); + } if (ret != MLAN_STATUS_PENDING) kfree(req); @@ -5400,100 +5401,6 @@ done: return ret; } -/** - * @brief Change Adhoc Channel - * - * @param priv A pointer to moal_private structure - * @param channel The channel to be set. - * @param wait_option wait_option - * - * @return MLAN_STATUS_SUCCESS--success, MLAN_STATUS_FAILURE--fail - */ -mlan_status woal_change_adhoc_chan(moal_private *priv, int channel, - t_u8 wait_option) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_bss_info bss_info; - mlan_ds_bss *bss = NULL; - mlan_ioctl_req *req = NULL; - - ENTER(); - - memset(&bss_info, 0, sizeof(bss_info)); - - /* Get BSS information */ - if (MLAN_STATUS_SUCCESS != - woal_get_bss_info(priv, wait_option, &bss_info)) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - if (bss_info.bss_mode == MLAN_BSS_MODE_INFRA) { - ret = MLAN_STATUS_SUCCESS; - goto done; - } - - /* Allocate an IOCTL request buffer */ - req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); - if (req == NULL) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - - /* Get current channel */ - bss = (mlan_ds_bss *)req->pbuf; - bss->sub_command = MLAN_OID_IBSS_CHANNEL; - req->req_id = MLAN_IOCTL_BSS; - req->action = MLAN_ACT_GET; - - /* Send IOCTL request to MLAN */ - ret = woal_request_ioctl(priv, req, wait_option); - if (ret != MLAN_STATUS_SUCCESS) - goto done; - - if (bss->param.bss_chan.channel == (unsigned int)channel) { - ret = MLAN_STATUS_SUCCESS; - goto done; - } - PRINTM(MINFO, "Updating Channel from %d to %d\n", - (int)bss->param.bss_chan.channel, channel); - - if (bss_info.media_connected != MTRUE) { - ret = MLAN_STATUS_SUCCESS; - goto done; - } - - /* Do disonnect*/ - bss->sub_command = MLAN_OID_BSS_STOP; - memset((t_u8 *)&bss->param.bssid, 0, ETH_ALEN); - - /* Send IOCTL request to MLAN */ - ret = woal_request_ioctl(priv, req, wait_option); - if (ret != MLAN_STATUS_SUCCESS) - goto done; - - /* Do specific SSID scanning */ - if (MLAN_STATUS_SUCCESS != - woal_request_scan(priv, wait_option, &bss_info.ssid)) { - ret = MLAN_STATUS_FAILURE; - goto done; - } - /* Start/Join Adhoc network */ - bss->sub_command = MLAN_OID_BSS_START; - memset(&bss->param.ssid_bssid, 0, sizeof(mlan_ssid_bssid)); - moal_memcpy_ext(priv->phandle, &bss->param.ssid_bssid.ssid, - &bss_info.ssid, sizeof(mlan_802_11_ssid), - sizeof(mlan_802_11_ssid)); - - /* Send IOCTL request to MLAN */ - ret = woal_request_ioctl(priv, req, wait_option); - -done: - if (ret != MLAN_STATUS_PENDING) - kfree(req); - LEAVE(); - return ret; -} - /** * @brief Find the best network to associate * @@ -7217,7 +7124,6 @@ mlan_status woal_set_band(moal_private *priv, char *pband) req->action = MLAN_ACT_SET; memset(&radio_cfg->param.band_cfg, 0, sizeof(mlan_ds_band_cfg)); radio_cfg->param.band_cfg.config_bands = band; - radio_cfg->param.band_cfg.adhoc_start_band = band; ret = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); done: @@ -8239,6 +8145,7 @@ void woal_ioctl_get_misc_conf(moal_private *priv, mlan_ds_misc_cfg *info) #define TRIGGER_FRAME_STR_LEN 250 #define HE_TB_TX_STR_LEN 30 #define MAX_RADIO_MODE 21 +#define OTP_RDWR_LEN 50 /* * @brief Parse mfg cmd radio mode string @@ -8942,6 +8849,68 @@ mlan_status woal_process_rf_test_mode(moal_handle *handle, t_u32 mode) return ret; } +/* + * @brief Parse mfg cmd otp rdwr + * + * @param handle A pointer to moal_handle structure + * @param s A pointer to user buffer + * @param len Length of user buffer + * @param d A pointer to mfg_cmd_generic_cfg struct + * @return 0 on success, -EINVAL otherwise + */ + +static int parse_otp_mac_addr_rd_wr_string(const char *s, size_t len, + mfg_cmd_otp_mac_addr_rd_wr_t *d) +{ + int ret = MLAN_STATUS_SUCCESS; + char *string = NULL; + char *tmp = NULL; + char *pos = NULL; + gfp_t flag; + int i = 0; + + ENTER(); + if (!s || !d) { + LEAVE(); + return -EINVAL; + } + + flag = (in_atomic() || irqs_disabled()) ? GFP_ATOMIC : GFP_KERNEL; + string = kzalloc(OTP_RDWR_LEN, flag); + if (string == NULL) { + LEAVE(); + return -ENOMEM; + } + + moal_memcpy_ext(NULL, string, s + strlen("otp_mac_addr_rd_wr="), + len - strlen("otp_mac_addr_rd_wr="), OTP_RDWR_LEN - 1); + + tmp = string; + pos = strsep(&string, " \t"); + d->action = (t_u16)woal_string_to_number(pos); + if (d->action == MFALSE) + goto done; + + pos = strsep(&string, " \t"); + if (pos) { + char *begin, *end; + begin = pos; + for (i = 0; i < MLAN_MAC_ADDR_LENGTH; i++) { + end = woal_strsep(&begin, ':', '/'); + if (end) + d->mac_addr[i] = woal_atox(end); + } + } + + if (d->action > 1) + ret = -EINVAL; + +done: + kfree(tmp); + LEAVE(); + return ret; +} + /** * @brief This function sends RF test mode command in firmware * @@ -9029,6 +8998,13 @@ mlan_status woal_process_rf_test_mode_cmd(moal_handle *handle, t_u32 cmd, buffer, len, &misc->param.mfg_tx_trigger_config)) err = MTRUE; break; + case MFG_CMD_OTP_MAC_ADD: + misc->sub_command = MLAN_OID_MISC_OTP_MAC_RD_WR; + if (parse_otp_mac_addr_rd_wr_string( + buffer, len, &misc->param.mfg_otp_mac_addr_rd_wr)) { + err = MTRUE; + } + break; default: err = MTRUE; } @@ -9177,6 +9153,14 @@ mlan_status woal_process_rf_test_mode_cmd(moal_handle *handle, t_u32 cmd, handle->rf_data->mfg_tx_trigger_config.basic_trig_user_info = misc->param.mfg_tx_trigger_config.basic_trig_user_info; break; + case MFG_CMD_OTP_MAC_ADD: + handle->rf_data->mfg_otp_mac_addr_rd_wr.action = + misc->param.mfg_otp_mac_addr_rd_wr.action; + for (i = 0; i < ETH_ALEN; i++) { + handle->rf_data->mfg_otp_mac_addr_rd_wr.mac_addr[i] = + misc->param.mfg_otp_mac_addr_rd_wr.mac_addr[i]; + } + break; } done: if (err || ret != MLAN_STATUS_PENDING) diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.c b/mxm_wifiex/wlan_src/mlinux/moal_main.c index 82a66b0..bedbb0d 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.c @@ -121,6 +121,8 @@ static struct _card_info card_info_SD8801 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x64, .fw_reset_val = 0, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x8000231C, .slew_rate_bit_offset = 14, #endif @@ -158,6 +160,8 @@ static struct _card_info card_info_SD8887 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0B6, .fw_reset_val = 1, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif @@ -195,6 +199,8 @@ static struct _card_info card_info_SD8897 = { .func1_reg_end = 0x0b, .fw_reset_reg = 0x0E8, .fw_reset_val = 1, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif @@ -276,6 +282,8 @@ static struct _card_info card_info_SD8977 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif @@ -316,6 +324,8 @@ static struct _card_info card_info_SD8978 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif @@ -356,6 +366,8 @@ static struct _card_info card_info_SD8997 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif @@ -397,6 +409,8 @@ static struct _card_info card_info_SD9098 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x90002328, .slew_rate_bit_offset = 12, #endif @@ -438,6 +452,8 @@ static struct _card_info card_info_SD9097 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x90002328, .slew_rate_bit_offset = 12, #endif @@ -479,6 +495,8 @@ static struct _card_info card_info_SDIW624 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x90002328, .slew_rate_bit_offset = 12, #endif @@ -520,6 +538,8 @@ static struct _card_info card_info_SD9177 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x90002328, .slew_rate_bit_offset = 12, #endif @@ -548,6 +568,7 @@ static struct _card_info card_info_PCIE8997 = { .fw_name_wlan = PCIE8997_DEFAULT_WLAN_FW_NAME, .fw_reset_reg = 0xcf4, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0x0c48, .sniffer_support = 1, .per_pkt_cfg_support = 1, .host_mlme_required = 1, @@ -574,6 +595,7 @@ static struct _card_info card_info_PCIE9097 = { .fw_name_wlan = PCIE9097_DEFAULT_WLAN_FW_NAME, .fw_reset_reg = 0x1c94, .fw_reset_val = 0x98, + .fw_wakeup_reg = 0x0, .sniffer_support = 1, .per_pkt_cfg_support = 1, .host_mlme_required = 1, @@ -600,6 +622,7 @@ static struct _card_info card_info_PCIE9098 = { .fw_name_wlan = PCIE9098_DEFAULT_WLAN_FW_NAME, .fw_reset_reg = 0x1c94, .fw_reset_val = 0x98, + .fw_wakeup_reg = 0x0, .sniffer_support = 1, .per_pkt_cfg_support = 1, .host_mlme_required = 1, @@ -627,6 +650,7 @@ static struct _card_info card_info_PCIEIW624 = { .fw_name_wlan = PCIEIW624_DEFAULT_WLAN_FW_NAME, .fw_reset_reg = 0x1c94, .fw_reset_val = 0x98, + .fw_wakeup_reg = 0x0, .sniffer_support = 1, .per_pkt_cfg_support = 1, .host_mlme_required = 1, @@ -788,6 +812,8 @@ static struct _card_info card_info_SD8987 = { .func1_reg_end = 0x17, .fw_reset_reg = 0x0EE, .fw_reset_val = 0x99, + .fw_wakeup_reg = 0, + .fw_wakeup_val = 2, .slew_rate_reg = 0x80002328, .slew_rate_bit_offset = 12, #endif @@ -1026,9 +1052,37 @@ void woal_clean_up(moal_handle *handle) #endif } } + woal_flush_evt_queue(handle); return; } +/** + * @brief This function send the auto recovery complete event to kernel + * + * @param handle Pointer to structure moal_handle + * + * @return N/A + */ +void woal_send_auto_recovery_complete_event(moal_handle *handle) +{ + moal_private *priv; + priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); + if (priv) { + woal_broadcast_event(priv, CUS_EVT_FW_RECOVER_SUCCESS, + strlen(CUS_EVT_FW_RECOVER_SUCCESS)); +#ifdef STA_CFG80211 +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) + if (IS_STA_OR_UAP_CFG80211(handle->params.cfg80211_wext)) + woal_cfg80211_vendor_event( + priv, event_fw_reset_success, + CUS_EVT_FW_RECOVER_SUCCESS, + strlen(CUS_EVT_FW_RECOVER_SUCCESS)); +#endif +#endif + } + reset_handle = NULL; +} + /** * @brief This function process FW hang * @@ -1140,6 +1194,7 @@ static void woal_hang_work_queue(struct work_struct *work) #endif #endif } + if (IS_SD(reset_handle->card_type)) { PRINTM(MMSG, "WIFI auto_fw_reload: fw_reload=1\n"); ret = woal_request_fw_reload( @@ -1155,55 +1210,13 @@ static void woal_hang_work_queue(struct work_struct *work) reset_handle, FW_RELOAD_PCIE_INBAND_RESET); } else { - reset_handle->init_wait_q_woken = MFALSE; PRINTM(MMSG, "WIFI auto_fw_reload: fw_reload=4\n"); ret = woal_request_fw_reload( reset_handle, FW_RELOAD_PCIE_RESET); - if (!ret) { - /* Wait for FLR to complete */ - wait_event_timeout( - reset_handle->init_wait_q, - reset_handle->init_wait_q_woken, - 10 * HZ); - if (reset_handle->hardware_status != - HardwareStatusReady) - ret = -1; - } } } #endif - priv = woal_get_priv(reset_handle, MLAN_BSS_ROLE_ANY); - if (priv) { - if (ret) { - woal_broadcast_event( - priv, CUS_EVT_FW_RECOVER_FAIL, - strlen(CUS_EVT_FW_RECOVER_FAIL)); -#ifdef STA_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) - woal_cfg80211_vendor_event( - priv, event_fw_reset_failure, - CUS_EVT_FW_RECOVER_FAIL, - strlen(CUS_EVT_FW_RECOVER_FAIL)); -#endif -#endif - } else { - woal_broadcast_event( - priv, CUS_EVT_FW_RECOVER_SUCCESS, - strlen(CUS_EVT_FW_RECOVER_SUCCESS)); -#ifdef STA_CFG80211 -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) - if (IS_STA_OR_UAP_CFG80211(cfg80211_wext)) - woal_cfg80211_vendor_event( - priv, event_fw_reset_success, - CUS_EVT_FW_RECOVER_SUCCESS, - strlen(CUS_EVT_FW_RECOVER_SUCCESS)); -#endif -#endif - } - } - reset_handle = NULL; LEAVE(); return; } @@ -1241,7 +1254,7 @@ static void woal_hang_work_queue(struct work_struct *work) void woal_process_hang(moal_handle *handle) { ENTER(); - if (!handle) { + if (!handle || handle->fw_reseting) { LEAVE(); return; } @@ -1800,9 +1813,6 @@ t_u32 woal_get_mode(moal_private *priv, t_u8 wait_option) case MLAN_BSS_MODE_INFRA: mode = MW_MODE_INFRA; break; - case MLAN_BSS_MODE_IBSS: - mode = MW_MODE_ADHOC; - break; default: mode = MW_MODE_AUTO; break; @@ -2294,9 +2304,9 @@ mlan_status woal_init_sw(moal_handle *handle) device.gpio_pin = (t_u32)handle->params.gpiopin; #ifdef SDIO_MMC #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36) - device.max_segs = ((struct sdio_mmc_card *)handle->card) + device.max_segs = ((sdio_mmc_card *)handle->card) ->func->card->host->max_segs; - device.max_seg_size = ((struct sdio_mmc_card *)handle->card) + device.max_seg_size = ((sdio_mmc_card *)handle->card) ->func->card->host->max_seg_size; #endif PRINTM(MMSG, "SDIO: max_segs=%d max_seg_size=%d\n", @@ -2354,6 +2364,8 @@ mlan_status woal_init_sw(moal_handle *handle) device.dfs_offload = moal_extflg_isset(handle, EXT_DFS_OFFLOAD); #endif device.second_mac = handle->second_mac; + device.antcfg = handle->params.antcfg; + device.dmcs = moal_extflg_isset(handle, EXT_DMCS); for (i = 0; i < handle->drv_mode.intf_num; i++) { device.bss_attr[i].bss_type = @@ -3818,15 +3830,6 @@ static mlan_status woal_add_card_dpc(moal_handle *handle) } } - if (handle->params.antcfg) { - if (MLAN_STATUS_SUCCESS != - woal_set_user_antcfg(handle, MOAL_IOCTL_WAIT)) { - PRINTM(MFATAL, "Set user antcfg data failed\n"); - ret = MLAN_STATUS_FAILURE; - goto err; - } - } - #ifdef UAP_SUPPORT if (handle->params.uap_oper_ctrl) woal_set_uap_operation_ctrl(handle); @@ -3909,8 +3912,10 @@ static mlan_status woal_req_dpd_data(moal_handle *handle, int status = MLAN_STATUS_SUCCESS; ENTER(); - - if (dpd_data_cfg) { + /* dpd_data_cfg=none is treated as no dpd_data_cfg parameter + * present at module load time. + */ + if (dpd_data_cfg && strncmp(dpd_data_cfg, "none", strlen("none"))) { PRINTM(MMSG, "Request firmware: %s\n", dpd_data_cfg); if (req_fw_nowait) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 14, 0) @@ -4284,7 +4289,8 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) wifi_status = WIFI_STATUS_INIT_FW_FAIL; goto done; } else if (ret == MLAN_STATUS_SUCCESS) { - wifi_status = WIFI_STATUS_OK; + if (!handle->fw_reseting) + wifi_status = WIFI_STATUS_OK; handle->hardware_status = HardwareStatusReady; goto done; } @@ -4305,7 +4311,8 @@ static mlan_status woal_init_fw_dpc(moal_handle *handle) ret = MLAN_STATUS_FAILURE; goto done; } - wifi_status = WIFI_STATUS_OK; + if (!handle->fw_reseting) + wifi_status = WIFI_STATUS_OK; ret = MLAN_STATUS_SUCCESS; done: if (handle->dpd_data) { @@ -4594,11 +4601,19 @@ void woal_fill_mlan_buffer(moal_private *priv, mlan_buffer *pmbuf, } PRINTM(MDAT_D, "packet %04x prio=%#x\n", eth->h_proto, skb->priority); - if (priv->enable_mc_aggr && priv->num_mcast_addr) { + if ((priv->enable_mc_aggr || priv->enable_uc_nonaggr) && + priv->num_mcast_addr) { if (woal_find_mcast_node_tx(priv, skb)) { mc_txcontrol *tx_ctrl = (mc_txcontrol *)(skb->data + skb->len - sizeof(mc_txcontrol)); + /* Need to check whether flags field is set to 0xf9 + * so that it can be treated as unicast frames + */ + if ((tx_ctrl->mc_pkt_flags & 0xf9) == 0xf9) { + PRINTM(MDAT_D, "Ucast frame seq_num:%d\n", + tx_ctrl->seq_num); + } moal_memcpy_ext(priv->phandle, (t_u8 *)&pmbuf->u.mc_tx_info, (t_u8 *)tx_ctrl, sizeof(mc_txcontrol), @@ -5594,6 +5609,7 @@ void woal_remove_interface(moal_handle *handle, t_u8 bss_index) unregister_netdev(dev); woal_sched_timeout(100); + if (priv->mclist_workqueue) { flush_workqueue(priv->mclist_workqueue); destroy_workqueue(priv->mclist_workqueue); @@ -5696,70 +5712,6 @@ done: return status; } -/** - * @brief Configure antcfg - * - * @param handle A pointer to moal_handle - * @param wait_option Wait option - * - * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING -- success, - * otherwise fail - */ -mlan_status woal_set_user_antcfg(moal_handle *handle, t_u8 wait_option) -{ - moal_private *priv = NULL; - mlan_ioctl_req *req = NULL; - mlan_ds_radio_cfg *radio = NULL; - mlan_status status; - int antcfg; - - ENTER(); - priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); - if (!priv) { - LEAVE(); - return MLAN_STATUS_FAILURE; - } - antcfg = handle->params.antcfg; - /* Allocate an IOCTL request buffer */ - req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( - sizeof(mlan_ds_radio_cfg)); - if (req == NULL) { - status = MLAN_STATUS_FAILURE; - goto done; - } - - /* Fill request buffer */ - radio = (mlan_ds_radio_cfg *)req->pbuf; - radio->sub_command = MLAN_OID_ANT_CFG; - req->req_id = MLAN_IOCTL_RADIO_CFG; - req->action = MLAN_ACT_SET; - - 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_CARDAW693(handle->card_type)) { - radio->param.ant_cfg.tx_antenna = - radio->param.ant_cfg.rx_antenna = antcfg; -#if defined(STA_CFG80211) || defined(UAP_CFG80211) - woal_cfg80211_notify_antcfg(priv, priv->phandle->wiphy, - radio); -#endif - } else { - radio->param.ant_cfg.tx_antenna = - (antcfg & 0x0030) >> 4; - radio->param.ant_cfg.rx_antenna = antcfg & 0x0003; - } - } else - radio->param.ant_cfg_1x1.antenna = antcfg; - /* Send IOCTL request to MLAN */ - status = woal_request_ioctl(priv, req, wait_option); -done: - kfree(req); - LEAVE(); - return status; -} - /** * @brief Configure MLAN for low power mode * @@ -5926,7 +5878,7 @@ int woal_hexval(char chr) * * @return N/A */ -static void woal_flush_evt_queue(moal_handle *handle) +void woal_flush_evt_queue(moal_handle *handle) { struct woal_event *evt = NULL, *tmp_node; unsigned long flags; @@ -6918,7 +6870,7 @@ u16 woal_select_queue(struct net_device *dev, struct sk_buff *skb tid = skb->priority = woal_classify8021d(skb); #endif #define NXP_ETH_P_EAPOL 0x888E -#define NXP_ETH_P_WAPI 0x8884 +#define NXP_ETH_P_WAPI 0x88B4 switch (skb->protocol) { case htons(ETH_P_ARP): #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) @@ -7071,16 +7023,16 @@ t_u8 woal_find_mcast_node_tx(moal_private *priv, struct sk_buff *skb) ENTER(); moal_memcpy_ext(priv->phandle, ra, skb->data, MLAN_MAC_ADDR_LENGTH, sizeof(ra)); - if (ra[0] & 0x01) { - spin_lock_irqsave(&priv->mcast_lock, flags); - list_for_each_entry (node, &priv->mcast_list, link) { - if (!memcmp(node->mcast_addr, ra, ETH_ALEN)) { - ret = MTRUE; - break; - } + // if (ra[0] & 0x01){ + spin_lock_irqsave(&priv->mcast_lock, flags); + list_for_each_entry (node, &priv->mcast_list, link) { + if (!memcmp(node->mcast_addr, ra, ETH_ALEN)) { + ret = MTRUE; + break; } - spin_unlock_irqrestore(&priv->mcast_lock, flags); } + spin_unlock_irqrestore(&priv->mcast_lock, flags); + // } LEAVE(); return ret; } @@ -9791,6 +9743,7 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) t_u16 type = 0; t_u8 *pos; moal_private *priv = NULL; + moal_handle *ref_handle = NULL; ENTER(); @@ -9832,6 +9785,16 @@ t_void woal_store_firmware_dump(moal_handle *phandle, mlan_event *pmevent) } phandle->fw_dump_len = 0; PRINTM(MMSG, "==== Start Receive FW dump event ====\n"); + ref_handle = (moal_handle *)phandle->pref_mac; + if (ref_handle) { + if (!ref_handle->drv_dump_buf || + !ref_handle->drv_dump_len) + ref_handle->drv_dump_buf = woal_dump_drv_info( + ref_handle, &ref_handle->drv_dump_len); + } + if (!phandle->drv_dump_buf || !phandle->drv_dump_len) + phandle->drv_dump_buf = woal_dump_drv_info( + phandle, &phandle->drv_dump_len); } else { if (!phandle->fw_dump_buf || !phandle->fw_dump_len) { PRINTM(MERROR, @@ -11196,7 +11159,8 @@ mlan_status woal_request_country_power_table(moal_private *priv, char *country, memset(file_path, 0, sizeof(file_path)); /* file_path should be Null terminated */ if (fw_name) { - moal_memcpy(handle, file_path, fw_name, sizeof(file_path) - 1); + /* file_path[] needs to be reset to 0 before here */ + strncpy(file_path, fw_name, sizeof(file_path) - 1); last_slash = strrchr(file_path, '/'); if (last_slash) memset(last_slash + 1, 0, @@ -11361,13 +11325,16 @@ t_void woal_scan_timeout_handler(struct work_struct *work) if (IS_STA_CFG80211(handle->params.cfg80211_wext)) { if (handle->scan_request && handle->fake_scan_complete) { - PRINTM(MMSG, "wlan: Send fake scan result\n"); + PRINTM(MMSG, + "wlan: Send fake scan result for scan_request %p\n", + handle->scan_request); if (priv) woal_inform_bss_from_scan_result(priv, NULL, MOAL_NO_WAIT); spin_lock_irqsave(&handle->scan_req_lock, flags); woal_cfg80211_scan_done(handle->scan_request, MFALSE); handle->scan_request = NULL; + handle->fake_scan_complete = MFALSE; spin_unlock_irqrestore(&handle->scan_req_lock, flags); } else if (handle->scan_request) { PRINTM(MMSG, "wlan: scan timeout!\n"); @@ -12124,7 +12091,6 @@ moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, m_handle[index - 1]->pref_mac = (void *)handle; } } - /* Init module parameters */ if (woal_init_module_param(handle)) { PRINTM(MERROR, "Fail to load module parameter file\n"); @@ -12870,9 +12836,7 @@ exit_sem_err: } #endif -#define FW_POLL_TRIES 100 #ifdef SDIO - /** * @brief This function reload fw * @@ -12883,62 +12847,15 @@ exit_sem_err: */ static int woal_reset_and_reload_fw(moal_handle *handle, t_u8 mode) { - int ret = 0, tries = 0; - t_u32 value = 1; - t_u32 reset_reg = handle->card_info->fw_reset_reg; - t_u8 reset_val = handle->card_info->fw_reset_val; + int ret = 0; ENTER(); #ifdef SDIO_MMC if (mode == FW_RELOAD_SDIO_HW_RESET) { PRINTM(MCMND, "woal_sdio_reset_fw...\n"); woal_sdio_reset_hw(handle); - goto reload_fw; } #endif - mlan_pm_wakeup_card(handle->pmlan_adapter, MTRUE); - /** wait SOC fully wake up */ - for (tries = 0; tries < FW_POLL_TRIES; ++tries) { - ret = handle->ops.write_reg(handle, reset_reg, 0xba); - if (ret == MLAN_STATUS_SUCCESS) { - handle->ops.read_reg(handle, reset_reg, &value); - if (value == 0xba) { - PRINTM(MMSG, "FW wake up\n"); - break; - } - } - udelay(1000); - } - /* Write register to notify FW */ - if (handle->ops.write_reg(handle, reset_reg, reset_val) != - MLAN_STATUS_SUCCESS) { - PRINTM(MERROR, "Failed to write register.\n"); - 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); - if (value == 0) - /* FW is ready */ - break; - udelay(1000); - } - - if (value) { - PRINTM(MERROR, "Failed to poll FW reset register %X=0x%x\n", - reset_reg, value); - ret = -EFAULT; - goto done; - } - mlan_pm_wakeup_card(handle->pmlan_adapter, MFALSE); -reload_fw: /* Download FW */ ret = woal_request_fw(handle); if (ret) { @@ -12952,72 +12869,6 @@ done: } #endif -#ifdef PCIE -/** - * @brief This function reload fw for pcie - * - * @param handle A pointer to moal_handle structure - * - * @return 0--success, otherwise failure - */ -static int woal_pcie_reset_and_reload_fw(moal_handle *handle) -{ - int ret = 0, tries = 0; - t_u32 value = 1; - t_u32 reset_reg = handle->card_info->fw_reset_reg; - 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) && - !IS_PCIE9097(handle->card_type) && - !IS_PCIE8997(handle->card_type)) { - PRINTM(MERROR, "HW don't support PCIE in-band reset\n"); - return -EFAULT; - } -#endif - - mlan_pm_wakeup_card(handle->pmlan_adapter, MTRUE); - - /* Write register to notify FW */ - if (handle->ops.write_reg(handle, reset_reg, reset_val) != - MLAN_STATUS_SUCCESS) { - PRINTM(MERROR, "Failed to write reregister.\n"); - ret = -EFAULT; - goto done; - } - /* Poll register around 100 ms */ - for (tries = 0; tries < FW_POLL_TRIES; ++tries) { - handle->ops.read_reg(handle, reset_reg, &value); - if (value == 0) - /* FW is ready */ - break; - udelay(1000); - } - - if (value) { - PRINTM(MERROR, "Failed to poll FW reset register %X=0x%x\n", - reset_reg, value); - ret = -EFAULT; - goto done; - } - mlan_pm_wakeup_card(handle->pmlan_adapter, MFALSE); - /* Download FW */ - ret = woal_request_fw(handle); - if (ret) { - ret = -EFAULT; - goto done; - } - PRINTM(MMSG, "PCIE FW Reload successfully."); -done: - LEAVE(); - return ret; -} -#endif - /** * @brief This function reload fw * @@ -13317,6 +13168,19 @@ int woal_request_fw_reload(moal_handle *phandle, t_u8 mode) } LEAVE(); return ret; + } else if (mode == FW_RELOAD_PCIE_INBAND_RESET) { + if (handle->ops.card_reset) + handle->ops.card_reset(handle); + LEAVE(); + return ret; + } +#endif +#ifdef SDIO + if (mode == FW_RELOAD_SDIO_INBAND_RESET) { + if (handle->ops.card_reset) + handle->ops.card_reset(handle); + LEAVE(); + return ret; } #endif @@ -13354,8 +13218,7 @@ int woal_request_fw_reload(moal_handle *phandle, t_u8 mode) } } #ifdef SDIO - else if ((mode == FW_RELOAD_SDIO_INBAND_RESET || - mode == FW_RELOAD_SDIO_HW_RESET) && + else if ((mode == FW_RELOAD_SDIO_HW_RESET) && IS_SD(handle->card_type)) { ret = woal_reset_and_reload_fw(handle, mode); if (ret) { @@ -13370,23 +13233,6 @@ int woal_request_fw_reload(moal_handle *phandle, t_u8 mode) } } } -#endif -#ifdef PCIE - else if (mode == FW_RELOAD_PCIE_INBAND_RESET && - IS_PCIE(handle->card_type)) { - ret = woal_pcie_reset_and_reload_fw(handle); - if (ret) { - PRINTM(MERROR, "woal_pcie_reset_and_reload_fw fail\n"); - goto done; - } - if (ref_handle) { - ret = woal_reload_fw(ref_handle); - if (ret) { - PRINTM(MERROR, "woal_reload_fw fail\n"); - goto done; - } - } - } #endif else ret = -EFAULT; @@ -13593,8 +13439,7 @@ static void woal_cleanup_module(void) #ifdef MMC_PM_KEEP_POWER if (handle->is_suspended == MTRUE) { woal_sdio_resume( - &(((struct sdio_mmc_card *)handle->card)->func) - ->dev); + &(((sdio_mmc_card *)handle->card)->func)->dev); } #endif /* MMC_PM_KEEP_POWER */ #endif /* SDIO_SUSPEND_RESUME */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_main.h b/mxm_wifiex/wlan_src/mlinux/moal_main.h index 79b0b6a..c8ec059 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_main.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_main.h @@ -164,6 +164,7 @@ Change log: #define CFG80211_VERSION_CODE MAX(LINUX_VERSION_CODE, COMPAT_VERSION_CODE) #define IMX_ANDROID_13 0 +#define IMX_ANDROID_14 0 #define IMX_ANDROID_12_BACKPORT 0 #if defined(IMX_SUPPORT) @@ -173,6 +174,10 @@ Change log: #if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 15, 52) #undef IMX_ANDROID_13 #define IMX_ANDROID_13 1 +#ifdef ANDROID_14_SUPPORT +#undef IMX_ANDROID_14 +#define IMX_ANDROID_14 1 +#endif #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 15, 41) #undef IMX_ANDROID_12_BACKPORT @@ -809,10 +814,6 @@ out: /** Custom event : OBSS scan parameter */ #define CUS_EVT_OBSS_SCAN_PARAM "EVENT=OBSS_SCAN_PARAM" -/** Custom event : AdHoc link sensed */ -#define CUS_EVT_ADHOC_LINK_SENSED "EVENT=ADHOC_LINK_SENSED" -/** Custom event : AdHoc link lost */ -#define CUS_EVT_ADHOC_LINK_LOST "EVENT=ADHOC_LINK_LOST" /** Custom event : MIC failure, unicast */ #define CUS_EVT_MLME_MIC_ERR_UNI "MLME-MICHAELMICFAILURE.indication unicast" /** Custom event : MIC failure, multicast */ @@ -901,11 +902,6 @@ 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 @@ -1385,6 +1381,8 @@ struct rf_test_mode_data { t_u8 bssid[ETH_ALEN]; /* Trigger frame config values */ mfg_Cmd_IEEEtypes_CtlBasicTrigHdr_t mfg_tx_trigger_config; + /* OTP frame data */ + mfg_cmd_otp_mac_addr_rd_wr_t mfg_otp_mac_addr_rd_wr; }; /** Number of samples in histogram (/proc/mwlan/adapterX/mlan0/histogram).*/ @@ -1808,6 +1806,8 @@ struct _moal_private { t_u32 num_mcast_addr; /** enable mc_aggr */ t_u8 enable_mc_aggr; + /** enable uc_nonaggr */ + t_u8 enable_uc_nonaggr; /** tcp list */ struct list_head tdls_list; /** tdls spin lock */ @@ -1935,6 +1935,8 @@ typedef struct _card_info { #if defined(SDIO) || defined(PCIE) t_u32 fw_reset_reg; t_u8 fw_reset_val; + t_u32 fw_wakeup_reg; + t_u8 fw_wakeup_val; #endif t_u8 sniffer_support; t_u8 per_pkt_cfg_support; @@ -2347,6 +2349,7 @@ typedef struct _moal_if_ops { mlan_status (*get_fw_name)(moal_handle *handle); void (*dump_fw_info)(moal_handle *handle); int (*dump_reg_info)(moal_handle *handle, t_u8 *buf); + void (*card_reset)(moal_handle *handle); void (*reg_dbg)(moal_handle *handle); t_u8 (*is_second_mac)(moal_handle *handle); } moal_if_ops; @@ -2399,6 +2402,7 @@ enum ext_mod_params { EXT_TX_SKB_CLONE, EXT_PMQOS, EXT_CHAN_TRACK, + EXT_DMCS, EXT_MAX_PARAM, }; @@ -2637,6 +2641,7 @@ struct _moal_handle { /** STATUS variables */ MOAL_HARDWARE_STATUS hardware_status; BOOLEAN fw_reload; + BOOLEAN fw_reseting; /** POWER MANAGEMENT AND PnP SUPPORT */ BOOLEAN surprise_removed; /** Firmware release number */ @@ -3671,6 +3676,7 @@ mlan_status woal_set_rgpower_table(moal_handle *handle); void woal_terminate_workqueue(moal_handle *handle); void woal_flush_workqueue(moal_handle *handle); void woal_queue_rx_task(moal_handle *handle); +void woal_flush_evt_queue(moal_handle *handle); /** initializes firmware */ mlan_status woal_init_fw(moal_handle *handle); /** frees the structure of moal_handle */ @@ -3940,9 +3946,6 @@ mlan_status woal_cancel_scan(moal_private *priv, t_u8 wait_option); /** Find best network to connect */ mlan_status woal_find_best_network(moal_private *priv, t_u8 wait_option, mlan_ssid_bssid *ssid_bssid); -/** Set Ad-Hoc channel */ -mlan_status woal_change_adhoc_chan(moal_private *priv, int channel, - t_u8 wait_option); /** Get scan table */ mlan_status woal_get_scan_table(moal_private *priv, t_u8 wait_option, @@ -4112,6 +4115,7 @@ void woal_fill_mlan_buffer(moal_private *priv, mlan_buffer *pmbuf, moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_num, t_u8 bss_type); void woal_clean_up(moal_handle *handle); +void woal_send_auto_recovery_complete_event(moal_handle *handle); void woal_remove_interface(moal_handle *handle, t_u8 bss_index); void woal_set_multicast_list(struct net_device *dev); mlan_status woal_request_fw(moal_handle *handle); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_pcie.c b/mxm_wifiex/wlan_src/mlinux/moal_pcie.c index 67fd4bc..95168b1 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_pcie.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_pcie.c @@ -57,6 +57,7 @@ static void woal_pcie_reg_dbg(moal_handle *phandle); static void woal_pcie_unregister_dev(moal_handle *handle); static void woal_pcie_cleanup(pcie_service_card *card); static mlan_status woal_pcie_init(pcie_service_card *card); +static void woal_pcie_work(struct work_struct *work); /** WLAN IDs */ static const struct pci_device_id wlan_ids[] = { @@ -248,7 +249,9 @@ static mlan_status woal_reset_adma(moal_handle *handle) t_u32 value; t_u32 reset_reg = handle->card_info->fw_reset_reg; t_u8 reset_adma_val = 0x97; - + /* wake up device before set the reset reg */ + handle->ops.read_reg(handle, handle->card_info->fw_wakeup_reg, &value); + udelay(100); if (handle->ops.write_reg(handle, reset_reg, reset_adma_val) != MLAN_STATUS_SUCCESS) { PRINTM(MERROR, "Failed to write register.\n"); @@ -373,7 +376,16 @@ static mlan_status woal_do_flr(moal_handle *handle, bool prepare, bool flr_flag) /* Remove interface */ for (i = 0; i < handle->priv_num; i++) woal_remove_interface(handle, i); - + handle->priv_num = 0; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + /* Unregister wiphy device and free */ + if (handle->wiphy) { + wiphy_unregister(handle->wiphy); + woal_cfg80211_free_bands(handle->wiphy); + wiphy_free(handle->wiphy); + handle->wiphy = NULL; + } +#endif /* Unregister mlan */ if (handle->pmlan_adapter) { mlan_unregister(handle->pmlan_adapter); @@ -430,6 +442,7 @@ perform_init: moal_extflg_set(handle, EXT_FW_SERIAL); goto err_init_fw; } + if (flr_flag && fw_serial_bkp) moal_extflg_set(handle, EXT_FW_SERIAL); if (IS_PCIE9098(handle->card_type)) @@ -442,6 +455,10 @@ exit_sem_err: return status; 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"); @@ -472,6 +489,8 @@ err_init_fw: while (handle->reassoc_thread.pid) woal_sched_timeout(2); #endif /* REASSOCIATION */ + if (moal_extflg_isset(handle, EXT_NAPI)) + netif_napi_del(&handle->napi_rx); woal_terminate_workqueue(handle); woal_free_moal_handle(handle); @@ -534,6 +553,7 @@ static int woal_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret = -EFAULT; goto err; } + INIT_WORK(&card->reset_work, woal_pcie_work); if (woal_add_card(card, &card->dev->dev, &pcie_ops, card_type) == NULL) { @@ -577,10 +597,12 @@ static void woal_pcie_remove(struct pci_dev *dev) LEAVE(); return; } - + cancel_work_sync(&card->reset_work); handle = card->handle; if (!handle || !handle->priv_num) { PRINTM(MINFO, "PCIE card handle removed\n"); + woal_pcie_cleanup(card); + kfree(card); LEAVE(); return; } @@ -876,6 +898,7 @@ static void woal_pcie_reset_prepare(struct pci_dev *pdev) } } handle->surprise_removed = MTRUE; + handle->fw_reseting = MTRUE; // TODO: Can add more chips once the related code has been ported to fw // v18 if (IS_PCIE9097(handle->card_type) || IS_PCIE9098(handle->card_type)) { @@ -885,6 +908,7 @@ static void woal_pcie_reset_prepare(struct pci_dev *pdev) woal_do_flr(handle, true, true); if (ref_handle) { ref_handle->surprise_removed = MTRUE; + ref_handle->fw_reseting = MTRUE; woal_do_flr(ref_handle, true, true); } @@ -934,12 +958,18 @@ static void woal_pcie_reset_done(struct pci_dev *pdev) } } handle->surprise_removed = MFALSE; - woal_do_flr(handle, false, true); + if (MLAN_STATUS_SUCCESS == woal_do_flr(handle, false, true)) + handle->fw_reseting = MFALSE; + else + handle = NULL; if (ref_handle) { ref_handle->surprise_removed = MFALSE; - woal_do_flr(ref_handle, false, true); + if (MLAN_STATUS_SUCCESS == woal_do_flr(ref_handle, false, true)) + ref_handle->fw_reseting = MFALSE; } - + wifi_status = WIFI_STATUS_OK; + if (handle) + woal_send_auto_recovery_complete_event(handle); LEAVE(); } #else @@ -986,6 +1016,7 @@ static void woal_pcie_reset_notify(struct pci_dev *pdev, bool prepare) * Note. FW might not be healthy. */ handle->surprise_removed = MTRUE; + handle->fw_reseting = MTRUE; // TODO: Can add more chips once the related code has been // ported to fw v18 if (IS_PCIE9097(handle->card_type) || @@ -995,6 +1026,7 @@ static void woal_pcie_reset_notify(struct pci_dev *pdev, bool prepare) woal_do_flr(handle, prepare, true); if (ref_handle) { ref_handle->surprise_removed = MTRUE; + ref_handle->fw_reseting = MTRUE; woal_do_flr(ref_handle, prepare, true); } } else { @@ -1004,11 +1036,19 @@ static void woal_pcie_reset_notify(struct pci_dev *pdev, bool prepare) * Reconfigure the sw and fw including fw redownload */ handle->surprise_removed = MFALSE; - woal_do_flr(handle, prepare, true); + if (MLAN_STATUS_SUCCESS == woal_do_flr(handle, prepare, true)) + handle->fw_reseting = MFALSE; + else + handle = NULL; if (ref_handle) { ref_handle->surprise_removed = MFALSE; - woal_do_flr(ref_handle, prepare, true); + if (MLAN_STATUS_SUCCESS == + woal_do_flr(ref_handle, prepare, true)) + ref_handle->fw_reseting = MFALSE; } + wifi_status = WIFI_STATUS_OK; + if (handle) + woal_send_auto_recovery_complete_event(handle); } LEAVE(); } @@ -1151,10 +1191,6 @@ static irqreturn_t woal_pcie_interrupt(int irq, void *dev_id) goto exit; } handle = card->handle; - if (handle->surprise_removed == MTRUE) { - ret = MLAN_STATUS_FAILURE; - goto exit; - } PRINTM(MINFO, "*** IN PCIE IRQ ***\n"); handle->main_state = MOAL_RECV_INT; if (handle->second_mac) @@ -1395,7 +1431,7 @@ static mlan_status woal_pcie_register_dev(moal_handle *handle) pdev = card->dev; /* save adapter pointer in card */ card->handle = handle; - + PRINTM(MERROR, "---yunjie--- woal_pcie_register_dev int mode %d\n", pcie_int_mode); switch (pcie_int_mode) { case PCIE_INT_MODE_MSIX: pcie_int_mode = PCIE_INT_MODE_MSIX; @@ -1422,8 +1458,8 @@ static mlan_status woal_pcie_register_dev(moal_handle *handle) &(card->msix_contexts[i])); if (ret) { - PRINTM(MFATAL, - "request_irq failed: ret=%d\n", + PRINTM(MERROR, + "---yunjie--- request_irq failed: ret=%d\n", ret); for (j = 0; j < i; j++) free_irq(card->msix_entries[j] @@ -1447,7 +1483,7 @@ static mlan_status woal_pcie_register_dev(moal_handle *handle) ret = request_irq(pdev->irq, woal_pcie_interrupt, 0, "mrvl_pcie_msi", pdev); if (ret) { - PRINTM(MFATAL, "request_irq failed: ret=%d\n", + PRINTM(MERROR, "---yunjie--- request_irq failed: ret=%d\n", ret); pci_disable_msi(pdev); } else { @@ -1462,7 +1498,7 @@ static mlan_status woal_pcie_register_dev(moal_handle *handle) ret = request_irq(pdev->irq, woal_pcie_interrupt, IRQF_SHARED, "mrvl_pcie", pdev); if (ret) { - PRINTM(MFATAL, "request_irq failed: ret=%d\n", ret); + PRINTM(MERROR, "---yunjie--- request_irq failed: ret=%d\n", ret); ret = MLAN_STATUS_FAILURE; goto done; } @@ -1470,7 +1506,7 @@ static mlan_status woal_pcie_register_dev(moal_handle *handle) break; default: - PRINTM(MFATAL, "pcie_int_mode %d failed\n", pcie_int_mode); + PRINTM(MERROR, "---yunjie--- pcie_int_mode %d failed\n", pcie_int_mode); ret = MLAN_STATUS_FAILURE; goto done; break; @@ -2521,6 +2557,7 @@ static t_u8 woal_pcie_is_second_mac(moal_handle *handle) static void woal_pcie_dump_fw_info(moal_handle *phandle) { + moal_private *priv = NULL; #ifdef DUMP_TO_PROC if (phandle->fw_dump_buf) { PRINTM(MERROR, "FW dump already exist\n"); @@ -2553,13 +2590,23 @@ static void woal_pcie_dump_fw_info(moal_handle *phandle) phandle->fw_dump = MFALSE; if (!phandle->priv_num) return; - woal_send_fw_dump_complete_event( - woal_get_priv(phandle, MLAN_BSS_ROLE_ANY)); + priv = woal_get_priv(phandle, MLAN_BSS_ROLE_ANY); + if (priv == NULL) { + return; + } + woal_send_fw_dump_complete_event(priv); mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE); queue_work(phandle->workqueue, &phandle->main_work); woal_process_hang(phandle); } +/** + * @brief This function get fw name + * + * @param handle A pointer to moal_handle structure + * @return MLAN_STATUS_SUCCESS + * + */ static mlan_status woal_pcie_get_fw_name(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; @@ -2783,6 +2830,139 @@ done: return ret; } +/** + * @brief This function trigger in-band reset to FW + * + * @param handle A pointer to moal_handle structure + * @return 0 or failure + * + */ +static int woal_pcie_reset_fw(moal_handle *handle) +{ + int ret = 0, tries = 0; + t_u32 value = 1; + t_u32 reset_reg = handle->card_info->fw_reset_reg; + t_u8 reset_val = handle->card_info->fw_reset_val; + + ENTER(); + if (IS_PCIE8897(handle->card_type)) { + PRINTM(MERROR, "PCIE8897 don't support PCIE in-band reset\n"); + LEAVE(); + return -EFAULT; + } + woal_pcie_read_reg(handle, handle->card_info->fw_wakeup_reg, &value); + udelay(100); + + /* Write register to notify FW */ + if (woal_pcie_write_reg(handle, reset_reg, reset_val) != + MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "Failed to write reregister.\n"); + ret = -EFAULT; + goto done; + } + /* Poll register around 100 ms */ + for (tries = 0; tries < MAX_POLL_TRIES; ++tries) { + woal_pcie_read_reg(handle, reset_reg, &value); + if (value == 0) + /* FW is ready */ + break; + udelay(1000); + } + + if (value) { + PRINTM(MERROR, "Failed to poll FW reset register %X=0x%x\n", + reset_reg, value); + ret = -EFAULT; + goto done; + } + PRINTM(MMSG, "PCIE Trigger FW In-band Reset success."); +done: + LEAVE(); + return ret; +} + +/** + * @brief This function handle the pcie work + * + * @param WORK A pointer to work_struct + * @return N/A + * + */ +static void woal_pcie_work(struct work_struct *work) +{ + pcie_service_card *card = + container_of(work, pcie_service_card, reset_work); + moal_handle *handle = NULL; + moal_handle *ref_handle = NULL; + PRINTM(MMSG, "========START IN-BAND RESET===========\n"); + handle = card->handle; + + // handle-> mac0 , ref_handle->second mac + if (handle->pref_mac) { + if (handle->second_mac) { + handle = (moal_handle *)handle->pref_mac; + ref_handle = (moal_handle *)handle->pref_mac; + } else { + ref_handle = (moal_handle *)handle->pref_mac; + } + if (ref_handle) { + ref_handle->surprise_removed = MTRUE; + woal_clean_up(ref_handle); + mlan_ioctl(ref_handle->pmlan_adapter, NULL); + } + } + handle->surprise_removed = MTRUE; + handle->fw_reseting = MTRUE; + // TODO: Can add more chips once the related code has been ported to fw + // v18 + if (IS_PCIE9097(handle->card_type) || IS_PCIE9098(handle->card_type)) { + woal_reset_adma(handle); + } + woal_do_flr(handle, true, true); + if (ref_handle) { + ref_handle->surprise_removed = MTRUE; + ref_handle->fw_reseting = MTRUE; + woal_do_flr(ref_handle, true, true); + } + if (woal_pcie_reset_fw(handle)) { + PRINTM(MERROR, "PCIe In-band Reset Fail\n"); + goto done; + } + handle->surprise_removed = MFALSE; + if (MLAN_STATUS_SUCCESS == woal_do_flr(handle, false, true)) + handle->fw_reseting = MFALSE; + else + handle = NULL; + if (ref_handle) { + ref_handle->surprise_removed = MFALSE; + if (MLAN_STATUS_SUCCESS == woal_do_flr(ref_handle, false, true)) + ref_handle->fw_reseting = MFALSE; + } + card->work_flags = MFALSE; +done: + wifi_status = WIFI_STATUS_OK; + if (handle) + woal_send_auto_recovery_complete_event(handle); + PRINTM(MMSG, "========END IN-BAND RESET===========\n"); + return; +} + +/** + * @brief This function start reset_work + * + * @param handle A pointer to moal_handle structure + * @return MTRUE/MFALSE + * + */ +static void woal_pcie_card_reset(moal_handle *handle) +{ + pcie_service_card *card = (pcie_service_card *)handle->card; + if (!card->work_flags) { + card->work_flags = MTRUE; + schedule_work(&card->reset_work); + } +} + static moal_if_ops pcie_ops = { .register_dev = woal_pcie_register_dev, .unregister_dev = woal_pcie_unregister_dev, @@ -2794,5 +2974,6 @@ static moal_if_ops pcie_ops = { .dump_fw_info = woal_pcie_dump_fw_info, .reg_dbg = woal_pcie_reg_dbg, .dump_reg_info = woal_pcie_dump_reg_info, + .card_reset = woal_pcie_card_reset, .is_second_mac = woal_pcie_is_second_mac, }; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_pcie.h b/mxm_wifiex/wlan_src/mlinux/moal_pcie.h index 24f2116..28a3fb9 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_pcie.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_pcie.h @@ -150,6 +150,10 @@ typedef struct _pcie_service_card { struct pci_dev *dev; /** moal_handle structure pointer */ moal_handle *handle; + /** reset work*/ + struct work_struct reset_work; + /** work flag */ + t_u8 work_flags; /** I/O memory regions pointer to the bus */ void __iomem *pci_mmap; /** I/O memory regions pointer to the bus */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_priv.c b/mxm_wifiex/wlan_src/mlinux/moal_priv.c index 3fe16b9..1f21df0 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_priv.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_priv.c @@ -61,14 +61,6 @@ static t_u8 SupportedInfraBand[] = { BAND_A | BAND_AN | BAND_AAC, }; -/** Bands supported in Ad-Hoc mode */ -static t_u8 SupportedAdhocBand[] = { - BAND_B, - BAND_B | BAND_G, - BAND_G, - BAND_A, -}; - /******************************************************** Local Functions ********************************************************/ @@ -1460,11 +1452,9 @@ static int woal_band_cfg(moal_private *priv, struct iwreq *wrq) { int ret = 0; unsigned int i; - int data[3]; + int data[1]; int user_data_len = wrq->u.data.length, copy_len; t_u32 infra_band = 0; - t_u32 adhoc_band = 0; - t_u32 adhoc_channel = 0; mlan_ioctl_req *req = NULL; mlan_ds_radio_cfg *radio_cfg = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -1505,11 +1495,6 @@ static int woal_band_cfg(moal_private *priv, struct iwreq *wrq) } /* Infra Band */ data[0] = radio_cfg->param.band_cfg.config_bands; - /* Adhoc Band */ - data[1] = radio_cfg->param.band_cfg.adhoc_start_band; - /* Adhoc Channel */ - data[2] = radio_cfg->param.band_cfg.adhoc_channel; - wrq->u.data.length = 3; if (copy_to_user(wrq->u.data.pointer, data, sizeof(int) * wrq->u.data.length)) { @@ -1533,33 +1518,9 @@ static int woal_band_cfg(moal_private *priv, struct iwreq *wrq) goto error; } - /* Set Adhoc band */ - if (user_data_len >= 2) { - adhoc_band = data[1]; - for (i = 0; i < sizeof(SupportedAdhocBand); i++) - if (adhoc_band == SupportedAdhocBand[i]) - break; - if (i == sizeof(SupportedAdhocBand)) { - ret = -EINVAL; - goto error; - } - } - - /* Set Adhoc channel */ - if (user_data_len >= 3) { - adhoc_channel = data[2]; - if (adhoc_channel == 0) { - /* Check if specified adhoc channel is non-zero - */ - ret = -EINVAL; - goto error; - } - } /* Set config_bands and adhoc_start_band values to MLAN */ req->action = MLAN_ACT_SET; radio_cfg->param.band_cfg.config_bands = infra_band; - radio_cfg->param.band_cfg.adhoc_start_band = adhoc_band; - radio_cfg->param.band_cfg.adhoc_channel = adhoc_channel; status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); if (status != MLAN_STATUS_SUCCESS) { ret = -EFAULT; @@ -4911,20 +4872,16 @@ static int woal_cmd52rdwr_ioctl(moal_private *priv, struct iwreq *wrq) if (!rw) { #ifdef SDIO_MMC - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); if (func) data = sdio_readb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, reg, &ret); else data = sdio_f0_readb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, reg, &ret); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_readb: reading register 0x%X failed\n", @@ -4943,20 +4900,16 @@ static int woal_cmd52rdwr_ioctl(moal_private *priv, struct iwreq *wrq) #endif } else { #ifdef SDIO_MMC - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); if (func) sdio_writeb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, data, reg, &ret); else sdio_f0_writeb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, data, reg, &ret); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_writeb: writing register 0x%X failed\n", @@ -5018,8 +4971,8 @@ static int woal_cmd53rdwr_ioctl(moal_private *priv, struct iwreq *wrq) ret = -EFAULT; goto done; } - if (wrq->u.data.length > WOAL_2K_BYTES) { - PRINTM(MERROR, "Data lengh is too large!\n"); + if (wrq->u.data.length == 0 || wrq->u.data.length > WOAL_2K_BYTES) { + PRINTM(MERROR, "Data lengh is invalid!\n"); ret = -EINVAL; goto done; } @@ -5053,16 +5006,13 @@ static int woal_cmd53rdwr_ioctl(moal_private *priv, struct iwreq *wrq) reg, mode, blklen, blknum); if (!rw) { - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); - if (sdio_readsb( - ((struct sdio_mmc_card *)priv->phandle->card)->func, - data, reg, total_len)) + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_readsb(((sdio_mmc_card *)priv->phandle->card)->func, + data, reg, total_len)) PRINTM(MERROR, "sdio_readsb: reading memory 0x%x failed\n", reg); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); if (copy_to_user(wrq->u.data.pointer, data, total_len)) { PRINTM(MINFO, "Copy to user failed\n"); @@ -5080,16 +5030,13 @@ static int woal_cmd53rdwr_ioctl(moal_private *priv, struct iwreq *wrq) for (pos = 0; pos < (int)total_len; pos++) data[pos] = buf[11 + (pos % pattern_len)]; - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); - if (sdio_writesb( - ((struct sdio_mmc_card *)priv->phandle->card)->func, - reg, data, total_len)) + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); + if (sdio_writesb(((sdio_mmc_card *)priv->phandle->card)->func, + reg, data, total_len)) PRINTM(MERROR, "sdio_writesb: writing memory 0x%x failed\n", reg); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); } done: @@ -7094,8 +7041,6 @@ void woal_ioctl_get_bss_resp(moal_private *priv, mlan_ds_bss *bss) case MLAN_OID_BSS_MODE: if (bss->param.bss_mode == MLAN_BSS_MODE_INFRA) mode = IW_MODE_INFRA; - else if (bss->param.bss_mode == MLAN_BSS_MODE_IBSS) - mode = IW_MODE_ADHOC; else mode = IW_MODE_AUTO; priv->w_stats.status = mode; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_proc.c b/mxm_wifiex/wlan_src/mlinux/moal_proc.c index d8bf019..afc0542 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_proc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_proc.c @@ -805,6 +805,11 @@ static ssize_t woal_config_write(struct file *f, const char __user *buf, if (!strncmp(databuf, "trigger_frame=", strlen("trigger_frame=")) && count > strlen("trigger_frame=")) cmd = MFG_CMD_CONFIG_TRIGGER_FRAME; + if (!strncmp(databuf, + "otp_mac_addr_rd_wr=", strlen("otp_mac_add_rd_wr=")) && + count > strlen("otp_mac_addr_rd_wr=")) { + cmd = MFG_CMD_OTP_MAC_ADD; + } if (cmd && handle->rf_test_mode && (woal_process_rf_test_mode_cmd( handle, cmd, (const char *)databuf, (size_t)count, @@ -1049,6 +1054,14 @@ static int woal_config_read(struct seq_file *sfp, void *data) .basic_trig_user_info.pref_ac); } seq_printf(sfp, "\n"); + seq_printf(sfp, "otp_mac_add_rd_wr="); + seq_printf(sfp, " %02x:%02x:%02x:%02x:%02x:%02x \n", + handle->rf_data->mfg_otp_mac_addr_rd_wr.mac_addr[0], + handle->rf_data->mfg_otp_mac_addr_rd_wr.mac_addr[1], + handle->rf_data->mfg_otp_mac_addr_rd_wr.mac_addr[2], + handle->rf_data->mfg_otp_mac_addr_rd_wr.mac_addr[3], + handle->rf_data->mfg_otp_mac_addr_rd_wr.mac_addr[4], + handle->rf_data->mfg_otp_mac_addr_rd_wr.mac_addr[5]); } // Read current antcfg configuration woal_priv_get_tx_rx_ant(sfp, priv); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sdio.h b/mxm_wifiex/wlan_src/mlinux/moal_sdio.h index 9e0ae7e..22f060d 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sdio.h +++ b/mxm_wifiex/wlan_src/mlinux/moal_sdio.h @@ -45,6 +45,11 @@ Change log: #define BYTE_MODE 0 #endif +/** SDIO bus width 1 bit mode */ +#define SDIO_BUS_WIDTH_1 1 +/** SDIO bus width 4 bit mode */ +#define SDIO_BUS_WIDTH_4 4 + #ifndef FIXED_ADDRESS /** Fixed address mode */ #define FIXED_ADDRESS 0 @@ -174,6 +179,7 @@ mlan_status woal_sdiommc_bus_register(void); void woal_sdiommc_bus_unregister(void); int woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option); +int woal_sdio_set_buswidth(moal_handle *handle, t_u8 bus_width); #ifdef SDIO_SUSPEND_RESUME #ifdef MMC_PM_FUNC_SUSPENDED @@ -188,14 +194,18 @@ int woal_sdio_resume(struct device *dev); #ifdef SDIO_MMC /** Structure: SDIO MMC card */ -struct sdio_mmc_card { +typedef struct _sdio_mmc_card { /** sdio_func structure pointer */ struct sdio_func *func; /** moal_handle structure pointer */ moal_handle *handle; + /** reset work*/ + struct work_struct reset_work; + /** work flag */ + t_u8 work_flags; /** saved host clock value */ unsigned int host_clock; -}; +} sdio_mmc_card; void woal_sdio_reset_hw(moal_handle *handle); #endif /* SDIO_MMC */ diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c b/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c index 96155dd..dda3e03 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sdio_mmc.c @@ -27,8 +27,15 @@ Change log: ****************************************************/ #include - +#if defined(STA_CFG80211) || defined(UAP_CFG80211) +#include "moal_cfg80211.h" +#endif #include "moal_sdio.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) +#if IS_ENABLED(CONFIG_IPV6) +#include +#endif +#endif /** define nxp vendor id */ #define NXP_VENDOR_ID 0x0471 @@ -133,6 +140,7 @@ MODULE_DEVICE_TABLE(sdio, wlan_ids); int woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id); void woal_sdio_remove(struct sdio_func *func); +static void woal_sdiommc_work(struct work_struct *work); #ifdef SDIO static void woal_sdiommc_reg_dbg(pmoal_handle handle); #endif @@ -205,7 +213,7 @@ static void woal_dump_sdio_reg(moal_handle *handle) for (i = 0; i < ARRAY_SIZE(fun0_reg); i++) { data = sdio_f0_readb( - ((struct sdio_mmc_card *)handle->card)->func, + ((sdio_mmc_card *)handle->card)->func, fun0_reg[i], &ret); PRINTM(MMSG, "fun0: reg 0x%02x=0x%02x ret=%d\n", fun0_reg[i], data, ret); @@ -223,7 +231,7 @@ static void woal_dump_sdio_reg(moal_handle *handle) } #endif for (i = 0; i < array_size; i++) { - data = sdio_readb(((struct sdio_mmc_card *)handle->card)->func, + data = sdio_readb(((sdio_mmc_card *)handle->card)->func, fun1_reg[i], &ret); PRINTM(MMSG, "fun1: reg 0x%02x=0x%02x ret=%d\n", fun1_reg[i], data, ret); @@ -243,7 +251,7 @@ static void woal_dump_sdio_reg(moal_handle *handle) static void woal_sdio_interrupt(struct sdio_func *func) { moal_handle *handle; - struct sdio_mmc_card *card; + sdio_mmc_card *card; mlan_status status; ENTER(); @@ -296,7 +304,7 @@ static void woal_sdio_interrupt(struct sdio_func *func) */ static t_u16 woal_update_card_type(t_void *card) { - struct sdio_mmc_card *cardp_sd = (struct sdio_mmc_card *)card; + sdio_mmc_card *cardp_sd = (sdio_mmc_card *)card; t_u16 card_type = 0; /* Update card type */ @@ -468,7 +476,7 @@ static t_u16 woal_update_card_type(t_void *card) int woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) { int ret = MLAN_STATUS_SUCCESS; - struct sdio_mmc_card *card = NULL; + sdio_mmc_card *card = NULL; t_u16 card_type = 0; ENTER(); @@ -476,7 +484,7 @@ int woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) PRINTM(MMSG, "vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n", func->vendor, func->device, func->class, func->num); - card = kzalloc(sizeof(struct sdio_mmc_card), GFP_KERNEL); + card = kzalloc(sizeof(sdio_mmc_card), GFP_KERNEL); if (!card) { PRINTM(MFATAL, "Failed to allocate memory in probe function!\n"); @@ -518,7 +526,7 @@ int woal_sdio_probe(struct sdio_func *func, const struct sdio_device_id *id) ret = MLAN_STATUS_FAILURE; goto err; } - + INIT_WORK(&card->reset_work, woal_sdiommc_work); if (NULL == woal_add_card(card, &card->func->dev, &sdiommc_ops, card_type)) { PRINTM(MMSG, "woal_add_card failed\n"); @@ -549,7 +557,7 @@ err: */ void woal_sdio_remove(struct sdio_func *func) { - struct sdio_mmc_card *card; + sdio_mmc_card *card; ENTER(); @@ -603,8 +611,7 @@ void woal_wlan_is_suspended(moal_handle *handle) ENTER(); if (handle->suspend_notify_req == MTRUE) { handle->is_suspended = MTRUE; - sdio_func_suspended( - ((struct sdio_mmc_card *)handle->card)->func); + sdio_func_suspended(((sdio_mmc_card *)handle->card)->func); } LEAVE(); } @@ -619,7 +626,7 @@ void woal_sdio_shutdown(struct device *dev) { struct sdio_func *func = dev_to_sdio_func(dev); moal_handle *handle = NULL; - struct sdio_mmc_card *cardp; + sdio_mmc_card *cardp; mlan_ds_ps_info pm_info; int i, retry_num = 8; @@ -702,7 +709,7 @@ int woal_sdio_suspend(struct device *dev) struct sdio_func *func = dev_to_sdio_func(dev); mmc_pm_flag_t pm_flags = 0; moal_handle *handle = NULL; - struct sdio_mmc_card *cardp; + sdio_mmc_card *cardp; int i, retry_num = 8; int ret = MLAN_STATUS_SUCCESS; int hs_actived = 0; @@ -831,7 +838,7 @@ int woal_sdio_resume(struct device *dev) struct sdio_func *func = dev_to_sdio_func(dev); mmc_pm_flag_t pm_flags = 0; moal_handle *handle = NULL; - struct sdio_mmc_card *cardp; + sdio_mmc_card *cardp; int i; ENTER(); @@ -886,10 +893,10 @@ static mlan_status woal_sdiommc_write_reg(moal_handle *handle, t_u32 reg, t_u32 data) { mlan_status ret = MLAN_STATUS_FAILURE; - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - sdio_writeb(((struct sdio_mmc_card *)handle->card)->func, (t_u8)data, - reg, (int *)&ret); - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + sdio_writeb(((sdio_mmc_card *)handle->card)->func, (t_u8)data, reg, + (int *)&ret); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); return ret; } @@ -907,10 +914,10 @@ static mlan_status woal_sdiommc_read_reg(moal_handle *handle, t_u32 reg, { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 val; - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - val = sdio_readb(((struct sdio_mmc_card *)handle->card)->func, reg, + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + val = sdio_readb(((sdio_mmc_card *)handle->card)->func, reg, (int *)&ret); - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); *data = val; return ret; @@ -928,10 +935,10 @@ static mlan_status woal_sdiommc_read_reg(moal_handle *handle, t_u32 reg, static mlan_status woal_sdio_writeb(moal_handle *handle, t_u32 reg, t_u8 data) { mlan_status ret = MLAN_STATUS_FAILURE; - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - sdio_writeb(((struct sdio_mmc_card *)handle->card)->func, (t_u8)data, - reg, (int *)&ret); - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + sdio_writeb(((sdio_mmc_card *)handle->card)->func, (t_u8)data, reg, + (int *)&ret); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); return ret; } @@ -948,10 +955,10 @@ static mlan_status woal_sdio_readb(moal_handle *handle, t_u32 reg, t_u8 *data) { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 val; - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - val = sdio_readb(((struct sdio_mmc_card *)handle->card)->func, reg, + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + val = sdio_readb(((sdio_mmc_card *)handle->card)->func, reg, (int *)&ret); - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); *data = val; return ret; @@ -971,10 +978,10 @@ static mlan_status woal_sdio_f0_readb(moal_handle *handle, t_u32 reg, { mlan_status ret = MLAN_STATUS_FAILURE; t_u8 val; - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - val = sdio_f0_readb(((struct sdio_mmc_card *)handle->card)->func, reg, + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + val = sdio_f0_readb(((sdio_mmc_card *)handle->card)->func, reg, (int *)&ret); - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); *data = val; return ret; @@ -1000,7 +1007,7 @@ static mlan_status woal_sdio_rw_mb(moal_handle *handle, pmlan_buffer pmbuf_list, struct mmc_request mmc_req; struct mmc_command mmc_cmd; struct mmc_data mmc_dat; - struct sdio_func *func = ((struct sdio_mmc_card *)handle->card)->func; + struct sdio_func *func = ((sdio_mmc_card *)handle->card)->func; t_u32 ioport = (port & MLAN_SDIO_IO_PORT_MASK); t_u32 blkcnt = pmbuf_list->data_len / MLAN_SDIO_BLOCK_SIZE; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) @@ -1042,25 +1049,24 @@ static mlan_status woal_sdio_rw_mb(moal_handle *handle, pmlan_buffer pmbuf_list, mmc_req.cmd = &mmc_cmd; mmc_req.data = &mmc_dat; - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - mmc_set_data_timeout( - &mmc_dat, ((struct sdio_mmc_card *)handle->card)->func->card); - mmc_wait_for_req( - ((struct sdio_mmc_card *)handle->card)->func->card->host, - &mmc_req); + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + mmc_set_data_timeout(&mmc_dat, + ((sdio_mmc_card *)handle->card)->func->card); + mmc_wait_for_req(((sdio_mmc_card *)handle->card)->func->card->host, + &mmc_req); if (mmc_cmd.error || mmc_dat.error) { PRINTM(MERROR, "CMD53 %s cmd_error = %d data_error=%d\n", write ? "write" : "read", mmc_cmd.error, mmc_dat.error); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) /* issue abort cmd52 command through F0*/ - sdio_f0_writeb(((struct sdio_mmc_card *)handle->card)->func, - 0x01, SDIO_CCCR_ABORT, &status); + sdio_f0_writeb(((sdio_mmc_card *)handle->card)->func, 0x01, + SDIO_CCCR_ABORT, &status); #endif - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); return MLAN_STATUS_FAILURE; } - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); return MLAN_STATUS_SUCCESS; } @@ -1093,20 +1099,20 @@ static mlan_status woal_sdiommc_write_data_sync(moal_handle *handle, #ifdef SDIO_MMC_DEBUG handle->cmd53w = 1; #endif - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - status = sdio_writesb(((struct sdio_mmc_card *)handle->card)->func, - ioport, buffer, blkcnt * blksz); + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + status = sdio_writesb(((sdio_mmc_card *)handle->card)->func, ioport, + buffer, blkcnt * blksz); if (!status) ret = MLAN_STATUS_SUCCESS; else { PRINTM(MERROR, "cmd53 write error=%d\n", status); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) /* issue abort cmd52 command through F0*/ - sdio_f0_writeb(((struct sdio_mmc_card *)handle->card)->func, - 0x01, SDIO_CCCR_ABORT, &status); + sdio_f0_writeb(((sdio_mmc_card *)handle->card)->func, 0x01, + SDIO_CCCR_ABORT, &status); #endif } - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); #ifdef SDIO_MMC_DEBUG handle->cmd53w = 2; #endif @@ -1142,20 +1148,20 @@ static mlan_status woal_sdiommc_read_data_sync(moal_handle *handle, #ifdef SDIO_MMC_DEBUG handle->cmd53r = 1; #endif - sdio_claim_host(((struct sdio_mmc_card *)handle->card)->func); - status = sdio_readsb(((struct sdio_mmc_card *)handle->card)->func, - buffer, ioport, blkcnt * blksz); + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + status = sdio_readsb(((sdio_mmc_card *)handle->card)->func, buffer, + ioport, blkcnt * blksz); if (!status) { ret = MLAN_STATUS_SUCCESS; } else { PRINTM(MERROR, "cmd53 read error=%d\n", status); #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) /* issue abort cmd52 command through F0*/ - sdio_f0_writeb(((struct sdio_mmc_card *)handle->card)->func, - 0x01, SDIO_CCCR_ABORT, &status); + sdio_f0_writeb(((sdio_mmc_card *)handle->card)->func, 0x01, + SDIO_CCCR_ABORT, &status); #endif } - sdio_release_host(((struct sdio_mmc_card *)handle->card)->func); + sdio_release_host(((sdio_mmc_card *)handle->card)->func); #ifdef SDIO_MMC_DEBUG handle->cmd53r = 2; #endif @@ -1209,7 +1215,7 @@ static void woal_sdiommc_unregister_dev(moal_handle *handle) { ENTER(); if (handle->card) { - struct sdio_mmc_card *card = handle->card; + sdio_mmc_card *card = handle->card; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) struct sdio_func *func = card->func; #endif @@ -1245,7 +1251,7 @@ static void woal_sdiommc_unregister_dev(moal_handle *handle) static mlan_status woal_sdiommc_register_dev(moal_handle *handle) { int ret = MLAN_STATUS_SUCCESS; - struct sdio_mmc_card *card = handle->card; + sdio_mmc_card *card = handle->card; struct sdio_func *func; ENTER(); @@ -1286,6 +1292,44 @@ release_host: return MLAN_STATUS_FAILURE; } +/** + * @brief This function set the sdio bus width + * + * @param handle A pointer to moal_handle structure + * @param mode 1--1 bit mode, 4--4 bit mode + * @return MLAN_STATUS_SUCCESS + */ +int woal_sdio_set_buswidth(moal_handle *handle, t_u8 bus_width) +{ + sdio_mmc_card *cardp = (sdio_mmc_card *)handle->card; + struct mmc_host *host = cardp->func->card->host; + int ret = 0; + t_u8 val; + + ENTER(); + + if (bus_width != SDIO_BUS_WIDTH_1 && bus_width != SDIO_BUS_WIDTH_4) { + LEAVE(); + return -EFAULT; + } + sdio_claim_host(((sdio_mmc_card *)handle->card)->func); + val = sdio_f0_readb(((sdio_mmc_card *)handle->card)->func, SDIO_CCCR_IF, + (int *)&ret); + val &= ~SDIO_BUS_WIDTH_MASK; + if (bus_width == SDIO_BUS_WIDTH_1) + host->ios.bus_width = MMC_BUS_WIDTH_1; + else { + host->ios.bus_width = MMC_BUS_WIDTH_4; + val |= SDIO_BUS_WIDTH_4BIT; + } + sdio_f0_writeb(((sdio_mmc_card *)handle->card)->func, val, SDIO_CCCR_IF, + &ret); + sdio_release_host(cardp->func); + host->ops->set_ios(host, &host->ios); + LEAVE(); + return ret; +} + /** * @brief This function set bus clock on/off * @@ -1295,7 +1339,7 @@ release_host: */ int woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option) { - struct sdio_mmc_card *cardp = (struct sdio_mmc_card *)handle->card; + sdio_mmc_card *cardp = (sdio_mmc_card *)handle->card; struct mmc_host *host = cardp->func->card->host; ENTER(); @@ -1328,7 +1372,7 @@ int woal_sdio_set_bus_clock(moal_handle *handle, t_u8 option) int woal_sdio_read_write_cmd52(moal_handle *handle, int func, int reg, int val) { int ret = MLAN_STATUS_SUCCESS; - struct sdio_mmc_card *card = (struct sdio_mmc_card *)handle->card; + sdio_mmc_card *card = (sdio_mmc_card *)handle->card; ENTER(); /* Save current func and reg for read */ @@ -1381,7 +1425,7 @@ 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; + sdio_mmc_card *card = (sdio_mmc_card *)handle->card; #endif #ifdef SD9098 @@ -1395,7 +1439,7 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle) { mlan_status ret = MLAN_STATUS_SUCCESS; #ifdef SD9098 - struct sdio_mmc_card *card = (struct sdio_mmc_card *)handle->card; + sdio_mmc_card *card = (sdio_mmc_card *)handle->card; #endif t_u32 revision_id = 0; t_u32 rev_id_reg = handle->card_info->rev_id_reg; @@ -1882,7 +1926,7 @@ void woal_dump_firmware_info(moal_handle *phandle) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) - sdio_claim_host(((struct sdio_mmc_card *)phandle->card)->func); + sdio_claim_host(((sdio_mmc_card *)phandle->card)->func); #endif /* start dump fw memory */ moal_get_system_time(phandle, &sec, &usec); @@ -2064,7 +2108,7 @@ void woal_dump_firmware_info(moal_handle *phandle) /* end dump fw memory */ done: #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32) - sdio_release_host(((struct sdio_mmc_card *)phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)phandle->card)->func); #endif if (ITCM_Ptr) moal_vfree(phandle, ITCM_Ptr); @@ -2752,7 +2796,7 @@ static int woal_sdiommc_dump_reg_info(moal_handle *phandle, t_u8 *drv_buf) */ void woal_sdio_reset_hw(moal_handle *handle) { - struct sdio_mmc_card *card = handle->card; + sdio_mmc_card *card = handle->card; struct sdio_func *func = card->func; ENTER(); sdio_claim_host(func); @@ -2789,6 +2833,347 @@ void woal_sdio_reset_hw(moal_handle *handle) return; } +/** + * @brief This function reload fw + * + * @param handle A pointer to moal_handle structure + * + * @return 0--success, otherwise failure + */ +static int woal_sdiommc_reset_fw(moal_handle *handle) +{ + int ret = 0, tries = 0; + t_u32 value = 1; + t_u32 reset_reg = handle->card_info->fw_reset_reg; + t_u8 reset_val = handle->card_info->fw_reset_val; + t_u32 wakeup_reg = handle->card_info->fw_wakeup_reg; + t_u8 wakeup_val = handle->card_info->fw_wakeup_val; + + ENTER(); + /** write power up bit to wakeu device */ + if (handle->ops.write_reg(handle, wakeup_reg, wakeup_val) != + MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "Failed to write wakeup register.\n"); + ret = -EFAULT; + goto done; + } + + /** wait SOC fully wake up */ + for (tries = 0; tries < MAX_POLL_TRIES; ++tries) { + ret = handle->ops.write_reg(handle, reset_reg, 0xba); + if (ret == MLAN_STATUS_SUCCESS) { + handle->ops.read_reg(handle, reset_reg, &value); + if (value == 0xba) { + PRINTM(MMSG, "FW wake up\n"); + break; + } + } + udelay(1000); + } + /* Write register to notify FW */ + if (handle->ops.write_reg(handle, reset_reg, reset_val) != + MLAN_STATUS_SUCCESS) { + PRINTM(MERROR, "Failed to write reset register.\n"); + 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 < MAX_POLL_TRIES; ++tries) { + handle->ops.read_reg(handle, reset_reg, &value); + if (value == 0) + /* FW is ready */ + break; + udelay(1000); + } + + if (value) { + PRINTM(MERROR, "Failed to poll FW reset register %X=0x%x\n", + reset_reg, value); + ret = -EFAULT; + goto done; + } + PRINTM(MMSG, "SDIO Trigger FW In-band Reset success"); +done: + LEAVE(); + return ret; +} + +/** + * @brief Function to process pre/post SDIO function level reset + * + * @param handle A pointer to moal_handle structure + * @param prepare True :- its a prepare reset + * False :- its a post reset + * @param flr True: flag for wifi-only firmware + * + * Note: This function is mix of woal_switch_drv_mode() and + * remove_card(). Idea is to cleanup the software only. + * post reset: add_card() + * + * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE + */ +static mlan_status woal_do_sdiommc_flr(moal_handle *handle, bool prepare, + bool flr_flag) +{ + unsigned int i; + int index = 0; + mlan_status status = MLAN_STATUS_SUCCESS; + moal_private *priv = NULL; + int fw_serial_bkp = 0; + sdio_mmc_card *card = NULL; + + ENTER(); + + if (!handle) { + PRINTM(MINFO, "\n Handle null during prepare=%d\n", prepare); + LEAVE(); + return status; + } + card = (sdio_mmc_card *)handle->card; + if (MOAL_ACQ_SEMAPHORE_BLOCK(&AddRemoveCardSem)) + goto exit_sem_err; + + if (!prepare) + goto perform_init; + + /* Reset all interfaces */ + priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); + mlan_disable_host_int(handle->pmlan_adapter); + woal_reset_intf(priv, MOAL_IOCTL_WAIT, MTRUE); + woal_clean_up(handle); + mlan_ioctl(handle->pmlan_adapter, NULL); + + /* Shutdown firmware */ + handle->init_wait_q_woken = MFALSE; + status = mlan_shutdown_fw(handle->pmlan_adapter); + + if (status == MLAN_STATUS_PENDING) + wait_event_interruptible(handle->init_wait_q, + handle->init_wait_q_woken); + + if (atomic_read(&handle->rx_pending) || + atomic_read(&handle->tx_pending) || + atomic_read(&handle->ioctl_pending)) { + PRINTM(MERROR, + "ERR: rx_pending=%d,tx_pending=%d,ioctl_pending=%d\n", + atomic_read(&handle->rx_pending), + atomic_read(&handle->tx_pending), + atomic_read(&handle->ioctl_pending)); + } + + unregister_inetaddr_notifier(&handle->woal_notifier); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) +#if IS_ENABLED(CONFIG_IPV6) + unregister_inet6addr_notifier(&handle->woal_inet6_notifier); +#endif +#endif + +#ifdef WIFI_DIRECT_SUPPORT +#if defined(STA_CFG80211) && defined(UAP_CFG80211) +#if CFG80211_VERSION_CODE >= WIFI_DIRECT_KERNEL_VERSION + /* Remove virtual interface */ + woal_remove_virtual_interface(handle); +#endif +#endif +#endif + /* Remove interface */ + for (i = 0; i < handle->priv_num; i++) + woal_remove_interface(handle, i); + handle->priv_num = 0; +#if defined(STA_CFG80211) || defined(UAP_CFG80211) + /* Unregister wiphy device and free */ + if (handle->wiphy) { + wiphy_unregister(handle->wiphy); + woal_cfg80211_free_bands(handle->wiphy); + wiphy_free(handle->wiphy); + handle->wiphy = NULL; + } +#endif + /* Unregister mlan */ + if (handle->pmlan_adapter) { + mlan_unregister(handle->pmlan_adapter); + if (atomic_read(&handle->lock_count) || + atomic_read(&handle->malloc_count) || + atomic_read(&handle->mbufalloc_count)) { + PRINTM(MERROR, + "mlan has memory leak: lock_count=%d," + " malloc_count=%d, mbufalloc_count=%d\n", + atomic_read(&handle->lock_count), + atomic_read(&handle->malloc_count), + atomic_read(&handle->mbufalloc_count)); + } + handle->pmlan_adapter = NULL; + } + + goto exit; + +perform_init: + handle->priv_num = 0; + + /* Init SW */ + if (woal_init_sw(handle)) { + PRINTM(MFATAL, "Software Init Failed\n"); + goto err_init_fw; + } + /* Init FW and HW */ + /* Load wlan only binary */ + if (flr_flag) { + fw_serial_bkp = moal_extflg_isset(handle, EXT_FW_SERIAL); + moal_extflg_clear(handle, EXT_FW_SERIAL); + woal_update_firmware_name(handle); + } + if (woal_init_fw(handle)) { + PRINTM(MFATAL, "Firmware Init Failed\n"); + woal_sdiommc_reg_dbg(handle); + if (fw_serial_bkp) + moal_extflg_set(handle, EXT_FW_SERIAL); + goto err_init_fw; + } + if (flr_flag && fw_serial_bkp) + moal_extflg_set(handle, EXT_FW_SERIAL); +exit: + MOAL_REL_SEMAPHORE(&AddRemoveCardSem); + +exit_sem_err: + LEAVE(); + return status; + +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"); + handle->init_wait_q_woken = MFALSE; + status = mlan_shutdown_fw(handle->pmlan_adapter); + if (status == MLAN_STATUS_PENDING) + wait_event_interruptible(handle->init_wait_q, + handle->init_wait_q_woken); + } +#ifdef ANDROID_KERNEL +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0) + wakeup_source_trash(&handle->ws); +#else + wake_lock_destroy(&handle->wake_lock); +#endif +#endif +#ifdef CONFIG_PROC_FS + woal_proc_exit(handle); +#endif + /* Unregister device */ + PRINTM(MINFO, "unregister device\n"); + woal_sdiommc_unregister_dev(handle); + handle->surprise_removed = MTRUE; +#ifdef REASSOCIATION + if (handle->reassoc_thread.pid) + wake_up_interruptible(&handle->reassoc_thread.wait_q); + /* waiting for main thread quit */ + while (handle->reassoc_thread.pid) + woal_sched_timeout(2); +#endif /* REASSOCIATION */ + if (moal_extflg_isset(handle, EXT_NAPI)) + netif_napi_del(&handle->napi_rx); + woal_terminate_workqueue(handle); + woal_free_moal_handle(handle); + + for (index = 0; index < MAX_MLAN_ADAPTER; index++) { + if (m_handle[index] == handle) + break; + } + if (index < MAX_MLAN_ADAPTER) + m_handle[index] = NULL; + card->handle = NULL; + MOAL_REL_SEMAPHORE(&AddRemoveCardSem); + LEAVE(); + return (mlan_status)MLAN_STATUS_FAILURE; +} + +/** + * @brief This function handle the sdio work + * + * @param WORK A pointer to work_struct + * @return N/A + * + */ +static void woal_sdiommc_work(struct work_struct *work) +{ + sdio_mmc_card *card = container_of(work, sdio_mmc_card, reset_work); + moal_handle *handle = NULL; + moal_handle *ref_handle = NULL; + PRINTM(MMSG, "========START IN-BAND RESET===========\n"); + handle = card->handle; + // handle-> mac0 , ref_handle->second mac + if (handle->pref_mac) { + if (handle->second_mac) { + handle = (moal_handle *)handle->pref_mac; + ref_handle = (moal_handle *)handle->pref_mac; + } else { + ref_handle = (moal_handle *)handle->pref_mac; + } + if (ref_handle) { + ref_handle->surprise_removed = MTRUE; + woal_clean_up(ref_handle); + mlan_ioctl(ref_handle->pmlan_adapter, NULL); + } + } + handle->surprise_removed = MTRUE; + handle->fw_reseting = MTRUE; + woal_do_sdiommc_flr(handle, true, true); + if (ref_handle) { + ref_handle->surprise_removed = MTRUE; + ref_handle->fw_reseting = MTRUE; + woal_do_sdiommc_flr(ref_handle, true, true); + } + if (woal_sdiommc_reset_fw(handle)) { + PRINTM(MERROR, "SDIO In-band Reset Fail\n"); + goto done; + } + handle->surprise_removed = MFALSE; + if (MLAN_STATUS_SUCCESS == woal_do_sdiommc_flr(handle, false, true)) + handle->fw_reseting = MFALSE; + else + handle = NULL; + + if (ref_handle) { + ref_handle->surprise_removed = MFALSE; + if (MLAN_STATUS_SUCCESS == + woal_do_sdiommc_flr(ref_handle, false, true)) + ref_handle->fw_reseting = MFALSE; + } + card->work_flags = MFALSE; +done: + wifi_status = WIFI_STATUS_OK; + if (handle) + woal_send_auto_recovery_complete_event(handle); + PRINTM(MMSG, "========END IN-BAND RESET===========\n"); + return; +} + +/** + * @brief This function start reset_work + * + * @param handle A pointer to moal_handle structure + * @return MTRUE/MFALSE + * + */ +static void woal_sdiommc_card_reset(moal_handle *handle) +{ + sdio_mmc_card *card = handle->card; + if (!card->work_flags) { + card->work_flags = MTRUE; + schedule_work(&card->reset_work); + } +} + static moal_if_ops sdiommc_ops = { .register_dev = woal_sdiommc_register_dev, .unregister_dev = woal_sdiommc_unregister_dev, @@ -2800,5 +3185,6 @@ static moal_if_ops sdiommc_ops = { .dump_fw_info = woal_sdiommc_dump_fw_info, .dump_reg_info = woal_sdiommc_dump_reg_info, .reg_dbg = woal_sdiommc_reg_dbg, + .card_reset = woal_sdiommc_card_reset, .is_second_mac = woal_sdiommc_is_second_mac, }; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_shim.c b/mxm_wifiex/wlan_src/mlinux/moal_shim.c index 4afc986..fe5095e 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_shim.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_shim.c @@ -55,6 +55,8 @@ Change log: #endif /*defined(PCIE) || defined(SDIO)*/ +#define NXP_ETH_P_WAPI 0x88B4 + /******************************************************** Local Variables ********************************************************/ @@ -107,7 +109,12 @@ mlan_status moal_malloc(t_void *pmoal, t_u32 size, t_u32 flag, t_u8 **ppbuf) if (flag & MLAN_MEM_DMA) mem_flag |= GFP_DMA; } - *ppbuf = kzalloc(size, mem_flag); + + if (flag & MLAN_MEM_FLAG_DIRTY) + *ppbuf = kmalloc(size, mem_flag); + else + *ppbuf = kzalloc(size, mem_flag); + if (*ppbuf == NULL) { PRINTM(MERROR, "%s: allocate memory (%d bytes) failed!\n", __func__, (int)size); @@ -241,7 +248,6 @@ mlan_status moal_mfree_consistent(t_void *pmoal, t_u32 size, t_u8 *pbuf, if (!pbuf || !card) return MLAN_STATUS_FAILURE; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) dma_free_coherent(&card->dev->dev, size, pbuf, buf_pa); #else @@ -272,7 +278,6 @@ mlan_status moal_map_memory(t_void *pmoal, t_u8 *pbuf, t_u64 *pbuf_pa, if (!card) return MLAN_STATUS_FAILURE; - /* Init memory to device */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) dma = dma_map_single(&card->dev->dev, pbuf, size, flag); @@ -287,7 +292,6 @@ mlan_status moal_map_memory(t_void *pmoal, t_u8 *pbuf, t_u64 *pbuf_pa, PRINTM(MERROR, "Tx ring: failed to dma_map_single\n"); return MLAN_STATUS_FAILURE; } - *pbuf_pa = dma; return MLAN_STATUS_SUCCESS; } @@ -311,7 +315,6 @@ mlan_status moal_unmap_memory(t_void *pmoal, t_u8 *pbuf, t_u64 buf_pa, if (!card) return MLAN_STATUS_FAILURE; - #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0) dma_unmap_single(&card->dev->dev, buf_pa, size, flag); #else @@ -2235,8 +2238,17 @@ mlan_status moal_recv_packet(t_void *pmoal, pmlan_buffer pmbuf) MAC2STR(ethh->h_source)); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) priv->deauth_evt_cnt = 0; +#endif + } else if (ntohs(ethh->h_proto) == NXP_ETH_P_WAPI) { + PRINTM(MEVENT, + "wlan: %s Rx WAPI pkt from " MACSTR "\n", + priv->netdev->name, + MAC2STR(ethh->h_source)); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) + priv->deauth_evt_cnt = 0; #endif } + #ifdef UAP_SUPPORT #if defined(UAP_CFG80211) || defined(STA_CFG80211) if (pmbuf->flags & MLAN_BUF_FLAG_EASYMESH) { @@ -2715,10 +2727,8 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #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) @@ -2826,33 +2836,6 @@ mlan_status moal_recv_event(t_void *pmoal, pmlan_event pmevent) #endif switch (pmevent->event_id) { #ifdef STA_SUPPORT - case MLAN_EVENT_ID_FW_ADHOC_LINK_SENSED: - priv->is_adhoc_link_sensed = MTRUE; - if (!netif_carrier_ok(priv->netdev)) - netif_carrier_on(priv->netdev); - woal_wake_queue(priv->netdev); -#ifdef STA_WEXT - if (IS_STA_WEXT(cfg80211_wext)) - woal_send_iwevcustom_event(priv, - CUS_EVT_ADHOC_LINK_SENSED); -#endif - woal_broadcast_event(priv, CUS_EVT_ADHOC_LINK_SENSED, - strlen(CUS_EVT_ADHOC_LINK_SENSED)); - break; - - case MLAN_EVENT_ID_FW_ADHOC_LINK_LOST: - woal_stop_queue(priv->netdev); - if (netif_carrier_ok(priv->netdev)) - netif_carrier_off(priv->netdev); - priv->is_adhoc_link_sensed = MFALSE; -#ifdef STA_WEXT - if (IS_STA_WEXT(cfg80211_wext)) - woal_send_iwevcustom_event(priv, - CUS_EVT_ADHOC_LINK_LOST); -#endif - woal_broadcast_event(priv, CUS_EVT_ADHOC_LINK_LOST, - strlen(CUS_EVT_ADHOC_LINK_LOST)); - break; case MLAN_EVENT_ID_DRV_CONNECTED: #ifdef STA_WEXT @@ -4414,82 +4397,6 @@ 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"); diff --git a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c index 8031096..25f790f 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_sta_cfg80211.c @@ -53,6 +53,38 @@ static const u32 cfg80211_cipher_suites[] = { #endif }; +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +static const u32 cfg80211_akm_suites[] = { + WLAN_AKM_SUITE_8021X, + WLAN_AKM_SUITE_PSK, + WLAN_AKM_SUITE_SAE, + WLAN_AKM_SUITE_FT_OVER_SAE, + WLAN_AKM_SUITE_8021X_SHA256, + WLAN_AKM_SUITE_PSK_SHA256, + WLAN_AKM_SUITE_TDLS, + WLAN_AKM_SUITE_FT_8021X, + WLAN_AKM_SUITE_FT_PSK, + WLAN_AKM_SUITE_8021X_SUITE_B, + WLAN_AKM_SUITE_8021X_SUITE_B_192, + WLAN_AKM_SUITE_FILS_SHA256, + WLAN_AKM_SUITE_FILS_SHA384, + WLAN_AKM_SUITE_FT_FILS_SHA256, + WLAN_AKM_SUITE_FT_FILS_SHA384, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) + WLAN_AKM_SUITE_OWE, +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) + WLAN_AKM_SUITE_FT_PSK_SHA384, + WLAN_AKM_SUITE_PSK_SHA384, + WLAN_AKM_SUITE_FILS_SHA384, + WLAN_AKM_SUITE_FT_FILS_SHA384, +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) + WLAN_AKM_SUITE_WFA_DPP, +#endif +}; +#endif + #ifdef UAP_SUPPORT #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) static int woal_cfg80211_set_monitor_channel(struct wiphy *wiphy, @@ -1373,11 +1405,6 @@ int woal_set_rf_channel(moal_private *priv, struct ieee80211_channel *chan, else { config_bands = BAND_AN | BAND_A; } - if (mode == MLAN_BSS_MODE_IBSS) { - radio_cfg->param.band_cfg.adhoc_start_band = config_bands; - radio_cfg->param.band_cfg.adhoc_channel = - ieee80211_frequency_to_channel(chan->center_freq); - } status = woal_request_ioctl(priv, req, wait_option); if (status != MLAN_STATUS_SUCCESS) { @@ -1386,18 +1413,6 @@ int woal_set_rf_channel(moal_private *priv, struct ieee80211_channel *chan, } woal_send_domain_info_cmd_fw(priv, wait_option); - PRINTM(MINFO, "Setting band %d, and mode = %d channel=%d\n", - config_bands, mode, - ieee80211_frequency_to_channel(chan->center_freq)); - - if (MLAN_STATUS_SUCCESS != - woal_change_adhoc_chan( - priv, ieee80211_frequency_to_channel(chan->center_freq), - wait_option)) { - ret = -EFAULT; - goto done; - } - done: if (status != MLAN_STATUS_PENDING) kfree(req); @@ -1677,84 +1692,6 @@ done: return ret; } -/** - * @brief Informs the CFG802.11 subsystem of a new IBSS connection. - * - * The following information are sent to the CFG802.11 subsystem - * to register the new IBSS connection. If we do not register the - * new IBSS, a kernel panic will result. - * - MAC address - * - Capabilities - * - Beacon period - * - RSSI value - * - Channel - * - Supported rates IE - * - Extended capabilities IE - * - DS parameter set IE - * - HT Capability IE - * - Vendor Specific IE (221) - * - WPA IE - * - RSN IE - * - * @param priv A pointer to moal_private structure - * @param cahn A pointer to ieee80211_channel structure - * @param beacon_interval Beacon interval - * - * @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE - */ -static mlan_status woal_cfg80211_inform_ibss_bss(moal_private *priv, - struct ieee80211_channel *chan, - t_u16 beacon_interval) -{ - mlan_status ret = MLAN_STATUS_SUCCESS; - mlan_bss_info bss_info; - mlan_ds_get_signal signal; - t_u8 ie_buf[MLAN_MAX_SSID_LENGTH + sizeof(IEEEtypes_Header_t)]; - int ie_len = 0; - struct cfg80211_bss *bss = NULL; - - ENTER(); - - ret = woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info); - if (ret) - goto done; - - memset(ie_buf, 0, sizeof(ie_buf)); - ie_buf[0] = WLAN_EID_SSID; - ie_buf[1] = bss_info.ssid.ssid_len; - - moal_memcpy_ext(priv->phandle, &ie_buf[sizeof(IEEEtypes_Header_t)], - &bss_info.ssid.ssid, bss_info.ssid.ssid_len, - sizeof(ie_buf) - sizeof(IEEEtypes_Header_t)); - ie_len = ie_buf[1] + sizeof(IEEEtypes_Header_t); - - /* Get signal information from the firmware */ - memset(&signal, 0, sizeof(mlan_ds_get_signal)); - if (MLAN_STATUS_SUCCESS != - woal_get_signal_info(priv, MOAL_IOCTL_WAIT, &signal)) { - PRINTM(MERROR, "Error getting signal information\n"); - ret = MLAN_STATUS_FAILURE; - goto done; - } - - bss = cfg80211_inform_bss(priv->wdev->wiphy, chan, -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) - CFG80211_BSS_FTYPE_UNKNOWN, -#endif - bss_info.bssid, 0, WLAN_CAPABILITY_IBSS, - beacon_interval, ie_buf, ie_len, - signal.bcn_rssi_avg, GFP_KERNEL); - if (bss) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) - cfg80211_put_bss(priv->wdev->wiphy, bss); -#else - cfg80211_put_bss(bss); -#endif -done: - LEAVE(); - return ret; -} - /** * @brief Process country IE before assoicate * @@ -2165,7 +2102,7 @@ static int woal_cfg80211_auth_scan(moal_private *priv, * @return MLAN_STATUS_SUCCESS/MLAN_STATUS_PENDING * -- success, otherwise fail */ -mlan_status woal_request_set_host_mlme(moal_private *priv) +static mlan_status woal_request_set_host_mlme(moal_private *priv, t_u8 *bssid) { mlan_ioctl_req *req = NULL; mlan_ds_bss *bss = NULL; @@ -2184,7 +2121,8 @@ mlan_status woal_request_set_host_mlme(moal_private *priv) bss->sub_command = MLAN_OID_BSS_HOST_MLME; req->req_id = MLAN_IOCTL_BSS; req->action = MLAN_ACT_SET; - + moal_memcpy_ext(priv->phandle, &bss->param.bssid, bssid, + MLAN_MAC_ADDR_LENGTH, MLAN_MAC_ADDR_LENGTH); /* Send IOCTL request to MLAN */ status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT); done: @@ -2541,7 +2479,7 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, 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); + woal_request_set_host_mlme(priv, req->bss->bssid); PRINTM(MMSG, "wlan: HostMlme %s send auth to bssid " MACSTR "\n", dev->name, MAC2STR(req->bss->bssid)); @@ -2671,7 +2609,11 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv, struct cfg80211_bss *bss = NULL; unsigned long flags; u8 *assoc_req_buf = NULL; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 7, 0)) || IMX_ANDROID_14) + struct cfg80211_rx_assoc_resp_data resp = { + .uapsd_queues = -1, + }; +#elif ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) struct cfg80211_rx_assoc_resp resp = { .uapsd_queues = -1, }; @@ -2728,8 +2670,7 @@ void woal_host_mlme_process_assoc_resp(moal_private *priv, assoc_req_buf = assoc_info ->assoc_req_buf; - -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) resp.links[0].bss = bss; resp.buf = assoc_info->assoc_resp_buf; resp.len = assoc_info->assoc_resp_len; @@ -2854,8 +2795,8 @@ static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, 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; + LEAVE(); + return -EFAULT; } priv->cfg_disconnect = MFALSE; @@ -3094,7 +3035,6 @@ done: int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, mlan_ds_misc_assoc_rsp *assoc_rsp) { - struct cfg80211_ibss_params *ibss_param = NULL; struct cfg80211_connect_params *conn_param = NULL; mlan_802_11_ssid req_ssid; mlan_ssid_bssid *ssid_bssid = NULL; @@ -3109,7 +3049,6 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, t_u8 *ie = NULL; int ie_len = 0; struct ieee80211_channel *channel = NULL; - t_u16 beacon_interval = 0; bool privacy; struct cfg80211_bss *pub = NULL; mlan_status status = MLAN_STATUS_SUCCESS; @@ -3128,25 +3067,7 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, mode = woal_nl80211_iftype_to_mode(priv->wdev->iftype); - if (mode == MLAN_BSS_MODE_IBSS) { - ibss_param = (struct cfg80211_ibss_params *)sme; - ssid = (t_u8 *)ibss_param->ssid; - ssid_len = ibss_param->ssid_len; - bssid = (t_u8 *)ibss_param->bssid; -#if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 8, 0) - channel = ibss_param->channel; -#else - channel = ibss_param->chandef.chan; -#endif - if (channel) - priv->phandle->band = channel->band; - if (ibss_param->ie_len) - ie = (t_u8 *)ibss_param->ie; - ie_len = ibss_param->ie_len; - beacon_interval = ibss_param->beacon_interval; - privacy = ibss_param->privacy; - - } else { + { conn_param = (struct cfg80211_connect_params *)sme; ssid = (t_u8 *)conn_param->ssid; ssid_len = conn_param->ssid_len; @@ -3344,56 +3265,6 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, } } - if (mode == MLAN_BSS_MODE_IBSS) { - mlan_ds_bss *bss = NULL; - /* Change beacon interval */ - if ((beacon_interval < MLAN_MIN_BEACON_INTERVAL) || - (beacon_interval > MLAN_MAX_BEACON_INTERVAL)) { - ret = -EINVAL; - goto done; - } - kfree(req); - req = NULL; - - req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_bss)); - if (req == NULL) { - ret = -ENOMEM; - goto done; - } - bss = (mlan_ds_bss *)req->pbuf; - req->req_id = MLAN_IOCTL_BSS; - req->action = MLAN_ACT_SET; - bss->sub_command = MLAN_OID_IBSS_BCN_INTERVAL; - bss->param.bcn_interval = beacon_interval; - status = woal_request_ioctl(priv, req, wait_option); - if (status != MLAN_STATUS_SUCCESS) { - ret = -EFAULT; - goto done; - } - - /* "privacy" is set only for ad-hoc mode */ - if (privacy) { - /* - * Keep MLAN_ENCRYPTION_MODE_WEP40 for now so that - * the firmware can find a matching network from the - * scan. cfg80211 does not give us the encryption - * mode at this stage so just setting it to wep here - */ - if (MLAN_STATUS_SUCCESS != - woal_set_auth_mode(priv, wait_option, - MLAN_AUTH_MODE_OPEN)) { - ret = -EFAULT; - goto done; - } - - wpa_enabled = 0; - ret = woal_cfg80211_set_auth( - priv, MLAN_ENCRYPTION_MODE_WEP104, wpa_enabled, - wait_option); - if (ret) - goto done; - } - } moal_memcpy_ext(priv->phandle, &ssid_bssid->ssid, &req_ssid, sizeof(mlan_802_11_ssid), sizeof(ssid_bssid->ssid)); if (bssid) @@ -3464,16 +3335,7 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option, goto done; } - /* Inform the IBSS information to kernel, otherwise - * kernel will give a panic after successful assoc */ - if (mode == MLAN_BSS_MODE_IBSS) { - if (MLAN_STATUS_SUCCESS != - woal_cfg80211_inform_ibss_bss(priv, channel, - beacon_interval)) { - ret = -EFAULT; - goto done; - } - } else if (assoc_rsp) { + if (assoc_rsp) { moal_memcpy_ext(priv->phandle, assoc_rsp, &ssid_bssid->assoc_rsp, sizeof(mlan_ds_misc_assoc_rsp), @@ -4202,10 +4064,9 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy, t_u8 dfs_region = NXP_DFS_UNKNOWN; ENTER(); - priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY); - if (!priv) { - PRINTM(MFATAL, "Unable to get priv in %s()\n", __func__); + if (!priv || handle->driver_status || handle->surprise_removed) { + PRINTM(MERROR, "Blocking reg_notifier in %s()\n", __func__); LEAVE(); #if CFG80211_VERSION_CODE < KERNEL_VERSION(3, 9, 0) return -EINVAL; @@ -4526,7 +4387,7 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, ENTER(); PRINTM(MINFO, "Received scan request on %s\n", dev->name); - if (priv->phandle->driver_status) { + if (priv->phandle->driver_status || priv->phandle->surprise_removed) { PRINTM(MERROR, "Block woal_cfg80211_scan in abnormal driver state\n"); LEAVE(); @@ -4561,7 +4422,9 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, priv->phandle->fake_scan_complete = priv->fake_scan_complete; if (priv->fake_scan_complete) { PRINTM(MEVENT, "fake scan complete flag is on\n"); + spin_lock_irqsave(&priv->phandle->scan_req_lock, flags); priv->phandle->scan_request = request; + spin_unlock_irqrestore(&priv->phandle->scan_req_lock, flags); queue_delayed_work(priv->phandle->evt_workqueue, &priv->phandle->scan_timeout_work, msecs_to_jiffies(1000)); @@ -4571,8 +4434,18 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, if (MLAN_STATUS_SUCCESS == woal_get_bss_info(priv, MOAL_IOCTL_WAIT, &bss_info)) { if (bss_info.scan_block) { - PRINTM(MEVENT, "Block scan in mlan module\n"); - return -EAGAIN; + PRINTM(MEVENT, + "Block scan in mlan module for scan_request %p\n", + request); + spin_lock_irqsave(&priv->phandle->scan_req_lock, flags); + priv->phandle->fake_scan_complete = MTRUE; + priv->phandle->scan_request = request; + spin_unlock_irqrestore(&priv->phandle->scan_req_lock, + flags); + queue_delayed_work(priv->phandle->evt_workqueue, + &priv->phandle->scan_timeout_work, + msecs_to_jiffies(1000)); + return ret; } } if (priv->phandle->scan_request && @@ -4583,7 +4456,6 @@ static int woal_cfg80211_scan(struct wiphy *wiphy, struct net_device *dev, LEAVE(); return -EBUSY; } - #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) /* This check is to prevent the situation where * new scan request comes while Auth is not completed */ @@ -5538,7 +5410,7 @@ static int woal_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, return 0; } #endif - if (priv->phandle->driver_status) { + if (priv->phandle->driver_status || priv->phandle->surprise_removed) { PRINTM(MERROR, "Block woal_cfg80211_disconnect in abnormal driver state\n"); LEAVE(); @@ -5632,6 +5504,12 @@ static int woal_cfg80211_deauthenticate(struct wiphy *wiphy, { int ret = 0; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); + if (priv->phandle->driver_status || priv->phandle->surprise_removed) { + PRINTM(MERROR, + "Block woal_cfg80211_deauthenticate in abnormal driver state\n"); + return ret; + } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (priv->host_mlme) { priv->host_mlme = MFALSE; @@ -5673,6 +5551,13 @@ static int woal_cfg80211_disassociate(struct wiphy *wiphy, { int ret = 0; moal_private *priv = (moal_private *)woal_get_netdev_priv(dev); + + if (priv->phandle->driver_status || priv->phandle->surprise_removed) { + PRINTM(MERROR, + "Block woal_cfg80211_disassociate in abnormal driver state\n"); + return ret; + } + #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) if (priv->host_mlme) { priv->host_mlme = MFALSE; @@ -5982,7 +5867,7 @@ static int woal_cfg80211_set_power_mgmt(struct wiphy *wiphy, return -EFAULT; } - if (priv->phandle->driver_status) { + if (priv->phandle->driver_status || priv->phandle->surprise_removed) { PRINTM(MERROR, "Block woal_cfg80211_set_power_mgmt in abnormal driver state\n"); LEAVE(); @@ -8888,7 +8773,7 @@ int woal_cfg80211_update_ft_ies(struct wiphy *wiphy, struct net_device *dev, assoc_rsp->assoc_resp_buf; #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) #if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_13 || \ - IMX_ANDROID_12_BACKPORT) + IMX_ANDROID_14 || IMX_ANDROID_12_BACKPORT) roam_info.links[0].bssid = priv->cfg_bssid; #else roam_info.bssid = priv->cfg_bssid; @@ -9362,7 +9247,7 @@ void woal_start_roaming(moal_private *priv) #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) #if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_13 || \ - IMX_ANDROID_12_BACKPORT) + IMX_ANDROID_14 || IMX_ANDROID_12_BACKPORT) roam_info.links[0].bssid = priv->cfg_bssid; #else roam_info.bssid = priv->cfg_bssid; @@ -9443,7 +9328,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, if (params->ext_capab_len) req_len += sizeof(MrvlIEtypesHeader_t) + params->ext_capab_len; #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.supported_rates_len) req_len += sizeof(MrvlIEtypesHeader_t) + params->link_sta_params.supported_rates_len; @@ -9454,14 +9339,14 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, #endif if (params->uapsd_queues || params->max_sp) req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(qosinfo); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.ht_capa) #else if (params->ht_capa) #endif req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(struct ieee80211_ht_cap); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.vht_capa) #else if (params->vht_capa) @@ -9469,7 +9354,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(struct ieee80211_vht_cap); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.opmode_notif_used) req_len += sizeof(MrvlIEtypesHeader_t) + sizeof(u8); #else @@ -9479,7 +9364,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.he_capa_len) req_len += sizeof(MrvlExtIEtypesHeader_t) + params->link_sta_params.he_capa_len; @@ -9534,20 +9419,20 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; } #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.supported_rates_len) { #else if (params->supported_rates_len) { #endif tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = SUPPORTED_RATES; -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) tlv->header.len = params->link_sta_params.supported_rates_len; #else tlv->header.len = params->supported_rates_len; #endif moal_memcpy_ext(priv->phandle, tlv->data, -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) params->link_sta_params.supported_rates, tlv->header.len, #else @@ -9571,7 +9456,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, sizeof(MrvlIEtypesHeader_t) + tlv->header.len; tlv = (MrvlIEtypes_Data_t *)pos; } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.ht_capa) { #else if (params->ht_capa) { @@ -9579,7 +9464,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = HT_CAPABILITY; tlv->header.len = sizeof(struct ieee80211_ht_cap); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) moal_memcpy_ext(priv->phandle, tlv->data, params->link_sta_params.ht_capa, #else @@ -9591,7 +9476,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, sizeof(MrvlIEtypesHeader_t) + tlv->header.len; tlv = (MrvlIEtypes_Data_t *)pos; } -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.vht_capa) { #else if (params->vht_capa) { @@ -9599,7 +9484,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = VHT_CAPABILITY; tlv->header.len = sizeof(struct ieee80211_vht_cap); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) moal_memcpy_ext(priv->phandle, tlv->data, params->link_sta_params.vht_capa, #else @@ -9612,7 +9497,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; } #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.opmode_notif_used) { #else if (params->opmode_notif_used) { @@ -9620,7 +9505,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; tlv->header.type = OPER_MODE_NTF; tlv->header.len = sizeof(u8); -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) moal_memcpy_ext(priv->phandle, tlv->data, ¶ms->link_sta_params.opmode_notif, #else @@ -9633,7 +9518,7 @@ int woal_cfg80211_uap_add_station(struct wiphy *wiphy, struct net_device *dev, tlv = (MrvlIEtypes_Data_t *)pos; } #endif -#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) +#if ((CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)) || IMX_ANDROID_14) if (params->link_sta_params.he_capa_len) { ext_tlv = (MrvlExtIEtypes_Data_t *)pos; ext_tlv->header.type = EXTENSION; @@ -10237,6 +10122,11 @@ mlan_status woal_register_cfg80211(moal_private *priv) /* Initialize cipher suits */ wiphy->cipher_suites = cfg80211_cipher_suites; wiphy->n_cipher_suites = ARRAY_SIZE(cfg80211_cipher_suites); +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) + wiphy->akm_suites = cfg80211_akm_suites; + wiphy->n_akm_suites = ARRAY_SIZE(cfg80211_akm_suites); +#endif + #ifdef UAP_CFG80211 #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) @@ -10254,6 +10144,7 @@ mlan_status woal_register_cfg80211(moal_private *priv) #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) + cfg80211_iface_comb_ap_sta.num_different_channels = 1; if ((moal_extflg_isset(priv->phandle, EXT_CFG80211_DRCS) && priv->phandle->card_info->drcs) || IS_CARD9098(priv->phandle->card_type) || @@ -10404,6 +10295,7 @@ mlan_status woal_register_cfg80211(moal_private *priv) } #endif #endif + /* Set struct moal_handle pointer in wiphy_priv */ wdev_priv = wiphy_priv(wiphy); *(unsigned long *)wdev_priv = (unsigned long)priv->phandle; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap.c b/mxm_wifiex/wlan_src/mlinux/moal_uap.c index c9fb521..34c0569 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap.c @@ -662,20 +662,16 @@ static int woal_uap_sdcmd52_rw(struct net_device *dev, struct ifreq *req) if (!param.action) { PRINTM(MINFO, "Cmd52 read, func=%d, reg=0x%08X\n", func, reg); #ifdef SDIO_MMC - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); if (func) data = sdio_readb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, reg, &ret); else data = sdio_f0_readb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, reg, &ret); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_readb: reading register 0x%X failed\n", @@ -698,20 +694,16 @@ static int woal_uap_sdcmd52_rw(struct net_device *dev, struct ifreq *req) PRINTM(MINFO, "Cmd52 write, func=%d, reg=0x%08X, data=0x%02X\n", func, reg, data); #ifdef SDIO_MMC - sdio_claim_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_claim_host(((sdio_mmc_card *)priv->phandle->card)->func); if (func) sdio_writeb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, data, reg, &ret); else sdio_f0_writeb( - ((struct sdio_mmc_card *)priv->phandle->card) - ->func, + ((sdio_mmc_card *)priv->phandle->card)->func, data, reg, &ret); - sdio_release_host( - ((struct sdio_mmc_card *)priv->phandle->card)->func); + sdio_release_host(((sdio_mmc_card *)priv->phandle->card)->func); if (ret) { PRINTM(MERROR, "sdio_writeb: writing register 0x%X failed\n", diff --git a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c index fc65003..74a0ccd 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_uap_cfg80211.c @@ -107,7 +107,15 @@ static int woal_deauth_assoc_station(moal_private *priv, u8 *mac_addr, LEAVE(); return -EINVAL; } - +#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE + if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) + cfg80211_del_sta(priv->netdev, mac_addr, GFP_KERNEL); +#endif + if (priv->media_connected == MFALSE) { + PRINTM(MINFO, "cfg80211: Media not connected!\n"); + LEAVE(); + return 0; + } ioctl_req = (mlan_ioctl_req *)woal_alloc_mlan_ioctl_req( sizeof(mlan_ds_get_info) + (MAX_STA_LIST_IE_SIZE * MAX_NUM_CLIENTS)); @@ -138,11 +146,6 @@ static int woal_deauth_assoc_station(moal_private *priv, u8 *mac_addr, PRINTM(MMSG, "wlan: deauth station " MACSTR "\n", MAC2STR(mac_addr)); ret = woal_deauth_station(priv, mac_addr, reason_code); -#if KERNEL_VERSION(3, 8, 0) <= CFG80211_VERSION_CODE - if (moal_extflg_isset(priv->phandle, EXT_HOST_MLME)) - cfg80211_del_sta(priv->netdev, mac_addr, - GFP_KERNEL); -#endif break; } } @@ -1741,6 +1744,11 @@ static int woal_cfg80211_add_vlan_vir_if(struct wiphy *wiphy, struct net_device *ndev = NULL; ENTER(); + if (!priv) { + PRINTM(MFATAL, "Error:woal_get_priv returned NULL\n"); + ret = -EFAULT; + goto fail; + } ASSERT_RTNL(); #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 29) #ifndef MAX_WMM_QUEUE @@ -2323,6 +2331,8 @@ void woal_remove_virtual_interface(moal_handle *handle) moal_private *priv = NULL; int vir_intf = 0; int i = 0; + moal_handle *ref_handle = NULL; + int ref_vir_intf = 0; #endif ENTER(); rtnl_lock(); @@ -2352,6 +2362,38 @@ void woal_remove_virtual_interface(moal_handle *handle) } } } + if (handle->pref_mac) { + ref_handle = (moal_handle *)handle->pref_mac; + for (i = 0; i < ref_handle->priv_num; i++) { + priv = ref_handle->priv[i]; + if (priv) { + if (priv->bss_virtual && + priv->wdev->wiphy == handle->wiphy) { + PRINTM(MCMND, + "Remove virtual interfaces from pref mac %s\n", + priv->netdev->name); +#ifdef CONFIG_PROC_FS + /* Remove proc debug */ + woal_debug_remove(priv); + woal_proc_remove(priv); +#endif /* CONFIG_PROC_FS */ + netif_device_detach(priv->netdev); + if (priv->netdev->reg_state == + NETREG_REGISTERED) +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) + cfg80211_unregister_netdevice( + priv->netdev); +#else + unregister_netdevice( + priv->netdev); +#endif + ref_handle->priv[i] = NULL; + ref_vir_intf++; + } + } + } + ref_handle->priv_num -= ref_vir_intf; + } #endif if (handle->mon_if) { netif_device_detach(handle->mon_if->mon_ndev); @@ -2726,7 +2768,7 @@ int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, ENTER(); - PRINTM(MMSG, "wlan: Starting AP\n"); + PRINTM(MMSG, "wlan: %s Starting AP\n", dev->name); #if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 39) /* cancel previous remain on channel to avoid firmware hang */ if (priv->phandle->remain_on_channel) { @@ -2859,7 +2901,7 @@ int woal_cfg80211_add_beacon(struct wiphy *wiphy, struct net_device *dev, goto done; } } - PRINTM(MMSG, "wlan: AP started\n"); + PRINTM(MMSG, "wlan: %s AP started\n", dev->name); done: LEAVE(); return ret; @@ -2969,7 +3011,7 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) ENTER(); - if (priv->phandle->driver_status) { + if (priv->phandle->driver_status || priv->phandle->surprise_removed) { PRINTM(MERROR, "Block woal_cfg80211_del_beacon in abnormal driver state\n"); LEAVE(); @@ -2981,7 +3023,7 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) #endif #endif priv->uap_host_based = MFALSE; - PRINTM(MMSG, "wlan: Stoping AP\n"); + PRINTM(MMSG, "wlan: %s Stopping AP\n", dev->name); #ifdef STA_SUPPORT woal_cancel_scan(priv, MOAL_IOCTL_WAIT); #endif @@ -3064,7 +3106,7 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev) priv->vlan_sta_list[i] = NULL; } #endif - PRINTM(MMSG, "wlan: AP stopped\n"); + PRINTM(MMSG, "wlan: %s AP stopped\n", dev->name); done: LEAVE(); return ret; @@ -3202,12 +3244,6 @@ int woal_cfg80211_del_station(struct wiphy *wiphy, struct net_device *dev, } #endif - if (priv->media_connected == MFALSE) { - PRINTM(MINFO, "cfg80211: Media not connected!\n"); - LEAVE(); - return 0; - } - #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) if (param) { mac_addr = param->mac; diff --git a/mxm_wifiex/wlan_src/mlinux/moal_wext.c b/mxm_wifiex/wlan_src/mlinux/moal_wext.c index 90020c5..b62e385 100644 --- a/mxm_wifiex/wlan_src/mlinux/moal_wext.c +++ b/mxm_wifiex/wlan_src/mlinux/moal_wext.c @@ -239,31 +239,6 @@ static const struct iw_priv_args woal_private_args[] = { Local Functions ********************************************************/ -/** - * @brief Compare two SSIDs - * - * @param ssid1 A pointer to ssid to compare - * @param ssid2 A pointer to ssid to compare - * - * @return 0--ssid is same, otherwise is different - */ -static t_s32 woal_ssid_cmp(mlan_802_11_ssid *ssid1, mlan_802_11_ssid *ssid2) -{ - ENTER(); - - if (!ssid1 || !ssid2) { - LEAVE(); - return -1; - } - if (ssid1->ssid_len != ssid2->ssid_len) { - LEAVE(); - return -1; - } - - LEAVE(); - return memcmp(ssid1->ssid, ssid2->ssid, ssid1->ssid_len); -} - /** * @brief Sort Channels * @@ -466,10 +441,6 @@ static int woal_set_freq(struct net_device *dev, struct iw_request_info *info, ret = -EFAULT; goto done; } - if (MLAN_STATUS_SUCCESS != - woal_change_adhoc_chan(priv, bss->param.bss_chan.channel, - MOAL_IOCTL_WAIT)) - ret = -EFAULT; done: if (status != MLAN_STATUS_PENDING) @@ -562,9 +533,6 @@ static int woal_set_bss_mode(struct net_device *dev, case IW_MODE_INFRA: bss->param.bss_mode = MLAN_BSS_MODE_INFRA; break; - case IW_MODE_ADHOC: - bss->param.bss_mode = MLAN_BSS_MODE_IBSS; - break; case IW_MODE_AUTO: bss->param.bss_mode = MLAN_BSS_MODE_AUTO; break; @@ -2984,7 +2952,6 @@ static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, mlan_scan_resp scan_resp; mlan_bss_info bss_info; BSSDescriptor_t *scan_table; - mlan_ds_get_signal rssi; t_u16 buf_size = 16 + 256 * 2; char *buf = NULL; char *ptr; @@ -3090,9 +3057,7 @@ static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, /* Add mode */ iwe.cmd = SIOCGIWMODE; - if (scan_table[i].bss_mode == MLAN_BSS_MODE_IBSS) - iwe.u.mode = IW_MODE_ADHOC; - else if (scan_table[i].bss_mode == MLAN_BSS_MODE_INFRA) + if (scan_table[i].bss_mode == MLAN_BSS_MODE_INFRA) iwe.u.mode = IW_MODE_MASTER; else iwe.u.mode = IW_MODE_AUTO; @@ -3119,18 +3084,6 @@ static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, else iwe.u.qual.noise = bss_info.bcn_nf_last; - if ((bss_info.bss_mode == MLAN_BSS_MODE_IBSS) && - !woal_ssid_cmp(&bss_info.ssid, &scan_table[i].ssid) && - bss_info.adhoc_state == ADHOC_STARTED) { - memset(&rssi, 0, sizeof(mlan_ds_get_signal)); - if (MLAN_STATUS_SUCCESS != - woal_get_signal_info(priv, MOAL_IOCTL_WAIT, - &rssi)) { - ret = -EFAULT; - break; - } - iwe.u.qual.level = rssi.data_rssi_avg; - } iwe.u.qual.qual = woal_rssi_to_quality((t_s16)(iwe.u.qual.level - 0x100)); iwe.len = IW_EV_QUAL_LEN; @@ -3170,15 +3123,6 @@ static int woal_get_scan(struct net_device *dev, struct iw_request_info *info, current_val, end_buf, &iwe, iwe.len); } - if ((bss_info.bss_mode == MLAN_BSS_MODE_IBSS) && - !woal_ssid_cmp(&bss_info.ssid, &scan_table[i].ssid) && - bss_info.adhoc_state == ADHOC_STARTED) { - iwe.u.bitrate.value = 22 * 500000; - iwe.len = IW_EV_PARAM_LEN; - current_val = IWE_STREAM_ADD_VALUE(info, current_ev, - current_val, end_buf, - &iwe, iwe.len); - } /* Check if an event is added */ if ((unsigned int)(current_val - current_ev) >= IW_EV_PARAM_LEN)