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) 2020, 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 of 18 * the license of that module. An independent module is a module which is not 19 * derived from this software. The special exception does not apply to any 20 * modifications of the software. 21 * 22 * 23 * <<Broadcom-WL-IPTag/Open:>> 24 * 25 * $Id$ 26 */ 27 28 #ifndef _dhd_ip_h_ 29 #define _dhd_ip_h_ 30 31 #if defined(DHDTCPACK_SUPPRESS) || defined(DHDTCPSYNC_FLOOD_BLK) 32 #include <dngl_stats.h> 33 #include <bcmutils.h> 34 #include <dhd.h> 35 #endif /* DHDTCPACK_SUPPRESS || DHDTCPSYNC_FLOOD_BLK */ 36 37 typedef enum pkt_frag 38 { 39 DHD_PKT_FRAG_NONE = 0, 40 DHD_PKT_FRAG_FIRST, 41 DHD_PKT_FRAG_CONT, 42 DHD_PKT_FRAG_LAST 43 } pkt_frag_t; 44 45 extern pkt_frag_t pkt_frag_info(osl_t *osh, void *p); 46 47 #ifdef DHDTCPSYNC_FLOOD_BLK 48 typedef enum tcp_hdr_flags { 49 FLAG_SYNC, 50 FLAG_SYNCACK, 51 FLAG_RST, 52 FLAG_OTHERS 53 } tcp_hdr_flag_t; 54 55 extern tcp_hdr_flag_t dhd_tcpdata_get_flag(dhd_pub_t *dhdp, void *pkt); 56 #endif /* DHDTCPSYNC_FLOOD_BLK */ 57 58 #ifdef DHDTCPACK_SUPPRESS 59 #define TCPACKSZMIN (ETHER_HDR_LEN + IPV4_MIN_HEADER_LEN + TCP_MIN_HEADER_LEN) 60 /* Size of MAX possible TCP ACK packet. Extra bytes for IP/TCP option fields */ 61 #define TCPACKSZMAX (TCPACKSZMIN + 100) 62 63 /* Max number of TCP streams that have own src/dst IP addrs and TCP ports */ 64 #ifndef TCPACK_INFO_MAXNUM 65 #define TCPACK_INFO_MAXNUM 4 66 #endif 67 #ifndef TCPDATA_INFO_MAXNUM 68 #define TCPDATA_INFO_MAXNUM 4 69 #endif 70 #define TCPDATA_PSH_INFO_MAXNUM (8 * TCPDATA_INFO_MAXNUM) 71 72 #define TCPDATA_INFO_TIMEOUT 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 /* #define DHDTCPACK_SUP_DBG */ 91 #if defined(DEBUG_COUNTER) && defined(DHDTCPACK_SUP_DBG) 92 extern counter_tbl_t tack_tbl; 93 #endif /* DEBUG_COUNTER && DHDTCPACK_SUP_DBG */ 94 #endif /* DHDTCPACK_SUPPRESS */ 95 96 #endif /* _dhd_ip_h_ */ 97