software/drivers/sd8887/src/wlan/mlan/mlan_11h.c
/**
 *  @brief Perform a radar measurement if required on given channel
 *
 *  Check to see if the provided channel requires a channel availability
 *    check (60 second radar detection measurement).  If required, perform
 *    measurement, stalling calling thread until the measurement completes
 *    and then report result.
 *
 *  Used when starting an adhoc or AP network.
 *
 *  @param priv         Private driver information structure
 *  @param pioctl_req   Pointer to IOCTL request buffer
 *  @param channel      Channel on which to perform radar measurement
 *  @param bandcfg      Channel Band config structure
 *
 *  @return
 *    - MTRUE  if radar measurement request was successfully issued
 *    - MFALSE if radar detection is not required
 *    - < 0 for error during radar detection (if performed)
 *
 *  @sa wlan_11h_radar_detect_required
 */
@brief Perform a radar measurement if required on given channel
Check to see if the provided channel requires a channel availability
check (60 second radar detection measurement).  If required, perform
measurement, stalling calling thread until the measurement completes
and then report result.

Used when starting an adhoc or AP network.

@param priv         Private driver information structure
@param pioctl_req   Pointer to IOCTL request buffer
@param channel      Channel on which to perform radar measurement
@param bandcfg      Channel Band config structure

@return
- MTRUE  if radar measurement request was successfully issued
- MFALSE if radar detection is not required
- < 0 for error during radar detection (if performed)


