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