Explorar el Código

qcacmn: Add support for ACS diag event

Add APIs for ACS diag event:

- EVENT_WLAN_ACS_REQ
  ACS request event indication

- EVENT_WLAN_ACS_SCAN_START
  Indicates the diag event for ACS scan start request

- EVENT_WLAN_ACS_SCAN_DONE
  Indicates the diag event for ACS scan done

- EVENT_WLAN_ACS_BEST_CHANNEL
  Indicates the best channel has been selected after ACS

- EVENT_WLAN_ACS_CHANNEL_SPECTRAL_WEIGHTCHAN
  Indicates a diag event for ACS channel weight evaluation result

Change-Id: I508449c597caddba14a49aa9cf5da671b80e5bc4
CRs-Fixed: 2238687
wadesong hace 7 años
padre
commit
0b79d037ff

+ 86 - 0
utils/host_diag_log/inc/host_diag_core_event.h

@@ -881,6 +881,92 @@ enum wake_lock_reason {
 	WIFI_POWER_EVENT_WAKELOCK_MONITOR_MODE,
 };
 
+/* The length of interface name should >= IFNAMSIZ */
+#define HOST_EVENT_INTF_STR_LEN 16
+#define HOST_EVENT_HW_MODE_STR_LEN 12
+
+/**
+ * struct host_event_wlan_acs_req - payload for ACS diag event
+ * @intf: network interface name for WLAN
+ * @hw_mode: hw mode configured by hostapd
+ * @bw: channel bandwidth(MHz)
+ * @ht: a flag indicating whether HT phy mode is enabled
+ * @vht: a flag indicating whether VHT phy mode is enabled
+ * @chan_start: starting channel number for ACS scan
+ * @chan_end: ending channel number for ACS scan
+ *
+ * This structure includes all the payload related to ACS request parameters
+ */
+struct host_event_wlan_acs_req {
+	uint8_t intf[HOST_EVENT_INTF_STR_LEN];
+	uint8_t hw_mode[HOST_EVENT_HW_MODE_STR_LEN];
+	uint16_t bw;
+	uint8_t ht;
+	uint8_t vht;
+	uint16_t chan_start;
+	uint16_t chan_end;
+};
+
+/**
+ * struct host_event_wlan_acs_scan_start - payload for ACS scan request
+ * @scan_id: scan request ID
+ * @vdev_id: vdev/session ID
+ *
+ * This structure includes all the payload related to ACS scan request
+ * parameters
+ */
+struct host_event_wlan_acs_scan_start {
+	uint32_t scan_id;
+	uint8_t vdev_id;
+};
+
+#define HOST_EVENT_STATUS_STR_LEN 24
+
+/**
+ * struct host_event_wlan_acs_scan_done - payload for ACS scan done event
+ * @status: indicating whether ACS scan is successful
+ * @vdev_id: vdev/session ID
+ * @scan_id: scan request ID
+ *
+ * This structure includes all the payload related to ACS scan done event
+ */
+struct host_event_wlan_acs_scan_done {
+	uint8_t status[HOST_EVENT_STATUS_STR_LEN];
+	uint32_t scan_id;
+	uint8_t vdev_id;
+};
+
+/**
+ * struct host_event_wlan_acs_chan_spectral_weight - payload for spectral
+ * weight event indication
+ * @chan: channel number
+ * @weight: channel weight
+ * @rssi: RSSI value obtained after scanning
+ * @bss_count: number of BSS detected on this channel
+ *
+ * This structure includes all the payload related to a channel's weight
+ * evaluation result
+ */
+struct host_event_wlan_acs_chan_spectral_weight {
+	uint16_t chan;
+	uint16_t weight;
+	int32_t rssi;
+	uint16_t bss_count;
+};
+
+/**
+ * struct host_event_wlan_acs_best_chan - payload for ACS best channel event
+ * @chan: channel number
+ * @weight: channel weight
+ *
+ * This structure includes all the payload related to the best channel
+ * selected after ACS procedure
+ */
+struct host_event_wlan_acs_best_chan {
+	uint16_t chan;
+	uint16_t weight;
+};
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