@brief Perform a radar measurement if required on given channel Check to see if the provided channel requires a channel availability check ( 60 second radar detection measurement ) . If required perform measurement stalling calling thread until the measurement completes and then report result . Used when starting an adhoc or AP network . @param priv Private driver information structure @param pioctl_req Pointer to IOCTL request buffer @param channel Channel on which to perform radar measurement @param bandcfg Channel Band config structure @return - MTRUE if radar measurement request was successfully issued - MFALSE if radar detection is not required - < 0 for error during radar detection ( if performed )
t_s32
wlan_11h_issue_radar_detect(mlan_private *priv,
			    pmlan_ioctl_req pioctl_req,
			    t_u8 channel, Band_Config_t bandcfg)
{
	t_s32 ret;
	HostCmd_DS_CHAN_RPT_REQ chan_rpt_req;
	mlan_adapter *pmadapter = priv->adapter;
	mlan_ds_11h_cfg *ds_11hcfg = MNULL;
	ENTER();
	ret = wlan_11h_radar_detect_required(priv, channel);
	if (ret) {
		memset(priv->adapter, &chan_rpt_req, 0x00,
		       sizeof(chan_rpt_req));
		chan_rpt_req.chan_desc.startFreq = START_FREQ_11A_BAND;
		if (pmadapter->chanrpt_param_bandcfg) {
			chan_rpt_req.chan_desc.bandcfg = bandcfg;
		} else {
			*((t_u8 *)&chan_rpt_req.chan_desc.bandcfg) =
				(t_u8)bandcfg.chanWidth;
		}
		chan_rpt_req.chan_desc.chanNum = channel;
		chan_rpt_req.millisec_dwell_time =
			WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION;
		if (wlan_is_etsi_country(pmadapter, pmadapter->country_code)) {
			if (channel == 120 || channel == 124 || channel == 128) {
				chan_rpt_req.millisec_dwell_time =
					WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION *
					10;
			}
			if (channel == 116 &&
			    ((bandcfg.chanWidth == CHAN_BW_40MHZ)
			     || (bandcfg.chanWidth == CHAN_BW_80MHZ)
			    )) {
				chan_rpt_req.millisec_dwell_time =
					WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION *
					10;
			}
		}
		if (pioctl_req) {
			ds_11hcfg = (mlan_ds_11h_cfg *)pioctl_req->pbuf;
			if (!ds_11hcfg->param.chan_rpt_req.host_based) {
				ds_11hcfg->param.chan_rpt_req.
					millisec_dwell_time =
					chan_rpt_req.millisec_dwell_time;
			}
		}
#ifdef DFS_TESTING_SUPPORT
		if (priv->adapter->dfs_test_params.user_cac_period_msec) {
			PRINTM(MCMD_D,
			       "dfs_testing - user CAC period=%d (msec)\n",
			       priv->adapter->dfs_test_params.
			       user_cac_period_msec);
			chan_rpt_req.millisec_dwell_time =
				priv->adapter->dfs_test_params.
				user_cac_period_msec;
		}
#endif
		PRINTM(MCMND, "11h: issuing DFS Radar check for channel=%d."
		       "  Please wait for response...\n", channel);
		ret = wlan_prepare_cmd(priv, HostCmd_CMD_CHAN_REPORT_REQUEST,
				       HostCmd_ACT_GEN_SET, 0,
				       (t_void *)pioctl_req,
				       (t_void *)&chan_rpt_req);
	}
	LEAVE();
	return ret;
}
t_s32 wlan_11h_issue_radar_detect ( mlan_private * priv , pmlan_ioctl_req pioctl_req , t_u8 channel , Band_Config_t bandcfg ) { t_s32 ret ; HostCmd_DS_CHAN_RPT_REQ chan_rpt_req ; mlan_adapter * pmadapter = priv -> adapter ; mlan_ds_11h_cfg * ds_11hcfg = MNULL ; ENTER ( ) ; ret = wlan_11h_radar_detect_required ( priv , channel ) ; if ( ret ) { memset ( priv -> adapter , & chan_rpt_req , 0x00 , sizeof ( chan_rpt_req ) ) ; chan_rpt_req . chan_desc . startFreq = START_FREQ_11A_BAND ; if ( pmadapter -> chanrpt_param_bandcfg ) { chan_rpt_req . chan_desc . bandcfg = bandcfg ; } else { * ( ( t_u8 * ) & chan_rpt_req . chan_desc . bandcfg ) = ( t_u8 ) bandcfg . chanWidth ; } chan_rpt_req . chan_desc . chanNum = channel ; chan_rpt_req . millisec_dwell_time = WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION ; if ( wlan_is_etsi_country ( pmadapter , pmadapter -> country_code ) ) { if ( channel == 120 || channel == 124 || channel == 128 ) { chan_rpt_req . millisec_dwell_time = WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION * 10 ; } if ( channel == 116 && ( ( bandcfg . chanWidth == CHAN_BW_40MHZ ) || ( bandcfg . chanWidth == CHAN_BW_80MHZ ) ) ) { chan_rpt_req . millisec_dwell_time = WLAN_11H_CHANNEL_AVAIL_CHECK_DURATION * 10 ; } } if ( pioctl_req ) { ds_11hcfg = ( mlan_ds_11h_cfg * ) pioctl_req -> pbuf ; if ( ! ds_11hcfg -> param . chan_rpt_req . host_based ) { ds_11hcfg -> param . chan_rpt_req . millisec_dwell_time = chan_rpt_req . millisec_dwell_time ; } } #ifdef DFS_TESTING_SUPPORT if ( priv -> adapter -> dfs_test_params . user_cac_period_msec ) { PRINTM ( MCMD_D , " \n " , priv -> adapter -> dfs_test_params . user_cac_period_msec ) ; chan_rpt_req . millisec_dwell_time = priv -> adapter -> dfs_test_params . user_cac_period_msec ; } #endif PRINTM ( MCMND , " " " \n " , channel ) ; ret = wlan_prepare_cmd ( priv , HostCmd_CMD_CHAN_REPORT_REQUEST , HostCmd_ACT_GEN_SET , 0 , ( t_void * ) pioctl_req , ( t_void * ) & chan_rpt_req ) ; } LEAVE ( ) ; return ret ; }
@brief Perform a radar measurement if required on given channel
  Check to see if the provided channel requires a channel availability
    check (60 second radar detection measurement).
@brief Perform a radar measurement if required on given channel Check to see if the provided channel requires a channel availability check ( 60 second radar detection measurement ) .
/* Prepare and issue CMD_CHAN_RPT_REQ. */ /* ETSI new requirement for ch 120, 124 and 128 */ /* Save dwell time information to be used later in moal */