Browse Source

qcacld-3.0: Changes to support WDI_EVENT_SW_EVENT for packetlog

Changes in host to support WDI_EVENT_SW_EVENT for packetlog.

Change-Id: I8936a408a7da21ad293b6da7af146298c049052d
CRs-fixed: 1047382
Nirav Shah 8 years ago
parent
commit
dcc4c875c4

+ 1 - 0
core/dp/txrx/wdi_event.h

@@ -38,6 +38,7 @@ enum WDI_EVENT {
 	WDI_EVENT_RX_DESC_REMOTE,
 	WDI_EVENT_RATE_FIND,
 	WDI_EVENT_RATE_UPDATE,
+	WDI_EVENT_SW_EVENT,
 	WDI_EVENT_RX_PEER_INVALID,
 	/* End of new event items */
 

+ 2 - 0
core/utils/pktlog/include/pktlog_ac_i.h

@@ -67,6 +67,8 @@ A_STATUS process_rx_info(void *pdev, void *data);
 A_STATUS process_rx_info_remote(void *pdev, void *data);
 A_STATUS process_rate_find(void *pdev, void *data);
 A_STATUS process_rate_update(void *pdev, void *data);
+A_STATUS process_sw_event(void *pdev, void *data);
+
 
 #endif /* REMOVE_PKT_LOG */
 #endif

+ 34 - 0
core/utils/pktlog/pktlog_ac.c

@@ -53,6 +53,7 @@ wdi_event_subscribe PKTLOG_RX_SUBSCRIBER;
 wdi_event_subscribe PKTLOG_RX_REMOTE_SUBSCRIBER;
 wdi_event_subscribe PKTLOG_RCFIND_SUBSCRIBER;
 wdi_event_subscribe PKTLOG_RCUPDATE_SUBSCRIBER;
+wdi_event_subscribe PKTLOG_SW_EVENT_SUBSCRIBER;
 
 struct ol_pl_arch_dep_funcs ol_pl_funcs = {
 	.pktlog_init = pktlog_init,
@@ -118,6 +119,9 @@ static inline A_STATUS pktlog_enable_tgt(struct hif_opaque_softc *_scn,
 	if (log_state & ATH_PKTLOG_RCUPDATE)
 		types |= WMI_PKTLOG_EVENT_RCU;
 
+	if (log_state & ATH_PKTLOG_SW_EVENT)
+		types |= WMI_PKTLOG_EVENT_SW;
+
 	return pktlog_wma_post_msg(types, WMI_PDEV_PKTLOG_ENABLE_CMDID);
 }
 
@@ -159,6 +163,14 @@ wdi_pktlog_subscribe(struct ol_txrx_pdev_t *txrx_pdev, int32_t log_state)
 			return A_ERROR;
 		}
 	}
+	if (log_state & ATH_PKTLOG_SW_EVENT) {
+		if (wdi_event_sub(txrx_pdev,
+				  &PKTLOG_SW_EVENT_SUBSCRIBER,
+				  WDI_EVENT_SW_EVENT)) {
+			return A_ERROR;
+		}
+	}
+
 	return A_OK;
 }
 
@@ -220,6 +232,17 @@ void pktlog_callback(void *pdev, enum WDI_EVENT event, void *log_data)
 		}
 		break;
 	}
+	case WDI_EVENT_SW_EVENT:
+	{
+		/*
+		 * process SW EVENT message
+		 */
+		if (process_sw_event(pdev, log_data)) {
+			printk("Unable to process SW_EVENT\n");
+			return;
+		}
+		break;
+	}
 	default:
 		break;
 	}
@@ -260,6 +283,13 @@ wdi_pktlog_unsubscribe(struct ol_txrx_pdev_t *txrx_pdev, uint32_t log_state)
 			return A_ERROR;
 		}
 	}
+	if (log_state & ATH_PKTLOG_RCUPDATE) {
+		if (wdi_event_unsub(txrx_pdev,
+				    &PKTLOG_SW_EVENT_SUBSCRIBER,
+				    WDI_EVENT_SW_EVENT)) {
+			return A_ERROR;
+		}
+	}
 	return A_OK;
 }
 
@@ -325,6 +355,7 @@ void pktlog_init(struct hif_opaque_softc *scn)
 	PKTLOG_RX_REMOTE_SUBSCRIBER.callback = pktlog_callback;
 	PKTLOG_RCFIND_SUBSCRIBER.callback = pktlog_callback;
 	PKTLOG_RCUPDATE_SUBSCRIBER.callback = pktlog_callback;
+	PKTLOG_SW_EVENT_SUBSCRIBER.callback = pktlog_callback;
 }
 
 int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state)
@@ -485,6 +516,9 @@ void pktlog_process_fw_msg(uint32_t *buff)
 	else if (log_type == PKTLOG_TYPE_RX_STAT)
 		wdi_event_handler(WDI_EVENT_RX_DESC,
 				  txrx_pdev, pl_hdr);
+	else if (log_type == PKTLOG_TYPE_SW_EVENT)
+		wdi_event_handler(WDI_EVENT_SW_EVENT,
+				  txrx_pdev, pl_hdr);
 
 }
 

+ 64 - 0
core/utils/pktlog/pktlog_internal.c

@@ -700,6 +700,70 @@ A_STATUS process_rate_find(void *pdev, void *data)
 	return A_OK;
 }
 
+A_STATUS process_sw_event(void *pdev, void *data)
+{
+	struct ol_pktlog_dev_t *pl_dev;
+	struct ath_pktlog_hdr pl_hdr;
+	struct ath_pktlog_info *pl_info;
+	size_t log_size;
+
+	/*
+	 * Will be uncommented when the rate control find
+	 * for pktlog is implemented in the firmware.
+	 * Currently derived from the TX PPDU status
+	 */
+	struct ath_pktlog_sw_event sw_event;
+	uint32_t *pl_tgt_hdr;
+
+	if (!pdev) {
+		qdf_print("Invalid pdev in %s\n", __func__);
+		return A_ERROR;
+	}
+	if (!data) {
+		qdf_print("Invalid data in %s\n", __func__);
+		return A_ERROR;
+	}
+
+	pl_tgt_hdr = (uint32_t *) data;
+	/*
+	 * Makes the short words (16 bits) portable b/w little endian
+	 * and big endian
+	 */
+	pl_hdr.flags = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_FLAGS_OFFSET) &
+			ATH_PKTLOG_HDR_FLAGS_MASK) >>
+		       ATH_PKTLOG_HDR_FLAGS_SHIFT;
+	pl_hdr.missed_cnt = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MISSED_CNT_OFFSET) &
+			     ATH_PKTLOG_HDR_MISSED_CNT_MASK) >>
+			    ATH_PKTLOG_HDR_MISSED_CNT_SHIFT;
+#ifdef HELIUMPLUS
+	pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
+			   ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
+			  ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
+	pl_hdr.macId = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_MAC_ID_OFFSET) &
+			   ATH_PKTLOG_HDR_MAC_ID_MASK) >>
+			  ATH_PKTLOG_HDR_MAC_ID_SHIFT;
+#else
+	pl_hdr.log_type = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_LOG_TYPE_OFFSET) &
+				   ATH_PKTLOG_HDR_LOG_TYPE_MASK) >>
+				  ATH_PKTLOG_HDR_LOG_TYPE_SHIFT;
+#endif
+
+	pl_hdr.size = (*(pl_tgt_hdr + ATH_PKTLOG_HDR_SIZE_OFFSET) &
+		       ATH_PKTLOG_HDR_SIZE_MASK) >> ATH_PKTLOG_HDR_SIZE_SHIFT;
+	pl_hdr.timestamp = *(pl_tgt_hdr + ATH_PKTLOG_HDR_TIMESTAMP_OFFSET);
+	pl_dev = ((struct ol_txrx_pdev_t *)pdev)->pl_dev;
+	pl_info = pl_dev->pl_info;
+	log_size = pl_hdr.size;
+	sw_event.sw_event = (void *)pktlog_getbuf(pl_dev, pl_info,
+					       log_size, &pl_hdr);
+
+	qdf_mem_copy(sw_event.sw_event,
+				 ((char *)data + sizeof(struct ath_pktlog_hdr)),
+				 pl_hdr.size);
+
+	return A_OK;
+}
+
 A_STATUS process_rate_update(void *pdev, void *data)
 {
 	struct ol_pktlog_dev_t *pl_dev;

+ 2 - 1
core/wma/src/wma_main.c

@@ -5329,7 +5329,8 @@ void wma_set_wifi_start_packet_stats(void *wma_handle,
 	}
 
 	log_state = ATH_PKTLOG_ANI | ATH_PKTLOG_RCUPDATE | ATH_PKTLOG_RCFIND |
-		ATH_PKTLOG_RX | ATH_PKTLOG_TX | ATH_PKTLOG_TEXT;
+		ATH_PKTLOG_RX | ATH_PKTLOG_TX |
+		ATH_PKTLOG_TEXT | ATH_PKTLOG_SW_EVENT;
 
 	if (start_log->verbose_level == WLAN_LOG_LEVEL_ACTIVE) {
 		pktlog_enable(scn, log_state);

+ 10 - 1
uapi/linux/pktlog_ac_fmt.h

@@ -123,6 +123,8 @@ enum {
 #define ATH_PKTLOG_TEXT     0x000000020
 #define ATH_PKTLOG_PHYERR   0x000000040
 #define ATH_PKTLOG_PROMISC  0x000000080
+#define ATH_PKTLOG_SW_EVENT 0x000000100
+
 
 /* Types of packet log events */
 #define PKTLOG_TYPE_TX_CTRL     1
@@ -133,7 +135,9 @@ enum {
 #define PKTLOG_TYPE_RC_FIND     6
 #define PKTLOG_TYPE_RC_UPDATE   7
 #define PKTLOG_TYPE_TX_VIRT_ADDR 8
-#define PKTLOG_TYPE_MAX          9
+#define PKTLOG_TYPE_SMART_ANTENNA 9
+#define PKTLOG_TYPE_SW_EVENT     10
+#define PKTLOG_TYPE_MAX          11
 
 #define PKTLOG_MAX_TXCTL_WORDS 57       /* +2 words for bitmap */
 #define PKTLOG_MAX_TXSTATUS_WORDS 32
@@ -225,6 +229,11 @@ struct ath_pktlog_rc_find {
 	void *rcFind;
 } __ATTRIB_PACK;
 
+struct ath_pktlog_sw_event {
+	struct ath_pktlog_hdr pl_hdr;
+	void *sw_event;
+} __ATTRIB_PACK;
+
 struct ath_pktlog_rc_update {
 	struct ath_pktlog_hdr pl_hdr;
 	void *txRateCtrl;       /* rate control state proper */