FreeBSD kernel CAM code
ctl.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ctl_port_entry
 
struct  ctl_modepage_header
 
union  ctl_modepage_info
 

Macros

#define CTL_RETVAL_COMPLETE   0
 
#define CTL_RETVAL_QUEUED   1
 
#define CTL_RETVAL_ALLOCATED   2
 
#define CTL_RETVAL_ERROR   3
 
#define CTL_PORT_WWNN_VALID   0x01
 
#define CTL_PORT_WWPN_VALID   0x02
 
#define CTL_SN_LEN   16
 
#define CTL_DEVID_LEN   64
 
#define CTL_DEVID_MIN_LEN   16
 
#define CTL_WWPN_LEN   8
 
#define CTL_DRIVER_NAME_LEN   32
 

Enumerations

enum  ctl_port_type {
  CTL_PORT_NONE = 0x00 , CTL_PORT_FC = 0x01 , CTL_PORT_SCSI = 0x02 , CTL_PORT_IOCTL = 0x04 ,
  CTL_PORT_INTERNAL = 0x08 , CTL_PORT_ISCSI = 0x10 , CTL_PORT_SAS = 0x20 , CTL_PORT_UMASS = 0x40 ,
  CTL_PORT_ALL = 0xff , CTL_PORT_ISC = 0x100
}
 
enum  ctl_ua_type {
  CTL_UA_NONE = 0x0000 , CTL_UA_POWERON = 0x0001 , CTL_UA_BUS_RESET = 0x0002 , CTL_UA_TARG_RESET = 0x0004 ,
  CTL_UA_I_T_NEXUS_LOSS = 0x0008 , CTL_UA_LUN_RESET = 0x0010 , CTL_UA_LUN_CHANGE = 0x0020 , CTL_UA_MODE_CHANGE = 0x0040 ,
  CTL_UA_LOG_CHANGE = 0x0080 , CTL_UA_INQ_CHANGE = 0x0100 , CTL_UA_RES_PREEMPT = 0x0400 , CTL_UA_RES_RELEASE = 0x0800 ,
  CTL_UA_REG_PREEMPT = 0x1000 , CTL_UA_ASYM_ACC_CHANGE = 0x2000 , CTL_UA_CAPACITY_CHANGE = 0x4000 , CTL_UA_THIN_PROV_THRES = 0x8000 ,
  CTL_UA_MEDIUM_CHANGE = 0x10000 , CTL_UA_IE = 0x20000
}
 

Functions

 MALLOC_DECLARE (M_CTL)
 
int ctl_sbuf_printf_esc (struct sbuf *sb, char *str, int size)
 
int ctl_ffz (uint32_t *mask, uint32_t first, uint32_t last)
 
int ctl_set_mask (uint32_t *mask, uint32_t bit)
 
int ctl_clear_mask (uint32_t *mask, uint32_t bit)
 
int ctl_is_set (uint32_t *mask, uint32_t bit)
 
int ctl_default_page_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr)
 
int ctl_ie_page_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr)
 
int ctl_temp_log_sense_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc)
 
int ctl_lbp_log_sense_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc)
 
int ctl_sap_log_sense_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc)
 
int ctl_ie_log_sense_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc)
 
int ctl_config_move_done (union ctl_io *io, bool samethr)
 
void ctl_datamove_done (union ctl_io *io, bool samethr)
 
void ctl_datamove (union ctl_io *io)
 
void ctl_serseq_done (union ctl_io *io)
 
void ctl_done (union ctl_io *io)
 
void ctl_data_submit_done (union ctl_io *io)
 
void ctl_config_read_done (union ctl_io *io)
 
void ctl_config_write_done (union ctl_io *io)
 
void ctl_portDB_changed (int portnum)
 
