linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] ath10k: add wmi-tlv debug event handling
@ 2015-01-08 11:18 Michal Kazior
  2015-01-08 11:18 ` [PATCH 1/2] ath10k: implement diag data container event Michal Kazior
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Michal Kazior @ 2015-01-08 11:18 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

New wmi-tlv firmware will deliver debug messages
via new events.

Note: This may yield some (trivial) conflicts
against my beacon/presp template patchset.


Michal Kazior (2):
  ath10k: implement diag data container event
  ath10k: implement diag event

 drivers/net/wireless/ath/ath10k/trace.h   |  68 ++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 102 ++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  19 ++++++
 3 files changed, 189 insertions(+)

-- 
1.8.5.3


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

* [PATCH 1/2] ath10k: implement diag data container event
  2015-01-08 11:18 [PATCH 0/2] ath10k: add wmi-tlv debug event handling Michal Kazior
@ 2015-01-08 11:18 ` Michal Kazior
  2015-01-08 11:18 ` [PATCH 2/2] ath10k: implement diag event Michal Kazior
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Michal Kazior @ 2015-01-08 11:18 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

Some firmware revisions may report this event as
part of their diagnostics.

This avoids `unknown event` warnings and adds
tracing for the event.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/trace.h   | 41 ++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 71 +++++++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 19 +++++++++
 3 files changed, 131 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index b289378..1c541f7 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -453,6 +453,47 @@ TRACE_EVENT(ath10k_htt_rx_desc,
 	 )
 );
 
+TRACE_EVENT(ath10k_wmi_diag_container,
+	    TP_PROTO(struct ath10k *ar,
+		     u8 type,
+		     u32 timestamp,
+		     u32 code,
+		     u16 len,
+		     const void *data),
+
+	TP_ARGS(ar, type, timestamp, code, len, data),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(ar->dev))
+		__string(driver, dev_driver_string(ar->dev))
+		__field(u8, type)
+		__field(u32, timestamp)
+		__field(u32, code)
+		__field(u16, len)
+		__dynamic_array(u8, data, len)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(ar->dev));
+		__assign_str(driver, dev_driver_string(ar->dev));
+		__entry->type = type;
+		__entry->timestamp = timestamp;
+		__entry->code = code;
+		__entry->len = len;
+		memcpy(__get_dynamic_array(data), data, len);
+	),
+
+	TP_printk(
+		"%s %s diag container type %hhu timestamp %u code %u len %d",
+		__get_str(driver),
+		__get_str(device),
+		__entry->type,
+		__entry->timestamp,
+		__entry->code,
+		__entry->len
+	)
+);
+
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 4c050ce..46a9f50 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -58,6 +58,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
 		= { .min_len = sizeof(struct wlan_host_mem_req) },
 	[WMI_TLV_TAG_STRUCT_READY_EVENT]
 		= { .min_len = sizeof(struct wmi_tlv_rdy_ev) },
+	[WMI_TLV_TAG_STRUCT_DIAG_DATA_CONTAINER_EVENT]
+		= { .min_len = sizeof(struct wmi_tlv_diag_data_ev) },
 };
 
 static int
@@ -156,6 +158,72 @@ static u16 ath10k_wmi_tlv_len(const void *ptr)
 	return __le16_to_cpu((((const struct wmi_tlv *)ptr) - 1)->len);
 }
 
+/**************/
+/* TLV events */
+/**************/
+static int ath10k_wmi_tlv_event_diag_data(struct ath10k *ar,
+					  struct sk_buff *skb)
+{
+	const void **tb;
+	const struct wmi_tlv_diag_data_ev *ev;
+	const struct wmi_tlv_diag_item *item;
+	const void *data;
+	int ret, num_items, len;
+
+	tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
+	if (IS_ERR(tb)) {
+		ret = PTR_ERR(tb);
+		ath10k_warn(ar, "failed to parse tlv: %d\n", ret);
+		return ret;
+	}
+
+	ev = tb[WMI_TLV_TAG_STRUCT_DIAG_DATA_CONTAINER_EVENT];
+	data = tb[WMI_TLV_TAG_ARRAY_BYTE];
+	if (!ev || !data) {
+		kfree(tb);
+		return -EPROTO;
+	}
+
+	num_items = __le32_to_cpu(ev->num_items);
+	len = ath10k_wmi_tlv_len(data);
+
+	while (num_items--) {
+		if (len == 0)
+			break;
+		if (len < sizeof(*item)) {
+			ath10k_warn(ar, "failed to parse diag data: can't fit item header\n");
+			break;
+		}
+
+		item = data;
+
+		if (len < sizeof(*item) + __le16_to_cpu(item->len)) {
+			ath10k_warn(ar, "failed to parse diag data: item is too long\n");
+			break;
+		}
+
+		trace_ath10k_wmi_diag_container(ar,
+						item->type,
+						__le32_to_cpu(item->timestamp),
+						__le32_to_cpu(item->code),
+						__le16_to_cpu(item->len),
+						item->payload);
+
+		len -= sizeof(*item);
+		len -= roundup(__le16_to_cpu(item->len), 4);
+
+		data += sizeof(*item);
+		data += roundup(__le16_to_cpu(item->len), 4);
+	}
+
+	if (num_items != -1 || len != 0)
+		ath10k_warn(ar, "failed to parse diag data event: num_items %d len %d\n",
+			    num_items, len);
+
+	kfree(tb);
+	return 0;
+}
+
 /***********/
 /* TLV ops */
 /***********/
@@ -268,6 +336,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
 	case WMI_TLV_READY_EVENTID:
 		ath10k_wmi_event_ready(ar, skb);
 		break;
+	case WMI_TLV_DIAG_DATA_CONTAINER_EVENTID:
+		ath10k_wmi_tlv_event_diag_data(ar, skb);
+		break;
 	default:
 		ath10k_warn(ar, "Unknown eventid: %d\n", id);
 		break;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index 54ffa12..c1cde3c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1375,6 +1375,25 @@ struct wmi_tlv_pktlog_disable {
 	__le32 reserved;
 } __packed;
 
+enum wmi_tlv_diag_item_type {
+	WMI_TLV_DIAG_ITEM_TYPE_FW_EVENT,
+	WMI_TLV_DIAG_ITEM_TYPE_FW_LOG,
+	WMI_TLV_DIAG_ITEM_TYPE_FW_DEBUG_MSG,
+};
+
+struct wmi_tlv_diag_item {
+	u8 type;
+	u8 reserved;
+	__le16 len;
+	__le32 timestamp;
+	__le32 code;
+	u8 payload[0];
+} __packed;
+
+struct wmi_tlv_diag_data_ev {
+	__le32 num_items;
+} __packed;
+
 void ath10k_wmi_tlv_attach(struct ath10k *ar);
 
 #endif
-- 
1.8.5.3


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

* [PATCH 2/2] ath10k: implement diag event
  2015-01-08 11:18 [PATCH 0/2] ath10k: add wmi-tlv debug event handling Michal Kazior
  2015-01-08 11:18 ` [PATCH 1/2] ath10k: implement diag data container event Michal Kazior
