linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] ath10k: Add pktlog support
@ 2014-10-02 17:09 Rajkumar Manoharan
  2014-10-02 17:09 ` [PATCH v2 1/4] ath10k: Add support to configure pktlog filter Rajkumar Manoharan
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Rajkumar Manoharan @ 2014-10-02 17:09 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Rajkumar Manoharan

This implements the Packet log feature for ath10k.
All tx and rx events and rx descriptor details are
posted to user space by tracepoints.

v2: Addressed review comments and based on discussion with Michal
    dropped tx_msdu_id patch and added tx info changes

Rajkumar Manoharan (4):
  ath10k: Add support to configure pktlog filter
  ath10k: add tracing for ath10k_htt_pktlog
  ath10k: add tracing for rx descriptor
  ath10k: add tracing for tx msdu pktlog event

 drivers/net/wireless/ath/ath10k/core.h   |  2 +
 drivers/net/wireless/ath/ath10k/debug.c  | 80 +++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/debug.h  | 15 +++++-
 drivers/net/wireless/ath/ath10k/htt.h    |  2 +-
 drivers/net/wireless/ath/ath10k/htt_rx.c | 47 +++++++++++++++++
 drivers/net/wireless/ath/ath10k/hw.h     | 35 +++++++++++++
 drivers/net/wireless/ath/ath10k/trace.h  | 89 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c    | 33 ++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h    |  6 +++
 9 files changed, 306 insertions(+), 3 deletions(-)

-- 
2.1.1


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

* [PATCH v2 1/4] ath10k: Add support to configure pktlog filter
  2014-10-02 17:09 [PATCH v2 0/4] ath10k: Add pktlog support Rajkumar Manoharan
@ 2014-10-02 17:09 ` Rajkumar Manoharan
  2014-10-06 11:52   ` Kalle Valo
  2014-10-02 17:09 ` [PATCH v2 2/4] ath10k: add tracing for ath10k_htt_pktlog Rajkumar Manoharan
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Rajkumar Manoharan @ 2014-10-02 17:09 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Rajkumar Manoharan

Add support to configure packet log filters (tx, rx, rate control)
via debugfs. To disable htt pktlog events set the filters to 0.

ex:

To enable pktlog for all filters

   echo 0x1f > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter

To disable pktlog

   echo 0 > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/core.h  |  2 +
 drivers/net/wireless/ath/ath10k/debug.c | 72 ++++++++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath10k/debug.h |  9 +++++
 drivers/net/wireless/ath/ath10k/wmi.c   | 33 +++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.h   |  6 +++
 5 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index 674e38c..f361226 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -302,7 +302,9 @@ struct ath10k_debug {
 	struct ath10k_dfs_stats dfs_stats;
 	struct ath_dfs_pool_stats dfs_pool_stats;
 
+	/* protected by conf_mutex */
 	u32 fw_dbglog_mask;
+	u32 pktlog_filter;
 
 	u8 htt_max_amsdu;
 	u8 htt_max_ampdu;
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index 680d508..22213f6 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1195,7 +1195,17 @@ int ath10k_debug_start(struct ath10k *ar)
 				    ret);
 	}
 
-	return 0;
+	if (ar->debug.pktlog_filter)
+		ret = ath10k_wmi_pdev_pktlog_enable(ar,
+						    ar->debug.pktlog_filter);
+	else
+		ret = ath10k_wmi_pdev_pktlog_disable(ar);
+
+	if (ret)
+		ath10k_warn(ar, "failed to send pktlog command: %d filter %x",
+			    ret, ar->debug.pktlog_filter);
+
+	return ret;
 }
 
 void ath10k_debug_stop(struct ath10k *ar)
@@ -1210,6 +1220,8 @@ void ath10k_debug_stop(struct ath10k *ar)
 
 	ar->debug.htt_max_amsdu = 0;
 	ar->debug.htt_max_ampdu = 0;
