software/drivers/sd8887/src/wlan/mlinux/moal_cfg80211.c
/**
 * @brief Request the driver to set the coalesce
 *
 * @param wiphy           A pointer to wiphy structure
 * @param coalesce        A pointer to cfg80211_coalesce structure
 *
 * @return                0 -- success, otherwise fail
 */
@brief Request the driver to set the coalesce
@param wiphy           A pointer to wiphy structure
@param coalesce        A pointer to cfg80211_coalesce structure

@return                0 -- success, otherwise fail
@brief Request the driver to set the coalesce @param wiphy A pointer to wiphy structure @param coalesce A pointer to cfg80211_coalesce structure @return 0 -- success otherwise fail
int
woal_cfg80211_set_coalesce(struct wiphy *wiphy,
			   struct cfg80211_coalesce *coalesce)
{
	int ret = 0;
	int i;
	moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy);
	moal_private *priv = NULL;
	mlan_ds_coalesce_cfg coalesce_cfg;
	ENTER();
	if (!handle) {
		PRINTM(MFATAL, "Unable to get handle\n");
		ret = -EINVAL;
		goto done;
	}
	priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY);
	if (!priv) {
		ret = -EINVAL;
		goto done;
	}
	memset(&coalesce_cfg, 0, sizeof(coalesce_cfg));
	if (!coalesce) {
		PRINTM(MCMND,
		       "Disable coalesce and reset all previous rules\n");
	} else {
		coalesce_cfg.num_of_rules = coalesce->n_rules;
		for (i = 0; i < coalesce->n_rules; i++) {
			ret = woal_fill_coalesce_rule_info(&coalesce->rules[i],
							   &coalesce_cfg.
							   rule[i]);
			if (ret) {
				PRINTM(MERROR,
				       "Recheck the patterns provided for rule %d\n",
				       i + 1);
				return ret;
			}
		}
	}
	if (MLAN_STATUS_SUCCESS !=
	    woal_set_coalesce(priv, MLAN_ACT_SET, &coalesce_cfg)) {
		PRINTM(MERROR, "wlan: Fail to set coalesce\n");
		ret = -EFAULT;
	}
done:
	LEAVE();
	return ret;
}
int woal_cfg80211_set_coalesce ( struct wiphy * wiphy , struct cfg80211_coalesce * coalesce ) { int ret = 0 ; int i ; moal_handle * handle = ( moal_handle * ) woal_get_wiphy_priv ( wiphy ) ; moal_private * priv = NULL ; mlan_ds_coalesce_cfg coalesce_cfg ; ENTER ( ) ; if ( ! handle ) { PRINTM ( MFATAL , " \n " ) ; ret = - EINVAL ; goto done ; } priv = woal_get_priv ( handle , MLAN_BSS_ROLE_ANY ) ; if ( ! priv ) { ret = - EINVAL ; goto done ; } memset ( & coalesce_cfg , 0 , sizeof ( coalesce_cfg ) ) ; if ( ! coalesce ) { PRINTM ( MCMND , " \n " ) ; } else { coalesce_cfg . num_of_rules = coalesce -> n_rules ; for ( i = 0 ; i < coalesce -> n_rules ; i ++ ) { ret = woal_fill_coalesce_rule_info ( & coalesce -> rules [ i ] , & coalesce_cfg . rule [ i ] ) ; if ( ret ) { PRINTM ( MERROR , " \n " , i + 1 ) ; return ret ; } } } if ( MLAN_STATUS_SUCCESS != woal_set_coalesce ( priv , MLAN_ACT_SET , & coalesce_cfg ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; } done : LEAVE ( ) ; return ret ; }
@brief Request the driver to set the coalesce
 @param wiphy           A pointer to wiphy structure
 @param coalesce        A pointer to cfg80211_coalesce structure
@brief Request the driver to set the coalesce @param wiphy A pointer to wiphy structure @param coalesce A pointer to cfg80211_coalesce structure