software/drivers/sd8887/src/wlan/mlan/mlan_11ac.c
/**
 *  @brief This function append the 802_11AC tlv
 *
 *  @param pmpriv       A pointer to mlan_private structure
 *  @param pbss_desc    A pointer to BSSDescriptor_t structure
 *  @param ppbuffer     A Pointer to command buffer pointer
 *
 *  @return bytes added to the buffer
 */
@brief This function append the 802_11AC tlv
@param pmpriv       A pointer to mlan_private structure
@param pbss_desc    A pointer to BSSDescriptor_t structure
@param ppbuffer     A Pointer to command buffer pointer

@return bytes added to the buffer
@brief This function append the 802_11AC tlv @param pmpriv A pointer to mlan_private structure @param pbss_desc A pointer to BSSDescriptor_t structure @param ppbuffer A Pointer to command buffer pointer @return bytes added to the buffer
int
wlan_cmd_append_11ac_tlv(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc,
			 t_u8 **ppbuffer)
{
	pmlan_adapter pmadapter = pmpriv->adapter;
	MrvlIETypes_VHTCap_t *pvht_cap;
	MrvlIETypes_OperModeNtf_t *pmrvl_oper_mode;
	t_u16 mcs_map_user = 0;
	t_u16 nss;
	int ret_len = 0;
	ENTER();
	if (ppbuffer == MNULL) {
		LEAVE();
		return 0;
	}
	if (*ppbuffer == MNULL) {
		LEAVE();
		return 0;
	}
	if (pbss_desc->pvht_cap &&
	    wlan_get_nss_vht_mcs(pbss_desc->pvht_cap->vht_cap.mcs_sets.
				 rx_mcs_map)) {
		pvht_cap = (MrvlIETypes_VHTCap_t *)*ppbuffer;
		memset(pmadapter, pvht_cap, 0, sizeof(MrvlIETypes_VHTCap_t));
		pvht_cap->header.type = wlan_cpu_to_le16(VHT_CAPABILITY);
		pvht_cap->header.len = sizeof(VHT_capa_t);
		memcpy(pmadapter,
		       (t_u8 *)pvht_cap + sizeof(MrvlIEtypesHeader_t),
		       (t_u8 *)pbss_desc->pvht_cap + sizeof(IEEEtypes_Header_t),
		       pvht_cap->header.len);
		wlan_fill_vht_cap_tlv(pmpriv, pvht_cap, pbss_desc->bss_band,
				      MTRUE);
		HEXDUMP("VHT_CAPABILITIES IE", (t_u8 *)pvht_cap,
			sizeof(MrvlIETypes_VHTCap_t));
		*ppbuffer += sizeof(MrvlIETypes_VHTCap_t);
		ret_len += sizeof(MrvlIETypes_VHTCap_t);
		pvht_cap->header.len = wlan_cpu_to_le16(pvht_cap->header.len);
	} else {
		LEAVE();
		return 0;
	}
	pmrvl_oper_mode = (MrvlIETypes_OperModeNtf_t *)*ppbuffer;
	memset(pmadapter, pmrvl_oper_mode, 0,
	       sizeof(MrvlIETypes_OperModeNtf_t));
	pmrvl_oper_mode->header.type = wlan_cpu_to_le16(OPER_MODE_NTF);
	pmrvl_oper_mode->header.len = sizeof(t_u8);
	if (pmpriv->usr_dot_11ac_opermode_bw ||
	    pmpriv->usr_dot_11ac_opermode_nss) {
		pmrvl_oper_mode->oper_mode |=
			(pmpriv->usr_dot_11ac_opermode_nss - 1) << 4;
		pmrvl_oper_mode->oper_mode |=
			pmpriv->usr_dot_11ac_opermode_bw - 1;
		if (pbss_desc->bss_band & BAND_G) {
			if (!(IS_OPER_MODE_20M(pmrvl_oper_mode->oper_mode))) {
				if (pbss_desc->pht_cap->ht_cap.
				    ht_cap_info & MBIT(1))
					SET_OPER_MODE_40M(pmrvl_oper_mode->
							  oper_mode);
				else
					SET_OPER_MODE_20M(pmrvl_oper_mode->
							  oper_mode);
			}
		}
	} else {
		SET_OPER_MODE_80M(pmrvl_oper_mode->oper_mode);
		mcs_map_user =
			GET_DEVRXMCSMAP(pmpriv->usr_dot_11ac_mcs_support);
		nss = wlan_get_nss_num_vht_mcs(mcs_map_user);
		pmrvl_oper_mode->oper_mode |= (nss - 1) << 4;
		switch (pbss_desc->curr_bandwidth) {
		case BW_20MHZ:
			SET_OPER_MODE_20M(pmrvl_oper_mode->oper_mode);
			break;
		case BW_40MHZ:
			SET_OPER_MODE_40M(pmrvl_oper_mode->oper_mode);
			break;
		case BW_80MHZ:
		default:
			break;
		}
	}
	HEXDUMP("OPER MODE NTF IE", (t_u8 *)pmrvl_oper_mode,
		sizeof(MrvlIETypes_OperModeNtf_t));
	*ppbuffer += sizeof(MrvlIETypes_OperModeNtf_t);
	ret_len += sizeof(MrvlIETypes_OperModeNtf_t);
	pmrvl_oper_mode->header.len =
		wlan_cpu_to_le16(pmrvl_oper_mode->header.len);
	LEAVE();
	return ret_len;
}
int wlan_cmd_append_11ac_tlv ( mlan_private * pmpriv , BSSDescriptor_t * pbss_desc , t_u8 * * ppbuffer ) { pmlan_adapter pmadapter = pmpriv -> adapter ; MrvlIETypes_VHTCap_t * pvht_cap ; MrvlIETypes_OperModeNtf_t * pmrvl_oper_mode ; t_u16 mcs_map_user = 0 ; t_u16 nss ; int ret_len = 0 ; ENTER ( ) ; if ( ppbuffer == MNULL ) { LEAVE ( ) ; return 0 ; } if ( * ppbuffer == MNULL ) { LEAVE ( ) ; return 0 ; } if ( pbss_desc -> pvht_cap && wlan_get_nss_vht_mcs ( pbss_desc -> pvht_cap -> vht_cap . mcs_sets . rx_mcs_map ) ) { pvht_cap = ( MrvlIETypes_VHTCap_t * ) * ppbuffer ; memset ( pmadapter , pvht_cap , 0 , sizeof ( MrvlIETypes_VHTCap_t ) ) ; pvht_cap -> header . type = wlan_cpu_to_le16 ( VHT_CAPABILITY ) ; pvht_cap -> header . len = sizeof ( VHT_capa_t ) ; memcpy ( pmadapter , ( t_u8 * ) pvht_cap + sizeof ( MrvlIEtypesHeader_t ) , ( t_u8 * ) pbss_desc -> pvht_cap + sizeof ( IEEEtypes_Header_t ) , pvht_cap -> header . len ) ; wlan_fill_vht_cap_tlv ( pmpriv , pvht_cap , pbss_desc -> bss_band , MTRUE ) ; HEXDUMP ( " " , ( t_u8 * ) pvht_cap , sizeof ( MrvlIETypes_VHTCap_t ) ) ; * ppbuffer += sizeof ( MrvlIETypes_VHTCap_t ) ; ret_len += sizeof ( MrvlIETypes_VHTCap_t ) ; pvht_cap -> header . len = wlan_cpu_to_le16 ( pvht_cap -> header . len ) ; } else { LEAVE ( ) ; return 0 ; } pmrvl_oper_mode = ( MrvlIETypes_OperModeNtf_t * ) * ppbuffer ; memset ( pmadapter , pmrvl_oper_mode , 0 , sizeof ( MrvlIETypes_OperModeNtf_t ) ) ; pmrvl_oper_mode -> header . type = wlan_cpu_to_le16 ( OPER_MODE_NTF ) ; pmrvl_oper_mode -> header . len = sizeof ( t_u8 ) ; if ( pmpriv -> usr_dot_11ac_opermode_bw || pmpriv -> usr_dot_11ac_opermode_nss ) { pmrvl_oper_mode -> oper_mode |= ( pmpriv -> usr_dot_11ac_opermode_nss - 1 ) << 4 ; pmrvl_oper_mode -> oper_mode |= pmpriv -> usr_dot_11ac_opermode_bw - 1 ; if ( pbss_desc -> bss_band & BAND_G ) { if ( ! ( IS_OPER_MODE_20M ( pmrvl_oper_mode -> oper_mode ) ) ) { if ( pbss_desc -> pht_cap -> ht_cap . ht_cap_info & MBIT ( 1 ) ) SET_OPER_MODE_40M ( pmrvl_oper_mode -> oper_mode ) ; else SET_OPER_MODE_20M ( pmrvl_oper_mode -> oper_mode ) ; } } } else { SET_OPER_MODE_80M ( pmrvl_oper_mode -> oper_mode ) ; mcs_map_user = GET_DEVRXMCSMAP ( pmpriv -> usr_dot_11ac_mcs_support ) ; nss = wlan_get_nss_num_vht_mcs ( mcs_map_user ) ; pmrvl_oper_mode -> oper_mode |= ( nss - 1 ) << 4 ; switch ( pbss_desc -> curr_bandwidth ) { case BW_20MHZ : SET_OPER_MODE_20M ( pmrvl_oper_mode -> oper_mode ) ; break ; case BW_40MHZ : SET_OPER_MODE_40M ( pmrvl_oper_mode -> oper_mode ) ; break ; case BW_80MHZ : default : break ; } } HEXDUMP ( " " , ( t_u8 * ) pmrvl_oper_mode , sizeof ( MrvlIETypes_OperModeNtf_t ) ) ; * ppbuffer += sizeof ( MrvlIETypes_OperModeNtf_t ) ; ret_len += sizeof ( MrvlIETypes_OperModeNtf_t ) ; pmrvl_oper_mode -> header . len = wlan_cpu_to_le16 ( pmrvl_oper_mode -> header . len ) ; LEAVE ( ) ; return ret_len ; }
@brief This function append the 802_11AC tlv
  @param pmpriv       A pointer to mlan_private structure
  @param pbss_desc    A pointer to BSSDescriptor_t structure
  @param ppbuffer     A Pointer to command buffer pointer
@brief This function append the 802_11AC tlv @param pmpriv A pointer to mlan_private structure @param pbss_desc A pointer to BSSDescriptor_t structure @param ppbuffer A Pointer to command buffer pointer
/* Null Checks */ /* VHT Capabilities IE */ /* Operating Mode Notification IE */ /** set default bandwidth:80M*/