diff --git a/core/htc/htc_send.c b/core/htc/htc_send.c index bb0ff387837d..b60abc9736f8 100644 --- a/core/htc/htc_send.c +++ b/core/htc/htc_send.c @@ -586,18 +586,9 @@ static A_STATUS htc_issue_packets(HTC_TARGET *target, pEndpoint->TxCredits += pPacket->PktInfo.AsTx.CreditsUsed; #endif - while (!HTC_QUEUE_EMPTY(pPktQueue)) { - if (status != A_NO_RESOURCE) { - AR_DEBUG_PRINTF(ATH_DEBUG_ERR, - ("htc_issue_packets, failed pkt:0x%p status:%d \n", - pPacket, status)); - } - pPacket = htc_packet_dequeue(pPktQueue); - if (pPacket) { - pPacket->Status = status; - send_packet_completion(target, pPacket); - } - } + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("htc_issue_packets, failed pkt:0x%p status:%d", + pPacket, status)); } AR_DEBUG_PRINTF(ATH_DEBUG_SEND, ("-htc_issue_packets \n")); @@ -997,7 +988,16 @@ static HTC_SEND_QUEUE_RESULT htc_try_send(HTC_TARGET *target, UNLOCK_HTC_TX(target); /* send what we can */ - htc_issue_packets(target, pEndpoint, &sendQueue); + result = htc_issue_packets(target, pEndpoint, &sendQueue); + if (result) { + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, + ("htc_issue_packets, failed status:%d put it back to head of callersSendQueue", + result)); + HTC_PACKET_QUEUE_TRANSFER_TO_HEAD(&pEndpoint->TxQueue, + &sendQueue); + LOCK_HTC_TX(target); + break; + } if (!IS_TX_CREDIT_FLOW_ENABLED(pEndpoint)) { tx_resources = diff --git a/core/wmi/wmi_unified.c b/core/wmi/wmi_unified.c index 6e908a3f866a..d1980c73f567 100644 --- a/core/wmi/wmi_unified.c +++ b/core/wmi/wmi_unified.c @@ -104,6 +104,60 @@ struct wmi_event_debug wmi_rx_event_log_buffer[WMI_EVENT_DEBUG_MAX_ENTRY]; cdf_get_log_timestamp(); \ g_wmi_rx_event_buf_idx++; \ } +/* wmi_mgmt commands */ +#define WMI_MGMT_EVENT_DEBUG_MAX_ENTRY (256) + +uint32_t g_wmi_mgmt_command_buf_idx = 0; +struct +wmi_command_debug wmi_mgmt_command_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; + +/* wmi_mgmt commands TX completed */ +uint32_t g_wmi_mgmt_command_tx_cmp_buf_idx = 0; +struct wmi_command_debug +wmi_mgmt_command_tx_cmp_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; + +/* wmi_mgmt events when processed */ +uint32_t g_wmi_mgmt_event_buf_idx = 0; +struct wmi_event_debug +wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY]; + +#define WMI_MGMT_COMMAND_RECORD(a, b) { \ + if (WMI_MGMT_EVENT_DEBUG_MAX_ENTRY <= \ + g_wmi_mgmt_command_buf_idx) \ + g_wmi_mgmt_command_buf_idx = 0; \ + wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].command = a; \ + cdf_mem_copy( \ + wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data,\ + b, 16); \ + wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].time = \ + cdf_get_log_timestamp(); \ + g_wmi_mgmt_command_buf_idx++; \ +} + +#define WMI_MGMT_COMMAND_TX_CMP_RECORD(a, b) { \ + if (WMI_MGMT_EVENT_DEBUG_MAX_ENTRY <= \ + g_wmi_mgmt_command_tx_cmp_buf_idx) \ + g_wmi_mgmt_command_tx_cmp_buf_idx = 0; \ + wmi_mgmt_command_tx_cmp_log_buffer[g_wmi_mgmt_command_tx_cmp_buf_idx].\ + command = a; \ + cdf_mem_copy(wmi_mgmt_command_tx_cmp_log_buffer \ + [g_wmi_mgmt_command_tx_cmp_buf_idx].data, b, 16); \ + wmi_mgmt_command_tx_cmp_log_buffer[g_wmi_mgmt_command_tx_cmp_buf_idx].\ + time =\ + cdf_get_log_timestamp(); \ + g_wmi_mgmt_command_tx_cmp_buf_idx++; \ +} + +#define WMI_MGMT_EVENT_RECORD(a, b) { \ + if (WMI_MGMT_EVENT_DEBUG_MAX_ENTRY <= g_wmi_mgmt_event_buf_idx) \ + g_wmi_mgmt_event_buf_idx = 0; \ + wmi_mgmt_event_log_buffer[g_wmi_mgmt_event_buf_idx].event = a; \ + cdf_mem_copy(wmi_mgmt_event_log_buffer[g_wmi_mgmt_event_buf_idx].data,\ + b, 16); \ + wmi_mgmt_event_log_buffer[g_wmi_mgmt_event_buf_idx].time = \ + cdf_get_log_timestamp(); \ + g_wmi_mgmt_event_buf_idx++; \ +} #endif /*WMI_INTERFACE_EVENT_LOGGING */ @@ -780,7 +834,14 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len, #ifdef WMI_INTERFACE_EVENT_LOGGING cdf_spin_lock_bh(&wmi_handle->wmi_record_lock); /*Record 16 bytes of WMI cmd data - exclude TLV and WMI headers */ - WMI_COMMAND_RECORD(cmd_id, ((uint32_t *) cdf_nbuf_data(buf) + 2)); + if (cmd_id == WMI_MGMT_TX_SEND_CMDID) { + WMI_MGMT_COMMAND_RECORD(cmd_id, + ((uint32_t *)cdf_nbuf_data(buf) + 2)); + } else { + WMI_COMMAND_RECORD(cmd_id, ((uint32_t *) cdf_nbuf_data(buf) + + 2)); + } + cdf_spin_unlock_bh(&wmi_handle->wmi_record_lock); #endif @@ -1037,7 +1098,11 @@ void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf) #ifdef WMI_INTERFACE_EVENT_LOGGING cdf_spin_lock_bh(&wmi_handle->wmi_record_lock); /* Exclude 4 bytes of TLV header */ - WMI_EVENT_RECORD(id, ((uint8_t *) data + 4)); + if (id == WMI_MGMT_TX_COMPLETION_EVENTID) { + WMI_MGMT_EVENT_RECORD(id, ((uint8_t *) data + 4)); + } else { + WMI_EVENT_RECORD(id, ((uint8_t *) data + 4)); + } cdf_spin_unlock_bh(&wmi_handle->wmi_record_lock); #endif /* Call the WMI registered event handler */ @@ -1189,9 +1254,14 @@ void wmi_htc_tx_complete(void *ctx, HTC_PACKET *htc_pkt) cdf_spin_lock_bh(&wmi_handle->wmi_record_lock); /* Record 16 bytes of WMI cmd tx complete data - exclude TLV and WMI headers */ - WMI_COMMAND_TX_CMP_RECORD(cmd_id, - ((uint32_t *) cdf_nbuf_data(wmi_cmd_buf) + - 2)); + if (cmd_id == WMI_MGMT_TX_SEND_CMDID) { + WMI_MGMT_COMMAND_TX_CMP_RECORD(cmd_id, + ((uint32_t *) cdf_nbuf_data(wmi_cmd_buf) + 2)); + } else { + WMI_COMMAND_TX_CMP_RECORD(cmd_id, + ((uint32_t *) cdf_nbuf_data(wmi_cmd_buf) + 2)); + } + cdf_spin_unlock_bh(&wmi_handle->wmi_record_lock); #endif cdf_nbuf_free(wmi_cmd_buf);