Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the Chelsio T4 Ethernet driver for Linux. |
| 3 | * |
| 4 | * Copyright (c) 2003-2010 Chelsio Communications, Inc. All rights reserved. |
| 5 | * |
| 6 | * This software is available to you under a choice of one of two |
| 7 | * licenses. You may choose to be licensed under the terms of the GNU |
| 8 | * General Public License (GPL) Version 2, available from the file |
| 9 | * COPYING in the main directory of this source tree, or the |
| 10 | * OpenIB.org BSD license below: |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or |
| 13 | * without modification, are permitted provided that the following |
| 14 | * conditions are met: |
| 15 | * |
| 16 | * - Redistributions of source code must retain the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer. |
| 19 | * |
| 20 | * - Redistributions in binary form must reproduce the above |
| 21 | * copyright notice, this list of conditions and the following |
| 22 | * disclaimer in the documentation and/or other materials |
| 23 | * provided with the distribution. |
| 24 | * |
| 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 32 | * SOFTWARE. |
| 33 | */ |
| 34 | |
| 35 | #ifndef __T4_MSG_H |
| 36 | #define __T4_MSG_H |
| 37 | |
| 38 | #include <linux/types.h> |
| 39 | |
| 40 | enum { |
| 41 | CPL_PASS_OPEN_REQ = 0x1, |
| 42 | CPL_PASS_ACCEPT_RPL = 0x2, |
| 43 | CPL_ACT_OPEN_REQ = 0x3, |
| 44 | CPL_SET_TCB_FIELD = 0x5, |
| 45 | CPL_GET_TCB = 0x6, |
| 46 | CPL_CLOSE_CON_REQ = 0x8, |
| 47 | CPL_CLOSE_LISTSRV_REQ = 0x9, |
| 48 | CPL_ABORT_REQ = 0xA, |
| 49 | CPL_ABORT_RPL = 0xB, |
| 50 | CPL_RX_DATA_ACK = 0xD, |
| 51 | CPL_TX_PKT = 0xE, |
| 52 | CPL_L2T_WRITE_REQ = 0x12, |
| 53 | CPL_TID_RELEASE = 0x1A, |
| 54 | |
| 55 | CPL_CLOSE_LISTSRV_RPL = 0x20, |
| 56 | CPL_L2T_WRITE_RPL = 0x23, |
| 57 | CPL_PASS_OPEN_RPL = 0x24, |
| 58 | CPL_ACT_OPEN_RPL = 0x25, |
| 59 | CPL_PEER_CLOSE = 0x26, |
| 60 | CPL_ABORT_REQ_RSS = 0x2B, |
| 61 | CPL_ABORT_RPL_RSS = 0x2D, |
| 62 | |
| 63 | CPL_CLOSE_CON_RPL = 0x32, |
| 64 | CPL_ISCSI_HDR = 0x33, |
| 65 | CPL_RDMA_CQE = 0x35, |
| 66 | CPL_RDMA_CQE_READ_RSP = 0x36, |
| 67 | CPL_RDMA_CQE_ERR = 0x37, |
| 68 | CPL_RX_DATA = 0x39, |
| 69 | CPL_SET_TCB_RPL = 0x3A, |
| 70 | CPL_RX_PKT = 0x3B, |
| 71 | CPL_RX_DDP_COMPLETE = 0x3F, |
| 72 | |
| 73 | CPL_ACT_ESTABLISH = 0x40, |
| 74 | CPL_PASS_ESTABLISH = 0x41, |
| 75 | CPL_RX_DATA_DDP = 0x42, |
| 76 | CPL_PASS_ACCEPT_REQ = 0x44, |
Santosh Rastapur | 2422d9a | 2013-03-14 05:08:48 +0000 | [diff] [blame] | 77 | CPL_TRACE_PKT_T5 = 0x48, |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 78 | |
| 79 | CPL_RDMA_READ_REQ = 0x60, |
| 80 | |
| 81 | CPL_PASS_OPEN_REQ6 = 0x81, |
| 82 | CPL_ACT_OPEN_REQ6 = 0x83, |
| 83 | |
| 84 | CPL_RDMA_TERMINATE = 0xA2, |
| 85 | CPL_RDMA_WRITE = 0xA4, |
| 86 | CPL_SGE_EGR_UPDATE = 0xA5, |
| 87 | |
| 88 | CPL_TRACE_PKT = 0xB0, |
| 89 | |
| 90 | CPL_FW4_MSG = 0xC0, |
| 91 | CPL_FW4_PLD = 0xC1, |
| 92 | CPL_FW4_ACK = 0xC3, |
| 93 | |
| 94 | CPL_FW6_MSG = 0xE0, |
| 95 | CPL_FW6_PLD = 0xE1, |
| 96 | CPL_TX_PKT_LSO = 0xED, |
| 97 | CPL_TX_PKT_XT = 0xEE, |
| 98 | |
| 99 | NUM_CPL_CMDS |
| 100 | }; |
| 101 | |
| 102 | enum CPL_error { |
| 103 | CPL_ERR_NONE = 0, |
| 104 | CPL_ERR_TCAM_FULL = 3, |
| 105 | CPL_ERR_BAD_LENGTH = 15, |
| 106 | CPL_ERR_BAD_ROUTE = 18, |
| 107 | CPL_ERR_CONN_RESET = 20, |
| 108 | CPL_ERR_CONN_EXIST_SYNRECV = 21, |
| 109 | CPL_ERR_CONN_EXIST = 22, |
| 110 | CPL_ERR_ARP_MISS = 23, |
| 111 | CPL_ERR_BAD_SYN = 24, |
| 112 | CPL_ERR_CONN_TIMEDOUT = 30, |
| 113 | CPL_ERR_XMIT_TIMEDOUT = 31, |
| 114 | CPL_ERR_PERSIST_TIMEDOUT = 32, |
| 115 | CPL_ERR_FINWAIT2_TIMEDOUT = 33, |
| 116 | CPL_ERR_KEEPALIVE_TIMEDOUT = 34, |
| 117 | CPL_ERR_RTX_NEG_ADVICE = 35, |
| 118 | CPL_ERR_PERSIST_NEG_ADVICE = 36, |
| 119 | CPL_ERR_ABORT_FAILED = 42, |
| 120 | CPL_ERR_IWARP_FLM = 50, |
| 121 | }; |
| 122 | |
| 123 | enum { |
| 124 | ULP_MODE_NONE = 0, |
| 125 | ULP_MODE_ISCSI = 2, |
| 126 | ULP_MODE_RDMA = 4, |
Steve Wise | b48f3b9 | 2011-03-11 22:30:21 +0000 | [diff] [blame] | 127 | ULP_MODE_TCPDDP = 5, |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 128 | ULP_MODE_FCOE = 6, |
| 129 | }; |
| 130 | |
| 131 | enum { |
| 132 | ULP_CRC_HEADER = 1 << 0, |
| 133 | ULP_CRC_DATA = 1 << 1 |
| 134 | }; |
| 135 | |
| 136 | enum { |
| 137 | CPL_ABORT_SEND_RST = 0, |
| 138 | CPL_ABORT_NO_RST, |
| 139 | }; |
| 140 | |
| 141 | enum { /* TX_PKT_XT checksum types */ |
| 142 | TX_CSUM_TCP = 0, |
| 143 | TX_CSUM_UDP = 1, |
| 144 | TX_CSUM_CRC16 = 4, |
| 145 | TX_CSUM_CRC32 = 5, |
| 146 | TX_CSUM_CRC32C = 6, |
| 147 | TX_CSUM_FCOE = 7, |
| 148 | TX_CSUM_TCPIP = 8, |
| 149 | TX_CSUM_UDPIP = 9, |
| 150 | TX_CSUM_TCPIP6 = 10, |
| 151 | TX_CSUM_UDPIP6 = 11, |
| 152 | TX_CSUM_IP = 12, |
| 153 | }; |
| 154 | |
| 155 | union opcode_tid { |
| 156 | __be32 opcode_tid; |
| 157 | u8 opcode; |
| 158 | }; |
| 159 | |
| 160 | #define CPL_OPCODE(x) ((x) << 24) |
| 161 | #define MK_OPCODE_TID(opcode, tid) (CPL_OPCODE(opcode) | (tid)) |
| 162 | #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid) |
| 163 | #define GET_TID(cmd) (ntohl(OPCODE_TID(cmd)) & 0xFFFFFF) |
| 164 | |
| 165 | /* partitioning of TID fields that also carry a queue id */ |
| 166 | #define GET_TID_TID(x) ((x) & 0x3fff) |
| 167 | #define GET_TID_QID(x) (((x) >> 14) & 0x3ff) |
| 168 | #define TID_QID(x) ((x) << 14) |
| 169 | |
| 170 | struct rss_header { |
| 171 | u8 opcode; |
| 172 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 173 | u8 channel:2; |
| 174 | u8 filter_hit:1; |
| 175 | u8 filter_tid:1; |
| 176 | u8 hash_type:2; |
| 177 | u8 ipv6:1; |
| 178 | u8 send2fw:1; |
| 179 | #else |
| 180 | u8 send2fw:1; |
| 181 | u8 ipv6:1; |
| 182 | u8 hash_type:2; |
| 183 | u8 filter_tid:1; |
| 184 | u8 filter_hit:1; |
| 185 | u8 channel:2; |
| 186 | #endif |
| 187 | __be16 qid; |
| 188 | __be32 hash_val; |
| 189 | }; |
| 190 | |
| 191 | struct work_request_hdr { |
| 192 | __be32 wr_hi; |
| 193 | __be32 wr_mid; |
| 194 | __be64 wr_lo; |
| 195 | }; |
| 196 | |
Vipul Pandya | 5be78ee | 2012-12-10 09:30:54 +0000 | [diff] [blame] | 197 | /* wr_hi fields */ |
| 198 | #define S_WR_OP 24 |
| 199 | #define V_WR_OP(x) ((__u64)(x) << S_WR_OP) |
| 200 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 201 | #define WR_HDR struct work_request_hdr wr |
| 202 | |
Vipul Pandya | 1cab775 | 2012-12-10 09:30:55 +0000 | [diff] [blame] | 203 | /* option 0 fields */ |
| 204 | #define S_MSS_IDX 60 |
| 205 | #define M_MSS_IDX 0xF |
| 206 | #define V_MSS_IDX(x) ((__u64)(x) << S_MSS_IDX) |
| 207 | #define G_MSS_IDX(x) (((x) >> S_MSS_IDX) & M_MSS_IDX) |
| 208 | |
| 209 | /* option 2 fields */ |
| 210 | #define S_RSS_QUEUE 0 |
| 211 | #define M_RSS_QUEUE 0x3FF |
| 212 | #define V_RSS_QUEUE(x) ((x) << S_RSS_QUEUE) |
| 213 | #define G_RSS_QUEUE(x) (((x) >> S_RSS_QUEUE) & M_RSS_QUEUE) |
| 214 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 215 | struct cpl_pass_open_req { |
| 216 | WR_HDR; |
| 217 | union opcode_tid ot; |
| 218 | __be16 local_port; |
| 219 | __be16 peer_port; |
| 220 | __be32 local_ip; |
| 221 | __be32 peer_ip; |
| 222 | __be64 opt0; |
| 223 | #define TX_CHAN(x) ((x) << 2) |
Vipul Pandya | 5be78ee | 2012-12-10 09:30:54 +0000 | [diff] [blame] | 224 | #define NO_CONG(x) ((x) << 4) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 225 | #define DELACK(x) ((x) << 5) |
| 226 | #define ULP_MODE(x) ((x) << 8) |
| 227 | #define RCV_BUFSIZ(x) ((x) << 12) |
| 228 | #define DSCP(x) ((x) << 22) |
| 229 | #define SMAC_SEL(x) ((u64)(x) << 28) |
| 230 | #define L2T_IDX(x) ((u64)(x) << 36) |
Vipul Pandya | 5be78ee | 2012-12-10 09:30:54 +0000 | [diff] [blame] | 231 | #define TCAM_BYPASS(x) ((u64)(x) << 48) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 232 | #define NAGLE(x) ((u64)(x) << 49) |
| 233 | #define WND_SCALE(x) ((u64)(x) << 50) |
| 234 | #define KEEP_ALIVE(x) ((u64)(x) << 54) |
| 235 | #define MSS_IDX(x) ((u64)(x) << 60) |
| 236 | __be64 opt1; |
| 237 | #define SYN_RSS_ENABLE (1 << 0) |
| 238 | #define SYN_RSS_QUEUE(x) ((x) << 2) |
| 239 | #define CONN_POLICY_ASK (1 << 22) |
| 240 | }; |
| 241 | |
| 242 | struct cpl_pass_open_req6 { |
| 243 | WR_HDR; |
| 244 | union opcode_tid ot; |
| 245 | __be16 local_port; |
| 246 | __be16 peer_port; |
| 247 | __be64 local_ip_hi; |
| 248 | __be64 local_ip_lo; |
| 249 | __be64 peer_ip_hi; |
| 250 | __be64 peer_ip_lo; |
| 251 | __be64 opt0; |
| 252 | __be64 opt1; |
| 253 | }; |
| 254 | |
| 255 | struct cpl_pass_open_rpl { |
| 256 | union opcode_tid ot; |
| 257 | u8 rsvd[3]; |
| 258 | u8 status; |
| 259 | }; |
| 260 | |
| 261 | struct cpl_pass_accept_rpl { |
| 262 | WR_HDR; |
| 263 | union opcode_tid ot; |
| 264 | __be32 opt2; |
| 265 | #define RSS_QUEUE(x) ((x) << 0) |
| 266 | #define RSS_QUEUE_VALID (1 << 10) |
| 267 | #define RX_COALESCE_VALID(x) ((x) << 11) |
| 268 | #define RX_COALESCE(x) ((x) << 12) |
Vipul Pandya | 5be78ee | 2012-12-10 09:30:54 +0000 | [diff] [blame] | 269 | #define PACE(x) ((x) << 16) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 270 | #define TX_QUEUE(x) ((x) << 23) |
| 271 | #define RX_CHANNEL(x) ((x) << 26) |
Vipul Pandya | 5be78ee | 2012-12-10 09:30:54 +0000 | [diff] [blame] | 272 | #define CCTRL_ECN(x) ((x) << 27) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 273 | #define WND_SCALE_EN(x) ((x) << 28) |
| 274 | #define TSTAMPS_EN(x) ((x) << 29) |
| 275 | #define SACK_EN(x) ((x) << 30) |
| 276 | __be64 opt0; |
| 277 | }; |
| 278 | |
| 279 | struct cpl_act_open_req { |
| 280 | WR_HDR; |
| 281 | union opcode_tid ot; |
| 282 | __be16 local_port; |
| 283 | __be16 peer_port; |
| 284 | __be32 local_ip; |
| 285 | __be32 peer_ip; |
| 286 | __be64 opt0; |
| 287 | __be32 params; |
| 288 | __be32 opt2; |
| 289 | }; |
| 290 | |
Santosh Rastapur | 2422d9a | 2013-03-14 05:08:48 +0000 | [diff] [blame] | 291 | #define S_FILTER_TUPLE 24 |
| 292 | #define M_FILTER_TUPLE 0xFFFFFFFFFF |
| 293 | #define V_FILTER_TUPLE(x) ((x) << S_FILTER_TUPLE) |
| 294 | #define G_FILTER_TUPLE(x) (((x) >> S_FILTER_TUPLE) & M_FILTER_TUPLE) |
| 295 | struct cpl_t5_act_open_req { |
| 296 | WR_HDR; |
| 297 | union opcode_tid ot; |
| 298 | __be16 local_port; |
| 299 | __be16 peer_port; |
| 300 | __be32 local_ip; |
| 301 | __be32 peer_ip; |
| 302 | __be64 opt0; |
| 303 | __be32 rsvd; |
| 304 | __be32 opt2; |
| 305 | __be64 params; |
| 306 | }; |
| 307 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 308 | struct cpl_act_open_req6 { |
| 309 | WR_HDR; |
| 310 | union opcode_tid ot; |
| 311 | __be16 local_port; |
| 312 | __be16 peer_port; |
| 313 | __be64 local_ip_hi; |
| 314 | __be64 local_ip_lo; |
| 315 | __be64 peer_ip_hi; |
| 316 | __be64 peer_ip_lo; |
| 317 | __be64 opt0; |
| 318 | __be32 params; |
| 319 | __be32 opt2; |
| 320 | }; |
| 321 | |
| 322 | struct cpl_act_open_rpl { |
| 323 | union opcode_tid ot; |
| 324 | __be32 atid_status; |
| 325 | #define GET_AOPEN_STATUS(x) ((x) & 0xff) |
| 326 | #define GET_AOPEN_ATID(x) (((x) >> 8) & 0xffffff) |
| 327 | }; |
| 328 | |
| 329 | struct cpl_pass_establish { |
| 330 | union opcode_tid ot; |
| 331 | __be32 rsvd; |
| 332 | __be32 tos_stid; |
Vipul Pandya | 1cab775 | 2012-12-10 09:30:55 +0000 | [diff] [blame] | 333 | #define PASS_OPEN_TID(x) ((x) << 0) |
| 334 | #define PASS_OPEN_TOS(x) ((x) << 24) |
| 335 | #define GET_PASS_OPEN_TID(x) (((x) >> 0) & 0xFFFFFF) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 336 | #define GET_POPEN_TID(x) ((x) & 0xffffff) |
| 337 | #define GET_POPEN_TOS(x) (((x) >> 24) & 0xff) |
| 338 | __be16 mac_idx; |
| 339 | __be16 tcp_opt; |
| 340 | #define GET_TCPOPT_WSCALE_OK(x) (((x) >> 5) & 1) |
| 341 | #define GET_TCPOPT_SACK(x) (((x) >> 6) & 1) |
| 342 | #define GET_TCPOPT_TSTAMP(x) (((x) >> 7) & 1) |
| 343 | #define GET_TCPOPT_SND_WSCALE(x) (((x) >> 8) & 0xf) |
| 344 | #define GET_TCPOPT_MSS(x) (((x) >> 12) & 0xf) |
| 345 | __be32 snd_isn; |
| 346 | __be32 rcv_isn; |
| 347 | }; |
| 348 | |
| 349 | struct cpl_act_establish { |
| 350 | union opcode_tid ot; |
| 351 | __be32 rsvd; |
| 352 | __be32 tos_atid; |
| 353 | __be16 mac_idx; |
| 354 | __be16 tcp_opt; |
| 355 | __be32 snd_isn; |
| 356 | __be32 rcv_isn; |
| 357 | }; |
| 358 | |
| 359 | struct cpl_get_tcb { |
| 360 | WR_HDR; |
| 361 | union opcode_tid ot; |
| 362 | __be16 reply_ctrl; |
| 363 | #define QUEUENO(x) ((x) << 0) |
| 364 | #define REPLY_CHAN(x) ((x) << 14) |
| 365 | #define NO_REPLY(x) ((x) << 15) |
| 366 | __be16 cookie; |
| 367 | }; |
| 368 | |
| 369 | struct cpl_set_tcb_field { |
| 370 | WR_HDR; |
| 371 | union opcode_tid ot; |
| 372 | __be16 reply_ctrl; |
| 373 | __be16 word_cookie; |
| 374 | #define TCB_WORD(x) ((x) << 0) |
| 375 | #define TCB_COOKIE(x) ((x) << 5) |
Vipul Pandya | f2b7e78 | 2012-12-10 09:30:52 +0000 | [diff] [blame] | 376 | #define GET_TCB_COOKIE(x) (((x) >> 5) & 7) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 377 | __be64 mask; |
| 378 | __be64 val; |
| 379 | }; |
| 380 | |
| 381 | struct cpl_set_tcb_rpl { |
| 382 | union opcode_tid ot; |
| 383 | __be16 rsvd; |
| 384 | u8 cookie; |
| 385 | u8 status; |
| 386 | __be64 oldval; |
| 387 | }; |
| 388 | |
| 389 | struct cpl_close_con_req { |
| 390 | WR_HDR; |
| 391 | union opcode_tid ot; |
| 392 | __be32 rsvd; |
| 393 | }; |
| 394 | |
| 395 | struct cpl_close_con_rpl { |
| 396 | union opcode_tid ot; |
| 397 | u8 rsvd[3]; |
| 398 | u8 status; |
| 399 | __be32 snd_nxt; |
| 400 | __be32 rcv_nxt; |
| 401 | }; |
| 402 | |
| 403 | struct cpl_close_listsvr_req { |
| 404 | WR_HDR; |
| 405 | union opcode_tid ot; |
| 406 | __be16 reply_ctrl; |
| 407 | #define LISTSVR_IPV6 (1 << 14) |
| 408 | __be16 rsvd; |
| 409 | }; |
| 410 | |
| 411 | struct cpl_close_listsvr_rpl { |
| 412 | union opcode_tid ot; |
| 413 | u8 rsvd[3]; |
| 414 | u8 status; |
| 415 | }; |
| 416 | |
| 417 | struct cpl_abort_req_rss { |
| 418 | union opcode_tid ot; |
| 419 | u8 rsvd[3]; |
| 420 | u8 status; |
| 421 | }; |
| 422 | |
| 423 | struct cpl_abort_req { |
| 424 | WR_HDR; |
| 425 | union opcode_tid ot; |
| 426 | __be32 rsvd0; |
| 427 | u8 rsvd1; |
| 428 | u8 cmd; |
| 429 | u8 rsvd2[6]; |
| 430 | }; |
| 431 | |
| 432 | struct cpl_abort_rpl_rss { |
| 433 | union opcode_tid ot; |
| 434 | u8 rsvd[3]; |
| 435 | u8 status; |
| 436 | }; |
| 437 | |
| 438 | struct cpl_abort_rpl { |
| 439 | WR_HDR; |
| 440 | union opcode_tid ot; |
| 441 | __be32 rsvd0; |
| 442 | u8 rsvd1; |
| 443 | u8 cmd; |
| 444 | u8 rsvd2[6]; |
| 445 | }; |
| 446 | |
| 447 | struct cpl_peer_close { |
| 448 | union opcode_tid ot; |
| 449 | __be32 rcv_nxt; |
| 450 | }; |
| 451 | |
| 452 | struct cpl_tid_release { |
| 453 | WR_HDR; |
| 454 | union opcode_tid ot; |
| 455 | __be32 rsvd; |
| 456 | }; |
| 457 | |
| 458 | struct cpl_tx_pkt_core { |
| 459 | __be32 ctrl0; |
| 460 | #define TXPKT_VF(x) ((x) << 0) |
| 461 | #define TXPKT_PF(x) ((x) << 8) |
| 462 | #define TXPKT_VF_VLD (1 << 11) |
| 463 | #define TXPKT_OVLAN_IDX(x) ((x) << 12) |
| 464 | #define TXPKT_INTF(x) ((x) << 16) |
| 465 | #define TXPKT_INS_OVLAN (1 << 21) |
| 466 | #define TXPKT_OPCODE(x) ((x) << 24) |
| 467 | __be16 pack; |
| 468 | __be16 len; |
| 469 | __be64 ctrl1; |
| 470 | #define TXPKT_CSUM_END(x) ((x) << 12) |
| 471 | #define TXPKT_CSUM_START(x) ((x) << 20) |
| 472 | #define TXPKT_IPHDR_LEN(x) ((u64)(x) << 20) |
| 473 | #define TXPKT_CSUM_LOC(x) ((u64)(x) << 30) |
| 474 | #define TXPKT_ETHHDR_LEN(x) ((u64)(x) << 34) |
| 475 | #define TXPKT_CSUM_TYPE(x) ((u64)(x) << 40) |
| 476 | #define TXPKT_VLAN(x) ((u64)(x) << 44) |
| 477 | #define TXPKT_VLAN_VLD (1ULL << 60) |
| 478 | #define TXPKT_IPCSUM_DIS (1ULL << 62) |
| 479 | #define TXPKT_L4CSUM_DIS (1ULL << 63) |
| 480 | }; |
| 481 | |
| 482 | struct cpl_tx_pkt { |
| 483 | WR_HDR; |
| 484 | struct cpl_tx_pkt_core c; |
| 485 | }; |
| 486 | |
| 487 | #define cpl_tx_pkt_xt cpl_tx_pkt |
| 488 | |
Casey Leedom | 1704d74 | 2010-06-25 12:09:38 +0000 | [diff] [blame] | 489 | struct cpl_tx_pkt_lso_core { |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 490 | __be32 lso_ctrl; |
| 491 | #define LSO_TCPHDR_LEN(x) ((x) << 0) |
| 492 | #define LSO_IPHDR_LEN(x) ((x) << 4) |
| 493 | #define LSO_ETHHDR_LEN(x) ((x) << 16) |
| 494 | #define LSO_IPV6(x) ((x) << 20) |
| 495 | #define LSO_LAST_SLICE (1 << 22) |
| 496 | #define LSO_FIRST_SLICE (1 << 23) |
| 497 | #define LSO_OPCODE(x) ((x) << 24) |
| 498 | __be16 ipid_ofst; |
| 499 | __be16 mss; |
| 500 | __be32 seqno_offset; |
| 501 | __be32 len; |
| 502 | /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ |
| 503 | }; |
| 504 | |
Casey Leedom | 1704d74 | 2010-06-25 12:09:38 +0000 | [diff] [blame] | 505 | struct cpl_tx_pkt_lso { |
| 506 | WR_HDR; |
| 507 | struct cpl_tx_pkt_lso_core c; |
| 508 | /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ |
| 509 | }; |
| 510 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 511 | struct cpl_iscsi_hdr { |
| 512 | union opcode_tid ot; |
| 513 | __be16 pdu_len_ddp; |
| 514 | #define ISCSI_PDU_LEN(x) ((x) & 0x7FFF) |
| 515 | #define ISCSI_DDP (1 << 15) |
| 516 | __be16 len; |
| 517 | __be32 seq; |
| 518 | __be16 urg; |
| 519 | u8 rsvd; |
| 520 | u8 status; |
| 521 | }; |
| 522 | |
| 523 | struct cpl_rx_data { |
| 524 | union opcode_tid ot; |
| 525 | __be16 rsvd; |
| 526 | __be16 len; |
| 527 | __be32 seq; |
| 528 | __be16 urg; |
| 529 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 530 | u8 dack_mode:2; |
| 531 | u8 psh:1; |
| 532 | u8 heartbeat:1; |
| 533 | u8 ddp_off:1; |
| 534 | u8 :3; |
| 535 | #else |
| 536 | u8 :3; |
| 537 | u8 ddp_off:1; |
| 538 | u8 heartbeat:1; |
| 539 | u8 psh:1; |
| 540 | u8 dack_mode:2; |
| 541 | #endif |
| 542 | u8 status; |
| 543 | }; |
| 544 | |
| 545 | struct cpl_rx_data_ack { |
| 546 | WR_HDR; |
| 547 | union opcode_tid ot; |
| 548 | __be32 credit_dack; |
| 549 | #define RX_CREDITS(x) ((x) << 0) |
| 550 | #define RX_FORCE_ACK(x) ((x) << 28) |
| 551 | }; |
| 552 | |
| 553 | struct cpl_rx_pkt { |
Dimitris Michailidis | 87b6cf5 | 2010-04-27 16:22:42 -0700 | [diff] [blame] | 554 | struct rss_header rsshdr; |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 555 | u8 opcode; |
| 556 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 557 | u8 iff:4; |
| 558 | u8 csum_calc:1; |
| 559 | u8 ipmi_pkt:1; |
| 560 | u8 vlan_ex:1; |
| 561 | u8 ip_frag:1; |
| 562 | #else |
| 563 | u8 ip_frag:1; |
| 564 | u8 vlan_ex:1; |
| 565 | u8 ipmi_pkt:1; |
| 566 | u8 csum_calc:1; |
| 567 | u8 iff:4; |
| 568 | #endif |
| 569 | __be16 csum; |
| 570 | __be16 vlan; |
| 571 | __be16 len; |
| 572 | __be32 l2info; |
| 573 | #define RXF_UDP (1 << 22) |
| 574 | #define RXF_TCP (1 << 23) |
Dimitris Michailidis | ba5d3c6 | 2010-08-02 13:19:17 +0000 | [diff] [blame] | 575 | #define RXF_IP (1 << 24) |
| 576 | #define RXF_IP6 (1 << 25) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 577 | __be16 hdr_len; |
| 578 | __be16 err_vec; |
| 579 | }; |
| 580 | |
Vipul Pandya | 1cab775 | 2012-12-10 09:30:55 +0000 | [diff] [blame] | 581 | /* rx_pkt.l2info fields */ |
| 582 | #define S_RX_ETHHDR_LEN 0 |
| 583 | #define M_RX_ETHHDR_LEN 0x1F |
| 584 | #define V_RX_ETHHDR_LEN(x) ((x) << S_RX_ETHHDR_LEN) |
| 585 | #define G_RX_ETHHDR_LEN(x) (((x) >> S_RX_ETHHDR_LEN) & M_RX_ETHHDR_LEN) |
| 586 | |
Santosh Rastapur | 2422d9a | 2013-03-14 05:08:48 +0000 | [diff] [blame] | 587 | #define S_RX_T5_ETHHDR_LEN 0 |
| 588 | #define M_RX_T5_ETHHDR_LEN 0x3F |
| 589 | #define V_RX_T5_ETHHDR_LEN(x) ((x) << S_RX_T5_ETHHDR_LEN) |
| 590 | #define G_RX_T5_ETHHDR_LEN(x) (((x) >> S_RX_T5_ETHHDR_LEN) & M_RX_T5_ETHHDR_LEN) |
| 591 | |
Vipul Pandya | 1cab775 | 2012-12-10 09:30:55 +0000 | [diff] [blame] | 592 | #define S_RX_MACIDX 8 |
| 593 | #define M_RX_MACIDX 0x1FF |
| 594 | #define V_RX_MACIDX(x) ((x) << S_RX_MACIDX) |
| 595 | #define G_RX_MACIDX(x) (((x) >> S_RX_MACIDX) & M_RX_MACIDX) |
| 596 | |
| 597 | #define S_RXF_SYN 21 |
| 598 | #define V_RXF_SYN(x) ((x) << S_RXF_SYN) |
| 599 | #define F_RXF_SYN V_RXF_SYN(1U) |
| 600 | |
| 601 | #define S_RX_CHAN 28 |
| 602 | #define M_RX_CHAN 0xF |
| 603 | #define V_RX_CHAN(x) ((x) << S_RX_CHAN) |
| 604 | #define G_RX_CHAN(x) (((x) >> S_RX_CHAN) & M_RX_CHAN) |
| 605 | |
| 606 | /* rx_pkt.hdr_len fields */ |
| 607 | #define S_RX_TCPHDR_LEN 0 |
| 608 | #define M_RX_TCPHDR_LEN 0x3F |
| 609 | #define V_RX_TCPHDR_LEN(x) ((x) << S_RX_TCPHDR_LEN) |
| 610 | #define G_RX_TCPHDR_LEN(x) (((x) >> S_RX_TCPHDR_LEN) & M_RX_TCPHDR_LEN) |
| 611 | |
| 612 | #define S_RX_IPHDR_LEN 6 |
| 613 | #define M_RX_IPHDR_LEN 0x3FF |
| 614 | #define V_RX_IPHDR_LEN(x) ((x) << S_RX_IPHDR_LEN) |
| 615 | #define G_RX_IPHDR_LEN(x) (((x) >> S_RX_IPHDR_LEN) & M_RX_IPHDR_LEN) |
| 616 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 617 | struct cpl_trace_pkt { |
| 618 | u8 opcode; |
| 619 | u8 intf; |
| 620 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 621 | u8 runt:4; |
| 622 | u8 filter_hit:4; |
| 623 | u8 :6; |
| 624 | u8 err:1; |
| 625 | u8 trunc:1; |
| 626 | #else |
| 627 | u8 filter_hit:4; |
| 628 | u8 runt:4; |
| 629 | u8 trunc:1; |
| 630 | u8 err:1; |
| 631 | u8 :6; |
| 632 | #endif |
| 633 | __be16 rsvd; |
| 634 | __be16 len; |
| 635 | __be64 tstamp; |
| 636 | }; |
| 637 | |
Santosh Rastapur | 2422d9a | 2013-03-14 05:08:48 +0000 | [diff] [blame] | 638 | struct cpl_t5_trace_pkt { |
| 639 | __u8 opcode; |
| 640 | __u8 intf; |
| 641 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
| 642 | __u8 runt:4; |
| 643 | __u8 filter_hit:4; |
| 644 | __u8:6; |
| 645 | __u8 err:1; |
| 646 | __u8 trunc:1; |
| 647 | #else |
| 648 | __u8 filter_hit:4; |
| 649 | __u8 runt:4; |
| 650 | __u8 trunc:1; |
| 651 | __u8 err:1; |
| 652 | __u8:6; |
| 653 | #endif |
| 654 | __be16 rsvd; |
| 655 | __be16 len; |
| 656 | __be64 tstamp; |
| 657 | __be64 rsvd1; |
| 658 | }; |
| 659 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 660 | struct cpl_l2t_write_req { |
| 661 | WR_HDR; |
| 662 | union opcode_tid ot; |
| 663 | __be16 params; |
| 664 | #define L2T_W_INFO(x) ((x) << 2) |
| 665 | #define L2T_W_PORT(x) ((x) << 8) |
| 666 | #define L2T_W_NOREPLY(x) ((x) << 15) |
| 667 | __be16 l2t_idx; |
| 668 | __be16 vlan; |
| 669 | u8 dst_mac[6]; |
| 670 | }; |
| 671 | |
| 672 | struct cpl_l2t_write_rpl { |
| 673 | union opcode_tid ot; |
| 674 | u8 status; |
| 675 | u8 rsvd[3]; |
| 676 | }; |
| 677 | |
| 678 | struct cpl_rdma_terminate { |
| 679 | union opcode_tid ot; |
| 680 | __be16 rsvd; |
| 681 | __be16 len; |
| 682 | }; |
| 683 | |
| 684 | struct cpl_sge_egr_update { |
| 685 | __be32 opcode_qid; |
| 686 | #define EGR_QID(x) ((x) & 0x1FFFF) |
| 687 | __be16 cidx; |
| 688 | __be16 pidx; |
| 689 | }; |
| 690 | |
Vipul Pandya | b407a4a | 2013-04-29 04:04:40 +0000 | [diff] [blame^] | 691 | /* cpl_fw*.type values */ |
| 692 | enum { |
| 693 | FW_TYPE_CMD_RPL = 0, |
| 694 | FW_TYPE_WR_RPL = 1, |
| 695 | FW_TYPE_CQE = 2, |
| 696 | FW_TYPE_OFLD_CONNECTION_WR_RPL = 3, |
| 697 | FW_TYPE_RSSCPL = 4, |
| 698 | }; |
| 699 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 700 | struct cpl_fw4_pld { |
| 701 | u8 opcode; |
| 702 | u8 rsvd0[3]; |
| 703 | u8 type; |
| 704 | u8 rsvd1; |
| 705 | __be16 len; |
| 706 | __be64 data; |
| 707 | __be64 rsvd2; |
| 708 | }; |
| 709 | |
| 710 | struct cpl_fw6_pld { |
| 711 | u8 opcode; |
| 712 | u8 rsvd[5]; |
| 713 | __be16 len; |
| 714 | __be64 data[4]; |
| 715 | }; |
| 716 | |
| 717 | struct cpl_fw4_msg { |
| 718 | u8 opcode; |
| 719 | u8 type; |
| 720 | __be16 rsvd0; |
| 721 | __be32 rsvd1; |
| 722 | __be64 data[2]; |
| 723 | }; |
| 724 | |
| 725 | struct cpl_fw4_ack { |
| 726 | union opcode_tid ot; |
| 727 | u8 credits; |
| 728 | u8 rsvd0[2]; |
| 729 | u8 seq_vld; |
| 730 | __be32 snd_nxt; |
| 731 | __be32 snd_una; |
| 732 | __be64 rsvd1; |
| 733 | }; |
| 734 | |
| 735 | struct cpl_fw6_msg { |
| 736 | u8 opcode; |
| 737 | u8 type; |
| 738 | __be16 rsvd0; |
| 739 | __be32 rsvd1; |
| 740 | __be64 data[4]; |
| 741 | }; |
| 742 | |
Casey Leedom | 1704d74 | 2010-06-25 12:09:38 +0000 | [diff] [blame] | 743 | /* cpl_fw6_msg.type values */ |
| 744 | enum { |
| 745 | FW6_TYPE_CMD_RPL = 0, |
Vipul Pandya | 5be78ee | 2012-12-10 09:30:54 +0000 | [diff] [blame] | 746 | FW6_TYPE_WR_RPL = 1, |
| 747 | FW6_TYPE_CQE = 2, |
| 748 | FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3, |
Vipul Pandya | b407a4a | 2013-04-29 04:04:40 +0000 | [diff] [blame^] | 749 | FW6_TYPE_RSSCPL = FW_TYPE_RSSCPL, |
Vipul Pandya | 5be78ee | 2012-12-10 09:30:54 +0000 | [diff] [blame] | 750 | }; |
| 751 | |
| 752 | struct cpl_fw6_msg_ofld_connection_wr_rpl { |
| 753 | __u64 cookie; |
| 754 | __be32 tid; /* or atid in case of active failure */ |
| 755 | __u8 t_state; |
| 756 | __u8 retval; |
| 757 | __u8 rsvd[2]; |
Casey Leedom | 1704d74 | 2010-06-25 12:09:38 +0000 | [diff] [blame] | 758 | }; |
| 759 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 760 | enum { |
| 761 | ULP_TX_MEM_READ = 2, |
| 762 | ULP_TX_MEM_WRITE = 3, |
| 763 | ULP_TX_PKT = 4 |
| 764 | }; |
| 765 | |
| 766 | enum { |
| 767 | ULP_TX_SC_NOOP = 0x80, |
| 768 | ULP_TX_SC_IMM = 0x81, |
| 769 | ULP_TX_SC_DSGL = 0x82, |
| 770 | ULP_TX_SC_ISGL = 0x83 |
| 771 | }; |
| 772 | |
| 773 | struct ulptx_sge_pair { |
| 774 | __be32 len[2]; |
| 775 | __be64 addr[2]; |
| 776 | }; |
| 777 | |
| 778 | struct ulptx_sgl { |
| 779 | __be32 cmd_nsge; |
| 780 | #define ULPTX_CMD(x) ((x) << 24) |
| 781 | #define ULPTX_NSGE(x) ((x) << 0) |
Naresh Kumar Inna | ce91a92 | 2012-11-15 22:41:17 +0530 | [diff] [blame] | 782 | #define ULPTX_MORE (1U << 23) |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 783 | __be32 len0; |
| 784 | __be64 addr0; |
| 785 | struct ulptx_sge_pair sge[0]; |
| 786 | }; |
| 787 | |
| 788 | struct ulp_mem_io { |
| 789 | WR_HDR; |
| 790 | __be32 cmd; |
| 791 | #define ULP_MEMIO_ORDER(x) ((x) << 23) |
| 792 | __be32 len16; /* command length */ |
| 793 | __be32 dlen; /* data length in 32-byte units */ |
| 794 | #define ULP_MEMIO_DATA_LEN(x) ((x) << 0) |
| 795 | __be32 lock_addr; |
| 796 | #define ULP_MEMIO_ADDR(x) ((x) << 0) |
| 797 | #define ULP_MEMIO_LOCK(x) ((x) << 31) |
| 798 | }; |
| 799 | |
Vipul Pandya | 42b6a94 | 2013-03-14 05:09:01 +0000 | [diff] [blame] | 800 | #define S_T5_ULP_MEMIO_IMM 23 |
| 801 | #define V_T5_ULP_MEMIO_IMM(x) ((x) << S_T5_ULP_MEMIO_IMM) |
| 802 | #define F_T5_ULP_MEMIO_IMM V_T5_ULP_MEMIO_IMM(1U) |
| 803 | |
| 804 | #define S_T5_ULP_MEMIO_ORDER 22 |
| 805 | #define V_T5_ULP_MEMIO_ORDER(x) ((x) << S_T5_ULP_MEMIO_ORDER) |
| 806 | #define F_T5_ULP_MEMIO_ORDER V_T5_ULP_MEMIO_ORDER(1U) |
| 807 | |
Dimitris Michailidis | bbc02c7 | 2010-04-01 15:28:22 +0000 | [diff] [blame] | 808 | #endif /* __T4_MSG_H */ |