Explorar el Código

qcacld-3.0: Add diag event for TDLS teardown

qcacld-2.0 to qcacld-3.0 propagation

Add diag event for TDLS teardown. Event contains reason for
teardown and peer mac address.

Change-Id: Ib04deac6cf7d61fae1a7bb0d0fb8f4dc652b3217
CRs-Fixed: 934448
Abhishek Singh hace 9 años
padre
commit
4ef5fe00a4

+ 33 - 0
core/hdd/inc/wlan_hdd_tdls.h

@@ -160,6 +160,30 @@ typedef enum eTDLSLinkStatus {
 	eTDLS_LINK_TEARING,
 } tTDLSLinkStatus;
 
+/**
+ * enum tdls_teardown_reason - Reason for TDLS teardown
+ * @eTDLS_TEARDOWN_EXT_CTRL: Reason ext ctrl.
+ * @eTDLS_TEARDOWN_CONCURRENCY: Reason concurrency.
+ * @eTDLS_TEARDOWN_RSSI_THRESHOLD: Reason rssi threshold.
+ * @eTDLS_TEARDOWN_TXRX_THRESHOLD: Reason txrx threshold.
+ * @eTDLS_TEARDOWN_BTCOEX: Reason BTCOEX.
+ * @eTDLS_TEARDOWN_SCAN: Reason scan.
+ * @eTDLS_TEARDOWN_BSS_DISCONNECT: Reason bss disconnected.
+ * @eTDLS_TEARDOWN_ANTENNA_SWITCH: Disconnected due to antenna switch
+ *
+ * Reason to indicate in diag event of tdls teardown.
+ */
+enum tdls_teardown_reason {
+	eTDLS_TEARDOWN_EXT_CTRL,
+	eTDLS_TEARDOWN_CONCURRENCY,
+	eTDLS_TEARDOWN_RSSI_THRESHOLD,
+	eTDLS_TEARDOWN_TXRX_THRESHOLD,
+	eTDLS_TEARDOWN_BTCOEX,
+	eTDLS_TEARDOWN_SCAN,
+	eTDLS_TEARDOWN_BSS_DISCONNECT,
+	eTDLS_TEARDOWN_ANTENNA_SWITCH,
+};
+
 /**
  * enum tTDLSLinkReason - tdls link reason
  *
@@ -625,4 +649,13 @@ static inline void wlan_hdd_tdls_exit(hdd_adapter_t *adapter)
 static inline void hdd_tdls_pre_init(hdd_context_t *hdd_ctx) { }
 #endif /* End of FEATURE_WLAN_TDLS */
 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
+					uint8_t *peer_mac);
+#else
+static inline
+void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
+					uint8_t *peer_mac) {}
+#endif /* FEATURE_WLAN_DIAG_SUPPORT */
+
 #endif /* __HDD_TDLS_H */

+ 8 - 0
core/hdd/src/wlan_hdd_assoc.c

@@ -3209,6 +3209,8 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter,
 						pRoamInfo->peerMac.bytes, true);
 		wlan_hdd_tdls_indicate_teardown(pAdapter, curr_peer,
 						pRoamInfo->reasonCode);
+		hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_BSS_DISCONNECT,
+						curr_peer->peerMac);
 		status = QDF_STATUS_SUCCESS;
 		break;
 	}
@@ -3388,6 +3390,9 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter,
 				wlan_hdd_tdls_indicate_teardown
 					(pHddTdlsCtx->pAdapter, curr_peer,
 					reason);
