• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Header file describing the common ip parser function.
3  *
4  * Provides type definitions and function prototypes used to parse ip packet.
5  *
6  * Copyright (C) 1999-2019, Broadcom.
7  *
8  *      Unless you and Broadcom execute a separate written software license
9  * agreement governing use of this software, this software is licensed to you
10  * under the terms of the GNU General Public License version 2 (the "GPL"),
11  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
12  * following added to such license:
13  *
14  *      As a special exception, the copyright holders of this software give you
15  * permission to link this software with independent modules, and to copy and
16  * distribute the resulting executable under terms of your choice, provided that
17  * you also meet, for each linked independent module, the terms and conditions
18  * of the license of that module.  An independent module is a module which is
19  * not derived from this software.  The special exception does not apply to any
20  * modifications of the software.
21  *
22  *      Notwithstanding the above, under no circumstances may you combine this
23  * software in any way with any other Broadcom software provided under a license
24  * other than the GPL, without Broadcom's express prior written consent.
25  *
26  *
27  * <<Broadcom-WL-IPTag/Open:>>
28  *
29  * $Id: dhd_ip.h 790572 2018-11-26 11:03:46Z $
30  */
31 
32 #ifndef _dhd_ip_h_
33 #define _dhd_ip_h_
34 
35 #if defined(DHDTCPACK_SUPPRESS) || defined(DHDTCPSYNC_FLOOD_BLK)
36 #include <dngl_stats.h>
37 #include <bcmutils.h>
38 #include <dhd.h>
39 #endif /* DHDTCPACK_SUPPRESS || DHDTCPSYNC_FLOOD_BLK */
40 
41 typedef enum pkt_frag {
42     DHD_PKT_FRAG_NONE = 0,
43     DHD_PKT_FRAG_FIRST,
44     DHD_PKT_FRAG_CONT,
45     DHD_PKT_FRAG_LAST
46 } pkt_frag_t;
47 
48 extern pkt_frag_t pkt_frag_info(osl_t *osh, void *p);
49 
50 #ifdef DHDTCPSYNC_FLOOD_BLK
51 typedef enum tcp_hdr_flags {
52     FLAG_SYNC,
53     FLAG_SYNCACK,
54     FLAG_RST,
55     FLAG_OTHERS
56 } tcp_hdr_flag_t;
57 
58 extern tcp_hdr_flag_t dhd_tcpdata_get_flag(dhd_pub_t *dhdp, void *pkt);
59 #endif /* DHDTCPSYNC_FLOOD_BLK */
60 
61 #ifdef DHDTCPACK_SUPPRESS
62 #define TCPACKSZMIN (ETHER_HDR_LEN + IPV4_MIN_HEADER_LEN + TCP_MIN_HEADER_LEN)
63 /* Size of MAX possible TCP ACK packet. Extra bytes for IP/TCP option fields */
64 #define TCPACKSZMAX (TCPACKSZMIN + 100)
65 
66 /* Max number of TCP streams that have own src/dst IP addrs and TCP ports */
67 #define TCPACK_INFO_MAXNUM 4
68 #define TCPDATA_INFO_MAXNUM 4
69 #define TCPDATA_PSH_INFO_MAXNUM (8 * TCPDATA_INFO_MAXNUM)
70 
71 #define TCPDATA_INFO_TIMEOUT                                                   \
72     5000 /* Remove tcpdata_info if inactive for this time (in ms) */
73 
74 #define DEFAULT_TCPACK_SUPP_RATIO 3
75 #ifndef CUSTOM_TCPACK_SUPP_RATIO
76 #define CUSTOM_TCPACK_SUPP_RATIO DEFAULT_TCPACK_SUPP_RATIO
77 #endif /* CUSTOM_TCPACK_SUPP_RATIO */
78 
79 #define DEFAULT_TCPACK_DELAY_TIME 10 /* ms */
80 #ifndef CUSTOM_TCPACK_DELAY_TIME
81 #define CUSTOM_TCPACK_DELAY_TIME DEFAULT_TCPACK_DELAY_TIME
82 #endif /* CUSTOM_TCPACK_DELAY_TIME */
83 
84 extern int dhd_tcpack_suppress_set(dhd_pub_t *dhdp, uint8 on);
85 extern void dhd_tcpack_info_tbl_clean(dhd_pub_t *dhdp);
86 extern int dhd_tcpack_check_xmit(dhd_pub_t *dhdp, void *pkt);
87 extern bool dhd_tcpack_suppress(dhd_pub_t *dhdp, void *pkt);
88 extern bool dhd_tcpdata_info_get(dhd_pub_t *dhdp, void *pkt);
89 extern bool dhd_tcpack_hold(dhd_pub_t *dhdp, void *pkt, int ifidx);
90 #if defined(DEBUG_COUNTER) && defined(DHDTCPACK_SUP_DBG)
91 extern counter_tbl_t tack_tbl;
92 #endif /* DEBUG_COUNTER && DHDTCPACK_SUP_DBG */
93 #endif /* DHDTCPACK_SUPPRESS */
94 
95 #endif /* _dhd_ip_h_ */
96