software/drivers/sd8887/src/wlan/mlan/mlan_11ac.c
/**
 *  @brief This function converts the 2-bit MCS map to the highest long GI
 *  VHT PPDU data rate
 *
 *  @param priv         A pointer to mlan_private structure
 *  @param bands        Supported bands
 *  @param mcs_map      2-bit MCS map
 *
 *  @return             the max data rate for long GI
 */
@brief This function converts the 2-bit MCS map to the highest long GI
VHT PPDU data rate

@param priv         A pointer to mlan_private structure
@param bands        Supported bands
@param mcs_map      2-bit MCS map

@return             the max data rate for long GI
@brief This function converts the 2 - bit MCS map to the highest long GI VHT PPDU data rate @param priv A pointer to mlan_private structure @param bands Supported bands @param mcs_map 2 - bit MCS map @return the max data rate for long GI
t_u16
wlan_convert_mcsmap_to_maxrate(mlan_private *priv, t_u8 bands, t_u16 mcs_map)
{
	t_u8 i;
	t_u8 nss;
	t_u8 max_mcs;
	t_u16 max_rate = 0;
	t_u32 usr_vht_cap_info = 0;
	t_u32 usr_dot_11n_dev_cap;
	t_u16 max_rate_lgi_20MHZ[8][3] = {
		{0x41, 0x4E, 0x0},	
		{0x82, 0x9C, 0x0},	
		{0xC3, 0xEA, 0x104},	
		{0x104, 0x138, 0x0},	
		{0x145, 0x186, 0x0},	
		{0x186, 0x1D4, 0x208},	
		{0x1C7, 0x222, 0x0},	
		{0x208, 0x270, 0x0}	
	};
	t_u16 max_rate_lgi_40MHZ[8][3] = {
		{0x87, 0xA2, 0xB4},	
		{0x10E, 0x144, 0x168},	
		{0x195, 0x1E6, 0x21C},	
		{0x21C, 0x288, 0x2D0},	
		{0x2A3, 0x32A, 0x384},	
		{0x32A, 0x3CC, 0x438},	
		{0x3B1, 0x46E, 0x4EC},	
		{0x438, 0x510, 0x5A0}	
	};
	t_u16 max_rate_lgi_80MHZ[8][3] = {
		{0x124, 0x15F, 0x186},	
		{0x249, 0x2BE, 0x30C},	
		{0x36D, 0x41D, 0x492},	
		{0x492, 0x57C, 0x618},	
		{0x5B6, 0x6DB, 0x79E},	
		{0x6DB, 0x83A, 0x0},	
		{0x7FF, 0x999, 0xAAA},	
		{0x924, 0xAF8, 0xC30}	
	};
	t_u16 max_rate_lgi_160MHZ[8][3] = {
		{0x249, 0x2BE, 0x30C},	
		{0x492, 0x57C, 0x618},	
		{0x6DB, 0x83A, 0x0},	
		{0x924, 0xAF8, 0xC30},	
		{0xB6D, 0xDB6, 0xF3C},	
		{0xDB6, 0x1074, 0x1248},	
		{0xFFF, 0x1332, 0x1554},	
		{0x1248, 0x15F0, 0x1860}	
	};
	if (bands & BAND_AAC) {
		usr_vht_cap_info = priv->usr_dot_11ac_dev_cap_a;
		usr_dot_11n_dev_cap = priv->usr_dot_11n_dev_cap_a;
	} else {
		usr_vht_cap_info = priv->usr_dot_11ac_dev_cap_bg;
		usr_dot_11n_dev_cap = priv->usr_dot_11n_dev_cap_bg;
	}
	nss = 0;
	for (i = 0; i < 8; i++) {
		max_mcs = (mcs_map >> (2 * i)) & 0x3;
		if (max_mcs < 3)
			nss = i;
	}
	max_mcs = (mcs_map >> (2 * nss)) & 0x3;
	if (max_mcs >= 3)
		max_mcs = 2;
	if (GET_VHTCAP_CHWDSET(usr_vht_cap_info)) {
		max_rate = max_rate_lgi_160MHZ[nss][max_mcs];
		if (max_mcs >= 1 && max_rate == 0)
			max_rate = max_rate_lgi_160MHZ[nss][max_mcs - 1];
	} else {
		if (priv->usr_dot_11ac_bw == BW_FOLLOW_VHTCAP) {
			max_rate = max_rate_lgi_80MHZ[nss][max_mcs];
			if (max_mcs >= 1 && max_rate == 0)
				max_rate = max_rate_lgi_80MHZ[nss][max_mcs - 1];
		} else {
			if (ISSUPP_CHANWIDTH40(usr_dot_11n_dev_cap)) {
				max_rate = max_rate_lgi_40MHZ[nss][max_mcs];
			} else {
				max_rate = max_rate_lgi_20MHZ[nss][max_mcs];
				if (max_mcs >= 1 && max_rate == 0)
					max_rate =
						max_rate_lgi_20MHZ[nss][max_mcs
									- 1];
			}
		}
	}
	PRINTM(MCMND, "max_rate=%dM\n", max_rate);
	return max_rate;
}
t_u16 wlan_convert_mcsmap_to_maxrate ( mlan_private * priv , t_u8 bands , t_u16 mcs_map ) { t_u8 i ; t_u8 nss ; t_u8 max_mcs ; t_u16 max_rate = 0 ; t_u32 usr_vht_cap_info = 0 ; t_u32 usr_dot_11n_dev_cap ; t_u16 max_rate_lgi_20MHZ [ 8 ] [ 3 ] = { { 0x41 , 0x4E , 0x0 } , { 0x82 , 0x9C , 0x0 } , { 0xC3 , 0xEA , 0x104 } , { 0x104 , 0x138 , 0x0 } , { 0x145 , 0x186 , 0x0 } , { 0x186 , 0x1D4 , 0x208 } , { 0x1C7 , 0x222 , 0x0 } , { 0x208 , 0x270 , 0x0 } } ; t_u16 max_rate_lgi_40MHZ [ 8 ] [ 3 ] = { { 0x87 , 0xA2 , 0xB4 } , { 0x10E , 0x144 , 0x168 } , { 0x195 , 0x1E6 , 0x21C } , { 0x21C , 0x288 , 0x2D0 } , { 0x2A3 , 0x32A , 0x384 } , { 0x32A , 0x3CC , 0x438 } , { 0x3B1 , 0x46E , 0x4EC } , { 0x438 , 0x510 , 0x5A0 } } ; t_u16 max_rate_lgi_80MHZ [ 8 ] [ 3 ] = { { 0x124 , 0x15F , 0x186 } , { 0x249 , 0x2BE , 0x30C } , { 0x36D , 0x41D , 0x492 } , { 0x492 , 0x57C , 0x618 } , { 0x5B6 , 0x6DB , 0x79E } , { 0x6DB , 0x83A , 0x0 } , { 0x7FF , 0x999 , 0xAAA } , { 0x924 , 0xAF8 , 0xC30 } } ; t_u16 max_rate_lgi_160MHZ [ 8 ] [ 3 ] = { { 0x249 , 0x2BE , 0x30C } , { 0x492 , 0x57C , 0x618 } , { 0x6DB , 0x83A , 0x0 } , { 0x924 , 0xAF8 , 0xC30 } , { 0xB6D , 0xDB6 , 0xF3C } , { 0xDB6 , 0x1074 , 0x1248 } , { 0xFFF , 0x1332 , 0x1554 } , { 0x1248 , 0x15F0 , 0x1860 } } ; if ( bands & BAND_AAC ) { usr_vht_cap_info = priv -> usr_dot_11ac_dev_cap_a ; usr_dot_11n_dev_cap = priv -> usr_dot_11n_dev_cap_a ; } else { usr_vht_cap_info = priv -> usr_dot_11ac_dev_cap_bg ; usr_dot_11n_dev_cap = priv -> usr_dot_11n_dev_cap_bg ; } nss = 0 ; for ( i = 0 ; i < 8 ; i ++ ) { max_mcs = ( mcs_map >> ( 2 * i ) ) & 0x3 ; if ( max_mcs < 3 ) nss = i ; } max_mcs = ( mcs_map >> ( 2 * nss ) ) & 0x3 ; if ( max_mcs >= 3 ) max_mcs = 2 ; if ( GET_VHTCAP_CHWDSET ( usr_vht_cap_info ) ) { max_rate = max_rate_lgi_160MHZ [ nss ] [ max_mcs ] ; if ( max_mcs >= 1 && max_rate == 0 ) max_rate = max_rate_lgi_160MHZ [ nss ] [ max_mcs - 1 ] ; } else { if ( priv -> usr_dot_11ac_bw == BW_FOLLOW_VHTCAP ) { max_rate = max_rate_lgi_80MHZ [ nss ] [ max_mcs ] ; if ( max_mcs >= 1 && max_rate == 0 ) max_rate = max_rate_lgi_80MHZ [ nss ] [ max_mcs - 1 ] ; } else { if ( ISSUPP_CHANWIDTH40 ( usr_dot_11n_dev_cap ) ) { max_rate = max_rate_lgi_40MHZ [ nss ] [ max_mcs ] ; } else { max_rate = max_rate_lgi_20MHZ [ nss ] [ max_mcs ] ; if ( max_mcs >= 1 && max_rate == 0 ) max_rate = max_rate_lgi_20MHZ [ nss ] [ max_mcs - 1 ] ; } } } PRINTM ( MCMND , " \n " , max_rate ) ; return max_rate ; }
@brief This function converts the 2-bit MCS map to the highest long GI
  VHT PPDU data rate
