software/drivers/sd8887/src/wlan/mlinux/moal_cfg80211.c
/**
 * @brief Request the driver to change the value of fragment
 * threshold or rts threshold or retry limit
 *
 * @param wiphy         A pointer to wiphy structure
 * @param changed       Change flags
 *
 * @return              0 -- success, otherwise fail
 */
@brief Request the driver to change the value of fragment
threshold or rts threshold or retry limit

@param wiphy         A pointer to wiphy structure
@param changed       Change flags

@return              0 -- success, otherwise fail
@brief Request the driver to change the value of fragment threshold or rts threshold or retry limit @param wiphy A pointer to wiphy structure @param changed Change flags @return 0 -- success otherwise fail
int
woal_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
{
	moal_private *priv = NULL;
	moal_handle *handle = (moal_handle *)woal_get_wiphy_priv(wiphy);
#ifdef UAP_CFG80211
#ifdef UAP_SUPPORT
	mlan_uap_bss_param *sys_cfg = NULL;
#endif
#endif
	int frag_thr = wiphy->frag_threshold;
	int rts_thr = wiphy->rts_threshold;
	int retry = wiphy->retry_long;
	ENTER();
	priv = woal_get_priv(handle, MLAN_BSS_ROLE_ANY);
	if (!priv) {
		LEAVE();
		return -EFAULT;
	}
	if (rts_thr == MLAN_FRAG_RTS_DISABLED)
		rts_thr = MLAN_RTS_MAX_VALUE;
	if (frag_thr == MLAN_FRAG_RTS_DISABLED)
		frag_thr = MLAN_FRAG_MAX_VALUE;
#ifdef UAP_CFG80211
#ifdef UAP_SUPPORT
	if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
		sys_cfg = kzalloc(sizeof(mlan_uap_bss_param), GFP_ATOMIC);
		if (!sys_cfg) {
			PRINTM(MERROR,
			       "Fail to alloc memory for mlan_uap_bss_param\n");
			LEAVE();
			return -EFAULT;
		}
		woal_set_sys_config_invalid_data(sys_cfg);
		sys_cfg->frag_threshold = frag_thr;
		sys_cfg->rts_threshold = rts_thr;
		sys_cfg->retry_limit = retry;
		if ((changed & WIPHY_PARAM_RTS_THRESHOLD) ||
		    (changed & WIPHY_PARAM_FRAG_THRESHOLD) ||
		    (changed &
		     (WIPHY_PARAM_RETRY_LONG | WIPHY_PARAM_RETRY_SHORT))) {
			if (woal_set_get_sys_config
			    (priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, sys_cfg)) {
				kfree(sys_cfg);
				goto fail;
			}
		}
		kfree(sys_cfg);
	}
#endif
#endif
#ifdef STA_CFG80211
#ifdef STA_SUPPORT
	if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) {
		if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
			if (woal_set_get_rts
			    (priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, &rts_thr))
				goto fail;
		}
		if (changed & WIPHY_PARAM_FRAG_THRESHOLD) {
			if (woal_set_get_frag
			    (priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, &frag_thr))
				goto fail;
		}
		if (changed &
		    (WIPHY_PARAM_RETRY_LONG | WIPHY_PARAM_RETRY_SHORT))
			if (woal_set_get_retry
			    (priv, MLAN_ACT_SET, MOAL_IOCTL_WAIT, &retry))
				goto fail;
	}
#endif
#endif
	LEAVE();
	return 0;
fail:
	PRINTM(MERROR, "Failed to change wiphy params %x\n", changed);
	LEAVE();
	return -EFAULT;
}
int woal_cfg80211_set_wiphy_params ( struct wiphy * wiphy , u32 changed ) { moal_private * priv = NULL ; moal_handle * handle = ( moal_handle * ) woal_get_wiphy_priv ( wiphy ) ; #ifdef UAP_CFG80211 #ifdef UAP_SUPPORT mlan_uap_bss_param * sys_cfg = NULL ; #endif #endif int frag_thr = wiphy -> frag_threshold ; int rts_thr = wiphy -> rts_threshold ; int retry = wiphy -> retry_long ; ENTER ( ) ; priv = woal_get_priv ( handle , MLAN_BSS_ROLE_ANY ) ; if ( ! priv ) { LEAVE ( ) ; return - EFAULT ; } if ( rts_thr == MLAN_FRAG_RTS_DISABLED ) rts_thr = MLAN_RTS_MAX_VALUE ; if ( frag_thr == MLAN_FRAG_RTS_DISABLED ) frag_thr = MLAN_FRAG_MAX_VALUE ; #ifdef UAP_CFG80211 #ifdef UAP_SUPPORT if ( GET_BSS_ROLE ( priv ) == MLAN_BSS_ROLE_UAP ) { sys_cfg = kzalloc ( sizeof ( mlan_uap_bss_param ) , GFP_ATOMIC ) ; if ( ! sys_cfg ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return - EFAULT ; } woal_set_sys_config_invalid_data ( sys_cfg ) ; sys_cfg -> frag_threshold = frag_thr ; sys_cfg -> rts_threshold = rts_thr ; sys_cfg -> retry_limit = retry ; if ( ( changed & WIPHY_PARAM_RTS_THRESHOLD ) || ( changed & WIPHY_PARAM_FRAG_THRESHOLD ) || ( changed & ( WIPHY_PARAM_RETRY_LONG | WIPHY_PARAM_RETRY_SHORT ) ) ) { if ( woal_set_get_sys_config ( priv , MLAN_ACT_SET , MOAL_IOCTL_WAIT , sys_cfg ) ) { kfree ( sys_cfg ) ; goto fail ; } } kfree ( sys_cfg ) ; } #endif #endif #ifdef STA_CFG80211 #ifdef STA_SUPPORT if ( GET_BSS_ROLE ( priv ) == MLAN_BSS_ROLE_STA ) { if ( changed & WIPHY_PARAM_RTS_THRESHOLD ) { if ( woal_set_get_rts ( priv , MLAN_ACT_SET , MOAL_IOCTL_WAIT , & rts_thr ) ) goto fail ; } if ( changed & WIPHY_PARAM_FRAG_THRESHOLD ) { if ( woal_set_get_frag ( priv , MLAN_ACT_SET , MOAL_IOCTL_WAIT , & frag_thr ) ) goto fail ; } if ( changed & ( WIPHY_PARAM_RETRY_LONG | WIPHY_PARAM_RETRY_SHORT ) ) if ( woal_set_get_retry ( priv , MLAN_ACT_SET , MOAL_IOCTL_WAIT , & retry ) ) goto fail ; } #endif #endif LEAVE ( ) ; return 0 ; fail : PRINTM ( MERROR , " \n " , changed ) ; LEAVE ( ) ; return - EFAULT ; }
@brief Request the driver to change the value of fragment
 threshold or rts threshold or retry limit
@brief Request the driver to change the value of fragment threshold or rts threshold or retry limit
/* Initialize the invalid values so that the correct
		 * values below are downloaded to firmware */