Browse Source

qcacmn: Enhance data path related statistics

Enhance data path related statistics.
- Add per reason pause time
- Enahnce TSO stats
- clear DPTRACE buffer

Change-Id: Ic884e5a2ba9da34651f524a5b099c20d3b7f83a1
CRs-Fixed: 1017437
Nirav Shah 9 years ago
parent
commit
cede289aad
4 changed files with 66 additions and 13 deletions
  1. 4 0
      qdf/inc/qdf_nbuf.h
  2. 11 2
      qdf/inc/qdf_trace.h
  3. 0 1
      qdf/linux/src/qdf_nbuf.c
  4. 51 10
      qdf/linux/src/qdf_trace.c

+ 4 - 0
qdf/inc/qdf_nbuf.h

@@ -143,6 +143,10 @@ struct mon_rx_status {
 #define QDF_DHCP_RELEASE			(7)
 #define QDF_DHCP_INFORM				(8)
 
+#define ARP_SUB_TYPE_OFFSET  20
+#define ARP_REQUEST			(1)
+#define ARP_RESPONSE		(2)
+
 #define QDF_NBUF_IPA_CHECK_MASK		0x80000000
 
 /**

+ 11 - 2
qdf/inc/qdf_trace.h

@@ -107,6 +107,7 @@ typedef enum {
 
 #define DUMP_DP_TRACE       0
 #define ENABLE_DP_TRACE_LIVE_MODE	1
+#define CLEAR_DP_TRACE_BUFFER	2
 
 #ifdef TRACE_RECORD
 
@@ -261,7 +262,8 @@ enum qdf_proto_type {
  * @QDF_PROTO_DHCP_RELEASE - release
  * @QDF_PROTO_DHCP_INFORM - inform
  * @QDF_PROTO_DHCP_DECLINE - decline
- * @QDF_PROTO_ARP_SUBTYPE - arp
+ * @QDF_PROTO_ARP_REQ - arp request
+ * @QDF_PROTO_ARP_RES - arp response
  * @QDF_PROTO_MGMT_ASSOC -assoc
  * @QDF_PROTO_MGMT_DISASSOC - disassoc
  * @QDF_PROTO_MGMT_AUTH - auth
@@ -281,7 +283,8 @@ enum qdf_proto_subtype {
 	QDF_PROTO_DHCP_RELEASE,
 	QDF_PROTO_DHCP_INFORM,
 	QDF_PROTO_DHCP_DECLINE,
-	QDF_PROTO_ARP_SUBTYPE,
+	QDF_PROTO_ARP_REQ,
+	QDF_PROTO_ARP_RES,
 	QDF_PROTO_MGMT_ASSOC,
 	QDF_PROTO_MGMT_DISASSOC,
 	QDF_PROTO_MGMT_AUTH,
@@ -455,6 +458,7 @@ qdf_dp_trace_proto_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
 void qdf_dp_display_proto_pkt(struct qdf_dp_trace_record_s *record,
 				uint16_t index);
 void qdf_dp_trace_enable_live_mode(void);
+void qdf_dp_trace_clear_buffer(void);
 void qdf_dp_trace_mgmt_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
 		enum qdf_proto_type type, enum qdf_proto_subtype subtype);
 void qdf_dp_display_mgmt_pkt(struct qdf_dp_trace_record_s *record,
@@ -488,6 +492,11 @@ void qdf_dp_trace_enable_live_mode(void)
 {
 }
 
+static inline
+void qdf_dp_trace_clear_buffer(void)
+{
+}
+
 #endif
 
 

+ 0 - 1
qdf/linux/src/qdf_nbuf.c

@@ -1348,7 +1348,6 @@ EXPORT_SYMBOL(__qdf_nbuf_inc_users);
 
 #endif /* FEATURE_TSO */
 
-
 /**
  * __qdf_nbuf_ref() - Reference the nbuf so it can get held until the last free.
  * @skb: sk_buff handle

+ 51 - 10
qdf/linux/src/qdf_trace.c

@@ -734,7 +734,7 @@ void qdf_dp_trace_init(void)
 	g_qdf_dp_trace_data.proto_bitmap = QDF_NBUF_PKT_TRAC_TYPE_EAPOL |
 	    QDF_NBUF_PKT_TRAC_TYPE_DHCP | QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION;
 	g_qdf_dp_trace_data.no_of_record = 0;
-	g_qdf_dp_trace_data.verbosity    = QDF_DP_TRACE_VERBOSITY_DEFAULT;
+	g_qdf_dp_trace_data.verbosity    = QDF_DP_TRACE_VERBOSITY_LOW;
 	g_qdf_dp_trace_data.enable = true;
 
 	for (i = 0; i < QDF_DP_TRACE_MAX; i++)
@@ -1009,8 +1009,10 @@ const char *qdf_dp_subtype_to_str(enum qdf_proto_subtype subtype)
 		return "INFORM";
 	case QDF_PROTO_DHCP_DECLINE:
 		return "DECLINE";
-	case QDF_PROTO_ARP_SUBTYPE:
-		return "NA";
+	case QDF_PROTO_ARP_REQ:
+		return "REQUEST";
+	case QDF_PROTO_ARP_RES:
+		return "RESPONSE";
 	case QDF_PROTO_MGMT_ASSOC:
 		return "ASSOC";
 	case QDF_PROTO_MGMT_DISASSOC:
@@ -1057,11 +1059,12 @@ EXPORT_SYMBOL(qdf_dp_enable_check);
  * @code: dptrace code
  * @data: data pointer
  * @size: size of buffer
+ * @print: true to print it in kmsg
  *
  * Return: none
  */
 void qdf_dp_add_record(enum QDF_DP_TRACE_ID code,
-		       uint8_t *data, uint8_t size)
+		       uint8_t *data, uint8_t size, bool print)
 {
 	struct qdf_dp_trace_record_s *rec = NULL;
 	int index;
@@ -1106,7 +1109,7 @@ void qdf_dp_add_record(enum QDF_DP_TRACE_ID code,
 	rec->pid = (in_interrupt() ? 0 : current->pid);
 	spin_unlock_bh(&l_dp_trace_lock);
 
-	if (g_qdf_dp_trace_data.live_mode)
+	if (g_qdf_dp_trace_data.live_mode || (print == true))
 		qdf_dp_trace_cb_table[rec->code] (rec, index);
 }
 EXPORT_SYMBOL(qdf_dp_add_record);
@@ -1276,12 +1279,29 @@ EXPORT_SYMBOL(qdf_log_dhcp_pkt);
 bool qdf_log_arp_pkt(uint8_t session_id, struct sk_buff *skb,
 		     enum qdf_proto_dir dir)
 {
+	uint16_t subtype;
+	enum qdf_proto_subtype proto_subtype;
+
 	if ((qdf_dp_get_proto_bitmap() & QDF_NBUF_PKT_TRAC_TYPE_ARP) &&
 	     qdf_nbuf_is_ipv4_arp_pkt(skb) == true) {
+
+		subtype = (uint16_t)(*(uint16_t *)
+			(skb->data + ARP_SUB_TYPE_OFFSET));
+		switch (QDF_SWAP_U16(subtype)) {
+		case ARP_REQUEST:
+			proto_subtype = QDF_PROTO_ARP_REQ;
+			break;
+		case ARP_RESPONSE:
+			proto_subtype = QDF_PROTO_ARP_RES;
+			break;
+		default:
+			proto_subtype = QDF_PROTO_INVALID;
+		}
+
 		DPTRACE(qdf_dp_trace_proto_pkt(QDF_DP_TRACE_ARP_PACKET_RECORD,
 			session_id, (skb->data + QDF_NBUF_SRC_MAC_OFFSET),
 			(skb->data + QDF_NBUF_DEST_MAC_OFFSET),
-			QDF_PROTO_TYPE_ARP, QDF_PROTO_ARP_SUBTYPE, dir));
+			QDF_PROTO_TYPE_ARP, proto_subtype, dir));
 		if (QDF_TX == dir)
 			QDF_NBUF_CB_TX_DP_TRACE(skb) = 1;
 		else if (QDF_RX == dir)
@@ -1363,7 +1383,7 @@ void qdf_dp_trace_mgmt_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
 	buf.type = type;
 	buf.subtype = subtype;
 	buf.vdev_id = vdev_id;
-	qdf_dp_add_record(code, (uint8_t *)&buf, buf_size);
+	qdf_dp_add_record(code, (uint8_t *)&buf, buf_size, true);
 }
 EXPORT_SYMBOL(qdf_dp_trace_mgmt_pkt);
 
