浏览代码

qcacmn: Remove PROTO_TRACE feature

Remove PROTO_TRACE feature and add MGMT packet
logging in DPTRACE

Change-Id: I0437a2100554628607c561b0e815c0009f1c5606
CRs-Fixed: 1008087
Nirav Shah 9 年之前
父节点
当前提交
31d694b25a
共有 5 个文件被更改,包括 165 次插入98 次删除
  1. 0 32
      qdf/inc/qdf_nbuf.h
  2. 99 14
      qdf/inc/qdf_trace.h
  3. 0 6
      qdf/linux/src/i_qdf_nbuf.h
  4. 0 45
      qdf/linux/src/qdf_nbuf.c
  5. 66 1
      qdf/linux/src/qdf_trace.c

+ 0 - 32
qdf/inc/qdf_nbuf.h

@@ -1037,27 +1037,6 @@ static inline uint8_t qdf_nbuf_trace_get_proto_type(qdf_nbuf_t buf)
 	return __qdf_nbuf_trace_get_proto_type(buf);
 }
 
-#ifdef QCA_PKT_PROTO_TRACE
-/**
- * qdf_nbuf_trace_set_proto_type() - this function updates packet proto type
- * @buf: Network buffer
- * @proto_type: Protocol type
- *
- * Return: none
- */
-static inline void
-qdf_nbuf_trace_set_proto_type(qdf_nbuf_t buf, uint8_t proto_type)
-{
-	__qdf_nbuf_trace_set_proto_type(buf, proto_type);
-}
-#else
-static inline void
-qdf_nbuf_trace_set_proto_type(qdf_nbuf_t buf, uint8_t proto_type)
-{
-	return;
-}
-#endif
-
 /**
  * qdf_nbuf_reg_trace_cb() - this function registers protocol trace callback
  * @cb_func_ptr: Callback pointer
@@ -1069,17 +1048,6 @@ static inline void qdf_nbuf_reg_trace_cb(qdf_nbuf_trace_update_t cb_func_ptr)
 	__qdf_nbuf_reg_trace_cb(cb_func_ptr);
 }
 
-/**
- * qdf_nbuf_trace_update() - this function updates protocol event
- * @buf: Network buffer
- * @event_string: Event string pointer
- *
- * Return: none
- */
-static inline void qdf_nbuf_trace_update(qdf_nbuf_t buf, char *event_string)
-{
-	__qdf_nbuf_trace_update(buf, event_string);
-}
 
 /**
  * qdf_nbuf_set_tx_parallel_dnload_frm() - set tx parallel download

+ 99 - 14
qdf/inc/qdf_trace.h

@@ -173,19 +173,33 @@ typedef struct s_qdf_trace_data {
 
 /**
  * enum QDF_DP_TRACE_ID - Generic ID to identify various events in data path
- * @QDF_DP_TRACE_INVALID: Invalid ID
- * @QDF_DP_TRACE_DROP_PACKET_RECORD: Dropped packet stored with this id
- * @QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD: nbuf->data ptr of HDD
- * @QDF_DP_TRACE_HDD_TX_PACKET_RECORD: nbuf->data stored with this id
- * @QDF_DP_TRACE_CE_PACKET_PTR_RECORD: nbuf->data ptr of CE
- * @QDF_DP_TRACE_CE_PACKET_RECORD: nbuf->data stored with this id
- * @QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD: nbuf->data ptr of txrx queue
- * @QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD: nbuf->data ptr of txrx
- * @QDF_DP_TRACE_HTT_PACKET_PTR_RECORD: nbuf->data ptr of htt
- * @QDF_DP_TRACE_HTC_PACKET_PTR_RECORD: nbuf->data ptr of htc
- * @QDF_DP_TRACE_HIF_PACKET_PTR_RECORD: nbuf->data ptr of hif
- * @QDF_DP_TRACE_HDD_TX_TIMEOUT: hdd tx timeout event
- * @QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT: hdd tx softap timeout event
+ * @QDF_DP_TRACE_INVALID - invalid
+ * @QDF_DP_TRACE_DROP_PACKET_RECORD - record drop packet
+ * @QDF_DP_TRACE_EAPOL_PACKET_RECORD - record EAPOL packet
+ * @QDF_DP_TRACE_DHCP_PACKET_RECORD - record DHCP packet
+ * @QDF_DP_TRACE_ARP_PACKET_RECORD - record ARP packet
+ * @QDF_DP_TRACE_MGMT_PACKET_RECORD - record MGMT pacekt
+ * @QDF_DP_TRACE_DEFAULT_VERBOSITY - below this are part of default verbosity
+ * @QDF_DP_TRACE_HDD_TX_TIMEOUT - HDD tx timeout
+ * @QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT- SOFTAP HDD tx timeout
+ * @QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD - HDD layer ptr record
+ * @QDF_DP_TRACE_CE_PACKET_PTR_RECORD - CE layer ptr record
+ * @QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD- CE fastpath ptr record
+ * @QDF_DP_TRACE_FREE_PACKET_PTR_RECORD - tx completion ptr record
+ * @QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD - HTT RX record
+ * @QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD- HTT RX offload record
+ * @QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD - HDD RX record
+ * @QDF_DP_TRACE_LOW_VERBOSITY - below this are part of low verbosity
+ * @QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD -tx queue ptr record
+ * @QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
+ * @QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD - txrx fast path record
+ * @QDF_DP_TRACE_HTT_PACKET_PTR_RECORD - htt packet ptr record
+ * @QDF_DP_TRACE_HTC_PACKET_PTR_RECORD - htc packet ptr record
+ * @QDF_DP_TRACE_HIF_PACKET_PTR_RECORD - hif packet ptr record
+ * @QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
+ * @QDF_DP_TRACE_MED_VERBOSITY - below this are part of med verbosity
+ * @QDF_DP_TRACE_HDD_TX_PACKET_RECORD - record 32 bytes at HDD
+ * @QDF_DP_TRACE_HIGH_VERBOSITY - below this are part of high verbosity
  */
 enum  QDF_DP_TRACE_ID {
 	QDF_DP_TRACE_INVALID,
@@ -193,6 +207,7 @@ enum  QDF_DP_TRACE_ID {
 	QDF_DP_TRACE_EAPOL_PACKET_RECORD,
 	QDF_DP_TRACE_DHCP_PACKET_RECORD,
 	QDF_DP_TRACE_ARP_PACKET_RECORD,
+	QDF_DP_TRACE_MGMT_PACKET_RECORD,
 	QDF_DP_TRACE_DEFAULT_VERBOSITY,
 	QDF_DP_TRACE_HDD_TX_TIMEOUT,
 	QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT,
@@ -217,13 +232,41 @@ enum  QDF_DP_TRACE_ID {
 	QDF_DP_TRACE_MAX
 };
 
+/**
+ * qdf_proto_type - protocol type
+ * @QDF_PROTO_TYPE_DHCP - DHCP
+ * @QDF_PROTO_TYPE_EAPOL - EAPOL
+ * @QDF_PROTO_TYPE_ARP - ARP
+ * @QDF_PROTO_TYPE_MGMT - MGMT
+ */
 enum qdf_proto_type {
 	QDF_PROTO_TYPE_DHCP,
 	QDF_PROTO_TYPE_EAPOL,
 	QDF_PROTO_TYPE_ARP,
+	QDF_PROTO_TYPE_MGMT,
 	QDF_PROTO_TYPE_MAX
 };
 
+/**
+ * qdf_proto_subtype - subtype of packet
+ * @QDF_PROTO_EAPOL_M1 - EAPOL 1/4
+ * @QDF_PROTO_EAPOL_M2 - EAPOL 2/4
+ * @QDF_PROTO_EAPOL_M3 - EAPOL 3/4
+ * @QDF_PROTO_EAPOL_M4 - EAPOL 4/4
+ * @QDF_PROTO_DHCP_DISCOVER - discover
+ * @QDF_PROTO_DHCP_REQUEST - request
+ * @QDF_PROTO_DHCP_OFFER - offer
+ * @QDF_PROTO_DHCP_ACK - ACK
+ * @QDF_PROTO_DHCP_NACK - NACK
+ * @QDF_PROTO_DHCP_RELEASE - release
+ * @QDF_PROTO_DHCP_INFORM - inform
+ * @QDF_PROTO_DHCP_DECLINE - decline
+ * @QDF_PROTO_ARP_SUBTYPE - arp
+ * @QDF_PROTO_MGMT_ASSOC -assoc
+ * @QDF_PROTO_MGMT_DISASSOC - disassoc
+ * @QDF_PROTO_MGMT_AUTH - auth
+ * @QDF_PROTO_MGMT_DEAUTH - deauth
+ */
 enum qdf_proto_subtype {
 	QDF_PROTO_INVALID,
 	QDF_PROTO_EAPOL_M1,
@@ -239,20 +282,46 @@ enum qdf_proto_subtype {
 	QDF_PROTO_DHCP_INFORM,
 	QDF_PROTO_DHCP_DECLINE,
 	QDF_PROTO_ARP_SUBTYPE,
+	QDF_PROTO_MGMT_ASSOC,
+	QDF_PROTO_MGMT_DISASSOC,
+	QDF_PROTO_MGMT_AUTH,
+	QDF_PROTO_MGMT_DEAUTH,
 	QDF_PROTO_SUBTYPE_MAX
 };
 
+/**
+ * qdf_proto_dir - direction
+ * @QDF_TX: TX direction
+ * @QDF_RX: RX direction
+ * @QDF_NA: not applicable
+ */
 enum qdf_proto_dir {
 	QDF_TX,
-	QDF_RX
+	QDF_RX,
+	QDF_NA
 };
 
+/**
+ * struct qdf_dp_trace_ptr_buf - pointer record buffer
+ * @cookie: cookie value
+ * @msdu_id: msdu_id
+ * @status: completion status
+ */
 struct qdf_dp_trace_ptr_buf {
 	uint64_t cookie;
 	uint16_t msdu_id;
 	uint16_t status;
 };
 
+/**
+ * struct qdf_dp_trace_proto_buf - proto packet buffer
+ * @sa: source address
+ * @da: destination address
+ * @vdev_id : vdev id
+ * @type: packet type
+ * @subtype: packet subtype
+ * @dir: direction
+ */
 struct qdf_dp_trace_proto_buf {
 	struct qdf_mac_addr sa;
 	struct qdf_mac_addr da;
@@ -262,6 +331,18 @@ struct qdf_dp_trace_proto_buf {
 	uint8_t dir;
 };
 
+/**
+ * struct qdf_dp_trace_mgmt_buf - mgmt packet buffer
+ * @vdev_id : vdev id
+ * @type: packet type
+ * @subtype: packet subtype
+ */
+struct qdf_dp_trace_mgmt_buf {
+	uint8_t vdev_id;
+	uint8_t type;
+	uint8_t subtype;
+};
+
 /**
  * struct qdf_dp_trace_record_s - Describes a record in DP trace
  * @time: time when it got stored
@@ -374,6 +455,10 @@ 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_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,
+			      uint16_t index);
 #else
 static inline
 void qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,

+ 0 - 6
qdf/linux/src/i_qdf_nbuf.h

@@ -482,12 +482,6 @@ QDF_STATUS __qdf_nbuf_frag_map(
 	qdf_device_t osdev, __qdf_nbuf_t nbuf,
 	int offset, qdf_dma_dir_t dir, int cur_frag);
 
-#ifdef QCA_PKT_PROTO_TRACE
-void __qdf_nbuf_trace_update(struct sk_buff *buf, char *event_string);
-#else
-#define __qdf_nbuf_trace_update(skb, event_string)
-#endif /* QCA_PKT_PROTO_TRACE */
-
 bool __qdf_nbuf_is_ipv4_pkt(struct sk_buff *skb);
 bool __qdf_nbuf_is_ipv4_dhcp_pkt(struct sk_buff *skb);
 bool __qdf_nbuf_is_ipv4_eapol_pkt(struct sk_buff *skb);

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

@@ -553,51 +553,6 @@ bool __qdf_nbuf_is_ipv4_arp_pkt(struct sk_buff *skb)
 		return false;
 }
 
-#ifdef QCA_PKT_PROTO_TRACE
-/**
- * __qdf_nbuf_trace_update() - update trace event
- * @skb: Pointer to network buffer
- * @event_string: Pointer to trace callback function
- *
- * Return: none
- */
-void __qdf_nbuf_trace_update(struct sk_buff *buf, char *event_string)
-{
-	char string_buf[QDF_NBUF_PKT_TRAC_MAX_STRING];
-
-	if ((!qdf_trace_update_cb) || (!event_string))
-		return;
-
-	if (!qdf_nbuf_trace_get_proto_type(buf))
-		return;
-
-	/* Buffer over flow */
-	if (QDF_NBUF_PKT_TRAC_MAX_STRING <=
-	    (qdf_str_len(event_string) + QDF_NBUF_PKT_TRAC_PROTO_STRING)) {
-		return;
-	}
-
-	qdf_mem_zero(string_buf, QDF_NBUF_PKT_TRAC_MAX_STRING);
-	qdf_mem_copy(string_buf, event_string, qdf_str_len(event_string));
-	if (QDF_NBUF_PKT_TRAC_TYPE_EAPOL & qdf_nbuf_trace_get_proto_type(buf)) {
-		qdf_mem_copy(string_buf + qdf_str_len(event_string),
-			     "EPL", QDF_NBUF_PKT_TRAC_PROTO_STRING);
-	} else if (QDF_NBUF_PKT_TRAC_TYPE_DHCP &
-		 qdf_nbuf_trace_get_proto_type(buf)) {
-		qdf_mem_copy(string_buf + qdf_str_len(event_string),
-			     "DHC", QDF_NBUF_PKT_TRAC_PROTO_STRING);
-	} else if (QDF_NBUF_PKT_TRAC_TYPE_MGMT_ACTION &
-		   qdf_nbuf_trace_get_proto_type(buf)) {
-		qdf_mem_copy(string_buf + qdf_str_len(event_string),
-			     "MACT", QDF_NBUF_PKT_TRAC_PROTO_STRING);
-	}
-
-	qdf_trace_update_cb(string_buf);
-	return;
-}
-EXPORT_SYMBOL(__qdf_nbuf_trace_update);
-#endif /* QCA_PKT_PROTO_TRACE */
-
 #ifdef MEMORY_DEBUG
 #define QDF_NET_BUF_TRACK_MAX_SIZE    (1024)
 

+ 66 - 1
qdf/linux/src/qdf_trace.c

@@ -731,7 +731,8 @@ void qdf_dp_trace_init(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 = 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_DEFAULT;
 	g_qdf_dp_trace_data.enable = true;
@@ -747,6 +748,8 @@ void qdf_dp_trace_init(void)
 	qdf_dp_trace_cb_table[QDF_DP_TRACE_DHCP_PACKET_RECORD] =
 	qdf_dp_trace_cb_table[QDF_DP_TRACE_ARP_PACKET_RECORD] =
 						qdf_dp_display_proto_pkt;
+	qdf_dp_trace_cb_table[QDF_DP_TRACE_MGMT_PACKET_RECORD] =
+					qdf_dp_display_mgmt_pkt;
 
 }
 EXPORT_SYMBOL(qdf_dp_trace_init);
@@ -889,6 +892,8 @@ const char *qdf_dp_code_to_string(enum QDF_DP_TRACE_ID code)
 		return "DHCP:";
 	case QDF_DP_TRACE_ARP_PACKET_RECORD:
 		return "ARP:";
+	case QDF_DP_TRACE_MGMT_PACKET_RECORD:
+		return "MGMT:";
 	case QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD:
 		return "HDD: TX: PTR:";
 	case QDF_DP_TRACE_HDD_TX_PACKET_RECORD:
@@ -963,6 +968,8 @@ const char *qdf_dp_type_to_str(enum qdf_proto_type type)
 		return "EAPOL";
 	case QDF_PROTO_TYPE_ARP:
 		return "ARP";
+	case QDF_PROTO_TYPE_MGMT:
+		return "MGMT";
 	default:
 		return "invalid";
 	}
@@ -1004,6 +1011,14 @@ const char *qdf_dp_subtype_to_str(enum qdf_proto_subtype subtype)
 		return "DECLINE";
 	case QDF_PROTO_ARP_SUBTYPE:
 		return "NA";
+	case QDF_PROTO_MGMT_ASSOC:
+		return "ASSOC";
+	case QDF_PROTO_MGMT_DISASSOC:
+		return "DISASSOC";
+	case QDF_PROTO_MGMT_AUTH:
+		return "AUTH";
+	case QDF_PROTO_MGMT_DEAUTH:
+		return "DEAUTH";
 	default:
 		return "invalid";
 	}
@@ -1303,6 +1318,56 @@ void qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,
 }
 EXPORT_SYMBOL(qdf_dp_trace_log_pkt);
 
