software/drivers/sd8887/src/wlan/mlinux/moal_uap_cfg80211.c
/**
 * @brief reset AP or GO parameters
 *
 * @param wiphy           A pointer to wiphy structure
 * @param dev             A pointer to net_device structure
 *
 * @return                0 -- success, otherwise fail
 */
@brief reset AP or GO parameters
@param wiphy           A pointer to wiphy structure
@param dev             A pointer to net_device structure

@return                0 -- success, otherwise fail
@brief reset AP or GO parameters @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure @return 0 -- success otherwise fail
int
woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
{
	moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
	int ret = 0;
#ifdef STA_SUPPORT
	moal_private *pmpriv = NULL;
#endif
	ENTER();
	if (priv->phandle->driver_status) {
		PRINTM(MERROR,
		       "Block  woal_cfg80211_del_beacon in abnormal driver state\n");
		LEAVE();
		return -EFAULT;
	}
	priv->uap_host_based = MFALSE;
	PRINTM(MMSG, "wlan: Stoping AP\n");
#ifdef STA_SUPPORT
	woal_cancel_scan(priv, MOAL_IOCTL_WAIT);
#endif
	memset(priv->dscp_map, 0xFF, sizeof(priv->dscp_map));
	woal_deauth_all_station(priv);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
	if (dfs_offload)
		woal_cancel_cac_block(priv);
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 12, 0)
	memset(&priv->chan, 0, sizeof(struct cfg80211_chan_def));
	if (priv->phandle->is_cac_timer_set &&
	    priv->bss_index == priv->phandle->cac_bss_index) {
		woal_cancel_timer(&priv->phandle->cac_timer);
		priv->phandle->is_cac_timer_set = MFALSE;
		woal_11h_cancel_chan_report_ioctl(priv, MOAL_IOCTL_WAIT);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
		cfg80211_cac_event(priv->netdev, &priv->phandle->dfs_channel,
				   NL80211_RADAR_CAC_ABORTED, GFP_KERNEL);
#else
		cfg80211_cac_event(priv->netdev, NL80211_RADAR_CAC_ABORTED,
				   GFP_KERNEL);
#endif
		memset(&priv->phandle->dfs_channel, 0,
		       sizeof(struct cfg80211_chan_def));
		priv->phandle->cac_bss_index = 0xff;
	}
	if (priv->csa_workqueue)
		flush_workqueue(priv->csa_workqueue);
#endif
	if (priv->bss_started == MTRUE) {
		if (MLAN_STATUS_FAILURE ==
		    woal_uap_bss_ctrl(priv, MOAL_IOCTL_WAIT_TIMEOUT,
				      UAP_BSS_STOP)) {
			ret = -EFAULT;
			goto done;
		}
		if (MLAN_STATUS_FAILURE ==
		    woal_uap_bss_ctrl(priv, MOAL_NO_WAIT, UAP_BSS_RESET)) {
		}
		if (MLAN_STATUS_FAILURE ==
		    woal_request_set_mac_address(priv, MOAL_NO_WAIT))
			PRINTM(MERROR, "Set MAC address failed\n");
	}
	woal_clear_all_mgmt_ies(priv, MOAL_NO_WAIT);
#ifdef STA_SUPPORT
	if (!woal_is_any_interface_active(priv->phandle)) {
		pmpriv = woal_get_priv((moal_handle *)priv->phandle,
				       MLAN_BSS_ROLE_STA);
		if (pmpriv)
			woal_set_scan_time(pmpriv, ACTIVE_SCAN_CHAN_TIME,
					   PASSIVE_SCAN_CHAN_TIME,
					   SPECIFIC_SCAN_CHAN_TIME);
	}
#endif
	priv->cipher = 0;
	memset(priv->uap_wep_key, 0, sizeof(priv->uap_wep_key));
	priv->channel = 0;
	PRINTM(MMSG, "wlan: AP stopped\n");
done:
	LEAVE();
	return ret;
}
int woal_cfg80211_del_beacon ( struct wiphy * wiphy , struct net_device * dev ) { moal_private * priv = ( moal_private * ) woal_get_netdev_priv ( dev ) ; int ret = 0 ; #ifdef STA_SUPPORT moal_private * pmpriv = NULL ; #endif ENTER ( ) ; if ( priv -> phandle -> driver_status ) { PRINTM ( MERROR , " \n " ) ; LEAVE ( ) ; return - EFAULT ; } priv -> uap_host_based = MFALSE ; PRINTM ( MMSG , " \n " ) ; #ifdef STA_SUPPORT woal_cancel_scan ( priv , MOAL_IOCTL_WAIT ) ; #endif memset ( priv -> dscp_map , 0xFF , sizeof ( priv -> dscp_map ) ) ; woal_deauth_all_station ( priv ) ; #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 14 , 0 ) if ( dfs_offload ) woal_cancel_cac_block ( priv ) ; #endif #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 12 , 0 ) memset ( & priv -> chan , 0 , sizeof ( struct cfg80211_chan_def ) ) ; if ( priv -> phandle -> is_cac_timer_set && priv -> bss_index == priv -> phandle -> cac_bss_index ) { woal_cancel_timer ( & priv -> phandle -> cac_timer ) ; priv -> phandle -> is_cac_timer_set = MFALSE ; woal_11h_cancel_chan_report_ioctl ( priv , MOAL_IOCTL_WAIT ) ; #if CFG80211_VERSION_CODE >= KERNEL_VERSION ( 3 , 14 , 0 ) cfg80211_cac_event ( priv -> netdev , & priv -> phandle -> dfs_channel , NL80211_RADAR_CAC_ABORTED , GFP_KERNEL ) ; #else cfg80211_cac_event ( priv -> netdev , NL80211_RADAR_CAC_ABORTED , GFP_KERNEL ) ; #endif memset ( & priv -> phandle -> dfs_channel , 0 , sizeof ( struct cfg80211_chan_def ) ) ; priv -> phandle -> cac_bss_index = 0xff ; } if ( priv -> csa_workqueue ) flush_workqueue ( priv -> csa_workqueue ) ; #endif if ( priv -> bss_started == MTRUE ) { if ( MLAN_STATUS_FAILURE == woal_uap_bss_ctrl ( priv , MOAL_IOCTL_WAIT_TIMEOUT , UAP_BSS_STOP ) ) { ret = - EFAULT ; goto done ; } if ( MLAN_STATUS_FAILURE == woal_uap_bss_ctrl ( priv , MOAL_NO_WAIT , UAP_BSS_RESET ) ) { } if ( MLAN_STATUS_FAILURE == woal_request_set_mac_address ( priv , MOAL_NO_WAIT ) ) PRINTM ( MERROR , " \n " ) ; } woal_clear_all_mgmt_ies ( priv , MOAL_NO_WAIT ) ; #ifdef STA_SUPPORT if ( ! woal_is_any_interface_active ( priv -> phandle ) ) { pmpriv = woal_get_priv ( ( moal_handle * ) priv -> phandle , MLAN_BSS_ROLE_STA ) ; if ( pmpriv ) woal_set_scan_time ( pmpriv , ACTIVE_SCAN_CHAN_TIME , PASSIVE_SCAN_CHAN_TIME , SPECIFIC_SCAN_CHAN_TIME ) ; } #endif priv -> cipher = 0 ; memset ( priv -> uap_wep_key , 0 , sizeof ( priv -> uap_wep_key ) ) ; priv -> channel = 0 ; PRINTM ( MMSG , " \n " ) ; done : LEAVE ( ) ; return ret ; }
@brief reset AP or GO parameters
 @param wiphy           A pointer to wiphy structure
 @param dev             A pointer to net_device structure
@brief reset AP or GO parameters @param wiphy A pointer to wiphy structure @param dev A pointer to net_device structure
/* Make sure Chan Report is cancelled */ /* if the bss is still running, then stop it */ /* Set WLAN MAC addresses */