software/drivers/sd8887/src/wlan/mlinux/moal_uap_cfg80211.c
/**
 * @brief Set txq parameters

 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 * @param params		  A pointer to ieee80211_txq_params structure
 *
 * @return                0 -- success, otherwise fail
 */
@brief Set txq parameters
@param wiphy           A pointer to wiphy structure
@param dev             A pointer to net_device structure
@param params                  A pointer to ieee80211_txq_params structure

@return                0 -- success, otherwise fail
@brief Set txq parameters @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure @param params A pointer to ieee80211_txq_params structure @return 0 -- success otherwise fail
int
woal_cfg80211_set_txq_params(struct wiphy *wiphy, struct net_device *dev,
			     struct ieee80211_txq_params *params)
{
	int ret = 0;
	u8 ac = 0;
	wmm_parameter_t ap_wmm_para;
	moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
	ENTER();
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
	switch (params->ac) {
	case NL80211_AC_VO:
		ac = 3;
		break;
	case NL80211_AC_VI:
		ac = 2;
		break;
	case NL80211_AC_BK:
		ac = 1;
		break;
	case NL80211_AC_BE:
		ac = 0;
		break;
	default:
		break;
	}
#else
	switch (params->queue) {
	case NL80211_TXQ_Q_VO:
		ac = 3;
		break;
	case NL80211_TXQ_Q_VI:
		ac = 2;
		break;
	case NL80211_TXQ_Q_BK:
		ac = 1;
		break;
	case NL80211_TXQ_Q_BE:
		ac = 0;
		break;
	default:
		break;
	}
#endif
	PRINTM(MMSG, "Set AC=%d, txop=%d cwmin=%d, cwmax=%d aifs=%d\n", ac,
	       params->txop, params->cwmin, params->cwmax, params->aifs);
	memset(&ap_wmm_para, 0, sizeof(wmm_parameter_t));
	if (MLAN_STATUS_SUCCESS !=
	    woal_set_get_ap_wmm_para(priv, MLAN_ACT_GET, &ap_wmm_para)) {
		PRINTM(MERROR, "wlan: We don't support AP WMM parameter\n");
		LEAVE();
		return ret;
	}
	ap_wmm_para.ac_params[ac].aci_aifsn.aifsn = params->aifs;
	ap_wmm_para.ac_params[ac].ecw.ecw_max = ilog2(params->cwmax + 1);
	ap_wmm_para.ac_params[ac].ecw.ecw_min = ilog2(params->cwmin + 1);
	ap_wmm_para.ac_params[ac].tx_op_limit = params->txop;
	if (MLAN_STATUS_SUCCESS !=
	    woal_set_get_ap_wmm_para(priv, MLAN_ACT_SET, &ap_wmm_para)) {
		PRINTM(MERROR, "wlan: Fail to set AP WMM parameter\n");
		ret = -EFAULT;
	}
	LEAVE();
	return ret;
}
int woal_cfg80211_set_txq_params ( struct wiphy * wiphy , struct net_device * dev , struct ieee80211_txq_params * params ) { int ret = 0 ; u8 ac = 0 ; wmm_parameter_t ap_wmm_para ; moal_private * priv = ( moal_private * ) woal_get_netdev_priv ( dev ) ; ENTER ( ) ; #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 5 , 0 ) switch ( params -> ac ) { case NL80211_AC_VO : ac = 3 ; break ; case NL80211_AC_VI : ac = 2 ; break ; case NL80211_AC_BK : ac = 1 ; break ; case NL80211_AC_BE : ac = 0 ; break ; default : break ; } #else switch ( params -> queue ) { case NL80211_TXQ_Q_VO : ac = 3 ; break ; case NL80211_TXQ_Q_VI : ac = 2 ; break ; case NL80211_TXQ_Q_BK : ac = 1 ; break ; case NL80211_TXQ_Q_BE : ac = 0 ; break ; default : break ; } #endif PRINTM ( MMSG , " \n " , ac , params -> txop , params -> cwmin , params -> cwmax , params -> aifs ) ; memset ( & ap_wmm_para , 0 , sizeof ( wmm_parameter_t ) ) ; if ( MLAN_STATUS_SUCCESS != woal_set_get_ap_wmm_para ( priv , MLAN_ACT_GET , & ap_wmm_para ) ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return ret ; } ap_wmm_para . ac_params [ ac ] . aci_aifsn . aifsn = params -> aifs ; ap_wmm_para . ac_params [ ac ] . ecw . ecw_max = ilog2 ( params -> cwmax + 1 ) ; ap_wmm_para . ac_params [ ac ] . ecw . ecw_min = ilog2 ( params -> cwmin + 1 ) ; ap_wmm_para . ac_params [ ac ] . tx_op_limit = params -> txop ; if ( MLAN_STATUS_SUCCESS != woal_set_get_ap_wmm_para ( priv , MLAN_ACT_SET , & ap_wmm_para ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; } LEAVE ( ) ; return ret ; }
@brief Set txq parameters
 @param wiphy           A pointer to wiphy structure
 @param dev             A pointer to net_device structure
 @param params                  A pointer to ieee80211_txq_params structure
@brief Set txq parameters @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure @param params A pointer to ieee80211_txq_params structure
/* AC_BE: 0, AC_BK:1, AC_VI: 2, AC_VO:3 */