1 /* 57xx_iscsi_hsi.h: Broadcom NetXtreme II iSCSI HSI. 2 * 3 * Copyright (c) 2006 - 2009 Broadcom Corporation 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation. 8 * 9 * Written by: Anil Veerabhadrappa (anilgv@broadcom.com) 10 */ 11 #ifndef __57XX_ISCSI_HSI_LINUX_LE__ 12 #define __57XX_ISCSI_HSI_LINUX_LE__ 13 14 /* 15 * iSCSI Async CQE 16 */ 17 struct bnx2i_async_msg { 18 #if defined(__BIG_ENDIAN) 19 u8 op_code; 20 u8 reserved1; 21 u16 reserved0; 22 #elif defined(__LITTLE_ENDIAN) 23 u16 reserved0; 24 u8 reserved1; 25 u8 op_code; 26 #endif 27 u32 reserved2; 28 u32 exp_cmd_sn; 29 u32 max_cmd_sn; 30 u32 reserved3[2]; 31 #if defined(__BIG_ENDIAN) 32 u16 reserved5; 33 u8 err_code; 34 u8 reserved4; 35 #elif defined(__LITTLE_ENDIAN) 36 u8 reserved4; 37 u8 err_code; 38 u16 reserved5; 39 #endif 40 u32 reserved6; 41 u32 lun[2]; 42 #if defined(__BIG_ENDIAN) 43 u8 async_event; 44 u8 async_vcode; 45 u16 param1; 46 #elif defined(__LITTLE_ENDIAN) 47 u16 param1; 48 u8 async_vcode; 49 u8 async_event; 50 #endif 51 #if defined(__BIG_ENDIAN) 52 u16 param2; 53 u16 param3; 54 #elif defined(__LITTLE_ENDIAN) 55 u16 param3; 56 u16 param2; 57 #endif 58 u32 reserved7[3]; 59 u32 cq_req_sn; 60 }; 61 62 63 /* 64 * iSCSI Buffer Descriptor (BD) 65 */ 66 struct iscsi_bd { 67 u32 buffer_addr_hi; 68 u32 buffer_addr_lo; 69 #if defined(__BIG_ENDIAN) 70 u16 reserved0; 71 u16 buffer_length; 72 #elif defined(__LITTLE_ENDIAN) 73 u16 buffer_length; 74 u16 reserved0; 75 #endif 76 #if defined(__BIG_ENDIAN) 77 u16 reserved3; 78 u16 flags; 79 #define ISCSI_BD_RESERVED1 (0x3F<<0) 80 #define ISCSI_BD_RESERVED1_SHIFT 0 81 #define ISCSI_BD_LAST_IN_BD_CHAIN (0x1<<6) 82 #define ISCSI_BD_LAST_IN_BD_CHAIN_SHIFT 6 83 #define ISCSI_BD_FIRST_IN_BD_CHAIN (0x1<<7) 84 #define ISCSI_BD_FIRST_IN_BD_CHAIN_SHIFT 7 85 #define ISCSI_BD_RESERVED2 (0xFF<<8) 86 #define ISCSI_BD_RESERVED2_SHIFT 8 87 #elif defined(__LITTLE_ENDIAN) 88 u16 flags; 89 #define ISCSI_BD_RESERVED1 (0x3F<<0) 90 #define ISCSI_BD_RESERVED1_SHIFT 0 91 #define ISCSI_BD_LAST_IN_BD_CHAIN (0x1<<6) 92 #define ISCSI_BD_LAST_IN_BD_CHAIN_SHIFT 6 93 #define ISCSI_BD_FIRST_IN_BD_CHAIN (0x1<<7) 94 #define ISCSI_BD_FIRST_IN_BD_CHAIN_SHIFT 7 95 #define ISCSI_BD_RESERVED2 (0xFF<<8) 96 #define ISCSI_BD_RESERVED2_SHIFT 8 97 u16 reserved3; 98 #endif 99 }; 100 101 102 /* 103 * iSCSI Cleanup SQ WQE 104 */ 105 struct bnx2i_cleanup_request { 106 #if defined(__BIG_ENDIAN) 107 u8 op_code; 108 u8 reserved1; 109 u16 reserved0; 110 #elif defined(__LITTLE_ENDIAN) 111 u16 reserved0; 112 u8 reserved1; 113 u8 op_code; 114 #endif 115 u32 reserved2[3]; 116 #if defined(__BIG_ENDIAN) 117 u16 reserved3; 118 u16 itt; 119 #define ISCSI_CLEANUP_REQUEST_INDEX (0x3FFF<<0) 120 #define ISCSI_CLEANUP_REQUEST_INDEX_SHIFT 0 121 #define ISCSI_CLEANUP_REQUEST_TYPE (0x3<<14) 122 #define ISCSI_CLEANUP_REQUEST_TYPE_SHIFT 14 123 #elif defined(__LITTLE_ENDIAN) 124 u16 itt; 125 #define ISCSI_CLEANUP_REQUEST_INDEX (0x3FFF<<0) 126 #define ISCSI_CLEANUP_REQUEST_INDEX_SHIFT 0 127 #define ISCSI_CLEANUP_REQUEST_TYPE (0x3<<14) 128 #define ISCSI_CLEANUP_REQUEST_TYPE_SHIFT 14 129 u16 reserved3; 130 #endif 131 u32 reserved4[10]; 132 #if defined(__BIG_ENDIAN) 133 u8 cq_index; 134 u8 reserved6; 135 u16 reserved5; 136 #elif defined(__LITTLE_ENDIAN) 137 u16 reserved5; 138 u8 reserved6; 139 u8 cq_index; 140 #endif 141 }; 142 143 144 /* 145 * iSCSI Cleanup CQE 146 */ 147 struct bnx2i_cleanup_response { 148 #if defined(__BIG_ENDIAN) 149 u8 op_code; 150 u8 status; 151 u16 reserved0; 152 #elif defined(__LITTLE_ENDIAN) 153 u16 reserved0; 154 u8 status; 155 u8 op_code; 156 #endif 157 u32 reserved1[3]; 158 u32 reserved2[2]; 159 #if defined(__BIG_ENDIAN) 160 u16 reserved4; 161 u8 err_code; 162 u8 reserved3; 163 #elif defined(__LITTLE_ENDIAN) 164 u8 reserved3; 165 u8 err_code; 166 u16 reserved4; 167 #endif 168 u32 reserved5[7]; 169 #if defined(__BIG_ENDIAN) 170 u16 reserved6; 171 u16 itt; 172 #define ISCSI_CLEANUP_RESPONSE_INDEX (0x3FFF<<0) 173 #define ISCSI_CLEANUP_RESPONSE_INDEX_SHIFT 0 174 #define ISCSI_CLEANUP_RESPONSE_TYPE (0x3<<14) 175 #define ISCSI_CLEANUP_RESPONSE_TYPE_SHIFT 14 176 #elif defined(__LITTLE_ENDIAN) 177 u16 itt; 178 #define ISCSI_CLEANUP_RESPONSE_INDEX (0x3FFF<<0) 179 #define ISCSI_CLEANUP_RESPONSE_INDEX_SHIFT 0 180 #define ISCSI_CLEANUP_RESPONSE_TYPE (0x3<<14) 181 #define ISCSI_CLEANUP_RESPONSE_TYPE_SHIFT 14 182 u16 reserved6; 183 #endif 184 u32 cq_req_sn; 185 }; 186 187 188 /* 189 * SCSI read/write SQ WQE 190 */ 191 struct bnx2i_cmd_request { 192 #if defined(__BIG_ENDIAN) 193 u8 op_code; 194 u8 op_attr; 195 #define ISCSI_CMD_REQUEST_TASK_ATTR (0x7<<0) 196 #define ISCSI_CMD_REQUEST_TASK_ATTR_SHIFT 0 197 #define ISCSI_CMD_REQUEST_RESERVED1 (0x3<<3) 198 #define ISCSI_CMD_REQUEST_RESERVED1_SHIFT 3 199 #define ISCSI_CMD_REQUEST_WRITE (0x1<<5) 200 #define ISCSI_CMD_REQUEST_WRITE_SHIFT 5 201 #define ISCSI_CMD_REQUEST_READ (0x1<<6) 202 #define ISCSI_CMD_REQUEST_READ_SHIFT 6 203 #define ISCSI_CMD_REQUEST_FINAL (0x1<<7) 204 #define ISCSI_CMD_REQUEST_FINAL_SHIFT 7 205 u16 reserved0; 206 #elif defined(__LITTLE_ENDIAN) 207 u16 reserved0; 208 u8 op_attr; 209 #define ISCSI_CMD_REQUEST_TASK_ATTR (0x7<<0) 210 #define ISCSI_CMD_REQUEST_TASK_ATTR_SHIFT 0 211 #define ISCSI_CMD_REQUEST_RESERVED1 (0x3<<3) 212 #define ISCSI_CMD_REQUEST_RESERVED1_SHIFT 3 213 #define ISCSI_CMD_REQUEST_WRITE (0x1<<5) 214 #define ISCSI_CMD_REQUEST_WRITE_SHIFT 5 215 #define ISCSI_CMD_REQUEST_READ (0x1<<6) 216 #define ISCSI_CMD_REQUEST_READ_SHIFT 6 217 #define ISCSI_CMD_REQUEST_FINAL (0x1<<7) 218 #define ISCSI_CMD_REQUEST_FINAL_SHIFT 7 219 u8 op_code; 220 #endif 221 #if defined(__BIG_ENDIAN) 222 u16 ud_buffer_offset; 223 u16 sd_buffer_offset; 224 #elif defined(__LITTLE_ENDIAN) 225 u16 sd_buffer_offset; 226 u16 ud_buffer_offset; 227 #endif 228 u32 lun[2]; 229 #if defined(__BIG_ENDIAN) 230 u16 reserved2; 231 u16 itt; 232 #define ISCSI_CMD_REQUEST_INDEX (0x3FFF<<0) 233 #define ISCSI_CMD_REQUEST_INDEX_SHIFT 0 234 #define ISCSI_CMD_REQUEST_TYPE (0x3<<14) 235 #define ISCSI_CMD_REQUEST_TYPE_SHIFT 14 236 #elif defined(__LITTLE_ENDIAN) 237 u16 itt; 238 #define ISCSI_CMD_REQUEST_INDEX (0x3FFF<<0) 239 #define ISCSI_CMD_REQUEST_INDEX_SHIFT 0 240 #define ISCSI_CMD_REQUEST_TYPE (0x3<<14) 241 #define ISCSI_CMD_REQUEST_TYPE_SHIFT 14 242 u16 reserved2; 243 #endif 244 u32 total_data_transfer_length; 245 u32 cmd_sn; 246 u32 reserved3; 247 u32 cdb[4]; 248 u32 zero_fill; 249 u32 bd_list_addr_lo; 250 u32 bd_list_addr_hi; 251 #if defined(__BIG_ENDIAN) 252 u8 cq_index; 253 u8 sd_start_bd_index; 254 u8 ud_start_bd_index; 255 u8 num_bds; 256 #elif defined(__LITTLE_ENDIAN) 257 u8 num_bds; 258 u8 ud_start_bd_index; 259 u8 sd_start_bd_index; 260 u8 cq_index; 261 #endif 262 }; 263 264 265 /* 266 * task statistics for write response 267 */ 268 struct bnx2i_write_resp_task_stat { 269 u32 num_data_ins; 270 }; 271 272 /* 273 * task statistics for read response 274 */ 275 struct bnx2i_read_resp_task_stat { 276 #if defined(__BIG_ENDIAN) 277 u16 num_data_outs; 278 u16 num_r2ts; 279 #elif defined(__LITTLE_ENDIAN) 280 u16 num_r2ts; 281 u16 num_data_outs; 282 #endif 283 }; 284 285 /* 286 * task statistics for iSCSI cmd response 287 */ 288 union bnx2i_cmd_resp_task_stat { 289 struct bnx2i_write_resp_task_stat write_stat; 290 struct bnx2i_read_resp_task_stat read_stat; 291 }; 292 293 /* 294 * SCSI Command CQE 295 */ 296 struct bnx2i_cmd_response { 297 #if defined(__BIG_ENDIAN) 298 u8 op_code; 299 u8 response_flags; 300 #define ISCSI_CMD_RESPONSE_RESERVED0 (0x1<<0) 301 #define ISCSI_CMD_RESPONSE_RESERVED0_SHIFT 0 302 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW (0x1<<1) 303 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW_SHIFT 1 304 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW (0x1<<2) 305 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW_SHIFT 2 306 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW (0x1<<3) 307 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW_SHIFT 3 308 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW (0x1<<4) 309 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW_SHIFT 4 310 #define ISCSI_CMD_RESPONSE_RESERVED1 (0x7<<5) 311 #define ISCSI_CMD_RESPONSE_RESERVED1_SHIFT 5 312 u8 response; 313 u8 status; 314 #elif defined(__LITTLE_ENDIAN) 315 u8 status; 316 u8 response; 317 u8 response_flags; 318 #define ISCSI_CMD_RESPONSE_RESERVED0 (0x1<<0) 319 #define ISCSI_CMD_RESPONSE_RESERVED0_SHIFT 0 320 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW (0x1<<1) 321 #define ISCSI_CMD_RESPONSE_RESIDUAL_UNDERFLOW_SHIFT 1 322 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW (0x1<<2) 323 #define ISCSI_CMD_RESPONSE_RESIDUAL_OVERFLOW_SHIFT 2 324 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW (0x1<<3) 325 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_UNDERFLOW_SHIFT 3 326 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW (0x1<<4) 327 #define ISCSI_CMD_RESPONSE_BR_RESIDUAL_OVERFLOW_SHIFT 4 328 #define ISCSI_CMD_RESPONSE_RESERVED1 (0x7<<5) 329 #define ISCSI_CMD_RESPONSE_RESERVED1_SHIFT 5 330 u8 op_code; 331 #endif 332 u32 data_length; 333 u32 exp_cmd_sn; 334 u32 max_cmd_sn; 335 u32 reserved2; 336 u32 residual_count; 337 #if defined(__BIG_ENDIAN) 338 u16 reserved4; 339 u8 err_code; 340 u8 reserved3; 341 #elif defined(__LITTLE_ENDIAN) 342 u8 reserved3; 343 u8 err_code; 344 u16 reserved4; 345 #endif 346 u32 reserved5[5]; 347 union bnx2i_cmd_resp_task_stat task_stat; 348 u32 reserved6; 349 #if defined(__BIG_ENDIAN) 350 u16 reserved7; 351 u16 itt; 352 #define ISCSI_CMD_RESPONSE_INDEX (0x3FFF<<0) 353 #define ISCSI_CMD_RESPONSE_INDEX_SHIFT 0 354 #define ISCSI_CMD_RESPONSE_TYPE (0x3<<14) 355 #define ISCSI_CMD_RESPONSE_TYPE_SHIFT 14 356 #elif defined(__LITTLE_ENDIAN) 357 u16 itt; 358 #define ISCSI_CMD_RESPONSE_INDEX (0x3FFF<<0) 359 #define ISCSI_CMD_RESPONSE_INDEX_SHIFT 0 360 #define ISCSI_CMD_RESPONSE_TYPE (0x3<<14) 361 #define ISCSI_CMD_RESPONSE_TYPE_SHIFT 14 362 u16 reserved7; 363 #endif 364 u32 cq_req_sn; 365 }; 366 367 368 369 /* 370 * firmware middle-path request SQ WQE 371 */ 372 struct bnx2i_fw_mp_request { 373 #if defined(__BIG_ENDIAN) 374 u8 op_code; 375 u8 op_attr; 376 u16 hdr_opaque1; 377 #elif defined(__LITTLE_ENDIAN) 378 u16 hdr_opaque1; 379 u8 op_attr; 380 u8 op_code; 381 #endif 382 u32 data_length; 383 u32 hdr_opaque2[2]; 384 #if defined(__BIG_ENDIAN) 385 u16 reserved0; 386 u16 itt; 387 #define ISCSI_FW_MP_REQUEST_INDEX (0x3FFF<<0) 388 #define ISCSI_FW_MP_REQUEST_INDEX_SHIFT 0 389 #define ISCSI_FW_MP_REQUEST_TYPE (0x3<<14) 390 #define ISCSI_FW_MP_REQUEST_TYPE_SHIFT 14 391 #elif defined(__LITTLE_ENDIAN) 392 u16 itt; 393 #define ISCSI_FW_MP_REQUEST_INDEX (0x3FFF<<0) 394 #define ISCSI_FW_MP_REQUEST_INDEX_SHIFT 0 395 #define ISCSI_FW_MP_REQUEST_TYPE (0x3<<14) 396 #define ISCSI_FW_MP_REQUEST_TYPE_SHIFT 14 397 u16 reserved0; 398 #endif 399 u32 hdr_opaque3[4]; 400 u32 resp_bd_list_addr_lo; 401 u32 resp_bd_list_addr_hi; 402 u32 resp_buffer; 403 #define ISCSI_FW_MP_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0) 404 #define ISCSI_FW_MP_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0 405 #define ISCSI_FW_MP_REQUEST_NUM_RESP_BDS (0xFF<<24) 406 #define ISCSI_FW_MP_REQUEST_NUM_RESP_BDS_SHIFT 24 407 #if defined(__BIG_ENDIAN) 408 u16 reserved4; 409 u8 reserved3; 410 u8 flags; 411 #define ISCSI_FW_MP_REQUEST_RESERVED1 (0x1<<0) 412 #define ISCSI_FW_MP_REQUEST_RESERVED1_SHIFT 0 413 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION (0x1<<1) 414 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION_SHIFT 1 415 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2) 416 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2 417 #define ISCSI_FW_MP_REQUEST_RESERVED2 (0x1F<<3) 418 #define ISCSI_FW_MP_REQUEST_RESERVED2_SHIFT 3 419 #elif defined(__LITTLE_ENDIAN) 420 u8 flags; 421 #define ISCSI_FW_MP_REQUEST_RESERVED1 (0x1<<0) 422 #define ISCSI_FW_MP_REQUEST_RESERVED1_SHIFT 0 423 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION (0x1<<1) 424 #define ISCSI_FW_MP_REQUEST_LOCAL_COMPLETION_SHIFT 1 425 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2) 426 #define ISCSI_FW_MP_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2 427 #define ISCSI_FW_MP_REQUEST_RESERVED2 (0x1F<<3) 428 #define ISCSI_FW_MP_REQUEST_RESERVED2_SHIFT 3 429 u8 reserved3; 430 u16 reserved4; 431 #endif 432 u32 bd_list_addr_lo; 433 u32 bd_list_addr_hi; 434 #if defined(__BIG_ENDIAN) 435 u8 cq_index; 436 u8 reserved6; 437 u8 reserved5; 438 u8 num_bds; 439 #elif defined(__LITTLE_ENDIAN) 440 u8 num_bds; 441 u8 reserved5; 442 u8 reserved6; 443 u8 cq_index; 444 #endif 445 }; 446 447 448 /* 449 * firmware response - CQE: used only by firmware 450 */ 451 struct bnx2i_fw_response { 452 u32 hdr_dword1[2]; 453 u32 hdr_exp_cmd_sn; 454 u32 hdr_max_cmd_sn; 455 u32 hdr_ttt; 456 u32 hdr_res_cnt; 457 u32 cqe_flags; 458 #define ISCSI_FW_RESPONSE_RESERVED2 (0xFF<<0) 459 #define ISCSI_FW_RESPONSE_RESERVED2_SHIFT 0 460 #define ISCSI_FW_RESPONSE_ERR_CODE (0xFF<<8) 461 #define ISCSI_FW_RESPONSE_ERR_CODE_SHIFT 8 462 #define ISCSI_FW_RESPONSE_RESERVED3 (0xFFFF<<16) 463 #define ISCSI_FW_RESPONSE_RESERVED3_SHIFT 16 464 u32 stat_sn; 465 u32 hdr_dword2[2]; 466 u32 hdr_dword3[2]; 467 u32 task_stat; 468 u32 reserved0; 469 u32 hdr_itt; 470 u32 cq_req_sn; 471 }; 472 473 474 /* 475 * iSCSI KCQ CQE parameters 476 */ 477 union iscsi_kcqe_params { 478 u32 reserved0[4]; 479 }; 480 481 /* 482 * iSCSI KCQ CQE 483 */ 484 struct iscsi_kcqe { 485 u32 iscsi_conn_id; 486 u32 completion_status; 487 u32 iscsi_conn_context_id; 488 union iscsi_kcqe_params params; 489 #if defined(__BIG_ENDIAN) 490 u8 flags; 491 #define ISCSI_KCQE_RESERVED0 (0xF<<0) 492 #define ISCSI_KCQE_RESERVED0_SHIFT 0 493 #define ISCSI_KCQE_LAYER_CODE (0x7<<4) 494 #define ISCSI_KCQE_LAYER_CODE_SHIFT 4 495 #define ISCSI_KCQE_RESERVED1 (0x1<<7) 496 #define ISCSI_KCQE_RESERVED1_SHIFT 7 497 u8 op_code; 498 u16 qe_self_seq; 499 #elif defined(__LITTLE_ENDIAN) 500 u16 qe_self_seq; 501 u8 op_code; 502 u8 flags; 503 #define ISCSI_KCQE_RESERVED0 (0xF<<0) 504 #define ISCSI_KCQE_RESERVED0_SHIFT 0 505 #define ISCSI_KCQE_LAYER_CODE (0x7<<4) 506 #define ISCSI_KCQE_LAYER_CODE_SHIFT 4 507 #define ISCSI_KCQE_RESERVED1 (0x1<<7) 508 #define ISCSI_KCQE_RESERVED1_SHIFT 7 509 #endif 510 }; 511 512 513 514 /* 515 * iSCSI KWQE header 516 */ 517 struct iscsi_kwqe_header { 518 #if defined(__BIG_ENDIAN) 519 u8 flags; 520 #define ISCSI_KWQE_HEADER_RESERVED0 (0xF<<0) 521 #define ISCSI_KWQE_HEADER_RESERVED0_SHIFT 0 522 #define ISCSI_KWQE_HEADER_LAYER_CODE (0x7<<4) 523 #define ISCSI_KWQE_HEADER_LAYER_CODE_SHIFT 4 524 #define ISCSI_KWQE_HEADER_RESERVED1 (0x1<<7) 525 #define ISCSI_KWQE_HEADER_RESERVED1_SHIFT 7 526 u8 op_code; 527 #elif defined(__LITTLE_ENDIAN) 528 u8 op_code; 529 u8 flags; 530 #define ISCSI_KWQE_HEADER_RESERVED0 (0xF<<0) 531 #define ISCSI_KWQE_HEADER_RESERVED0_SHIFT 0 532 #define ISCSI_KWQE_HEADER_LAYER_CODE (0x7<<4) 533 #define ISCSI_KWQE_HEADER_LAYER_CODE_SHIFT 4 534 #define ISCSI_KWQE_HEADER_RESERVED1 (0x1<<7) 535 #define ISCSI_KWQE_HEADER_RESERVED1_SHIFT 7 536 #endif 537 }; 538 539 /* 540 * iSCSI firmware init request 1 541 */ 542 struct iscsi_kwqe_init1 { 543 #if defined(__BIG_ENDIAN) 544 struct iscsi_kwqe_header hdr; 545 u8 reserved0; 546 u8 num_cqs; 547 #elif defined(__LITTLE_ENDIAN) 548 u8 num_cqs; 549 u8 reserved0; 550 struct iscsi_kwqe_header hdr; 551 #endif 552 u32 dummy_buffer_addr_lo; 553 u32 dummy_buffer_addr_hi; 554 #if defined(__BIG_ENDIAN) 555 u16 num_ccells_per_conn; 556 u16 num_tasks_per_conn; 557 #elif defined(__LITTLE_ENDIAN) 558 u16 num_tasks_per_conn; 559 u16 num_ccells_per_conn; 560 #endif 561 #if defined(__BIG_ENDIAN) 562 u16 sq_wqes_per_page; 563 u16 sq_num_wqes; 564 #elif defined(__LITTLE_ENDIAN) 565 u16 sq_num_wqes; 566 u16 sq_wqes_per_page; 567 #endif 568 #if defined(__BIG_ENDIAN) 569 u8 cq_log_wqes_per_page; 570 u8 flags; 571 #define ISCSI_KWQE_INIT1_PAGE_SIZE (0xF<<0) 572 #define ISCSI_KWQE_INIT1_PAGE_SIZE_SHIFT 0 573 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE (0x1<<4) 574 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE_SHIFT 4 575 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE (0x1<<5) 576 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE_SHIFT 5 577 #define ISCSI_KWQE_INIT1_RESERVED1 (0x3<<6) 578 #define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 6 579 u16 cq_num_wqes; 580 #elif defined(__LITTLE_ENDIAN) 581 u16 cq_num_wqes; 582 u8 flags; 583 #define ISCSI_KWQE_INIT1_PAGE_SIZE (0xF<<0) 584 #define ISCSI_KWQE_INIT1_PAGE_SIZE_SHIFT 0 585 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE (0x1<<4) 586 #define ISCSI_KWQE_INIT1_DELAYED_ACK_ENABLE_SHIFT 4 587 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE (0x1<<5) 588 #define ISCSI_KWQE_INIT1_KEEP_ALIVE_ENABLE_SHIFT 5 589 #define ISCSI_KWQE_INIT1_RESERVED1 (0x3<<6) 590 #define ISCSI_KWQE_INIT1_RESERVED1_SHIFT 6 591 u8 cq_log_wqes_per_page; 592 #endif 593 #if defined(__BIG_ENDIAN) 594 u16 cq_num_pages; 595 u16 sq_num_pages; 596 #elif defined(__LITTLE_ENDIAN) 597 u16 sq_num_pages; 598 u16 cq_num_pages; 599 #endif 600 #if defined(__BIG_ENDIAN) 601 u16 rq_buffer_size; 602 u16 rq_num_wqes; 603 #elif defined(__LITTLE_ENDIAN) 604 u16 rq_num_wqes; 605 u16 rq_buffer_size; 606 #endif 607 }; 608 609 /* 610 * iSCSI firmware init request 2 611 */ 612 struct iscsi_kwqe_init2 { 613 #if defined(__BIG_ENDIAN) 614 struct iscsi_kwqe_header hdr; 615 u16 max_cq_sqn; 616 #elif defined(__LITTLE_ENDIAN) 617 u16 max_cq_sqn; 618 struct iscsi_kwqe_header hdr; 619 #endif 620 u32 error_bit_map[2]; 621 u32 reserved1[5]; 622 }; 623 624 /* 625 * Initial iSCSI connection offload request 1 626 */ 627 struct iscsi_kwqe_conn_offload1 { 628 #if defined(__BIG_ENDIAN) 629 struct iscsi_kwqe_header hdr; 630 u16 iscsi_conn_id; 631 #elif defined(__LITTLE_ENDIAN) 632 u16 iscsi_conn_id; 633 struct iscsi_kwqe_header hdr; 634 #endif 635 u32 sq_page_table_addr_lo; 636 u32 sq_page_table_addr_hi; 637 u32 cq_page_table_addr_lo; 638 u32 cq_page_table_addr_hi; 639 u32 reserved0[3]; 640 }; 641 642 /* 643 * iSCSI Page Table Entry (PTE) 644 */ 645 struct iscsi_pte { 646 u32 hi; 647 u32 lo; 648 }; 649 650 /* 651 * Initial iSCSI connection offload request 2 652 */ 653 struct iscsi_kwqe_conn_offload2 { 654 #if defined(__BIG_ENDIAN) 655 struct iscsi_kwqe_header hdr; 656 u16 reserved0; 657 #elif defined(__LITTLE_ENDIAN) 658 u16 reserved0; 659 struct iscsi_kwqe_header hdr; 660 #endif 661 u32 rq_page_table_addr_lo; 662 u32 rq_page_table_addr_hi; 663 struct iscsi_pte sq_first_pte; 664 struct iscsi_pte cq_first_pte; 665 u32 num_additional_wqes; 666 }; 667 668 669 /* 670 * Initial iSCSI connection offload request 3 671 */ 672 struct iscsi_kwqe_conn_offload3 { 673 #if defined(__BIG_ENDIAN) 674 struct iscsi_kwqe_header hdr; 675 u16 reserved0; 676 #elif defined(__LITTLE_ENDIAN) 677 u16 reserved0; 678 struct iscsi_kwqe_header hdr; 679 #endif 680 u32 reserved1; 681 struct iscsi_pte qp_first_pte[3]; 682 }; 683 684 685 /* 686 * iSCSI connection update request 687 */ 688 struct iscsi_kwqe_conn_update { 689 #if defined(__BIG_ENDIAN) 690 struct iscsi_kwqe_header hdr; 691 u16 reserved0; 692 #elif defined(__LITTLE_ENDIAN) 693 u16 reserved0; 694 struct iscsi_kwqe_header hdr; 695 #endif 696 #if defined(__BIG_ENDIAN) 697 u8 session_error_recovery_level; 698 u8 max_outstanding_r2ts; 699 u8 reserved2; 700 u8 conn_flags; 701 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST (0x1<<0) 702 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST_SHIFT 0 703 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST (0x1<<1) 704 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST_SHIFT 1 705 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T (0x1<<2) 706 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T_SHIFT 2 707 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA (0x1<<3) 708 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA_SHIFT 3 709 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1 (0xF<<4) 710 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1_SHIFT 4 711 #elif defined(__LITTLE_ENDIAN) 712 u8 conn_flags; 713 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST (0x1<<0) 714 #define ISCSI_KWQE_CONN_UPDATE_HEADER_DIGEST_SHIFT 0 715 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST (0x1<<1) 716 #define ISCSI_KWQE_CONN_UPDATE_DATA_DIGEST_SHIFT 1 717 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T (0x1<<2) 718 #define ISCSI_KWQE_CONN_UPDATE_INITIAL_R2T_SHIFT 2 719 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA (0x1<<3) 720 #define ISCSI_KWQE_CONN_UPDATE_IMMEDIATE_DATA_SHIFT 3 721 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1 (0xF<<4) 722 #define ISCSI_KWQE_CONN_UPDATE_RESERVED1_SHIFT 4 723 u8 reserved2; 724 u8 max_outstanding_r2ts; 725 u8 session_error_recovery_level; 726 #endif 727 u32 context_id; 728 u32 max_send_pdu_length; 729 u32 max_recv_pdu_length; 730 u32 first_burst_length; 731 u32 max_burst_length; 732 u32 exp_stat_sn; 733 }; 734 735 /* 736 * iSCSI destroy connection request 737 */ 738 struct iscsi_kwqe_conn_destroy { 739 #if defined(__BIG_ENDIAN) 740 struct iscsi_kwqe_header hdr; 741 u16 reserved0; 742 #elif defined(__LITTLE_ENDIAN) 743 u16 reserved0; 744 struct iscsi_kwqe_header hdr; 745 #endif 746 u32 context_id; 747 u32 reserved1[6]; 748 }; 749 750 /* 751 * iSCSI KWQ WQE 752 */ 753 union iscsi_kwqe { 754 struct iscsi_kwqe_init1 init1; 755 struct iscsi_kwqe_init2 init2; 756 struct iscsi_kwqe_conn_offload1 conn_offload1; 757 struct iscsi_kwqe_conn_offload2 conn_offload2; 758 struct iscsi_kwqe_conn_update conn_update; 759 struct iscsi_kwqe_conn_destroy conn_destroy; 760 }; 761 762 /* 763 * iSCSI Login SQ WQE 764 */ 765 struct bnx2i_login_request { 766 #if defined(__BIG_ENDIAN) 767 u8 op_code; 768 u8 op_attr; 769 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE (0x3<<0) 770 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE_SHIFT 0 771 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE (0x3<<2) 772 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE_SHIFT 2 773 #define ISCSI_LOGIN_REQUEST_RESERVED0 (0x3<<4) 774 #define ISCSI_LOGIN_REQUEST_RESERVED0_SHIFT 4 775 #define ISCSI_LOGIN_REQUEST_CONT (0x1<<6) 776 #define ISCSI_LOGIN_REQUEST_CONT_SHIFT 6 777 #define ISCSI_LOGIN_REQUEST_TRANSIT (0x1<<7) 778 #define ISCSI_LOGIN_REQUEST_TRANSIT_SHIFT 7 779 u8 version_max; 780 u8 version_min; 781 #elif defined(__LITTLE_ENDIAN) 782 u8 version_min; 783 u8 version_max; 784 u8 op_attr; 785 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE (0x3<<0) 786 #define ISCSI_LOGIN_REQUEST_NEXT_STAGE_SHIFT 0 787 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE (0x3<<2) 788 #define ISCSI_LOGIN_REQUEST_CURRENT_STAGE_SHIFT 2 789 #define ISCSI_LOGIN_REQUEST_RESERVED0 (0x3<<4) 790 #define ISCSI_LOGIN_REQUEST_RESERVED0_SHIFT 4 791 #define ISCSI_LOGIN_REQUEST_CONT (0x1<<6) 792 #define ISCSI_LOGIN_REQUEST_CONT_SHIFT 6 793 #define ISCSI_LOGIN_REQUEST_TRANSIT (0x1<<7) 794 #define ISCSI_LOGIN_REQUEST_TRANSIT_SHIFT 7 795 u8 op_code; 796 #endif 797 u32 data_length; 798 u32 isid_lo; 799 #if defined(__BIG_ENDIAN) 800 u16 isid_hi; 801 u16 tsih; 802 #elif defined(__LITTLE_ENDIAN) 803 u16 tsih; 804 u16 isid_hi; 805 #endif 806 #if defined(__BIG_ENDIAN) 807 u16 reserved2; 808 u16 itt; 809 #define ISCSI_LOGIN_REQUEST_INDEX (0x3FFF<<0) 810 #define ISCSI_LOGIN_REQUEST_INDEX_SHIFT 0 811 #define ISCSI_LOGIN_REQUEST_TYPE (0x3<<14) 812 #define ISCSI_LOGIN_REQUEST_TYPE_SHIFT 14 813 #elif defined(__LITTLE_ENDIAN) 814 u16 itt; 815 #define ISCSI_LOGIN_REQUEST_INDEX (0x3FFF<<0) 816 #define ISCSI_LOGIN_REQUEST_INDEX_SHIFT 0 817 #define ISCSI_LOGIN_REQUEST_TYPE (0x3<<14) 818 #define ISCSI_LOGIN_REQUEST_TYPE_SHIFT 14 819 u16 reserved2; 820 #endif 821 #if defined(__BIG_ENDIAN) 822 u16 cid; 823 u16 reserved3; 824 #elif defined(__LITTLE_ENDIAN) 825 u16 reserved3; 826 u16 cid; 827 #endif 828 u32 cmd_sn; 829 u32 exp_stat_sn; 830 u32 reserved4; 831 u32 resp_bd_list_addr_lo; 832 u32 resp_bd_list_addr_hi; 833 u32 resp_buffer; 834 #define ISCSI_LOGIN_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0) 835 #define ISCSI_LOGIN_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0 836 #define ISCSI_LOGIN_REQUEST_NUM_RESP_BDS (0xFF<<24) 837 #define ISCSI_LOGIN_REQUEST_NUM_RESP_BDS_SHIFT 24 838 #if defined(__BIG_ENDIAN) 839 u16 reserved8; 840 u8 reserved7; 841 u8 flags; 842 #define ISCSI_LOGIN_REQUEST_RESERVED5 (0x3<<0) 843 #define ISCSI_LOGIN_REQUEST_RESERVED5_SHIFT 0 844 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2) 845 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2 846 #define ISCSI_LOGIN_REQUEST_RESERVED6 (0x1F<<3) 847 #define ISCSI_LOGIN_REQUEST_RESERVED6_SHIFT 3 848 #elif defined(__LITTLE_ENDIAN) 849 u8 flags; 850 #define ISCSI_LOGIN_REQUEST_RESERVED5 (0x3<<0) 851 #define ISCSI_LOGIN_REQUEST_RESERVED5_SHIFT 0 852 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN (0x1<<2) 853 #define ISCSI_LOGIN_REQUEST_UPDATE_EXP_STAT_SN_SHIFT 2 854 #define ISCSI_LOGIN_REQUEST_RESERVED6 (0x1F<<3) 855 #define ISCSI_LOGIN_REQUEST_RESERVED6_SHIFT 3 856 u8 reserved7; 857 u16 reserved8; 858 #endif 859 u32 bd_list_addr_lo; 860 u32 bd_list_addr_hi; 861 #if defined(__BIG_ENDIAN) 862 u8 cq_index; 863 u8 reserved10; 864 u8 reserved9; 865 u8 num_bds; 866 #elif defined(__LITTLE_ENDIAN) 867 u8 num_bds; 868 u8 reserved9; 869 u8 reserved10; 870 u8 cq_index; 871 #endif 872 }; 873 874 875 /* 876 * iSCSI Login CQE 877 */ 878 struct bnx2i_login_response { 879 #if defined(__BIG_ENDIAN) 880 u8 op_code; 881 u8 response_flags; 882 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE (0x3<<0) 883 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE_SHIFT 0 884 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE (0x3<<2) 885 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE_SHIFT 2 886 #define ISCSI_LOGIN_RESPONSE_RESERVED0 (0x3<<4) 887 #define ISCSI_LOGIN_RESPONSE_RESERVED0_SHIFT 4 888 #define ISCSI_LOGIN_RESPONSE_CONT (0x1<<6) 889 #define ISCSI_LOGIN_RESPONSE_CONT_SHIFT 6 890 #define ISCSI_LOGIN_RESPONSE_TRANSIT (0x1<<7) 891 #define ISCSI_LOGIN_RESPONSE_TRANSIT_SHIFT 7 892 u8 version_max; 893 u8 version_active; 894 #elif defined(__LITTLE_ENDIAN) 895 u8 version_active; 896 u8 version_max; 897 u8 response_flags; 898 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE (0x3<<0) 899 #define ISCSI_LOGIN_RESPONSE_NEXT_STAGE_SHIFT 0 900 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE (0x3<<2) 901 #define ISCSI_LOGIN_RESPONSE_CURRENT_STAGE_SHIFT 2 902 #define ISCSI_LOGIN_RESPONSE_RESERVED0 (0x3<<4) 903 #define ISCSI_LOGIN_RESPONSE_RESERVED0_SHIFT 4 904 #define ISCSI_LOGIN_RESPONSE_CONT (0x1<<6) 905 #define ISCSI_LOGIN_RESPONSE_CONT_SHIFT 6 906 #define ISCSI_LOGIN_RESPONSE_TRANSIT (0x1<<7) 907 #define ISCSI_LOGIN_RESPONSE_TRANSIT_SHIFT 7 908 u8 op_code; 909 #endif 910 u32 data_length; 911 u32 exp_cmd_sn; 912 u32 max_cmd_sn; 913 u32 reserved1[2]; 914 #if defined(__BIG_ENDIAN) 915 u16 reserved3; 916 u8 err_code; 917 u8 reserved2; 918 #elif defined(__LITTLE_ENDIAN) 919 u8 reserved2; 920 u8 err_code; 921 u16 reserved3; 922 #endif 923 u32 stat_sn; 924 u32 isid_lo; 925 #if defined(__BIG_ENDIAN) 926 u16 isid_hi; 927 u16 tsih; 928 #elif defined(__LITTLE_ENDIAN) 929 u16 tsih; 930 u16 isid_hi; 931 #endif 932 #if defined(__BIG_ENDIAN) 933 u8 status_class; 934 u8 status_detail; 935 u16 reserved4; 936 #elif defined(__LITTLE_ENDIAN) 937 u16 reserved4; 938 u8 status_detail; 939 u8 status_class; 940 #endif 941 u32 reserved5[3]; 942 #if defined(__BIG_ENDIAN) 943 u16 reserved6; 944 u16 itt; 945 #define ISCSI_LOGIN_RESPONSE_INDEX (0x3FFF<<0) 946 #define ISCSI_LOGIN_RESPONSE_INDEX_SHIFT 0 947 #define ISCSI_LOGIN_RESPONSE_TYPE (0x3<<14) 948 #define ISCSI_LOGIN_RESPONSE_TYPE_SHIFT 14 949 #elif defined(__LITTLE_ENDIAN) 950 u16 itt; 951 #define ISCSI_LOGIN_RESPONSE_INDEX (0x3FFF<<0) 952 #define ISCSI_LOGIN_RESPONSE_INDEX_SHIFT 0 953 #define ISCSI_LOGIN_RESPONSE_TYPE (0x3<<14) 954 #define ISCSI_LOGIN_RESPONSE_TYPE_SHIFT 14 955 u16 reserved6; 956 #endif 957 u32 cq_req_sn; 958 }; 959 960 961 /* 962 * iSCSI Logout SQ WQE 963 */ 964 struct bnx2i_logout_request { 965 #if defined(__BIG_ENDIAN) 966 u8 op_code; 967 u8 op_attr; 968 #define ISCSI_LOGOUT_REQUEST_REASON (0x7F<<0) 969 #define ISCSI_LOGOUT_REQUEST_REASON_SHIFT 0 970 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE (0x1<<7) 971 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE_SHIFT 7 972 u16 reserved0; 973 #elif defined(__LITTLE_ENDIAN) 974 u16 reserved0; 975 u8 op_attr; 976 #define ISCSI_LOGOUT_REQUEST_REASON (0x7F<<0) 977 #define ISCSI_LOGOUT_REQUEST_REASON_SHIFT 0 978 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE (0x1<<7) 979 #define ISCSI_LOGOUT_REQUEST_ALWAYS_ONE_SHIFT 7 980 u8 op_code; 981 #endif 982 u32 data_length; 983 u32 reserved1[2]; 984 #if defined(__BIG_ENDIAN) 985 u16 reserved2; 986 u16 itt; 987 #define ISCSI_LOGOUT_REQUEST_INDEX (0x3FFF<<0) 988 #define ISCSI_LOGOUT_REQUEST_INDEX_SHIFT 0 989 #define ISCSI_LOGOUT_REQUEST_TYPE (0x3<<14) 990 #define ISCSI_LOGOUT_REQUEST_TYPE_SHIFT 14 991 #elif defined(__LITTLE_ENDIAN) 992 u16 itt; 993 #define ISCSI_LOGOUT_REQUEST_INDEX (0x3FFF<<0) 994 #define ISCSI_LOGOUT_REQUEST_INDEX_SHIFT 0 995 #define ISCSI_LOGOUT_REQUEST_TYPE (0x3<<14) 996 #define ISCSI_LOGOUT_REQUEST_TYPE_SHIFT 14 997 u16 reserved2; 998 #endif 999 #if defined(__BIG_ENDIAN) 1000 u16 cid; 1001 u16 reserved3; 1002 #elif defined(__LITTLE_ENDIAN) 1003 u16 reserved3; 1004 u16 cid; 1005 #endif 1006 u32 cmd_sn; 1007 u32 reserved4[5]; 1008 u32 zero_fill; 1009 u32 bd_list_addr_lo; 1010 u32 bd_list_addr_hi; 1011 #if defined(__BIG_ENDIAN) 1012 u8 cq_index; 1013 u8 reserved6; 1014 u8 reserved5; 1015 u8 num_bds; 1016 #elif defined(__LITTLE_ENDIAN) 1017 u8 num_bds; 1018 u8 reserved5; 1019 u8 reserved6; 1020 u8 cq_index; 1021 #endif 1022 }; 1023 1024 1025 /* 1026 * iSCSI Logout CQE 1027 */ 1028 struct bnx2i_logout_response { 1029 #if defined(__BIG_ENDIAN) 1030 u8 op_code; 1031 u8 reserved1; 1032 u8 response; 1033 u8 reserved0; 1034 #elif defined(__LITTLE_ENDIAN) 1035 u8 reserved0; 1036 u8 response; 1037 u8 reserved1; 1038 u8 op_code; 1039 #endif 1040 u32 reserved2; 1041 u32 exp_cmd_sn; 1042 u32 max_cmd_sn; 1043 u32 reserved3[2]; 1044 #if defined(__BIG_ENDIAN) 1045 u16 reserved5; 1046 u8 err_code; 1047 u8 reserved4; 1048 #elif defined(__LITTLE_ENDIAN) 1049 u8 reserved4; 1050 u8 err_code; 1051 u16 reserved5; 1052 #endif 1053 u32 reserved6[3]; 1054 #if defined(__BIG_ENDIAN) 1055 u16 time_to_wait; 1056 u16 time_to_retain; 1057 #elif defined(__LITTLE_ENDIAN) 1058 u16 time_to_retain; 1059 u16 time_to_wait; 1060 #endif 1061 u32 reserved7[3]; 1062 #if defined(__BIG_ENDIAN) 1063 u16 reserved8; 1064 u16 itt; 1065 #define ISCSI_LOGOUT_RESPONSE_INDEX (0x3FFF<<0) 1066 #define ISCSI_LOGOUT_RESPONSE_INDEX_SHIFT 0 1067 #define ISCSI_LOGOUT_RESPONSE_TYPE (0x3<<14) 1068 #define ISCSI_LOGOUT_RESPONSE_TYPE_SHIFT 14 1069 #elif defined(__LITTLE_ENDIAN) 1070 u16 itt; 1071 #define ISCSI_LOGOUT_RESPONSE_INDEX (0x3FFF<<0) 1072 #define ISCSI_LOGOUT_RESPONSE_INDEX_SHIFT 0 1073 #define ISCSI_LOGOUT_RESPONSE_TYPE (0x3<<14) 1074 #define ISCSI_LOGOUT_RESPONSE_TYPE_SHIFT 14 1075 u16 reserved8; 1076 #endif 1077 u32 cq_req_sn; 1078 }; 1079 1080 1081 /* 1082 * iSCSI Nop-In CQE 1083 */ 1084 struct bnx2i_nop_in_msg { 1085 #if defined(__BIG_ENDIAN) 1086 u8 op_code; 1087 u8 reserved1; 1088 u16 reserved0; 1089 #elif defined(__LITTLE_ENDIAN) 1090 u16 reserved0; 1091 u8 reserved1; 1092 u8 op_code; 1093 #endif 1094 u32 data_length; 1095 u32 exp_cmd_sn; 1096 u32 max_cmd_sn; 1097 u32 ttt; 1098 u32 reserved2; 1099 #if defined(__BIG_ENDIAN) 1100 u16 reserved4; 1101 u8 err_code; 1102 u8 reserved3; 1103 #elif defined(__LITTLE_ENDIAN) 1104 u8 reserved3; 1105 u8 err_code; 1106 u16 reserved4; 1107 #endif 1108 u32 reserved5; 1109 u32 lun[2]; 1110 u32 reserved6[4]; 1111 #if defined(__BIG_ENDIAN) 1112 u16 reserved7; 1113 u16 itt; 1114 #define ISCSI_NOP_IN_MSG_INDEX (0x3FFF<<0) 1115 #define ISCSI_NOP_IN_MSG_INDEX_SHIFT 0 1116 #define ISCSI_NOP_IN_MSG_TYPE (0x3<<14) 1117 #define ISCSI_NOP_IN_MSG_TYPE_SHIFT 14 1118 #elif defined(__LITTLE_ENDIAN) 1119 u16 itt; 1120 #define ISCSI_NOP_IN_MSG_INDEX (0x3FFF<<0) 1121 #define ISCSI_NOP_IN_MSG_INDEX_SHIFT 0 1122 #define ISCSI_NOP_IN_MSG_TYPE (0x3<<14) 1123 #define ISCSI_NOP_IN_MSG_TYPE_SHIFT 14 1124 u16 reserved7; 1125 #endif 1126 u32 cq_req_sn; 1127 }; 1128 1129 1130 /* 1131 * iSCSI NOP-OUT SQ WQE 1132 */ 1133 struct bnx2i_nop_out_request { 1134 #if defined(__BIG_ENDIAN) 1135 u8 op_code; 1136 u8 op_attr; 1137 #define ISCSI_NOP_OUT_REQUEST_RESERVED1 (0x7F<<0) 1138 #define ISCSI_NOP_OUT_REQUEST_RESERVED1_SHIFT 0 1139 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE (0x1<<7) 1140 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE_SHIFT 7 1141 u16 reserved0; 1142 #elif defined(__LITTLE_ENDIAN) 1143 u16 reserved0; 1144 u8 op_attr; 1145 #define ISCSI_NOP_OUT_REQUEST_RESERVED1 (0x7F<<0) 1146 #define ISCSI_NOP_OUT_REQUEST_RESERVED1_SHIFT 0 1147 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE (0x1<<7) 1148 #define ISCSI_NOP_OUT_REQUEST_ALWAYS_ONE_SHIFT 7 1149 u8 op_code; 1150 #endif 1151 u32 data_length; 1152 u32 lun[2]; 1153 #if defined(__BIG_ENDIAN) 1154 u16 reserved2; 1155 u16 itt; 1156 #define ISCSI_NOP_OUT_REQUEST_INDEX (0x3FFF<<0) 1157 #define ISCSI_NOP_OUT_REQUEST_INDEX_SHIFT 0 1158 #define ISCSI_NOP_OUT_REQUEST_TYPE (0x3<<14) 1159 #define ISCSI_NOP_OUT_REQUEST_TYPE_SHIFT 14 1160 #elif defined(__LITTLE_ENDIAN) 1161 u16 itt; 1162 #define ISCSI_NOP_OUT_REQUEST_INDEX (0x3FFF<<0) 1163 #define ISCSI_NOP_OUT_REQUEST_INDEX_SHIFT 0 1164 #define ISCSI_NOP_OUT_REQUEST_TYPE (0x3<<14) 1165 #define ISCSI_NOP_OUT_REQUEST_TYPE_SHIFT 14 1166 u16 reserved2; 1167 #endif 1168 u32 ttt; 1169 u32 cmd_sn; 1170 u32 reserved3[2]; 1171 u32 resp_bd_list_addr_lo; 1172 u32 resp_bd_list_addr_hi; 1173 u32 resp_buffer; 1174 #define ISCSI_NOP_OUT_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0) 1175 #define ISCSI_NOP_OUT_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0 1176 #define ISCSI_NOP_OUT_REQUEST_NUM_RESP_BDS (0xFF<<24) 1177 #define ISCSI_NOP_OUT_REQUEST_NUM_RESP_BDS_SHIFT 24 1178 #if defined(__BIG_ENDIAN) 1179 u16 reserved7; 1180 u8 reserved6; 1181 u8 flags; 1182 #define ISCSI_NOP_OUT_REQUEST_RESERVED4 (0x1<<0) 1183 #define ISCSI_NOP_OUT_REQUEST_RESERVED4_SHIFT 0 1184 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION (0x1<<1) 1185 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION_SHIFT 1 1186 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL (0x3F<<2) 1187 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL_SHIFT 2 1188 #elif defined(__LITTLE_ENDIAN) 1189 u8 flags; 1190 #define ISCSI_NOP_OUT_REQUEST_RESERVED4 (0x1<<0) 1191 #define ISCSI_NOP_OUT_REQUEST_RESERVED4_SHIFT 0 1192 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION (0x1<<1) 1193 #define ISCSI_NOP_OUT_REQUEST_LOCAL_COMPLETION_SHIFT 1 1194 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL (0x3F<<2) 1195 #define ISCSI_NOP_OUT_REQUEST_ZERO_FILL_SHIFT 2 1196 u8 reserved6; 1197 u16 reserved7; 1198 #endif 1199 u32 bd_list_addr_lo; 1200 u32 bd_list_addr_hi; 1201 #if defined(__BIG_ENDIAN) 1202 u8 cq_index; 1203 u8 reserved9; 1204 u8 reserved8; 1205 u8 num_bds; 1206 #elif defined(__LITTLE_ENDIAN) 1207 u8 num_bds; 1208 u8 reserved8; 1209 u8 reserved9; 1210 u8 cq_index; 1211 #endif 1212 }; 1213 1214 /* 1215 * iSCSI Reject CQE 1216 */ 1217 struct bnx2i_reject_msg { 1218 #if defined(__BIG_ENDIAN) 1219 u8 op_code; 1220 u8 reserved1; 1221 u8 reason; 1222 u8 reserved0; 1223 #elif defined(__LITTLE_ENDIAN) 1224 u8 reserved0; 1225 u8 reason; 1226 u8 reserved1; 1227 u8 op_code; 1228 #endif 1229 u32 data_length; 1230 u32 exp_cmd_sn; 1231 u32 max_cmd_sn; 1232 u32 reserved2[2]; 1233 #if defined(__BIG_ENDIAN) 1234 u16 reserved4; 1235 u8 err_code; 1236 u8 reserved3; 1237 #elif defined(__LITTLE_ENDIAN) 1238 u8 reserved3; 1239 u8 err_code; 1240 u16 reserved4; 1241 #endif 1242 u32 reserved5[8]; 1243 u32 cq_req_sn; 1244 }; 1245 1246 /* 1247 * bnx2i iSCSI TMF SQ WQE 1248 */ 1249 struct bnx2i_tmf_request { 1250 #if defined(__BIG_ENDIAN) 1251 u8 op_code; 1252 u8 op_attr; 1253 #define ISCSI_TMF_REQUEST_FUNCTION (0x7F<<0) 1254 #define ISCSI_TMF_REQUEST_FUNCTION_SHIFT 0 1255 #define ISCSI_TMF_REQUEST_ALWAYS_ONE (0x1<<7) 1256 #define ISCSI_TMF_REQUEST_ALWAYS_ONE_SHIFT 7 1257 u16 reserved0; 1258 #elif defined(__LITTLE_ENDIAN) 1259 u16 reserved0; 1260 u8 op_attr; 1261 #define ISCSI_TMF_REQUEST_FUNCTION (0x7F<<0) 1262 #define ISCSI_TMF_REQUEST_FUNCTION_SHIFT 0 1263 #define ISCSI_TMF_REQUEST_ALWAYS_ONE (0x1<<7) 1264 #define ISCSI_TMF_REQUEST_ALWAYS_ONE_SHIFT 7 1265 u8 op_code; 1266 #endif 1267 u32 data_length; 1268 u32 lun[2]; 1269 #if defined(__BIG_ENDIAN) 1270 u16 reserved1; 1271 u16 itt; 1272 #define ISCSI_TMF_REQUEST_INDEX (0x3FFF<<0) 1273 #define ISCSI_TMF_REQUEST_INDEX_SHIFT 0 1274 #define ISCSI_TMF_REQUEST_TYPE (0x3<<14) 1275 #define ISCSI_TMF_REQUEST_TYPE_SHIFT 14 1276 #elif defined(__LITTLE_ENDIAN) 1277 u16 itt; 1278 #define ISCSI_TMF_REQUEST_INDEX (0x3FFF<<0) 1279 #define ISCSI_TMF_REQUEST_INDEX_SHIFT 0 1280 #define ISCSI_TMF_REQUEST_TYPE (0x3<<14) 1281 #define ISCSI_TMF_REQUEST_TYPE_SHIFT 14 1282 u16 reserved1; 1283 #endif 1284 u32 ref_itt; 1285 u32 cmd_sn; 1286 u32 reserved2; 1287 u32 ref_cmd_sn; 1288 u32 reserved3[3]; 1289 u32 zero_fill; 1290 u32 bd_list_addr_lo; 1291 u32 bd_list_addr_hi; 1292 #if defined(__BIG_ENDIAN) 1293 u8 cq_index; 1294 u8 reserved5; 1295 u8 reserved4; 1296 u8 num_bds; 1297 #elif defined(__LITTLE_ENDIAN) 1298 u8 num_bds; 1299 u8 reserved4; 1300 u8 reserved5; 1301 u8 cq_index; 1302 #endif 1303 }; 1304 1305 /* 1306 * iSCSI Text SQ WQE 1307 */ 1308 struct bnx2i_text_request { 1309 #if defined(__BIG_ENDIAN) 1310 u8 op_code; 1311 u8 op_attr; 1312 #define ISCSI_TEXT_REQUEST_RESERVED1 (0x3F<<0) 1313 #define ISCSI_TEXT_REQUEST_RESERVED1_SHIFT 0 1314 #define ISCSI_TEXT_REQUEST_CONT (0x1<<6) 1315 #define ISCSI_TEXT_REQUEST_CONT_SHIFT 6 1316 #define ISCSI_TEXT_REQUEST_FINAL (0x1<<7) 1317 #define ISCSI_TEXT_REQUEST_FINAL_SHIFT 7 1318 u16 reserved0; 1319 #elif defined(__LITTLE_ENDIAN) 1320 u16 reserved0; 1321 u8 op_attr; 1322 #define ISCSI_TEXT_REQUEST_RESERVED1 (0x3F<<0) 1323 #define ISCSI_TEXT_REQUEST_RESERVED1_SHIFT 0 1324 #define ISCSI_TEXT_REQUEST_CONT (0x1<<6) 1325 #define ISCSI_TEXT_REQUEST_CONT_SHIFT 6 1326 #define ISCSI_TEXT_REQUEST_FINAL (0x1<<7) 1327 #define ISCSI_TEXT_REQUEST_FINAL_SHIFT 7 1328 u8 op_code; 1329 #endif 1330 u32 data_length; 1331 u32 lun[2]; 1332 #if defined(__BIG_ENDIAN) 1333 u16 reserved3; 1334 u16 itt; 1335 #define ISCSI_TEXT_REQUEST_INDEX (0x3FFF<<0) 1336 #define ISCSI_TEXT_REQUEST_INDEX_SHIFT 0 1337 #define ISCSI_TEXT_REQUEST_TYPE (0x3<<14) 1338 #define ISCSI_TEXT_REQUEST_TYPE_SHIFT 14 1339 #elif defined(__LITTLE_ENDIAN) 1340 u16 itt; 1341 #define ISCSI_TEXT_REQUEST_INDEX (0x3FFF<<0) 1342 #define ISCSI_TEXT_REQUEST_INDEX_SHIFT 0 1343 #define ISCSI_TEXT_REQUEST_TYPE (0x3<<14) 1344 #define ISCSI_TEXT_REQUEST_TYPE_SHIFT 14 1345 u16 reserved3; 1346 #endif 1347 u32 ttt; 1348 u32 cmd_sn; 1349 u32 reserved4[2]; 1350 u32 resp_bd_list_addr_lo; 1351 u32 resp_bd_list_addr_hi; 1352 u32 resp_buffer; 1353 #define ISCSI_TEXT_REQUEST_RESP_BUFFER_LENGTH (0xFFFFFF<<0) 1354 #define ISCSI_TEXT_REQUEST_RESP_BUFFER_LENGTH_SHIFT 0 1355 #define ISCSI_TEXT_REQUEST_NUM_RESP_BDS (0xFF<<24) 1356 #define ISCSI_TEXT_REQUEST_NUM_RESP_BDS_SHIFT 24 1357 u32 zero_fill; 1358 u32 bd_list_addr_lo; 1359 u32 bd_list_addr_hi; 1360 #if defined(__BIG_ENDIAN) 1361 u8 cq_index; 1362 u8 reserved7; 1363 u8 reserved6; 1364 u8 num_bds; 1365 #elif defined(__LITTLE_ENDIAN) 1366 u8 num_bds; 1367 u8 reserved6; 1368 u8 reserved7; 1369 u8 cq_index; 1370 #endif 1371 }; 1372 1373 /* 1374 * iSCSI SQ WQE 1375 */ 1376 union iscsi_request { 1377 struct bnx2i_cmd_request cmd; 1378 struct bnx2i_tmf_request tmf; 1379 struct bnx2i_nop_out_request nop_out; 1380 struct bnx2i_login_request login_req; 1381 struct bnx2i_text_request text; 1382 struct bnx2i_logout_request logout_req; 1383 struct bnx2i_cleanup_request cleanup; 1384 }; 1385 1386 1387 /* 1388 * iSCSI TMF CQE 1389 */ 1390 struct bnx2i_tmf_response { 1391 #if defined(__BIG_ENDIAN) 1392 u8 op_code; 1393 u8 reserved1; 1394 u8 response; 1395 u8 reserved0; 1396 #elif defined(__LITTLE_ENDIAN) 1397 u8 reserved0; 1398 u8 response; 1399 u8 reserved1; 1400 u8 op_code; 1401 #endif 1402 u32 reserved2; 1403 u32 exp_cmd_sn; 1404 u32 max_cmd_sn; 1405 u32 reserved3[2]; 1406 #if defined(__BIG_ENDIAN) 1407 u16 reserved5; 1408 u8 err_code; 1409 u8 reserved4; 1410 #elif defined(__LITTLE_ENDIAN) 1411 u8 reserved4; 1412 u8 err_code; 1413 u16 reserved5; 1414 #endif 1415 u32 reserved6[7]; 1416 #if defined(__BIG_ENDIAN) 1417 u16 reserved7; 1418 u16 itt; 1419 #define ISCSI_TMF_RESPONSE_INDEX (0x3FFF<<0) 1420 #define ISCSI_TMF_RESPONSE_INDEX_SHIFT 0 1421 #define ISCSI_TMF_RESPONSE_TYPE (0x3<<14) 1422 #define ISCSI_TMF_RESPONSE_TYPE_SHIFT 14 1423 #elif defined(__LITTLE_ENDIAN) 1424 u16 itt; 1425 #define ISCSI_TMF_RESPONSE_INDEX (0x3FFF<<0) 1426 #define ISCSI_TMF_RESPONSE_INDEX_SHIFT 0 1427 #define ISCSI_TMF_RESPONSE_TYPE (0x3<<14) 1428 #define ISCSI_TMF_RESPONSE_TYPE_SHIFT 14 1429 u16 reserved7; 1430 #endif 1431 u32 cq_req_sn; 1432 }; 1433 1434 /* 1435 * iSCSI Text CQE 1436 */ 1437 struct bnx2i_text_response { 1438 #if defined(__BIG_ENDIAN) 1439 u8 op_code; 1440 u8 response_flags; 1441 #define ISCSI_TEXT_RESPONSE_RESERVED1 (0x3F<<0) 1442 #define ISCSI_TEXT_RESPONSE_RESERVED1_SHIFT 0 1443 #define ISCSI_TEXT_RESPONSE_CONT (0x1<<6) 1444 #define ISCSI_TEXT_RESPONSE_CONT_SHIFT 6 1445 #define ISCSI_TEXT_RESPONSE_FINAL (0x1<<7) 1446 #define ISCSI_TEXT_RESPONSE_FINAL_SHIFT 7 1447 u16 reserved0; 1448 #elif defined(__LITTLE_ENDIAN) 1449 u16 reserved0; 1450 u8 response_flags; 1451 #define ISCSI_TEXT_RESPONSE_RESERVED1 (0x3F<<0) 1452 #define ISCSI_TEXT_RESPONSE_RESERVED1_SHIFT 0 1453 #define ISCSI_TEXT_RESPONSE_CONT (0x1<<6) 1454 #define ISCSI_TEXT_RESPONSE_CONT_SHIFT 6 1455 #define ISCSI_TEXT_RESPONSE_FINAL (0x1<<7) 1456 #define ISCSI_TEXT_RESPONSE_FINAL_SHIFT 7 1457 u8 op_code; 1458 #endif 1459 u32 data_length; 1460 u32 exp_cmd_sn; 1461 u32 max_cmd_sn; 1462 u32 ttt; 1463 u32 reserved2; 1464 #if defined(__BIG_ENDIAN) 1465 u16 reserved4; 1466 u8 err_code; 1467 u8 reserved3; 1468 #elif defined(__LITTLE_ENDIAN) 1469 u8 reserved3; 1470 u8 err_code; 1471 u16 reserved4; 1472 #endif 1473 u32 reserved5; 1474 u32 lun[2]; 1475 u32 reserved6[4]; 1476 #if defined(__BIG_ENDIAN) 1477 u16 reserved7; 1478 u16 itt; 1479 #define ISCSI_TEXT_RESPONSE_INDEX (0x3FFF<<0) 1480 #define ISCSI_TEXT_RESPONSE_INDEX_SHIFT 0 1481 #define ISCSI_TEXT_RESPONSE_TYPE (0x3<<14) 1482 #define ISCSI_TEXT_RESPONSE_TYPE_SHIFT 14 1483 #elif defined(__LITTLE_ENDIAN) 1484 u16 itt; 1485 #define ISCSI_TEXT_RESPONSE_INDEX (0x3FFF<<0) 1486 #define ISCSI_TEXT_RESPONSE_INDEX_SHIFT 0 1487 #define ISCSI_TEXT_RESPONSE_TYPE (0x3<<14) 1488 #define ISCSI_TEXT_RESPONSE_TYPE_SHIFT 14 1489 u16 reserved7; 1490 #endif 1491 u32 cq_req_sn; 1492 }; 1493 1494 /* 1495 * iSCSI CQE 1496 */ 1497 union iscsi_response { 1498 struct bnx2i_cmd_response cmd; 1499 struct bnx2i_tmf_response tmf; 1500 struct bnx2i_login_response login_resp; 1501 struct bnx2i_text_response text; 1502 struct bnx2i_logout_response logout_resp; 1503 struct bnx2i_cleanup_response cleanup; 1504 struct bnx2i_reject_msg reject; 1505 struct bnx2i_async_msg async; 1506 struct bnx2i_nop_in_msg nop_in; 1507 }; 1508 1509 #endif /* __57XX_ISCSI_HSI_LINUX_LE__ */ 1510