Explorar el Código

qcacld-3.0: Add support to dump frames on demand

Add support to dump the full management,eapol,
dhcp, arp frames based on the level of the
debug_packet_log configured through ini gEnableDebugLog.

The dump levels are as follows:
* 0x1  - Enable mgmt pkt logs (except probe req/rsp, beacons).
* 0x2  - Enable EAPOL pkt logs.
* 0x4  - Enable DHCP pkt logs.
* 0x8  - Enable mgmt action frames logs.
* 0x10 - Enable ARP pkt logs.
* 0x0  - Disable all the above connection related logs.

Change-Id: If572cccb327da785dd0d56cff6d37ba170b15cc8
CRs-Fixed: 3173604
Surya Prakash Sivaraj hace 3 años
padre
commit
0c0fafc085

+ 26 - 8
components/mlme/dispatcher/inc/cfg_mlme_generic.h

@@ -54,6 +54,23 @@ enum wlan_wds_mode {
 	WLAN_WDS_MODE_MAX = WLAN_WDS_MODE_LAST - 1,
 };
 
+/* debug_packet_log_type: Debug packet log type
+ * DEBUG_PKTLOG_TYPE_NONE: Debug packet log is disabled
+ * DEBUG_PKTLOG_TYPE_MGMT: Management frames logging is enabled.
+ * DEBUG_PKTLOG_TYPE_EAPOL: EAPOL packets logging is enabled.
+ * DEBUG_PKTLOG_TYPE_DHCP: DHCP packets logging is enabled.
+ * DEBUG_PKTLOG_TYPE_ACTION: Action frames logging is enabled.
+ * DEBUG_PKTLOG_TYPE_ARP: ARP packets logging is enabled.
+ */
+enum debug_packet_log_type {
+	DEBUG_PKTLOG_TYPE_NONE   = 0x0,
+	DEBUG_PKTLOG_TYPE_MGMT   = 0x1,
+	DEBUG_PKTLOG_TYPE_EAPOL  = 0x2,
+	DEBUG_PKTLOG_TYPE_DHCP   = 0x4,
+	DEBUG_PKTLOG_TYPE_ACTION = 0x8,
+	DEBUG_PKTLOG_TYPE_ARP    = 0x10,
+};
+
 /*
  * pmfSaQueryMaxRetries - Control PMF SA query retries for SAP
  * @Min: 0
@@ -602,15 +619,16 @@ enum wlan_wds_mode {
  * gEnableDebugLog - Enable/Disable the Connection related logs
  * @Min: 0
  * @Max: 0xFF
- * @Default: 0x0F
+ * @Default: 0x01
  *
  * This ini is used to enable/disable the connection related logs
- * 0x1 - Enable mgmt pkt logs (excpet probe req/rsp, beacons).
- * 0x2 - Enable EAPOL pkt logs.
- * 0x4 - Enable DHCP pkt logs.
- * 0x8 - Enable mgmt action frames logs.
- * 0x0 - Disable all the above connection related logs.
- * The default value of 0x0F will enable all the above logs
+ * 0x1  - Enable mgmt pkt logs (except probe req/rsp, beacons).
+ * 0x2  - Enable EAPOL pkt logs.
+ * 0x4  - Enable DHCP pkt logs.
+ * 0x8  - Enable mgmt action frames logs.
+ * 0x10 - Enable ARP pkt logs.
+ * 0x0  - Disable all the above connection related logs.
+ * The default value of 0x01 will enable all the mgmt logs
  *
  * Related: None
  *
@@ -622,7 +640,7 @@ enum wlan_wds_mode {
  */
 #define CFG_ENABLE_DEBUG_PACKET_LOG CFG_INI_UINT( \
 				"gEnableDebugLog", \
-				0, 0xFF, 0x0F, \
+				0, 0xFF, 0x01, \
 				CFG_VALUE_OR_DEFAULT, \
 				"Enable debug log")
 

+ 17 - 0
core/hdd/inc/wlan_hdd_tx_rx.h

