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
This commit is contained in:

committed by
nshrivas

parent
7b76263659
commit
06c7cbb878
@@ -77,8 +77,8 @@ typedef int (qdf_abstract_print)(void *priv, const char *fmt, ...);
|
|||||||
/*
|
/*
|
||||||
* Rate limit based on pkt prototype
|
* Rate limit based on pkt prototype
|
||||||
*/
|
*/
|
||||||
#define QDF_MAX_DHCP_PKTS_PER_SEC (10)
|
#define QDF_MAX_DHCP_PKTS_PER_SEC (20)
|
||||||
#define QDF_MAX_EAPOL_PKTS_PER_SEC (10)
|
#define QDF_MAX_EAPOL_PKTS_PER_SEC (50)
|
||||||
#define QDF_MAX_ARP_PKTS_PER_SEC (5)
|
#define QDF_MAX_ARP_PKTS_PER_SEC (5)
|
||||||
#define QDF_MAX_DNS_PKTS_PER_SEC (5)
|
#define QDF_MAX_DNS_PKTS_PER_SEC (5)
|
||||||
#define QDF_MAX_OTHER_PKTS_PER_SEC (1)
|
#define QDF_MAX_OTHER_PKTS_PER_SEC (1)
|
||||||
@@ -920,7 +920,7 @@ void qdf_dp_set_proto_event_bitmap(uint32_t value);
|
|||||||
* Return: none
|
* Return: none
|
||||||
*/
|
*/
|
||||||
void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
|
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 status);
|
||||||
#else
|
#else
|
||||||
static inline
|
static inline
|
||||||
@@ -1014,7 +1014,7 @@ void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
|
|||||||
|
|
||||||
static inline
|
static inline
|
||||||
void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
|
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 status)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -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
|
* 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
|
* Return: String based on pkt type
|
||||||
*/
|
*/
|
||||||
static
|
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) {
|
switch (subtype) {
|
||||||
case QDF_PROTO_EAPOL_M1:
|
case QDF_PROTO_EAPOL_M1:
|
||||||
@@ -1464,6 +1465,12 @@ uint8_t *qdf_get_pkt_type_string(uint8_t subtype)
|
|||||||
return "DHCP-A";
|
return "DHCP-A";
|
||||||
case QDF_PROTO_DHCP_NACK:
|
case QDF_PROTO_DHCP_NACK:
|
||||||
return "DHCP-NA";
|
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:
|
case QDF_PROTO_ARP_REQ:
|
||||||
return "ARP-RQ";
|
return "ARP-RQ";
|
||||||
case QDF_PROTO_ARP_RES:
|
case QDF_PROTO_ARP_RES:
|
||||||
@@ -1472,9 +1479,20 @@ uint8_t *qdf_get_pkt_type_string(uint8_t subtype)
|
|||||||
return "DNS_Q";
|
return "DNS_Q";
|
||||||
case QDF_PROTO_DNS_RES:
|
case QDF_PROTO_DNS_RES:
|
||||||
return "DNS_RS";
|
return "DNS_RS";
|
||||||
|
default:
|
||||||
|
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:
|
default:
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1515,28 +1533,37 @@ uint8_t *qdf_get_pkt_status_string(uint8_t status)
|
|||||||
* Return: none
|
* Return: none
|
||||||
*/
|
*/
|
||||||
void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
|
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 status)
|
||||||
{
|
{
|
||||||
uint8_t pkt_rate_limit;
|
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;
|
ulong curr_ticks = jiffies;
|
||||||
|
|
||||||
pkt_rate_limit = qdf_get_rate_limit_by_type(type);
|
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;
|
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)
|
if (status == QDF_TX_RX_STATUS_INVALID)
|
||||||
qdf_nofl_info("%s %s: SA:%pM DA:%pM",
|
qdf_nofl_info("%s %s: SA:%pM DA:%pM",
|
||||||
qdf_get_pkt_type_string(subtype), dir ? "RX":"TX",
|
qdf_get_pkt_type_string(type, subtype),
|
||||||
sa, da);
|
dir ? "RX":"TX", sa, da);
|
||||||
else
|
else
|
||||||
qdf_nofl_info("%s %s: SA:%pM DA:%pM msdu_id:%d status: %s",
|
qdf_nofl_info("%s %s: SA:%pM DA:%pM msdu_id:%d status: %s",
|
||||||
qdf_get_pkt_type_string(subtype), dir ? "RX":"TX",
|
qdf_get_pkt_type_string(type, subtype),
|
||||||
sa, da, msdu_id,
|
dir ? "RX":"TX", sa, da, msdu_id,
|
||||||
qdf_get_pkt_status_string(status));
|
qdf_get_pkt_status_string(status));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user