浏览代码

qcacld-3.0: Rate limit the logging

Incase peer sends multiple Association
Request or multiple Association Request,
there can be crash due to excessive
logging.
So, rate limit the logging.
Also, this is also valid in case peer
sends multiple Disassociation or
Deauthentication request.

Change-Id: Iec4f70e8154ca0001f6d752f65449bb1d7bce5da
CRs-Fixed: 2891926
Utkarsh Bhatnagar 4 年之前
父节点
当前提交
97e7a5f87a

+ 5 - 1
core/mac/src/include/sir_debug.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012, 2014-2015, 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2012, 2014-2015, 2017-2019, 2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -56,6 +56,10 @@
 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_PE, params)
 #define pe_nofl_debug(params...) \
 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_PE, params)
+#define pe_nofl_rl_debug(params...) \
+	QDF_TRACE_DEBUG_RL_NO_FL(QDF_MODULE_ID_PE, params)
+#define pe_nofl_rl_info(params...) \
+	QDF_TRACE_INFO_RL_NO_FL(QDF_MODULE_ID_PE, params)
 
 #define PE_ENTER() QDF_TRACE_ENTER(QDF_MODULE_ID_PE, "enter")
 #define PE_EXIT() QDF_TRACE_EXIT(QDF_MODULE_ID_PE, "exit")

+ 5 - 5
core/mac/src/pe/lim/lim_process_assoc_req_frame.c

@@ -2269,11 +2269,11 @@ void lim_process_assoc_req_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_in
 	hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info);
 	frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
 
-	pe_nofl_debug("Assoc req RX: subtype %d vdev %d sys role %d lim state %d rssi %d from " QDF_MAC_ADDR_FMT,
-		      sub_type, session->vdev_id, GET_LIM_SYSTEM_ROLE(session),
-		      session->limMlmState,
-		      WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info),
-		      QDF_MAC_ADDR_REF(hdr->sa));
+	pe_nofl_rl_debug("Assoc req RX: subtype %d vdev %d sys role %d lim state %d rssi %d from " QDF_MAC_ADDR_FMT,
+			 sub_type, session->vdev_id, GET_LIM_SYSTEM_ROLE(session),
+			 session->limMlmState,
+			 WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info),
+			 QDF_MAC_ADDR_REF(hdr->sa));
 
 	if (LIM_IS_STA_ROLE(session)) {
 		pe_err("Rcvd unexpected ASSOC REQ, sessionid: %d sys sub_type: %d for role: %d from: "

+ 5 - 6
core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c

@@ -670,7 +670,6 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 	tpSirAssocRsp assoc_rsp;
 	tLimMlmAssocCnf assoc_cnf;
 	tSchBeaconStruct *beacon;
-	uint8_t vdev_id = session_entry->vdev_id;
 	uint8_t ap_nss;
 	int8_t rssi;
 	QDF_STATUS status;
@@ -708,11 +707,11 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 		return;
 	}
 
-	pe_nofl_info("Assoc rsp RX: subtype %d vdev %d sys role %d lim state %d rssi %d from " QDF_MAC_ADDR_FMT,
-		     subtype, vdev_id,
-		     GET_LIM_SYSTEM_ROLE(session_entry),
-		     session_entry->limMlmState, rssi,
-		     QDF_MAC_ADDR_REF(hdr->sa));
+	pe_nofl_rl_info("Assoc rsp RX: subtype %d vdev %d sys role %d lim state %d rssi %d from " QDF_MAC_ADDR_FMT,
+			subtype, session_entry->vdev_id,
+			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);
 

+ 9 - 9
core/mac/src/pe/lim/lim_process_auth_frame.c

@@ -418,9 +418,9 @@ static void lim_process_sae_auth_frame(struct mac_context *mac_ctx,
 	body_ptr = WMA_GET_RX_MPDU_DATA(rx_pkt_info);
 	frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info);
 
-	pe_nofl_info("SAE Auth RX type %d subtype %d from "QDF_MAC_ADDR_FMT,
-		     mac_hdr->fc.type, mac_hdr->fc.subType,
-		     QDF_MAC_ADDR_REF(mac_hdr->sa));
+	pe_nofl_rl_info("SAE Auth RX type %d subtype %d from "QDF_MAC_ADDR_FMT,
+			mac_hdr->fc.type, mac_hdr->fc.subType,
+			QDF_MAC_ADDR_REF(mac_hdr->sa));
 
 	if (LIM_IS_STA_ROLE(pe_session) &&
 	    pe_session->limMlmState != eLIM_MLM_WT_SAE_AUTH_STATE)
@@ -1339,12 +1339,12 @@ lim_process_auth_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 	}
 	auth_alg = *(uint16_t *) body_ptr;
 
