Browse Source

qcacld-3.0: Implement disconnect complete functionality

Currently disconnect callback function for connection
manager is a dummy function, add disconnect complete
functionality in disconnect complete callback in hdd
for connection manager.

Change-Id: Ifa59a0ea442d4381d501cbef8a82ec3d6a2198d2
CRs-Fixed: 2826390
Ashish Kumar Dhanotiya 4 years ago
parent
commit
05aeb0c8e6

+ 5 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -3092,6 +3092,11 @@ int hdd_wlan_notify_modem_power_state(int state);
 void wlan_hdd_send_svc_nlink_msg(int radio, int type, void *data, int len);
 #ifdef FEATURE_WLAN_AUTO_SHUTDOWN
 void wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable);
+#else
+static inline void
+wlan_hdd_auto_shutdown_enable(struct hdd_context *hdd_ctx, bool enable)
+{
+}
 #endif
 
 struct hdd_adapter *

+ 1 - 21
core/hdd/src/wlan_hdd_assoc.c

@@ -84,6 +84,7 @@
 #endif
 #include "wlan_cm_public_struct.h"
 #include "osif_cm_util.h"
+#include "wlan_hdd_cm_api.h"
 
 
 /* These are needed to recognize WPA and RSN suite types */
@@ -5627,27 +5628,6 @@ void hdd_roam_profile_init(struct hdd_adapter *adapter)
 }
 
 #ifdef FEATURE_CM_ENABLE
