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