software/drivers/sd8887/src/wlan/mlan/mlan_init.c
/**
 *  @brief This function initializes the private structure
 *          and sets default values to the members of mlan_private.
 *
 *  @param priv     A pointer to mlan_private structure
 *
 *  @return         MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
 */
@brief This function initializes the private structure
and sets default values to the members of mlan_private.

@param priv     A pointer to mlan_private structure


@brief This function initializes the private structure and sets default values to the members of mlan_private . @param priv A pointer to mlan_private structure
mlan_status
wlan_init_priv(pmlan_private priv)
{
	t_u32 i;
	pmlan_adapter pmadapter = priv->adapter;
	mlan_status ret = MLAN_STATUS_SUCCESS;
	ENTER();
	priv->media_connected = MFALSE;
	memset(pmadapter, priv->curr_addr, 0xff, MLAN_MAC_ADDR_LENGTH);
#ifdef STA_SUPPORT
	priv->pkt_tx_ctrl = 0;
	priv->bss_mode = MLAN_BSS_MODE_INFRA;
	priv->data_rate = 0;	
	priv->is_data_rate_auto = MTRUE;
	priv->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
	priv->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
	priv->sec_info.wep_status = Wlan802_11WEPDisabled;
	priv->sec_info.authentication_mode = MLAN_AUTH_MODE_AUTO;
	priv->sec_info.encryption_mode = MLAN_ENCRYPTION_MODE_NONE;
	for (i = 0; i < MRVL_NUM_WEP_KEY; i++)
		memset(pmadapter, &priv->wep_key[i], 0, sizeof(mrvl_wep_key_t));
	priv->wep_key_curr_index = 0;
	priv->ewpa_query = MFALSE;
	priv->curr_pkt_filter =
		HostCmd_ACT_MAC_STATIC_DYNAMIC_BW_ENABLE |
		HostCmd_ACT_MAC_RTS_CTS_ENABLE |
		HostCmd_ACT_MAC_RX_ON | HostCmd_ACT_MAC_TX_ON |
		HostCmd_ACT_MAC_ETHERNETII_ENABLE;
	priv->beacon_period = MLAN_BEACON_INTERVAL;
	priv->pattempted_bss_desc = MNULL;
	memset(pmadapter, &priv->gtk_rekey, 0,
	       sizeof(mlan_ds_misc_gtk_rekey_data));
	memset(pmadapter, &priv->curr_bss_params, 0,
	       sizeof(priv->curr_bss_params));
	priv->listen_interval = MLAN_DEFAULT_LISTEN_INTERVAL;
	memset(pmadapter, &priv->assoc_rsp_buf, 0, sizeof(priv->assoc_rsp_buf));
	priv->assoc_rsp_size = 0;
	wlan_11d_priv_init(priv);
	wlan_11h_priv_init(priv);
#ifdef UAP_SUPPORT
	priv->uap_bss_started = MFALSE;
	priv->uap_host_based = MFALSE;
	memset(pmadapter, &priv->uap_state_chan_cb, 0,
	       sizeof(priv->uap_state_chan_cb));
#endif
#if defined(UAP_SUPPORT)
	priv->num_drop_pkts = 0;
#endif
#if defined(STA_SUPPORT)
	priv->adhoc_state_prev = ADHOC_IDLE;
	memset(pmadapter, &priv->adhoc_last_start_ssid, 0,
	       sizeof(priv->adhoc_last_start_ssid));
#endif
	priv->atim_window = 0;
	priv->adhoc_state = ADHOC_IDLE;
	priv->tx_power_level = 0;
	priv->max_tx_power_level = 0;
	priv->min_tx_power_level = 0;
	priv->tx_rate = 0;
	priv->rxpd_rate_info = 0;
	priv->rxpd_vhtinfo = 0;
	priv->rxpd_rate = 0;
	priv->rate_bitmap = 0;
	priv->data_rssi_last = 0;
	priv->data_rssi_avg = 0;
	priv->data_nf_avg = 0;
	priv->data_nf_last = 0;
	priv->bcn_rssi_last = 0;
	priv->bcn_rssi_avg = 0;
	priv->bcn_nf_avg = 0;
	priv->bcn_nf_last = 0;
	priv->sec_info.ewpa_enabled = MFALSE;
	priv->sec_info.wpa_enabled = MFALSE;
	priv->sec_info.wpa2_enabled = MFALSE;
	memset(pmadapter, &priv->wpa_ie, 0, sizeof(priv->wpa_ie));
	memset(pmadapter, &priv->aes_key, 0, sizeof(priv->aes_key));
	priv->wpa_ie_len = 0;
	priv->wpa_is_gtk_set = MFALSE;
#if defined(STA_SUPPORT)
	priv->pmfcfg.mfpc = 0;
	priv->pmfcfg.mfpr = 0;
#endif
	priv->sec_info.wapi_enabled = MFALSE;
	priv->wapi_ie_len = 0;
	priv->sec_info.wapi_key_on = MFALSE;
	memset(pmadapter, &priv->wps, 0, sizeof(priv->wps));
	memset(pmadapter, &priv->gen_ie_buf, 0, sizeof(priv->gen_ie_buf));
	priv->gen_ie_buf_len = 0;
#endif 
	priv->wmm_required = MTRUE;
	priv->wmm_enabled = MFALSE;
	priv->wmm_qosinfo = 0;
	priv->saved_wmm_qosinfo = 0;
	priv->host_tdls_cs_support = MTRUE;
	priv->host_tdls_uapsd_support = MTRUE;
	priv->tdls_cs_channel = 0;
	priv->supp_regulatory_class_len = 0;
	priv->chan_supp_len = 0;
	priv->tdls_idle_time = TDLS_IDLE_TIMEOUT;
	priv->txaggrctrl = MTRUE;
#ifdef STA_SUPPORT
	priv->pcurr_bcn_buf = MNULL;
	priv->curr_bcn_size = 0;
	memset(pmadapter, &priv->ext_cap, 0, sizeof(priv->ext_cap));
	SET_EXTCAP_OPERMODENTF(priv->ext_cap);
	SET_EXTCAP_TDLS(priv->ext_cap);
	SET_EXTCAP_QOS_MAP(priv->ext_cap);
	memcpy(priv->adapter, &priv->def_ext_cap, &priv->ext_cap,
	       sizeof(priv->ext_cap));
#endif 
	for (i = 0; i < MAX_NUM_TID; i++)
		priv->addba_reject[i] = ADDBA_RSP_STATUS_ACCEPT;
	priv->addba_reject[6] = ADDBA_RSP_STATUS_REJECT;
	priv->addba_reject[7] = ADDBA_RSP_STATUS_REJECT;
	memcpy(priv->adapter, priv->ibss_addba_reject, priv->addba_reject,
	       sizeof(priv->addba_reject));
	priv->max_amsdu = 0;
#ifdef STA_SUPPORT
	if (priv->bss_type == MLAN_BSS_TYPE_STA) {
		priv->add_ba_param.tx_win_size = MLAN_STA_AMPDU_DEF_TXWINSIZE;
		priv->add_ba_param.rx_win_size = MLAN_STA_AMPDU_DEF_RXWINSIZE;
	}
#endif
#ifdef WIFI_DIRECT_SUPPORT
	if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) {
		priv->add_ba_param.tx_win_size = MLAN_WFD_AMPDU_DEF_TXRXWINSIZE;
		priv->add_ba_param.rx_win_size = MLAN_WFD_AMPDU_DEF_TXRXWINSIZE;
	}