@ 2015-01-08 11:18 ` Michal Kazior
  2015-01-15 11:10 ` [PATCH 0/2] ath10k: add wmi-tlv debug event handling Kalle Valo
  2015-01-27 13:51 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Michal Kazior @ 2015-01-08 11:18 UTC (permalink / raw)
  To: ath10k; +Cc: linux-wireless, Michal Kazior

Some firmware revisions may report this event as
part of their diagnostics.

This avoids `unknown event` warnings and adds
tracing for the event.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/trace.h   | 27 +++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 31 +++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/trace.h b/drivers/net/wireless/ath/ath10k/trace.h
index 1c541f7..5407887 100644
--- a/drivers/net/wireless/ath/ath10k/trace.h
+++ b/drivers/net/wireless/ath/ath10k/trace.h
@@ -494,6 +494,33 @@ TRACE_EVENT(ath10k_wmi_diag_container,
 	)
 );
 
+TRACE_EVENT(ath10k_wmi_diag,
+	    TP_PROTO(struct ath10k *ar, const void *data, size_t len),
+
+	TP_ARGS(ar, data, len),
+
+	TP_STRUCT__entry(
+		__string(device, dev_name(ar->dev))
+		__string(driver, dev_driver_string(ar->dev))
+		__field(u16, len)
+		__dynamic_array(u8, data, len)
+	),
+
+	TP_fast_assign(
+		__assign_str(device, dev_name(ar->dev));
+		__assign_str(driver, dev_driver_string(ar->dev));
+		__entry->len = len;
+		memcpy(__get_dynamic_array(data), data, len);
+	),
+
+	TP_printk(
+		"%s %s tlv diag len %d",
+		__get_str(driver),
+		__get_str(device),
+		__entry->len
+	)
+);
+
 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
 
 /* we don't want to use include/trace/events */
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 46a9f50..a2ad886 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -224,6 +224,34 @@ static int ath10k_wmi_tlv_event_diag_data(struct ath10k *ar,
 	return 0;
 }
 
+static int ath10k_wmi_tlv_event_diag(struct ath10k *ar,
+				     struct sk_buff *skb)
+{
+	const void **tb;
+	const void *data;
+	int ret, len;
+
+	tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
+	if (IS_ERR(tb)) {
+		ret = PTR_ERR(tb);
+		ath10k_warn(ar, "failed to parse tlv: %d\n", ret);
+		return ret;
+	}
+
+	data = tb[WMI_TLV_TAG_ARRAY_BYTE];
+	if (!data) {
+		kfree(tb);
+		return -EPROTO;
+	}
+	len = ath10k_wmi_tlv_len(data);
+
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv diag event len %d\n", len);
+	trace_ath10k_wmi_diag(ar, data, len);
+
+	kfree(tb);
+	return 0;
+}
+
 /***********/
 /* TLV ops */
 /***********/