+ 5 - 0
utils/host_diag_log/inc/host_diag_event_defs.h

@@ -886,6 +886,11 @@ typedef enum {
 	 */
 
 	EVENT_WLAN_SSR_SHUTDOWN_SUBSYSTEM = 0xB3D,
+	EVENT_WLAN_ACS_REQ = 0xC4A,
+	EVENT_WLAN_ACS_SCAN_START = 0xC4B,
+	EVENT_WLAN_ACS_SCAN_DONE = 0xC4C,
+	EVENT_WLAN_ACS_CHANNEL_SPECTRAL_WEIGHT = 0xC4D,
+	EVENT_WLAN_ACS_BEST_CHANNEL = 0xC4E,
 	EVENT_WLAN_HOST_MGMT_TX_V2 = 0xC52,
 	EVENT_WLAN_HOST_MGMT_RX_V2 = 0xC53,
 	EVENT_WLAN_CONN_STATS_V2 = 0xC56,

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

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -33,6 +33,7 @@
 #include "wlan_nlink_srv.h"
 #include "cds_api.h"
 #include "wlan_ps_wow_diag.h"
+#include "qdf_str.h"
 
 #define PTT_MSG_DIAG_CMDS_TYPE   (0x5050)
 
@@ -294,4 +295,75 @@ void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause)
 	WLAN_HOST_DIAG_EVENT_REPORT(&wowRequest,
 		EVENT_WLAN_POWERSAVE_WOW);
 }
+
+void host_log_acs_req_event(uint8_t *intf, const uint8_t *hw_mode, uint16_t bw,
+			    uint8_t ht, uint8_t vht, uint16_t chan_start,
+			    uint16_t chan_end)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(acs_req, struct host_event_wlan_acs_req);
+
+	qdf_str_lcopy(acs_req.intf, intf, HOST_EVENT_INTF_STR_LEN);
+	qdf_str_lcopy(acs_req.hw_mode, hw_mode, HOST_EVENT_HW_MODE_STR_LEN);
+	acs_req.bw = bw;
+	acs_req.ht = ht;
+	acs_req.vht = vht;
+	acs_req.chan_start = chan_start;
+	acs_req.chan_end = chan_end;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&acs_req, EVENT_WLAN_ACS_REQ);
+}
+
+void host_log_acs_scan_start(uint32_t scan_id, uint8_t vdev_id)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(acs_scan_start,
+				 struct host_event_wlan_acs_scan_start);
+
+	acs_scan_start.scan_id = scan_id;
+	acs_scan_start.vdev_id = vdev_id;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&acs_scan_start,
+				    EVENT_WLAN_ACS_SCAN_START);
+}
+
+void host_log_acs_scan_done(const uint8_t *status,
+			    uint8_t vdev_id, uint32_t scan_id)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(acs_scan_done,
+				 struct host_event_wlan_acs_scan_done);
+
+	qdf_str_lcopy(acs_scan_done.status, status, HOST_EVENT_STATUS_STR_LEN);
+	acs_scan_done.vdev_id = vdev_id;
+	acs_scan_done.scan_id = scan_id;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&acs_scan_done, EVENT_WLAN_ACS_SCAN_DONE);
+}
+
+void host_log_acs_chan_spect_weight(uint16_t chan, uint16_t weight,
+				    int32_t rssi, uint16_t bss_count)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(
+		acs_chan_spect_weight,
+		struct host_event_wlan_acs_chan_spectral_weight);
+
+	acs_chan_spect_weight.chan = chan;
+	acs_chan_spect_weight.weight = weight;
+	acs_chan_spect_weight.rssi = rssi;
+	acs_chan_spect_weight.bss_count = bss_count;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&acs_chan_spect_weight,
+				    EVENT_WLAN_ACS_CHANNEL_SPECTRAL_WEIGHT);
+}
+
+void host_log_acs_best_chan(uint16_t chan, uint16_t weight)
+{
+	WLAN_HOST_DIAG_EVENT_DEF(acs_best_chan,
+				 struct host_event_wlan_acs_best_chan);
+
+	acs_best_chan.chan = chan;
+	acs_best_chan.weight = weight;
+
+	WLAN_HOST_DIAG_EVENT_REPORT(&acs_best_chan,
+				    EVENT_WLAN_ACS_BEST_CHANNEL);
+}
+
 #endif

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

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -108,11 +108,109 @@ static inline void host_log_low_resource_failure(uint8_t event_sub_type)
 
 #ifdef FEATURE_WLAN_DIAG_SUPPORT
 void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause);
