/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2003 Silicon Graphics International Corp.4* Copyright (c) 2011 Spectra Logic Corporation5* Copyright (c) 2014-2017 Alexander Motin <[email protected]>6* All rights reserved.7*8* Redistribution and use in source and binary forms, with or without9* modification, are permitted provided that the following conditions10* are met:11* 1. Redistributions of source code must retain the above copyright12* notice, this list of conditions, and the following disclaimer,13* without modification.14* 2. Redistributions in binary form must reproduce at minimum a disclaimer15* substantially similar to the "NO WARRANTY" disclaimer below16* ("Disclaimer") and any redistribution must be conditioned upon17* including a substantially similar Disclaimer requirement for further18* binary redistribution.19*20* NO WARRANTY21* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS22* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT23* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR24* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT25* HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* 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) ARISING30* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE31* POSSIBILITY OF SUCH DAMAGES.32*33* $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_ioctl.h#4 $34*/35/*36* CAM Target Layer ioctl interface.37*38* Author: Ken Merry <[email protected]>39*/4041#ifndef _CTL_IOCTL_H_42#define _CTL_IOCTL_H_4344#ifdef ICL_KERNEL_PROXY45#include <sys/socket.h>46#endif4748#include <sys/ioccom.h>49#include <sys/nv.h>50#include <dev/nvmf/nvmf.h>51#include <dev/nvmf/nvmf_proto.h>5253#define CTL_DEFAULT_DEV "/dev/cam/ctl"54/*55* Maximum number of targets we support.56*/57#define CTL_MAX_TARGETS 15859/*60* Maximum target ID we support.61*/62#define CTL_MAX_TARGID 156364/*65* Maximum number of initiators per port.66*/67#define CTL_MAX_INIT_PER_PORT 20486869/* Hopefully this won't conflict with new misc devices that pop up */70#define CTL_MINOR 2257172typedef enum {73CTL_DELAY_TYPE_NONE,74CTL_DELAY_TYPE_CONT,75CTL_DELAY_TYPE_ONESHOT76} ctl_delay_type;7778typedef enum {79CTL_DELAY_LOC_NONE,80CTL_DELAY_LOC_DATAMOVE,81CTL_DELAY_LOC_DONE,82} ctl_delay_location;8384typedef enum {85CTL_DELAY_STATUS_NONE,86CTL_DELAY_STATUS_OK,87CTL_DELAY_STATUS_INVALID_LUN,88CTL_DELAY_STATUS_INVALID_TYPE,89CTL_DELAY_STATUS_INVALID_LOC,90CTL_DELAY_STATUS_NOT_IMPLEMENTED91} ctl_delay_status;9293struct ctl_io_delay_info {94uint32_t lun_id;95ctl_delay_type delay_type;96ctl_delay_location delay_loc;97uint32_t delay_secs;98ctl_delay_status status;99};100101typedef enum {102CTL_STATS_NO_IO,103CTL_STATS_READ,104CTL_STATS_WRITE105} ctl_stat_types;106#define CTL_STATS_NUM_TYPES 3107108typedef enum {109CTL_SS_OK,110CTL_SS_NEED_MORE_SPACE,111CTL_SS_ERROR112} ctl_stats_status;113114typedef u_int ctl_stats_flags;115116#define CTL_STATS_FLAG_NONE 0x00117#define CTL_STATS_FLAG_TIME_VALID 0x01118119struct ctl_io_stats {120uint32_t item;121uint64_t bytes[CTL_STATS_NUM_TYPES];122uint64_t operations[CTL_STATS_NUM_TYPES];123uint64_t dmas[CTL_STATS_NUM_TYPES];124struct bintime time[CTL_STATS_NUM_TYPES];125struct bintime dma_time[CTL_STATS_NUM_TYPES];126};127128struct ctl_get_io_stats {129struct ctl_io_stats *stats; /* passed to/from kernel */130size_t alloc_len; /* passed to kernel */131size_t fill_len; /* passed to userland */132int first_item; /* passed to kernel */133int num_items; /* passed to userland */134ctl_stats_status status; /* passed to userland */135ctl_stats_flags flags; /* passed to userland */136struct timespec timestamp; /* passed to userland */137};138139/*140* The types of errors that can be injected:141*142* NONE: No error specified.143* ABORTED: SSD_KEY_ABORTED_COMMAND, 0x45, 0x00144* MEDIUM_ERR: Medium error, different asc/ascq depending on read/write.145* UA: Unit attention.146* CUSTOM: User specifies the sense data.147* TYPE: Mask to use with error types.148*149* Flags that affect injection behavior:150* CONTINUOUS: This error will stay around until explicitly cleared.151* DESCRIPTOR: Use descriptor sense instead of fixed sense.152*/153typedef u_int ctl_lun_error;154155#define CTL_LUN_INJ_NONE 0x000156#define CTL_LUN_INJ_ABORTED 0x001157#define CTL_LUN_INJ_MEDIUM_ERR 0x002158#define CTL_LUN_INJ_UA 0x003159#define CTL_LUN_INJ_CUSTOM 0x004160#define CTL_LUN_INJ_TYPE 0x0ff161#define CTL_LUN_INJ_CONTINUOUS 0x100162#define CTL_LUN_INJ_DESCRIPTOR 0x200163164/*165* Flags to specify what type of command the given error pattern will166* execute on. The first group of types can be ORed together.167*168* READ: Any read command.169* WRITE: Any write command.170* READWRITE: Any read or write command.171* READCAP: Any read capacity command.172* TUR: Test Unit Ready.173* ANY: Any command.174* MASK: Mask for basic command patterns.175*176* Special types:177*178* CMD: The CDB to act on is specified in struct ctl_error_desc_cmd.179* RANGE: For read/write commands, act when the LBA is in the180* specified range.181*/182typedef u_int ctl_lun_error_pattern;183184#define CTL_LUN_PAT_NONE 0x000185#define CTL_LUN_PAT_READ 0x001186#define CTL_LUN_PAT_WRITE 0x002187#define CTL_LUN_PAT_READWRITE CTL_LUN_PAT_READ | CTL_LUN_PAT_WRITE188#define CTL_LUN_PAT_READCAP 0x004189#define CTL_LUN_PAT_TUR 0x008190#define CTL_LUN_PAT_ANY 0x0ff191#define CTL_LUN_PAT_MASK 0x0ff192#define CTL_LUN_PAT_CMD 0x100193#define CTL_LUN_PAT_RANGE 0x200194195/*196* This structure allows the user to specify a particular CDB pattern to197* look for.198*199* cdb_pattern: Fill in the relevant bytes to look for in the CDB.200* cdb_valid_bytes: Bitmask specifying valid bytes in the cdb_pattern.201* flags: Specify any command flags (see ctl_io_flags) that202* should be set.203*/204struct ctl_error_desc_cmd {205uint8_t cdb_pattern[CTL_MAX_CDBLEN];206uint32_t cdb_valid_bytes;207uint32_t flags;208};209210/*211* Error injection descriptor.212*213* lun_id LUN to act on.214* lun_error: The type of error to inject. See above for descriptions.215* error_pattern: What kind of command to act on. See above.216* cmd_desc: For CTL_LUN_PAT_CMD only.217* lba_range: For CTL_LUN_PAT_RANGE only.218* custom_sense: Specify sense. For CTL_LUN_INJ_CUSTOM only.219* serial: Serial number returned by the kernel. Use for deletion.220* links: Kernel use only.221*/222struct ctl_error_desc {223uint32_t lun_id; /* To kernel */224ctl_lun_error lun_error; /* To kernel */225ctl_lun_error_pattern error_pattern; /* To kernel */226struct ctl_error_desc_cmd cmd_desc; /* To kernel */227struct ctl_lba_len lba_range; /* To kernel */228struct scsi_sense_data custom_sense; /* To kernel */229uint64_t serial; /* From kernel */230STAILQ_ENTRY(ctl_error_desc) links; /* Kernel use only */231};232233typedef u_int ctl_ooa_flags;234235#define CTL_OOA_FLAG_NONE 0x00236#define CTL_OOA_FLAG_ALL_LUNS 0x01237238typedef enum {239CTL_OOA_OK,240CTL_OOA_NEED_MORE_SPACE,241CTL_OOA_ERROR242} ctl_get_ooa_status;243244typedef u_int ctl_ooa_cmd_flags;245246#define CTL_OOACMD_FLAG_NONE 0x00247#define CTL_OOACMD_FLAG_DMA 0x01248#define CTL_OOACMD_FLAG_BLOCKED 0x02249#define CTL_OOACMD_FLAG_ABORT 0x04250#define CTL_OOACMD_FLAG_RTR 0x08251#define CTL_OOACMD_FLAG_DMA_QUEUED 0x10252#define CTL_OOACMD_FLAG_STATUS_QUEUED 0x20253#define CTL_OOACMD_FLAG_STATUS_SENT 0x40254255struct ctl_ooa_entry {256ctl_ooa_cmd_flags cmd_flags;257uint8_t cdb[CTL_MAX_CDBLEN];258uint8_t cdb_len;259uint64_t tag_num;260ctl_tag_type tag_type;261uint32_t lun_num;262struct bintime start_bt;263};264265struct ctl_ooa {266ctl_ooa_flags flags; /* passed to kernel */267uint64_t lun_num; /* passed to kernel */268uint32_t alloc_len; /* passed to kernel */269uint32_t alloc_num; /* passed to kernel */270struct ctl_ooa_entry *entries; /* filled in kernel */271uint32_t fill_len; /* passed to userland */272uint32_t fill_num; /* passed to userland */273uint32_t dropped_num; /* passed to userland */274struct bintime cur_bt; /* passed to userland */275ctl_get_ooa_status status; /* passed to userland */276};277278typedef enum {279CTL_LUN_NOSTATUS,280CTL_LUN_OK,281CTL_LUN_ERROR,282CTL_LUN_WARNING283} ctl_lun_status;284285#define CTL_ERROR_STR_LEN 160286287typedef enum {288CTL_LUNREQ_CREATE,289CTL_LUNREQ_RM,290CTL_LUNREQ_MODIFY,291} ctl_lunreq_type;292293/*294* The ID_REQ flag is used to say that the caller has requested a295* particular LUN ID in the req_lun_id field. If we cannot allocate that296* LUN ID, the ctl_add_lun() call will fail.297*298* The STOPPED flag tells us that the LUN should default to the powered299* off state. It will return 0x04,0x02 until it is powered up. ("Logical300* unit not ready, initializing command required.")301*302* The NO_MEDIA flag tells us that the LUN has no media inserted.303*304* The PRIMARY flag tells us that this LUN is registered as a Primary LUN305* which is accessible via the Master shelf controller in an HA. This flag306* being set indicates a Primary LUN. This flag being reset represents a307* Secondary LUN controlled by the Secondary controller in an HA308* configuration. Flag is applicable at this time to T_DIRECT types.309*310* The SERIAL_NUM flag tells us that the serial_num field is filled in and311* valid for use in SCSI INQUIRY VPD page 0x80.312*313* The DEVID flag tells us that the device_id field is filled in and314* valid for use in SCSI INQUIRY VPD page 0x83.315*316* The DEV_TYPE flag tells us that the device_type field is filled in.317*318* The EJECTED flag tells us that the removable LUN has tray open.319*320* The UNMAP flag tells us that this LUN supports UNMAP.321*322* The OFFLINE flag tells us that this LUN can not access backing store.323*/324typedef u_int ctl_backend_lun_flags;325326#define CTL_LUN_FLAG_ID_REQ 0x01327#define CTL_LUN_FLAG_STOPPED 0x02328#define CTL_LUN_FLAG_NO_MEDIA 0x04329#define CTL_LUN_FLAG_PRIMARY 0x08330#define CTL_LUN_FLAG_SERIAL_NUM 0x10331#define CTL_LUN_FLAG_DEVID 0x20332#define CTL_LUN_FLAG_DEV_TYPE 0x40333#define CTL_LUN_FLAG_UNMAP 0x80334#define CTL_LUN_FLAG_EJECTED 0x100335#define CTL_LUN_FLAG_READONLY 0x200336337/*338* LUN creation parameters:339*340* flags: Various LUN flags, see above.341*342* device_type: The SCSI device type. e.g. 0 for Direct Access,343* 3 for Processor, etc. Only certain backends may344* support setting this field. The CTL_LUN_FLAG_DEV_TYPE345* flag should be set in the flags field if the device346* type is set.347*348* lun_size_bytes: The size of the LUN in bytes. For some backends349* this is relevant (e.g. ramdisk), for others, it may350* be ignored in favor of using the properties of the351* backing store. If specified, this should be a352* multiple of the blocksize.353*354* The actual size of the LUN is returned in this355* field.356*357* blocksize_bytes: The LUN blocksize in bytes. For some backends this358* is relevant, for others it may be ignored in359* favor of using the properties of the backing store.360*361* The actual blocksize of the LUN is returned in this362* field.363*364* req_lun_id: The requested LUN ID. The CTL_LUN_FLAG_ID_REQ flag365* should be set if this is set. The request will be366* granted if the LUN number is available, otherwise367* the LUN addition request will fail.368*369* The allocated LUN number is returned in this field.370*371* serial_num: This is the value returned in SCSI INQUIRY VPD page372* 0x80. If it is specified, the CTL_LUN_FLAG_SERIAL_NUM373* flag should be set.374*375* The serial number value used is returned in this376* field.377*378* device_id: This is the value returned in the T10 vendor ID379* based DESIGNATOR field in the SCSI INQUIRY VPD page380* 0x83 data. If it is specified, the CTL_LUN_FLAG_DEVID381* flag should be set.382*383* The device id value used is returned in this field.384*/385struct ctl_lun_create_params {386ctl_backend_lun_flags flags;387uint8_t device_type;388uint64_t lun_size_bytes;389uint32_t blocksize_bytes;390uint32_t req_lun_id;391uint8_t serial_num[CTL_SN_LEN];392uint8_t device_id[CTL_DEVID_LEN];393};394395/*396* LUN removal parameters:397*398* lun_id: The number of the LUN to delete. This must be set.399* The LUN must be backed by the given backend.400*/401struct ctl_lun_rm_params {402uint32_t lun_id;403};404405/*406* LUN modification parameters:407*408* lun_id: The number of the LUN to modify. This must be set.409* The LUN must be backed by the given backend.410*411* lun_size_bytes: The size of the LUN in bytes. If zero, update412* the size using the backing file size, if possible.413*/414struct ctl_lun_modify_params {415uint32_t lun_id;416uint64_t lun_size_bytes;417};418419/*420* Union of request type data. Fill in the appropriate union member for421* the request type.422*/423union ctl_lunreq_data {424struct ctl_lun_create_params create;425struct ctl_lun_rm_params rm;426struct ctl_lun_modify_params modify;427};428429/*430* LUN request interface:431*432* backend: This is required, and is NUL-terminated a string433* that is the name of the backend, like "ramdisk" or434* "block".435*436* reqtype: The type of request, CTL_LUNREQ_CREATE to create a437* LUN, CTL_LUNREQ_RM to delete a LUN.438*439* reqdata: Request type-specific information. See the440* description of individual the union members above441* for more information.442*443* num_be_args: This is the number of backend-specific arguments444* in the be_args array.445*446* be_args: This is an array of backend-specific arguments.447* See above for a description of the fields in this448* structure.449*450* status: Status of the LUN request.451*452* error_str: If the status is CTL_LUN_ERROR, this will453* contain a string describing the error.454*455* kern_be_args: For kernel use only.456*/457struct ctl_lun_req {458#define CTL_BE_NAME_LEN 32459char backend[CTL_BE_NAME_LEN];460ctl_lunreq_type reqtype;461union ctl_lunreq_data reqdata;462void * args;463nvlist_t * args_nvl;464#define CTL_MAX_ARGS_LEN (1024 * 1024)465size_t args_len;466void * result;467nvlist_t * result_nvl;468size_t result_len;469ctl_lun_status status;470char error_str[CTL_ERROR_STR_LEN];471};472473/*474* LUN list status:475*476* NONE: No status.477*478* OK: Request completed successfully.479*480* NEED_MORE_SPACE: The allocated length of the entries field is too481* small for the available data.482*483* ERROR: An error occurred, look at the error string for a484* description of the error.485*/486typedef enum {487CTL_LUN_LIST_NONE,488CTL_LUN_LIST_OK,489CTL_LUN_LIST_NEED_MORE_SPACE,490CTL_LUN_LIST_ERROR491} ctl_lun_list_status;492493/*494* LUN list interface495*496* backend_name: This is a NUL-terminated string. If the string497* length is 0, then all LUNs on all backends will498* be enumerated. Otherwise this is the name of the499* backend to be enumerated, like "ramdisk" or "block".500*501* alloc_len: The length of the data buffer allocated for entries.502* In order to properly size the buffer, make one call503* with alloc_len set to 0, and then use the returned504* dropped_len as the buffer length to allocate and505* pass in on a subsequent call.506*507* lun_xml: XML-formatted information on the requested LUNs.508*509* fill_len: The amount of data filled in the storage for entries.510*511* status: The status of the request. See above for the512* description of the values of this field.513*514* error_str: If the status indicates an error, this string will515* be filled in to describe the error.516*/517struct ctl_lun_list {518char backend[CTL_BE_NAME_LEN]; /* passed to kernel*/519uint32_t alloc_len; /* passed to kernel */520char *lun_xml; /* filled in kernel */521uint32_t fill_len; /* passed to userland */522ctl_lun_list_status status; /* passed to userland */523char error_str[CTL_ERROR_STR_LEN];524/* passed to userland */525};526527/*528* Port request interface:529*530* driver: This is required, and is NUL-terminated a string531* that is the name of the frontend, like "iscsi" .532*533* reqtype: The type of request, CTL_REQ_CREATE to create a534* port, CTL_REQ_REMOVE to delete a port.535*536* num_be_args: This is the number of frontend-specific arguments537* in the be_args array.538*539* be_args: This is an array of frontend-specific arguments.540* See above for a description of the fields in this541* structure.542*543* status: Status of the request.544*545* error_str: If the status is CTL_LUN_ERROR, this will546* contain a string describing the error.547*548* kern_be_args: For kernel use only.549*/550typedef enum {551CTL_REQ_CREATE,552CTL_REQ_REMOVE,553CTL_REQ_MODIFY,554} ctl_req_type;555556struct ctl_req {557char driver[CTL_DRIVER_NAME_LEN];558ctl_req_type reqtype;559void * args;560nvlist_t * args_nvl;561size_t args_len;562void * result;563nvlist_t * result_nvl;564size_t result_len;565ctl_lun_status status;566char error_str[CTL_ERROR_STR_LEN];567};568569/*570* iSCSI status571*572* OK: Request completed successfully.573*574* ERROR: An error occurred, look at the error string for a575* description of the error.576*577* CTL_ISCSI_LIST_NEED_MORE_SPACE:578* User has to pass larger buffer for CTL_ISCSI_LIST ioctl.579*/580typedef enum {581CTL_ISCSI_OK,582CTL_ISCSI_ERROR,583CTL_ISCSI_LIST_NEED_MORE_SPACE,584CTL_ISCSI_SESSION_NOT_FOUND585} ctl_iscsi_status;586587typedef enum {588CTL_ISCSI_HANDOFF,589CTL_ISCSI_LIST,590CTL_ISCSI_LOGOUT,591CTL_ISCSI_TERMINATE,592CTL_ISCSI_LIMITS,593#if defined(ICL_KERNEL_PROXY) || 1594/*595* We actually need those in all cases, but leave the ICL_KERNEL_PROXY,596* to remember to remove them along with rest of proxy code, eventually.597*/598CTL_ISCSI_LISTEN,599CTL_ISCSI_ACCEPT,600CTL_ISCSI_SEND,601CTL_ISCSI_RECEIVE,602#endif603} ctl_iscsi_type;604605typedef enum {606CTL_ISCSI_DIGEST_NONE,607CTL_ISCSI_DIGEST_CRC32C608} ctl_iscsi_digest;609610#define CTL_ISCSI_NAME_LEN 224 /* 223 bytes, by RFC 3720, + '\0' */611#define CTL_ISCSI_ADDR_LEN 47 /* INET6_ADDRSTRLEN + '\0' */612#define CTL_ISCSI_ALIAS_LEN 128 /* Arbitrary. */613#define CTL_ISCSI_OFFLOAD_LEN 8 /* Arbitrary. */614615struct ctl_iscsi_handoff_params {616char initiator_name[CTL_ISCSI_NAME_LEN];617char initiator_addr[CTL_ISCSI_ADDR_LEN];618char initiator_alias[CTL_ISCSI_ALIAS_LEN];619uint8_t initiator_isid[6];620char target_name[CTL_ISCSI_NAME_LEN];621int socket;622int portal_group_tag;623624/*625* Connection parameters negotiated by ctld(8).626*/627ctl_iscsi_digest header_digest;628ctl_iscsi_digest data_digest;629uint32_t cmdsn;630uint32_t statsn;631int max_recv_data_segment_length;632int max_burst_length;633int first_burst_length;634uint32_t immediate_data;635char offload[CTL_ISCSI_OFFLOAD_LEN];636#ifdef ICL_KERNEL_PROXY637int connection_id;638#else639int spare;640#endif641int max_send_data_segment_length;642};643644struct ctl_iscsi_list_params {645uint32_t alloc_len; /* passed to kernel */646char *conn_xml; /* filled in kernel */647uint32_t fill_len; /* passed to userland */648int spare[4];649};650651struct ctl_iscsi_logout_params {652int connection_id; /* passed to kernel */653char initiator_name[CTL_ISCSI_NAME_LEN];654/* passed to kernel */655char initiator_addr[CTL_ISCSI_ADDR_LEN];656/* passed to kernel */657int all; /* passed to kernel */658int spare[4];659};660661struct ctl_iscsi_terminate_params {662int connection_id; /* passed to kernel */663char initiator_name[CTL_ISCSI_NAME_LEN];664/* passed to kernel */665char initiator_addr[CTL_ISCSI_NAME_LEN];666/* passed to kernel */667int all; /* passed to kernel */668int spare[4];669};670671struct ctl_iscsi_limits_params {672/* passed to kernel */673char offload[CTL_ISCSI_OFFLOAD_LEN];674int socket;675676/* passed to userland */677#ifdef __LP64__678int spare;679#endif680int max_recv_data_segment_length;681int max_send_data_segment_length;682int max_burst_length;683int first_burst_length;684};685686#ifdef ICL_KERNEL_PROXY687struct ctl_iscsi_listen_params {688int iser;689int domain;690int socktype;691int protocol;692struct sockaddr *addr;693socklen_t addrlen;694int portal_id;695int spare[4];696};697698struct ctl_iscsi_accept_params {699int connection_id;700int portal_id;701struct sockaddr *initiator_addr;702socklen_t initiator_addrlen;703int spare[4];704};705706struct ctl_iscsi_send_params {707int connection_id;708void *bhs;709size_t spare;710void *spare2;711size_t data_segment_len;712void *data_segment;713int spare3[4];714};715716struct ctl_iscsi_receive_params {717int connection_id;718void *bhs;719size_t spare;720void *spare2;721size_t data_segment_len;722void *data_segment;723int spare3[4];724};725726#endif /* ICL_KERNEL_PROXY */727728union ctl_iscsi_data {729struct ctl_iscsi_handoff_params handoff;730struct ctl_iscsi_list_params list;731struct ctl_iscsi_logout_params logout;732struct ctl_iscsi_terminate_params terminate;733struct ctl_iscsi_limits_params limits;734#ifdef ICL_KERNEL_PROXY735struct ctl_iscsi_listen_params listen;736struct ctl_iscsi_accept_params accept;737struct ctl_iscsi_send_params send;738struct ctl_iscsi_receive_params receive;739#endif740};741742/*743* iSCSI interface744*745* status: The status of the request. See above for the746* description of the values of this field.747*748* error_str: If the status indicates an error, this string will749* be filled in to describe the error.750*/751struct ctl_iscsi {752ctl_iscsi_type type; /* passed to kernel */753union ctl_iscsi_data data; /* passed to kernel */754ctl_iscsi_status status; /* passed to userland */755char error_str[CTL_ERROR_STR_LEN];756/* passed to userland */757};758759struct ctl_lun_map {760uint32_t port;761uint32_t plun;762uint32_t lun;763};764765/*766* NVMe over Fabrics status767*768* OK: Request completed successfully.769*770* ERROR: An error occurred, look at the error string for a771* description of the error.772*/773typedef enum {774CTL_NVMF_OK,775CTL_NVMF_ERROR,776CTL_NVMF_LIST_NEED_MORE_SPACE,777CTL_NVMF_ASSOCIATION_NOT_FOUND778} ctl_nvmf_status;779780typedef enum {781CTL_NVMF_HANDOFF,782CTL_NVMF_LIST,783CTL_NVMF_TERMINATE784} ctl_nvmf_type;785786struct ctl_nvmf_list_params {787uint32_t alloc_len; /* passed to kernel */788char *conn_xml; /* filled in kernel */789uint32_t fill_len; /* passed to userland */790int spare[4];791};792793struct ctl_nvmf_terminate_params {794int cntlid; /* passed to kernel */795char hostnqn[NVME_NQN_FIELD_SIZE];796/* passed to kernel */797int all; /* passed to kernel */798int spare[4];799};800801union ctl_nvmf_data {802struct nvmf_ioc_nv handoff;803struct ctl_nvmf_list_params list;804struct ctl_nvmf_terminate_params terminate;805};806807/*808* NVMe over Fabrics interface809*810* status: The status of the request. See above for the811* description of the values of this field.812*813* error_str: If the status indicates an error, this string will814* be filled in to describe the error.815*/816struct ctl_nvmf {817ctl_nvmf_type type; /* passed to kernel */818union ctl_nvmf_data data; /* passed to kernel */819ctl_nvmf_status status; /* passed to userland */820char error_str[CTL_ERROR_STR_LEN];821/* passed to userland */822};823824#define CTL_IO _IOWR(CTL_MINOR, 0x00, union ctl_io)825#define CTL_ENABLE_PORT _IOW(CTL_MINOR, 0x04, struct ctl_port_entry)826#define CTL_DISABLE_PORT _IOW(CTL_MINOR, 0x05, struct ctl_port_entry)827#define CTL_DELAY_IO _IOWR(CTL_MINOR, 0x10, struct ctl_io_delay_info)828#define CTL_ERROR_INJECT _IOWR(CTL_MINOR, 0x16, struct ctl_error_desc)829#define CTL_GET_OOA _IOWR(CTL_MINOR, 0x18, struct ctl_ooa)830#define CTL_DUMP_STRUCTS _IO(CTL_MINOR, 0x19)831#define CTL_LUN_REQ _IOWR(CTL_MINOR, 0x21, struct ctl_lun_req)832#define CTL_LUN_LIST _IOWR(CTL_MINOR, 0x22, struct ctl_lun_list)833#define CTL_ERROR_INJECT_DELETE _IOW(CTL_MINOR, 0x23, struct ctl_error_desc)834#define CTL_SET_PORT_WWNS _IOW(CTL_MINOR, 0x24, struct ctl_port_entry)835#define CTL_ISCSI _IOWR(CTL_MINOR, 0x25, struct ctl_iscsi)836#define CTL_PORT_REQ _IOWR(CTL_MINOR, 0x26, struct ctl_req)837#define CTL_PORT_LIST _IOWR(CTL_MINOR, 0x27, struct ctl_lun_list)838#define CTL_LUN_MAP _IOW(CTL_MINOR, 0x28, struct ctl_lun_map)839#define CTL_GET_LUN_STATS _IOWR(CTL_MINOR, 0x29, struct ctl_get_io_stats)840#define CTL_GET_PORT_STATS _IOWR(CTL_MINOR, 0x2a, struct ctl_get_io_stats)841#define CTL_NVMF _IOWR(CTL_MINOR, 0x2b, struct ctl_nvmf)842843#endif /* _CTL_IOCTL_H_ */844845/*846* vim: ts=8847*/848849850