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