浏览代码

qcacmn: Update tx/rx bundle statistics for USB interface

Update tx/rx bundle statistics for USB interface.

Change-Id: Ia7951f9feb88ca28e055d9f32f0dfee65c7f0bf9
CRs-Fixed: 2571550
Nirav Shah 5 年之前
父节点
当前提交
eb26831637
共有 4 个文件被更改,包括 37 次插入2 次删除
  1. 1 0
      hif/inc/hif.h
  2. 14 0
      hif/src/usb/usbdrv.c
  3. 18 0
      htc/htc.c
  4. 4 2
      htc/htc_send.c

+ 1 - 0
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 {

+ 14 - 0
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);
 

+ 18 - 0
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 */

+ 4 - 2
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]++;
 }
 
 /**