+
+	ath10k_wmi_pdev_pktlog_disable(ar);
 }
 
 static ssize_t ath10k_write_simulate_radar(struct file *file,
@@ -1292,6 +1304,61 @@ static const struct file_operations fops_dfs_stats = {
 	.llseek = default_llseek,
 };
 
+static ssize_t ath10k_write_pktlog_filter(struct file *file,
+					  const char __user *ubuf,
+					  size_t count, loff_t *ppos)
+{
+	struct ath10k *ar = file->private_data;
+	u32 filter;
+	int ret;
+
+	if (kstrtouint_from_user(ubuf, count, 0, &filter))
+		return -EINVAL;
+
+	mutex_lock(&ar->conf_mutex);
+
+	if (ar->state != ATH10K_STATE_ON) {
+		ar->debug.pktlog_filter = filter;
+		mutex_unlock(&ar->conf_mutex);
+		return count;
+	}
+
+	if (filter && (filter != ar->debug.pktlog_filter))
+		ret = ath10k_wmi_pdev_pktlog_enable(ar, filter);
+	else
+		ret = ath10k_wmi_pdev_pktlog_disable(ar);
+
+	ar->debug.pktlog_filter = filter;
+	mutex_unlock(&ar->conf_mutex);
+
+	if (ret)
+		ath10k_warn(ar, "failed to send pktlog command: %d filter %x",
+			    ret, ar->debug.pktlog_filter);
+
+	return count;
+}
+
+static ssize_t ath10k_read_pktlog_filter(struct file *file, char __user *ubuf,
+					 size_t count, loff_t *ppos)
+{
+	char buf[32];
+	struct ath10k *ar = file->private_data;
+	int len = 0;
+
+	mutex_lock(&ar->conf_mutex);
+	len = scnprintf(buf, sizeof(buf) - len, "%08x\n",
+			ar->debug.pktlog_filter);
+	mutex_unlock(&ar->conf_mutex);
+
+	return simple_read_from_buffer(ubuf, count, ppos, buf, len);
+}
+
+static const struct file_operations fops_pktlog_filter = {
+	.read = ath10k_read_pktlog_filter,
+	.write = ath10k_write_pktlog_filter,
+	.open = simple_open
+};
+
 int ath10k_debug_create(struct ath10k *ar)
 {
 	ar->debug.fw_crash_data = vzalloc(sizeof(*ar->debug.fw_crash_data));
@@ -1370,6 +1437,9 @@ int ath10k_debug_register(struct ath10k *ar)
 				    &fops_dfs_stats);
 	}
 
+	debugfs_create_file("pktlog_filter", S_IRUGO | S_IWUSR,
+			    ar->debug.debugfs_phy, ar, &fops_pktlog_filter);
+
 	return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index efbcd29..794e6bb 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -38,6 +38,15 @@ enum ath10k_debug_mask {
 	ATH10K_DBG_ANY		= 0xffffffff,
 };
 
+enum ath10k_pktlog_filter {
+	ATH10K_PKTLOG_RX         = 0x000000001,
+	ATH10K_PKTLOG_TX         = 0x000000002,
+	ATH10K_PKTLOG_RCFIND     = 0x000000004,
+	ATH10K_PKTLOG_RCUPDATE   = 0x000000008,
+	ATH10K_PKTLOG_DBG_PRINT  = 0x000000010,
+	ATH10K_PKTLOG_ANY        = 0x00000001f,
+};
+
 extern unsigned int ath10k_debug_mask;
 
 __printf(2, 3) void ath10k_info(struct ath10k *ar, const char *fmt, ...);
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index f65032f..c145b98 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4345,6 +4345,39 @@ int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable)
 	return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->dbglog_cfg_cmdid);
 }
 
