1 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ 2 /* QLogic qed NIC Driver 3 * Copyright (c) 2015-2017 QLogic Corporation 4 * Copyright (c) 2019-2020 Marvell International Ltd. 5 */ 6 7 #ifndef __TCP_COMMON__ 8 #define __TCP_COMMON__ 9 10 /********************/ 11 /* TCP FW CONSTANTS */ 12 /********************/ 13 14 #define TCP_INVALID_TIMEOUT_VAL -1 15 16 /* OOO opaque data received from LL2 */ 17 struct ooo_opaque { 18 __le32 cid; 19 u8 drop_isle; 20 u8 drop_size; 21 u8 ooo_opcode; 22 u8 ooo_isle; 23 }; 24 25 /* tcp connect mode enum */ 26 enum tcp_connect_mode { 27 TCP_CONNECT_ACTIVE, 28 TCP_CONNECT_PASSIVE, 29 MAX_TCP_CONNECT_MODE 30 }; 31 32 /* tcp function init parameters */ 33 struct tcp_init_params { 34 __le32 two_msl_timer; 35 __le16 tx_sws_timer; 36 u8 max_fin_rt; 37 u8 reserved[9]; 38 }; 39 40 /* tcp IPv4/IPv6 enum */ 41 enum tcp_ip_version { 42 TCP_IPV4, 43 TCP_IPV6, 44 MAX_TCP_IP_VERSION 45 }; 46 47 /* tcp offload parameters */ 48 struct tcp_offload_params { 49 __le16 local_mac_addr_lo; 50 __le16 local_mac_addr_mid; 51 __le16 local_mac_addr_hi; 52 __le16 remote_mac_addr_lo; 53 __le16 remote_mac_addr_mid; 54 __le16 remote_mac_addr_hi; 55 __le16 vlan_id; 56 __le16 flags; 57 #define TCP_OFFLOAD_PARAMS_TS_EN_MASK 0x1 58 #define TCP_OFFLOAD_PARAMS_TS_EN_SHIFT 0 59 #define TCP_OFFLOAD_PARAMS_DA_EN_MASK 0x1 60 #define TCP_OFFLOAD_PARAMS_DA_EN_SHIFT 1 61 #define TCP_OFFLOAD_PARAMS_KA_EN_MASK 0x1 62 #define TCP_OFFLOAD_PARAMS_KA_EN_SHIFT 2 63 #define TCP_OFFLOAD_PARAMS_ECN_SENDER_EN_MASK 0x1 64 #define TCP_OFFLOAD_PARAMS_ECN_SENDER_EN_SHIFT 3 65 #define TCP_OFFLOAD_PARAMS_ECN_RECEIVER_EN_MASK 0x1 66 #define TCP_OFFLOAD_PARAMS_ECN_RECEIVER_EN_SHIFT 4 67 #define TCP_OFFLOAD_PARAMS_NAGLE_EN_MASK 0x1 68 #define TCP_OFFLOAD_PARAMS_NAGLE_EN_SHIFT 5 69 #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_MASK 0x1 70 #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_SHIFT 6 71 #define TCP_OFFLOAD_PARAMS_FIN_SENT_MASK 0x1 72 #define TCP_OFFLOAD_PARAMS_FIN_SENT_SHIFT 7 73 #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_MASK 0x1 74 #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_SHIFT 8 75 #define TCP_OFFLOAD_PARAMS_RESERVED_MASK 0x7F 76 #define TCP_OFFLOAD_PARAMS_RESERVED_SHIFT 9 77 u8 ip_version; 78 u8 reserved0[3]; 79 __le32 remote_ip[4]; 80 __le32 local_ip[4]; 81 __le32 flow_label; 82 u8 ttl; 83 u8 tos_or_tc; 84 __le16 remote_port; 85 __le16 local_port; 86 __le16 mss; 87 u8 rcv_wnd_scale; 88 u8 connect_mode; 89 __le16 srtt; 90 __le32 ss_thresh; 91 __le32 rcv_wnd; 92 __le32 cwnd; 93 u8 ka_max_probe_cnt; 94 u8 dup_ack_theshold; 95 __le16 reserved1; 96 __le32 ka_timeout; 97 __le32 ka_interval; 98 __le32 max_rt_time; 99 __le32 initial_rcv_wnd; 100 __le32 rcv_next; 101 __le32 snd_una; 102 __le32 snd_next; 103 __le32 snd_max; 104 __le32 snd_wnd; 105 __le32 snd_wl1; 106 __le32 ts_recent; 107 __le32 ts_recent_age; 108 __le32 total_rt; 109 __le32 ka_timeout_delta; 110 __le32 rt_timeout_delta; 111 u8 dup_ack_cnt; 112 u8 snd_wnd_probe_cnt; 113 u8 ka_probe_cnt; 114 u8 rt_cnt; 115 __le16 rtt_var; 116 __le16 fw_internal; 117 u8 snd_wnd_scale; 118 u8 ack_frequency; 119 __le16 da_timeout_value; 120 __le32 reserved3; 121 }; 122 123 /* tcp offload parameters */ 124 struct tcp_offload_params_opt2 { 125 __le16 local_mac_addr_lo; 126 __le16 local_mac_addr_mid; 127 __le16 local_mac_addr_hi; 128 __le16 remote_mac_addr_lo; 129 __le16 remote_mac_addr_mid; 130 __le16 remote_mac_addr_hi; 131 __le16 vlan_id; 132 __le16 flags; 133 #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_MASK 0x1 134 #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_SHIFT 0 135 #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_MASK 0x1 136 #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_SHIFT 1 137 #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_MASK 0x1 138 #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_SHIFT 2 139 #define TCP_OFFLOAD_PARAMS_OPT2_ECN_EN_MASK 0x1 140 #define TCP_OFFLOAD_PARAMS_OPT2_ECN_EN_SHIFT 3 141 #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_MASK 0xFFF 142 #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_SHIFT 4 143 u8 ip_version; 144 u8 reserved1[3]; 145 __le32 remote_ip[4]; 146 __le32 local_ip[4]; 147 __le32 flow_label; 148 u8 ttl; 149 u8 tos_or_tc; 150 __le16 remote_port; 151 __le16 local_port; 152 __le16 mss; 153 u8 rcv_wnd_scale; 154 u8 connect_mode; 155 __le16 syn_ip_payload_length; 156 __le32 syn_phy_addr_lo; 157 __le32 syn_phy_addr_hi; 158 __le32 cwnd; 159 u8 ka_max_probe_cnt; 160 u8 reserved2[3]; 161 __le32 ka_timeout; 162 __le32 ka_interval; 163 __le32 max_rt_time; 164 __le32 reserved3[16]; 165 }; 166 167 /* tcp IPv4/IPv6 enum */ 168 enum tcp_seg_placement_event { 169 TCP_EVENT_ADD_PEN, 170 TCP_EVENT_ADD_NEW_ISLE, 171 TCP_EVENT_ADD_ISLE_RIGHT, 172 TCP_EVENT_ADD_ISLE_LEFT, 173 TCP_EVENT_JOIN, 174 TCP_EVENT_DELETE_ISLES, 175 TCP_EVENT_NOP, 176 MAX_TCP_SEG_PLACEMENT_EVENT 177 }; 178 179 /* tcp init parameters */ 180 struct tcp_update_params { 181 __le16 flags; 182 #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_MASK 0x1 183 #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_SHIFT 0 184 #define TCP_UPDATE_PARAMS_MSS_CHANGED_MASK 0x1 185 #define TCP_UPDATE_PARAMS_MSS_CHANGED_SHIFT 1 186 #define TCP_UPDATE_PARAMS_TTL_CHANGED_MASK 0x1 187 #define TCP_UPDATE_PARAMS_TTL_CHANGED_SHIFT 2 188 #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_MASK 0x1 189 #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_SHIFT 3 190 #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_MASK 0x1 191 #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_SHIFT 4 192 #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_MASK 0x1 193 #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_SHIFT 5 194 #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_MASK 0x1 195 #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_SHIFT 6 196 #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_MASK 0x1 197 #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_SHIFT 7 198 #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_MASK 0x1 199 #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_SHIFT 8 200 #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_MASK 0x1 201 #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_SHIFT 9 202 #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_MASK 0x1 203 #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_SHIFT 10 204 #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_MASK 0x1 205 #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_SHIFT 11 206 #define TCP_UPDATE_PARAMS_KA_EN_MASK 0x1 207 #define TCP_UPDATE_PARAMS_KA_EN_SHIFT 12 208 #define TCP_UPDATE_PARAMS_NAGLE_EN_MASK 0x1 209 #define TCP_UPDATE_PARAMS_NAGLE_EN_SHIFT 13 210 #define TCP_UPDATE_PARAMS_KA_RESTART_MASK 0x1 211 #define TCP_UPDATE_PARAMS_KA_RESTART_SHIFT 14 212 #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_MASK 0x1 213 #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_SHIFT 15 214 __le16 remote_mac_addr_lo; 215 __le16 remote_mac_addr_mid; 216 __le16 remote_mac_addr_hi; 217 __le16 mss; 218 u8 ttl; 219 u8 tos_or_tc; 220 __le32 ka_timeout; 221 __le32 ka_interval; 222 __le32 max_rt_time; 223 __le32 flow_label; 224 __le32 initial_rcv_wnd; 225 u8 ka_max_probe_cnt; 226 u8 reserved1[7]; 227 }; 228 229 /* toe upload parameters */ 230 struct tcp_upload_params { 231 __le32 rcv_next; 232 __le32 snd_una; 233 __le32 snd_next; 234 __le32 snd_max; 235 __le32 snd_wnd; 236 __le32 rcv_wnd; 237 __le32 snd_wl1; 238 __le32 cwnd; 239 __le32 ss_thresh; 240 __le16 srtt; 241 __le16 rtt_var; 242 __le32 ts_time; 243 __le32 ts_recent; 244 __le32 ts_recent_age; 245 __le32 total_rt; 246 __le32 ka_timeout_delta; 247 __le32 rt_timeout_delta; 248 u8 dup_ack_cnt; 249 u8 snd_wnd_probe_cnt; 250 u8 ka_probe_cnt; 251 u8 rt_cnt; 252 __le32 reserved; 253 }; 254 255 #endif /* __TCP_COMMON__ */ 256
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.