Commit 21c1b063 authored by Maharaja Kennadyrajan's avatar Maharaja Kennadyrajan Committed by Kalle Valo

ath11k: add pktlog checksum in trace events to support pktlog

Pktlog data are different among the chipset & chipset versions.
As part of enhancing the user space script to decode the pktlog
trace events generated, it is desirable to know which chipset or
which chipset version has provided the events and thereby decode
the pktlogs appropriately.

Pktlog checksum helps to determine the chipset variant which is
given by the firmware in the struct wmi_ready_event.

Pktlog checksums are computed during the firmware build.
So, adding that pktlog checksum in the pklog trace events.
Signed-off-by: default avatarMaharaja Kennadyrajan <mkenna@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1585234155-30574-1-git-send-email-mkenna@codeaurora.org
parent 3d1c6046
...@@ -655,6 +655,7 @@ struct ath11k_base { ...@@ -655,6 +655,7 @@ struct ath11k_base {
/* protected by data_lock */ /* protected by data_lock */
u32 fw_crash_counter; u32 fw_crash_counter;
} stats; } stats;
u32 pktlog_defs_checksum;
}; };
struct ath11k_fw_stats_pdev { struct ath11k_fw_stats_pdev {
......
...@@ -1491,7 +1491,8 @@ static void ath11k_htt_pktlog(struct ath11k_base *ab, struct sk_buff *skb) ...@@ -1491,7 +1491,8 @@ static void ath11k_htt_pktlog(struct ath11k_base *ab, struct sk_buff *skb)
return; return;
} }
trace_ath11k_htt_pktlog(ar, data->payload, hdr->size); trace_ath11k_htt_pktlog(ar, data->payload, hdr->size,
ar->ab->pktlog_defs_checksum);
} }
static void ath11k_htt_backpressure_event_handler(struct ath11k_base *ab, static void ath11k_htt_backpressure_event_handler(struct ath11k_base *ab,
......
...@@ -21,14 +21,16 @@ static inline void trace_ ## name(proto) {} ...@@ -21,14 +21,16 @@ static inline void trace_ ## name(proto) {}
#define TRACE_SYSTEM ath11k #define TRACE_SYSTEM ath11k
TRACE_EVENT(ath11k_htt_pktlog, TRACE_EVENT(ath11k_htt_pktlog,
TP_PROTO(struct ath11k *ar, const void *buf, u16 buf_len), TP_PROTO(struct ath11k *ar, const void *buf, u16 buf_len,
u32 pktlog_checksum),
TP_ARGS(ar, buf, buf_len), TP_ARGS(ar, buf, buf_len, pktlog_checksum),
TP_STRUCT__entry( TP_STRUCT__entry(
__string(device, dev_name(ar->ab->dev)) __string(device, dev_name(ar->ab->dev))
__string(driver, dev_driver_string(ar->ab->dev)) __string(driver, dev_driver_string(ar->ab->dev))
__field(u16, buf_len) __field(u16, buf_len)
__field(u32, pktlog_checksum)
__dynamic_array(u8, pktlog, buf_len) __dynamic_array(u8, pktlog, buf_len)
), ),
...@@ -36,14 +38,16 @@ TRACE_EVENT(ath11k_htt_pktlog, ...@@ -36,14 +38,16 @@ TRACE_EVENT(ath11k_htt_pktlog,
__assign_str(device, dev_name(ar->ab->dev)); __assign_str(device, dev_name(ar->ab->dev));
__assign_str(driver, dev_driver_string(ar->ab->dev)); __assign_str(driver, dev_driver_string(ar->ab->dev));
__entry->buf_len = buf_len; __entry->buf_len = buf_len;
__entry->pktlog_checksum = pktlog_checksum;
memcpy(__get_dynamic_array(pktlog), buf, buf_len); memcpy(__get_dynamic_array(pktlog), buf, buf_len);
), ),
TP_printk( TP_printk(
"%s %s size %hu", "%s %s size %hu pktlog_checksum %d",
__get_str(driver), __get_str(driver),
__get_str(device), __get_str(device),
__entry->buf_len __entry->buf_len,
__entry->pktlog_checksum
) )
); );
......
...@@ -87,8 +87,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = { ...@@ -87,8 +87,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
= { .min_len = sizeof(struct wmi_pdev_bss_chan_info_event) }, = { .min_len = sizeof(struct wmi_pdev_bss_chan_info_event) },
[WMI_TAG_VDEV_INSTALL_KEY_COMPLETE_EVENT] [WMI_TAG_VDEV_INSTALL_KEY_COMPLETE_EVENT]
= { .min_len = sizeof(struct wmi_vdev_install_key_compl_event) }, = { .min_len = sizeof(struct wmi_vdev_install_key_compl_event) },
[WMI_TAG_READY_EVENT] [WMI_TAG_READY_EVENT] = {
= {.min_len = sizeof(struct wmi_ready_event) }, .min_len = sizeof(struct wmi_ready_event_min) },
[WMI_TAG_SERVICE_AVAILABLE_EVENT] [WMI_TAG_SERVICE_AVAILABLE_EVENT]
= {.min_len = sizeof(struct wmi_service_available_event) }, = {.min_len = sizeof(struct wmi_service_available_event) },
[WMI_TAG_PEER_ASSOC_CONF_EVENT] [WMI_TAG_PEER_ASSOC_CONF_EVENT]
...@@ -4991,7 +4991,7 @@ static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len, ...@@ -4991,7 +4991,7 @@ static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len,
const void *ptr, void *data) const void *ptr, void *data)
{ {
struct wmi_tlv_rdy_parse *rdy_parse = data; struct wmi_tlv_rdy_parse *rdy_parse = data;
struct wmi_ready_event *fixed_param; struct wmi_ready_event fixed_param;
struct wmi_mac_addr *addr_list; struct wmi_mac_addr *addr_list;
struct ath11k_pdev *pdev; struct ath11k_pdev *pdev;
u32 num_mac_addr; u32 num_mac_addr;
...@@ -4999,11 +4999,16 @@ static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len, ...@@ -4999,11 +4999,16 @@ static int ath11k_wmi_tlv_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len,
switch (tag) { switch (tag) {
case WMI_TAG_READY_EVENT: case WMI_TAG_READY_EVENT:
fixed_param = (struct wmi_ready_event *)ptr; memset(&fixed_param, 0, sizeof(fixed_param));
ab->wlan_init_status = fixed_param->status; memcpy(&fixed_param, (struct wmi_ready_event *)ptr,
rdy_parse->num_extra_mac_addr = fixed_param->num_extra_mac_addr; min_t(u16, sizeof(fixed_param), len));
ab->wlan_init_status = fixed_param.ready_event_min.status;
ether_addr_copy(ab->mac_addr, fixed_param->mac_addr.addr); rdy_parse->num_extra_mac_addr =
fixed_param.ready_event_min.num_extra_mac_addr;
ether_addr_copy(ab->mac_addr,
fixed_param.ready_event_min.mac_addr.addr);
ab->pktlog_defs_checksum = fixed_param.pktlog_defs_checksum;
ab->wmi_ready = true; ab->wmi_ready = true;
break; break;
case WMI_TAG_ARRAY_FIXED_STRUCT: case WMI_TAG_ARRAY_FIXED_STRUCT:
......
...@@ -2345,7 +2345,7 @@ struct wmi_mac_addr { ...@@ -2345,7 +2345,7 @@ struct wmi_mac_addr {
} __packed; } __packed;
} __packed; } __packed;
struct wmi_ready_event { struct wmi_ready_event_min {
struct wmi_abi_version fw_abi_vers; struct wmi_abi_version fw_abi_vers;
struct wmi_mac_addr mac_addr; struct wmi_mac_addr mac_addr;
u32 status; u32 status;
...@@ -2355,6 +2355,12 @@ struct wmi_ready_event { ...@@ -2355,6 +2355,12 @@ struct wmi_ready_event {
u32 num_extra_peers; u32 num_extra_peers;
} __packed; } __packed;
struct wmi_ready_event {
struct wmi_ready_event_min ready_event_min;
u32 max_ast_index;
u32 pktlog_defs_checksum;
} __packed;
struct wmi_service_available_event { struct wmi_service_available_event {
u32 wmi_service_segment_offset; u32 wmi_service_segment_offset;
u32 wmi_service_segment_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32]; u32 wmi_service_segment_bitmap[WMI_SERVICE_SEGMENT_BM_SIZE32];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment