/** * @brief Process an TLV buffer for a pending BSS Join command for * both adhoc and infra networks * * The TLV command processing for a BSS join for either adhoc or * infrastructure network is performed with this function. The * capability bits are inspected for the IBSS flag and the appropriate * local routines are called to setup the necessary TLVs. * * Activate 11h functionality in the firmware if the spectrum management * capability bit is found in the network information for the BSS we are * joining. * * @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 joining the BSS * @param p11h_bss_info Pointer to the 11h BSS information for this * network that was parsed out of the scan response. * * @return Integer number of bytes appended to the TLV output * buffer (ppbuffer), MLAN_STATUS_FAILURE (-1), * or MLAN_STATUS_SUCCESS (0) */ int wlan_11h_process_join(mlan_private * priv, t_u8 ** ppbuffer, IEEEtypes_CapInfo_t * pcap_info, t_u32 channel, wlan_11h_bss_info_t * p11h_bss_info) { int ret = 0; ENTER(); if (priv->media_connected == MTRUE) { if (wlan_11h_is_active(priv) == p11h_bss_info->sensed_11h) { /* Assume DFS parameters are the same for roaming as long as the current & next APs have the same spectrum mgmt capability bit setting */ ret = MLAN_STATUS_SUCCESS; } else { /* No support for roaming between DFS/non-DFS yet */ ret = MLAN_STATUS_FAILURE; } LEAVE(); return ret; } if (p11h_bss_info->sensed_11h) { /* No use having 11h enabled without 11d enabled */ wlan_11d_enable(priv, MNULL, ENABLE_11D); wlan_11d_parse_dnld_countryinfo(priv, priv->pattempted_bss_desc); /* Activate 11h functions in firmware, turns on capability bit */ wlan_11h_activate(priv, MTRUE); pcap_info->spectrum_mgmt = 1; 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, channel, p11h_bss_info); } } else { /* Deactivate 11h functions in the firmware */ wlan_11h_activate(priv, MFALSE); pcap_info->spectrum_mgmt = 0; } LEAVE(); 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 Integer number of bytes appended to the TLV output * buffer (ppbuffer) * */ int 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; int ret = 0; ENTER(); if (wlan_11h_is_enabled(priv) && ((adapter->adhoc_start_band & BAND_A) || (adapter->adhoc_start_band & BAND_AN) ) ) { if (wlan_11d_get_state(priv) == DISABLE_11D) { /* No use having 11h enabled without 11d enabled */ wlan_11d_enable(priv, MNULL, ENABLE_11D); wlan_11d_create_dnld_countryinfo(priv, adapter->adhoc_start_band); } /* Activate 11h functions in firmware, turns on capability bit */ wlan_11h_activate(priv, MTRUE); pcap_info->spectrum_mgmt = 1; /* Set flag indicating this BSS we are starting is using 11h */ p11h_bss_info->sensed_11h = MTRUE; ret = wlan_11h_process_adhoc(priv, ppbuffer, channel, MNULL); } else { /* Deactivate 11h functions in the firmware */ wlan_11h_activate(priv, MFALSE); pcap_info->spectrum_mgmt = 0; } LEAVE(); return ret; }
/** * @brief Callback to finish 11H channel check handling. * Not to be called directly to initiate channel check. * * @param priv A pointer to mlan_private structure (cast from t_void*) * * @return MLAN_STATUS_SUCCESS/PENDING --success, otherwise fail * @sa wlan_uap_11h_channel_check_req */ static mlan_status wlan_uap_callback_11h_channel_check_req(IN t_void * priv) { mlan_status ret = MLAN_STATUS_FAILURE; mlan_private *pmpriv = (mlan_private *) priv; mlan_callbacks *pcb = (mlan_callbacks *) & pmpriv->adapter->callbacks; wlan_uap_get_info_cb_t *puap_state_chan_cb = &pmpriv->uap_state_chan_cb; /* keep copy as local variable */ pmlan_ioctl_req pioctl = puap_state_chan_cb->pioctl_req_curr; ENTER(); /* clear callback now that we're here */ puap_state_chan_cb->get_chan_callback = MNULL; /* clear early to avoid race condition */ puap_state_chan_cb->pioctl_req_curr = MNULL; /* * Check if the region and channel requires a channel availability * check. */ if ((puap_state_chan_cb->band_config & BAND_CONFIG_5GHZ) && wlan_11h_radar_detect_required(pmpriv, puap_state_chan_cb->channel) && !wlan_11h_is_channel_under_nop(pmpriv->adapter, puap_state_chan_cb->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 */ ret = wlan_11h_issue_radar_detect(pmpriv, pioctl, puap_state_chan_cb->channel); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; } else { /* No command sent with the ioctl, need manually signal completion */ pcb->moal_ioctl_complete(pmpriv->adapter->pmoal_handle, pioctl, MLAN_STATUS_FAILURE); } LEAVE(); return ret; }
/** * @brief Callback to finish 11H handling * Not to be called directly to initiate 11H setting. * * @param pmpriv A pointer to mlan_private structure (cast from t_void*) * * @return MLAN_STATUS_PENDING --success, otherwise fail * @sa wlan_uap_snmp_mib_11h */ static mlan_status wlan_uap_callback_snmp_mib_11h(IN t_void * priv) { mlan_status ret = MLAN_STATUS_SUCCESS; mlan_private *pmpriv = (mlan_private *) priv; wlan_uap_get_info_cb_t *puap_state_chan_cb = &pmpriv->uap_state_chan_cb; mlan_ds_snmp_mib *snmp; t_bool enable_11h; ENTER(); /* clear callback now that we're here */ puap_state_chan_cb->get_chan_callback = MNULL; snmp = (mlan_ds_snmp_mib *) puap_state_chan_cb->pioctl_req_curr->pbuf; enable_11h = (snmp->param.oid_value) ? MTRUE : MFALSE; if (enable_11h) { if ((puap_state_chan_cb->band_config & BAND_CONFIG_5GHZ) && wlan_11h_radar_detect_required(pmpriv, puap_state_chan_cb->channel)) { if (!wlan_11h_is_master_radar_det_active(pmpriv)) wlan_11h_config_master_radar_det(pmpriv, MTRUE); } } ret = wlan_11h_activate(pmpriv, (t_void *) puap_state_chan_cb->pioctl_req_curr, enable_11h); wlan_11h_check_update_radar_det_state(pmpriv); if (ret == MLAN_STATUS_SUCCESS) ret = MLAN_STATUS_PENDING; puap_state_chan_cb->pioctl_req_curr = MNULL; // prevent re-use LEAVE(); return ret; }