Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 1 | /* QLogic qed NIC Driver |
Mintz, Yuval | e8f1cb5 | 2017-01-01 13:57:00 +0200 | [diff] [blame] | 2 | * Copyright (c) 2015-2017 QLogic Corporation |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 3 | * |
Mintz, Yuval | e8f1cb5 | 2017-01-01 13:57:00 +0200 | [diff] [blame] | 4 | * This software is available to you under a choice of one of two |
| 5 | * licenses. You may choose to be licensed under the terms of the GNU |
| 6 | * General Public License (GPL) Version 2, available from the file |
| 7 | * COPYING in the main directory of this source tree, or the |
| 8 | * OpenIB.org BSD license below: |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or |
| 11 | * without modification, are permitted provided that the following |
| 12 | * conditions are met: |
| 13 | * |
| 14 | * - Redistributions of source code must retain the above |
| 15 | * copyright notice, this list of conditions and the following |
| 16 | * disclaimer. |
| 17 | * |
| 18 | * - Redistributions in binary form must reproduce the above |
| 19 | * copyright notice, this list of conditions and the following |
| 20 | * disclaimer in the documentation and /or other materials |
| 21 | * provided with the distribution. |
| 22 | * |
| 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 30 | * SOFTWARE. |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 31 | */ |
| 32 | |
| 33 | #ifndef __TCP_COMMON__ |
| 34 | #define __TCP_COMMON__ |
| 35 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 36 | /********************/ |
| 37 | /* TCP FW CONSTANTS */ |
| 38 | /********************/ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 39 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 40 | #define TCP_INVALID_TIMEOUT_VAL -1 |
| 41 | |
| 42 | /* OOO opaque data received from LL2 */ |
Yuval Mintz | 05fafbf | 2016-08-19 09:33:31 +0300 | [diff] [blame] | 43 | struct ooo_opaque { |
| 44 | __le32 cid; |
| 45 | u8 drop_isle; |
| 46 | u8 drop_size; |
| 47 | u8 ooo_opcode; |
| 48 | u8 ooo_isle; |
| 49 | }; |
| 50 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 51 | /* tcp connect mode enum */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 52 | enum tcp_connect_mode { |
| 53 | TCP_CONNECT_ACTIVE, |
| 54 | TCP_CONNECT_PASSIVE, |
| 55 | MAX_TCP_CONNECT_MODE |
| 56 | }; |
| 57 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 58 | /* tcp function init parameters */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 59 | struct tcp_init_params { |
Yuval Mintz | 05fafbf | 2016-08-19 09:33:31 +0300 | [diff] [blame] | 60 | __le32 two_msl_timer; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 61 | __le16 tx_sws_timer; |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 62 | u8 max_fin_rt; |
Yuval Mintz | 05fafbf | 2016-08-19 09:33:31 +0300 | [diff] [blame] | 63 | u8 reserved[9]; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 64 | }; |
| 65 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 66 | /* tcp IPv4/IPv6 enum */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 67 | enum tcp_ip_version { |
| 68 | TCP_IPV4, |
| 69 | TCP_IPV6, |
| 70 | MAX_TCP_IP_VERSION |
| 71 | }; |
| 72 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 73 | /* tcp offload parameters */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 74 | struct tcp_offload_params { |
| 75 | __le16 local_mac_addr_lo; |
| 76 | __le16 local_mac_addr_mid; |
| 77 | __le16 local_mac_addr_hi; |
| 78 | __le16 remote_mac_addr_lo; |
| 79 | __le16 remote_mac_addr_mid; |
| 80 | __le16 remote_mac_addr_hi; |
| 81 | __le16 vlan_id; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 82 | __le16 flags; |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 83 | #define TCP_OFFLOAD_PARAMS_TS_EN_MASK 0x1 |
| 84 | #define TCP_OFFLOAD_PARAMS_TS_EN_SHIFT 0 |
| 85 | #define TCP_OFFLOAD_PARAMS_DA_EN_MASK 0x1 |
| 86 | #define TCP_OFFLOAD_PARAMS_DA_EN_SHIFT 1 |
| 87 | #define TCP_OFFLOAD_PARAMS_KA_EN_MASK 0x1 |
| 88 | #define TCP_OFFLOAD_PARAMS_KA_EN_SHIFT 2 |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 89 | #define TCP_OFFLOAD_PARAMS_ECN_SENDER_EN_MASK 0x1 |
| 90 | #define TCP_OFFLOAD_PARAMS_ECN_SENDER_EN_SHIFT 3 |
| 91 | #define TCP_OFFLOAD_PARAMS_ECN_RECEIVER_EN_MASK 0x1 |
| 92 | #define TCP_OFFLOAD_PARAMS_ECN_RECEIVER_EN_SHIFT 4 |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 93 | #define TCP_OFFLOAD_PARAMS_NAGLE_EN_MASK 0x1 |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 94 | #define TCP_OFFLOAD_PARAMS_NAGLE_EN_SHIFT 5 |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 95 | #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_MASK 0x1 |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 96 | #define TCP_OFFLOAD_PARAMS_DA_CNT_EN_SHIFT 6 |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 97 | #define TCP_OFFLOAD_PARAMS_FIN_SENT_MASK 0x1 |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 98 | #define TCP_OFFLOAD_PARAMS_FIN_SENT_SHIFT 7 |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 99 | #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_MASK 0x1 |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 100 | #define TCP_OFFLOAD_PARAMS_FIN_RECEIVED_SHIFT 8 |
| 101 | #define TCP_OFFLOAD_PARAMS_RESERVED_MASK 0x7F |
| 102 | #define TCP_OFFLOAD_PARAMS_RESERVED_SHIFT 9 |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 103 | u8 ip_version; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 104 | u8 reserved0[3]; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 105 | __le32 remote_ip[4]; |
| 106 | __le32 local_ip[4]; |
| 107 | __le32 flow_label; |
| 108 | u8 ttl; |
| 109 | u8 tos_or_tc; |
| 110 | __le16 remote_port; |
| 111 | __le16 local_port; |
| 112 | __le16 mss; |
| 113 | u8 rcv_wnd_scale; |
| 114 | u8 connect_mode; |
| 115 | __le16 srtt; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 116 | __le32 ss_thresh; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 117 | __le32 rcv_wnd; |
| 118 | __le32 cwnd; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 119 | u8 ka_max_probe_cnt; |
| 120 | u8 dup_ack_theshold; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 121 | __le16 reserved1; |
| 122 | __le32 ka_timeout; |
| 123 | __le32 ka_interval; |
| 124 | __le32 max_rt_time; |
| 125 | __le32 initial_rcv_wnd; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 126 | __le32 rcv_next; |
| 127 | __le32 snd_una; |
| 128 | __le32 snd_next; |
| 129 | __le32 snd_max; |
| 130 | __le32 snd_wnd; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 131 | __le32 snd_wl1; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 132 | __le32 ts_recent; |
| 133 | __le32 ts_recent_age; |
| 134 | __le32 total_rt; |
| 135 | __le32 ka_timeout_delta; |
| 136 | __le32 rt_timeout_delta; |
| 137 | u8 dup_ack_cnt; |
| 138 | u8 snd_wnd_probe_cnt; |
| 139 | u8 ka_probe_cnt; |
| 140 | u8 rt_cnt; |
| 141 | __le16 rtt_var; |
Mintz, Yuval | 7b6859f | 2017-05-18 19:41:04 +0300 | [diff] [blame] | 142 | __le16 fw_internal; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 143 | u8 snd_wnd_scale; |
| 144 | u8 ack_frequency; |
| 145 | __le16 da_timeout_value; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 146 | __le32 reserved3; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 147 | }; |
| 148 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 149 | /* tcp offload parameters */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 150 | struct tcp_offload_params_opt2 { |
| 151 | __le16 local_mac_addr_lo; |
| 152 | __le16 local_mac_addr_mid; |
| 153 | __le16 local_mac_addr_hi; |
| 154 | __le16 remote_mac_addr_lo; |
| 155 | __le16 remote_mac_addr_mid; |
| 156 | __le16 remote_mac_addr_hi; |
| 157 | __le16 vlan_id; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 158 | __le16 flags; |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 159 | #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_MASK 0x1 |
| 160 | #define TCP_OFFLOAD_PARAMS_OPT2_TS_EN_SHIFT 0 |
| 161 | #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_MASK 0x1 |
| 162 | #define TCP_OFFLOAD_PARAMS_OPT2_DA_EN_SHIFT 1 |
| 163 | #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_MASK 0x1 |
| 164 | #define TCP_OFFLOAD_PARAMS_OPT2_KA_EN_SHIFT 2 |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 165 | #define TCP_OFFLOAD_PARAMS_OPT2_ECN_EN_MASK 0x1 |
| 166 | #define TCP_OFFLOAD_PARAMS_OPT2_ECN_EN_SHIFT 3 |
| 167 | #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_MASK 0xFFF |
| 168 | #define TCP_OFFLOAD_PARAMS_OPT2_RESERVED0_SHIFT 4 |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 169 | u8 ip_version; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 170 | u8 reserved1[3]; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 171 | __le32 remote_ip[4]; |
| 172 | __le32 local_ip[4]; |
| 173 | __le32 flow_label; |
| 174 | u8 ttl; |
| 175 | u8 tos_or_tc; |
| 176 | __le16 remote_port; |
| 177 | __le16 local_port; |
| 178 | __le16 mss; |
| 179 | u8 rcv_wnd_scale; |
| 180 | u8 connect_mode; |
| 181 | __le16 syn_ip_payload_length; |
| 182 | __le32 syn_phy_addr_lo; |
| 183 | __le32 syn_phy_addr_hi; |
Tomer Tayar | da09091 | 2017-12-27 19:30:07 +0200 | [diff] [blame] | 184 | __le32 cwnd; |
| 185 | u8 ka_max_probe_cnt; |
| 186 | u8 reserved2[3]; |
| 187 | __le32 ka_timeout; |
| 188 | __le32 ka_interval; |
| 189 | __le32 max_rt_time; |
| 190 | __le32 reserved3[16]; |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 191 | }; |
| 192 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 193 | /* tcp IPv4/IPv6 enum */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 194 | enum tcp_seg_placement_event { |
| 195 | TCP_EVENT_ADD_PEN, |
| 196 | TCP_EVENT_ADD_NEW_ISLE, |
| 197 | TCP_EVENT_ADD_ISLE_RIGHT, |
| 198 | TCP_EVENT_ADD_ISLE_LEFT, |
| 199 | TCP_EVENT_JOIN, |
Mintz, Yuval | be086e7 | 2017-03-11 18:39:18 +0200 | [diff] [blame] | 200 | TCP_EVENT_DELETE_ISLES, |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 201 | TCP_EVENT_NOP, |
| 202 | MAX_TCP_SEG_PLACEMENT_EVENT |
| 203 | }; |
| 204 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 205 | /* tcp init parameters */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 206 | struct tcp_update_params { |
| 207 | __le16 flags; |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 208 | #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_MASK 0x1 |
| 209 | #define TCP_UPDATE_PARAMS_REMOTE_MAC_ADDR_CHANGED_SHIFT 0 |
| 210 | #define TCP_UPDATE_PARAMS_MSS_CHANGED_MASK 0x1 |
| 211 | #define TCP_UPDATE_PARAMS_MSS_CHANGED_SHIFT 1 |
| 212 | #define TCP_UPDATE_PARAMS_TTL_CHANGED_MASK 0x1 |
| 213 | #define TCP_UPDATE_PARAMS_TTL_CHANGED_SHIFT 2 |
| 214 | #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_MASK 0x1 |
| 215 | #define TCP_UPDATE_PARAMS_TOS_OR_TC_CHANGED_SHIFT 3 |
| 216 | #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_MASK 0x1 |
| 217 | #define TCP_UPDATE_PARAMS_KA_TIMEOUT_CHANGED_SHIFT 4 |
| 218 | #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_MASK 0x1 |
| 219 | #define TCP_UPDATE_PARAMS_KA_INTERVAL_CHANGED_SHIFT 5 |
| 220 | #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_MASK 0x1 |
| 221 | #define TCP_UPDATE_PARAMS_MAX_RT_TIME_CHANGED_SHIFT 6 |
| 222 | #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_MASK 0x1 |
| 223 | #define TCP_UPDATE_PARAMS_FLOW_LABEL_CHANGED_SHIFT 7 |
| 224 | #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_MASK 0x1 |
| 225 | #define TCP_UPDATE_PARAMS_INITIAL_RCV_WND_CHANGED_SHIFT 8 |
| 226 | #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_MASK 0x1 |
| 227 | #define TCP_UPDATE_PARAMS_KA_MAX_PROBE_CNT_CHANGED_SHIFT 9 |
| 228 | #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_MASK 0x1 |
| 229 | #define TCP_UPDATE_PARAMS_KA_EN_CHANGED_SHIFT 10 |
| 230 | #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_MASK 0x1 |
| 231 | #define TCP_UPDATE_PARAMS_NAGLE_EN_CHANGED_SHIFT 11 |
| 232 | #define TCP_UPDATE_PARAMS_KA_EN_MASK 0x1 |
| 233 | #define TCP_UPDATE_PARAMS_KA_EN_SHIFT 12 |
| 234 | #define TCP_UPDATE_PARAMS_NAGLE_EN_MASK 0x1 |
| 235 | #define TCP_UPDATE_PARAMS_NAGLE_EN_SHIFT 13 |
| 236 | #define TCP_UPDATE_PARAMS_KA_RESTART_MASK 0x1 |
| 237 | #define TCP_UPDATE_PARAMS_KA_RESTART_SHIFT 14 |
| 238 | #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_MASK 0x1 |
| 239 | #define TCP_UPDATE_PARAMS_RETRANSMIT_RESTART_SHIFT 15 |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 240 | __le16 remote_mac_addr_lo; |
| 241 | __le16 remote_mac_addr_mid; |
| 242 | __le16 remote_mac_addr_hi; |
| 243 | __le16 mss; |
| 244 | u8 ttl; |
| 245 | u8 tos_or_tc; |
| 246 | __le32 ka_timeout; |
| 247 | __le32 ka_interval; |
| 248 | __le32 max_rt_time; |
| 249 | __le32 flow_label; |
| 250 | __le32 initial_rcv_wnd; |
| 251 | u8 ka_max_probe_cnt; |
| 252 | u8 reserved1[7]; |
| 253 | }; |
| 254 | |
Tomer Tayar | a2e7699 | 2017-12-27 19:30:05 +0200 | [diff] [blame] | 255 | /* toe upload parameters */ |
Yuval Mintz | 7a9b6b8 | 2016-06-03 14:35:33 +0300 | [diff] [blame] | 256 | struct tcp_upload_params { |
| 257 | __le32 rcv_next; |
| 258 | __le32 snd_una; |
| 259 | __le32 snd_next; |
| 260 | __le32 snd_max; |
| 261 | __le32 snd_wnd; |
| 262 | __le32 rcv_wnd; |
| 263 | __le32 snd_wl1; |
| 264 | __le32 cwnd; |
| 265 | __le32 ss_thresh; |
| 266 | __le16 srtt; |
| 267 | __le16 rtt_var; |
| 268 | __le32 ts_time; |
| 269 | __le32 ts_recent; |
| 270 | __le32 ts_recent_age; |
| 271 | __le32 total_rt; |
| 272 | __le32 ka_timeout_delta; |
| 273 | __le32 rt_timeout_delta; |
| 274 | u8 dup_ack_cnt; |
| 275 | u8 snd_wnd_probe_cnt; |
| 276 | u8 ka_probe_cnt; |
| 277 | u8 rt_cnt; |
| 278 | __le32 reserved; |
| 279 | }; |
| 280 | |
| 281 | #endif /* __TCP_COMMON__ */ |