All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ath11k: cleanup in htt pktlog
@ 2019-06-12 10:29 Anilkumar Kolli
  2019-06-17  8:03 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Anilkumar Kolli @ 2019-06-12 10:29 UTC (permalink / raw)
  To: ath11k

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(-)

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;
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] ath11k: cleanup in htt pktlog
  2019-06-12 10:29 [PATCH v2] ath11k: cleanup in htt pktlog Anilkumar Kolli
@ 2019-06-17  8:03 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2019-06-17  8:03 UTC (permalink / raw)
  To: Anilkumar Kolli; +Cc: ath11k

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

-- 
https://patchwork.kernel.org/patch/10989367/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-17  8:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 10:29 [PATCH v2] ath11k: cleanup in htt pktlog Anilkumar Kolli
2019-06-17  8:03 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.