software/drivers/sd8887/src/wlan/mlan/mlan_11h.c
/**
 *  @brief Driver handling for CHANNEL_REPORT_RDY event
 *  This event will have the channel report data appended.
 *
 *  @param priv     Pointer to mlan_private
 *  @param pevent   Pointer to mlan_event
 *
 *  @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief Driver handling for CHANNEL_REPORT_RDY event
This event will have the channel report data appended.

@param priv     Pointer to mlan_private
@param pevent   Pointer to mlan_event


@brief Driver handling for CHANNEL_REPORT_RDY event This event will have the channel report data appended . @param priv Pointer to mlan_private @param pevent Pointer to mlan_event
mlan_status
wlan_11h_handle_event_chanrpt_ready(mlan_private *priv, mlan_event *pevent)
{
	mlan_status ret = MLAN_STATUS_SUCCESS;
	HostCmd_DS_CHAN_RPT_RSP *pchan_rpt_rsp;
	MrvlIEtypes_Data_t *ptlv;
	MeasRptBasicMap_t *pmeas_rpt_basic;
	t_u8 *pbuffer;
	t_s32 evt_len;
	t_u16 tlv_len;
	t_u32 sec, usec;
	wlan_dfs_device_state_t *pstate_dfs = &priv->adapter->state_dfs;
	ENTER();
	pchan_rpt_rsp = (HostCmd_DS_CHAN_RPT_RSP *)&pevent->event_buf;
	DBG_HEXDUMP(MCMD_D, "11h: Event ChanRptReady (HostCmd_DS_CHAN_RPT_RSP)",
		    (t_u8 *)pchan_rpt_rsp, pevent->event_len);
	if (wlan_le32_to_cpu(pchan_rpt_rsp->cmd_result) ==
	    MLAN_CMD_RESULT_SUCCESS) {
		pbuffer = (t_u8 *)&pchan_rpt_rsp->tlv_buffer;
		evt_len = pevent->event_len;
		evt_len -=
			sizeof(HostCmd_DS_CHAN_RPT_RSP) -
			sizeof(pchan_rpt_rsp->tlv_buffer);
		while (evt_len >= sizeof(MrvlIEtypesHeader_t)) {
			ptlv = (MrvlIEtypes_Data_t *)pbuffer;
			tlv_len = wlan_le16_to_cpu(ptlv->header.len);
			switch (wlan_le16_to_cpu(ptlv->header.type)) {
			case TLV_TYPE_CHANRPT_11H_BASIC:
				pmeas_rpt_basic =
					(MeasRptBasicMap_t *)&ptlv->data;
				if (pmeas_rpt_basic->radar) {
					pstate_dfs->dfs_radar_found = MTRUE;
					PRINTM(MMSG,
					       "RADAR Detected on channel %d!\n",
					       pstate_dfs->dfs_check_channel);
					wlan_11h_add_dfs_timestamp(priv->
								   adapter,
								   DFS_TS_REPR_NOP_START,
								   pstate_dfs->
								   dfs_check_channel);
				}
				break;
			default:
				break;
			}
			pbuffer += (tlv_len + sizeof(ptlv->header));
			evt_len -= (tlv_len + sizeof(ptlv->header));
			evt_len = (evt_len > 0) ? evt_len : 0;
		}
	} else {
		ret = MLAN_STATUS_FAILURE;
	}
	priv->adapter->callbacks.moal_get_system_time(priv->adapter->
						      pmoal_handle, &sec,
						      &usec);
	pstate_dfs->dfs_report_time_sec = sec;
	pstate_dfs->dfs_check_pending = MFALSE;
	pstate_dfs->dfs_check_priv = MNULL;
	LEAVE();
	return ret;
}
mlan_status wlan_11h_handle_event_chanrpt_ready ( mlan_private * priv , mlan_event * pevent ) { mlan_status ret = MLAN_STATUS_SUCCESS ; HostCmd_DS_CHAN_RPT_RSP * pchan_rpt_rsp ; MrvlIEtypes_Data_t * ptlv ; MeasRptBasicMap_t * pmeas_rpt_basic ; t_u8 * pbuffer ; t_s32 evt_len ; t_u16 tlv_len ; t_u32 sec , usec ; wlan_dfs_device_state_t * pstate_dfs = & priv -> adapter -> state_dfs ; ENTER ( ) ; pchan_rpt_rsp = ( HostCmd_DS_CHAN_RPT_RSP * ) & pevent -> event_buf ; DBG_HEXDUMP ( MCMD_D , " " , ( t_u8 * ) pchan_rpt_rsp , pevent -> event_len ) ; if ( wlan_le32_to_cpu ( pchan_rpt_rsp -> cmd_result ) == MLAN_CMD_RESULT_SUCCESS ) { pbuffer = ( t_u8 * ) & pchan_rpt_rsp -> tlv_buffer ; evt_len = pevent -> event_len ; evt_len -= sizeof ( HostCmd_DS_CHAN_RPT_RSP ) - sizeof ( pchan_rpt_rsp -> tlv_buffer ) ; while ( evt_len >= sizeof ( MrvlIEtypesHeader_t ) ) { ptlv = ( MrvlIEtypes_Data_t * ) pbuffer ; tlv_len = wlan_le16_to_cpu ( ptlv -> header . len ) ; switch ( wlan_le16_to_cpu ( ptlv -> header . type ) ) { case TLV_TYPE_CHANRPT_11H_BASIC : pmeas_rpt_basic = ( MeasRptBasicMap_t * ) & ptlv -> data ; if ( pmeas_rpt_basic -> radar ) { pstate_dfs -> dfs_radar_found = MTRUE ; PRINTM ( MMSG , " \n " , pstate_dfs -> dfs_check_channel ) ; wlan_11h_add_dfs_timestamp ( priv -> adapter , DFS_TS_REPR_NOP_START , pstate_dfs -> dfs_check_channel ) ; } break ; default : break ; } pbuffer += ( tlv_len + sizeof ( ptlv -> header ) ) ; evt_len -= ( tlv_len + sizeof ( ptlv -> header ) ) ; evt_len = ( evt_len > 0 ) ? evt_len : 0 ; } } else { ret = MLAN_STATUS_FAILURE ; } priv -> adapter -> callbacks . moal_get_system_time ( priv -> adapter -> pmoal_handle , & sec , & usec ) ; pstate_dfs -> dfs_report_time_sec = sec ; pstate_dfs -> dfs_check_pending = MFALSE ; pstate_dfs -> dfs_check_priv = MNULL ; LEAVE ( ) ; return ret ; }
@brief Driver handling for CHANNEL_REPORT_RDY event
  This event will have the channel report data appended.
@brief Driver handling for CHANNEL_REPORT_RDY event This event will have the channel report data appended .
/* add channel to NOP list */ /* Update DFS structure. */