From af7a4be436829ac1a26c222eb7d5c758c6bea319 Mon Sep 17 00:00:00 2001 From: Debabrata Purohit Date: Tue, 29 May 2018 14:27:48 +0100 Subject: [PATCH] [9610] wlbt: frame summary - support A-MSDU subframe format Add support for FAPI_DATAUNITDESCRIPTOR_AMSDU_SUBFRAME format in summary frame debug module. Change-Id: I46b3cda898e9fce55cf1f02d83f2a18828fea16e SCSC-Bug-Id: SSB-40293 Signed-off-by: Debabrata Purohit --- drivers/net/wireless/scsc/debug_frame.c | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/drivers/net/wireless/scsc/debug_frame.c b/drivers/net/wireless/scsc/debug_frame.c index 760292de7e49..eee4efa8ecc3 100755 --- a/drivers/net/wireless/scsc/debug_frame.c +++ b/drivers/net/wireless/scsc/debug_frame.c @@ -968,6 +968,43 @@ static bool slsi_decode_l3_frame(u8 *frame, u16 frame_length, char *result, size return true; } +static bool slsi_decode_amsdu_subframe(u8 *frame, u16 frame_length, char *result, size_t result_length) +{ + int slen; + + /* Only decode Management Frames at Level 1 */ + if (slsi_debug_summary_frame == 1) + return false; + + /* Only decode high important frames e.g. EAPOL, ARP, DHCP at Level 2 */ + if (slsi_debug_summary_frame == 2) { + struct msduhdr *msdu_hdr = (struct msduhdr *)frame; + u16 eth_type = be16_to_cpu(msdu_hdr->type); + + switch (eth_type) { + case ETH_P_IP: + /* slsi_is_dhcp_packet() decodes the frame as Ethernet frame so + * pass a offset (difference between MSDU header and ethernet header) + * to frames so it reads at the right offset + */ + if (slsi_is_dhcp_packet(frame + 8) == SLSI_TX_IS_NOT_DHCP) + return false; + break; + /* Fall through; process EAPOL, WAPI and ARP frames */ + case ETH_P_PAE: + case ETH_P_WAI: + case ETH_P_ARP: + break; + default: + /* return for all other frames */ + return false; + } + } + slen = snprintf(result, result_length, "eth"); + slsi_decode_proto_data(frame + 20, frame_length - 20, result + slen, result_length - slen); + return true; +} + static inline bool slsi_debug_frame_ratelimited(void) { static DEFINE_RATELIMIT_STATE(_rs, (5 * HZ), 200); @@ -1057,6 +1094,15 @@ void slsi_debug_frame(struct slsi_dev *sdev, struct net_device *dev, struct sk_b print = slsi_decode_l3_frame(frame, len, frame_info, sizeof(frame_info)); break; } + case FAPI_DATAUNITDESCRIPTOR_AMSDU_SUBFRAME: + { + struct ethhdr *ehdr = (struct ethhdr *)frame; + + dst = ehdr->h_dest; + src = ehdr->h_source; + print = slsi_decode_amsdu_subframe(frame, len, frame_info, sizeof(frame_info)); + break; + } default: return; } -- 2.20.1