Browse Source

qcacmn: Add diag API to report EVENT_WLAN_BRINGUP_STATUS

Implement API to report DIAG event EVENT_WLAN_BRINGUP_STATUS
to user-space.

Change-Id: Id344fc62b511de71da990aa37a2bca710ff8afda
CRs-Fixed: 2922103
Lin Bai 4 years ago
parent
commit
c672a940aa

+ 40 - 2
utils/host_diag_log/inc/host_diag_core_event.h

@@ -237,6 +237,35 @@ enum mgmt_bss_type {
 	MAX_PERSONA = 0xff,
 	MAX_PERSONA = 0xff,
 };
 };
 
 
+/**
+ * enum wlan_bringup_status: driver/device status
+ *
+ * @WLAN_STATUS_DISABLED: WLAN Disabled
+ * @WLAN_STATUS_ENABLED: WLAN Enabled
+ * @WLAN_STATUS_RESET_FAIL: Reset Fail
+ * @WLAN_STATUS_RESET_SUCCESS: Reset Success
+ * @WLAN_STATUS_DEVICE_REMOVED: Device Removed
+ * @WLAN_STATUS_DEVICE_INSERTED: Devide Inserted
+ * @WLAN_STATUS_DRIVER_UNLOADED: Driver Unloaded
+ * @WLAN_STATUS_DRIVER_LOADED: Driver Loaded
+ * @WLAN_STATUS_BUS_EXCEPTION: bus/link exception
+ * @WLAN_STATUS_DEVICE_TEMPERATURE_HIGH: chip temperature high
+ */
+enum wlan_bringup_status {
+	WLAN_STATUS_DISABLED = 0,
+	WLAN_STATUS_ENABLED = 1,
+	WLAN_STATUS_RESET_FAIL = 2,
+	WLAN_STATUS_RESET_SUCCESS = 3,
+	WLAN_STATUS_DEVICE_REMOVED = 4,
+	WLAN_STATUS_DEVICE_INSERTED = 5,
+	WLAN_STATUS_DRIVER_UNLOADED = 6,
+	WLAN_STATUS_DRIVER_LOADED = 7,
+	WLAN_STATUS_BUS_EXCEPTION = 8,
+	WLAN_STATUS_DEVICE_TEMPERATURE_HIGH = 9,
+
+	WLAN_STATUS_MAX = 0xffff,
+};
+
 /*-------------------------------------------------------------------------
 /*-------------------------------------------------------------------------
    Event ID: EVENT_WLAN_SECURITY
    Event ID: EVENT_WLAN_SECURITY
    ------------------------------------------------------------------------*/
    ------------------------------------------------------------------------*/
@@ -429,9 +458,18 @@ typedef struct {
 /*-------------------------------------------------------------------------
 /*-------------------------------------------------------------------------
    Event ID: EVENT_WLAN_BRINGUP_STATUS
    Event ID: EVENT_WLAN_BRINGUP_STATUS
    ------------------------------------------------------------------------*/
    ------------------------------------------------------------------------*/
+/**
+ * struct host_event_wlan_bringup_status_payload_type - Structure holding the
+ * device/driver status info
+ *
+ * @wlan_status: status code as defined by enum wlan_bringup_status
+ * @driver_version: version of WLAN driver
+ *
+ * This structure will hold WLAN device basic status and driver version
+ */
 typedef struct {
 typedef struct {
-	uint16_t wlanStatus;
-	char driverVersion[10];
+	uint16_t wlan_status;
+	char driver_version[10];
 } host_event_wlan_bringup_status_payload_type;
 } host_event_wlan_bringup_status_payload_type;
 
 
 /*-------------------------------------------------------------------------
 /*-------------------------------------------------------------------------

+ 3 - 1
utils/host_diag_log/inc/host_diag_event_defs.h

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2019,2021 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * any purpose with or without fee is hereby granted, provided that the
@@ -384,6 +384,8 @@ typedef enum {
 	 * 5 - Devide Inserted
 	 * 5 - Devide Inserted
 	 * 6 - Driver Unloaded
 	 * 6 - Driver Unloaded
 	 * 7 - Driver Loaded
 	 * 7 - Driver Loaded
+	 * 8 - bus/link down
+	 * 9 - chip temperature high
 	 *
 	 *
 	 * driverVersion: offset: 2 length: 10
 	 * driverVersion: offset: 2 length: 10
 	 *
 	 *

+ 16 - 1
utils/host_diag_log/src/host_diag_log.c

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * any purpose with or without fee is hereby granted, provided that the
@@ -389,4 +389,19 @@ void host_log_acs_best_chan(uint16_t chan, uint16_t weight)
 				    EVENT_WLAN_ACS_BEST_CHANNEL);
 				    EVENT_WLAN_ACS_BEST_CHANNEL);
 }
 }
 
 
+void host_log_device_status(uint16_t status_code)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(driver_status,
+				 host_event_wlan_bringup_status_payload_type);
+
+	driver_status.wlan_status = status_code;
+
+	/* driver version not used yet, fill properly if need later */
+	qdf_mem_zero(driver_status.driver_version,
+		     sizeof(driver_status.driver_version));
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&driver_status,
+				    EVENT_WLAN_BRINGUP_STATUS);
+}
+
 #endif
 #endif

+ 15 - 1
utils/host_diag_log/src/i_host_diag_core_event.h

@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2014-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2019, 2021 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
  * any purpose with or without fee is hereby granted, provided that the
@@ -233,6 +233,16 @@ void host_log_acs_chan_spect_weight(uint16_t chan, uint16_t weight,
  */
  */
 void host_log_acs_best_chan(uint16_t chan, uint16_t weight);
 void host_log_acs_best_chan(uint16_t chan, uint16_t weight);
 
 
+/**
+ * host_log_device_status() - device status indication
+ * @status_code: status code from enum wlan_bringup_status
+ *
+ * Indicates device status
+ *
+ * Return: None
+ */
+void host_log_device_status(uint16_t status_code);
+
 #else
 #else
 static inline void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause)
 static inline void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause)
 {
 {
@@ -264,6 +274,10 @@ static inline void host_log_acs_chan_spect_weight(uint16_t chan,
 static inline void host_log_acs_best_chan(uint16_t chan, uint32_t weight)
 static inline void host_log_acs_best_chan(uint16_t chan, uint32_t weight)
 {
 {
 }
 }
+
+static inline void host_log_device_status(uint16_t status_code)
+{
+}
 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }