software/drivers/sd8887/src/wlan/mlan/mlan_uap_cmdevent.c
/**
 *  @brief This function will search for the specific ie
 *
 *  @param priv    A pointer to mlan_private
 *  @param pevent  A pointer to event buf
 *
 *  @return	       N/A
 */
@brief This function will search for the specific ie
@param priv    A pointer to mlan_private
@param pevent  A pointer to event buf

@return            N/A
@brief This function will search for the specific ie @param priv A pointer to mlan_private @param pevent A pointer to event buf @return N / A
static void
wlan_check_uap_capability(pmlan_private priv, pmlan_buffer pevent)
{
	t_u16 tlv_type, tlv_len;
	int tlv_buf_left = pevent->data_len - BSS_START_EVENT_FIX_SIZE;
	MrvlIEtypesHeader_t *tlv =
		(MrvlIEtypesHeader_t *)(pevent->pbuf + pevent->data_offset +
					BSS_START_EVENT_FIX_SIZE);
	const t_u8 wmm_oui[4] = { 0x00, 0x50, 0xf2, 0x02 };
	IEEEtypes_WmmParameter_t wmm_param_ie;
	MrvlIEtypes_channel_band_t *pchan_info;
	t_u8 event_buf[100];
	mlan_event *event = (mlan_event *)event_buf;
	chan_band_info *pchan_band_info = (chan_band_info *) event->event_buf;
	priv->wmm_enabled = MFALSE;
	priv->pkt_fwd = MFALSE;
	priv->is_11n_enabled = MFALSE;
	ENTER();
	while (tlv_buf_left >= (int)sizeof(MrvlIEtypesHeader_t)) {
		tlv_type = wlan_le16_to_cpu(tlv->type);
		tlv_len = wlan_le16_to_cpu(tlv->len);
		if ((sizeof(MrvlIEtypesHeader_t) + tlv_len) >
		    (unsigned int)tlv_buf_left) {
			PRINTM(MERROR, "wrong tlv: tlvLen=%d, tlvBufLeft=%d\n",
			       tlv_len, tlv_buf_left);
			break;
		}
		if (tlv_type == HT_CAPABILITY) {
			DBG_HEXDUMP(MCMD_D, "HT_CAP tlv", tlv,
				    tlv_len + sizeof(MrvlIEtypesHeader_t));
			priv->is_11n_enabled = MTRUE;
		}
		if (tlv_type == VHT_CAPABILITY) {
			DBG_HEXDUMP(MCMD_D, "VHT_CAP tlv", tlv,
				    tlv_len + sizeof(MrvlIEtypesHeader_t));
			priv->is_11ac_enabled = MTRUE;
		}
		if (tlv_type == VENDOR_SPECIFIC_221) {
			if (!memcmp
			    (priv->adapter,
			     (t_u8 *)tlv + sizeof(MrvlIEtypesHeader_t), wmm_oui,
			     sizeof(wmm_oui))) {
				DBG_HEXDUMP(MCMD_D, "wmm ie tlv", tlv,
					    tlv_len +
					    sizeof(MrvlIEtypesHeader_t));
				priv->wmm_enabled = MFALSE;
				wlan_wmm_setup_ac_downgrade(priv);
				priv->wmm_enabled = MTRUE;
				memcpy(priv->adapter, &wmm_param_ie,
				       ((t_u8 *)tlv + 2),
				       sizeof(IEEEtypes_WmmParameter_t));
				wmm_param_ie.vend_hdr.len = (t_u8)tlv_len;
				wmm_param_ie.vend_hdr.element_id = WMM_IE;
				wlan_wmm_setup_queue_priorities(priv,
								&wmm_param_ie);
			}
		}
		if (tlv_type == TLV_TYPE_UAP_PKT_FWD_CTL) {
			DBG_HEXDUMP(MCMD_D, "pkt_fwd tlv", tlv,
				    tlv_len + sizeof(MrvlIEtypesHeader_t));
			priv->pkt_fwd =
				*((t_u8 *)tlv + sizeof(MrvlIEtypesHeader_t));
			PRINTM(MCMND, "pkt_fwd FW: 0x%x\n", priv->pkt_fwd);
			if (priv->pkt_fwd & PKT_FWD_FW_BIT)
				priv->pkt_fwd = MFALSE;
			else
				priv->pkt_fwd |= PKT_FWD_ENABLE_BIT;
			PRINTM(MCMND, "pkt_fwd DRV: 0x%x\n", priv->pkt_fwd);
		}
		if (tlv_type == TLV_TYPE_UAP_CHAN_BAND_CONFIG) {
			DBG_HEXDUMP(MCMD_D, "chan_band_config tlv", tlv,
				    tlv_len + sizeof(MrvlIEtypesHeader_t));
			pchan_info = (MrvlIEtypes_channel_band_t *)tlv;
			priv->uap_channel = pchan_info->channel;
			PRINTM(MCMND, "uap_channel FW: 0x%x\n",
			       priv->uap_channel);
			event->bss_index = priv->bss_index;
			event->event_id = MLAN_EVENT_ID_DRV_UAP_CHAN_INFO;
			event->event_len = sizeof(chan_band_info);
			memcpy(priv->adapter, (t_u8 *)&pchan_band_info->bandcfg,
			       (t_u8 *)&pchan_info->bandcfg, tlv_len);
			if (pchan_band_info->bandcfg.chanWidth == CHAN_BW_80MHZ)
				pchan_band_info->center_chan =
					wlan_get_center_freq_idx(priv, BAND_AAC,
								 pchan_info->
								 channel,
								 CHANNEL_BW_80MHZ);
			if (priv->adapter->ecsa_enable) {
				int ret;
				t_u8 bandwidth = BW_20MHZ;
				MrvlIEtypes_chan_bw_oper_t chan_bw_oper;
				chan_bw_oper.header.type = REGULATORY_CLASS;
				chan_bw_oper.header.len =
					sizeof(MrvlIEtypes_chan_bw_oper_t);
				chan_bw_oper.ds_chan_bw_oper.channel =
					pchan_info->channel;
				if (pchan_band_info->bandcfg.chanWidth ==
				    CHAN_BW_40MHZ)
					bandwidth = BW_40MHZ;
				else if (pchan_band_info->bandcfg.chanWidth ==
					 CHAN_BW_80MHZ)
					bandwidth = BW_80MHZ;
				chan_bw_oper.ds_chan_bw_oper.bandwidth =
					bandwidth;
				ret = wlan_prepare_cmd(priv,
						       HOST_CMD_APCMD_SYS_CONFIGURE,
						       HostCmd_ACT_GEN_SET, 0,
						       MNULL, &chan_bw_oper);
				if (ret != MLAN_STATUS_SUCCESS &&
				    ret != MLAN_STATUS_PENDING) {
					PRINTM(MERROR,
					       "%s(): Could not set supported operating class IE for priv=%p [priv_bss_idx=%d]!\n",
					       __func__, priv, priv->bss_index);
				}
			}
		}
		tlv_buf_left -= (sizeof(MrvlIEtypesHeader_t) + tlv_len);
		tlv = (MrvlIEtypesHeader_t *)((t_u8 *)tlv + tlv_len +
					      sizeof(MrvlIEtypesHeader_t));
	}
	if (priv->wmm_enabled == MFALSE) {
		wlan_wmm_setup_queues(priv);
	}
	if (event->event_id == MLAN_EVENT_ID_DRV_UAP_CHAN_INFO) {
		pchan_band_info->is_11n_enabled = priv->is_11n_enabled;
		wlan_recv_event(priv, MLAN_EVENT_ID_DRV_UAP_CHAN_INFO, event);
	}
	LEAVE();
}
static void wlan_check_uap_capability ( pmlan_private priv , pmlan_buffer pevent ) { t_u16 tlv_type , tlv_len ; int tlv_buf_left = pevent -> data_len - BSS_START_EVENT_FIX_SIZE ; MrvlIEtypesHeader_t * tlv = ( MrvlIEtypesHeader_t * ) ( pevent -> pbuf + pevent -> data_offset + BSS_START_EVENT_FIX_SIZE ) ; const t_u8 wmm_oui [ 4 ] = { 0x00 , 0x50 , 0xf2 , 0x02 } ; IEEEtypes_WmmParameter_t wmm_param_ie ; MrvlIEtypes_channel_band_t * pchan_info ; t_u8 event_buf [ 100 ] ; mlan_event * event = ( mlan_event * ) event_buf ; chan_band_info * pchan_band_info = ( chan_band_info * ) event -> event_buf ; priv -> wmm_enabled = MFALSE ; priv -> pkt_fwd = MFALSE ; priv -> is_11n_enabled = MFALSE ; ENTER ( ) ; while ( tlv_buf_left >= ( int ) sizeof ( MrvlIEtypesHeader_t ) ) { tlv_type = wlan_le16_to_cpu ( tlv -> type ) ; tlv_len = wlan_le16_to_cpu ( tlv -> len ) ; if ( ( sizeof ( MrvlIEtypesHeader_t ) + tlv_len ) > ( unsigned int ) tlv_buf_left ) { PRINTM ( MERROR , " \n " , tlv_len , tlv_buf_left ) ; break ; } if ( tlv_type == HT_CAPABILITY ) { DBG_HEXDUMP ( MCMD_D , " " , tlv , tlv_len + sizeof ( MrvlIEtypesHeader_t ) ) ; priv -> is_11n_enabled = MTRUE ; } if ( tlv_type == VHT_CAPABILITY ) { DBG_HEXDUMP ( MCMD_D , " " , tlv , tlv_len + sizeof ( MrvlIEtypesHeader_t ) ) ; priv -> is_11ac_enabled = MTRUE ; } if ( tlv_type == VENDOR_SPECIFIC_221 ) { if ( ! memcmp ( priv -> adapter , ( t_u8 * ) tlv + sizeof ( MrvlIEtypesHeader_t ) , wmm_oui , sizeof ( wmm_oui ) ) ) { DBG_HEXDUMP ( MCMD_D , " " , tlv , tlv_len + sizeof ( MrvlIEtypesHeader_t ) ) ; priv -> wmm_enabled = MFALSE ; wlan_wmm_setup_ac_downgrade ( priv ) ; priv -> wmm_enabled = MTRUE ; memcpy ( priv -> adapter , & wmm_param_ie , ( ( t_u8 * ) tlv + 2 ) , sizeof ( IEEEtypes_WmmParameter_t ) ) ; wmm_param_ie . vend_hdr . len = ( t_u8 ) tlv_len ; wmm_param_ie . vend_hdr . element_id = WMM_IE ; wlan_wmm_setup_queue_priorities ( priv , & wmm_param_ie ) ; } } if ( tlv_type == TLV_TYPE_UAP_PKT_FWD_CTL ) { DBG_HEXDUMP ( MCMD_D , " " , tlv , tlv_len + sizeof ( MrvlIEtypesHeader_t ) ) ; priv -> pkt_fwd = * ( ( t_u8 * ) tlv + sizeof ( MrvlIEtypesHeader_t ) ) ; PRINTM ( MCMND , " \n " , priv -> pkt_fwd ) ; if ( priv -> pkt_fwd & PKT_FWD_FW_BIT ) priv -> pkt_fwd = MFALSE ; else priv -> pkt_fwd |= PKT_FWD_ENABLE_BIT ; PRINTM ( MCMND , " \n " , priv -> pkt_fwd ) ; } if ( tlv_type == TLV_TYPE_UAP_CHAN_BAND_CONFIG ) { DBG_HEXDUMP ( MCMD_D , " " , tlv , tlv_len + sizeof ( MrvlIEtypesHeader_t ) ) ; pchan_info = ( MrvlIEtypes_channel_band_t * ) tlv ; priv -> uap_channel = pchan_info -> channel ; PRINTM ( MCMND , " \n " , priv -> uap_channel ) ; event -> bss_index = priv -> bss_index ; event -> event_id = MLAN_EVENT_ID_DRV_UAP_CHAN_INFO ; event -> event_len = sizeof ( chan_band_info ) ; memcpy ( priv -> adapter , ( t_u8 * ) & pchan_band_info -> bandcfg , ( t_u8 * ) & pchan_info -> bandcfg , tlv_len ) ; if ( pchan_band_info -> bandcfg . chanWidth == CHAN_BW_80MHZ ) pchan_band_info -> center_chan = wlan_get_center_freq_idx ( priv , BAND_AAC , pchan_info -> channel , CHANNEL_BW_80MHZ ) ; if ( priv -> adapter -> ecsa_enable ) { int ret ; t_u8 bandwidth = BW_20MHZ ; MrvlIEtypes_chan_bw_oper_t chan_bw_oper ; chan_bw_oper . header . type = REGULATORY_CLASS ; chan_bw_oper . header . len = sizeof ( MrvlIEtypes_chan_bw_oper_t ) ; chan_bw_oper . ds_chan_bw_oper . channel = pchan_info -> channel ; if ( pchan_band_info -> bandcfg . chanWidth == CHAN_BW_40MHZ ) bandwidth = BW_40MHZ ; else if ( pchan_band_info -> bandcfg . chanWidth == CHAN_BW_80MHZ ) bandwidth = BW_80MHZ ; chan_bw_oper . ds_chan_bw_oper . bandwidth = bandwidth ; ret = wlan_prepare_cmd ( priv , HOST_CMD_APCMD_SYS_CONFIGURE , HostCmd_ACT_GEN_SET , 0 , MNULL , & chan_bw_oper ) ; if ( ret != MLAN_STATUS_SUCCESS && ret != MLAN_STATUS_PENDING ) { PRINTM ( MERROR , " \n " , __func__ , priv , priv -> bss_index ) ; } } } tlv_buf_left -= ( sizeof ( MrvlIEtypesHeader_t ) + tlv_len ) ; tlv = ( MrvlIEtypesHeader_t * ) ( ( t_u8 * ) tlv + tlv_len + sizeof ( MrvlIEtypesHeader_t ) ) ; } if ( priv -> wmm_enabled == MFALSE ) { wlan_wmm_setup_queues ( priv ) ; } if ( event -> event_id == MLAN_EVENT_ID_DRV_UAP_CHAN_INFO ) { pchan_band_info -> is_11n_enabled = priv -> is_11n_enabled ; wlan_recv_event ( priv , MLAN_EVENT_ID_DRV_UAP_CHAN_INFO , event ) ; } LEAVE ( ) ; }
@brief This function will search for the specific ie
  @param priv    A pointer to mlan_private
  @param pevent  A pointer to event buf
@brief This function will search for the specific ie @param priv A pointer to mlan_private @param pevent A pointer to event buf
/* Since WMM is not enabled, setup the queues with the defaults */