ctl_ioctl.h revision 265507
1/*- 2 * Copyright (c) 2003 Silicon Graphics International Corp. 3 * Copyright (c) 2011 Spectra Logic Corporation 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions, and the following disclaimer, 11 * without modification. 12 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 13 * substantially similar to the "NO WARRANTY" disclaimer below 14 * ("Disclaimer") and any redistribution must be conditioned upon 15 * including a substantially similar Disclaimer requirement for further 16 * binary redistribution. 17 * 18 * NO WARRANTY 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 23 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 28 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGES. 30 * 31 * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_ioctl.h#4 $ 32 * $FreeBSD: stable/10/sys/cam/ctl/ctl_ioctl.h 265507 2014-05-07 07:29:39Z trasz $ 33 */ 34/* 35 * CAM Target Layer ioctl interface. 36 * 37 * Author: Ken Merry <ken@FreeBSD.org> 38 */ 39 40#ifndef _CTL_IOCTL_H_ 41#define _CTL_IOCTL_H_ 42 43#ifdef ICL_KERNEL_PROXY 44#include <sys/socket.h> 45#endif 46 47#include <sys/ioccom.h> 48 49#define CTL_DEFAULT_DEV "/dev/cam/ctl" 50/* 51 * Maximum number of targets we support. 52 */ 53#define CTL_MAX_TARGETS 1 54 55/* 56 * Maximum target ID we support. 57 */ 58#define CTL_MAX_TARGID 15 59 60/* 61 * Maximum number of LUNs we support at the moment. MUST be a power of 2. 62 */ 63#define CTL_MAX_LUNS 256 64 65/* 66 * Maximum number of initiators per port. 67 */ 68#define CTL_MAX_INIT_PER_PORT 2048 // Was 16 69 70/* 71 * Maximum number of ports registered at one time. 72 */ 73#define CTL_MAX_PORTS 32 74 75/* 76 * Maximum number of initiators we support. 77 */ 78#define CTL_MAX_INITIATORS (CTL_MAX_INIT_PER_PORT * CTL_MAX_PORTS) 79 80/* Hopefully this won't conflict with new misc devices that pop up */ 81#define CTL_MINOR 225 82 83typedef enum { 84 CTL_OOA_INVALID_LUN, 85 CTL_OOA_SUCCESS 86} ctl_ooa_status; 87 88struct ctl_ooa_info { 89 uint32_t target_id; /* Passed in to CTL */ 90 uint32_t lun_id; /* Passed in to CTL */ 91 uint32_t num_entries; /* Returned from CTL */ 92 ctl_ooa_status status; /* Returned from CTL */ 93}; 94 95struct ctl_hard_startstop_info { 96 cfi_mt_status status; 97 int total_luns; 98 int luns_complete; 99 int luns_failed; 100}; 101 102struct ctl_bbrread_info { 103 int lun_num; /* Passed in to CTL */ 104 uint64_t lba; /* Passed in to CTL */ 105 int len; /* Passed in to CTL */ 106 cfi_mt_status status; /* Returned from CTL */ 107 cfi_bbrread_status bbr_status; /* Returned from CTL */ 108 uint8_t scsi_status; /* Returned from CTL */ 109 struct scsi_sense_data sense_data; /* Returned from CTL */ 110}; 111 112typedef enum { 113 CTL_DELAY_TYPE_NONE, 114 CTL_DELAY_TYPE_CONT, 115 CTL_DELAY_TYPE_ONESHOT 116} ctl_delay_type; 117 118typedef enum { 119 CTL_DELAY_LOC_NONE, 120 CTL_DELAY_LOC_DATAMOVE, 121 CTL_DELAY_LOC_DONE, 122} ctl_delay_location; 123 124typedef enum { 125 CTL_DELAY_STATUS_NONE, 126 CTL_DELAY_STATUS_OK, 127 CTL_DELAY_STATUS_INVALID_LUN, 128 CTL_DELAY_STATUS_INVALID_TYPE, 129 CTL_DELAY_STATUS_INVALID_LOC, 130 CTL_DELAY_STATUS_NOT_IMPLEMENTED 131} ctl_delay_status; 132 133struct ctl_io_delay_info { 134 uint32_t target_id; 135 uint32_t lun_id; 136 ctl_delay_type delay_type; 137 ctl_delay_location delay_loc; 138 uint32_t delay_secs; 139 ctl_delay_status status; 140}; 141 142typedef enum { 143 CTL_GS_SYNC_NONE, 144 CTL_GS_SYNC_OK, 145 CTL_GS_SYNC_NO_LUN 146} ctl_gs_sync_status; 147 148/* 149 * The target and LUN id specify which device to modify. The sync interval 150 * means that we will let through every N SYNCHRONIZE CACHE commands. 151 */ 152struct ctl_sync_info { 153 uint32_t target_id; /* passed to kernel */ 154 uint32_t lun_id; /* passed to kernel */ 155 int sync_interval; /* depends on whether get/set */ 156 ctl_gs_sync_status status; /* passed from kernel */ 157}; 158 159typedef enum { 160 CTL_STATS_NO_IO, 161 CTL_STATS_READ, 162 CTL_STATS_WRITE 163} ctl_stat_types; 164#define CTL_STATS_NUM_TYPES 3 165 166typedef enum { 167 CTL_LUN_STATS_NO_BLOCKSIZE = 0x01 168} ctl_lun_stats_flags; 169 170struct ctl_lun_io_port_stats { 171 uint32_t targ_port; 172 uint64_t bytes[CTL_STATS_NUM_TYPES]; 173 uint64_t operations[CTL_STATS_NUM_TYPES]; 174 struct bintime time[CTL_STATS_NUM_TYPES]; 175 uint64_t num_dmas[CTL_STATS_NUM_TYPES]; 176 struct bintime dma_time[CTL_STATS_NUM_TYPES]; 177}; 178 179struct ctl_lun_io_stats { 180 uint8_t device_type; 181 uint64_t lun_number; 182 uint32_t blocksize; 183 ctl_lun_stats_flags flags; 184 struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; 185}; 186 187typedef enum { 188 CTL_SS_OK, 189 CTL_SS_NEED_MORE_SPACE, 190 CTL_SS_ERROR 191} ctl_stats_status; 192 193typedef enum { 194 CTL_STATS_FLAG_NONE = 0x00, 195 CTL_STATS_FLAG_TIME_VALID = 0x01 196} ctl_stats_flags; 197 198struct ctl_stats { 199 int alloc_len; /* passed to kernel */ 200 struct ctl_lun_io_stats *lun_stats; /* passed to/from kernel */ 201 int fill_len; /* passed to userland */ 202 int num_luns; /* passed to userland */ 203 ctl_stats_status status; /* passed to userland */ 204 ctl_stats_flags flags; /* passed to userland */ 205 struct timespec timestamp; /* passed to userland */ 206}; 207 208/* 209 * The types of errors that can be injected: 210 * 211 * NONE: No error specified. 212 * ABORTED: SSD_KEY_ABORTED_COMMAND, 0x45, 0x00 213 * MEDIUM_ERR: Medium error, different asc/ascq depending on read/write. 214 * UA: Unit attention. 215 * CUSTOM: User specifies the sense data. 216 * TYPE: Mask to use with error types. 217 * 218 * Flags that affect injection behavior: 219 * CONTINUOUS: This error will stay around until explicitly cleared. 220 * DESCRIPTOR: Use descriptor sense instead of fixed sense. 221 */ 222typedef enum { 223 CTL_LUN_INJ_NONE = 0x000, 224 CTL_LUN_INJ_ABORTED = 0x001, 225 CTL_LUN_INJ_MEDIUM_ERR = 0x002, 226 CTL_LUN_INJ_UA = 0x003, 227 CTL_LUN_INJ_CUSTOM = 0x004, 228 CTL_LUN_INJ_TYPE = 0x0ff, 229 CTL_LUN_INJ_CONTINUOUS = 0x100, 230 CTL_LUN_INJ_DESCRIPTOR = 0x200 231} ctl_lun_error; 232 233/* 234 * Flags to specify what type of command the given error pattern will 235 * execute on. The first group of types can be ORed together. 236 * 237 * READ: Any read command. 238 * WRITE: Any write command. 239 * READWRITE: Any read or write command. 240 * READCAP: Any read capacity command. 241 * TUR: Test Unit Ready. 242 * ANY: Any command. 243 * MASK: Mask for basic command patterns. 244 * 245 * Special types: 246 * 247 * CMD: The CDB to act on is specified in struct ctl_error_desc_cmd. 248 * RANGE: For read/write commands, act when the LBA is in the 249 * specified range. 250 */ 251typedef enum { 252 CTL_LUN_PAT_NONE = 0x000, 253 CTL_LUN_PAT_READ = 0x001, 254 CTL_LUN_PAT_WRITE = 0x002, 255 CTL_LUN_PAT_READWRITE = CTL_LUN_PAT_READ | CTL_LUN_PAT_WRITE, 256 CTL_LUN_PAT_READCAP = 0x004, 257 CTL_LUN_PAT_TUR = 0x008, 258 CTL_LUN_PAT_ANY = 0x0ff, 259 CTL_LUN_PAT_MASK = 0x0ff, 260 CTL_LUN_PAT_CMD = 0x100, 261 CTL_LUN_PAT_RANGE = 0x200 262} ctl_lun_error_pattern; 263 264/* 265 * This structure allows the user to specify a particular CDB pattern to 266 * look for. 267 * 268 * cdb_pattern: Fill in the relevant bytes to look for in the CDB. 269 * cdb_valid_bytes: Bitmask specifying valid bytes in the cdb_pattern. 270 * flags: Specify any command flags (see ctl_io_flags) that 271 * should be set. 272 */ 273struct ctl_error_desc_cmd { 274 uint8_t cdb_pattern[CTL_MAX_CDBLEN]; 275 uint32_t cdb_valid_bytes; 276 uint32_t flags; 277}; 278 279/* 280 * Error injection descriptor. 281 * 282 * target_id: Target ID to act on. 283 * lun_id LUN to act on. 284 * lun_error: The type of error to inject. See above for descriptions. 285 * error_pattern: What kind of command to act on. See above. 286 * cmd_desc: For CTL_LUN_PAT_CMD only. 287 * lba_range: For CTL_LUN_PAT_RANGE only. 288 * custom_sense: Specify sense. For CTL_LUN_INJ_CUSTOM only. 289 * serial: Serial number returned by the kernel. Use for deletion. 290 * links: Kernel use only. 291 */ 292struct ctl_error_desc { 293 uint32_t target_id; /* To kernel */ 294 uint32_t lun_id; /* To kernel */ 295 ctl_lun_error lun_error; /* To kernel */ 296 ctl_lun_error_pattern error_pattern; /* To kernel */ 297 struct ctl_error_desc_cmd cmd_desc; /* To kernel */ 298 struct ctl_lba_len lba_range; /* To kernel */ 299 struct scsi_sense_data custom_sense; /* To kernel */ 300 uint64_t serial; /* From kernel */ 301 STAILQ_ENTRY(ctl_error_desc) links; /* Kernel use only */ 302}; 303 304typedef enum { 305 CTL_OOA_FLAG_NONE = 0x00, 306 CTL_OOA_FLAG_ALL_LUNS = 0x01 307} ctl_ooa_flags; 308 309typedef enum { 310 CTL_OOA_OK, 311 CTL_OOA_NEED_MORE_SPACE, 312 CTL_OOA_ERROR 313} ctl_get_ooa_status; 314 315typedef enum { 316 CTL_OOACMD_FLAG_NONE = 0x00, 317 CTL_OOACMD_FLAG_DMA = 0x01, 318 CTL_OOACMD_FLAG_BLOCKED = 0x02, 319 CTL_OOACMD_FLAG_ABORT = 0x04, 320 CTL_OOACMD_FLAG_RTR = 0x08, 321 CTL_OOACMD_FLAG_DMA_QUEUED = 0x10 322} ctl_ooa_cmd_flags; 323 324struct ctl_ooa_entry { 325 ctl_ooa_cmd_flags cmd_flags; 326 uint8_t cdb[CTL_MAX_CDBLEN]; 327 uint8_t cdb_len; 328 uint32_t tag_num; 329 uint32_t lun_num; 330 struct bintime start_bt; 331}; 332 333struct ctl_ooa { 334 ctl_ooa_flags flags; /* passed to kernel */ 335 uint64_t lun_num; /* passed to kernel */ 336 uint32_t alloc_len; /* passed to kernel */ 337 uint32_t alloc_num; /* passed to kernel */ 338 struct ctl_ooa_entry *entries; /* filled in kernel */ 339 uint32_t fill_len; /* passed to userland */ 340 uint32_t fill_num; /* passed to userland */ 341 uint32_t dropped_num; /* passed to userland */ 342 struct bintime cur_bt; /* passed to userland */ 343 ctl_get_ooa_status status; /* passed to userland */ 344}; 345 346typedef enum { 347 CTL_PORT_LIST_NONE, 348 CTL_PORT_LIST_OK, 349 CTL_PORT_LIST_NEED_MORE_SPACE, 350 CTL_PORT_LIST_ERROR 351} ctl_port_list_status; 352 353struct ctl_port_list { 354 uint32_t alloc_len; /* passed to kernel */ 355 uint32_t alloc_num; /* passed to kernel */ 356 struct ctl_port_entry *entries; /* filled in kernel */ 357 uint32_t fill_len; /* passed to userland */ 358 uint32_t fill_num; /* passed to userland */ 359 uint32_t dropped_num; /* passed to userland */ 360 ctl_port_list_status status; /* passed to userland */ 361}; 362 363typedef enum { 364 CTL_LUN_NOSTATUS, 365 CTL_LUN_OK, 366 CTL_LUN_ERROR 367} ctl_lun_status; 368 369#define CTL_ERROR_STR_LEN 160 370 371#define CTL_BEARG_RD 0x01 372#define CTL_BEARG_WR 0x02 373#define CTL_BEARG_RW (CTL_BEARG_RD|CTL_BEARG_WR) 374#define CTL_BEARG_ASCII 0x04 375 376/* 377 * Backend Argument: 378 * 379 * namelen: Length of the name field, including the terminating NUL. 380 * 381 * name: Name of the paramter. This must be NUL-terminated. 382 * 383 * flags: Flags for the parameter, see above for values. 384 * 385 * vallen: Length of the value in bytes. 386 * 387 * value: Value to be set/fetched. 388 * 389 * kname: For kernel use only. 390 * 391 * kvalue: For kernel use only. 392 */ 393struct ctl_be_arg { 394 int namelen; 395 char *name; 396 int flags; 397 int vallen; 398 void *value; 399 400 char *kname; 401 void *kvalue; 402}; 403 404typedef enum { 405 CTL_LUNREQ_CREATE, 406 CTL_LUNREQ_RM, 407 CTL_LUNREQ_MODIFY, 408} ctl_lunreq_type; 409 410 411/* 412 * LUN creation parameters: 413 * 414 * flags: Various LUN flags, see ctl_backend.h for a 415 * description of the flag values and meanings. 416 * 417 * device_type: The SCSI device type. e.g. 0 for Direct Access, 418 * 3 for Processor, etc. Only certain backends may 419 * support setting this field. The CTL_LUN_FLAG_DEV_TYPE 420 * flag should be set in the flags field if the device 421 * type is set. 422 * 423 * lun_size_bytes: The size of the LUN in bytes. For some backends 424 * this is relevant (e.g. ramdisk), for others, it may 425 * be ignored in favor of using the properties of the 426 * backing store. If specified, this should be a 427 * multiple of the blocksize. 428 * 429 * The actual size of the LUN is returned in this 430 * field. 431 * 432 * blocksize_bytes: The LUN blocksize in bytes. For some backends this 433 * is relevant, for others it may be ignored in 434 * favor of using the properties of the backing store. 435 * 436 * The actual blocksize of the LUN is returned in this 437 * field. 438 * 439 * req_lun_id: The requested LUN ID. The CTL_LUN_FLAG_ID_REQ flag 440 * should be set if this is set. The request will be 441 * granted if the LUN number is available, otherwise 442 * the LUN addition request will fail. 443 * 444 * The allocated LUN number is returned in this field. 445 * 446 * serial_num: This is the value returned in SCSI INQUIRY VPD page 447 * 0x80. If it is specified, the CTL_LUN_FLAG_SERIAL_NUM 448 * flag should be set. 449 * 450 * The serial number value used is returned in this 451 * field. 452 * 453 * device_id: This is the value returned in the T10 vendor ID 454 * based DESIGNATOR field in the SCSI INQUIRY VPD page 455 * 0x83 data. If it is specified, the CTL_LUN_FLAG_DEVID 456 * flag should be set. 457 * 458 * The device id value used is returned in this field. 459 */ 460struct ctl_lun_create_params { 461 ctl_backend_lun_flags flags; 462 uint8_t device_type; 463 uint64_t lun_size_bytes; 464 uint32_t blocksize_bytes; 465 uint32_t req_lun_id; 466 uint8_t serial_num[CTL_SN_LEN]; 467 uint8_t device_id[CTL_DEVID_LEN]; 468}; 469 470/* 471 * LUN removal parameters: 472 * 473 * lun_id: The number of the LUN to delete. This must be set. 474 * The LUN must be backed by the given backend. 475 */ 476struct ctl_lun_rm_params { 477 uint32_t lun_id; 478}; 479 480/* 481 * LUN modification parameters: 482 * 483 * lun_id: The number of the LUN to modify. This must be set. 484 * The LUN must be backed by the given backend. 485 * 486 * lun_size_bytes: The size of the LUN in bytes. If zero, update 487 * the size using the backing file size, if possible. 488 */ 489struct ctl_lun_modify_params { 490 uint32_t lun_id; 491 uint64_t lun_size_bytes; 492}; 493 494/* 495 * Union of request type data. Fill in the appropriate union member for 496 * the request type. 497 */ 498union ctl_lunreq_data { 499 struct ctl_lun_create_params create; 500 struct ctl_lun_rm_params rm; 501 struct ctl_lun_modify_params modify; 502}; 503 504/* 505 * LUN request interface: 506 * 507 * backend: This is required, and is NUL-terminated a string 508 * that is the name of the backend, like "ramdisk" or 509 * "block". 510 * 511 * reqtype: The type of request, CTL_LUNREQ_CREATE to create a 512 * LUN, CTL_LUNREQ_RM to delete a LUN. 513 * 514 * reqdata: Request type-specific information. See the 515 * description of individual the union members above 516 * for more information. 517 * 518 * num_be_args: This is the number of backend-specific arguments 519 * in the be_args array. 520 * 521 * be_args: This is an array of backend-specific arguments. 522 * See above for a description of the fields in this 523 * structure. 524 * 525 * status: Status of the LUN request. 526 * 527 * error_str: If the status is CTL_LUN_ERROR, this will 528 * contain a string describing the error. 529 * 530 * kern_be_args: For kernel use only. 531 */ 532struct ctl_lun_req { 533 char backend[CTL_BE_NAME_LEN]; 534 ctl_lunreq_type reqtype; 535 union ctl_lunreq_data reqdata; 536 int num_be_args; 537 struct ctl_be_arg *be_args; 538 ctl_lun_status status; 539 char error_str[CTL_ERROR_STR_LEN]; 540 struct ctl_be_arg *kern_be_args; 541}; 542 543/* 544 * LUN list status: 545 * 546 * NONE: No status. 547 * 548 * OK: Request completed successfully. 549 * 550 * NEED_MORE_SPACE: The allocated length of the entries field is too 551 * small for the available data. 552 * 553 * ERROR: An error occured, look at the error string for a 554 * description of the error. 555 */ 556typedef enum { 557 CTL_LUN_LIST_NONE, 558 CTL_LUN_LIST_OK, 559 CTL_LUN_LIST_NEED_MORE_SPACE, 560 CTL_LUN_LIST_ERROR 561} ctl_lun_list_status; 562 563/* 564 * LUN list interface 565 * 566 * backend_name: This is a NUL-terminated string. If the string 567 * length is 0, then all LUNs on all backends will 568 * be enumerated. Otherwise this is the name of the 569 * backend to be enumerated, like "ramdisk" or "block". 570 * 571 * alloc_len: The length of the data buffer allocated for entries. 572 * In order to properly size the buffer, make one call 573 * with alloc_len set to 0, and then use the returned 574 * dropped_len as the buffer length to allocate and 575 * pass in on a subsequent call. 576 * 577 * lun_xml: XML-formatted information on the requested LUNs. 578 * 579 * fill_len: The amount of data filled in the storage for entries. 580 * 581 * status: The status of the request. See above for the 582 * description of the values of this field. 583 * 584 * error_str: If the status indicates an error, this string will 585 * be filled in to describe the error. 586 */ 587struct ctl_lun_list { 588 char backend[CTL_BE_NAME_LEN]; /* passed to kernel*/ 589 uint32_t alloc_len; /* passed to kernel */ 590 char *lun_xml; /* filled in kernel */ 591 uint32_t fill_len; /* passed to userland */ 592 ctl_lun_list_status status; /* passed to userland */ 593 char error_str[CTL_ERROR_STR_LEN]; 594 /* passed to userland */ 595}; 596 597/* 598 * iSCSI status 599 * 600 * OK: Request completed successfully. 601 * 602 * ERROR: An error occured, look at the error string for a 603 * description of the error. 604 * 605 * CTL_ISCSI_LIST_NEED_MORE_SPACE: 606 * User has to pass larger buffer for CTL_ISCSI_LIST ioctl. 607 */ 608typedef enum { 609 CTL_ISCSI_OK, 610 CTL_ISCSI_ERROR, 611 CTL_ISCSI_LIST_NEED_MORE_SPACE, 612 CTL_ISCSI_SESSION_NOT_FOUND 613} ctl_iscsi_status; 614 615typedef enum { 616 CTL_ISCSI_HANDOFF, 617 CTL_ISCSI_LIST, 618 CTL_ISCSI_LOGOUT, 619 CTL_ISCSI_TERMINATE, 620#ifdef ICL_KERNEL_PROXY 621 CTL_ISCSI_LISTEN, 622 CTL_ISCSI_ACCEPT, 623 CTL_ISCSI_SEND, 624 CTL_ISCSI_RECEIVE, 625 CTL_ISCSI_CLOSE, 626#endif 627} ctl_iscsi_type; 628 629typedef enum { 630 CTL_ISCSI_DIGEST_NONE, 631 CTL_ISCSI_DIGEST_CRC32C 632} ctl_iscsi_digest; 633 634#define CTL_ISCSI_NAME_LEN 224 /* 223 bytes, by RFC 3720, + '\0' */ 635#define CTL_ISCSI_ADDR_LEN 47 /* INET6_ADDRSTRLEN + '\0' */ 636#define CTL_ISCSI_ALIAS_LEN 128 /* Arbitrary. */ 637 638struct ctl_iscsi_handoff_params { 639 char initiator_name[CTL_ISCSI_NAME_LEN]; 640 char initiator_addr[CTL_ISCSI_ADDR_LEN]; 641 char initiator_alias[CTL_ISCSI_ALIAS_LEN]; 642 char target_name[CTL_ISCSI_NAME_LEN]; 643 int socket; 644 int portal_group_tag; 645 646 /* 647 * Connection parameters negotiated by ctld(8). 648 */ 649 ctl_iscsi_digest header_digest; 650 ctl_iscsi_digest data_digest; 651 uint32_t cmdsn; 652 uint32_t statsn; 653 uint32_t max_recv_data_segment_length; 654 uint32_t max_burst_length; 655 uint32_t first_burst_length; 656 uint32_t immediate_data; 657#ifdef ICL_KERNEL_PROXY 658 int connection_id; 659 int spare[3]; 660#else 661 int spare[4]; 662#endif 663}; 664 665struct ctl_iscsi_list_params { 666 uint32_t alloc_len; /* passed to kernel */ 667 char *conn_xml; /* filled in kernel */ 668 uint32_t fill_len; /* passed to userland */ 669 int spare[4]; 670}; 671 672struct ctl_iscsi_logout_params { 673 int connection_id; /* passed to kernel */ 674 char initiator_name[CTL_ISCSI_NAME_LEN]; 675 /* passed to kernel */ 676 char initiator_addr[CTL_ISCSI_ADDR_LEN]; 677 /* passed to kernel */ 678 int all; /* passed to kernel */ 679 int spare[4]; 680}; 681 682struct ctl_iscsi_terminate_params { 683 int connection_id; /* passed to kernel */ 684 char initiator_name[CTL_ISCSI_NAME_LEN]; 685 /* passed to kernel */ 686 char initiator_addr[CTL_ISCSI_NAME_LEN]; 687 /* passed to kernel */ 688 int all; /* passed to kernel */ 689 int spare[4]; 690}; 691 692#ifdef ICL_KERNEL_PROXY 693struct ctl_iscsi_listen_params { 694 int iser; 695 int domain; 696 int socktype; 697 int protocol; 698 struct sockaddr *addr; 699 socklen_t addrlen; 700 int spare[4]; 701}; 702 703struct ctl_iscsi_accept_params { 704 int connection_id; 705 int spare[4]; 706}; 707 708struct ctl_iscsi_send_params { 709 int connection_id; 710 void *bhs; 711 size_t spare; 712 void *spare2; 713 size_t data_segment_len; 714 void *data_segment; 715 int spare3[4]; 716}; 717 718struct ctl_iscsi_receive_params { 719 int connection_id; 720 void *bhs; 721 size_t spare; 722 void *spare2; 723 size_t data_segment_len; 724 void *data_segment; 725 int spare3[4]; 726}; 727 728struct ctl_iscsi_close_params { 729 int connection_id; 730 int spare[4]; 731}; 732#endif /* ICL_KERNEL_PROXY */ 733 734union ctl_iscsi_data { 735 struct ctl_iscsi_handoff_params handoff; 736 struct ctl_iscsi_list_params list; 737 struct ctl_iscsi_logout_params logout; 738 struct ctl_iscsi_terminate_params terminate; 739#ifdef ICL_KERNEL_PROXY 740 struct ctl_iscsi_listen_params listen; 741 struct ctl_iscsi_accept_params accept; 742 struct ctl_iscsi_send_params send; 743 struct ctl_iscsi_receive_params receive; 744 struct ctl_iscsi_close_params close; 745#endif 746}; 747 748/* 749 * iSCSI interface 750 * 751 * status: The status of the request. See above for the 752 * description of the values of this field. 753 * 754 * error_str: If the status indicates an error, this string will 755 * be filled in to describe the error. 756 */ 757struct ctl_iscsi { 758 ctl_iscsi_type type; /* passed to kernel */ 759 union ctl_iscsi_data data; /* passed to kernel */ 760 ctl_iscsi_status status; /* passed to userland */ 761 char error_str[CTL_ERROR_STR_LEN]; 762 /* passed to userland */ 763}; 764 765#define CTL_IO _IOWR(CTL_MINOR, 0x00, union ctl_io) 766#define CTL_ENABLE_PORT _IOW(CTL_MINOR, 0x04, struct ctl_port_entry) 767#define CTL_DISABLE_PORT _IOW(CTL_MINOR, 0x05, struct ctl_port_entry) 768#define CTL_DUMP_OOA _IO(CTL_MINOR, 0x06) 769#define CTL_CHECK_OOA _IOWR(CTL_MINOR, 0x07, struct ctl_ooa_info) 770#define CTL_HARD_STOP _IOR(CTL_MINOR, 0x08, \ 771 struct ctl_hard_startstop_info) 772#define CTL_HARD_START _IOR(CTL_MINOR, 0x09, \ 773 struct ctl_hard_startstop_info) 774#define CTL_DELAY_IO _IOWR(CTL_MINOR, 0x10, struct ctl_io_delay_info) 775#define CTL_REALSYNC_GET _IOR(CTL_MINOR, 0x11, int) 776#define CTL_REALSYNC_SET _IOW(CTL_MINOR, 0x12, int) 777#define CTL_SETSYNC _IOWR(CTL_MINOR, 0x13, struct ctl_sync_info) 778#define CTL_GETSYNC _IOWR(CTL_MINOR, 0x14, struct ctl_sync_info) 779#define CTL_GETSTATS _IOWR(CTL_MINOR, 0x15, struct ctl_stats) 780#define CTL_ERROR_INJECT _IOWR(CTL_MINOR, 0x16, struct ctl_error_desc) 781#define CTL_BBRREAD _IOWR(CTL_MINOR, 0x17, struct ctl_bbrread_info) 782#define CTL_GET_OOA _IOWR(CTL_MINOR, 0x18, struct ctl_ooa) 783#define CTL_DUMP_STRUCTS _IO(CTL_MINOR, 0x19) 784#define CTL_GET_PORT_LIST _IOWR(CTL_MINOR, 0x20, struct ctl_port_list) 785#define CTL_LUN_REQ _IOWR(CTL_MINOR, 0x21, struct ctl_lun_req) 786#define CTL_LUN_LIST _IOWR(CTL_MINOR, 0x22, struct ctl_lun_list) 787#define CTL_ERROR_INJECT_DELETE _IOW(CTL_MINOR, 0x23, struct ctl_error_desc) 788#define CTL_SET_PORT_WWNS _IOW(CTL_MINOR, 0x24, struct ctl_port_entry) 789#define CTL_ISCSI _IOWR(CTL_MINOR, 0x25, struct ctl_iscsi) 790 791#endif /* _CTL_IOCTL_H_ */ 792 793/* 794 * vim: ts=8 795 */ 796