1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Header file for the Packet dump helper functions
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation
5*4882a593Smuzhiyun *
6*4882a593Smuzhiyun * Copyright (C) 1999-2017, Broadcom Corporation
7*4882a593Smuzhiyun *
8*4882a593Smuzhiyun * Unless you and Broadcom execute a separate written software license
9*4882a593Smuzhiyun * agreement governing use of this software, this software is licensed to you
10*4882a593Smuzhiyun * under the terms of the GNU General Public License version 2 (the "GPL"),
11*4882a593Smuzhiyun * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12*4882a593Smuzhiyun * following added to such license:
13*4882a593Smuzhiyun *
14*4882a593Smuzhiyun * As a special exception, the copyright holders of this software give you
15*4882a593Smuzhiyun * permission to link this software with independent modules, and to copy and
16*4882a593Smuzhiyun * distribute the resulting executable under terms of your choice, provided that
17*4882a593Smuzhiyun * you also meet, for each linked independent module, the terms and conditions of
18*4882a593Smuzhiyun * the license of that module. An independent module is a module which is not
19*4882a593Smuzhiyun * derived from this software. The special exception does not apply to any
20*4882a593Smuzhiyun * modifications of the software.
21*4882a593Smuzhiyun *
22*4882a593Smuzhiyun * Notwithstanding the above, under no circumstances may you combine this
23*4882a593Smuzhiyun * software in any way with any other Broadcom software provided under a license
24*4882a593Smuzhiyun * other than the GPL, without Broadcom's express prior written consent.
25*4882a593Smuzhiyun *
26*4882a593Smuzhiyun *
27*4882a593Smuzhiyun * <<Broadcom-WL-IPTag/Open:>>
28*4882a593Smuzhiyun *
29*4882a593Smuzhiyun * $Id$
30*4882a593Smuzhiyun */
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun #ifndef __DHD_LINUX_PKTDUMP_H_
33*4882a593Smuzhiyun #define __DHD_LINUX_PKTDUMP_H_
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun #include <typedefs.h>
36*4882a593Smuzhiyun #include <dhd.h>
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun typedef enum {
39*4882a593Smuzhiyun EAPOL_OTHER = 0,
40*4882a593Smuzhiyun EAPOL_4WAY_M1,
41*4882a593Smuzhiyun EAPOL_4WAY_M2,
42*4882a593Smuzhiyun EAPOL_4WAY_M3,
43*4882a593Smuzhiyun EAPOL_4WAY_M4,
44*4882a593Smuzhiyun EAPOL_GROUPKEY_M1,
45*4882a593Smuzhiyun EAPOL_GROUPKEY_M2
46*4882a593Smuzhiyun } msg_eapol_t;
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun typedef enum pkt_cnt_rsn {
49*4882a593Smuzhiyun PKT_CNT_RSN_INVALID = 0,
50*4882a593Smuzhiyun PKT_CNT_RSN_ROAM = 1,
51*4882a593Smuzhiyun PKT_CNT_RSN_GRPKEY_UP = 2,
52*4882a593Smuzhiyun PKT_CNT_RSN_MAX = 3
53*4882a593Smuzhiyun } pkt_cnt_rsn_t;
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun extern msg_eapol_t dhd_is_4way_msg(uint8 *pktdata);
56*4882a593Smuzhiyun extern void dhd_dump_pkt(dhd_pub_t *dhd, int ifidx, uint8 *pktdata,
57*4882a593Smuzhiyun uint32 pktlen, bool tx, uint32 *pkthash, uint16 *pktfate);
58*4882a593Smuzhiyun
59*4882a593Smuzhiyun #ifdef DHD_PKTDUMP_ROAM
60*4882a593Smuzhiyun extern void dhd_dump_mod_pkt_timer(dhd_pub_t *dhdp, uint16 rsn);
61*4882a593Smuzhiyun extern void dhd_dump_pkt_init(dhd_pub_t *dhdp);
62*4882a593Smuzhiyun extern void dhd_dump_pkt_deinit(dhd_pub_t *dhdp);
63*4882a593Smuzhiyun extern void dhd_dump_pkt_clear(dhd_pub_t *dhdp);
64*4882a593Smuzhiyun #else
dhd_dump_mod_pkt_timer(dhd_pub_t * dhdp,uint16 rsn)65*4882a593Smuzhiyun static INLINE void dhd_dump_mod_pkt_timer(dhd_pub_t *dhdp, uint16 rsn) { }
dhd_dump_pkt_init(dhd_pub_t * dhdp)66*4882a593Smuzhiyun static INLINE void dhd_dump_pkt_init(dhd_pub_t *dhdp) { }
dhd_dump_pkt_deinit(dhd_pub_t * dhdp)67*4882a593Smuzhiyun static INLINE void dhd_dump_pkt_deinit(dhd_pub_t *dhdp) { }
dhd_dump_pkt_clear(dhd_pub_t * dhdp)68*4882a593Smuzhiyun static INLINE void dhd_dump_pkt_clear(dhd_pub_t *dhdp) { }
69*4882a593Smuzhiyun #endif /* DHD_PKTDUMP_ROAM */
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun /* Rx packet dump */
72*4882a593Smuzhiyun #ifdef DHD_RX_DUMP
73*4882a593Smuzhiyun extern void dhd_rx_pkt_dump(dhd_pub_t *dhdp, int ifidx,
74*4882a593Smuzhiyun uint8 *pktdata, uint32 pktlen);
75*4882a593Smuzhiyun #else
dhd_rx_pkt_dump(dhd_pub_t * dhdp,int ifidx,uint8 * pktdata,uint32 pktlen)76*4882a593Smuzhiyun static INLINE void dhd_rx_pkt_dump(dhd_pub_t *dhdp, int ifidx,
77*4882a593Smuzhiyun uint8 *pktdata, uint32 pktlen) { }
78*4882a593Smuzhiyun #endif /* DHD_RX_DUMP */
79*4882a593Smuzhiyun
80*4882a593Smuzhiyun /* DHCP packet dump */
81*4882a593Smuzhiyun #ifdef DHD_DHCP_DUMP
82*4882a593Smuzhiyun extern void dhd_dhcp_dump(dhd_pub_t *dhdp, int ifidx, uint8 *pktdata, bool tx,
83*4882a593Smuzhiyun uint32 *pkthash, uint16 *pktfate);
84*4882a593Smuzhiyun #else
dhd_dhcp_dump(dhd_pub_t * dhdp,int ifidx,uint8 * pktdata,bool tx,uint32 * pkthash,uint16 * pktfate)85*4882a593Smuzhiyun static INLINE void dhd_dhcp_dump(dhd_pub_t *dhdp, int ifidx,
86*4882a593Smuzhiyun uint8 *pktdata, bool tx, uint32 *pkthash, uint16 *pktfate) { }
87*4882a593Smuzhiyun #endif /* DHD_DHCP_DUMP */
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun /* DNS packet dump */
90*4882a593Smuzhiyun #ifdef DHD_DNS_DUMP
91*4882a593Smuzhiyun extern void dhd_dns_dump(dhd_pub_t *dhdp, int ifidx, uint8 *pktdata, bool tx,
92*4882a593Smuzhiyun uint32 *pkthash, uint16 *pktfate);
93*4882a593Smuzhiyun #else
dhd_dns_dump(dhd_pub_t * dhdp,int ifidx,uint8 * pktdata,bool tx,uint32 * pkthash,uint16 * pktfate)94*4882a593Smuzhiyun static INLINE void dhd_dns_dump(dhd_pub_t *dhdp, int ifidx,
95*4882a593Smuzhiyun uint8 *pktdata, bool tx, uint32 *pkthash, uint16 *pktfate) { }
96*4882a593Smuzhiyun #endif /* DHD_DNS_DUMP */
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun /* ICMP packet dump */
99*4882a593Smuzhiyun #ifdef DHD_ICMP_DUMP
100*4882a593Smuzhiyun extern void dhd_icmp_dump(dhd_pub_t *dhdp, int ifidx, uint8 *pktdata, bool tx,
101*4882a593Smuzhiyun uint32 *pkthash, uint16 *pktfate);
102*4882a593Smuzhiyun #else
dhd_icmp_dump(dhd_pub_t * dhdp,int ifidx,uint8 * pktdata,bool tx,uint32 * pkthash,uint16 * pktfate)103*4882a593Smuzhiyun static INLINE void dhd_icmp_dump(dhd_pub_t *dhdp, int ifidx,
104*4882a593Smuzhiyun uint8 *pktdata, bool tx, uint32 *pkthash, uint16 *pktfate) { }
105*4882a593Smuzhiyun #endif /* DHD_ICMP_DUMP */
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun /* ARP packet dump */
108*4882a593Smuzhiyun #ifdef DHD_ARP_DUMP
109*4882a593Smuzhiyun extern void dhd_arp_dump(dhd_pub_t *dhdp, int ifidx, uint8 *pktdata, bool tx,
110*4882a593Smuzhiyun uint32 *pkthash, uint16 *pktfate);
111*4882a593Smuzhiyun #else
dhd_arp_dump(dhd_pub_t * dhdp,int ifidx,uint8 * pktdata,bool tx,uint32 * pkthash,uint16 * pktfate)112*4882a593Smuzhiyun static INLINE void dhd_arp_dump(dhd_pub_t *dhdp, int ifidx,
113*4882a593Smuzhiyun uint8 *pktdata, bool tx, uint32 *pkthash, uint16 *pktfate) { }
114*4882a593Smuzhiyun #endif /* DHD_ARP_DUMP */
115*4882a593Smuzhiyun
116*4882a593Smuzhiyun /* 802.1X packet dump */
117*4882a593Smuzhiyun #ifdef DHD_8021X_DUMP
118*4882a593Smuzhiyun extern void dhd_dump_eapol_message(dhd_pub_t *dhd, int ifidx,
119*4882a593Smuzhiyun uint8 *pktdata, uint32 pktlen, bool tx, uint32 *pkthash, uint16 *pktfate);
120*4882a593Smuzhiyun #else
dhd_dump_eapol_message(dhd_pub_t * dhd,int ifidx,uint8 * pktdata,uint32 pktlen,bool tx,uint32 * pkthash,uint16 * pktfate)121*4882a593Smuzhiyun static INLINE void dhd_dump_eapol_message(dhd_pub_t *dhd, int ifidx,
122*4882a593Smuzhiyun uint8 *pktdata, uint32 pktlen, bool tx, uint32 *pkthash, uint16 *pktfate) { }
123*4882a593Smuzhiyun #endif /* DHD_8021X_DUMP */
124*4882a593Smuzhiyun
125*4882a593Smuzhiyun #endif /* __DHD_LINUX_PKTDUMP_H_ */
126