浏览代码

qcacmn: Modify pkt string for logging to console

Modify the qdf_get_pkt_type_string API to return
the packet type in case the packet does not fall
under the tracked packet subtypes and also increase
the rate limit values for EAPOL and DHCP packets.

Change-Id: Ie9681be64572346a09529043ef38dd57338700bb
CRs-Fixed: 2636540
Yeshwanth Sriram Guntuka 5 年之前
父节点
当前提交
06c7cbb878
共有 2 个文件被更改,包括 42 次插入15 次删除
  1. 4 4
      qdf/inc/qdf_trace.h
  2. 38 11
      qdf/linux/src/qdf_trace.c

+ 4 - 4
qdf/inc/qdf_trace.h

@@ -77,8 +77,8 @@ typedef int (qdf_abstract_print)(void *priv, const char *fmt, ...);
 /*
  * Rate limit based on pkt prototype
  */
-#define QDF_MAX_DHCP_PKTS_PER_SEC       (10)
-#define QDF_MAX_EAPOL_PKTS_PER_SEC      (10)
+#define QDF_MAX_DHCP_PKTS_PER_SEC       (20)
+#define QDF_MAX_EAPOL_PKTS_PER_SEC      (50)
 #define QDF_MAX_ARP_PKTS_PER_SEC        (5)
 #define QDF_MAX_DNS_PKTS_PER_SEC        (5)
 #define QDF_MAX_OTHER_PKTS_PER_SEC      (1)
@@ -920,7 +920,7 @@ void qdf_dp_set_proto_event_bitmap(uint32_t value);
  * Return: none
  */
 void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
-			       uint8_t subtype, uint8_t dir, uint8_t msdu_id,
+			       uint8_t subtype, uint8_t dir, uint16_t msdu_id,
 			       uint8_t status);
 #else
 static inline
@@ -1014,7 +1014,7 @@ void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
 
 static inline
 void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
-			       uint8_t subtype, uint8_t dir, uint8_t msdu_id,
+			       uint8_t subtype, uint8_t dir, uint16_t msdu_id,
 			       uint8_t status)
 {
 }

+ 38 - 11
qdf/linux/src/qdf_trace.c

@@ -1438,12 +1438,13 @@ uint8_t qdf_get_rate_limit_by_type(uint8_t type)
 
 /**
  * qdf_get_pkt_type_string() - Get the string based on pkt type
- * @subtype: packet type
+ * @type: packet type
+ * @subtype: packet subtype
  *
  * Return: String based on pkt type
  */
 static
-uint8_t *qdf_get_pkt_type_string(uint8_t subtype)
+uint8_t *qdf_get_pkt_type_string(uint8_t type, uint8_t subtype)
 {
 	switch (subtype) {
 	case QDF_PROTO_EAPOL_M1:
@@ -1464,6 +1465,12 @@ uint8_t *qdf_get_pkt_type_string(uint8_t subtype)
 		return "DHCP-A";
 	case QDF_PROTO_DHCP_NACK:
 		return "DHCP-NA";
+	case QDF_PROTO_DHCP_RELEASE:
+		return "DHCP-REL";
+	case QDF_PROTO_DHCP_INFORM:
+		return "DHCP-IN";
+	case QDF_PROTO_DHCP_DECLINE:
+		return "DHCP-DEC";
 	case QDF_PROTO_ARP_REQ:
 		return "ARP-RQ";
 	case QDF_PROTO_ARP_RES:
@@ -1473,7 +1480,18 @@ uint8_t *qdf_get_pkt_type_string(uint8_t subtype)
 	case QDF_PROTO_DNS_RES:
 		return "DNS_RS";
 	default:
-		return "UNKNOWN";
+		switch (type) {
+		case QDF_PROTO_TYPE_EAPOL:
+			return "EAP";
+		case QDF_PROTO_TYPE_DHCP:
+			return "DHCP";
+		case QDF_PROTO_TYPE_ARP:
+			return "ARP";
+		case QDF_PROTO_TYPE_DNS:
+			return "DNS";
+		default:
+			return "UNKNOWN";
+		}
 	}
 }
 
@@ -1515,28 +1533,37 @@ uint8_t *qdf_get_pkt_status_string(uint8_t status)
  * Return: none
  */
 void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
-			       uint8_t subtype, uint8_t dir, uint8_t msdu_id,
+			       uint8_t subtype, uint8_t dir, uint16_t msdu_id,
 			       uint8_t status)
 {
 	uint8_t pkt_rate_limit;
-	static ulong last_ticks[QDF_PROTO_SUBTYPE_MAX] = {0};
+	static ulong last_ticks_tx[QDF_PROTO_SUBTYPE_MAX] = {0};
+	static ulong last_ticks_rx[QDF_PROTO_SUBTYPE_MAX] = {0};
 	ulong curr_ticks = jiffies;
 
 	pkt_rate_limit = qdf_get_rate_limit_by_type(type);
 
-	if (!time_after(curr_ticks, last_ticks[subtype] + HZ / pkt_rate_limit))
+	if ((dir == QDF_TX &&
+	     !time_after(curr_ticks,
+			 last_ticks_tx[subtype] + HZ / pkt_rate_limit)) ||
+	    (dir == QDF_RX &&
+	     !time_after(curr_ticks,
+			 last_ticks_rx[subtype] + HZ / pkt_rate_limit)))
 		return;
 
-	last_ticks[subtype] = curr_ticks;
+	if (dir == QDF_TX)
+		last_ticks_tx[subtype] = curr_ticks;
+	else
+		last_ticks_rx[subtype] = curr_ticks;
 
 	if (status == QDF_TX_RX_STATUS_INVALID)
 		qdf_nofl_info("%s %s: SA:%pM DA:%pM",
-			      qdf_get_pkt_type_string(subtype), dir ? "RX":"TX",
-			      sa, da);
+			      qdf_get_pkt_type_string(type, subtype),
+			      dir ? "RX":"TX", sa, da);
 	else
 		qdf_nofl_info("%s %s: SA:%pM DA:%pM msdu_id:%d status: %s",
-			      qdf_get_pkt_type_string(subtype), dir ? "RX":"TX",
-			      sa, da, msdu_id,
+			      qdf_get_pkt_type_string(type, subtype),
+			      dir ? "RX":"TX", sa, da, msdu_id,
 			      qdf_get_pkt_status_string(status));
 }