+				hdd_send_wlan_tdls_teardown_event(
+					eTDLS_TEARDOWN_BSS_DISCONNECT,
+					curr_peer->peerMac);
 			} else {
 				hddLog(LOGE,
 					  FL
@@ -3436,6 +3441,9 @@ hdd_roam_tdls_status_update_handler(hdd_adapter_t *pAdapter,
 				wlan_hdd_tdls_indicate_teardown
 					(pHddTdlsCtx->pAdapter, curr_peer,
 					reason);
+				hdd_send_wlan_tdls_teardown_event(
+					eTDLS_TEARDOWN_BSS_DISCONNECT,
+					curr_peer->peerMac);
 			} else {
 				hddLog(LOGE,
 					  FL

+ 33 - 0
core/hdd/src/wlan_hdd_tdls.c

@@ -85,6 +85,31 @@ static void wlan_hdd_tdls_determine_channel_opclass(hdd_context_t *hddctx,
 	}
 }
 
+#ifdef FEATURE_WLAN_DIAG_SUPPORT
+/**
+ * hdd_send_wlan_tdls_teardown_event()- send TDLS teardown event
+ * @reason: reason for tear down.
+ * @peer_mac: peer mac
+ *
+ * This Function sends TDLS teardown diag event
+ *
+ * Return: void.
+ */
+void hdd_send_wlan_tdls_teardown_event(uint32_t reason,
+					uint8_t *peer_mac)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(tdls_tear_down,
+		struct host_event_tdls_teardown);
+	qdf_mem_zero(&tdls_tear_down,
+			sizeof(tdls_tear_down));
+
+	tdls_tear_down.reason = reason;
+	qdf_mem_copy(tdls_tear_down.peer_mac, peer_mac, MAC_ADDR_LEN);
+	WLAN_HOST_DIAG_EVENT_REPORT(&tdls_tear_down,
+		EVENT_WLAN_TDLS_TEARDOWN);
+}
+#endif
+
 /**
  * wlan_hdd_tdls_hash_key() - calculate tdls hash key given mac address
  * @mac: mac address
@@ -168,6 +193,8 @@ void wlan_hdd_tdls_disable_offchan_and_teardown_links(hdd_context_t *hddctx)
 					curr_peer->pHddTdlsCtx->pAdapter,
 					curr_peer,
 					eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
+		hdd_send_wlan_tdls_teardown_event(eTDLS_TEARDOWN_CONCURRENCY,
+			curr_peer->peerMac);
 	}
 }
 
@@ -2764,6 +2791,9 @@ int wlan_hdd_tdls_scan_callback(hdd_adapter_t *pAdapter, struct wiphy *wiphy,
 						(connectedPeerList[i]->pHddTdlsCtx->
 						pAdapter, connectedPeerList[i],
 						eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
+					hdd_send_wlan_tdls_teardown_event(
+						eTDLS_TEARDOWN_SCAN,
+						connectedPeerList[i]->peerMac);
 				}
 			}
 			/* schedule scan */
@@ -4117,6 +4147,9 @@ int wlan_hdd_tdls_extctrl_deconfig_peer(hdd_adapter_t *pAdapter,
 	} else {
 		wlan_hdd_tdls_indicate_teardown(pAdapter, pTdlsPeer,
 						eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON);
+		hdd_send_wlan_tdls_teardown_event(
+			eTDLS_TEARDOWN_EXT_CTRL,
+			pTdlsPeer->peerMac);
 	}
 	if (0 != wlan_hdd_tdls_set_force_peer(pAdapter, peer, false)) {
 		QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR,

+ 12 - 0
core/utils/host_diag_log/inc/host_diag_core_event.h

@@ -299,6 +299,18 @@ struct host_event_wlan_log_complete {
 	uint32_t reserved;
 };
 
+/**
+ * struct host_event_tdls_teardown - tdls teardown diag event
+ * @reason: reason for tear down
+ * @peer_mac: peer mac
+ *
+ * This structure contains tdls teardown diag event info
+ */
+struct host_event_tdls_teardown {
+	uint32_t reason;
+	uint8_t peer_mac[QDF_MAC_ADDR_SIZE];
+};
+
 /*-------------------------------------------------------------------------
    Function declarations and documenation
    ------------------------------------------------------------------------*/

+ 2 - 1
core/utils/host_diag_log/inc/host_diag_event_defs.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -54,6 +54,7 @@ typedef enum {
 	EVENT_WLAN_WAKE_LOCK = 0xAA2, /* 96 bytes payload */
 	EVENT_WLAN_BEACON_RECEIVED = 0xAA6, /* FW event: 2726 */
 	EVENT_WLAN_LOG_COMPLETE = 0xAA7, /* 16 bytes payload */
+	EVENT_WLAN_TDLS_TEARDOWN = 0xAB5,
 
 	EVENT_MAX_ID = 0x0FFF
 } event_id_enum_type;