+int ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 ev_bitmap)
+{
+	struct wmi_pdev_pktlog_enable_cmd *cmd;
+	struct sk_buff *skb;
+
+	skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+	if (!skb)
+		return -ENOMEM;
+
+	ev_bitmap &= ATH10K_PKTLOG_ANY;
+	ath10k_dbg(ar, ATH10K_DBG_WMI,
+		   "wmi enable pktlog filter:%x\n", ev_bitmap);
+
+	cmd = (struct wmi_pdev_pktlog_enable_cmd *)skb->data;
+	cmd->ev_bitmap = __cpu_to_le32(ev_bitmap);
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->pdev_pktlog_enable_cmdid);
+}
+
+int ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar)
+{
+	struct sk_buff *skb;
+
+	skb = ath10k_wmi_alloc_skb(ar, 0);
+	if (!skb)
+		return -ENOMEM;
+
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi disable pktlog\n");
+
+	return ath10k_wmi_cmd_send(ar, skb,
+				   ar->wmi.cmd->pdev_pktlog_disable_cmdid);
+}
+
 int ath10k_wmi_attach(struct ath10k *ar)
 {
 	if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 6243dbe..a38d788 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -2787,6 +2787,10 @@ struct wmi_pdev_set_channel_cmd {
 	struct wmi_channel chan;
 } __packed;
 
+struct wmi_pdev_pktlog_enable_cmd {
+	__le32 ev_bitmap;
+} __packed;
+
 /* Customize the DSCP (bit) to TID (0-7) mapping for QOS */
 #define WMI_DSCP_MAP_MAX    (64)
 struct wmi_pdev_set_dscp_tid_map_cmd {
@@ -4647,5 +4651,7 @@ int ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *skb);
 int ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable);
 int ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb,
 			     struct ath10k_fw_stats *stats);
+int ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 ev_list);
+int ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar);
 
 #endif /* _WMI_H_ */
-- 
2.1.1


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

