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