-	pe_nofl_info("Auth RX: vdev %d sys role %d lim_state %d from " QDF_MAC_ADDR_FMT " rssi %d auth_alg %d seq %d",
-		     pe_session->vdev_id, GET_LIM_SYSTEM_ROLE(pe_session),
-		     pe_session->limMlmState,
-		     QDF_MAC_ADDR_REF(mac_hdr->sa),
-		     WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info),
-		     auth_alg, curr_seq_num);
+	pe_nofl_rl_info("Auth RX: vdev %d sys role %d lim_state %d from " QDF_MAC_ADDR_FMT " rssi %d auth_alg %d seq %d",
+			pe_session->vdev_id, GET_LIM_SYSTEM_ROLE(pe_session),
+			pe_session->limMlmState,
+			QDF_MAC_ADDR_REF(mac_hdr->sa),
+			WMA_GET_RX_RSSI_NORMALIZED(rx_pkt_info),
+			auth_alg, curr_seq_num);
 
 	/* Restore default failure timeout */
 	if (QDF_P2P_CLIENT_MODE == pe_session->opmode &&

+ 7 - 7
core/mac/src/pe/lim/lim_process_deauth_frame.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -150,12 +150,12 @@ lim_process_deauth_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
 	/* Get reasonCode from Deauthentication frame body */
 	reasonCode = sir_read_u16(pBody);
 
-	pe_nofl_info("Deauth RX: vdev %d from "QDF_MAC_ADDR_FMT" for "QDF_MAC_ADDR_FMT" RSSI = %d reason %d mlm state = %d, sme state = %d systemrole = %d ",
-		     pe_session->vdev_id, QDF_MAC_ADDR_REF(pHdr->sa),
-		     QDF_MAC_ADDR_REF(pHdr->da), frame_rssi,
-		     reasonCode, pe_session->limMlmState,
-		     pe_session->limSmeState,
-		     GET_LIM_SYSTEM_ROLE(pe_session));
+	pe_nofl_rl_info("Deauth RX: vdev %d from "QDF_MAC_ADDR_FMT" for "QDF_MAC_ADDR_FMT" RSSI = %d reason %d mlm state = %d, sme state = %d systemrole = %d ",
+			pe_session->vdev_id, QDF_MAC_ADDR_REF(pHdr->sa),
+			QDF_MAC_ADDR_REF(pHdr->da), frame_rssi,
+			reasonCode, pe_session->limMlmState,
+			pe_session->limSmeState,
+			GET_LIM_SYSTEM_ROLE(pe_session));
 
 	lim_diag_event_report(mac, WLAN_PE_DIAG_DEAUTH_FRAME_EVENT,
 		pe_session, 0, reasonCode);

+ 7 - 7
core/mac/src/pe/lim/lim_process_disassoc_frame.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -147,12 +147,12 @@ lim_process_disassoc_frame(struct mac_context *mac, uint8_t *pRxPacketInfo,
 	/* Get reasonCode from Disassociation frame body */
 	reasonCode = sir_read_u16(pBody);
 
-	pe_nofl_info("Disassoc RX: vdev %d from "QDF_MAC_ADDR_FMT" for "QDF_MAC_ADDR_FMT" RSSI = %d reason %d mlm state = %d, sme state = %d systemrole = %d ",
-		     pe_session->vdev_id, QDF_MAC_ADDR_REF(pHdr->sa),
-		     QDF_MAC_ADDR_REF(pHdr->da), frame_rssi,
-		     reasonCode, pe_session->limMlmState,
-		     pe_session->limSmeState,
-		     GET_LIM_SYSTEM_ROLE(pe_session));
+	pe_nofl_rl_info("Disassoc RX: vdev %d from "QDF_MAC_ADDR_FMT" for "QDF_MAC_ADDR_FMT" RSSI = %d reason %d mlm state = %d, sme state = %d systemrole = %d ",
+			pe_session->vdev_id, QDF_MAC_ADDR_REF(pHdr->sa),
+			QDF_MAC_ADDR_REF(pHdr->da), frame_rssi,
+			reasonCode, pe_session->limMlmState,
+			pe_session->limSmeState,
+			GET_LIM_SYSTEM_ROLE(pe_session));
 	lim_diag_event_report(mac, WLAN_PE_DIAG_DISASSOC_FRAME_EVENT,
 		pe_session, 0, reasonCode);
 

+ 10 - 10
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -1914,9 +1914,9 @@ static QDF_STATUS lim_assoc_tx_complete_cnf(void *context,
 	uint16_t reason_code;
 	struct mac_context *mac_ctx = (struct mac_context *)context;
 
-	pe_nofl_info("Assoc req TX: %s (%d)",
-		     (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ?
-		      "success" : "fail", tx_complete);
+	pe_nofl_rl_info("Assoc req TX: %s (%d)",
+			(tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ?
+			"success" : "fail", tx_complete);
 
 	if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) {
 		assoc_ack_status = ACKED;
@@ -2801,9 +2801,9 @@ static QDF_STATUS lim_auth_tx_complete_cnf(void *context,
 	uint16_t reason_code;
 	bool sae_auth_acked;
 
-	pe_nofl_info("Auth TX: %s (%d)",
-		     (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ?
-		     "success" : "fail", tx_complete);
+	pe_nofl_rl_info("Auth TX: %s (%d)",
+			(tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) ?
+			"success" : "fail", tx_complete);
 	if (tx_complete == WMI_MGMT_TX_COMP_TYPE_COMPLETE_OK) {
 		mac_ctx->auth_ack_status = LIM_ACK_RCD_SUCCESS;
 		auth_ack_status = ACKED;
@@ -3786,10 +3786,10 @@ lim_send_deauth_mgmt_frame(struct mac_context *mac,
 				&nPayload, discon_ie);
 	mlme_free_self_disconnect_ies(pe_session->vdev);
 
-	pe_nofl_info("Deauth TX: vdev %d seq_num %d reason %u waitForAck %d to " QDF_MAC_ADDR_FMT " from " QDF_MAC_ADDR_FMT,
-		     pe_session->vdev_id, mac->mgmtSeqNum, nReason, waitForAck,
-		     QDF_MAC_ADDR_REF(pMacHdr->da),
-		     QDF_MAC_ADDR_REF(pe_session->self_mac_addr));
+	pe_nofl_rl_info("Deauth TX: vdev %d seq_num %d reason %u waitForAck %d to " QDF_MAC_ADDR_FMT " from " QDF_MAC_ADDR_FMT,
+			pe_session->vdev_id, mac->mgmtSeqNum, nReason, waitForAck,
+			QDF_MAC_ADDR_REF(pMacHdr->da),
+			QDF_MAC_ADDR_REF(pe_session->self_mac_addr));
 
 	if (!wlan_reg_is_24ghz_ch_freq(pe_session->curr_op_freq) ||
 	    pe_session->opmode == QDF_P2P_CLIENT_MODE ||