+
+/**
+ * host_log_acs_req_event() - ACS request event indication
+ * @intf: network interface name for WLAN
+ * @hw_mode: hw mode configured by hostapd
+ * @bw: channel bandwidth (MHz)
+ * @ht: a flag indicating whether HT phy mode is enabled
+ * @vht: a flag indicating whether VHT phy mode is enabled
+ * @chan_start: starting channel number for ACS scan
+ * @chan_end: ending channel number for ACS scan
+ *
+ * Indicates the diag event for ACS request with payload related
+ * to parameters populated by hostapd
+ *
+ * Return: None
+ */
+void host_log_acs_req_event(uint8_t *intf, const uint8_t *hw_mode,
+			    uint16_t bw, uint8_t ht, uint8_t vht,
+			    uint16_t chan_start, uint16_t chan_end);
+
+/**
+ * host_log_acs_scan_start() - ACS scan start event indication
+ * @scan_id: scan request ID
+ * @vdev_id: vdev/session ID
+ *
+ * Indicates the diag event for ACS scan start request
+ *
+ * Return: None
+ */
+void host_log_acs_scan_start(uint32_t scan_id, uint8_t vdev_id);
+
+/**
+ * host_log_acs_scan_done() - ACS scan done event indication
+ * @status: indicating whether ACS scan is successful
+ * @vdev_id: vdev/session ID
+ * @scan_id: scan request ID
+ *
+ * Indicates the diag event for ACS scan done
+ *
+ * Return: None
+ */
+void host_log_acs_scan_done(const uint8_t *status, uint8_t vdev_id,
+			    uint32_t scan_id);
+
+/**
+ * host_log_acs_chan_spect_weight() - ACS channel spectral weight indication
+ * weight event indication
+ * @chan: channel number
+ * @weight: channel weight
+ * @rssi: RSSI value obtained after scanning
+ * @bss_count: number of BSS detected on this channel
+ *
+ * Indicates a diag event for ACS channel weight evaluation result
+ *
+ * Return: None
+ */
+void host_log_acs_chan_spect_weight(uint16_t chan, uint16_t weight,
+				    int32_t rssi, uint16_t bss_count);
+
+/**
+ * host_log_acs_best_chan() - ACS best channel event indication
+ * @chan: channel number
+ * @weight: channel weight
+ *
+ * Indicates the best channel has been selected after ACS
+ *
+ * Return: None
+ */
+void host_log_acs_best_chan(uint16_t chan, uint16_t weight);
+
 #else
 static inline void qdf_wow_wakeup_host_event(uint8_t wow_wakeup_cause)
 {
 	return;
 }
+
+static inline void host_log_acs_req_event(uint8_t *intf, uint8_t *hw_mode,
+					  uint16_t bw, uint8_t ht, uint8_t vht,
+					  uint16_t chan_start,
+					  uint16_t chan_end)
+{
+}
+
+static inline void host_log_acs_scan_start(uint8_t *scan_type,
+					   uint8_t *bss_type, uint32_t scan_id,
+					   uint8_t vdev_id)
+{
+}
+
+static inline void host_log_acs_scan_done(const uint8_t *status,
+					  uint8_t vdev_id, uint32_t scan_id)
+{
+}
+
+static inline void host_log_acs_chan_spect_weight(uint16_t chan,
+						  uint16_t weight, int32_t rssi,
+						  uint16_t bss_count)
+{
+}
+
+static inline void host_log_acs_best_chan(uint16_t chan, uint32_t weight)
+{
+}
 #endif /* FEATURE_WLAN_DIAG_SUPPORT */
 #ifdef __cplusplus
 }