@@ -1423,7 +1443,7 @@ void qdf_dp_trace_proto_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
 	buf.type = type;
 	buf.subtype = subtype;
 	buf.vdev_id = vdev_id;
-	qdf_dp_add_record(code, (uint8_t *)&buf, buf_size);
+	qdf_dp_add_record(code, (uint8_t *)&buf, buf_size, true);
 }
 EXPORT_SYMBOL(qdf_dp_trace_proto_pkt);
 
@@ -1479,7 +1499,7 @@ void qdf_dp_trace_ptr(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
 	qdf_mem_copy(&buf.cookie, data, size);
 	buf.msdu_id = msdu_id;
 	buf.status = status;
-	qdf_dp_add_record(code, (uint8_t *)&buf, buf_size);
+	qdf_dp_add_record(code, (uint8_t *)&buf, buf_size, false);
 }
 EXPORT_SYMBOL(qdf_dp_trace_ptr);
 
@@ -1530,7 +1550,7 @@ void qdf_dp_trace(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
 	if (qdf_dp_enable_check(nbuf, code, dir) == false)
 		return;
 
-	qdf_dp_add_record(code, data, size);
+	qdf_dp_add_record(code, data, size, false);
 }
 EXPORT_SYMBOL(qdf_dp_trace);
 
@@ -1560,6 +1580,27 @@ void qdf_dp_trace_enable_live_mode(void)
 EXPORT_SYMBOL(qdf_dp_trace_enable_live_mode);
 
 
+/**
+ * qdf_dp_trace_clear_buffer() - clear dp trace buffer
+ *
+ * Return: none
+ */
+void qdf_dp_trace_clear_buffer(void)
+{
+	g_qdf_dp_trace_data.head = INVALID_QDF_DP_TRACE_ADDR;
+	g_qdf_dp_trace_data.tail = INVALID_QDF_DP_TRACE_ADDR;
+	g_qdf_dp_trace_data.num = 0;
+	g_qdf_dp_trace_data.proto_bitmap = QDF_NBUF_PKT_TRAC_TYPE_EAPOL |
+	    QDF_NBUF_PKT_TRAC_TYPE_DHCP | QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION;
+	g_qdf_dp_trace_data.no_of_record = 0;
+	g_qdf_dp_trace_data.verbosity    = QDF_DP_TRACE_VERBOSITY_LOW;
+	g_qdf_dp_trace_data.enable = true;
+
+	memset(g_qdf_dp_trace_tbl, 0,
+	   MAX_QDF_DP_TRACE_RECORDS * sizeof(struct qdf_dp_trace_record_s));
+}
+EXPORT_SYMBOL(qdf_dp_trace_clear_buffer);
+
 /**
  * qdf_dp_trace_dump_all() - Dump data from ring buffer via call back functions
  * registered with QDF