-static QDF_STATUS hdd_cm_connect_complete(struct wlan_objmgr_vdev *vdev,
-					  struct wlan_cm_connect_resp *rsp,
-					  enum osif_cb_type type)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-static QDF_STATUS hdd_cm_disconnect_complete(struct wlan_objmgr_vdev *vdev,
-					     struct wlan_cm_discon_rsp *rsp,
-					     enum osif_cb_type type)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-static QDF_STATUS hdd_cm_netif_queue_control(struct wlan_objmgr_vdev *vdev,
-					     enum netif_action_type action,
-					     enum netif_reason_type reason)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
 struct osif_cm_ops osif_ops = {
 	.connect_complete_cb = hdd_cm_connect_complete,
 	.disconnect_complete_cb = hdd_cm_disconnect_complete,

+ 14 - 0
core/hdd/src/wlan_hdd_cm_api.h

@@ -24,6 +24,8 @@
 #define __WLAN_HDD_CM_API_H
 
 #include <net/cfg80211.h>
+#include "wlan_cm_public_struct.h"
+#include "osif_cm_util.h"
 
 #ifdef FEATURE_CM_ENABLE
 /**
@@ -54,6 +56,18 @@ int wlan_hdd_cm_connect(struct wiphy *wiphy,
 int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
 			   struct net_device *dev, u16 reason);
 
+QDF_STATUS hdd_cm_disconnect_complete(struct wlan_objmgr_vdev *vdev,
+				      struct wlan_cm_discon_rsp *rsp,
+				      enum osif_cb_type type);
+
+QDF_STATUS hdd_cm_netif_queue_control(struct wlan_objmgr_vdev *vdev,
+				      enum netif_action_type action,
+				      enum netif_reason_type reason);
+
+QDF_STATUS hdd_cm_connect_complete(struct wlan_objmgr_vdev *vdev,
+				   struct wlan_cm_connect_resp *rsp,
+				   enum osif_cb_type type);
+
 #else
 static inline int
 wlan_hdd_cm_connect(struct wiphy *wiphy, struct net_device *ndev,

+ 7 - 0
core/hdd/src/wlan_hdd_cm_connect.c

@@ -131,3 +131,10 @@ int wlan_hdd_cm_connect(struct wiphy *wiphy,
 	hdd_objmgr_put_vdev(vdev);
 	return status;
 }
+
+QDF_STATUS hdd_cm_connect_complete(struct wlan_objmgr_vdev *vdev,
+				   struct wlan_cm_connect_resp *rsp,
+				   enum osif_cb_type type)
+{
+	return QDF_STATUS_SUCCESS;
+}

+ 126 - 0
core/hdd/src/wlan_hdd_cm_disconnect.c

@@ -26,6 +26,14 @@
 #include "wlan_hdd_trace.h"
 #include <osif_cm_req.h>
 #include "wlan_hdd_cm_api.h"
+#include "wlan_ipa_ucfg_api.h"
+#include "wlan_hdd_periodic_sta_stats.h"
+#include "wlan_hdd_stats.h"
+#include "wlan_hdd_scan.h"
+#include "sme_power_save_api.h"
+#include <wlan_logging_sock_svc.h>
+#include "wlan_hdd_ftm_time_sync.h"
+#include "wlan_hdd_bcn_recv.h"
 
 int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
 			   struct net_device *dev, u16 reason)
@@ -69,3 +77,121 @@ int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
 
 	return status;
 }
+
+static QDF_STATUS
+hdd_cm_disconnect_complete_pre_user_update(struct wlan_objmgr_vdev *vdev,
+					   struct wlan_cm_discon_rsp *rsp)
+{
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	struct hdd_adapter *adapter = hdd_get_adapter_by_vdev(hdd_ctx,
+					wlan_vdev_get_id(vdev));
+	mac_handle_t mac_handle = hdd_ctx->mac_handle;
+
+	if (ucfg_ipa_is_enabled() &&
+	    QDF_IS_STATUS_SUCCESS(wlan_hdd_validate_mac_address(
+				  &rsp->req.req.bssid)))
+		ucfg_ipa_wlan_evt(hdd_ctx->pdev, adapter->dev,
+				  adapter->device_mode,
+				  adapter->vdev_id,
+				  WLAN_IPA_STA_DISCONNECT,
+				  rsp->req.req.bssid.bytes);
+
+	hdd_periodic_sta_stats_stop(adapter);
+
+	wlan_hdd_auto_shutdown_enable(hdd_ctx, true);
+
+	DPTRACE(qdf_dp_trace_mgmt_pkt(QDF_DP_TRACE_MGMT_PACKET_RECORD,
+				      adapter->vdev_id,
+				      QDF_TRACE_DEFAULT_PDEV_ID,
+				      QDF_PROTO_TYPE_MGMT,
+				      QDF_PROTO_MGMT_DISASSOC));
+
+	hdd_wmm_dscp_initial_state(adapter);
+	wlan_deregister_txrx_packetdump(OL_TXRX_PDEV_ID);
+
+	/*
+	 * indicate 'disconnect' status to wpa_supplicant.
+	 * hdd_send_association_event check this api and get the required code
+	 * hdd_bus_bw_compute_reset_prev_txrx_stats,
+	 * hdd_lpass_notify_disconnect, hdd_send_peer_status_ind_to_app,
+	 * hdd_bus_bw_compute_timer_try_stop, hdd_ipa_set_tx_flow_info,
+	 * update P2P connection status
+	 */
+
+	if (adapter->device_mode == QDF_STA_MODE) {
+	/* Inform FTM TIME SYNC about the disconnection with the AP */
+		hdd_ftm_time_sync_sta_state_notify(
+				adapter, FTM_TIME_SYNC_STA_DISCONNECTED);
+	}
+	hdd_wmm_adapter_clear(adapter);
+
+	if (sme_is_beacon_report_started(mac_handle, adapter->vdev_id)) {
+		hdd_debug("Sending beacon pause indication to userspace");
+		hdd_beacon_recv_pause_indication((hdd_handle_t)hdd_ctx,
+						 adapter->vdev_id,
+						 SCAN_EVENT_TYPE_MAX, true);
+	}
+	/*
+	 * Clear saved connection information in HDD
+	 * hdd_conn_remove_connect_info(sta_ctx);, this is an static api,
+	 * Move this api here once this path is enabled.
+	 */
+
+	hdd_init_scan_reject_params(hdd_ctx);
+	ucfg_pmo_flush_gtk_offload_req(adapter->vdev);
+
+	if ((QDF_STA_MODE == adapter->device_mode) ||
+	    (QDF_P2P_CLIENT_MODE == adapter->device_mode)) {
+		sme_ps_disable_auto_ps_timer(mac_handle,
+					     adapter->vdev_id);
+		adapter->send_mode_change = true;
+	}
+	wlan_hdd_clear_link_layer_stats(adapter);
+
+	adapter->hdd_stats.tx_rx_stats.cont_txtimeout_cnt = 0;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS
+hdd_cm_disconnect_complete_post_user_update(struct wlan_objmgr_vdev *vdev,
+					    struct wlan_cm_discon_rsp *rsp)
+{
+	struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	struct hdd_adapter *adapter = hdd_get_adapter_by_vdev(hdd_ctx,
+					wlan_vdev_get_id(vdev));
+
+	hdd_nud_reset_tracking(adapter);
+	hdd_reset_limit_off_chan(adapter);
+
+	/*
+	 * Print bss sta info
+	 * hdd_print_bss_info(sta_ctx); this is static function, enable this
+	 * once this path is enabled.
+	 */
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS hdd_cm_disconnect_complete(struct wlan_objmgr_vdev *vdev,
+				      struct wlan_cm_discon_rsp *rsp,
+				      enum osif_cb_type type)
+{
+	switch (type) {
+	case OSIF_PRE_USERSPACE_UPDATE:
+		return hdd_cm_disconnect_complete_pre_user_update(vdev, rsp);
+	case OSIF_POST_USERSPACE_UPDATE:
+		return hdd_cm_disconnect_complete_post_user_update(vdev, rsp);
+	default:
+		hdd_cm_disconnect_complete_pre_user_update(vdev, rsp);
+		hdd_cm_disconnect_complete_post_user_update(vdev, rsp);
+		return QDF_STATUS_SUCCESS;
+	}
+}
+
+QDF_STATUS hdd_cm_netif_queue_control(struct wlan_objmgr_vdev *vdev,
+				      enum netif_action_type action,
+				      enum netif_reason_type reason)
+{
+	return QDF_STATUS_SUCCESS;
+}
+