1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2003 Silicon Graphics International Corp. 5 * Copyright (c) 2014-2015 Alexander Motin <mav@FreeBSD.org> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions, and the following disclaimer, 13 * without modification. 14 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 15 * substantially similar to the "NO WARRANTY" disclaimer below 16 * ("Disclaimer") and any redistribution must be conditioned upon 17 * including a substantially similar Disclaimer requirement for further 18 * binary redistribution. 19 * 20 * NO WARRANTY 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGES. 32 * 33 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_io.h#5 $ 34 */ 35 /* 36 * CAM Target Layer data movement structures/interface. 37 * 38 * Author: Ken Merry <ken@FreeBSD.org> 39 */ 40 41 #ifndef _CTL_IO_H_ 42 #define _CTL_IO_H_ 43 44 #ifndef _KERNEL 45 #include <stdbool.h> 46 #endif 47 48 #include <sys/queue.h> 49 #include <cam/scsi/scsi_all.h> 50 51 #define CTL_MAX_CDBLEN 32 52 /* 53 * Uncomment this next line to enable printing out times for I/Os 54 * that take longer than CTL_TIME_IO_SECS seconds to get to the datamove 55 * and/or done stage. 56 */ 57 #define CTL_TIME_IO 58 #ifdef CTL_TIME_IO 59 #define CTL_TIME_IO_DEFAULT_SECS 90 60 #endif 61 62 /* 63 * Uncomment this next line to enable the CTL I/O delay feature. You 64 * can delay I/O at two different points -- datamove and done. This is 65 * useful for diagnosing abort conditions (for hosts that send an abort on a 66 * timeout), and for determining how long a host's timeout is. 67 */ 68 //#define CTL_IO_DELAY 69 70 typedef enum { 71 CTL_STATUS_NONE, /* No status */ 72 CTL_SUCCESS, /* Transaction completed successfully */ 73 CTL_CMD_TIMEOUT, /* Command timed out, shouldn't happen here */ 74 CTL_SEL_TIMEOUT, /* Selection timeout, shouldn't happen here */ 75 CTL_ERROR, /* General CTL error XXX expand on this? */ 76 CTL_SCSI_ERROR, /* SCSI error, look at status byte/sense data */ 77 CTL_CMD_ABORTED, /* Command aborted, don't return status */ 78 CTL_STATUS_MASK = 0xfff,/* Mask off any status flags */ 79 CTL_AUTOSENSE = 0x1000 /* Autosense performed */ 80 } ctl_io_status; 81 82 /* 83 * WARNING: Keep the data in/out/none flags where they are. They're used 84 * in conjunction with ctl_cmd_flags. See comment above ctl_cmd_flags 85 * definition in ctl_private.h. 86 */ 87 typedef enum { 88 CTL_FLAG_NONE = 0x00000000, /* no flags */ 89 CTL_FLAG_DATA_IN = 0x00000001, /* DATA IN */ 90 CTL_FLAG_DATA_OUT = 0x00000002, /* DATA OUT */ 91 CTL_FLAG_DATA_NONE = 0x00000003, /* no data */ 92 CTL_FLAG_DATA_MASK = 0x00000003, 93 CTL_FLAG_USER_TAG = 0x00000020, /* userland provides tag */ 94 CTL_FLAG_USER_REQ = 0x00000040, /* request came from userland */ 95 CTL_FLAG_ALLOCATED = 0x00000100, /* data space allocated */ 96 CTL_FLAG_ABORT_STATUS = 0x00000400, /* return TASK ABORTED status */ 97 CTL_FLAG_ABORT = 0x00000800, /* this I/O should be aborted */ 98 CTL_FLAG_DMA_INPROG = 0x00001000, /* DMA in progress */ 99 CTL_FLAG_DELAY_DONE = 0x00004000, /* delay injection done */ 100 CTL_FLAG_INT_COPY = 0x00008000, /* internal copy, no done call*/ 101 CTL_FLAG_SENT_2OTHER_SC = 0x00010000, 102 CTL_FLAG_FROM_OTHER_SC = 0x00020000, 103 CTL_FLAG_IS_WAS_ON_RTR = 0x00040000, /* Don't rerun cmd on failover*/ 104 CTL_FLAG_BUS_ADDR = 0x00080000, /* ctl_sglist contains BUS 105 addresses, not virtual ones*/ 106 CTL_FLAG_IO_CONT = 0x00100000, /* Continue I/O instead of 107 completing */ 108 #if 0 109 CTL_FLAG_ALREADY_DONE = 0x00200000 /* I/O already completed */ 110 #endif 111 CTL_FLAG_NO_DATAMOVE = 0x00400000, 112 CTL_FLAG_DMA_QUEUED = 0x00800000, /* DMA queued but not started*/ 113 CTL_FLAG_STATUS_QUEUED = 0x01000000, /* Status queued but not sent*/ 114 115 CTL_FLAG_FAILOVER = 0x04000000, /* Killed by a failover */ 116 CTL_FLAG_IO_ACTIVE = 0x08000000, /* I/O active on this SC */ 117 CTL_FLAG_STATUS_SENT = 0x10000000, /* Status sent by datamove */ 118 CTL_FLAG_SERSEQ_DONE = 0x20000000 /* All storage I/O started */ 119 } ctl_io_flags; 120 121 struct ctl_lba_len { 122 uint64_t lba; 123 uint32_t len; 124 }; 125 126 struct ctl_lba_len_flags { 127 uint64_t lba; 128 uint32_t len; 129 uint32_t flags; 130 #define CTL_LLF_FUA 0x04000000 131 #define CTL_LLF_DPO 0x08000000 132 #define CTL_LLF_READ 0x10000000 133 #define CTL_LLF_WRITE 0x20000000 134 #define CTL_LLF_VERIFY 0x40000000 135 #define CTL_LLF_COMPARE 0x80000000 136 }; 137 138 struct ctl_ptr_len_flags { 139 uint8_t *ptr; 140 uint32_t len; 141 uint32_t flags; 142 }; 143 144 union ctl_priv { 145 uint8_t bytes[sizeof(uint64_t) * 2]; 146 uint64_t integer; 147 uint64_t integers[2]; 148 void *ptr; 149 void *ptrs[2]; 150 }; 151 152 /* 153 * Number of CTL private areas. 154 */ 155 #define CTL_NUM_PRIV 6 156 157 /* 158 * Which private area are we using for a particular piece of data? 159 */ 160 #define CTL_PRIV_LUN 0 /* CTL LUN pointer goes here */ 161 #define CTL_PRIV_LBA_LEN 1 /* Decoded LBA/len for read/write*/ 162 #define CTL_PRIV_MODEPAGE 1 /* Modepage info for config write */ 163 #define CTL_PRIV_BACKEND 2 /* Reserved for block, RAIDCore */ 164 #define CTL_PRIV_BACKEND_LUN 3 /* Backend LUN pointer */ 165 #define CTL_PRIV_FRONTEND 4 /* Frontend storage */ 166 #define CTL_PRIV_FRONTEND2 5 /* Another frontend storage */ 167 168 #define CTL_LUN(io) ((io)->io_hdr.ctl_private[CTL_PRIV_LUN].ptrs[0]) 169 #define CTL_SOFTC(io) ((io)->io_hdr.ctl_private[CTL_PRIV_LUN].ptrs[1]) 170 #define CTL_BACKEND_LUN(io) ((io)->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptrs[0]) 171 #define CTL_PORT(io) (((struct ctl_softc *)CTL_SOFTC(io))-> \ 172 ctl_ports[(io)->io_hdr.nexus.targ_port]) 173 174 /* 175 * These are used only on Originating SC in XFER mode, where requests don't 176 * ever reach backends, so we can reuse backend's private storage. 177 */ 178 #define CTL_RSGL(io) ((io)->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptrs[0]) 179 #define CTL_LSGL(io) ((io)->io_hdr.ctl_private[CTL_PRIV_BACKEND].ptrs[1]) 180 #define CTL_RSGLT(io) ((struct ctl_sg_entry *)CTL_RSGL(io)) 181 #define CTL_LSGLT(io) ((struct ctl_sg_entry *)CTL_LSGL(io)) 182 183 #define CTL_INVALID_PORTNAME 0xFF 184 #define CTL_UNMAPPED_IID 0xFF 185 186 struct ctl_sg_entry { 187 void *addr; 188 size_t len; 189 }; 190 191 typedef enum { 192 CTL_IO_NONE, 193 CTL_IO_SCSI, 194 CTL_IO_TASK, 195 } ctl_io_type; 196 197 struct ctl_nexus { 198 uint32_t initid; /* Initiator ID */ 199 uint32_t targ_port; /* Target port, filled in by PORT */ 200 uint32_t targ_lun; /* Destination lun */ 201 uint32_t targ_mapped_lun; /* Destination lun CTL-wide */ 202 }; 203 204 typedef enum { 205 CTL_MSG_SERIALIZE, 206 CTL_MSG_R2R, 207 CTL_MSG_FINISH_IO, 208 CTL_MSG_BAD_JUJU, 209 CTL_MSG_MANAGE_TASKS, 210 CTL_MSG_PERS_ACTION, 211 CTL_MSG_DATAMOVE, 212 CTL_MSG_DATAMOVE_DONE, 213 CTL_MSG_UA, /* Set/clear UA on secondary. */ 214 CTL_MSG_PORT_SYNC, /* Information about port. */ 215 CTL_MSG_LUN_SYNC, /* Information about LUN. */ 216 CTL_MSG_IID_SYNC, /* Information about initiator. */ 217 CTL_MSG_LOGIN, /* Information about HA peer. */ 218 CTL_MSG_MODE_SYNC, /* Mode page current content. */ 219 CTL_MSG_FAILOVER /* Fake, never sent though the wire */ 220 } ctl_msg_type; 221 222 struct ctl_scsiio; 223 224 struct ctl_io_hdr { 225 uint32_t version; /* interface version XXX */ 226 ctl_io_type io_type; /* task I/O, SCSI I/O, etc. */ 227 ctl_msg_type msg_type; 228 struct ctl_nexus nexus; /* Initiator, port, target, lun */ 229 uint32_t iid_indx; /* the index into the iid mapping */ 230 uint32_t flags; /* transaction flags */ 231 uint32_t status; /* transaction status */ 232 uint32_t port_status; /* trans status, set by PORT, 0 = good*/ 233 uint32_t timeout; /* timeout in ms */ 234 uint32_t retries; /* retry count */ 235 #ifdef CTL_IO_DELAY 236 struct callout delay_callout; 237 #endif /* CTL_IO_DELAY */ 238 #ifdef CTL_TIME_IO 239 time_t start_time; /* I/O start time */ 240 struct bintime start_bt; /* Timer start ticks */ 241 struct bintime dma_start_bt; /* DMA start ticks */ 242 struct bintime dma_bt; /* DMA total ticks */ 243 #endif /* CTL_TIME_IO */ 244 uint32_t num_dmas; /* Number of DMAs */ 245 union ctl_io *remote_io; /* I/O counterpart on remote HA side */ 246 union ctl_io *blocker; /* I/O blocking this one */ 247 void *pool; /* I/O pool */ 248 union ctl_priv ctl_private[CTL_NUM_PRIV];/* CTL private area */ 249 TAILQ_HEAD(, ctl_io_hdr) blocked_queue; /* I/Os blocked by this one */ 250 STAILQ_ENTRY(ctl_io_hdr) links; /* linked list pointer */ 251 LIST_ENTRY(ctl_io_hdr) ooa_links; /* ooa_queue links */ 252 TAILQ_ENTRY(ctl_io_hdr) blocked_links; /* blocked_queue links */ 253 }; 254 255 typedef enum { 256 CTL_TAG_UNTAGGED, 257 CTL_TAG_SIMPLE, 258 CTL_TAG_ORDERED, 259 CTL_TAG_HEAD_OF_QUEUE, 260 CTL_TAG_ACA 261 } ctl_tag_type; 262 263 union ctl_io; 264 265 typedef void (*ctl_ref)(void *arg, int diff); 266 267 /* 268 * SCSI passthrough I/O structure for the CAM Target Layer. Note 269 * that some of these fields are here for completeness, but they aren't 270 * used in the CTL implementation. e.g., timeout and retries won't be 271 * used. 272 * 273 * Note: Make sure the io_hdr is *always* the first element in this 274 * structure. 275 */ 276 struct ctl_scsiio { 277 struct ctl_io_hdr io_hdr; /* common to all I/O types */ 278 279 /* 280 * The ext_* fields are generally intended for frontend use; CTL itself 281 * doesn't modify or use them. 282 */ 283 uint32_t ext_sg_entries; /* 0 = no S/G list, > 0 = num entries */ 284 uint8_t *ext_data_ptr; /* data buffer or S/G list */ 285 uint32_t ext_data_len; /* Data transfer length */ 286 uint32_t ext_data_filled; /* Amount of data filled so far */ 287 288 /* 289 * The number of scatter/gather entries in the list pointed to 290 * by kern_data_ptr. 0 means there is no list, just a data pointer. 291 */ 292 uint32_t kern_sg_entries; 293 294 uint32_t rem_sg_entries; /* Unused. */ 295 296 /* 297 * The data pointer or a pointer to the scatter/gather list. 298 */ 299 uint8_t *kern_data_ptr; 300 301 /* 302 * Length of the data buffer or scatter/gather list. It's also 303 * the length of this particular piece of the data transfer, 304 * ie. number of bytes expected to be transferred by the current 305 * invocation of frontend's datamove() callback. It's always 306 * less than or equal to kern_total_len. 307 */ 308 uint32_t kern_data_len; 309 310 /* 311 * Total length of data to be transferred during this particular 312 * SCSI command, as decoded from SCSI CDB. 313 */ 314 uint32_t kern_total_len; 315 316 /* 317 * Amount of data left after the current data transfer. 318 */ 319 uint32_t kern_data_resid; 320 321 /* 322 * Byte offset of this transfer, equal to the amount of data 323 * already transferred for this SCSI command during previous 324 * datamove() invocations. 325 */ 326 uint32_t kern_rel_offset; 327 328 struct scsi_sense_data sense_data; /* sense data */ 329 uint8_t sense_len; /* Returned sense length */ 330 uint8_t scsi_status; /* SCSI status byte */ 331 uint8_t seridx; /* Serialization index. */ 332 uint8_t priority; /* Command priority */ 333 uint64_t tag_num; /* tag number */ 334 ctl_tag_type tag_type; /* simple, ordered, head of queue,etc.*/ 335 uint8_t cdb_len; /* CDB length */ 336 uint8_t cdb[CTL_MAX_CDBLEN]; /* CDB */ 337 int (*be_move_done)(union ctl_io *io, bool samethr); /* called by fe */ 338 int (*io_cont)(union ctl_io *io); /* to continue processing */ 339 ctl_ref kern_data_ref; /* Method to reference/release data */ 340 void *kern_data_arg; /* Opaque argument for kern_data_ref() */ 341 }; 342 343 typedef enum { 344 CTL_TASK_ABORT_TASK, 345 CTL_TASK_ABORT_TASK_SET, 346 CTL_TASK_CLEAR_ACA, 347 CTL_TASK_CLEAR_TASK_SET, 348 CTL_TASK_I_T_NEXUS_RESET, 349 CTL_TASK_LUN_RESET, 350 CTL_TASK_TARGET_RESET, 351 CTL_TASK_BUS_RESET, 352 CTL_TASK_PORT_LOGIN, 353 CTL_TASK_PORT_LOGOUT, 354 CTL_TASK_QUERY_TASK, 355 CTL_TASK_QUERY_TASK_SET, 356 CTL_TASK_QUERY_ASYNC_EVENT 357 } ctl_task_type; 358 359 typedef enum { 360 CTL_TASK_FUNCTION_COMPLETE, 361 CTL_TASK_FUNCTION_SUCCEEDED, 362 CTL_TASK_FUNCTION_REJECTED, 363 CTL_TASK_LUN_DOES_NOT_EXIST, 364 CTL_TASK_FUNCTION_NOT_SUPPORTED 365 } ctl_task_status; 366 367 /* 368 * Task management I/O structure. Aborts, bus resets, etc., are sent using 369 * this structure. 370 * 371 * Note: Make sure the io_hdr is *always* the first element in this 372 * structure. 373 */ 374 struct ctl_taskio { 375 struct ctl_io_hdr io_hdr; /* common to all I/O types */ 376 ctl_task_type task_action; /* Target Reset, Abort, etc. */ 377 uint64_t tag_num; /* tag number */ 378 ctl_tag_type tag_type; /* simple, ordered, etc. */ 379 uint8_t task_status; /* Complete, Succeeded, etc. */ 380 uint8_t task_resp[3];/* Response information */ 381 }; 382 383 /* 384 * HA link messages. 385 */ 386 #define CTL_HA_VERSION 4 387 388 /* 389 * Used for CTL_MSG_LOGIN. 390 */ 391 struct ctl_ha_msg_login { 392 ctl_msg_type msg_type; 393 int version; 394 int ha_mode; 395 int ha_id; 396 int max_luns; 397 int max_ports; 398 int max_init_per_port; 399 }; 400 401 typedef enum { 402 CTL_PR_REG_KEY, 403 CTL_PR_UNREG_KEY, 404 CTL_PR_PREEMPT, 405 CTL_PR_CLEAR, 406 CTL_PR_RESERVE, 407 CTL_PR_RELEASE 408 } ctl_pr_action; 409 410 /* 411 * The PR info is specifically for sending Persistent Reserve actions 412 * to the other SC which it must also act on. 413 * 414 * Note: Make sure the io_hdr is *always* the first element in this 415 * structure. 416 */ 417 struct ctl_pr_info { 418 ctl_pr_action action; 419 uint8_t sa_res_key[8]; 420 uint8_t res_type; 421 uint32_t residx; 422 }; 423 424 struct ctl_ha_msg_hdr { 425 ctl_msg_type msg_type; 426 uint32_t status; /* transaction status */ 427 union ctl_io *original_sc; 428 union ctl_io *serializing_sc; 429 struct ctl_nexus nexus; /* Initiator, port, target, lun */ 430 }; 431 432 #define CTL_HA_MAX_SG_ENTRIES 16 433 #define CTL_HA_DATAMOVE_SEGMENT 131072 434 435 /* 436 * Used for CTL_MSG_PERS_ACTION. 437 */ 438 struct ctl_ha_msg_pr { 439 struct ctl_ha_msg_hdr hdr; 440 struct ctl_pr_info pr_info; 441 }; 442 443 /* 444 * Used for CTL_MSG_UA. 445 */ 446 struct ctl_ha_msg_ua { 447 struct ctl_ha_msg_hdr hdr; 448 int ua_all; 449 int ua_set; 450 int ua_type; 451 uint8_t ua_info[8]; 452 }; 453 454 /* 455 * The S/G handling here is a little different than the standard ctl_scsiio 456 * structure, because we can't pass data by reference in between controllers. 457 * The S/G list in the ctl_scsiio struct is normally passed in the 458 * kern_data_ptr field. So kern_sg_entries here will always be non-zero, 459 * even if there is only one entry. 460 * 461 * Used for CTL_MSG_DATAMOVE. 462 */ 463 struct ctl_ha_msg_dt { 464 struct ctl_ha_msg_hdr hdr; 465 ctl_io_flags flags; /* Only I/O flags are used here */ 466 uint32_t sg_sequence; /* S/G portion number */ 467 uint8_t sg_last; /* last S/G batch = 1 */ 468 uint32_t sent_sg_entries; /* previous S/G count */ 469 uint32_t cur_sg_entries; /* current S/G entries */ 470 uint32_t kern_sg_entries; /* total S/G entries */ 471 uint32_t kern_data_len; /* Length of this S/G list */ 472 uint32_t kern_total_len; /* Total length of this 473 transaction */ 474 uint32_t kern_data_resid; /* Length left to transfer 475 after this*/ 476 uint32_t kern_rel_offset; /* Byte Offset of this 477 transfer */ 478 struct ctl_sg_entry sg_list[CTL_HA_MAX_SG_ENTRIES]; 479 }; 480 481 /* 482 * Used for CTL_MSG_SERIALIZE, CTL_MSG_FINISH_IO, CTL_MSG_BAD_JUJU, 483 * and CTL_MSG_DATAMOVE_DONE. 484 */ 485 struct ctl_ha_msg_scsi { 486 struct ctl_ha_msg_hdr hdr; 487 uint64_t tag_num; /* tag number */ 488 ctl_tag_type tag_type; /* simple, ordered, etc. */ 489 uint8_t cdb[CTL_MAX_CDBLEN]; /* CDB */ 490 uint8_t cdb_len; /* CDB length */ 491 uint8_t scsi_status; /* SCSI status byte */ 492 uint8_t sense_len; /* Returned sense length */ 493 uint8_t priority; /* Command priority */ 494 uint32_t port_status; /* trans status, set by FETD, 495 0 = good*/ 496 uint32_t kern_data_resid; /* for DATAMOVE_DONE */ 497 struct scsi_sense_data sense_data; /* sense data */ 498 }; 499 500 /* 501 * Used for CTL_MSG_MANAGE_TASKS. 502 */ 503 struct ctl_ha_msg_task { 504 struct ctl_ha_msg_hdr hdr; 505 ctl_task_type task_action; /* Target Reset, Abort, etc. */ 506 uint64_t tag_num; /* tag number */ 507 ctl_tag_type tag_type; /* simple, ordered, etc. */ 508 }; 509 510 /* 511 * Used for CTL_MSG_PORT_SYNC. 512 */ 513 struct ctl_ha_msg_port { 514 struct ctl_ha_msg_hdr hdr; 515 int port_type; 516 int physical_port; 517 int virtual_port; 518 int status; 519 int name_len; 520 int lun_map_len; 521 int port_devid_len; 522 int target_devid_len; 523 int init_devid_len; 524 uint8_t data[]; 525 }; 526 527 /* 528 * Used for CTL_MSG_LUN_SYNC. 529 */ 530 struct ctl_ha_msg_lun { 531 struct ctl_ha_msg_hdr hdr; 532 int flags; 533 unsigned int pr_generation; 534 uint32_t pr_res_idx; 535 uint8_t pr_res_type; 536 int lun_devid_len; 537 int pr_key_count; 538 uint8_t data[]; 539 }; 540 541 struct ctl_ha_msg_lun_pr_key { 542 uint32_t pr_iid; 543 uint64_t pr_key; 544 }; 545 546 /* 547 * Used for CTL_MSG_IID_SYNC. 548 */ 549 struct ctl_ha_msg_iid { 550 struct ctl_ha_msg_hdr hdr; 551 int in_use; 552 int name_len; 553 uint64_t wwpn; 554 uint8_t data[]; 555 }; 556 557 /* 558 * Used for CTL_MSG_MODE_SYNC. 559 */ 560 struct ctl_ha_msg_mode { 561 struct ctl_ha_msg_hdr hdr; 562 uint8_t page_code; 563 uint8_t subpage; 564 uint16_t page_len; 565 uint8_t data[]; 566 }; 567 568 union ctl_ha_msg { 569 struct ctl_ha_msg_hdr hdr; 570 struct ctl_ha_msg_task task; 571 struct ctl_ha_msg_scsi scsi; 572 struct ctl_ha_msg_dt dt; 573 struct ctl_ha_msg_pr pr; 574 struct ctl_ha_msg_ua ua; 575 struct ctl_ha_msg_port port; 576 struct ctl_ha_msg_lun lun; 577 struct ctl_ha_msg_iid iid; 578 struct ctl_ha_msg_login login; 579 struct ctl_ha_msg_mode mode; 580 }; 581 582 struct ctl_prio { 583 struct ctl_io_hdr io_hdr; 584 struct ctl_ha_msg_pr pr_msg; 585 }; 586 587 union ctl_io { 588 struct ctl_io_hdr io_hdr; /* common to all I/O types */ 589 struct ctl_scsiio scsiio; /* Normal SCSI commands */ 590 struct ctl_taskio taskio; /* SCSI task management/reset */ 591 struct ctl_prio presio; /* update per. res info on other SC */ 592 }; 593 594 #ifdef _KERNEL 595 596 union ctl_io *ctl_alloc_io(void *pool_ref); 597 union ctl_io *ctl_alloc_io_nowait(void *pool_ref); 598 void ctl_free_io(union ctl_io *io); 599 void ctl_zero_io(union ctl_io *io); 600 601 #endif /* _KERNEL */ 602 603 #endif /* _CTL_IO_H_ */ 604 605 /* 606 * vim: ts=8 607 */ 608