software/drivers/sd8887/src/wlan/mlan/mlan_sta_event.c
/**
 *  @brief This function handles disconnect event, reports disconnect
 *          to upper layer, cleans tx/rx packets,
 *          resets link state etc.
 *
 *  @param priv             A pointer to mlan_private structure
 *  @param drv_disconnect   Flag indicating the driver should disconnect
 *                          and flush pending packets.
 *
 *  @return                 N/A
 */
@brief This function handles disconnect event, reports disconnect
to upper layer, cleans tx/rx packets,
resets link state etc.

@param priv             A pointer to mlan_private structure
@param drv_disconnect   Flag indicating the driver should disconnect
and flush pending packets.

@return                 N/A
@brief This function handles disconnect event reports disconnect to upper layer cleans tx / rx packets resets link state etc . @param priv A pointer to mlan_private structure @param drv_disconnect Flag indicating the driver should disconnect and flush pending packets . @return N / A
t_void
wlan_reset_connect_state(pmlan_private priv, t_u8 drv_disconnect)
{
	mlan_adapter *pmadapter = priv->adapter;
	mlan_status ret = MLAN_STATUS_SUCCESS;
	state_11d_t enable;
	t_u8 event_buf[100];
	mlan_event *pevent = (mlan_event *)event_buf;
	ENTER();
	PRINTM(MINFO, "Handles disconnect event.\n");
	if (drv_disconnect) {
		priv->media_connected = MFALSE;
		pmadapter->state_rdh.tx_block = MFALSE;
		wlan_11h_check_update_radar_det_state(priv);
	}
	if (priv->port_ctrl_mode == MTRUE) {
		PRINTM(MINFO, "DISC: port_status = CLOSED\n");
		priv->port_open = MFALSE;
	}
	memset(pmadapter, &priv->gtk_rekey, 0,
	       sizeof(mlan_ds_misc_gtk_rekey_data));
	priv->tx_pause = MFALSE;
	pmadapter->scan_block = MFALSE;
	priv->data_rssi_last = 0;
	priv->data_nf_last = 0;
	priv->data_rssi_avg = 0;
	priv->data_nf_avg = 0;
	priv->bcn_rssi_last = 0;
	priv->bcn_nf_last = 0;
	priv->bcn_rssi_avg = 0;
	priv->bcn_nf_avg = 0;
	priv->rxpd_rate = 0;
	priv->rxpd_rate_info = 0;
	priv->max_amsdu = 0;
	wlan_coex_ampdu_rxwinsize(pmadapter);
	priv->sec_info.ewpa_enabled = MFALSE;
	priv->sec_info.wpa_enabled = MFALSE;
	priv->sec_info.wpa2_enabled = MFALSE;
	priv->wpa_ie_len = 0;
	priv->sec_info.wapi_enabled = MFALSE;
	priv->wapi_ie_len = 0;
	priv->sec_info.wapi_key_on = MFALSE;
	priv->wps.session_enable = MFALSE;
	memset(priv->adapter, (t_u8 *)&priv->wps.wps_ie, 0x00,
	       sizeof(priv->wps.wps_ie));
	priv->sec_info.encryption_mode = MLAN_ENCRYPTION_MODE_NONE;
	priv->is_data_rate_auto = MTRUE;
	priv->data_rate = 0;
	if (priv->bss_mode == MLAN_BSS_MODE_IBSS) {
		priv->adhoc_state = ADHOC_IDLE;
		priv->adhoc_is_link_sensed = MFALSE;
		priv->intf_state_11h.adhoc_auto_sel_chan = MTRUE;
	}
	if (drv_disconnect) {
		wlan_clean_txrx(priv);
		memset(pmadapter,
		       &priv->curr_bss_params, 0x00,
		       sizeof(priv->curr_bss_params));
	}
	wlan_send_tdls_tear_down_request(priv);
	wlan_delete_station_list(priv);
	pmadapter->tdls_status = TDLS_NOT_SETUP;
	priv->wmm_qosinfo = priv->saved_wmm_qosinfo;
	pmadapter->sleep_period.period = pmadapter->saved_sleep_period.period;
	pmadapter->tx_lock_flag = MFALSE;
	pmadapter->pps_uapsd_mode = MFALSE;
	pmadapter->delay_null_pkt = MFALSE;
	if (priv->bss_type == MLAN_BSS_TYPE_STA)
		pmadapter->hs_wake_interval = 0;
	if ((wlan_fw_11d_is_enabled(priv)) &&
	    (priv->state_11d.user_enable_11d == DISABLE_11D)) {
		priv->state_11d.enable_11d = DISABLE_11D;
		enable = DISABLE_11D;
		ret = wlan_prepare_cmd(priv,
				       HostCmd_CMD_802_11_SNMP_MIB,
				       HostCmd_ACT_GEN_SET,
				       Dot11D_i, MNULL, &enable);
		if (ret)
			PRINTM(MERROR, "11D: Failed to enable 11D\n");
	}
	if (pmadapter->num_cmd_timeout && pmadapter->curr_cmd &&
	    (pmadapter->cmd_timer_is_set == MFALSE)) {
		LEAVE();
		return;
	}
	pevent->bss_index = priv->bss_index;
	pevent->event_id = MLAN_EVENT_ID_FW_DISCONNECTED;
	pevent->event_len = sizeof(priv->disconnect_reason_code);
	memcpy(priv->adapter, pevent->event_buf, &priv->disconnect_reason_code,
	       pevent->event_len);
	wlan_recv_event(priv, MLAN_EVENT_ID_FW_DISCONNECTED, pevent);
	priv->disconnect_reason_code = 0;
	LEAVE();
}
t_void wlan_reset_connect_state ( pmlan_private priv , t_u8 drv_disconnect ) { mlan_adapter * pmadapter = priv -> adapter ; mlan_status ret = MLAN_STATUS_SUCCESS ; state_11d_t enable ; t_u8 event_buf [ 100 ] ; mlan_event * pevent = ( mlan_event * ) event_buf ; ENTER ( ) ; PRINTM ( MINFO , " \n " ) ; if ( drv_disconnect ) { priv -> media_connected = MFALSE ; pmadapter -> state_rdh . tx_block = MFALSE ; wlan_11h_check_update_radar_det_state ( priv ) ; } if ( priv -> port_ctrl_mode == MTRUE ) { PRINTM ( MINFO , " \n " ) ; priv -> port_open = MFALSE ; } memset ( pmadapter , & priv -> gtk_rekey , 0 , sizeof ( mlan_ds_misc_gtk_rekey_data ) ) ; priv -> tx_pause = MFALSE ; pmadapter -> scan_block = MFALSE ; priv -> data_rssi_last = 0 ; priv -> data_nf_last = 0 ; priv -> data_rssi_avg = 0 ; priv -> data_nf_avg = 0 ; priv -> bcn_rssi_last = 0 ; priv -> bcn_nf_last = 0 ; priv -> bcn_rssi_avg = 0 ; priv -> bcn_nf_avg = 0 ; priv -> rxpd_rate = 0 ; priv -> rxpd_rate_info = 0 ; priv -> max_amsdu = 0 ; wlan_coex_ampdu_rxwinsize ( pmadapter ) ; priv -> sec_info . ewpa_enabled = MFALSE ; priv -> sec_info . wpa_enabled = MFALSE ; priv -> sec_info . wpa2_enabled = MFALSE ; priv -> wpa_ie_len = 0 ; priv -> sec_info . wapi_enabled = MFALSE ; priv -> wapi_ie_len = 0 ; priv -> sec_info . wapi_key_on = MFALSE ; priv -> wps . session_enable = MFALSE ; memset ( priv -> adapter , ( t_u8 * ) & priv -> wps . wps_ie , 0x00 , sizeof ( priv -> wps . wps_ie ) ) ; priv -> sec_info . encryption_mode = MLAN_ENCRYPTION_MODE_NONE ; priv -> is_data_rate_auto = MTRUE ; priv -> data_rate = 0 ; if ( priv -> bss_mode == MLAN_BSS_MODE_IBSS ) { priv -> adhoc_state = ADHOC_IDLE ; priv -> adhoc_is_link_sensed = MFALSE ; priv -> intf_state_11h . adhoc_auto_sel_chan = MTRUE ; } if ( drv_disconnect ) { wlan_clean_txrx ( priv ) ; memset ( pmadapter , & priv -> curr_bss_params , 0x00 , sizeof ( priv -> curr_bss_params ) ) ; } wlan_send_tdls_tear_down_request ( priv ) ; wlan_delete_station_list ( priv ) ; pmadapter -> tdls_status = TDLS_NOT_SETUP ; priv -> wmm_qosinfo = priv -> saved_wmm_qosinfo ; pmadapter -> sleep_period . period = pmadapter -> saved_sleep_period . period ; pmadapter -> tx_lock_flag = MFALSE ; pmadapter -> pps_uapsd_mode = MFALSE ; pmadapter -> delay_null_pkt = MFALSE ; if ( priv -> bss_type == MLAN_BSS_TYPE_STA ) pmadapter -> hs_wake_interval = 0 ; if ( ( wlan_fw_11d_is_enabled ( priv ) ) && ( priv -> state_11d . user_enable_11d == DISABLE_11D ) ) { priv -> state_11d . enable_11d = DISABLE_11D ; enable = DISABLE_11D ; ret = wlan_prepare_cmd ( priv , HostCmd_CMD_802_11_SNMP_MIB , HostCmd_ACT_GEN_SET , Dot11D_i , MNULL , & enable ) ; if ( ret ) PRINTM ( MERROR , " \n " ) ; } if ( pmadapter -> num_cmd_timeout && pmadapter -> curr_cmd && ( pmadapter -> cmd_timer_is_set == MFALSE ) ) { LEAVE ( ) ; return ; } pevent -> bss_index = priv -> bss_index ; pevent -> event_id = MLAN_EVENT_ID_FW_DISCONNECTED ; pevent -> event_len = sizeof ( priv -> disconnect_reason_code ) ; memcpy ( priv -> adapter , pevent -> event_buf , & priv -> disconnect_reason_code , pevent -> event_len ) ; wlan_recv_event ( priv , MLAN_EVENT_ID_FW_DISCONNECTED , pevent ) ; priv -> disconnect_reason_code = 0 ; LEAVE ( ) ; }
@brief This function handles disconnect event, reports disconnect
          to upper layer, cleans tx/rx packets,
          resets link state etc.
@brief This function handles disconnect event reports disconnect to upper layer cleans tx / rx packets resets link state etc .
/* Close the port on Disconnect */ /* Reset SNR/NF/RSSI values */ /*Enable auto data rate */ /* Free Tx and Rx packets, report disconnect to upper layer */ /* Need to erase the current SSID and BSSID info */ /* Send cmd to FW to enable/disable 11D function */