* [PATCH v2 2/4] ath10k: add tracing for ath10k_htt_pktlog
  2014-10-02 17:09 [PATCH v2 0/4] ath10k: Add pktlog support Rajkumar Manoharan
  2014-10-02 17:09 ` [PATCH v2 1/4] ath10k: Add support to configure pktlog filter Rajkumar Manoharan
@ 2014-10-02 17:09 ` Rajkumar Manoharan
  2014-10-02 17:09 ` [PATCH v2 3/4] ath10k: add tracing for rx descriptor Rajkumar Manoharan
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Rajkumar Manoharan @ 2014-10-02 17:09 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Rajkumar Manoharan

This is useful for collecting pktlog statistics of tx, rx
and rate information, so add tracing for the API call.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/debug.h  |  1 -
 drivers/net/wireless/ath/ath10k/htt.h    |  2 +-
 drivers/net/wireless/ath/ath10k/htt_rx.c |  9 +++++++++
 drivers/net/wireless/ath/ath10k/hw.h     |  9 +++++++++
 drivers/net/wireless/ath/ath10k/trace.h  | 27 +++++++++++++++++++++++++++
 5 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h b/drivers/net/wireless/ath/ath10k/debug.h
index 794e6bb..aafdcab 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -69,7 +69,6 @@ struct ath10k_fw_crash_data *
 ath10k_debug_get_new_fw_crash_data(struct ath10k *ar);
 
 void ath10k_debug_dbglog_add(struct ath10k *ar, u8 *buffer, int len);
-
 #define ATH10K_DFS_STAT_INC(ar, c) (ar->debug.dfs_stats.c++)
 
 #else
diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h
index 3b44217..15c58e8 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -725,7 +725,7 @@ static inline u8 *htt_rx_test_get_chars(struct htt_rx_test *rx_test)
  */
 struct htt_pktlog_msg {
 	u8 pad[3];
-	__le32 payload[1 /* or more */];
+	u8 payload[0];
 } __packed;
 
 struct htt_dbg_stats_rx_reorder_stats {
diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 60d40a0..a078451 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -1674,6 +1674,15 @@ void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb)
 	case HTT_T2H_MSG_TYPE_RX_DELBA:
 		ath10k_htt_rx_delba(ar, resp);
 		break;
+	case HTT_T2H_MSG_TYPE_PKTLOG: {
+		struct ath10k_pktlog_hdr *hdr =
+			(struct ath10k_pktlog_hdr *)resp->pktlog_msg.payload;
+
+		trace_ath10k_htt_pktlog(ar, resp->pktlog_msg.payload,
+					sizeof(*hdr) +
+					__le16_to_cpu(hdr->size));
+		break;
+	}
 	case HTT_T2H_MSG_TYPE_RX_FLUSH: {
 		/* Ignore this event because mac80211 takes care of Rx
 		 * aggregation reordering.
diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h
index 006a9cb..4b86ca3 100644
--- a/drivers/net/wireless/ath/ath10k/hw.h
+++ b/drivers/net/wireless/ath/ath10k/hw.h
@@ -80,6 +80,15 @@ enum ath10k_mcast2ucast_mode {
 	ATH10K_MCAST2UCAST_ENABLED = 1,
 };
 
+struct ath10k_pktlog_hdr {
+	__le16 flags;
+	__le16 missed_cnt;
+	__le16 log_type;
+	__le16 size;
+	__le32 timestamp;
+	u8 payload[0];
+} __packed;
+
 /* Target specific defines for MAIN firmware */
 #define TARGET_NUM_VDEVS			8
 #define TARGET_NUM_PEER_AST			2
diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index 574b75a..971ff23 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -254,6 +254,33 @@ TRACE_EVENT(ath10k_wmi_dbglog,
 	)
 );
 
+TRACE_EVENT(ath10k_htt_pktlog,
+	    TP_PROTO(struct ath10k *ar, void *buf, u16 buf_len),
+
+	TP_ARGS(ar, buf, buf_len),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(ar->dev))
+		__string(driver, dev_driver_string(ar->dev))
+		__field(u16, buf_len)
+		__dynamic_array(u8, pktlog, buf_len)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(ar->dev));
+		__assign_str(driver, dev_driver_string(ar->dev));
+		__entry->buf_len = buf_len;
+		memcpy(__get_dynamic_array(pktlog), buf, buf_len);
+	),
+
+	TP_printk(
+		"%s %s size %hu",
+		__get_str(driver),
+		__get_str(device),
+		__entry->buf_len
+	 )
+);
+
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
-- 
2.1.1


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

* [PATCH v2 3/4] ath10k: add tracing for rx descriptor
  2014-10-02 17:09 [PATCH v2 0/4] ath10k: Add pktlog support Rajkumar Manoharan
  2014-10-02 17:09 ` [PATCH v2 1/4] ath10k: Add support to configure pktlog filter Rajkumar Manoharan
  2014-10-02 17:09 ` [PATCH v2 2/4] ath10k: add tracing for ath10k_htt_pktlog Rajkumar Manoharan
@ 2014-10-02 17:09 ` Rajkumar Manoharan
  2014-10-02 17:09 ` [PATCH v2 4/4] ath10k: add tracing for tx info Rajkumar Manoharan
  2014-10-07 14:15 ` [PATCH v2 0/4] ath10k: Add pktlog support Kalle Valo
  4 siblings, 0 replies; 9+ messages in thread
From: Rajkumar Manoharan @ 2014-10-02 17:09 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Rajkumar Manoharan

Upon the reception of frame, the descriptor status are reported
to user space by tracepoint. This is useful for collecting rx
statistics.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |  4 ++++
 drivers/net/wireless/ath/ath10k/trace.h  | 29 +++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index a078451..7add88e 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -316,6 +316,7 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
 	int msdu_len, msdu_chaining = 0;
 	struct sk_buff *msdu, *next;
 	struct htt_rx_desc *rx_desc;
+	u32 tsf;
 
 	lockdep_assert_held(&htt->rx_ring.lock);
 
