1 /* 2 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc. 3 * All rights reserved 4 * www.brocade.com 5 * 6 * Linux driver for Brocade Fibre Channel Host Bus Adapter. 7 * 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms of the GNU General Public License (GPL) Version 2 as 10 * published by the Free Software Foundation 11 * 12 * This program is distributed in the hope that it will be useful, but 13 * WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * General Public License for more details. 16 */ 17 18 #ifndef __BFI_MS_H__ 19 #define __BFI_MS_H__ 20 21 #include "bfi.h" 22 #include "bfa_fc.h" 23 #include "bfa_defs_svc.h" 24 25 #pragma pack(1) 26 27 enum bfi_iocfc_h2i_msgs { 28 BFI_IOCFC_H2I_CFG_REQ = 1, 29 BFI_IOCFC_H2I_SET_INTR_REQ = 2, 30 BFI_IOCFC_H2I_UPDATEQ_REQ = 3, 31 }; 32 33 enum bfi_iocfc_i2h_msgs { 34 BFI_IOCFC_I2H_CFG_REPLY = BFA_I2HM(1), 35 BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(3), 36 }; 37 38 struct bfi_iocfc_cfg_s { 39 u8 num_cqs; /* Number of CQs to be used */ 40 u8 sense_buf_len; /* SCSI sense length */ 41 u16 rsvd_1; 42 u32 endian_sig; /* endian signature of host */ 43 44 /* 45 * Request and response circular queue base addresses, size and 46 * shadow index pointers. 47 */ 48 union bfi_addr_u req_cq_ba[BFI_IOC_MAX_CQS]; 49 union bfi_addr_u req_shadow_ci[BFI_IOC_MAX_CQS]; 50 u16 req_cq_elems[BFI_IOC_MAX_CQS]; 51 union bfi_addr_u rsp_cq_ba[BFI_IOC_MAX_CQS]; 52 union bfi_addr_u rsp_shadow_pi[BFI_IOC_MAX_CQS]; 53 u16 rsp_cq_elems[BFI_IOC_MAX_CQS]; 54 55 union bfi_addr_u stats_addr; /* DMA-able address for stats */ 56 union bfi_addr_u cfgrsp_addr; /* config response dma address */ 57 union bfi_addr_u ioim_snsbase; /* IO sense buffer base address */ 58 struct bfa_iocfc_intr_attr_s intr_attr; /* IOC interrupt attributes */ 59 }; 60 61 /* 62 * Boot target wwn information for this port. This contains either the stored 63 * or discovered boot target port wwns for the port. 64 */ 65 struct bfi_iocfc_bootwwns { 66 wwn_t wwn[BFA_BOOT_BOOTLUN_MAX]; 67 u8 nwwns; 68 u8 rsvd[7]; 69 }; 70 71 struct bfi_iocfc_cfgrsp_s { 72 struct bfa_iocfc_fwcfg_s fwcfg; 73 struct bfa_iocfc_intr_attr_s intr_attr; 74 struct bfi_iocfc_bootwwns bootwwns; 75 struct bfi_pbc_s pbc_cfg; 76 }; 77 78 /* 79 * BFI_IOCFC_H2I_CFG_REQ message 80 */ 81 struct bfi_iocfc_cfg_req_s { 82 struct bfi_mhdr_s mh; 83 union bfi_addr_u ioc_cfg_dma_addr; 84 }; 85 86 87 /* 88 * BFI_IOCFC_I2H_CFG_REPLY message 89 */ 90 struct bfi_iocfc_cfg_reply_s { 91 struct bfi_mhdr_s mh; /* Common msg header */ 92 u8 cfg_success; /* cfg reply status */ 93 u8 lpu_bm; /* LPUs assigned for this IOC */ 94 u8 rsvd[2]; 95 }; 96 97 98 /* 99 * BFI_IOCFC_H2I_SET_INTR_REQ message 100 */ 101 struct bfi_iocfc_set_intr_req_s { 102 struct bfi_mhdr_s mh; /* common msg header */ 103 u8 coalesce; /* enable intr coalescing */ 104 u8 rsvd[3]; 105 u16 delay; /* delay timer 0..1125us */ 106 u16 latency; /* latency timer 0..225us */ 107 }; 108 109 110 /* 111 * BFI_IOCFC_H2I_UPDATEQ_REQ message 112 */ 113 struct bfi_iocfc_updateq_req_s { 114 struct bfi_mhdr_s mh; /* common msg header */ 115 u32 reqq_ba; /* reqq base addr */ 116 u32 rspq_ba; /* rspq base addr */ 117 u32 reqq_sci; /* reqq shadow ci */ 118 u32 rspq_spi; /* rspq shadow pi */ 119 }; 120 121 122 /* 123 * BFI_IOCFC_I2H_UPDATEQ_RSP message 124 */ 125 struct bfi_iocfc_updateq_rsp_s { 126 struct bfi_mhdr_s mh; /* common msg header */ 127 u8 status; /* updateq status */ 128 u8 rsvd[3]; 129 }; 130 131 132 /* 133 * H2I Messages 134 */ 135 union bfi_iocfc_h2i_msg_u { 136 struct bfi_mhdr_s mh; 137 struct bfi_iocfc_cfg_req_s cfg_req; 138 struct bfi_iocfc_updateq_req_s updateq_req; 139 u32 mboxmsg[BFI_IOC_MSGSZ]; 140 }; 141 142 143 /* 144 * I2H Messages 145 */ 146 union bfi_iocfc_i2h_msg_u { 147 struct bfi_mhdr_s mh; 148 struct bfi_iocfc_cfg_reply_s cfg_reply; 149 struct bfi_iocfc_updateq_rsp_s updateq_rsp; 150 u32 mboxmsg[BFI_IOC_MSGSZ]; 151 }; 152 153 154 enum bfi_fcport_h2i { 155 BFI_FCPORT_H2I_ENABLE_REQ = (1), 156 BFI_FCPORT_H2I_DISABLE_REQ = (2), 157 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3), 158 BFI_FCPORT_H2I_STATS_GET_REQ = (4), 159 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5), 160 }; 161 162 163 enum bfi_fcport_i2h { 164 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1), 165 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2), 166 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3), 167 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4), 168 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5), 169 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6), 170 BFI_FCPORT_I2H_TRUNK_SCN = BFA_I2HM(7), 171 BFI_FCPORT_I2H_ENABLE_AEN = BFA_I2HM(8), 172 BFI_FCPORT_I2H_DISABLE_AEN = BFA_I2HM(9), 173 }; 174 175 176 /* 177 * Generic REQ type 178 */ 179 struct bfi_fcport_req_s { 180 struct bfi_mhdr_s mh; /* msg header */ 181 u32 msgtag; /* msgtag for reply */ 182 }; 183 184 /* 185 * Generic RSP type 186 */ 187 struct bfi_fcport_rsp_s { 188 struct bfi_mhdr_s mh; /* common msg header */ 189 u8 status; /* port enable status */ 190 u8 rsvd[3]; 191 u32 msgtag; /* msgtag for reply */ 192 }; 193 194 /* 195 * BFI_FCPORT_H2I_ENABLE_REQ 196 */ 197 struct bfi_fcport_enable_req_s { 198 struct bfi_mhdr_s mh; /* msg header */ 199 u32 rsvd1; 200 wwn_t nwwn; /* node wwn of physical port */ 201 wwn_t pwwn; /* port wwn of physical port */ 202 struct bfa_port_cfg_s port_cfg; /* port configuration */ 203 union bfi_addr_u stats_dma_addr; /* DMA address for stats */ 204 u32 msgtag; /* msgtag for reply */ 205 u32 rsvd2; 206 }; 207 208 /* 209 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ 210 */ 211 struct bfi_fcport_set_svc_params_req_s { 212 struct bfi_mhdr_s mh; /* msg header */ 213 u16 tx_bbcredit; /* Tx credits */ 214 u16 rsvd; 215 }; 216 217 /* 218 * BFI_FCPORT_I2H_EVENT 219 */ 220 struct bfi_fcport_event_s { 221 struct bfi_mhdr_s mh; /* common msg header */ 222 struct bfa_port_link_s link_state; 223 }; 224 225 /* 226 * BFI_FCPORT_I2H_TRUNK_SCN 227 */ 228 struct bfi_fcport_trunk_link_s { 229 wwn_t trunk_wwn; 230 u8 fctl; /* bfa_trunk_link_fctl_t */ 231 u8 state; /* bfa_trunk_link_state_t */ 232 u8 speed; /* bfa_port_speed_t */ 233 u8 rsvd; 234 u32 deskew; 235 }; 236 237 #define BFI_FCPORT_MAX_LINKS 2 238 struct bfi_fcport_trunk_scn_s { 239 struct bfi_mhdr_s mh; 240 u8 trunk_state; /* bfa_trunk_state_t */ 241 u8 trunk_speed; /* bfa_port_speed_t */ 242 u8 rsvd_a[2]; 243 struct bfi_fcport_trunk_link_s tlink[BFI_FCPORT_MAX_LINKS]; 244 }; 245 246 /* 247 * fcport H2I message 248 */ 249 union bfi_fcport_h2i_msg_u { 250 struct bfi_mhdr_s *mhdr; 251 struct bfi_fcport_enable_req_s *penable; 252 struct bfi_fcport_req_s *pdisable; 253 struct bfi_fcport_set_svc_params_req_s *psetsvcparams; 254 struct bfi_fcport_req_s *pstatsget; 255 struct bfi_fcport_req_s *pstatsclear; 256 }; 257 258 /* 259 * fcport I2H message 260 */ 261 union bfi_fcport_i2h_msg_u { 262 struct bfi_msg_s *msg; 263 struct bfi_fcport_rsp_s *penable_rsp; 264 struct bfi_fcport_rsp_s *pdisable_rsp; 265 struct bfi_fcport_rsp_s *psetsvcparams_rsp; 266 struct bfi_fcport_rsp_s *pstatsget_rsp; 267 struct bfi_fcport_rsp_s *pstatsclear_rsp; 268 struct bfi_fcport_event_s *event; 269 struct bfi_fcport_trunk_scn_s *trunk_scn; 270 }; 271 272 enum bfi_fcxp_h2i { 273 BFI_FCXP_H2I_SEND_REQ = 1, 274 }; 275 276 enum bfi_fcxp_i2h { 277 BFI_FCXP_I2H_SEND_RSP = BFA_I2HM(1), 278 }; 279 280 #define BFA_FCXP_MAX_SGES 2 281 282 /* 283 * FCXP send request structure 284 */ 285 struct bfi_fcxp_send_req_s { 286 struct bfi_mhdr_s mh; /* Common msg header */ 287 u16 fcxp_tag; /* driver request tag */ 288 u16 max_frmsz; /* max send frame size */ 289 u16 vf_id; /* vsan tag if applicable */ 290 u16 rport_fw_hndl; /* FW Handle for the remote port */ 291 u8 class; /* FC class used for req/rsp */ 292 u8 rsp_timeout; /* timeout in secs, 0-no response */ 293 u8 cts; /* continue sequence */ 294 u8 lp_tag; /* lport tag */ 295 struct fchs_s fchs; /* request FC header structure */ 296 u32 req_len; /* request payload length */ 297 u32 rsp_maxlen; /* max response length expected */ 298 struct bfi_sge_s req_sge[BFA_FCXP_MAX_SGES]; /* request buf */ 299 struct bfi_sge_s rsp_sge[BFA_FCXP_MAX_SGES]; /* response buf */ 300 }; 301 302 /* 303 * FCXP send response structure 304 */ 305 struct bfi_fcxp_send_rsp_s { 306 struct bfi_mhdr_s mh; /* Common msg header */ 307 u16 fcxp_tag; /* send request tag */ 308 u8 req_status; /* request status */ 309 u8 rsvd; 310 u32 rsp_len; /* actual response length */ 311 u32 residue_len; /* residual response length */ 312 struct fchs_s fchs; /* response FC header structure */ 313 }; 314 315 enum bfi_uf_h2i { 316 BFI_UF_H2I_BUF_POST = 1, 317 }; 318 319 enum bfi_uf_i2h { 320 BFI_UF_I2H_FRM_RCVD = BFA_I2HM(1), 321 }; 322 323 #define BFA_UF_MAX_SGES 2 324 325 struct bfi_uf_buf_post_s { 326 struct bfi_mhdr_s mh; /* Common msg header */ 327 u16 buf_tag; /* buffer tag */ 328 u16 buf_len; /* total buffer length */ 329 struct bfi_sge_s sge[BFA_UF_MAX_SGES]; /* buffer DMA SGEs */ 330 }; 331 332 struct bfi_uf_frm_rcvd_s { 333 struct bfi_mhdr_s mh; /* Common msg header */ 334 u16 buf_tag; /* buffer tag */ 335 u16 rsvd; 336 u16 frm_len; /* received frame length */ 337 u16 xfr_len; /* tranferred length */ 338 }; 339 340 enum bfi_lps_h2i_msgs { 341 BFI_LPS_H2I_LOGIN_REQ = 1, 342 BFI_LPS_H2I_LOGOUT_REQ = 2, 343 }; 344 345 enum bfi_lps_i2h_msgs { 346 BFI_LPS_H2I_LOGIN_RSP = BFA_I2HM(1), 347 BFI_LPS_H2I_LOGOUT_RSP = BFA_I2HM(2), 348 BFI_LPS_H2I_CVL_EVENT = BFA_I2HM(3), 349 }; 350 351 struct bfi_lps_login_req_s { 352 struct bfi_mhdr_s mh; /* common msg header */ 353 u8 lp_tag; 354 u8 alpa; 355 u16 pdu_size; 356 wwn_t pwwn; 357 wwn_t nwwn; 358 u8 fdisc; 359 u8 auth_en; 360 u8 rsvd[2]; 361 }; 362 363 struct bfi_lps_login_rsp_s { 364 struct bfi_mhdr_s mh; /* common msg header */ 365 u8 lp_tag; 366 u8 status; 367 u8 lsrjt_rsn; 368 u8 lsrjt_expl; 369 wwn_t port_name; 370 wwn_t node_name; 371 u16 bb_credit; 372 u8 f_port; 373 u8 npiv_en; 374 u32 lp_pid:24; 375 u32 auth_req:8; 376 mac_t lp_mac; 377 mac_t fcf_mac; 378 u8 ext_status; 379 u8 brcd_switch; /* attached peer is brcd switch */ 380 }; 381 382 struct bfi_lps_logout_req_s { 383 struct bfi_mhdr_s mh; /* common msg header */ 384 u8 lp_tag; 385 u8 rsvd[3]; 386 wwn_t port_name; 387 }; 388 389 struct bfi_lps_logout_rsp_s { 390 struct bfi_mhdr_s mh; /* common msg header */ 391 u8 lp_tag; 392 u8 status; 393 u8 rsvd[2]; 394 }; 395 396 struct bfi_lps_cvl_event_s { 397 struct bfi_mhdr_s mh; /* common msg header */ 398 u8 lp_tag; 399 u8 rsvd[3]; 400 }; 401 402 union bfi_lps_h2i_msg_u { 403 struct bfi_mhdr_s *msg; 404 struct bfi_lps_login_req_s *login_req; 405 struct bfi_lps_logout_req_s *logout_req; 406 }; 407 408 union bfi_lps_i2h_msg_u { 409 struct bfi_msg_s *msg; 410 struct bfi_lps_login_rsp_s *login_rsp; 411 struct bfi_lps_logout_rsp_s *logout_rsp; 412 struct bfi_lps_cvl_event_s *cvl_event; 413 }; 414 415 enum bfi_rport_h2i_msgs { 416 BFI_RPORT_H2I_CREATE_REQ = 1, 417 BFI_RPORT_H2I_DELETE_REQ = 2, 418 BFI_RPORT_H2I_SET_SPEED_REQ = 3, 419 }; 420 421 enum bfi_rport_i2h_msgs { 422 BFI_RPORT_I2H_CREATE_RSP = BFA_I2HM(1), 423 BFI_RPORT_I2H_DELETE_RSP = BFA_I2HM(2), 424 BFI_RPORT_I2H_QOS_SCN = BFA_I2HM(3), 425 }; 426 427 struct bfi_rport_create_req_s { 428 struct bfi_mhdr_s mh; /* common msg header */ 429 u16 bfa_handle; /* host rport handle */ 430 u16 max_frmsz; /* max rcv pdu size */ 431 u32 pid:24, /* remote port ID */ 432 lp_tag:8; /* local port tag */ 433 u32 local_pid:24, /* local port ID */ 434 cisc:8; 435 u8 fc_class; /* supported FC classes */ 436 u8 vf_en; /* virtual fabric enable */ 437 u16 vf_id; /* virtual fabric ID */ 438 }; 439 440 struct bfi_rport_create_rsp_s { 441 struct bfi_mhdr_s mh; /* common msg header */ 442 u8 status; /* rport creation status */ 443 u8 rsvd[3]; 444 u16 bfa_handle; /* host rport handle */ 445 u16 fw_handle; /* firmware rport handle */ 446 struct bfa_rport_qos_attr_s qos_attr; /* QoS Attributes */ 447 }; 448 449 struct bfa_rport_speed_req_s { 450 struct bfi_mhdr_s mh; /* common msg header */ 451 u16 fw_handle; /* firmware rport handle */ 452 u8 speed; /* rport's speed via RPSC */ 453 u8 rsvd; 454 }; 455 456 struct bfi_rport_delete_req_s { 457 struct bfi_mhdr_s mh; /* common msg header */ 458 u16 fw_handle; /* firmware rport handle */ 459 u16 rsvd; 460 }; 461 462 struct bfi_rport_delete_rsp_s { 463 struct bfi_mhdr_s mh; /* common msg header */ 464 u16 bfa_handle; /* host rport handle */ 465 u8 status; /* rport deletion status */ 466 u8 rsvd; 467 }; 468 469 struct bfi_rport_qos_scn_s { 470 struct bfi_mhdr_s mh; /* common msg header */ 471 u16 bfa_handle; /* host rport handle */ 472 u16 rsvd; 473 struct bfa_rport_qos_attr_s old_qos_attr; /* Old QoS Attributes */ 474 struct bfa_rport_qos_attr_s new_qos_attr; /* New QoS Attributes */ 475 }; 476 477 union bfi_rport_h2i_msg_u { 478 struct bfi_msg_s *msg; 479 struct bfi_rport_create_req_s *create_req; 480 struct bfi_rport_delete_req_s *delete_req; 481 struct bfi_rport_speed_req_s *speed_req; 482 }; 483 484 union bfi_rport_i2h_msg_u { 485 struct bfi_msg_s *msg; 486 struct bfi_rport_create_rsp_s *create_rsp; 487 struct bfi_rport_delete_rsp_s *delete_rsp; 488 struct bfi_rport_qos_scn_s *qos_scn_evt; 489 }; 490 491 /* 492 * Initiator mode I-T nexus interface defines. 493 */ 494 495 enum bfi_itnim_h2i { 496 BFI_ITNIM_H2I_CREATE_REQ = 1, /* i-t nexus creation */ 497 BFI_ITNIM_H2I_DELETE_REQ = 2, /* i-t nexus deletion */ 498 }; 499 500 enum bfi_itnim_i2h { 501 BFI_ITNIM_I2H_CREATE_RSP = BFA_I2HM(1), 502 BFI_ITNIM_I2H_DELETE_RSP = BFA_I2HM(2), 503 BFI_ITNIM_I2H_SLER_EVENT = BFA_I2HM(3), 504 }; 505 506 struct bfi_itnim_create_req_s { 507 struct bfi_mhdr_s mh; /* common msg header */ 508 u16 fw_handle; /* f/w handle for itnim */ 509 u8 class; /* FC class for IO */ 510 u8 seq_rec; /* sequence recovery support */ 511 u8 msg_no; /* seq id of the msg */ 512 }; 513 514 struct bfi_itnim_create_rsp_s { 515 struct bfi_mhdr_s mh; /* common msg header */ 516 u16 bfa_handle; /* bfa handle for itnim */ 517 u8 status; /* fcp request status */ 518 u8 seq_id; /* seq id of the msg */ 519 }; 520 521 struct bfi_itnim_delete_req_s { 522 struct bfi_mhdr_s mh; /* common msg header */ 523 u16 fw_handle; /* f/w itnim handle */ 524 u8 seq_id; /* seq id of the msg */ 525 u8 rsvd; 526 }; 527 528 struct bfi_itnim_delete_rsp_s { 529 struct bfi_mhdr_s mh; /* common msg header */ 530 u16 bfa_handle; /* bfa handle for itnim */ 531 u8 status; /* fcp request status */ 532 u8 seq_id; /* seq id of the msg */ 533 }; 534 535 struct bfi_itnim_sler_event_s { 536 struct bfi_mhdr_s mh; /* common msg header */ 537 u16 bfa_handle; /* bfa handle for itnim */ 538 u16 rsvd; 539 }; 540 541 union bfi_itnim_h2i_msg_u { 542 struct bfi_itnim_create_req_s *create_req; 543 struct bfi_itnim_delete_req_s *delete_req; 544 struct bfi_msg_s *msg; 545 }; 546 547 union bfi_itnim_i2h_msg_u { 548 struct bfi_itnim_create_rsp_s *create_rsp; 549 struct bfi_itnim_delete_rsp_s *delete_rsp; 550 struct bfi_itnim_sler_event_s *sler_event; 551 struct bfi_msg_s *msg; 552 }; 553 554 /* 555 * Initiator mode IO interface defines. 556 */ 557 558 enum bfi_ioim_h2i { 559 BFI_IOIM_H2I_IOABORT_REQ = 1, /* IO abort request */ 560 BFI_IOIM_H2I_IOCLEANUP_REQ = 2, /* IO cleanup request */ 561 }; 562 563 enum bfi_ioim_i2h { 564 BFI_IOIM_I2H_IO_RSP = BFA_I2HM(1), /* non-fp IO response */ 565 BFI_IOIM_I2H_IOABORT_RSP = BFA_I2HM(2), /* ABORT rsp */ 566 }; 567 568 /* 569 * IO command DIF info 570 */ 571 struct bfi_ioim_dif_s { 572 u32 dif_info[4]; 573 }; 574 575 /* 576 * FCP IO messages overview 577 * 578 * @note 579 * - Max CDB length supported is 64 bytes. 580 * - SCSI Linked commands and SCSI bi-directional Commands not 581 * supported. 582 * 583 */ 584 struct bfi_ioim_req_s { 585 struct bfi_mhdr_s mh; /* Common msg header */ 586 u16 io_tag; /* I/O tag */ 587 u16 rport_hdl; /* itnim/rport firmware handle */ 588 struct fcp_cmnd_s cmnd; /* IO request info */ 589 590 /* 591 * SG elements array within the IO request must be double word 592 * aligned. This aligment is required to optimize SGM setup for the IO. 593 */ 594 struct bfi_sge_s sges[BFI_SGE_INLINE_MAX]; 595 u8 io_timeout; 596 u8 dif_en; 597 u8 rsvd_a[2]; 598 struct bfi_ioim_dif_s dif; 599 }; 600 601 /* 602 * This table shows various IO status codes from firmware and their 603 * meaning. Host driver can use these status codes to further process 604 * IO completions. 605 * 606 * BFI_IOIM_STS_OK : IO completed with error free SCSI & 607 * transport status. 608 * io-tag can be reused. 609 * 610 * BFA_IOIM_STS_SCSI_ERR : IO completed with scsi error. 611 * - io-tag can be reused. 612 * 613 * BFI_IOIM_STS_HOST_ABORTED : IO was aborted successfully due to 614 * host request. 615 * - io-tag cannot be reused yet. 616 * 617 * BFI_IOIM_STS_ABORTED : IO was aborted successfully 618 * internally by f/w. 619 * - io-tag cannot be reused yet. 620 * 621 * BFI_IOIM_STS_TIMEDOUT : IO timedout and ABTS/RRQ is happening 622 * in the firmware and 623 * - io-tag cannot be reused yet. 624 * 625 * BFI_IOIM_STS_SQER_NEEDED : Firmware could not recover the IO 626 * with sequence level error 627 * logic and hence host needs to retry 628 * this IO with a different IO tag 629 * - io-tag cannot be used yet. 630 * 631 * BFI_IOIM_STS_NEXUS_ABORT : Second Level Error Recovery from host 632 * is required because 2 consecutive ABTS 633 * timedout and host needs logout and 634 * re-login with the target 635 * - io-tag cannot be used yet. 636 * 637 * BFI_IOIM_STS_UNDERRUN : IO completed with SCSI status good, 638 * but the data tranferred is less than 639 * the fcp data length in the command. 640 * ex. SCSI INQUIRY where transferred 641 * data length and residue count in FCP 642 * response accounts for total fcp-dl 643 * - io-tag can be reused. 644 * 645 * BFI_IOIM_STS_OVERRUN : IO completed with SCSI status good, 646 * but the data transerred is more than 647 * fcp data length in the command. ex. 648 * TAPE IOs where blocks can of unequal 649 * lengths. 650 * - io-tag can be reused. 651 * 652 * BFI_IOIM_STS_RES_FREE : Firmware has completed using io-tag 653 * during abort process 654 * - io-tag can be reused. 655 * 656 * BFI_IOIM_STS_PROTO_ERR : Firmware detected a protocol error. 657 * ex target sent more data than 658 * requested, or there was data frame 659 * loss and other reasons 660 * - io-tag cannot be used yet. 661 * 662 * BFI_IOIM_STS_DIF_ERR : Firwmare detected DIF error. ex: DIF 663 * CRC err or Ref Tag err or App tag err. 664 * - io-tag can be reused. 665 * 666 * BFA_IOIM_STS_TSK_MGT_ABORT : IO was aborted because of Task 667 * Management command from the host 668 * - io-tag can be reused. 669 * 670 * BFI_IOIM_STS_UTAG : Firmware does not know about this 671 * io_tag. 672 * - io-tag can be reused. 673 */ 674 enum bfi_ioim_status { 675 BFI_IOIM_STS_OK = 0, 676 BFI_IOIM_STS_HOST_ABORTED = 1, 677 BFI_IOIM_STS_ABORTED = 2, 678 BFI_IOIM_STS_TIMEDOUT = 3, 679 BFI_IOIM_STS_RES_FREE = 4, 680 BFI_IOIM_STS_SQER_NEEDED = 5, 681 BFI_IOIM_STS_PROTO_ERR = 6, 682 BFI_IOIM_STS_UTAG = 7, 683 BFI_IOIM_STS_PATHTOV = 8, 684 }; 685 686 #define BFI_IOIM_SNSLEN (256) 687 /* 688 * I/O response message 689 */ 690 struct bfi_ioim_rsp_s { 691 struct bfi_mhdr_s mh; /* common msg header */ 692 u16 io_tag; /* completed IO tag */ 693 u16 bfa_rport_hndl; /* releated rport handle */ 694 u8 io_status; /* IO completion status */ 695 u8 reuse_io_tag; /* IO tag can be reused */ 696 u16 abort_tag; /* host abort request tag */ 697 u8 scsi_status; /* scsi status from target */ 698 u8 sns_len; /* scsi sense length */ 699 u8 resid_flags; /* IO residue flags */ 700 u8 rsvd_a; 701 u32 residue; /* IO residual length in bytes */ 702 u32 rsvd_b[3]; 703 }; 704 705 struct bfi_ioim_abort_req_s { 706 struct bfi_mhdr_s mh; /* Common msg header */ 707 u16 io_tag; /* I/O tag */ 708 u16 abort_tag; /* unique request tag */ 709 }; 710 711 /* 712 * Initiator mode task management command interface defines. 713 */ 714 715 enum bfi_tskim_h2i { 716 BFI_TSKIM_H2I_TM_REQ = 1, /* task-mgmt command */ 717 BFI_TSKIM_H2I_ABORT_REQ = 2, /* task-mgmt command */ 718 }; 719 720 enum bfi_tskim_i2h { 721 BFI_TSKIM_I2H_TM_RSP = BFA_I2HM(1), 722 }; 723 724 struct bfi_tskim_req_s { 725 struct bfi_mhdr_s mh; /* Common msg header */ 726 u16 tsk_tag; /* task management tag */ 727 u16 itn_fhdl; /* itn firmware handle */ 728 lun_t lun; /* LU number */ 729 u8 tm_flags; /* see enum fcp_tm_cmnd */ 730 u8 t_secs; /* Timeout value in seconds */ 731 u8 rsvd[2]; 732 }; 733 734 struct bfi_tskim_abortreq_s { 735 struct bfi_mhdr_s mh; /* Common msg header */ 736 u16 tsk_tag; /* task management tag */ 737 u16 rsvd; 738 }; 739 740 enum bfi_tskim_status { 741 /* 742 * Following are FCP-4 spec defined status codes, 743 * **DO NOT CHANGE THEM ** 744 */ 745 BFI_TSKIM_STS_OK = 0, 746 BFI_TSKIM_STS_NOT_SUPP = 4, 747 BFI_TSKIM_STS_FAILED = 5, 748 749 /* 750 * Defined by BFA 751 */ 752 BFI_TSKIM_STS_TIMEOUT = 10, /* TM request timedout */ 753 BFI_TSKIM_STS_ABORTED = 11, /* Aborted on host request */ 754 }; 755 756 struct bfi_tskim_rsp_s { 757 struct bfi_mhdr_s mh; /* Common msg header */ 758 u16 tsk_tag; /* task mgmt cmnd tag */ 759 u8 tsk_status; /* @ref bfi_tskim_status */ 760 u8 rsvd; 761 }; 762 763 #pragma pack() 764 765 #endif /* __BFI_MS_H__ */ 766