software/drivers/sd8887/src/wlan/mlinux/moal_uap_cfg80211.c
/**
 * @brief set mac filter
 *
 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 * @param params		  A pointer to cfg80211_acl_data structure
 *
 * @return                0 -- success, otherwise fail
 */
@brief set mac filter
@param wiphy           A pointer to wiphy structure
@param dev             A pointer to net_device structure
@param params                  A pointer to cfg80211_acl_data structure

@return                0 -- success, otherwise fail
@brief set mac filter @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure @param params A pointer to cfg80211_acl_data structure @return 0 -- success otherwise fail
int
woal_cfg80211_set_mac_acl(struct wiphy *wiphy, struct net_device *dev,
			  const struct cfg80211_acl_data *params)
{
	int ret = -EFAULT;
	mlan_uap_bss_param *sys_config = NULL;
	moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
	u8 bss_started = MFALSE;
	ENTER();
	PRINTM(MIOCTL, "Set mac acl, entries=%d, policy=%d\n",
	       params->n_acl_entries, params->acl_policy);
	sys_config = kzalloc(sizeof(mlan_uap_bss_param), GFP_ATOMIC);
	if (!sys_config) {
		PRINTM(MERROR, "Fail to alloc memory for mlan_uap_bss_param\n");
		LEAVE();
		return -EFAULT;
	}
	if (MLAN_STATUS_SUCCESS != woal_set_get_sys_config(priv,
							   MLAN_ACT_GET,
							   MOAL_IOCTL_WAIT,
							   sys_config)) {
		PRINTM(MERROR, "Error getting AP confiruration\n");
		ret = -EFAULT;
		goto done;
	}
	memset(&sys_config->filter, 0, sizeof(mac_filter));
	if (params->n_acl_entries <= MAX_MAC_FILTER_NUM)
		sys_config->filter.mac_count = params->n_acl_entries;
	else
		sys_config->filter.mac_count = MAX_MAC_FILTER_NUM;
	if (params->acl_policy == NL80211_ACL_POLICY_DENY_UNLESS_LISTED)
		sys_config->filter.filter_mode = MAC_FILTER_MODE_ALLOW_MAC;
	else if (params->acl_policy == NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED)
		sys_config->filter.filter_mode = MAC_FILTER_MODE_BLOCK_MAC;
	memcpy(sys_config->filter.mac_list, params->mac_addrs,
	       sys_config->filter.mac_count * sizeof(mlan_802_11_mac_addr));
	if (priv->bss_started == MTRUE) {
		bss_started = MTRUE;
		woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, UAP_BSS_STOP);
	}
	if (MLAN_STATUS_SUCCESS == woal_set_get_sys_config(priv,
							   MLAN_ACT_SET,
							   MOAL_IOCTL_WAIT,
							   sys_config))
		ret = 0;
done:
	kfree(sys_config);
	if (bss_started)
		woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT, UAP_BSS_START);
	LEAVE();
	return ret;
}
int woal_cfg80211_set_mac_acl ( struct wiphy * wiphy , struct net_device * dev , const struct cfg80211_acl_data * params ) { int ret = - EFAULT ; mlan_uap_bss_param * sys_config = NULL ; moal_private * priv = ( moal_private * ) woal_get_netdev_priv ( dev ) ; u8 bss_started = MFALSE ; ENTER ( ) ; PRINTM ( MIOCTL , " \n " , params -> n_acl_entries , params -> acl_policy ) ; sys_config = kzalloc ( sizeof ( mlan_uap_bss_param ) , GFP_ATOMIC ) ; if ( ! sys_config ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return - EFAULT ; } if ( MLAN_STATUS_SUCCESS != woal_set_get_sys_config ( priv , MLAN_ACT_GET , MOAL_IOCTL_WAIT , sys_config ) ) { PRINTM ( MERROR , " \n " ) ; ret = - EFAULT ; goto done ; } memset ( & sys_config -> filter , 0 , sizeof ( mac_filter ) ) ; if ( params -> n_acl_entries <= MAX_MAC_FILTER_NUM ) sys_config -> filter . mac_count = params -> n_acl_entries ; else sys_config -> filter . mac_count = MAX_MAC_FILTER_NUM ; if ( params -> acl_policy == NL80211_ACL_POLICY_DENY_UNLESS_LISTED ) sys_config -> filter . filter_mode = MAC_FILTER_MODE_ALLOW_MAC ; else if ( params -> acl_policy == NL80211_ACL_POLICY_ACCEPT_UNLESS_LISTED ) sys_config -> filter . filter_mode = MAC_FILTER_MODE_BLOCK_MAC ; memcpy ( sys_config -> filter . mac_list , params -> mac_addrs , sys_config -> filter . mac_count * sizeof ( mlan_802_11_mac_addr ) ) ; if ( priv -> bss_started == MTRUE ) { bss_started = MTRUE ; woal_uap_bss_ctrl ( priv , MOAL_IOCTL_WAIT_TIMEOUT , UAP_BSS_STOP ) ; } if ( MLAN_STATUS_SUCCESS == woal_set_get_sys_config ( priv , MLAN_ACT_SET , MOAL_IOCTL_WAIT , sys_config ) ) ret = 0 ; done : kfree ( sys_config ) ; if ( bss_started ) woal_uap_bss_ctrl ( priv , MOAL_IOCTL_WAIT_TIMEOUT , UAP_BSS_START ) ; LEAVE ( ) ; return ret ; }
@brief set mac filter
 @param wiphy           A pointer to wiphy structure
 @param dev             A pointer to net_device structure
 @param params                  A pointer to cfg80211_acl_data structure
@brief set mac filter @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure @param params A pointer to cfg80211_acl_data structure
/* Initialize the uap bss values which are uploaded from firmware */