Browse Source

qcacld-3.0: Fill last disconnect reason on disconnect

Fill last disconnect reason on disconnect and reset on connect.

Change-Id: Ibc3cde1e6bc2a9abbdb6c5b2caee9bea844269cd
CRs-Fixed: 2963284
Utkarsh Bhatnagar 3 years ago
parent
commit
d1e140e687

+ 0 - 3
core/hdd/src/wlan_hdd_cfg80211.c

@@ -21609,7 +21609,6 @@ static int wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
 
 	return errno;
 }
-#endif
 
 /**
  * hdd_ieee80211_reason_code_to_str() - return string conversion of reason code
@@ -21761,8 +21760,6 @@ wlan_hdd_cfg80211_indicate_disconnect(struct hdd_adapter *adapter,
 }
 #endif
 
-#ifndef FEATURE_CM_ENABLE
-
 int wlan_hdd_disconnect(struct hdd_adapter *adapter, u16 reason,
 			enum wlan_reason_code mac_reason)
 {

+ 2 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -619,6 +619,7 @@ int wlan_hdd_cfg80211_update_band(struct hdd_context *hdd_ctx,
 				  struct wiphy *wiphy,
 				  enum band_info new_band);
 
+#ifndef FEATURE_CM_ENABLE
 /**
  * wlan_hdd_cfg80211_indicate_disconnect() - Indicate disconnnect to userspace
  * @adapter: Pointer to adapter
@@ -639,6 +640,7 @@ wlan_hdd_cfg80211_indicate_disconnect(struct hdd_adapter *adapter,
 				      enum wlan_reason_code reason,
 				      uint8_t *disconnect_ies,
 				      uint16_t disconnect_ies_len);
+#endif
 
 /**
  * wlan_hdd_change_hw_mode_for_given_chnl() - change HW mode for given channel

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

@@ -376,6 +376,7 @@ int wlan_hdd_cm_connect(struct wiphy *wiphy,
 	struct osif_connect_params params;
 	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
 	struct hdd_context *hdd_ctx;
+	struct hdd_station_ctx *hdd_sta_ctx;
 
 	hdd_enter();
 
@@ -400,6 +401,7 @@ int wlan_hdd_cm_connect(struct wiphy *wiphy,
 	}
 
 	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 
 	status = wlan_hdd_validate_context(hdd_ctx);
 	if (status)
@@ -414,6 +416,16 @@ int wlan_hdd_cm_connect(struct wiphy *wiphy,
 		return -EINVAL;
 
 	ucfg_pmo_flush_gtk_offload_req(vdev);
+	qdf_mem_zero(&hdd_sta_ctx->conn_info.conn_flag,
+		     sizeof(hdd_sta_ctx->conn_info.conn_flag));
+
+	/*
+	 * Reset the ptk, gtk status flags to avoid using old/previous
+	 * connection status.
+	 */
+	hdd_sta_ctx->conn_info.gtk_installed = false;
+	hdd_sta_ctx->conn_info.ptk_installed = false;
+	adapter->last_disconnect_reason = 0;
 
 	qdf_runtime_pm_prevent_suspend(&hdd_ctx->runtime_context.connect);
 	hdd_prevent_suspend_timeout(HDD_WAKELOCK_CONNECT_COMPLETE,

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

@@ -322,6 +322,12 @@ hdd_cm_disconnect_complete_pre_user_update(struct wlan_objmgr_vdev *vdev,
 			   rsp->req.req.reason_code << 16 |
 			   rsp->req.req.source);
 	hdd_ipa_set_tx_flow_info();
+	/*
+	 * Convert and cache internal reason code in adapter. This can be
+	 * sent to userspace with a vendor event.
+	 */
+	adapter->last_disconnect_reason =
+			osif_cm_mac_to_qca_reason(rsp->req.req.reason_code);
 
 	return QDF_STATUS_SUCCESS;
 }