@@ -635,4 +635,21 @@ void hdd_pkt_add_timestamp(struct hdd_adapter *adapter,
 }
 #endif
 
+static inline
+void hdd_debug_pkt_dump(struct sk_buff *skb, int size,
+			uint16_t *dump_level)
+{
+	if (qdf_unlikely(qdf_nbuf_is_ipv4_eapol_pkt(skb)))
+		*dump_level &= DEBUG_PKTLOG_TYPE_EAPOL;
+	else if (qdf_unlikely(qdf_nbuf_is_ipv4_arp_pkt(skb)))
+		*dump_level &= DEBUG_PKTLOG_TYPE_ARP;
+	else if (qdf_unlikely(qdf_nbuf_is_ipv4_dhcp_pkt(skb)))
+		*dump_level &= DEBUG_PKTLOG_TYPE_DHCP;
+	else
+		return;
+
+	if (*dump_level)
+		qdf_trace_hex_dump(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_DEBUG,
+				   qdf_nbuf_data(skb), size);
+}
 #endif /* end #if !defined(WLAN_HDD_TX_RX_H) */

+ 12 - 0
core/hdd/src/wlan_hdd_softap_tx_rx.c

@@ -702,6 +702,8 @@ static void __hdd_softap_hard_start_xmit(struct sk_buff *skb,
 	uint32_t num_seg;
 	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
 	int cpu = qdf_get_smp_processor_id();
+	uint16_t dump_level = cfg_get(hdd_ctx->psoc,
+				      CFG_ENABLE_DEBUG_PACKET_LOG);
 
 	dest_mac_addr = (struct qdf_mac_addr *)skb->data;
 	++stats->per_cpu[cpu].tx_called;
@@ -753,6 +755,9 @@ static void __hdd_softap_hard_start_xmit(struct sk_buff *skb,
 		hdd_event_eapol_log(skb, QDF_TX);
 	}
 
+	if (qdf_unlikely(dump_level >= DEBUG_PKTLOG_TYPE_EAPOL))
+		hdd_debug_pkt_dump(skb, skb->len,  &dump_level);
+
 	hdd_softap_config_tx_pkt_tracing(adapter, skb);
 
 	/* check whether need to linearize skb, like non-linear udp data */
@@ -1107,6 +1112,7 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf)
 	struct hdd_station_info *sta_info;
 	bool is_eapol = false;
 	struct hdd_tx_rx_stats *stats;
+	uint16_t dump_level;
 
 	/* Sanity check on inputs */
 	if (unlikely((!adapter_context) || (!rx_buf))) {
@@ -1130,6 +1136,8 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf)
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	dump_level = cfg_get(hdd_ctx->psoc, CFG_ENABLE_DEBUG_PACKET_LOG);
+
 	stats = &adapter->hdd_stats.tx_rx_stats;
 	/* walk the chain until all are processed */
 	next = (struct sk_buff *)rx_buf;
@@ -1177,6 +1185,10 @@ QDF_STATUS hdd_softap_rx_packet_cbk(void *adapter_context, qdf_nbuf_t rx_buf)
 		if (qdf_nbuf_is_ipv4_eapol_pkt(skb))
 			is_eapol = true;
 
+		if (qdf_unlikely(dump_level >= DEBUG_PKTLOG_TYPE_EAPOL))
+			hdd_debug_pkt_dump(skb, skb->len - skb->data_len,
+					   &dump_level);
+
 		if (qdf_unlikely(is_eapol &&
 		    !(hdd_nbuf_dst_addr_is_self_addr(adapter, skb) ||
 		    hdd_nbuf_dst_addr_is_mld_addr(adapter, skb)))) {

+ 19 - 1
core/hdd/src/wlan_hdd_tx_rx.c

@@ -1117,6 +1117,7 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 	bool is_dhcp = false;
 	struct hdd_tx_rx_stats *stats = &adapter->hdd_stats.tx_rx_stats;
 	int cpu = qdf_get_smp_processor_id();
+	uint16_t dump_level;
 
 #ifdef QCA_WIFI_FTM
 	if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) {
@@ -1141,6 +1142,8 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 		goto drop_pkt;
 	}
 
