diff --git a/hif/inc/hif.h b/hif/inc/hif.h index 17745e32d1..735ae694b2 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -672,6 +672,7 @@ struct hif_msg_callbacks { uint8_t pipeID); void (*txResourceAvailHandler)(void *context, uint8_t pipe); void (*fwEventHandler)(void *context, QDF_STATUS status); + void (*update_bundle_stats)(void *context, uint8_t no_of_pkt_in_bundle); }; enum hif_target_status { diff --git a/hif/src/usb/usbdrv.c b/hif/src/usb/usbdrv.c index 1950b1f950..c56aa31528 100644 --- a/hif/src/usb/usbdrv.c +++ b/hif/src/usb/usbdrv.c @@ -679,6 +679,11 @@ static void usb_hif_usb_recv_complete(struct urb *urb) } /* note: queue implements a lock */ skb_queue_tail(&pipe->io_comp_queue, buf); + + if (pipe->device->htc_callbacks.update_bundle_stats) + pipe->device->htc_callbacks.update_bundle_stats + (pipe->device->htc_callbacks.Context, 1); + HIF_USB_SCHEDULE_WORK(pipe); } while (false); @@ -722,6 +727,7 @@ static void usb_hif_usb_recv_bundle_complete(struct urb *urb) HTC_FRAME_HDR *HtcHdr; uint16_t payloadLen; qdf_nbuf_t new_skb = NULL; + uint8_t no_of_pkt_in_bundle; HIF_DBG("+%s: recv pipe: %d, stat:%d,len:%d urb:0x%pK", __func__, @@ -769,6 +775,7 @@ static void usb_hif_usb_recv_bundle_complete(struct urb *urb) qdf_nbuf_peek_header(buf, &netdata, &netlen); netlen = urb->actual_length; + no_of_pkt_in_bundle = 0; do { uint16_t frame_len; @@ -818,7 +825,14 @@ static void usb_hif_usb_recv_bundle_complete(struct urb *urb) new_skb = NULL; netdata += frame_len; netlen -= frame_len; + no_of_pkt_in_bundle++; } while (netlen); + + if (pipe->device->htc_callbacks.update_bundle_stats) + pipe->device->htc_callbacks.update_bundle_stats + (pipe->device->htc_callbacks.Context, + no_of_pkt_in_bundle); + HIF_USB_SCHEDULE_WORK(pipe); } while (false); diff --git a/htc/htc.c b/htc/htc.c index 9db6f11b52..5354f96148 100644 --- a/htc/htc.c +++ b/htc/htc.c @@ -247,6 +247,23 @@ int htc_runtime_resume(HTC_HANDLE htc_ctx) static inline void htc_runtime_pm_init(HTC_TARGET *target) { } #endif +#if defined(DEBUG_HL_LOGGING) && defined(CONFIG_HL_SUPPORT) +static +void htc_update_rx_bundle_stats(void *ctx, uint8_t no_of_pkt_in_bundle) +{ + HTC_TARGET *target = (HTC_TARGET *)ctx; + + no_of_pkt_in_bundle--; + if (target && (no_of_pkt_in_bundle < HTC_MAX_MSG_PER_BUNDLE_RX)) + target->rx_bundle_stats[no_of_pkt_in_bundle]++; +} +#else +static +void htc_update_rx_bundle_stats(void *ctx, uint8_t no_of_pkt_in_bundle) +{ +} +#endif + /* registered target arrival callback from the HIF layer */ HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo, qdf_device_t osdev, uint32_t con_mode) @@ -316,6 +333,7 @@ HTC_HANDLE htc_create(void *ol_sc, struct htc_init_info *pInfo, htcCallbacks.txResourceAvailHandler = htc_tx_resource_avail_handler; htcCallbacks.fwEventHandler = htc_fw_event_handler; + htcCallbacks.update_bundle_stats = htc_update_rx_bundle_stats; target->hif_dev = ol_sc; /* Get HIF default pipe for HTC message exchange */ diff --git a/htc/htc_send.c b/htc/htc_send.c index 721c50b1ea..19a91149b4 100644 --- a/htc/htc_send.c +++ b/htc/htc_send.c @@ -295,8 +295,10 @@ htc_send_update_tx_bundle_stats(HTC_TARGET *target, qdf_size_t data_len, int TxCreditSize) { - if ((data_len / TxCreditSize) <= HTC_MAX_MSG_PER_BUNDLE_TX) - target->tx_bundle_stats[(data_len / TxCreditSize) - 1]++; + int index = ((data_len + TxCreditSize - 1) / TxCreditSize) - 1; + + if (index < HTC_MAX_MSG_PER_BUNDLE_TX) + target->tx_bundle_stats[index]++; } /**