#endif
#ifdef UAP_SUPPORT
	if (priv->bss_type == MLAN_BSS_TYPE_UAP) {
		priv->add_ba_param.tx_win_size = MLAN_UAP_AMPDU_DEF_TXWINSIZE;
		priv->add_ba_param.rx_win_size = MLAN_UAP_AMPDU_DEF_RXWINSIZE;
		priv->aggr_prio_tbl[6].ampdu_user =
			priv->aggr_prio_tbl[7].ampdu_user =
			BA_STREAM_NOT_ALLOWED;
	}
#endif
	priv->user_rxwinsize = priv->add_ba_param.rx_win_size;
	priv->port_ctrl_mode = MTRUE;
	priv->port_open = MFALSE;
	priv->intf_hr_len = INTF_HEADER_LEN;
	ret = wlan_add_bsspriotbl(priv);
	LEAVE();
	return ret;
}
mlan_status wlan_init_priv ( pmlan_private priv ) { t_u32 i ; pmlan_adapter pmadapter = priv -> adapter ; mlan_status ret = MLAN_STATUS_SUCCESS ; ENTER ( ) ; priv -> media_connected = MFALSE ; memset ( pmadapter , priv -> curr_addr , 0xff , MLAN_MAC_ADDR_LENGTH ) ; #ifdef STA_SUPPORT priv -> pkt_tx_ctrl = 0 ; priv -> bss_mode = MLAN_BSS_MODE_INFRA ; priv -> data_rate = 0 ; priv -> is_data_rate_auto = MTRUE ; priv -> bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR ; priv -> data_avg_factor = DEFAULT_DATA_AVG_FACTOR ; priv -> sec_info . wep_status = Wlan802_11WEPDisabled ; priv -> sec_info . authentication_mode = MLAN_AUTH_MODE_AUTO ; priv -> sec_info . encryption_mode = MLAN_ENCRYPTION_MODE_NONE ; for ( i = 0 ; i < MRVL_NUM_WEP_KEY ; i ++ ) memset ( pmadapter , & priv -> wep_key [ i ] , 0 , sizeof ( mrvl_wep_key_t ) ) ; priv -> wep_key_curr_index = 0 ; priv -> ewpa_query = MFALSE ; priv -> curr_pkt_filter = HostCmd_ACT_MAC_STATIC_DYNAMIC_BW_ENABLE | HostCmd_ACT_MAC_RTS_CTS_ENABLE | HostCmd_ACT_MAC_RX_ON | HostCmd_ACT_MAC_TX_ON | HostCmd_ACT_MAC_ETHERNETII_ENABLE ; priv -> beacon_period = MLAN_BEACON_INTERVAL ; priv -> pattempted_bss_desc = MNULL ; memset ( pmadapter , & priv -> gtk_rekey , 0 , sizeof ( mlan_ds_misc_gtk_rekey_data ) ) ; memset ( pmadapter , & priv -> curr_bss_params , 0 , sizeof ( priv -> curr_bss_params ) ) ; priv -> listen_interval = MLAN_DEFAULT_LISTEN_INTERVAL ; memset ( pmadapter , & priv -> assoc_rsp_buf , 0 , sizeof ( priv -> assoc_rsp_buf ) ) ; priv -> assoc_rsp_size = 0 ; wlan_11d_priv_init ( priv ) ; wlan_11h_priv_init ( priv ) ; #ifdef UAP_SUPPORT priv -> uap_bss_started = MFALSE ; priv -> uap_host_based = MFALSE ; memset ( pmadapter , & priv -> uap_state_chan_cb , 0 , sizeof ( priv -> uap_state_chan_cb ) ) ; #endif #if defined ( UAP_SUPPORT ) priv -> num_drop_pkts = 0 ; #endif #if defined ( STA_SUPPORT ) priv -> adhoc_state_prev = ADHOC_IDLE ; memset ( pmadapter , & priv -> adhoc_last_start_ssid , 0 , sizeof ( priv -> adhoc_last_start_ssid ) ) ; #endif priv -> atim_window = 0 ; priv -> adhoc_state = ADHOC_IDLE ; priv -> tx_power_level = 0 ; priv -> max_tx_power_level = 0 ; priv -> min_tx_power_level = 0 ; priv -> tx_rate = 0 ; priv -> rxpd_rate_info = 0 ; priv -> rxpd_vhtinfo = 0 ; priv -> rxpd_rate = 0 ; priv -> rate_bitmap = 0 ; priv -> data_rssi_last = 0 ; priv -> data_rssi_avg = 0 ; priv -> data_nf_avg = 0 ; priv -> data_nf_last = 0 ; priv -> bcn_rssi_last = 0 ; priv -> bcn_rssi_avg = 0 ; priv -> bcn_nf_avg = 0 ; priv -> bcn_nf_last = 0 ; priv -> sec_info . ewpa_enabled = MFALSE ; priv -> sec_info . wpa_enabled = MFALSE ; priv -> sec_info . wpa2_enabled = MFALSE ; memset ( pmadapter , & priv -> wpa_ie , 0 , sizeof ( priv -> wpa_ie ) ) ; memset ( pmadapter , & priv -> aes_key , 0 , sizeof ( priv -> aes_key ) ) ; priv -> wpa_ie_len = 0 ; priv -> wpa_is_gtk_set = MFALSE ; #if defined ( STA_SUPPORT ) priv -> pmfcfg . mfpc = 0 ; priv -> pmfcfg . mfpr = 0 ; #endif priv -> sec_info . wapi_enabled = MFALSE ; priv -> wapi_ie_len = 0 ; priv -> sec_info . wapi_key_on = MFALSE ; memset ( pmadapter , & priv -> wps , 0 , sizeof ( priv -> wps ) ) ; memset ( pmadapter , & priv -> gen_ie_buf , 0 , sizeof ( priv -> gen_ie_buf ) ) ; priv -> gen_ie_buf_len = 0 ; #endif priv -> wmm_required = MTRUE ; priv -> wmm_enabled = MFALSE ; priv -> wmm_qosinfo = 0 ; priv -> saved_wmm_qosinfo = 0 ; priv -> host_tdls_cs_support = MTRUE ; priv -> host_tdls_uapsd_support = MTRUE ; priv -> tdls_cs_channel = 0 ; priv -> supp_regulatory_class_len = 0 ; priv -> chan_supp_len = 0 ; priv -> tdls_idle_time = TDLS_IDLE_TIMEOUT ; priv -> txaggrctrl = MTRUE ; #ifdef STA_SUPPORT priv -> pcurr_bcn_buf = MNULL ; priv -> curr_bcn_size = 0 ; memset ( pmadapter , & priv -> ext_cap , 0 , sizeof ( priv -> ext_cap ) ) ; SET_EXTCAP_OPERMODENTF ( priv -> ext_cap ) ; SET_EXTCAP_TDLS ( priv -> ext_cap ) ; SET_EXTCAP_QOS_MAP ( priv -> ext_cap ) ; memcpy ( priv -> adapter , & priv -> def_ext_cap , & priv -> ext_cap , sizeof ( priv -> ext_cap ) ) ; #endif for ( i = 0 ; i < MAX_NUM_TID ; i ++ ) priv -> addba_reject [ i ] = ADDBA_RSP_STATUS_ACCEPT ; priv -> addba_reject [ 6 ] = ADDBA_RSP_STATUS_REJECT ; priv -> addba_reject [ 7 ] = ADDBA_RSP_STATUS_REJECT ; memcpy ( priv -> adapter , priv -> ibss_addba_reject , priv -> addba_reject , sizeof ( priv -> addba_reject ) ) ; priv -> max_amsdu = 0 ; #ifdef STA_SUPPORT if ( priv -> bss_type == MLAN_BSS_TYPE_STA ) { priv -> add_ba_param . tx_win_size = MLAN_STA_AMPDU_DEF_TXWINSIZE ; priv -> add_ba_param . rx_win_size = MLAN_STA_AMPDU_DEF_RXWINSIZE ; } #endif #ifdef WIFI_DIRECT_SUPPORT if ( priv -> bss_type == MLAN_BSS_TYPE_WIFIDIRECT ) { priv -> add_ba_param . tx_win_size = MLAN_WFD_AMPDU_DEF_TXRXWINSIZE ; priv -> add_ba_param . rx_win_size = MLAN_WFD_AMPDU_DEF_TXRXWINSIZE ; } #endif #ifdef UAP_SUPPORT if ( priv -> bss_type == MLAN_BSS_TYPE_UAP ) { priv -> add_ba_param . tx_win_size = MLAN_UAP_AMPDU_DEF_TXWINSIZE ; priv -> add_ba_param . rx_win_size = MLAN_UAP_AMPDU_DEF_RXWINSIZE ; priv -> aggr_prio_tbl [ 6 ] . ampdu_user = priv -> aggr_prio_tbl [ 7 ] . ampdu_user = BA_STREAM_NOT_ALLOWED ; } #endif priv -> user_rxwinsize = priv -> add_ba_param . rx_win_size ; priv -> port_ctrl_mode = MTRUE ; priv -> port_open = MFALSE ; priv -> intf_hr_len = INTF_HEADER_LEN ; ret = wlan_add_bsspriotbl ( priv ) ; LEAVE ( ) ; return ret ; }
@brief This function initializes the private structure
          and sets default values to the members of mlan_private.
@brief This function initializes the private structure and sets default values to the members of mlan_private .
/* Initially indicate the rate as auto */ /* refer to V15 CMD_TX_RATE_QUERY */ /* STA_SUPPORT */ /* Save default Extended Capability */ /* STA_SUPPORT */