qcacmn: Revert back implementation of wmi_mgmt_command_record

WMI_RECORDING:Fix implementation of WMI_MGMT_COMMAND_RECORD to
be compatible to WIN.
Current implemantation uses variables not applicable to
WIN.

CRs-Fixed: 1067944
Change-Id: I65b2415e40bd888d3b94ef5f04ec6d53b4d50da2
This commit is contained in:
Pratik Gandhi
2016-09-16 01:32:51 +05:30
committed by qcabuildsw
parent bf3bc6534f
commit 29e33f08f0
3 changed files with 61 additions and 36 deletions

View File

@@ -118,8 +118,10 @@ int qcacld_bp_seq_printf(struct seq_file *m, const char *f, ...)
#else #else
#define MAX_WMI_INSTANCES 3 #define MAX_WMI_INSTANCES 3
#endif #endif
#define CUSTOM_MGMT_CMD_DATA_SIZE 4
#endif #endif
#ifdef CONFIG_MCL
/* WMI commands */ /* WMI commands */
uint32_t g_wmi_command_buf_idx = 0; uint32_t g_wmi_command_buf_idx = 0;
struct wmi_command_debug wmi_command_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; struct wmi_command_debug wmi_command_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY];
@@ -136,6 +138,7 @@ struct wmi_event_debug wmi_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY];
/* WMI events when queued */ /* WMI events when queued */
uint32_t g_wmi_rx_event_buf_idx = 0; uint32_t g_wmi_rx_event_buf_idx = 0;
struct wmi_event_debug wmi_rx_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; struct wmi_event_debug wmi_rx_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY];
#endif
#define WMI_COMMAND_RECORD(h, a, b) { \ #define WMI_COMMAND_RECORD(h, a, b) { \
if (wmi_log_max_entry <= \ if (wmi_log_max_entry <= \
@@ -158,7 +161,8 @@ struct wmi_event_debug wmi_rx_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY];
#define WMI_COMMAND_TX_CMP_RECORD(h, a, b) { \ #define WMI_COMMAND_TX_CMP_RECORD(h, a, b) { \
if (wmi_log_max_entry <= \ if (wmi_log_max_entry <= \
*(h->log_info.wmi_command_tx_cmp_log_buf_info.p_buf_tail_idx))\ *(h->log_info.wmi_command_tx_cmp_log_buf_info.p_buf_tail_idx))\
*(h->log_info.wmi_command_tx_cmp_log_buf_info.p_buf_tail_idx) = 0;\ *(h->log_info.wmi_command_tx_cmp_log_buf_info. \
p_buf_tail_idx) = 0; \
((struct wmi_command_debug *)h->log_info. \ ((struct wmi_command_debug *)h->log_info. \
wmi_command_tx_cmp_log_buf_info.buf) \ wmi_command_tx_cmp_log_buf_info.buf) \
[*(h->log_info.wmi_command_tx_cmp_log_buf_info. \ [*(h->log_info.wmi_command_tx_cmp_log_buf_info. \
@@ -214,6 +218,7 @@ struct wmi_event_debug wmi_rx_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY];
h->log_info.wmi_rx_event_log_buf_info.length++; \ h->log_info.wmi_rx_event_log_buf_info.length++; \
} }
#ifdef CONFIG_MCL
uint32_t g_wmi_mgmt_command_buf_idx = 0; uint32_t g_wmi_mgmt_command_buf_idx = 0;
struct struct
wmi_command_debug wmi_mgmt_command_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; wmi_command_debug wmi_mgmt_command_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
@@ -227,19 +232,28 @@ wmi_mgmt_command_tx_cmp_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
uint32_t g_wmi_mgmt_event_buf_idx = 0; uint32_t g_wmi_mgmt_event_buf_idx = 0;
struct wmi_event_debug struct wmi_event_debug
wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
#endif
#define WMI_MGMT_COMMAND_RECORD(a, b, c, d, e) { \ #define WMI_MGMT_COMMAND_RECORD(h, a, b) { \
if (WMI_MGMT_EVENT_DEBUG_MAX_ENTRY <= \ if (wmi_mgmt_log_max_entry <= \
g_wmi_mgmt_command_buf_idx) \ *(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)) \
g_wmi_mgmt_command_buf_idx = 0; \ *(h->log_info.wmi_mgmt_command_log_buf_info. \
wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].command = a; \ p_buf_tail_idx) = 0; \
wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[0] = b; \ ((struct wmi_command_debug *)h->log_info. \
wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[1] = c; \ wmi_mgmt_command_log_buf_info.buf) \
wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[2] = d; \ [*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\
wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[3] = e; \ command = a; \
wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].time = \ qdf_mem_copy(((struct wmi_command_debug *)h->log_info. \
qdf_get_log_timestamp(); \ wmi_mgmt_command_log_buf_info.buf) \
g_wmi_mgmt_command_buf_idx++; \ [*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\
data, b, \
wmi_record_max_length); \
((struct wmi_command_debug *)h->log_info. \
wmi_mgmt_command_log_buf_info.buf) \
[*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\
time = qdf_get_log_timestamp(); \
(*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx))++;\
h->log_info.wmi_mgmt_command_log_buf_info.length++; \
} }
#define WMI_MGMT_COMMAND_TX_CMP_RECORD(h, a, b) { \ #define WMI_MGMT_COMMAND_TX_CMP_RECORD(h, a, b) { \
@@ -527,9 +541,9 @@ static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle)
#endif #endif
#ifdef CONFIG_MCL #ifdef CONFIG_MCL
const int8_t * const debugfs_dir[] = {"WMI0", "WMI1", "WMI2"}; const int8_t * const debugfs_dir[MAX_WMI_INSTANCES] = {"WMI0"};
#else #else
const int8_t * const debugfs_dir[] = {"WMI0"}; const int8_t * const debugfs_dir[MAX_WMI_INSTANCES] = {"WMI0", "WMI1", "WMI2"};
#endif #endif
/* debugfs routines*/ /* debugfs routines*/
@@ -554,9 +568,12 @@ const int8_t * const debugfs_dir[] = {"WMI0"};
int pos, nread, outlen; \ int pos, nread, outlen; \
int i; \ int i; \
\ \
if (!wmi_log->length) \ qdf_spin_lock(&wmi_handle->log_info.wmi_record_lock); \
if (!wmi_log->length) { \
qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock);\
return seq_printf(m, \ return seq_printf(m, \
"no elements to read from ring buffer!\n"); \ "no elements to read from ring buffer!\n"); \
} \
\ \
if (wmi_log->length <= wmi_ring_size) \ if (wmi_log->length <= wmi_ring_size) \
nread = wmi_log->length; \ nread = wmi_log->length; \
@@ -569,8 +586,8 @@ const int8_t * const debugfs_dir[] = {"WMI0"};
else \ else \
pos = *(wmi_log->p_buf_tail_idx) - 1; \ pos = *(wmi_log->p_buf_tail_idx) - 1; \
\ \
outlen = 0; \ outlen = seq_printf(m, "Length = %d\n", wmi_log->length);\
qdf_spin_lock(&wmi_handle->log_info.wmi_record_lock); \ qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock); \
while (nread--) { \ while (nread--) { \
struct wmi_command_debug *wmi_record; \ struct wmi_command_debug *wmi_record; \
\ \
@@ -590,8 +607,6 @@ const int8_t * const debugfs_dir[] = {"WMI0"};
else \ else \
pos--; \ pos--; \
} \ } \
outlen += seq_printf(m, "Length = %d\n", wmi_log->length);\
qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock); \
\ \
return outlen; \ return outlen; \
} \ } \
@@ -606,9 +621,12 @@ const int8_t * const debugfs_dir[] = {"WMI0"};
int pos, nread, outlen; \ int pos, nread, outlen; \
int i; \ int i; \
\ \
if (!wmi_log->length) \ qdf_spin_lock(&wmi_handle->log_info.wmi_record_lock); \
if (!wmi_log->length) { \
qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock);\
return seq_printf(m, \ return seq_printf(m, \
"no elements to read from ring buffer!\n"); \ "no elements to read from ring buffer!\n"); \
} \
\ \
if (wmi_log->length <= wmi_ring_size) \ if (wmi_log->length <= wmi_ring_size) \
nread = wmi_log->length; \ nread = wmi_log->length; \
@@ -621,8 +639,8 @@ const int8_t * const debugfs_dir[] = {"WMI0"};
else \ else \
pos = *(wmi_log->p_buf_tail_idx) - 1; \ pos = *(wmi_log->p_buf_tail_idx) - 1; \
\ \
outlen = 0; \ outlen = seq_printf(m, "Length = %d\n", wmi_log->length);\
qdf_spin_lock(&wmi_handle->log_info.wmi_record_lock); \ qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock); \
while (nread--) { \ while (nread--) { \
struct wmi_event_debug *wmi_record; \ struct wmi_event_debug *wmi_record; \
\ \
@@ -642,8 +660,6 @@ const int8_t * const debugfs_dir[] = {"WMI0"};
else \ else \
pos--; \ pos--; \
} \ } \
outlen += seq_printf(m, "Length = %d\n", wmi_log->length);\
qdf_spin_unlock(&wmi_handle->log_info.wmi_record_lock); \
\ \
return outlen; \ return outlen; \
} }
@@ -951,12 +967,17 @@ static QDF_STATUS wmi_debugfs_init(wmi_unified_t wmi_handle)
void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd, void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd,
void *header, uint32_t vdev_id, uint32_t chanfreq) void *header, uint32_t vdev_id, uint32_t chanfreq)
{ {
uint32_t data[CUSTOM_MGMT_CMD_DATA_SIZE];
data[0] = ((struct wmi_command_header *)header)->type;
data[1] = ((struct wmi_command_header *)header)->sub_type;
data[2] = vdev_id;
data[3] = chanfreq;
qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
WMI_MGMT_COMMAND_RECORD(cmd, WMI_MGMT_COMMAND_RECORD(wmi_handle, cmd, data);
((struct wmi_command_header *)header)->type,
((struct wmi_command_header *)header)->sub_type,
vdev_id, chanfreq);
qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock); qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock);
} }
@@ -1801,7 +1822,13 @@ QDF_STATUS wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf,
#ifdef WMI_INTERFACE_EVENT_LOGGING #ifdef WMI_INTERFACE_EVENT_LOGGING
if (wmi_handle->log_info.wmi_logging_enable) { if (wmi_handle->log_info.wmi_logging_enable) {
qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
if (!wmi_handle->log_info.is_management_record(cmd_id)) { /*Record 16 bytes of WMI cmd data -
* * exclude TLV and WMI headers */
if (wmi_handle->log_info.is_management_record(cmd_id)) {
WMI_MGMT_COMMAND_RECORD(wmi_handle, cmd_id,
((uint32_t *) qdf_nbuf_data(buf) +
wmi_handle->log_info.buf_offset_command));
} else {
WMI_COMMAND_RECORD(wmi_handle, cmd_id, WMI_COMMAND_RECORD(wmi_handle, cmd_id,
((uint32_t *) qdf_nbuf_data(buf) + ((uint32_t *) qdf_nbuf_data(buf) +
wmi_handle->log_info.buf_offset_command)); wmi_handle->log_info.buf_offset_command));
@@ -2347,9 +2374,6 @@ void wmi_htc_tx_complete(void *ctx, HTC_PACKET *htc_pkt)
cmd_id = WMI_GET_FIELD(qdf_nbuf_data(wmi_cmd_buf), cmd_id = WMI_GET_FIELD(qdf_nbuf_data(wmi_cmd_buf),
WMI_CMD_HDR, COMMANDID); WMI_CMD_HDR, COMMANDID);
WMI_LOGD("Sent WMI command:%s command_id:0x%x over dma and recieved tx complete interupt",
wmi_id_to_name(cmd_id), cmd_id);
qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock); qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
/* Record 16 bytes of WMI cmd tx complete data /* Record 16 bytes of WMI cmd tx complete data
- exclude TLV and WMI headers */ - exclude TLV and WMI headers */

View File

@@ -7285,7 +7285,9 @@ static bool is_management_record_non_tlv(uint32_t cmd_id)
{ {
if ((cmd_id == WMI_BCN_TX_CMDID) || if ((cmd_id == WMI_BCN_TX_CMDID) ||
(cmd_id == WMI_PDEV_SEND_BCN_CMDID) || (cmd_id == WMI_PDEV_SEND_BCN_CMDID) ||
(cmd_id == WMI_MGMT_TX_CMDID)) { (cmd_id == WMI_MGMT_TX_CMDID) ||
(cmd_id == WMI_GPIO_OUTPUT_CMDID) ||
(cmd_id == WMI_HOST_SWBA_EVENTID)) {
return true; return true;
} }

View File

@@ -12406,8 +12406,7 @@ static QDF_STATUS extract_channel_hopping_event_tlv(wmi_unified_t wmi_handle,
#ifdef WMI_INTERFACE_EVENT_LOGGING #ifdef WMI_INTERFACE_EVENT_LOGGING
static bool is_management_record_tlv(uint32_t cmd_id) static bool is_management_record_tlv(uint32_t cmd_id)
{ {
if ((cmd_id == WMI_MGMT_TX_SEND_CMDID) || if (cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID)
(cmd_id == WMI_MGMT_TX_COMPLETION_EVENTID))
return true; return true;
return false; return false;