+	dump_level = cfg_get(hdd_ctx->psoc, CFG_ENABLE_DEBUG_PACKET_LOG);
+
 	/*
 	 * wlan_hdd_mark_pkt_type zeros out skb->cb.  All skb->cb access
 	 * should be after it.
@@ -1184,6 +1187,9 @@ static void __hdd_hard_start_xmit(struct sk_buff *skb,
 		hdd_mark_icmp_req_to_fw(hdd_ctx, skb);
 	}
 
+	if (qdf_unlikely(dump_level >= DEBUG_PKTLOG_TYPE_EAPOL))
+		hdd_debug_pkt_dump(skb, skb->len, &dump_level);
+
 	hdd_pkt_add_timestamp(adapter, QDF_PKT_TX_DRIVER_ENTRY,
 			      qdf_get_log_timestamp(), skb);
 
@@ -2607,7 +2613,7 @@ QDF_STATUS hdd_rx_packet_cbk(void *adapter_context,
 	bool is_eapol, send_over_nl;
 	bool is_dhcp;
 	struct hdd_tx_rx_stats *stats;
-
+	uint16_t dump_level;
 	/* Sanity check on inputs */
 	if (unlikely((!adapter_context) || (!rxBuf))) {
 		QDF_TRACE(QDF_MODULE_ID_HDD_DATA, QDF_TRACE_LEVEL_ERROR,
@@ -2630,6 +2636,8 @@ QDF_STATUS hdd_rx_packet_cbk(void *adapter_context,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	dump_level = cfg_get(hdd_ctx->psoc, CFG_ENABLE_DEBUG_PACKET_LOG);
+
 	cpu_index = wlan_hdd_get_cpu();
 	stats = &adapter->hdd_stats.tx_rx_stats;
 
@@ -2655,6 +2663,7 @@ QDF_STATUS hdd_rx_packet_cbk(void *adapter_context,
 						__func__);
 				track_arp = true;
 			}
+			dump_level &= DEBUG_PKTLOG_TYPE_ARP;
 		} else if (qdf_nbuf_is_ipv4_eapol_pkt(skb)) {
 			subtype = qdf_nbuf_get_eapol_subtype(skb);
 			send_over_nl = true;
@@ -2667,6 +2676,7 @@ QDF_STATUS hdd_rx_packet_cbk(void *adapter_context,
 						eapol_m3_count;
 				is_eapol = true;
 			}
+			dump_level &= DEBUG_PKTLOG_TYPE_EAPOL;
 		} else if (qdf_nbuf_is_ipv4_dhcp_pkt(skb)) {
 			subtype = qdf_nbuf_get_dhcp_subtype(skb);
 			if (subtype == QDF_PROTO_DHCP_OFFER) {
@@ -2678,6 +2688,9 @@ QDF_STATUS hdd_rx_packet_cbk(void *adapter_context,
 						dhcp_ack_count;
 				is_dhcp = true;
 			}
+			dump_level &= DEBUG_PKTLOG_TYPE_DHCP;
+		} else {
+			dump_level = DEBUG_PKTLOG_TYPE_NONE;
 		}
 
 		hdd_pkt_add_timestamp(adapter, QDF_PKT_RX_DRIVER_EXIT,
@@ -2716,6 +2729,11 @@ QDF_STATUS hdd_rx_packet_cbk(void *adapter_context,
 		dest_mac_addr = (struct qdf_mac_addr *)(skb->data);
 		mac_addr = (struct qdf_mac_addr *)(skb->data+QDF_MAC_ADDR_SIZE);
 
+		if (dump_level)
+			qdf_trace_hex_dump(QDF_MODULE_ID_HDD,
+					   QDF_TRACE_LEVEL_DEBUG,
+					   skb->data, skb->len - skb->data_len);
+
 		vdev = hdd_objmgr_get_vdev_by_user(adapter,
 						   WLAN_OSIF_TDLS_ID);
 		if (vdev) {

+ 0 - 4
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -2662,10 +2662,6 @@ void lim_process_assoc_req_frame(struct mac_context *mac_ctx,
 		return;
 	}
 
-	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
-			   (uint8_t *)hdr,
-			   frame_len + WMA_GET_RX_MAC_HEADER_LEN(rx_pkt_info));
-
 	if (false == lim_chk_sa_da(mac_ctx, hdr, session, sub_type))
 		return;
 

+ 0 - 2
core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c

@@ -878,8 +878,6 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 			GET_LIM_SYSTEM_ROLE(session_entry),
 			session_entry->limMlmState, rssi,
 			QDF_MAC_ADDR_REF(hdr->sa));
-	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
-			   (uint8_t *)hdr, frame_len + SIR_MAC_HDR_LEN_3A);
 
 	beacon = qdf_mem_malloc(sizeof(tSchBeaconStruct));
 	if (!beacon)

+ 26 - 8
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -1305,19 +1305,24 @@ lim_handle80211_frames(struct mac_context *mac, struct scheduler_msg *limMsg,
 	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_ERROR, pHdr,
 			   WMA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
 #endif
-	if (mac->mlme_cfg->gen.debug_packet_log & 0x1) {
-		if ((fc.type == SIR_MAC_MGMT_FRAME) &&
+	if (fc.type == SIR_MAC_MGMT_FRAME) {
+		if ((mac->mlme_cfg->gen.debug_packet_log &
+		    DEBUG_PKTLOG_TYPE_MGMT) &&
 		    (fc.subType != SIR_MAC_MGMT_PROBE_REQ) &&
 		    (fc.subType != SIR_MAC_MGMT_PROBE_RSP) &&
-		    (fc.subType != SIR_MAC_MGMT_BEACON)) {
+		    (fc.subType != SIR_MAC_MGMT_BEACON) &&
+		    (fc.subType != SIR_MAC_MGMT_ACTION)) {
 			pe_debug("RX MGMT - Type %hu, SubType %hu, seq num[%d]",
-				   fc.type,
-				   fc.subType,
-				   ((pHdr->seqControl.seqNumHi <<
-				   HIGH_SEQ_NUM_OFFSET) |
-				   pHdr->seqControl.seqNumLo));
+				 fc.type, fc.subType,
+				 ((pHdr->seqControl.seqNumHi << HIGH_SEQ_NUM_OFFSET) |
+				 pHdr->seqControl.seqNumLo));
+			QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE,
+					   QDF_TRACE_LEVEL_DEBUG, pHdr,
+					   WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo)
+					   + SIR_MAC_HDR_LEN_3A);
 		}
 	}
+
 #ifdef FEATURE_WLAN_EXTSCAN
 	if (WMA_IS_EXTSCAN_SCAN_SRC(pRxPacketInfo) ||
 		WMA_IS_EPNO_SCAN_SRC(pRxPacketInfo)) {
@@ -1483,6 +1488,19 @@ lim_handle80211_frames(struct mac_context *mac, struct scheduler_msg *limMsg,
 				lim_process_action_frame_no_session(mac,
 								    pRxPacketInfo);
 			else {
+				if (mac->mlme_cfg->gen.debug_packet_log &
+				    DEBUG_PKTLOG_TYPE_ACTION) {
+					pe_debug("RX MGMT - Type %hu, SubType %hu, seq num[%d]",
+						 fc.type, fc.subType,
+						 ((pHdr->seqControl.seqNumHi << HIGH_SEQ_NUM_OFFSET) |
+						 pHdr->seqControl.seqNumLo));
+					QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE,
+							   QDF_TRACE_LEVEL_DEBUG,
+							   pHdr,
+							   WMA_GET_RX_PAYLOAD_LEN(pRxPacketInfo)
+							   + SIR_MAC_HDR_LEN_3A);
+				}
+
 				if (WMA_GET_RX_UNKNOWN_UCAST
 					    (pRxPacketInfo))
 					lim_handle_unknown_a2_index_frames

+ 0 - 6
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -1855,8 +1855,6 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx,
 		      frm.HTCaps.present, frm.VHTCaps.present,
 		      frm.vendor_vht_ie.present, frm.he_cap.present,
 		      frm.eht_cap.present);
-	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
-			   frame, (uint16_t)bytes);
 
 	if (!wlan_reg_is_24ghz_ch_freq(pe_session->curr_op_freq) ||
 	    pe_session->opmode == QDF_P2P_CLIENT_MODE ||
@@ -2811,8 +2809,6 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 	pe_nofl_info("Assoc req TX: vdev %d to "QDF_MAC_ADDR_FMT" seq num %d",
 		     pe_session->vdev_id, QDF_MAC_ADDR_REF(pe_session->bssId),
 		     mac_ctx->mgmtSeqNum);
-	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
-			  frame, (uint16_t)(sizeof(tSirMacMgmtHdr) + payload));
 
 	min_rid = lim_get_min_session_txrate(pe_session);
 	lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ASSOC_START_EVENT,
@@ -3375,8 +3371,6 @@ alloc_packet:
 		     vdev_id, auth_frame->authTransactionSeqNumber,
 		     mac_ctx->mgmtSeqNum, auth_frame->authStatusCode,
 		     mac_hdr->fc.wep, QDF_MAC_ADDR_REF(mac_hdr->da));
-	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
-			   frame, frame_len);
 
 	if ((session->ftPEContext.pFTPreAuthReq) &&
 	    (!wlan_reg_is_24ghz_ch_freq(

+ 19 - 4
core/wma/src/wma_data.c

@@ -2658,14 +2658,29 @@ QDF_STATUS wma_tx_packet(void *wma_context, void *tx_frame, uint16_t frmLen,
 		chanfreq = 0;
 	}
 
-	if (mac->mlme_cfg->gen.debug_packet_log & 0x1) {
-		if ((pFc->type == SIR_MAC_MGMT_FRAME) &&
+	if (pFc->type == SIR_MAC_MGMT_FRAME) {
+		if ((mac->mlme_cfg->gen.debug_packet_log &
+		    DEBUG_PKTLOG_TYPE_MGMT) &&
 		    (pFc->subType != SIR_MAC_MGMT_PROBE_REQ) &&
-		    (pFc->subType != SIR_MAC_MGMT_PROBE_RSP)) {
+		    (pFc->subType != SIR_MAC_MGMT_PROBE_RSP) &&
+		    (pFc->subType != SIR_MAC_MGMT_ACTION)) {
+			wma_debug("TX MGMT - Type %hu, SubType %hu seq_num[%d]",
+				  pFc->type, pFc->subType,
+				  ((mHdr->seqControl.seqNumHi << 4) |
+				  mHdr->seqControl.seqNumLo));
+			qdf_trace_hex_dump(QDF_MODULE_ID_WMA,
+					   QDF_TRACE_LEVEL_DEBUG, pData,
+					   frmLen);
+		} else if ((mac->mlme_cfg->gen.debug_packet_log &
+			   DEBUG_PKTLOG_TYPE_ACTION) &&
+			   (pFc->subType == SIR_MAC_MGMT_ACTION)) {
 			wma_debug("TX MGMT - Type %hu, SubType %hu seq_num[%d]",
-				 pFc->type, pFc->subType,
+				  pFc->type, pFc->subType,
 				 ((mHdr->seqControl.seqNumHi << 4) |
 				 mHdr->seqControl.seqNumLo));
+			qdf_trace_hex_dump(QDF_MODULE_ID_WMA,
+					   QDF_TRACE_LEVEL_DEBUG, pData,
+					   frmLen);
 		}
 	}