@@ -447,6 +448,9 @@ static int ath10k_htt_rx_amsdu_pop(struct ath10k_htt *htt,
 		last_msdu = __le32_to_cpu(rx_desc->msdu_end.info0) &
 				RX_MSDU_END_INFO0_LAST_MSDU;
 
+		tsf = __le32_to_cpu(rx_desc->ppdu_end.tsf_timestamp);
+		trace_ath10k_htt_rx_desc(ar, tsf, &rx_desc->attention,
+					 sizeof(*rx_desc) - sizeof(u32));
 		if (last_msdu) {
 			msdu->next = NULL;
 			break;
diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index 971ff23..3841667 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -281,6 +281,35 @@ TRACE_EVENT(ath10k_htt_pktlog,
 	 )
 );
 
+TRACE_EVENT(ath10k_htt_rx_desc,
+	    TP_PROTO(struct ath10k *ar, u32 tsf, void *rxdesc, u16 len),
+
+	TP_ARGS(ar, tsf, rxdesc, len),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(ar->dev))
+		__string(driver, dev_driver_string(ar->dev))
+		__field(u32, tsf)
+		__field(u16, len)
+		__dynamic_array(u8, rxdesc, len)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(ar->dev));
+		__assign_str(driver, dev_driver_string(ar->dev));
+		__entry->tsf = tsf;
+		__entry->len = len;
+		memcpy(__get_dynamic_array(rxdesc), rxdesc, len);
+	),
+
+	TP_printk(
+		"%s %s %u len %hu",
+		__get_str(driver),
+		__get_str(device),
+		__entry->tsf,
+		__entry->len
+	 )
+);
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
-- 
2.1.1


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

* [PATCH v2 4/4] ath10k: add tracing for tx info
  2014-10-02 17:09 [PATCH v2 0/4] ath10k: Add pktlog support Rajkumar Manoharan
                   ` (2 preceding siblings ...)
  2014-10-02 17:09 ` [PATCH v2 3/4] ath10k: add tracing for rx descriptor Rajkumar Manoharan
@ 2014-10-02 17:09 ` Rajkumar Manoharan
  2014-10-07 14:15 ` [PATCH v2 0/4] ath10k: Add pktlog support Kalle Valo
  4 siblings, 0 replies; 9+ messages in thread
From: Rajkumar Manoharan @ 2014-10-02 17:09 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Rajkumar Manoharan

The tx info such as msdu_id, frame len, vdev id and tid are reported
to user space by tracepoint. This is useful for collecting tx
statistics.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
---
 drivers/net/wireless/ath/ath10k/htt_tx.c |  1 +
 drivers/net/wireless/ath/ath10k/trace.h  | 60 ++++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/txrx.c   |  1 +
 3 files changed, 62 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index bd87a35..fdfb171 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -557,6 +557,7 @@ int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *msdu)
 	skb_cb->htt.txbuf->cmd_tx.frags_paddr = __cpu_to_le32(frags_paddr);
 	skb_cb->htt.txbuf->cmd_tx.peerid = __cpu_to_le32(HTT_INVALID_PEERID);
 
+	trace_ath10k_htt_tx(ar, msdu_id, msdu->len, vdev_id, tid);
 	ath10k_dbg(ar, ATH10K_DBG_HTT,
 		   "htt tx flags0 %hhu flags1 %hu len %d id %hu frags_paddr %08x, msdu_paddr %08x vdev %hhu tid %hhu\n",
 		   flags0, flags1, msdu->len, msdu_id, frags_paddr,
diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index 3841667..33b9bf4 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -310,6 +310,66 @@ TRACE_EVENT(ath10k_htt_rx_desc,
 		__entry->len
 	 )
 );
