1 /* 2 * This file is part of the Chelsio T4 Ethernet driver for Linux. 3 * 4 * Copyright (c) 2003-2014 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, 77 CPL_TRACE_PKT_T5 = 0x48, 78 CPL_RX_ISCSI_DDP = 0x49, 79 80 CPL_RDMA_READ_REQ = 0x60, 81 82 CPL_PASS_OPEN_REQ6 = 0x81, 83 CPL_ACT_OPEN_REQ6 = 0x83, 84 85 CPL_RDMA_TERMINATE = 0xA2, 86 CPL_RDMA_WRITE = 0xA4, 87 CPL_SGE_EGR_UPDATE = 0xA5, 88 89 CPL_TRACE_PKT = 0xB0, 90 CPL_ISCSI_DATA = 0xB2, 91 92 CPL_FW4_MSG = 0xC0, 93 CPL_FW4_PLD = 0xC1, 94 CPL_FW4_ACK = 0xC3, 95 96 CPL_FW6_MSG = 0xE0, 97 CPL_FW6_PLD = 0xE1, 98 CPL_TX_PKT_LSO = 0xED, 99 CPL_TX_PKT_XT = 0xEE, 100 101 NUM_CPL_CMDS 102 }; 103 104 enum CPL_error { 105 CPL_ERR_NONE = 0, 106 CPL_ERR_TCAM_FULL = 3, 107 CPL_ERR_BAD_LENGTH = 15, 108 CPL_ERR_BAD_ROUTE = 18, 109 CPL_ERR_CONN_RESET = 20, 110 CPL_ERR_CONN_EXIST_SYNRECV = 21, 111 CPL_ERR_CONN_EXIST = 22, 112 CPL_ERR_ARP_MISS = 23, 113 CPL_ERR_BAD_SYN = 24, 114 CPL_ERR_CONN_TIMEDOUT = 30, 115 CPL_ERR_XMIT_TIMEDOUT = 31, 116 CPL_ERR_PERSIST_TIMEDOUT = 32, 117 CPL_ERR_FINWAIT2_TIMEDOUT = 33, 118 CPL_ERR_KEEPALIVE_TIMEDOUT = 34, 119 CPL_ERR_RTX_NEG_ADVICE = 35, 120 CPL_ERR_PERSIST_NEG_ADVICE = 36, 121 CPL_ERR_KEEPALV_NEG_ADVICE = 37, 122 CPL_ERR_ABORT_FAILED = 42, 123 CPL_ERR_IWARP_FLM = 50, 124 }; 125 126 enum { 127 CPL_CONN_POLICY_AUTO = 0, 128 CPL_CONN_POLICY_ASK = 1, 129 CPL_CONN_POLICY_FILTER = 2, 130 CPL_CONN_POLICY_DENY = 3 131 }; 132 133 enum { 134 ULP_MODE_NONE = 0, 135 ULP_MODE_ISCSI = 2, 136 ULP_MODE_RDMA = 4, 137 ULP_MODE_TCPDDP = 5, 138 ULP_MODE_FCOE = 6, 139 }; 140 141 enum { 142 ULP_CRC_HEADER = 1 << 0, 143 ULP_CRC_DATA = 1 << 1 144 }; 145 146 enum { 147 CPL_ABORT_SEND_RST = 0, 148 CPL_ABORT_NO_RST, 149 }; 150 151 enum { /* TX_PKT_XT checksum types */ 152 TX_CSUM_TCP = 0, 153 TX_CSUM_UDP = 1, 154 TX_CSUM_CRC16 = 4, 155 TX_CSUM_CRC32 = 5, 156 TX_CSUM_CRC32C = 6, 157 TX_CSUM_FCOE = 7, 158 TX_CSUM_TCPIP = 8, 159 TX_CSUM_UDPIP = 9, 160 TX_CSUM_TCPIP6 = 10, 161 TX_CSUM_UDPIP6 = 11, 162 TX_CSUM_IP = 12, 163 }; 164 165 union opcode_tid { 166 __be32 opcode_tid; 167 u8 opcode; 168 }; 169 170 #define CPL_OPCODE_S 24 171 #define CPL_OPCODE_V(x) ((x) << CPL_OPCODE_S) 172 #define CPL_OPCODE_G(x) (((x) >> CPL_OPCODE_S) & 0xFF) 173 #define TID_G(x) ((x) & 0xFFFFFF) 174 175 /* tid is assumed to be 24-bits */ 176 #define MK_OPCODE_TID(opcode, tid) (CPL_OPCODE_V(opcode) | (tid)) 177 178 #define OPCODE_TID(cmd) ((cmd)->ot.opcode_tid) 179 180 /* extract the TID from a CPL command */ 181 #define GET_TID(cmd) (TID_G(be32_to_cpu(OPCODE_TID(cmd)))) 182 183 /* partitioning of TID fields that also carry a queue id */ 184 #define TID_TID_S 0 185 #define TID_TID_M 0x3fff 186 #define TID_TID_G(x) (((x) >> TID_TID_S) & TID_TID_M) 187 188 #define TID_QID_S 14 189 #define TID_QID_M 0x3ff 190 #define TID_QID_V(x) ((x) << TID_QID_S) 191 #define TID_QID_G(x) (((x) >> TID_QID_S) & TID_QID_M) 192 193 struct rss_header { 194 u8 opcode; 195 #if defined(__LITTLE_ENDIAN_BITFIELD) 196 u8 channel:2; 197 u8 filter_hit:1; 198 u8 filter_tid:1; 199 u8 hash_type:2; 200 u8 ipv6:1; 201 u8 send2fw:1; 202 #else 203 u8 send2fw:1; 204 u8 ipv6:1; 205 u8 hash_type:2; 206 u8 filter_tid:1; 207 u8 filter_hit:1; 208 u8 channel:2; 209 #endif 210 __be16 qid; 211 __be32 hash_val; 212 }; 213 214 struct work_request_hdr { 215 __be32 wr_hi; 216 __be32 wr_mid; 217 __be64 wr_lo; 218 }; 219 220 /* wr_hi fields */ 221 #define WR_OP_S 24 222 #define WR_OP_V(x) ((__u64)(x) << WR_OP_S) 223 224 #define WR_HDR struct work_request_hdr wr 225 226 /* option 0 fields */ 227 #define TX_CHAN_S 2 228 #define TX_CHAN_V(x) ((x) << TX_CHAN_S) 229 230 #define ULP_MODE_S 8 231 #define ULP_MODE_V(x) ((x) << ULP_MODE_S) 232 233 #define RCV_BUFSIZ_S 12 234 #define RCV_BUFSIZ_M 0x3FFU 235 #define RCV_BUFSIZ_V(x) ((x) << RCV_BUFSIZ_S) 236 237 #define SMAC_SEL_S 28 238 #define SMAC_SEL_V(x) ((__u64)(x) << SMAC_SEL_S) 239 240 #define L2T_IDX_S 36 241 #define L2T_IDX_V(x) ((__u64)(x) << L2T_IDX_S) 242 243 #define WND_SCALE_S 50 244 #define WND_SCALE_V(x) ((__u64)(x) << WND_SCALE_S) 245 246 #define KEEP_ALIVE_S 54 247 #define KEEP_ALIVE_V(x) ((__u64)(x) << KEEP_ALIVE_S) 248 #define KEEP_ALIVE_F KEEP_ALIVE_V(1ULL) 249 250 #define MSS_IDX_S 60 251 #define MSS_IDX_M 0xF 252 #define MSS_IDX_V(x) ((__u64)(x) << MSS_IDX_S) 253 #define MSS_IDX_G(x) (((x) >> MSS_IDX_S) & MSS_IDX_M) 254 255 /* option 2 fields */ 256 #define RSS_QUEUE_S 0 257 #define RSS_QUEUE_M 0x3FF 258 #define RSS_QUEUE_V(x) ((x) << RSS_QUEUE_S) 259 #define RSS_QUEUE_G(x) (((x) >> RSS_QUEUE_S) & RSS_QUEUE_M) 260 261 #define RSS_QUEUE_VALID_S 10 262 #define RSS_QUEUE_VALID_V(x) ((x) << RSS_QUEUE_VALID_S) 263 #define RSS_QUEUE_VALID_F RSS_QUEUE_VALID_V(1U) 264 265 #define RX_FC_DISABLE_S 20 266 #define RX_FC_DISABLE_V(x) ((x) << RX_FC_DISABLE_S) 267 #define RX_FC_DISABLE_F RX_FC_DISABLE_V(1U) 268 269 #define RX_FC_VALID_S 22 270 #define RX_FC_VALID_V(x) ((x) << RX_FC_VALID_S) 271 #define RX_FC_VALID_F RX_FC_VALID_V(1U) 272 273 #define RX_CHANNEL_S 26 274 #define RX_CHANNEL_V(x) ((x) << RX_CHANNEL_S) 275 276 #define WND_SCALE_EN_S 28 277 #define WND_SCALE_EN_V(x) ((x) << WND_SCALE_EN_S) 278 #define WND_SCALE_EN_F WND_SCALE_EN_V(1U) 279 280 #define T5_OPT_2_VALID_S 31 281 #define T5_OPT_2_VALID_V(x) ((x) << T5_OPT_2_VALID_S) 282 #define T5_OPT_2_VALID_F T5_OPT_2_VALID_V(1U) 283 284 struct cpl_pass_open_req { 285 WR_HDR; 286 union opcode_tid ot; 287 __be16 local_port; 288 __be16 peer_port; 289 __be32 local_ip; 290 __be32 peer_ip; 291 __be64 opt0; 292 __be64 opt1; 293 }; 294 295 /* option 0 fields */ 296 #define NO_CONG_S 4 297 #define NO_CONG_V(x) ((x) << NO_CONG_S) 298 #define NO_CONG_F NO_CONG_V(1U) 299 300 #define DELACK_S 5 301 #define DELACK_V(x) ((x) << DELACK_S) 302 #define DELACK_F DELACK_V(1U) 303 304 #define DSCP_S 22 305 #define DSCP_M 0x3F 306 #define DSCP_V(x) ((x) << DSCP_S) 307 #define DSCP_G(x) (((x) >> DSCP_S) & DSCP_M) 308 309 #define TCAM_BYPASS_S 48 310 #define TCAM_BYPASS_V(x) ((__u64)(x) << TCAM_BYPASS_S) 311 #define TCAM_BYPASS_F TCAM_BYPASS_V(1ULL) 312 313 #define NAGLE_S 49 314 #define NAGLE_V(x) ((__u64)(x) << NAGLE_S) 315 #define NAGLE_F NAGLE_V(1ULL) 316 317 /* option 1 fields */ 318 #define SYN_RSS_ENABLE_S 0 319 #define SYN_RSS_ENABLE_V(x) ((x) << SYN_RSS_ENABLE_S) 320 #define SYN_RSS_ENABLE_F SYN_RSS_ENABLE_V(1U) 321 322 #define SYN_RSS_QUEUE_S 2 323 #define SYN_RSS_QUEUE_V(x) ((x) << SYN_RSS_QUEUE_S) 324 325 #define CONN_POLICY_S 22 326 #define CONN_POLICY_V(x) ((x) << CONN_POLICY_S) 327 328 struct cpl_pass_open_req6 { 329 WR_HDR; 330 union opcode_tid ot; 331 __be16 local_port; 332 __be16 peer_port; 333 __be64 local_ip_hi; 334 __be64 local_ip_lo; 335 __be64 peer_ip_hi; 336 __be64 peer_ip_lo; 337 __be64 opt0; 338 __be64 opt1; 339 }; 340 341 struct cpl_pass_open_rpl { 342 union opcode_tid ot; 343 u8 rsvd[3]; 344 u8 status; 345 }; 346 347 struct cpl_pass_accept_rpl { 348 WR_HDR; 349 union opcode_tid ot; 350 __be32 opt2; 351 __be64 opt0; 352 }; 353 354 /* option 2 fields */ 355 #define RX_COALESCE_VALID_S 11 356 #define RX_COALESCE_VALID_V(x) ((x) << RX_COALESCE_VALID_S) 357 #define RX_COALESCE_VALID_F RX_COALESCE_VALID_V(1U) 358 359 #define RX_COALESCE_S 12 360 #define RX_COALESCE_V(x) ((x) << RX_COALESCE_S) 361 362 #define PACE_S 16 363 #define PACE_V(x) ((x) << PACE_S) 364 365 #define TX_QUEUE_S 23 366 #define TX_QUEUE_M 0x7 367 #define TX_QUEUE_V(x) ((x) << TX_QUEUE_S) 368 #define TX_QUEUE_G(x) (((x) >> TX_QUEUE_S) & TX_QUEUE_M) 369 370 #define CCTRL_ECN_S 27 371 #define CCTRL_ECN_V(x) ((x) << CCTRL_ECN_S) 372 #define CCTRL_ECN_F CCTRL_ECN_V(1U) 373 374 #define TSTAMPS_EN_S 29 375 #define TSTAMPS_EN_V(x) ((x) << TSTAMPS_EN_S) 376 #define TSTAMPS_EN_F TSTAMPS_EN_V(1U) 377 378 #define SACK_EN_S 30 379 #define SACK_EN_V(x) ((x) << SACK_EN_S) 380 #define SACK_EN_F SACK_EN_V(1U) 381 382 struct cpl_t5_pass_accept_rpl { 383 WR_HDR; 384 union opcode_tid ot; 385 __be32 opt2; 386 __be64 opt0; 387 __be32 iss; 388 __be32 rsvd; 389 }; 390 391 struct cpl_act_open_req { 392 WR_HDR; 393 union opcode_tid ot; 394 __be16 local_port; 395 __be16 peer_port; 396 __be32 local_ip; 397 __be32 peer_ip; 398 __be64 opt0; 399 __be32 params; 400 __be32 opt2; 401 }; 402 403 #define FILTER_TUPLE_S 24 404 #define FILTER_TUPLE_M 0xFFFFFFFFFF 405 #define FILTER_TUPLE_V(x) ((x) << FILTER_TUPLE_S) 406 #define FILTER_TUPLE_G(x) (((x) >> FILTER_TUPLE_S) & FILTER_TUPLE_M) 407 struct cpl_t5_act_open_req { 408 WR_HDR; 409 union opcode_tid ot; 410 __be16 local_port; 411 __be16 peer_port; 412 __be32 local_ip; 413 __be32 peer_ip; 414 __be64 opt0; 415 __be32 rsvd; 416 __be32 opt2; 417 __be64 params; 418 }; 419 420 struct cpl_act_open_req6 { 421 WR_HDR; 422 union opcode_tid ot; 423 __be16 local_port; 424 __be16 peer_port; 425 __be64 local_ip_hi; 426 __be64 local_ip_lo; 427 __be64 peer_ip_hi; 428 __be64 peer_ip_lo; 429 __be64 opt0; 430 __be32 params; 431 __be32 opt2; 432 }; 433 434 struct cpl_t5_act_open_req6 { 435 WR_HDR; 436 union opcode_tid ot; 437 __be16 local_port; 438 __be16 peer_port; 439 __be64 local_ip_hi; 440 __be64 local_ip_lo; 441 __be64 peer_ip_hi; 442 __be64 peer_ip_lo; 443 __be64 opt0; 444 __be32 rsvd; 445 __be32 opt2; 446 __be64 params; 447 }; 448 449 struct cpl_act_open_rpl { 450 union opcode_tid ot; 451 __be32 atid_status; 452 }; 453 454 /* cpl_act_open_rpl.atid_status fields */ 455 #define AOPEN_STATUS_S 0 456 #define AOPEN_STATUS_M 0xFF 457 #define AOPEN_STATUS_G(x) (((x) >> AOPEN_STATUS_S) & AOPEN_STATUS_M) 458 459 #define AOPEN_ATID_S 8 460 #define AOPEN_ATID_M 0xFFFFFF 461 #define AOPEN_ATID_G(x) (((x) >> AOPEN_ATID_S) & AOPEN_ATID_M) 462 463 struct cpl_pass_establish { 464 union opcode_tid ot; 465 __be32 rsvd; 466 __be32 tos_stid; 467 __be16 mac_idx; 468 __be16 tcp_opt; 469 __be32 snd_isn; 470 __be32 rcv_isn; 471 }; 472 473 /* cpl_pass_establish.tos_stid fields */ 474 #define PASS_OPEN_TID_S 0 475 #define PASS_OPEN_TID_M 0xFFFFFF 476 #define PASS_OPEN_TID_V(x) ((x) << PASS_OPEN_TID_S) 477 #define PASS_OPEN_TID_G(x) (((x) >> PASS_OPEN_TID_S) & PASS_OPEN_TID_M) 478 479 #define PASS_OPEN_TOS_S 24 480 #define PASS_OPEN_TOS_M 0xFF 481 #define PASS_OPEN_TOS_V(x) ((x) << PASS_OPEN_TOS_S) 482 #define PASS_OPEN_TOS_G(x) (((x) >> PASS_OPEN_TOS_S) & PASS_OPEN_TOS_M) 483 484 /* cpl_pass_establish.tcp_opt fields (also applies to act_open_establish) */ 485 #define TCPOPT_WSCALE_OK_S 5 486 #define TCPOPT_WSCALE_OK_M 0x1 487 #define TCPOPT_WSCALE_OK_G(x) \ 488 (((x) >> TCPOPT_WSCALE_OK_S) & TCPOPT_WSCALE_OK_M) 489 490 #define TCPOPT_SACK_S 6 491 #define TCPOPT_SACK_M 0x1 492 #define TCPOPT_SACK_G(x) (((x) >> TCPOPT_SACK_S) & TCPOPT_SACK_M) 493 494 #define TCPOPT_TSTAMP_S 7 495 #define TCPOPT_TSTAMP_M 0x1 496 #define TCPOPT_TSTAMP_G(x) (((x) >> TCPOPT_TSTAMP_S) & TCPOPT_TSTAMP_M) 497 498 #define TCPOPT_SND_WSCALE_S 8 499 #define TCPOPT_SND_WSCALE_M 0xF 500 #define TCPOPT_SND_WSCALE_G(x) \ 501 (((x) >> TCPOPT_SND_WSCALE_S) & TCPOPT_SND_WSCALE_M) 502 503 #define TCPOPT_MSS_S 12 504 #define TCPOPT_MSS_M 0xF 505 #define TCPOPT_MSS_G(x) (((x) >> TCPOPT_MSS_S) & TCPOPT_MSS_M) 506 507 struct cpl_act_establish { 508 union opcode_tid ot; 509 __be32 rsvd; 510 __be32 tos_atid; 511 __be16 mac_idx; 512 __be16 tcp_opt; 513 __be32 snd_isn; 514 __be32 rcv_isn; 515 }; 516 517 struct cpl_get_tcb { 518 WR_HDR; 519 union opcode_tid ot; 520 __be16 reply_ctrl; 521 __be16 cookie; 522 }; 523 524 /* cpl_get_tcb.reply_ctrl fields */ 525 #define QUEUENO_S 0 526 #define QUEUENO_V(x) ((x) << QUEUENO_S) 527 528 #define REPLY_CHAN_S 14 529 #define REPLY_CHAN_V(x) ((x) << REPLY_CHAN_S) 530 #define REPLY_CHAN_F REPLY_CHAN_V(1U) 531 532 #define NO_REPLY_S 15 533 #define NO_REPLY_V(x) ((x) << NO_REPLY_S) 534 #define NO_REPLY_F NO_REPLY_V(1U) 535 536 struct cpl_set_tcb_field { 537 WR_HDR; 538 union opcode_tid ot; 539 __be16 reply_ctrl; 540 __be16 word_cookie; 541 __be64 mask; 542 __be64 val; 543 }; 544 545 /* cpl_set_tcb_field.word_cookie fields */ 546 #define TCB_WORD_S 0 547 #define TCB_WORD(x) ((x) << TCB_WORD_S) 548 549 #define TCB_COOKIE_S 5 550 #define TCB_COOKIE_M 0x7 551 #define TCB_COOKIE_V(x) ((x) << TCB_COOKIE_S) 552 #define TCB_COOKIE_G(x) (((x) >> TCB_COOKIE_S) & TCB_COOKIE_M) 553 554 struct cpl_set_tcb_rpl { 555 union opcode_tid ot; 556 __be16 rsvd; 557 u8 cookie; 558 u8 status; 559 __be64 oldval; 560 }; 561 562 struct cpl_close_con_req { 563 WR_HDR; 564 union opcode_tid ot; 565 __be32 rsvd; 566 }; 567 568 struct cpl_close_con_rpl { 569 union opcode_tid ot; 570 u8 rsvd[3]; 571 u8 status; 572 __be32 snd_nxt; 573 __be32 rcv_nxt; 574 }; 575 576 struct cpl_close_listsvr_req { 577 WR_HDR; 578 union opcode_tid ot; 579 __be16 reply_ctrl; 580 __be16 rsvd; 581 }; 582 583 /* additional cpl_close_listsvr_req.reply_ctrl field */ 584 #define LISTSVR_IPV6_S 14 585 #define LISTSVR_IPV6_V(x) ((x) << LISTSVR_IPV6_S) 586 #define LISTSVR_IPV6_F LISTSVR_IPV6_V(1U) 587 588 struct cpl_close_listsvr_rpl { 589 union opcode_tid ot; 590 u8 rsvd[3]; 591 u8 status; 592 }; 593 594 struct cpl_abort_req_rss { 595 union opcode_tid ot; 596 u8 rsvd[3]; 597 u8 status; 598 }; 599 600 struct cpl_abort_req { 601 WR_HDR; 602 union opcode_tid ot; 603 __be32 rsvd0; 604 u8 rsvd1; 605 u8 cmd; 606 u8 rsvd2[6]; 607 }; 608 609 struct cpl_abort_rpl_rss { 610 union opcode_tid ot; 611 u8 rsvd[3]; 612 u8 status; 613 }; 614 615 struct cpl_abort_rpl { 616 WR_HDR; 617 union opcode_tid ot; 618 __be32 rsvd0; 619 u8 rsvd1; 620 u8 cmd; 621 u8 rsvd2[6]; 622 }; 623 624 struct cpl_peer_close { 625 union opcode_tid ot; 626 __be32 rcv_nxt; 627 }; 628 629 struct cpl_tid_release { 630 WR_HDR; 631 union opcode_tid ot; 632 __be32 rsvd; 633 }; 634 635 struct cpl_tx_pkt_core { 636 __be32 ctrl0; 637 __be16 pack; 638 __be16 len; 639 __be64 ctrl1; 640 }; 641 642 struct cpl_tx_pkt { 643 WR_HDR; 644 struct cpl_tx_pkt_core c; 645 }; 646 647 #define cpl_tx_pkt_xt cpl_tx_pkt 648 649 /* cpl_tx_pkt_core.ctrl0 fields */ 650 #define TXPKT_VF_S 0 651 #define TXPKT_VF_V(x) ((x) << TXPKT_VF_S) 652 653 #define TXPKT_PF_S 8 654 #define TXPKT_PF_V(x) ((x) << TXPKT_PF_S) 655 656 #define TXPKT_VF_VLD_S 11 657 #define TXPKT_VF_VLD_V(x) ((x) << TXPKT_VF_VLD_S) 658 #define TXPKT_VF_VLD_F TXPKT_VF_VLD_V(1U) 659 660 #define TXPKT_OVLAN_IDX_S 12 661 #define TXPKT_OVLAN_IDX_V(x) ((x) << TXPKT_OVLAN_IDX_S) 662 663 #define TXPKT_T5_OVLAN_IDX_S 12 664 #define TXPKT_T5_OVLAN_IDX_V(x) ((x) << TXPKT_T5_OVLAN_IDX_S) 665 666 #define TXPKT_INTF_S 16 667 #define TXPKT_INTF_V(x) ((x) << TXPKT_INTF_S) 668 669 #define TXPKT_INS_OVLAN_S 21 670 #define TXPKT_INS_OVLAN_V(x) ((x) << TXPKT_INS_OVLAN_S) 671 #define TXPKT_INS_OVLAN_F TXPKT_INS_OVLAN_V(1U) 672 673 #define TXPKT_OPCODE_S 24 674 #define TXPKT_OPCODE_V(x) ((x) << TXPKT_OPCODE_S) 675 676 /* cpl_tx_pkt_core.ctrl1 fields */ 677 #define TXPKT_CSUM_END_S 12 678 #define TXPKT_CSUM_END_V(x) ((x) << TXPKT_CSUM_END_S) 679 680 #define TXPKT_CSUM_START_S 20 681 #define TXPKT_CSUM_START_V(x) ((x) << TXPKT_CSUM_START_S) 682 683 #define TXPKT_IPHDR_LEN_S 20 684 #define TXPKT_IPHDR_LEN_V(x) ((__u64)(x) << TXPKT_IPHDR_LEN_S) 685 686 #define TXPKT_CSUM_LOC_S 30 687 #define TXPKT_CSUM_LOC_V(x) ((__u64)(x) << TXPKT_CSUM_LOC_S) 688 689 #define TXPKT_ETHHDR_LEN_S 34 690 #define TXPKT_ETHHDR_LEN_V(x) ((__u64)(x) << TXPKT_ETHHDR_LEN_S) 691 692 #define T6_TXPKT_ETHHDR_LEN_S 32 693 #define T6_TXPKT_ETHHDR_LEN_V(x) ((__u64)(x) << T6_TXPKT_ETHHDR_LEN_S) 694 695 #define TXPKT_CSUM_TYPE_S 40 696 #define TXPKT_CSUM_TYPE_V(x) ((__u64)(x) << TXPKT_CSUM_TYPE_S) 697 698 #define TXPKT_VLAN_S 44 699 #define TXPKT_VLAN_V(x) ((__u64)(x) << TXPKT_VLAN_S) 700 701 #define TXPKT_VLAN_VLD_S 60 702 #define TXPKT_VLAN_VLD_V(x) ((__u64)(x) << TXPKT_VLAN_VLD_S) 703 #define TXPKT_VLAN_VLD_F TXPKT_VLAN_VLD_V(1ULL) 704 705 #define TXPKT_IPCSUM_DIS_S 62 706 #define TXPKT_IPCSUM_DIS_V(x) ((__u64)(x) << TXPKT_IPCSUM_DIS_S) 707 #define TXPKT_IPCSUM_DIS_F TXPKT_IPCSUM_DIS_V(1ULL) 708 709 #define TXPKT_L4CSUM_DIS_S 63 710 #define TXPKT_L4CSUM_DIS_V(x) ((__u64)(x) << TXPKT_L4CSUM_DIS_S) 711 #define TXPKT_L4CSUM_DIS_F TXPKT_L4CSUM_DIS_V(1ULL) 712 713 struct cpl_tx_pkt_lso_core { 714 __be32 lso_ctrl; 715 __be16 ipid_ofst; 716 __be16 mss; 717 __be32 seqno_offset; 718 __be32 len; 719 /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ 720 }; 721 722 /* cpl_tx_pkt_lso_core.lso_ctrl fields */ 723 #define LSO_TCPHDR_LEN_S 0 724 #define LSO_TCPHDR_LEN_V(x) ((x) << LSO_TCPHDR_LEN_S) 725 726 #define LSO_IPHDR_LEN_S 4 727 #define LSO_IPHDR_LEN_V(x) ((x) << LSO_IPHDR_LEN_S) 728 729 #define LSO_ETHHDR_LEN_S 16 730 #define LSO_ETHHDR_LEN_V(x) ((x) << LSO_ETHHDR_LEN_S) 731 732 #define LSO_IPV6_S 20 733 #define LSO_IPV6_V(x) ((x) << LSO_IPV6_S) 734 #define LSO_IPV6_F LSO_IPV6_V(1U) 735 736 #define LSO_LAST_SLICE_S 22 737 #define LSO_LAST_SLICE_V(x) ((x) << LSO_LAST_SLICE_S) 738 #define LSO_LAST_SLICE_F LSO_LAST_SLICE_V(1U) 739 740 #define LSO_FIRST_SLICE_S 23 741 #define LSO_FIRST_SLICE_V(x) ((x) << LSO_FIRST_SLICE_S) 742 #define LSO_FIRST_SLICE_F LSO_FIRST_SLICE_V(1U) 743 744 #define LSO_OPCODE_S 24 745 #define LSO_OPCODE_V(x) ((x) << LSO_OPCODE_S) 746 747 #define LSO_T5_XFER_SIZE_S 0 748 #define LSO_T5_XFER_SIZE_V(x) ((x) << LSO_T5_XFER_SIZE_S) 749 750 struct cpl_tx_pkt_lso { 751 WR_HDR; 752 struct cpl_tx_pkt_lso_core c; 753 /* encapsulated CPL (TX_PKT, TX_PKT_XT or TX_DATA) follows here */ 754 }; 755 756 struct cpl_iscsi_hdr { 757 union opcode_tid ot; 758 __be16 pdu_len_ddp; 759 __be16 len; 760 __be32 seq; 761 __be16 urg; 762 u8 rsvd; 763 u8 status; 764 }; 765 766 /* cpl_iscsi_hdr.pdu_len_ddp fields */ 767 #define ISCSI_PDU_LEN_S 0 768 #define ISCSI_PDU_LEN_M 0x7FFF 769 #define ISCSI_PDU_LEN_V(x) ((x) << ISCSI_PDU_LEN_S) 770 #define ISCSI_PDU_LEN_G(x) (((x) >> ISCSI_PDU_LEN_S) & ISCSI_PDU_LEN_M) 771 772 #define ISCSI_DDP_S 15 773 #define ISCSI_DDP_V(x) ((x) << ISCSI_DDP_S) 774 #define ISCSI_DDP_F ISCSI_DDP_V(1U) 775 776 struct cpl_rx_data { 777 union opcode_tid ot; 778 __be16 rsvd; 779 __be16 len; 780 __be32 seq; 781 __be16 urg; 782 #if defined(__LITTLE_ENDIAN_BITFIELD) 783 u8 dack_mode:2; 784 u8 psh:1; 785 u8 heartbeat:1; 786 u8 ddp_off:1; 787 u8 :3; 788 #else 789 u8 :3; 790 u8 ddp_off:1; 791 u8 heartbeat:1; 792 u8 psh:1; 793 u8 dack_mode:2; 794 #endif 795 u8 status; 796 }; 797 798 struct cpl_rx_data_ack { 799 WR_HDR; 800 union opcode_tid ot; 801 __be32 credit_dack; 802 }; 803 804 /* cpl_rx_data_ack.ack_seq fields */ 805 #define RX_CREDITS_S 0 806 #define RX_CREDITS_V(x) ((x) << RX_CREDITS_S) 807 808 #define RX_FORCE_ACK_S 28 809 #define RX_FORCE_ACK_V(x) ((x) << RX_FORCE_ACK_S) 810 #define RX_FORCE_ACK_F RX_FORCE_ACK_V(1U) 811 812 struct cpl_rx_pkt { 813 struct rss_header rsshdr; 814 u8 opcode; 815 #if defined(__LITTLE_ENDIAN_BITFIELD) 816 u8 iff:4; 817 u8 csum_calc:1; 818 u8 ipmi_pkt:1; 819 u8 vlan_ex:1; 820 u8 ip_frag:1; 821 #else 822 u8 ip_frag:1; 823 u8 vlan_ex:1; 824 u8 ipmi_pkt:1; 825 u8 csum_calc:1; 826 u8 iff:4; 827 #endif 828 __be16 csum; 829 __be16 vlan; 830 __be16 len; 831 __be32 l2info; 832 __be16 hdr_len; 833 __be16 err_vec; 834 }; 835 836 #define RXF_PSH_S 20 837 #define RXF_PSH_V(x) ((x) << RXF_PSH_S) 838 #define RXF_PSH_F RXF_PSH_V(1U) 839 840 #define RXF_SYN_S 21 841 #define RXF_SYN_V(x) ((x) << RXF_SYN_S) 842 #define RXF_SYN_F RXF_SYN_V(1U) 843 844 #define RXF_UDP_S 22 845 #define RXF_UDP_V(x) ((x) << RXF_UDP_S) 846 #define RXF_UDP_F RXF_UDP_V(1U) 847 848 #define RXF_TCP_S 23 849 #define RXF_TCP_V(x) ((x) << RXF_TCP_S) 850 #define RXF_TCP_F RXF_TCP_V(1U) 851 852 #define RXF_IP_S 24 853 #define RXF_IP_V(x) ((x) << RXF_IP_S) 854 #define RXF_IP_F RXF_IP_V(1U) 855 856 #define RXF_IP6_S 25 857 #define RXF_IP6_V(x) ((x) << RXF_IP6_S) 858 #define RXF_IP6_F RXF_IP6_V(1U) 859 860 #define RXF_SYN_COOKIE_S 26 861 #define RXF_SYN_COOKIE_V(x) ((x) << RXF_SYN_COOKIE_S) 862 #define RXF_SYN_COOKIE_F RXF_SYN_COOKIE_V(1U) 863 864 #define RXF_FCOE_S 26 865 #define RXF_FCOE_V(x) ((x) << RXF_FCOE_S) 866 #define RXF_FCOE_F RXF_FCOE_V(1U) 867 868 #define RXF_LRO_S 27 869 #define RXF_LRO_V(x) ((x) << RXF_LRO_S) 870 #define RXF_LRO_F RXF_LRO_V(1U) 871 872 /* rx_pkt.l2info fields */ 873 #define RX_ETHHDR_LEN_S 0 874 #define RX_ETHHDR_LEN_M 0x1F 875 #define RX_ETHHDR_LEN_V(x) ((x) << RX_ETHHDR_LEN_S) 876 #define RX_ETHHDR_LEN_G(x) (((x) >> RX_ETHHDR_LEN_S) & RX_ETHHDR_LEN_M) 877 878 #define RX_T5_ETHHDR_LEN_S 0 879 #define RX_T5_ETHHDR_LEN_M 0x3F 880 #define RX_T5_ETHHDR_LEN_V(x) ((x) << RX_T5_ETHHDR_LEN_S) 881 #define RX_T5_ETHHDR_LEN_G(x) (((x) >> RX_T5_ETHHDR_LEN_S) & RX_T5_ETHHDR_LEN_M) 882 883 #define RX_MACIDX_S 8 884 #define RX_MACIDX_M 0x1FF 885 #define RX_MACIDX_V(x) ((x) << RX_MACIDX_S) 886 #define RX_MACIDX_G(x) (((x) >> RX_MACIDX_S) & RX_MACIDX_M) 887 888 #define RXF_SYN_S 21 889 #define RXF_SYN_V(x) ((x) << RXF_SYN_S) 890 #define RXF_SYN_F RXF_SYN_V(1U) 891 892 #define RX_CHAN_S 28 893 #define RX_CHAN_M 0xF 894 #define RX_CHAN_V(x) ((x) << RX_CHAN_S) 895 #define RX_CHAN_G(x) (((x) >> RX_CHAN_S) & RX_CHAN_M) 896 897 /* rx_pkt.hdr_len fields */ 898 #define RX_TCPHDR_LEN_S 0 899 #define RX_TCPHDR_LEN_M 0x3F 900 #define RX_TCPHDR_LEN_V(x) ((x) << RX_TCPHDR_LEN_S) 901 #define RX_TCPHDR_LEN_G(x) (((x) >> RX_TCPHDR_LEN_S) & RX_TCPHDR_LEN_M) 902 903 #define RX_IPHDR_LEN_S 6 904 #define RX_IPHDR_LEN_M 0x3FF 905 #define RX_IPHDR_LEN_V(x) ((x) << RX_IPHDR_LEN_S) 906 #define RX_IPHDR_LEN_G(x) (((x) >> RX_IPHDR_LEN_S) & RX_IPHDR_LEN_M) 907 908 /* rx_pkt.err_vec fields */ 909 #define RXERR_CSUM_S 13 910 #define RXERR_CSUM_V(x) ((x) << RXERR_CSUM_S) 911 #define RXERR_CSUM_F RXERR_CSUM_V(1U) 912 913 struct cpl_trace_pkt { 914 u8 opcode; 915 u8 intf; 916 #if defined(__LITTLE_ENDIAN_BITFIELD) 917 u8 runt:4; 918 u8 filter_hit:4; 919 u8 :6; 920 u8 err:1; 921 u8 trunc:1; 922 #else 923 u8 filter_hit:4; 924 u8 runt:4; 925 u8 trunc:1; 926 u8 err:1; 927 u8 :6; 928 #endif 929 __be16 rsvd; 930 __be16 len; 931 __be64 tstamp; 932 }; 933 934 struct cpl_t5_trace_pkt { 935 __u8 opcode; 936 __u8 intf; 937 #if defined(__LITTLE_ENDIAN_BITFIELD) 938 __u8 runt:4; 939 __u8 filter_hit:4; 940 __u8:6; 941 __u8 err:1; 942 __u8 trunc:1; 943 #else 944 __u8 filter_hit:4; 945 __u8 runt:4; 946 __u8 trunc:1; 947 __u8 err:1; 948 __u8:6; 949 #endif 950 __be16 rsvd; 951 __be16 len; 952 __be64 tstamp; 953 __be64 rsvd1; 954 }; 955 956 struct cpl_l2t_write_req { 957 WR_HDR; 958 union opcode_tid ot; 959 __be16 params; 960 __be16 l2t_idx; 961 __be16 vlan; 962 u8 dst_mac[6]; 963 }; 964 965 /* cpl_l2t_write_req.params fields */ 966 #define L2T_W_INFO_S 2 967 #define L2T_W_INFO_V(x) ((x) << L2T_W_INFO_S) 968 969 #define L2T_W_PORT_S 8 970 #define L2T_W_PORT_V(x) ((x) << L2T_W_PORT_S) 971 972 #define L2T_W_NOREPLY_S 15 973 #define L2T_W_NOREPLY_V(x) ((x) << L2T_W_NOREPLY_S) 974 #define L2T_W_NOREPLY_F L2T_W_NOREPLY_V(1U) 975 976 struct cpl_l2t_write_rpl { 977 union opcode_tid ot; 978 u8 status; 979 u8 rsvd[3]; 980 }; 981 982 struct cpl_rdma_terminate { 983 union opcode_tid ot; 984 __be16 rsvd; 985 __be16 len; 986 }; 987 988 struct cpl_sge_egr_update { 989 __be32 opcode_qid; 990 __be16 cidx; 991 __be16 pidx; 992 }; 993 994 /* cpl_sge_egr_update.ot fields */ 995 #define EGR_QID_S 0 996 #define EGR_QID_M 0x1FFFF 997 #define EGR_QID_G(x) (((x) >> EGR_QID_S) & EGR_QID_M) 998 999 /* cpl_fw*.type values */ 1000 enum { 1001 FW_TYPE_CMD_RPL = 0, 1002 FW_TYPE_WR_RPL = 1, 1003 FW_TYPE_CQE = 2, 1004 FW_TYPE_OFLD_CONNECTION_WR_RPL = 3, 1005 FW_TYPE_RSSCPL = 4, 1006 }; 1007 1008 struct cpl_fw4_pld { 1009 u8 opcode; 1010 u8 rsvd0[3]; 1011 u8 type; 1012 u8 rsvd1; 1013 __be16 len; 1014 __be64 data; 1015 __be64 rsvd2; 1016 }; 1017 1018 struct cpl_fw6_pld { 1019 u8 opcode; 1020 u8 rsvd[5]; 1021 __be16 len; 1022 __be64 data[4]; 1023 }; 1024 1025 struct cpl_fw4_msg { 1026 u8 opcode; 1027 u8 type; 1028 __be16 rsvd0; 1029 __be32 rsvd1; 1030 __be64 data[2]; 1031 }; 1032 1033 struct cpl_fw4_ack { 1034 union opcode_tid ot; 1035 u8 credits; 1036 u8 rsvd0[2]; 1037 u8 seq_vld; 1038 __be32 snd_nxt; 1039 __be32 snd_una; 1040 __be64 rsvd1; 1041 }; 1042 1043 struct cpl_fw6_msg { 1044 u8 opcode; 1045 u8 type; 1046 __be16 rsvd0; 1047 __be32 rsvd1; 1048 __be64 data[4]; 1049 }; 1050 1051 /* cpl_fw6_msg.type values */ 1052 enum { 1053 FW6_TYPE_CMD_RPL = 0, 1054 FW6_TYPE_WR_RPL = 1, 1055 FW6_TYPE_CQE = 2, 1056 FW6_TYPE_OFLD_CONNECTION_WR_RPL = 3, 1057 FW6_TYPE_RSSCPL = FW_TYPE_RSSCPL, 1058 }; 1059 1060 struct cpl_fw6_msg_ofld_connection_wr_rpl { 1061 __u64 cookie; 1062 __be32 tid; /* or atid in case of active failure */ 1063 __u8 t_state; 1064 __u8 retval; 1065 __u8 rsvd[2]; 1066 }; 1067 1068 enum { 1069 ULP_TX_MEM_READ = 2, 1070 ULP_TX_MEM_WRITE = 3, 1071 ULP_TX_PKT = 4 1072 }; 1073 1074 enum { 1075 ULP_TX_SC_NOOP = 0x80, 1076 ULP_TX_SC_IMM = 0x81, 1077 ULP_TX_SC_DSGL = 0x82, 1078 ULP_TX_SC_ISGL = 0x83 1079 }; 1080 1081 #define ULPTX_CMD_S 24 1082 #define ULPTX_CMD_V(x) ((x) << ULPTX_CMD_S) 1083 1084 struct ulptx_sge_pair { 1085 __be32 len[2]; 1086 __be64 addr[2]; 1087 }; 1088 1089 struct ulptx_sgl { 1090 __be32 cmd_nsge; 1091 __be32 len0; 1092 __be64 addr0; 1093 struct ulptx_sge_pair sge[0]; 1094 }; 1095 1096 #define ULPTX_NSGE_S 0 1097 #define ULPTX_NSGE_V(x) ((x) << ULPTX_NSGE_S) 1098 1099 #define ULPTX_MORE_S 23 1100 #define ULPTX_MORE_V(x) ((x) << ULPTX_MORE_S) 1101 #define ULPTX_MORE_F ULPTX_MORE_V(1U) 1102 1103 struct ulp_mem_io { 1104 WR_HDR; 1105 __be32 cmd; 1106 __be32 len16; /* command length */ 1107 __be32 dlen; /* data length in 32-byte units */ 1108 __be32 lock_addr; 1109 }; 1110 1111 #define ULP_MEMIO_LOCK_S 31 1112 #define ULP_MEMIO_LOCK_V(x) ((x) << ULP_MEMIO_LOCK_S) 1113 #define ULP_MEMIO_LOCK_F ULP_MEMIO_LOCK_V(1U) 1114 1115 /* additional ulp_mem_io.cmd fields */ 1116 #define ULP_MEMIO_ORDER_S 23 1117 #define ULP_MEMIO_ORDER_V(x) ((x) << ULP_MEMIO_ORDER_S) 1118 #define ULP_MEMIO_ORDER_F ULP_MEMIO_ORDER_V(1U) 1119 1120 #define T5_ULP_MEMIO_IMM_S 23 1121 #define T5_ULP_MEMIO_IMM_V(x) ((x) << T5_ULP_MEMIO_IMM_S) 1122 #define T5_ULP_MEMIO_IMM_F T5_ULP_MEMIO_IMM_V(1U) 1123 1124 #define T5_ULP_MEMIO_ORDER_S 22 1125 #define T5_ULP_MEMIO_ORDER_V(x) ((x) << T5_ULP_MEMIO_ORDER_S) 1126 #define T5_ULP_MEMIO_ORDER_F T5_ULP_MEMIO_ORDER_V(1U) 1127 1128 /* ulp_mem_io.lock_addr fields */ 1129 #define ULP_MEMIO_ADDR_S 0 1130 #define ULP_MEMIO_ADDR_V(x) ((x) << ULP_MEMIO_ADDR_S) 1131 1132 /* ulp_mem_io.dlen fields */ 1133 #define ULP_MEMIO_DATA_LEN_S 0 1134 #define ULP_MEMIO_DATA_LEN_V(x) ((x) << ULP_MEMIO_DATA_LEN_S) 1135 1136 #endif /* __T4_MSG_H */ 1137