@brief This function converts the 2 - bit MCS map to the highest long GI VHT PPDU data rate
/* tables of the MCS map to the highest data rate (in Mbps)
	 * supported for long GI */ /* NSS = 1 */ /* NSS = 2 */ /* NSS = 3 */ /* NSS = 4 */ /* NSS = 5 */ /* NSS = 6 */ /* NSS = 7 */ /* NSS = 8 */ /* NSS = 1 */ /* NSS = 2 */ /* NSS = 3 */ /* NSS = 4 */ /* NSS = 5 */ /* NSS = 6 */ /* NSS = 7 */ /* NSS = 8 */ /* NSS = 1 */ /* NSS = 2 */ /* NSS = 3 */ /* NSS = 4 */ /* NSS = 5 */ /* NSS = 6 */ /* NSS = 7 */ /* NSS = 8 */ /* NSS = 1 */ /* NSS = 2 */ /* NSS = 3 */ /* NSS = 4 */ /* NSS = 5 */ /* NSS = 6 */ /* NSS = 7 */ /* NSS = 8 */ /* find the max NSS supported */ /* if max_mcs is 3, nss must be 0 (SS = 1). Thus, max mcs is MCS 9 */ /* support 160 MHz */ /* MCS9 is not supported in NSS6 */ /* MCS9 is not supported in NSS3 */ /* MCS9 is not supported in NSS1/2/4/5/7/8 */