+
+TRACE_EVENT(ath10k_htt_tx,
+	    TP_PROTO(struct ath10k *ar, u16 msdu_id, u16 msdu_len,
+		     u8 vdev_id, u8 tid),
+
+	TP_ARGS(ar, msdu_id, msdu_len, vdev_id, tid),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(ar->dev))
+		__string(driver, dev_driver_string(ar->dev))
+		__field(u16, msdu_id)
+		__field(u16, msdu_len)
+		__field(u8, vdev_id)
+		__field(u8, tid)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(ar->dev));
+		__assign_str(driver, dev_driver_string(ar->dev));
+		__entry->msdu_id = msdu_id;
+		__entry->msdu_len = msdu_len;
+		__entry->vdev_id = vdev_id;
+		__entry->tid = tid;
+	),
+
+	TP_printk(
+		"%s %s msdu_id %d msdu_len %d vdev_id %d tid %d",
+		__get_str(driver),
+		__get_str(device),
+		__entry->msdu_id,
+		__entry->msdu_len,
+		__entry->vdev_id,
+		__entry->tid
+	 )
+);
+
+TRACE_EVENT(ath10k_txrx_tx_unref,
+	    TP_PROTO(struct ath10k *ar, u16 msdu_id),
+
+	TP_ARGS(ar, msdu_id),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(ar->dev))
+		__string(driver, dev_driver_string(ar->dev))
+		__field(u16, msdu_id)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(ar->dev));
+		__assign_str(driver, dev_driver_string(ar->dev));
+		__entry->msdu_id = msdu_id;
+	),
+
+	TP_printk(
+		"%s %s msdu_id %d",
+		__get_str(driver),
+		__get_str(device),
+		__entry->msdu_id
+	 )
+);
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c
index a0cbc21..f9c90e3 100644
--- a/drivers/net/wireless/ath/ath10k/txrx.c
+++ b/drivers/net/wireless/ath/ath10k/txrx.c
@@ -78,6 +78,7 @@ void ath10k_txrx_tx_unref(struct ath10k_htt *htt,
 
 	info = IEEE80211_SKB_CB(msdu);
 	memset(&info->status, 0, sizeof(info->status));
+	trace_ath10k_txrx_tx_unref(ar, tx_done->msdu_id);
 
 	if (tx_done->discard) {
 		ieee80211_free_txskb(htt->ar->hw, msdu);
-- 
2.1.1


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

* Re: [PATCH v2 1/4] ath10k: Add support to configure pktlog filter
  2014-10-02 17:09 ` [PATCH v2 1/4] ath10k: Add support to configure pktlog filter Rajkumar Manoharan
@ 2014-10-06 11:52   ` Kalle Valo
  2014-10-06 12:06     ` Rajkumar Manoharan
  0 siblings, 1 reply; 9+ messages in thread
From: Kalle Valo @ 2014-10-06 11:52 UTC (permalink / raw)
  To: Rajkumar Manoharan; +Cc: ath10k, linux-wireless

Rajkumar Manoharan <rmanohar@qti.qualcomm.com> writes:

> Add support to configure packet log filters (tx, rx, rate control)
> via debugfs. To disable htt pktlog events set the filters to 0.
>
> ex:
>
> To enable pktlog for all filters
>
>    echo 0x1f > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter
>
> To disable pktlog
>
>    echo 0 > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter
>
> Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>

I did minor changes to the error handling in
ath10k_write_pktlog_filter() and in ath10k_debug_start(). Diff below and
full commit here:

https://github.com/kvalo/ath/commit/470c43d83b7ee4147dea38a4f7b986070555a032

Please review my changes.

Kalle

diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index a5700a2aff8c..fe71494cefa9 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1396,15 +1396,20 @@ int ath10k_debug_start(struct ath10k *ar)
 				    ret);
 	}
 
-	if (ar->debug.pktlog_filter)
+	if (ar->debug.pktlog_filter) {
 		ret = ath10k_wmi_pdev_pktlog_enable(ar,
 						    ar->debug.pktlog_filter);
-	else
+		if (ret)
+			/* not serious */
+			ath10k_warn(ar,
+				    "failed to enable pktlog filter %x: %d",
+				    ar->debug.pktlog_filter, ret);
+	} else {
 		ret = ath10k_wmi_pdev_pktlog_disable(ar);
-
-	if (ret)
-		ath10k_warn(ar, "failed to send pktlog command: %d filter %x",
-			    ret, ar->debug.pktlog_filter);
+		if (ret)
+			/* not serious */
+			ath10k_warn(ar, "failed to disable pktlog: %d", ret);
+	}
 
 	return ret;
 }
@@ -1520,23 +1525,31 @@ static ssize_t ath10k_write_pktlog_filter(struct file *file,
 
 	if (ar->state != ATH10K_STATE_ON) {
 		ar->debug.pktlog_filter = filter;
-		mutex_unlock(&ar->conf_mutex);
-		return count;
+		ret = count;
+		goto out;
 	}
 
-	if (filter && (filter != ar->debug.pktlog_filter))
+	if (filter && (filter != ar->debug.pktlog_filter)) {
 		ret = ath10k_wmi_pdev_pktlog_enable(ar, filter);
-	else
+		if (ret) {
+			ath10k_warn(ar, "failed to enable pktlog filter %x: %d",
+				    ar->debug.pktlog_filter, ret);
+			goto out;
+		}
+	} else {
 		ret = ath10k_wmi_pdev_pktlog_disable(ar);
+		if (ret) {
+			ath10k_warn(ar, "failed to disable pktlog: %d", ret);
+			goto out;
+		}
+	}
 
 	ar->debug.pktlog_filter = filter;
-	mutex_unlock(&ar->conf_mutex);
-
-	if (ret)
-		ath10k_warn(ar, "failed to send pktlog command: %d filter %x",
-			    ret, ar->debug.pktlog_filter);
+	ret = count;
 
-	return count;
+out:
+	mutex_unlock(&ar->conf_mutex);
+	return ret;
 }
 
 static ssize_t ath10k_read_pktlog_filter(struct file *file, char __user *ubuf,

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

* Re: [PATCH v2 1/4] ath10k: Add support to configure pktlog filter
  2014-10-06 11:52   ` Kalle Valo
@ 2014-10-06 12:06     ` Rajkumar Manoharan
  2014-10-06 12:11       ` Kalle Valo
  0 siblings, 1 reply; 9+ messages in thread
From: Rajkumar Manoharan @ 2014-10-06 12:06 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath10k, linux-wireless

On Mon, Oct 06, 2014 at 02:52:45PM +0300, Kalle Valo wrote:
> Rajkumar Manoharan <rmanohar@qti.qualcomm.com> writes:
> 
> > Add support to configure packet log filters (tx, rx, rate control)
> > via debugfs. To disable htt pktlog events set the filters to 0.
> >
> > ex:
> >
> > To enable pktlog for all filters
> >
> >    echo 0x1f > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter
> >
> > To disable pktlog
> >
> >    echo 0 > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter
> >
> > Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
> 
> I did minor changes to the error handling in
> ath10k_write_pktlog_filter() and in ath10k_debug_start(). Diff below and
> full commit here:
> 
> https://github.com/kvalo/ath/commit/470c43d83b7ee4147dea38a4f7b986070555a032
> 
> Please review my changes.
> 

LGTM. We need Michal's tracepoint changes other than pktlog. I do not have his
latest version of the change.

-Rajkumar

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

* Re: [PATCH v2 1/4] ath10k: Add support to configure pktlog filter
  2014-10-06 12:06     ` Rajkumar Manoharan
@ 2014-10-06 12:11       ` Kalle Valo
  0 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2014-10-06 12:11 UTC (permalink / raw)
  To: Rajkumar Manoharan; +Cc: ath10k, linux-wireless

Rajkumar Manoharan <rmanohar@qti.qualcomm.com> writes:

> On Mon, Oct 06, 2014 at 02:52:45PM +0300, Kalle Valo wrote:
>> Rajkumar Manoharan <rmanohar@qti.qualcomm.com> writes:
>> 
>> > Add support to configure packet log filters (tx, rx, rate control)
>> > via debugfs. To disable htt pktlog events set the filters to 0.
>> >
>> > ex:
>> >
>> > To enable pktlog for all filters
>> >
>> >    echo 0x1f > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter
>> >
>> > To disable pktlog
>> >
>> >    echo 0 > /sys/kernel/debug/ieee80211/phy*/ath10k/pktlog_filter
>> >
>> > Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
>> 
>> I did minor changes to the error handling in
>> ath10k_write_pktlog_filter() and in ath10k_debug_start(). Diff below and
>> full commit here:
>> 
>> https://github.com/kvalo/ath/commit/470c43d83b7ee4147dea38a4f7b986070555a032
>> 
>> Please review my changes.
>
> LGTM.

Joe Perches pointed out to me offline that I had missed '\n' in two of
the warning messages. So one more change:

--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1402,13 +1402,13 @@ int ath10k_debug_start(struct ath10k *ar)
 		if (ret)
 			/* not serious */
 			ath10k_warn(ar,
-				    "failed to enable pktlog filter %x: %d",
+				    "failed to enable pktlog filter %x: %d\n",
 				    ar->debug.pktlog_filter, ret);
 	} else {
 		ret = ath10k_wmi_pdev_pktlog_disable(ar);
 		if (ret)
 			/* not serious */
-			ath10k_warn(ar, "failed to disable pktlog: %d", ret);
+			ath10k_warn(ar, "failed to disable pktlog: %d\n", ret);
 	}
 
 	return ret;
@@ -1532,14 +1532,14 @@ static ssize_t ath10k_write_pktlog_filter(struct file *file,
 	if (filter && (filter != ar->debug.pktlog_filter)) {
 		ret = ath10k_wmi_pdev_pktlog_enable(ar, filter);
 		if (ret) {
-			ath10k_warn(ar, "failed to enable pktlog filter %x: %d",
+			ath10k_warn(ar, "failed to enable pktlog filter %x: %d\n",
 				    ar->debug.pktlog_filter, ret);
 			goto out;
 		}
 	} else {
 		ret = ath10k_wmi_pdev_pktlog_disable(ar);
 		if (ret) {
-			ath10k_warn(ar, "failed to disable pktlog: %d", ret);
+			ath10k_warn(ar, "failed to disable pktlog: %d\n", ret);
 			goto out;
 		}
 	}


-- 
Kalle Valo

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

* Re: [PATCH v2 0/4] ath10k: Add pktlog support
  2014-10-02 17:09 [PATCH v2 0/4] ath10k: Add pktlog support Rajkumar Manoharan
                   ` (3 preceding siblings ...)
  2014-10-02 17:09 ` [PATCH v2 4/4] ath10k: add tracing for tx info Rajkumar Manoharan
@ 2014-10-07 14:15 ` Kalle Valo
  4 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2014-10-07 14:15 UTC (permalink / raw)
  To: Rajkumar Manoharan; +Cc: ath10k, linux-wireless

Rajkumar Manoharan <rmanohar@qti.qualcomm.com> writes:

> This implements the Packet log feature for ath10k.
> All tx and rx events and rx descriptor details are
> posted to user space by tracepoints.
>
> v2: Addressed review comments and based on discussion with Michal
>     dropped tx_msdu_id patch and added tx info changes
>
> Rajkumar Manoharan (4):
>   ath10k: Add support to configure pktlog filter
>   ath10k: add tracing for ath10k_htt_pktlog
>   ath10k: add tracing for rx descriptor
>   ath10k: add tracing for tx msdu pktlog event

Thanks, all four patches applied.

-- 
Kalle Valo

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

end of thread, other threads:[~2014-10-07 14:15 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02 17:09 [PATCH v2 0/4] ath10k: Add pktlog support Rajkumar Manoharan
2014-10-02 17:09 ` [PATCH v2 1/4] ath10k: Add support to configure pktlog filter Rajkumar Manoharan
2014-10-06 11:52   ` Kalle Valo
2014-10-06 12:06     ` Rajkumar Manoharan
2014-10-06 12:11       ` Kalle Valo
2014-10-02 17:09 ` [PATCH v2 2/4] ath10k: add tracing for ath10k_htt_pktlog Rajkumar Manoharan
2014-10-02 17:09 ` [PATCH v2 3/4] ath10k: add tracing for rx descriptor Rajkumar Manoharan
2014-10-02 17:09 ` [PATCH v2 4/4] ath10k: add tracing for tx info Rajkumar Manoharan
2014-10-07 14:15 ` [PATCH v2 0/4] ath10k: Add pktlog support Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).