int ctl_ioctl_io (struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
 
void ctl_est_ua (struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua)
 
void ctl_est_ua_port (struct ctl_lun *lun, int port, uint32_t except, ctl_ua_type ua)
 
void ctl_est_ua_all (struct ctl_lun *lun, uint32_t except, ctl_ua_type ua)
 
void ctl_clr_ua (struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua)
 
void ctl_clr_ua_all (struct ctl_lun *lun, uint32_t except, ctl_ua_type ua)
 
void ctl_clr_ua_allluns (struct ctl_softc *ctl_softc, uint32_t initidx, ctl_ua_type ua_type)
 
uint32_t ctl_decode_lun (uint64_t encoded)
 
uint64_t ctl_encode_lun (uint32_t decoded)
 
void ctl_isc_announce_lun (struct ctl_lun *lun)
 
void ctl_isc_announce_port (struct ctl_port *port)
 
void ctl_isc_announce_iid (struct ctl_port *port, int iid)
 
void ctl_isc_announce_mode (struct ctl_lun *lun, uint32_t initidx, uint8_t page, uint8_t subpage)
 
int ctl_expand_number (const char *buf, uint64_t *num)
 

Macro Definition Documentation

◆ CTL_DEVID_LEN

#define CTL_DEVID_LEN   64

Definition at line 96 of file ctl.h.

◆ CTL_DEVID_MIN_LEN

#define CTL_DEVID_MIN_LEN   16

Definition at line 97 of file ctl.h.

◆ CTL_DRIVER_NAME_LEN

#define CTL_DRIVER_NAME_LEN   32

Definition at line 103 of file ctl.h.

◆ CTL_PORT_WWNN_VALID

#define CTL_PORT_WWNN_VALID   0x01

Definition at line 70 of file ctl.h.

◆ CTL_PORT_WWPN_VALID

#define CTL_PORT_WWPN_VALID   0x02

Definition at line 71 of file ctl.h.

◆ CTL_RETVAL_ALLOCATED

#define CTL_RETVAL_ALLOCATED   2

Definition at line 47 of file ctl.h.

◆ CTL_RETVAL_COMPLETE

#define CTL_RETVAL_COMPLETE   0

Definition at line 45 of file ctl.h.

◆ CTL_RETVAL_ERROR

#define CTL_RETVAL_ERROR   3

Definition at line 48 of file ctl.h.

◆ CTL_RETVAL_QUEUED

#define CTL_RETVAL_QUEUED   1

Definition at line 46 of file ctl.h.

◆ CTL_SN_LEN

#define CTL_SN_LEN   16

Definition at line 91 of file ctl.h.

◆ CTL_WWPN_LEN

#define CTL_WWPN_LEN   8

Definition at line 101 of file ctl.h.

Enumeration Type Documentation

◆ ctl_port_type

Enumerator
CTL_PORT_NONE 
CTL_PORT_FC 
CTL_PORT_SCSI 
CTL_PORT_IOCTL 
CTL_PORT_INTERNAL 
CTL_PORT_ISCSI 
CTL_PORT_SAS 
CTL_PORT_UMASS 
CTL_PORT_ALL 
CTL_PORT_ISC 

Definition at line 50 of file ctl.h.

◆ ctl_ua_type

Enumerator
CTL_UA_NONE 
CTL_UA_POWERON 
CTL_UA_BUS_RESET 
CTL_UA_TARG_RESET 
CTL_UA_I_T_NEXUS_LOSS 
CTL_UA_LUN_RESET 
CTL_UA_LUN_CHANGE 
CTL_UA_MODE_CHANGE 
CTL_UA_LOG_CHANGE 
CTL_UA_INQ_CHANGE 
CTL_UA_RES_PREEMPT 
CTL_UA_RES_RELEASE 
CTL_UA_REG_PREEMPT 
CTL_UA_ASYM_ACC_CHANGE 
CTL_UA_CAPACITY_CHANGE 
CTL_UA_THIN_PROV_THRES 
CTL_UA_MEDIUM_CHANGE 
CTL_UA_IE 

Definition at line 110 of file ctl.h.

Function Documentation

◆ ctl_clear_mask()

int ctl_clear_mask ( uint32_t *  mask,
uint32_t  bit 
)

Definition at line 3838 of file ctl.c.

Referenced by ctl_add_lun(), ctl_do_lun_reset(), ctl_free_lun(), ctl_i_t_nexus_loss(), ctl_port_deregister(), ctl_port_register(), and ctl_prevent_allow().

Here is the caller graph for this function:

◆ ctl_clr_ua()

void ctl_clr_ua ( struct ctl_lun lun,
uint32_t  initidx,
ctl_ua_type  ua 
)

Definition at line 1848 of file ctl.c.

References CTL_MAX_INIT_PER_PORT, ctl_lun::ctl_softc, ctl_softc::init_max, ctl_softc::init_min, ctl_lun::lun_lock, and ctl_lun::pending_ua.

Referenced by ctl_clr_ua_allluns(), ctl_isc_ua(), and ctl_report_luns().

Here is the caller graph for this function:

◆ ctl_clr_ua_all()

void ctl_clr_ua_all ( struct ctl_lun lun,
uint32_t  except,
ctl_ua_type  ua 
)

Definition at line 1863 of file ctl.c.

References CTL_MAX_INIT_PER_PORT, ctl_lun::ctl_softc, ctl_lun::lun_lock, ctl_lun::pending_ua, ctl_softc::port_max, and ctl_softc::port_min.

Referenced by ctl_build_ua(), ctl_ie_page_handler(), ctl_isc_ua(), and ctl_thresh_thread().

Here is the caller graph for this function:

◆ ctl_clr_ua_allluns()

void ctl_clr_ua_allluns ( struct ctl_softc ctl_softc,
uint32_t  initidx,
ctl_ua_type  ua_type 
)

Definition at line 1881 of file ctl.c.

References ctl_clr_ua(), ctl_softc::ctl_lock, and ctl_lun::lun.

Referenced by ctl_build_ua().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_config_move_done()

int ctl_config_move_done ( union ctl_io io,
bool  samethr 
)

Definition at line 5102 of file ctl.c.

References ctl_data_print(), ctl_debug, CTL_DEBUG_CDB_DATA, CTL_DEBUG_PRINT, ctl_done(), CTL_FLAG_ABORT, CTL_FLAG_ALLOCATED, CTL_FLAG_DATA_IN, CTL_FLAG_DATA_MASK, CTL_IO_SCSI, CTL_RETVAL_COMPLETE, ctl_scsiio(), CTL_STATUS_MASK, CTL_STATUS_NONE, CTL_SUCCESS, ctl_io_hdr::flags, ctl_io::io_hdr, ctl_io_hdr::io_type, ctl_scsiio::kern_data_ptr, ctl_io::scsiio, and ctl_io_hdr::status.

Referenced by ctl_backend_register(), ctl_extended_copy_lid1(), ctl_extended_copy_lid4(), ctl_format(), ctl_get_config(), ctl_get_event_status(), ctl_get_lba_status(), ctl_inquiry_evpd_bdc(), ctl_inquiry_evpd_block_limits(), ctl_inquiry_evpd_devid(), ctl_inquiry_evpd_eid(), ctl_inquiry_evpd_lbp(), ctl_inquiry_evpd_mpp(), ctl_inquiry_evpd_scsi_ports(), ctl_inquiry_evpd_serial(), ctl_inquiry_evpd_sfs(), ctl_inquiry_evpd_supported(), ctl_inquiry_evpd_tpc(), ctl_inquiry_std(), ctl_log_sense(), ctl_mechanism_status(), ctl_mode_select(), ctl_mode_sense(), ctl_persistent_reserve_in(), ctl_persistent_reserve_out(), ctl_populate_token(), ctl_read_buffer(), ctl_read_capacity(), ctl_read_capacity_16(), ctl_read_defect(), ctl_read_toc(), ctl_receive_copy_failure_details(), ctl_receive_copy_operating_parameters(), ctl_receive_copy_status_lid1(), ctl_receive_copy_status_lid4(), ctl_receive_rod_token_information(), ctl_report_all_rod_tokens(), ctl_report_ident_info(), ctl_report_luns(), ctl_report_supported_opcodes(), ctl_report_supported_tmf(), ctl_report_tagret_port_groups(), ctl_report_timestamp(), ctl_request_sense(), ctl_unmap(), ctl_write_buffer(), ctl_write_same(), and ctl_write_using_token().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_config_read_done()

◆ ctl_config_write_done()

◆ ctl_data_submit_done()

◆ ctl_datamove()

void ctl_datamove ( union ctl_io io)

Definition at line 12538 of file ctl.c.

References ctl_scsiio::be_move_done, ctl_datamove_done_process(), CTL_DEBUG_PRINT, CTL_DELAY_TYPE_ONESHOT, CTL_FLAG_ABORT, CTL_FLAG_DELAY_DONE, CTL_LUN, CTL_PORT, CTL_SOFTC, ctl_io_hdr::dma_start_bt, ctl_io_hdr::flags, ctl_nexus::initid, ctl_io::io_hdr, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_resid, ctl_lun::lun, ctl_io_hdr::nexus, ctl_io_hdr::port_status, ctl_io::scsiio, ctl_scsiio::tag_num, ctl_nexus::targ_lun, and ctl_nexus::targ_port.

Referenced by ctl_backend_ramdisk_compare(), ctl_backend_ramdisk_rw(), ctl_be_block_biodone(), ctl_be_block_dispatch(), ctl_be_block_dispatch_file(), ctl_be_block_dispatch_zvol(), ctl_config_read_done(), ctl_extended_copy_lid1(), ctl_extended_copy_lid4(), ctl_format(), ctl_get_config(), ctl_get_event_status(), ctl_inquiry_evpd_bdc(), ctl_inquiry_evpd_block_limits(), ctl_inquiry_evpd_devid(), ctl_inquiry_evpd_eid(), ctl_inquiry_evpd_lbp(), ctl_inquiry_evpd_mpp(), ctl_inquiry_evpd_scsi_ports(), ctl_inquiry_evpd_serial(), ctl_inquiry_evpd_sfs(), ctl_inquiry_evpd_supported(), ctl_inquiry_evpd_tpc(), ctl_inquiry_std(), ctl_log_sense(), ctl_mechanism_status(), ctl_mode_select(), ctl_mode_sense(), ctl_persistent_reserve_in(), ctl_persistent_reserve_out(), ctl_populate_token(), ctl_read_buffer(), ctl_read_capacity(), ctl_read_capacity_16(), ctl_read_defect(), ctl_read_toc(), ctl_receive_copy_failure_details(), ctl_receive_copy_operating_parameters(), ctl_receive_copy_status_lid1(), ctl_receive_copy_status_lid4(), ctl_receive_rod_token_information(), ctl_report_all_rod_tokens(), ctl_report_ident_info(), ctl_report_luns(), ctl_report_supported_opcodes(), ctl_report_supported_tmf(), ctl_report_tagret_port_groups(), ctl_report_timestamp(), ctl_request_sense(), ctl_unmap(), ctl_write_buffer(), ctl_write_same(), and ctl_write_using_token().

Here is the call graph for this function:

◆ ctl_datamove_done()

void ctl_datamove_done ( union ctl_io io,
bool  samethr 
)

Definition at line 12530 of file ctl.c.

References ctl_scsiio::be_move_done, ctl_datamove_done_process(), and ctl_io::scsiio.

Referenced by cfcs_datamove(), cfi_submit_wait(), cfiscsi_data_wait_abort(), cfiscsi_datamove_in(), cfiscsi_datamove_out(), cfiscsi_pdu_handle_data_out(), ctl_ha_datamove(), ctl_handle_isc(), ctlfedone(), and tpcl_datamove().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_decode_lun()

◆ ctl_default_page_handler()

int ctl_default_page_handler ( struct ctl_scsiio ctsio,
struct ctl_page_index page_index,
uint8_t *  page_ptr 
)

◆ ctl_done()

void ctl_done ( union ctl_io io)

Definition at line 13362 of file ctl.c.

References ctl_scsiio::cdb, CTL_DELAY_TYPE_ONESHOT, ctl_enqueue_done(), CTL_FLAG_DELAY_DONE, CTL_FLAG_INT_COPY, CTL_IO_TASK, CTL_LUN, ctl_io_hdr::flags, ctl_nexus::initid, ctl_io::io_hdr, ctl_io_hdr::io_type, ctl_lun::lun, ctl_io_hdr::msg_type, ctl_io_hdr::nexus, ctl_io::scsiio, ctl_io_hdr::status, ctl_scsiio::tag_num, ctl_taskio::tag_num, ctl_nexus::targ_lun, ctl_nexus::targ_port, and ctl_io::taskio.

Referenced by ctl_cnw(), ctl_config_move_done(), ctl_config_read_done(), ctl_config_write_done(), ctl_copy_operation_abort(), ctl_data_submit_done(), ctl_do_mode_select(), ctl_extended_copy_lid1(), ctl_extended_copy_lid4(), ctl_failover_io(), ctl_failover_lun(), ctl_format(), ctl_get_event_status(), ctl_get_lba_status(), ctl_handle_isc(), ctl_inquiry(), ctl_inquiry_evpd(), ctl_log_sense(), ctl_mode_select(), ctl_mode_sense(), ctl_persistent_reserve_out(), ctl_populate_token(), ctl_prevent_allow(), ctl_pro_preempt(), ctl_read_buffer(), ctl_read_capacity(), ctl_read_capacity_16(), ctl_read_defect(), ctl_read_write(), ctl_receive_copy_failure_details(), ctl_receive_copy_status_lid1(), ctl_receive_copy_status_lid4(), ctl_receive_rod_token_information(), ctl_report_ident_info(), ctl_report_luns(), ctl_report_supported_opcodes(), ctl_report_tagret_port_groups(), ctl_run_task(), ctl_scsi_release(), ctl_scsi_reserve(), ctl_scsiio(), ctl_scsiio_precheck(), ctl_start_stop(), ctl_sync_cache(), ctl_try_unblock_io(), ctl_tur(), ctl_unmap(), ctl_validate_command(), ctl_verify(), ctl_write_buffer(), ctl_write_same(), ctl_write_using_token(), and tpc_process().

Here is the call graph for this function:

◆ ctl_encode_lun()

uint64_t ctl_encode_lun ( uint32_t  decoded)

Definition at line 3795 of file ctl.c.

References RPL_LUNDATA_ATYP_EXTLUN, RPL_LUNDATA_ATYP_FLAT, and RPL_LUNDATA_ATYP_PERIPH.

Referenced by ctl_report_luns(), ctlfe_lun_disable(), and ctlfe_lun_enable().

Here is the caller graph for this function:

◆ ctl_est_ua()

void ctl_est_ua ( struct ctl_lun lun,
uint32_t  initidx,
ctl_ua_type  ua 
)

◆ ctl_est_ua_all()

◆ ctl_est_ua_port()

void ctl_est_ua_port ( struct ctl_lun lun,
int  port,
uint32_t  except,
ctl_ua_type  ua 
)

Definition at line 1822 of file ctl.c.

References CTL_MAX_INIT_PER_PORT, ctl_lun::lun_lock, and ctl_lun::pending_ua.

Referenced by ctl_est_ua_all(), and ctl_ioctl().

Here is the caller graph for this function:

◆ ctl_expand_number()

int ctl_expand_number ( const char *  buf,
uint64_t *  num 
)

Definition at line 4021 of file ctl.c.

Referenced by ctl_backend_ramdisk_create(), ctl_be_block_open_dev(), ctl_be_block_open_file(), ctl_init_page_index(), ctl_inquiry_evpd_block_limits(), and ctl_write_same().

Here is the caller graph for this function:

◆ ctl_ffz()

int ctl_ffz ( uint32_t *  mask,
uint32_t  first,
uint32_t  last 
)

Definition at line 3810 of file ctl.c.

Referenced by ctl_add_lun(), and ctl_port_register().

Here is the caller graph for this function:

◆ ctl_ie_log_sense_handler()

◆ ctl_ie_page_handler()

◆ ctl_ioctl_io()

int ctl_ioctl_io ( struct cdev *  dev,
u_long  cmd,
caddr_t  addr,
int  flag,
struct thread *  td 
)

◆ ctl_is_set()

int ctl_is_set ( uint32_t *  mask,
uint32_t  bit 
)

Definition at line 3854 of file ctl.c.

Referenced by ctl_add_lun(), ctl_i_t_nexus_loss(), and ctl_prevent_allow().

Here is the caller graph for this function:

◆ ctl_isc_announce_iid()

◆ ctl_isc_announce_lun()

◆ ctl_isc_announce_mode()

◆ ctl_isc_announce_port()

◆ ctl_lbp_log_sense_handler()

◆ ctl_portDB_changed()

void ctl_portDB_changed ( int  portnum)

◆ ctl_sap_log_sense_handler()

int ctl_sap_log_sense_handler ( struct ctl_scsiio ctsio,
struct ctl_page_index page_index,
int  pc 
)

◆ ctl_sbuf_printf_esc()

int ctl_sbuf_printf_esc ( struct sbuf *  sb,
char *  str,
int  size 
)

Definition at line 2528 of file ctl.c.

Referenced by ctl_ioctl().

Here is the caller graph for this function:

◆ ctl_serseq_done()

void ctl_serseq_done ( union ctl_io io)

Definition at line 13347 of file ctl.c.

References CTL_FLAG_SERSEQ_DONE, CTL_LUN, ctl_try_unblock_others(), ctl_io_hdr::flags, ctl_io::io_hdr, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_rw(), ctl_be_block_biodone(), ctl_be_block_dispatch_file(), and ctl_be_block_dispatch_zvol().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ctl_set_mask()

int ctl_set_mask ( uint32_t *  mask,
uint32_t  bit 
)

Definition at line 3822 of file ctl.c.

Referenced by ctl_add_lun(), ctl_port_register(), and ctl_prevent_allow().

Here is the caller graph for this function:

◆ ctl_temp_log_sense_handler()

◆ MALLOC_DECLARE()

MALLOC_DECLARE ( M_CTL  )