diff mbox series

[v2] ath11k: cleanup in htt pktlog

Message ID 1560335345-13626-1-git-send-email-akolli@codeaurora.org (mailing list archive)
State Accepted
Commit 3fb4abcf11d6c12a5da2d0ad1c989a9819e66adc
Delegated to: Kalle Valo
Headers show
Series [v2] ath11k: cleanup in htt pktlog | expand

Commit Message

Anilkumar Kolli June 12, 2019, 10:29 a.m. UTC
Addressed below comments,
* debug: move enum ath11k_wmi_pktlog_enable to wmi.h
* dp_rx: ath11k_htt_pktlog(): 'u32 *data' needs a proper struct,
  avoids pointer arithmetic.

Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
---
V2:
  - addressed sathish's comments
 
 drivers/net/wireless/ath/ath11k/debug.h |  5 -----
 drivers/net/wireless/ath/ath11k/dp.h    | 39 +++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath11k/dp_rx.c | 10 ++++-----
 drivers/net/wireless/ath/ath11k/wmi.h   |  5 +++++
 4 files changed, 49 insertions(+), 10 deletions(-)

Comments

Kalle Valo June 17, 2019, 8:03 a.m. UTC | #1
Anilkumar Kolli <akolli@codeaurora.org> wrote:

> Addressed below comments,
> * debug: move enum ath11k_wmi_pktlog_enable to wmi.h
> * dp_rx: ath11k_htt_pktlog(): 'u32 *data' needs a proper struct,
>   avoids pointer arithmetic.
> 
> Signed-off-by: Anilkumar Kolli <akolli@codeaurora.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath11k-bringup branch of ath.git, thanks.

3fb4abcf11d6 ath11k: cleanup in htt pktlog
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h
index 13973d972169..5774f531f268 100644
--- a/drivers/net/wireless/ath/ath11k/debug.h
+++ b/drivers/net/wireless/ath/ath11k/debug.h
@@ -80,11 +80,6 @@  enum ath11k_pktlog_filter {
 	ATH11K_PKTLOG_ANY		= 0x00000006f,
 };
 
-enum ath11k_wmi_pktlog_enable {
-    ATH11K_WMI_PKTLOG_ENABLE_AUTO  = 0,
-    ATH11K_WMI_PKTLOG_ENABLE_FORCE = 1,
-};
-
 enum ath11k_pktlog_mode {
 	ATH11K_PKTLOG_MODE_LITE = 1,
 	ATH11K_PKTLOG_MODE_FULL = 2,
diff --git a/drivers/net/wireless/ath/ath11k/dp.h b/drivers/net/wireless/ath/ath11k/dp.h
index 79b665816378..a4b32abbeaee 100644
--- a/drivers/net/wireless/ath/ath11k/dp.h
+++ b/drivers/net/wireless/ath/ath11k/dp.h
@@ -1214,6 +1214,45 @@  struct htt_ppdu_stats_info {
 };
 
 /**
+ * @brief target -> host packet log message
+ *
+ * @details
+ * The following field definitions describe the format of the packet log
+ * message sent from the target to the host.
+ * The message consists of a 4-octet header,followed by a variable number
+ * of 32-bit character values.
+ *
+ * |31                         16|15  12|11   10|9    8|7            0|
+ * |------------------------------------------------------------------|
+ * |        payload_size         | rsvd |pdev_id|mac_id|   msg type   |
+ * |------------------------------------------------------------------|
+ * |                              payload                             |
+ * |------------------------------------------------------------------|
+ *   - MSG_TYPE
+ *     Bits 7:0
+ *     Purpose: identifies this as a pktlog message
+ *     Value: HTT_T2H_MSG_TYPE_PKTLOG
+ *   - mac_id
+ *     Bits 9:8
+ *     Purpose: identifies which MAC/PHY instance generated this pktlog info
+ *     Value: 0-3
+ *   - pdev_id
+ *     Bits 11:10
+ *     Purpose: pdev_id
+ *     Value: 0-3
+ *     0 (for rings at SOC level),
+ *     1/2/3 PDEV -> 0/1/2
+ *   - payload_size
+ *     Bits 31:16
+ *     Purpose: explicitly specify the payload size
+ *     Value: payload size in bytes (payload size is a multiple of 4 bytes)
+ */
+struct htt_pktlog_msg {
+	u32 hdr;
+	u8 payload[0];
+};
+
+/**
  * @brief host -> target FW extended statistics retrieve
  *
  * @details
diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c
index 59d2605c0ce2..e18ca4c0cda4 100644
--- a/drivers/net/wireless/ath/ath11k/dp_rx.c
+++ b/drivers/net/wireless/ath/ath11k/dp_rx.c
@@ -1084,11 +1084,12 @@  static int ath11k_htt_pull_ppdu_stats(struct ath11k_base *ab,
 static void ath11k_htt_pktlog(struct ath11k_base *ab,
 				     struct sk_buff *skb)
 {
-	u32 *data = (u32 *)skb->data, len;
+	struct htt_pktlog_msg *data = (struct htt_pktlog_msg *)skb->data;
 	struct ath11k *ar;
+	u32 len;
 	u8 pdev_id;
 
-	len = FIELD_GET(HTT_T2H_PPDU_STATS_PAYLOAD_SIZE_M, *data);
+	len = FIELD_GET(HTT_T2H_PPDU_STATS_PAYLOAD_SIZE_M, data->hdr);
 
 	if (len > ATH11K_HTT_PKTLOG_MAX_SIZE)
 	{
@@ -1098,12 +1099,11 @@  static void ath11k_htt_pktlog(struct ath11k_base *ab,
 		return;
 	}
 
-	pdev_id = FIELD_GET(HTT_T2H_PPDU_STATS_PDEV_ID_M, *data);
+	pdev_id = FIELD_GET(HTT_T2H_PPDU_STATS_PDEV_ID_M, data->hdr);
 	pdev_id = DP_HW2SW_MACID(pdev_id);
 	ar = ab->pdevs[pdev_id].ar;
-	++data;
 
-	trace_ath11k_htt_pktlog(ar, data, len);
+	trace_ath11k_htt_pktlog(ar, data->payload, len);
 }
 
 void ath11k_dp_htt_htc_t2h_msg_handler(struct ath11k_base *ab,
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index f30542e2d090..d5b3de2e7e87 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -4148,6 +4148,11 @@  struct wmi_pdev_pktlog_filter_cmd {
 	u32 num_mac;
 } __packed;
 
+enum ath11k_wmi_pktlog_enable {
+	ATH11K_WMI_PKTLOG_ENABLE_AUTO  = 0,
+	ATH11K_WMI_PKTLOG_ENABLE_FORCE = 1,
+};
+
 struct wmi_pktlog_enable_cmd {
 	u32 tlv_header;
 	u32 pdev_id;