@@ -339,6 +367,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
 	case WMI_TLV_DIAG_DATA_CONTAINER_EVENTID:
 		ath10k_wmi_tlv_event_diag_data(ar, skb);
 		break;
+	case WMI_TLV_DIAG_EVENTID:
+		ath10k_wmi_tlv_event_diag(ar, skb);
+		break;
 	default:
 		ath10k_warn(ar, "Unknown eventid: %d\n", id);
 		break;
-- 
1.8.5.3


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

* Re: [PATCH 0/2] ath10k: add wmi-tlv debug event handling
  2015-01-08 11:18 [PATCH 0/2] ath10k: add wmi-tlv debug event handling Michal Kazior
  2015-01-08 11:18 ` [PATCH 1/2] ath10k: implement diag data container event Michal Kazior
  2015-01-08 11:18 ` [PATCH 2/2] ath10k: implement diag event Michal Kazior
@ 2015-01-15 11:10 ` Kalle Valo
  2015-01-15 12:38   ` Michal Kazior
  2015-01-27 13:51 ` Kalle Valo
  3 siblings, 1 reply; 6+ messages in thread
From: Kalle Valo @ 2015-01-15 11:10 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> New wmi-tlv firmware will deliver debug messages
> via new events.
>
> Note: This may yield some (trivial) conflicts
> against my beacon/presp template patchset.

You were right, but bonus points for having valid parent commit ids for
the 3-way merge! :)

Applying: ath10k: implement diag data container event
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging drivers/net/wireless/ath/ath10k/wmi-tlv.h
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/wmi-tlv.h
Auto-merging drivers/net/wireless/ath/ath10k/wmi-tlv.c
CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/wmi-tlv.c
Failed to merge in the changes.
Patch failed at 0001 ath10k: implement diag data container event

Please double check my conflict resolution in ath-next-test.

-- 
Kalle Valo

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

* Re: [PATCH 0/2] ath10k: add wmi-tlv debug event handling
  2015-01-15 11:10 ` [PATCH 0/2] ath10k: add wmi-tlv debug event handling Kalle Valo
@ 2015-01-15 12:38   ` Michal Kazior
  0 siblings, 0 replies; 6+ messages in thread
From: Michal Kazior @ 2015-01-15 12:38 UTC (permalink / raw)
  To: Kalle Valo; +Cc: ath10k, linux-wireless

On 15 January 2015 at 12:10, Kalle Valo <kvalo@qca.qualcomm.com> wrote:
[...]
> Applying: ath10k: implement diag data container event
> Using index info to reconstruct a base tree...
> Falling back to patching base and 3-way merge...
> Auto-merging drivers/net/wireless/ath/ath10k/wmi-tlv.h
> CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/wmi-tlv.h
> Auto-merging drivers/net/wireless/ath/ath10k/wmi-tlv.c
> CONFLICT (content): Merge conflict in drivers/net/wireless/ath/ath10k/wmi-tlv.c
> Failed to merge in the changes.
> Patch failed at 0001 ath10k: implement diag data container event
>
> Please double check my conflict resolution in ath-next-test.

Looks good, thanks!


Michał

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

* Re: [PATCH 0/2] ath10k: add wmi-tlv debug event handling
  2015-01-08 11:18 [PATCH 0/2] ath10k: add wmi-tlv debug event handling Michal Kazior
                   ` (2 preceding siblings ...)
  2015-01-15 11:10 ` [PATCH 0/2] ath10k: add wmi-tlv debug event handling Kalle Valo
@ 2015-01-27 13:51 ` Kalle Valo
  3 siblings, 0 replies; 6+ messages in thread
From: Kalle Valo @ 2015-01-27 13:51 UTC (permalink / raw)
  To: Michal Kazior; +Cc: ath10k, linux-wireless

Michal Kazior <michal.kazior@tieto.com> writes:

> New wmi-tlv firmware will deliver debug messages
> via new events.
>
> Note: This may yield some (trivial) conflicts
> against my beacon/presp template patchset.
>
>
> Michal Kazior (2):
>   ath10k: implement diag data container event
>   ath10k: implement diag event

Thanks, applied to ath.git.

-- 
Kalle Valo

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

end of thread, other threads:[~2015-01-27 13:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-08 11:18 [PATCH 0/2] ath10k: add wmi-tlv debug event handling Michal Kazior
2015-01-08 11:18 ` [PATCH 1/2] ath10k: implement diag data container event Michal Kazior
2015-01-08 11:18 ` [PATCH 2/2] ath10k: implement diag event Michal Kazior
2015-01-15 11:10 ` [PATCH 0/2] ath10k: add wmi-tlv debug event handling Kalle Valo
2015-01-15 12:38   ` Michal Kazior
2015-01-27 13:51 ` 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).