xref: /OK3568_Linux_fs/external/rkwifibt/drivers/bcmdhd/dhd_ip.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Header file describing the common ip parser function.
3*4882a593Smuzhiyun  *
4*4882a593Smuzhiyun  * Provides type definitions and function prototypes used to parse ip packet.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright (C) 2020, Broadcom.
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  *
23*4882a593Smuzhiyun  * <<Broadcom-WL-IPTag/Open:>>
24*4882a593Smuzhiyun  *
25*4882a593Smuzhiyun  * $Id$
26*4882a593Smuzhiyun  */
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun #ifndef _dhd_ip_h_
29*4882a593Smuzhiyun #define _dhd_ip_h_
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #if defined(DHDTCPACK_SUPPRESS) || defined(DHDTCPSYNC_FLOOD_BLK)
32*4882a593Smuzhiyun #include <dngl_stats.h>
33*4882a593Smuzhiyun #include <bcmutils.h>
34*4882a593Smuzhiyun #include <dhd.h>
35*4882a593Smuzhiyun #endif /* DHDTCPACK_SUPPRESS || DHDTCPSYNC_FLOOD_BLK */
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun typedef enum pkt_frag
38*4882a593Smuzhiyun {
39*4882a593Smuzhiyun 	DHD_PKT_FRAG_NONE = 0,
40*4882a593Smuzhiyun 	DHD_PKT_FRAG_FIRST,
41*4882a593Smuzhiyun 	DHD_PKT_FRAG_CONT,
42*4882a593Smuzhiyun 	DHD_PKT_FRAG_LAST
43*4882a593Smuzhiyun } pkt_frag_t;
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun extern pkt_frag_t pkt_frag_info(osl_t *osh, void *p);
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun #ifdef DHDTCPSYNC_FLOOD_BLK
48*4882a593Smuzhiyun typedef enum tcp_hdr_flags {
49*4882a593Smuzhiyun 	FLAG_SYNC,
50*4882a593Smuzhiyun 	FLAG_SYNCACK,
51*4882a593Smuzhiyun 	FLAG_RST,
52*4882a593Smuzhiyun 	FLAG_OTHERS
53*4882a593Smuzhiyun } tcp_hdr_flag_t;
54*4882a593Smuzhiyun 
55*4882a593Smuzhiyun extern tcp_hdr_flag_t dhd_tcpdata_get_flag(dhd_pub_t *dhdp, void *pkt);
56*4882a593Smuzhiyun #endif /* DHDTCPSYNC_FLOOD_BLK */
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun #ifdef DHDTCPACK_SUPPRESS
59*4882a593Smuzhiyun #define	TCPACKSZMIN	(ETHER_HDR_LEN + IPV4_MIN_HEADER_LEN + TCP_MIN_HEADER_LEN)
60*4882a593Smuzhiyun /* Size of MAX possible TCP ACK packet. Extra bytes for IP/TCP option fields */
61*4882a593Smuzhiyun #define	TCPACKSZMAX	(TCPACKSZMIN + 100)
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun /* Max number of TCP streams that have own src/dst IP addrs and TCP ports */
64*4882a593Smuzhiyun #ifndef TCPACK_INFO_MAXNUM
65*4882a593Smuzhiyun #define TCPACK_INFO_MAXNUM 4
66*4882a593Smuzhiyun #endif
67*4882a593Smuzhiyun #ifndef TCPDATA_INFO_MAXNUM
68*4882a593Smuzhiyun #define TCPDATA_INFO_MAXNUM 4
69*4882a593Smuzhiyun #endif
70*4882a593Smuzhiyun #define TCPDATA_PSH_INFO_MAXNUM (8 * TCPDATA_INFO_MAXNUM)
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun #define TCPDATA_INFO_TIMEOUT 5000	/* Remove tcpdata_info if inactive for this time (in ms) */
73*4882a593Smuzhiyun 
74*4882a593Smuzhiyun #define DEFAULT_TCPACK_SUPP_RATIO 3
75*4882a593Smuzhiyun #ifndef CUSTOM_TCPACK_SUPP_RATIO
76*4882a593Smuzhiyun #define CUSTOM_TCPACK_SUPP_RATIO DEFAULT_TCPACK_SUPP_RATIO
77*4882a593Smuzhiyun #endif /* CUSTOM_TCPACK_SUPP_RATIO */
78*4882a593Smuzhiyun 
79*4882a593Smuzhiyun #define DEFAULT_TCPACK_DELAY_TIME 10 /* ms */
80*4882a593Smuzhiyun #ifndef CUSTOM_TCPACK_DELAY_TIME
81*4882a593Smuzhiyun #define CUSTOM_TCPACK_DELAY_TIME DEFAULT_TCPACK_DELAY_TIME
82*4882a593Smuzhiyun #endif /* CUSTOM_TCPACK_DELAY_TIME */
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun extern int dhd_tcpack_suppress_set(dhd_pub_t *dhdp, uint8 on);
85*4882a593Smuzhiyun extern void dhd_tcpack_info_tbl_clean(dhd_pub_t *dhdp);
86*4882a593Smuzhiyun extern int dhd_tcpack_check_xmit(dhd_pub_t *dhdp, void *pkt);
87*4882a593Smuzhiyun extern bool dhd_tcpack_suppress(dhd_pub_t *dhdp, void *pkt);
88*4882a593Smuzhiyun extern bool dhd_tcpdata_info_get(dhd_pub_t *dhdp, void *pkt);
89*4882a593Smuzhiyun extern bool dhd_tcpack_hold(dhd_pub_t *dhdp, void *pkt, int ifidx);
90*4882a593Smuzhiyun /* #define DHDTCPACK_SUP_DBG */
91*4882a593Smuzhiyun #if defined(DEBUG_COUNTER) && defined(DHDTCPACK_SUP_DBG)
92*4882a593Smuzhiyun extern counter_tbl_t tack_tbl;
93*4882a593Smuzhiyun #endif /* DEBUG_COUNTER && DHDTCPACK_SUP_DBG */
94*4882a593Smuzhiyun #endif /* DHDTCPACK_SUPPRESS */
95*4882a593Smuzhiyun 
96*4882a593Smuzhiyun #endif /* _dhd_ip_h_ */
97