+/**
+ * qdf_dp_display_mgmt_pkt() - display proto packet
+ * @record: dptrace record
+ * @index: index
+ *
+ * Return: none
+ */
+void qdf_dp_display_mgmt_pkt(struct qdf_dp_trace_record_s *record,
+			      uint16_t index)
+{
+	struct qdf_dp_trace_mgmt_buf *buf =
+		(struct qdf_dp_trace_mgmt_buf *)record->data;
+
+	qdf_print("DPT: %04d: %012llu: %s vdev_id %d", index,
+		record->time, qdf_dp_code_to_string(record->code),
+		buf->vdev_id);
+	qdf_print("DPT: Type %s Subtype %s", qdf_dp_type_to_str(buf->type),
+		qdf_dp_subtype_to_str(buf->subtype));
+}
+EXPORT_SYMBOL(qdf_dp_display_mgmt_pkt);
+
+/**
+ * qdf_dp_trace_mgmt_pkt() - record mgmt packet
+ * @code: dptrace code
+ * @vdev_id: vdev id
+ * @type: proto type
+ * @subtype: proto subtype
+ *
+ * Return: none
+ */
+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)
+{
+	struct qdf_dp_trace_mgmt_buf buf;
+	int buf_size = sizeof(struct qdf_dp_trace_mgmt_buf);
+
+	if (qdf_dp_enable_check(NULL, code, QDF_NA) == false)
+		return;
+
+	if (buf_size > QDF_DP_TRACE_RECORD_SIZE)
+		QDF_BUG(0);
+
+	buf.type = type;
+	buf.subtype = subtype;
+	buf.vdev_id = vdev_id;
+	qdf_dp_add_record(code, (uint8_t *)&buf, buf_size);
+}
+EXPORT_SYMBOL(qdf_dp_trace_mgmt_pkt);
+
+
 /**
  * qdf_dp_display_proto_pkt() - display proto packet
  * @record: dptrace record