FreeBSD kernel CAM code
ctl.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/ctype.h>
#include <sys/kernel.h>
#include <sys/types.h>
#include <sys/kthread.h>
#include <sys/bio.h>
#include <sys/fcntl.h>
#include <sys/lock.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/malloc.h>
#include <sys/conf.h>
#include <sys/ioccom.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
#include <sys/smp.h>
#include <sys/endian.h>
#include <sys/proc.h>
#include <sys/sched.h>
#include <sys/sysctl.h>
#include <sys/nv.h>
#include <sys/dnv.h>
#include <vm/uma.h>
#include <cam/cam.h>
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_cd.h>
#include <cam/scsi/scsi_da.h>
#include <cam/ctl/ctl_io.h>
#include <cam/ctl/ctl.h>
#include <cam/ctl/ctl_frontend.h>
#include <cam/ctl/ctl_util.h>
#include <cam/ctl/ctl_backend.h>
#include <cam/ctl/ctl_ioctl.h>
#include <cam/ctl/ctl_ha.h>
#include <cam/ctl/ctl_private.h>
#include <cam/ctl/ctl_debug.h>
#include <cam/ctl/ctl_scsi_all.h>
#include <cam/ctl/ctl_error.h>
#include "ctl_ser_table.c"
Include dependency graph for ctl.c:

Go to the source code of this file.

Macros

#define CTL_CEM_LEN   (sizeof(struct scsi_control_ext_page) - 4)
 
#define CTL_LBPM_LEN   (sizeof(struct ctl_logical_block_provisioning_page) - 4)
 
#define CTL_DEFAULT_MAX_LUNS   1024
 
#define CTL_DEFAULT_MAX_PORTS   256
 
#define CTL_MAX_INITIATORS   (CTL_MAX_INIT_PER_PORT * ctl_max_ports)
 
#define SCSI_EVPD_NUM_SUPPORTED_PAGES   11
 

Functions

 __FBSDID ("$FreeBSD$")
 
 SYSCTL_NODE (_kern_cam, OID_AUTO, ctl, CTLFLAG_RD|CTLFLAG_MPSAFE, 0, "CAM Target Layer")
 
 SYSCTL_INT (_kern_cam_ctl, OID_AUTO, worker_threads, CTLFLAG_RDTUN, &worker_threads, 1, "Number of worker threads")
 
 SYSCTL_INT (_kern_cam_ctl, OID_AUTO, debug, CTLFLAG_RWTUN, &ctl_debug, 0, "Enabled debug flags")
 
 SYSCTL_INT (_kern_cam_ctl, OID_AUTO, lun_map_size, CTLFLAG_RWTUN, &ctl_lun_map_size, 0, "Size of per-port LUN map (max LUN + 1)")
 
 TUNABLE_INT ("kern.cam.ctl.max_luns", &ctl_max_luns)
 
 SYSCTL_INT (_kern_cam_ctl, OID_AUTO, max_luns, CTLFLAG_RDTUN, &ctl_max_luns, CTL_DEFAULT_MAX_LUNS, "Maximum number of LUNs")
 
 TUNABLE_INT ("kern.cam.ctl.max_ports", &ctl_max_ports)
 
 SYSCTL_INT (_kern_cam_ctl, OID_AUTO, max_ports, CTLFLAG_RDTUN, &ctl_max_ports, CTL_DEFAULT_MAX_LUNS, "Maximum number of ports")
 
static void ctl_isc_event_handler (ctl_ha_channel chanel, ctl_ha_event event, int param)
 
static void ctl_copy_sense_data (union ctl_ha_msg *src, union ctl_io *dest)
 
static void ctl_copy_sense_data_back (union ctl_io *src, union ctl_ha_msg *dest)
 
static int ctl_init (void)
 
static int ctl_shutdown (void)
 
static int ctl_open (struct cdev *dev, int flags, int fmt, struct thread *td)
 
static int ctl_close (struct cdev *dev, int flags, int fmt, struct thread *td)
 
static void ctl_serialize_other_sc_cmd (struct ctl_scsiio *ctsio)
 
static void ctl_ioctl_fill_ooa (struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries)
 
static int ctl_ioctl (struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
 
static int ctl_enable_lun (struct ctl_lun *lun)
 
static int ctl_disable_lun (struct ctl_lun *lun)
 
static int ctl_free_lun (struct ctl_lun *lun)
 
static int ctl_do_mode_select (union ctl_io *io)
 
static int ctl_pro_preempt (struct ctl_softc *softc, struct ctl_lun *lun, uint64_t res_key, uint64_t sa_res_key, uint8_t type, uint32_t residx, struct ctl_scsiio *ctsio, struct scsi_per_res_out *cdb, struct scsi_per_res_out_parms *param)
 
static void ctl_pro_preempt_other (struct ctl_lun *lun, union ctl_ha_msg *msg)
 
static void ctl_hndl_per_res_out_on_other_sc (union ctl_io *io)
 
static int ctl_inquiry_evpd_supported (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_serial (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_devid (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_eid (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_mpp (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_scsi_ports (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_sfs (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_block_limits (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_bdc (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd_lbp (struct ctl_scsiio *ctsio, int alloc_len)
 
static int ctl_inquiry_evpd (struct ctl_scsiio *ctsio)
 
static int ctl_inquiry_std (struct ctl_scsiio *ctsio)
 
static int ctl_get_lba_len (union ctl_io *io, uint64_t *lba, uint64_t *len)
 
static ctl_action ctl_extent_check (union ctl_io *io1, union ctl_io *io2, bool seq)
 
static ctl_action ctl_seq_check (union ctl_io *io1, union ctl_io *io2)
 
static ctl_action ctl_check_for_blockage (struct ctl_lun *lun, union ctl_io *pending_io, const uint8_t *serialize_row, union ctl_io *ooa_io)
 
static ctl_action ctl_check_ooa (struct ctl_lun *lun, union ctl_io *pending_io, union ctl_io **starting_io)
 
static void ctl_try_unblock_io (struct ctl_lun *lun, union ctl_io *io, bool skip)
 
static void ctl_try_unblock_others (struct ctl_lun *lun, union ctl_io *io, bool skip)
 
static int ctl_scsiio_lun_check (struct ctl_lun *lun, const struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio)
 
static void ctl_failover_lun (union ctl_io *io)
 
static void ctl_scsiio_precheck (struct ctl_scsiio *ctsio)
 
static int ctl_scsiio (struct ctl_scsiio *ctsio)
 
static int ctl_target_reset (union ctl_io *io)
 
static void ctl_do_lun_reset (struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua_type)
 
static int ctl_lun_reset (union ctl_io *io)
 
static int ctl_abort_task (union ctl_io *io)
 
static int ctl_abort_task_set (union ctl_io *io)
 
static int ctl_query_task (union ctl_io *io, int task_set)
 
static void ctl_i_t_nexus_loss (struct ctl_softc *softc, uint32_t initidx, ctl_ua_type ua_type)
 
static int ctl_i_t_nexus_reset (union ctl_io *io)
 
static int ctl_query_async_event (union ctl_io *io)
 
static void ctl_run_task (union ctl_io *io)
 
static void ctl_send_datamove_done (union ctl_io *io, int have_lock)
 
static void ctl_datamove_remote_write_cb (struct ctl_ha_dt_req *rq)
 
static int ctl_datamove_remote_dm_write_cb (union ctl_io *io, bool samethr)
 
static void ctl_datamove_remote_write (union ctl_io *io)
 
static int ctl_datamove_remote_dm_read_cb (union ctl_io *io, bool samethr)
 
static void ctl_datamove_remote_read_cb (struct ctl_ha_dt_req *rq)
 
static int ctl_datamove_remote_sgl_setup (union ctl_io *io)
 
static int ctl_datamove_remote_xfer (union ctl_io *io, unsigned command, ctl_ha_dt_cb callback)
 
static void ctl_datamove_remote_read (union ctl_io *io)
 
static void ctl_datamove_remote (union ctl_io *io)
 
static void ctl_process_done (union ctl_io *io)
 
static void ctl_thresh_thread (void *arg)
 
static void ctl_work_thread (void *arg)
 
static void ctl_enqueue_incoming (union ctl_io *io)
 
static void ctl_enqueue_rtr (union ctl_io *io)
 
static void ctl_enqueue_done (union ctl_io *io)
 
static void ctl_enqueue_isc (union ctl_io *io)
 
static const struct ctl_cmd_entryctl_get_cmd_entry (struct ctl_scsiio *ctsio, int *sa)
 
static const struct ctl_cmd_entryctl_validate_command (struct ctl_scsiio *ctsio)
 
static int ctl_cmd_applicable (uint8_t lun_type, const struct ctl_cmd_entry *entry)
 
static int ctl_ha_init (void)
 
static int ctl_ha_shutdown (void)
 
static uint64_t ctl_get_prkey (struct ctl_lun *lun, uint32_t residx)
 
static void ctl_clr_prkey (struct ctl_lun *lun, uint32_t residx)
 
static void ctl_alloc_prkey (struct ctl_lun *lun, uint32_t residx)
 
static void ctl_set_prkey (struct ctl_lun *lun, uint32_t residx, uint64_t key)
 
 MALLOC_DEFINE (M_CTL, "ctlmem", "Memory used for CTL")
 
static int ctl_module_event_handler (module_t, int, void *)
 
 DECLARE_MODULE (ctl, ctl_moduledata, SI_SUB_CONFIGURE, SI_ORDER_THIRD)
 
 MODULE_VERSION (ctl, 1)
 
static void ctl_ha_datamove (union ctl_io *io)
 
static void ctl_ha_done (union ctl_io *io)
 
static void ctl_isc_handler_finish_xfer (struct ctl_softc *ctl_softc, union ctl_ha_msg *msg_info)
 
static void ctl_isc_handler_finish_ser_only (struct ctl_softc *ctl_softc, union ctl_ha_msg *msg_info)
 
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)
 
static void ctl_isc_ha_link_up (struct ctl_softc *softc)
 
static void ctl_isc_ha_link_down (struct ctl_softc *softc)
 
static void ctl_isc_ua (struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
 
static void ctl_isc_lun_sync (struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
 
static void ctl_isc_port_sync (struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
 
static void ctl_isc_iid_sync (struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
 
static void ctl_isc_login (struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
 
static void ctl_isc_mode_sync (struct ctl_softc *softc, union ctl_ha_msg *msg, int len)
 
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)
 
static int ctl_ha_role_sysctl (SYSCTL_HANDLER_ARGS)
 
int ctl_remove_initiator (struct ctl_port *port, int iid)
 
int ctl_add_initiator (struct ctl_port *port, int iid, uint64_t wwpn, char *name)
 
static int ctl_create_iid (struct ctl_port *port, int iid, uint8_t *buf)
 
int ctl_sbuf_printf_esc (struct sbuf *sb, char *str, int size)
 
static void ctl_id_sbuf (struct ctl_devid *id, struct sbuf *sb)
 
uint32_t ctl_get_initindex (struct ctl_nexus *nexus)
 
int ctl_lun_map_init (struct ctl_port *port)
 
int ctl_lun_map_deinit (struct ctl_port *port)
 
int ctl_lun_map_set (struct ctl_port *port, uint32_t plun, uint32_t glun)
 
int ctl_lun_map_unset (struct ctl_port *port, uint32_t plun)
 
uint32_t ctl_lun_map_from_port (struct ctl_port *port, uint32_t lun_id)
 
uint32_t ctl_lun_map_to_port (struct ctl_port *port, uint32_t lun_id)
 
uint32_t ctl_decode_lun (uint64_t encoded)
 
uint64_t ctl_encode_lun (uint32_t decoded)
 
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_pool_create (struct ctl_softc *ctl_softc, const char *pool_name, uint32_t total_ctl_io, void **npool)
 
void ctl_pool_free (struct ctl_io_pool *pool)
 
union ctl_ioctl_alloc_io (void *pool_ref)
 
union ctl_ioctl_alloc_io_nowait (void *pool_ref)
 
void ctl_free_io (union ctl_io *io)
 
void ctl_zero_io (union ctl_io *io)
 
int ctl_expand_number (const char *buf, uint64_t *num)
 
static int ctl_init_page_index (struct ctl_lun *lun)
 
static int ctl_init_log_page_index (struct ctl_lun *lun)
 
static int hex2bin (const char *str, uint8_t *buf, int buf_size)
 
int ctl_add_lun (struct ctl_be_lun *be_lun)
 
int ctl_start_lun (struct ctl_be_lun *be_lun)
 
int ctl_stop_lun (struct ctl_be_lun *be_lun)
 
int ctl_lun_no_media (struct ctl_be_lun *be_lun)
 
int ctl_lun_has_media (struct ctl_be_lun *be_lun)
 
int ctl_lun_ejected (struct ctl_be_lun *be_lun)
 
int ctl_lun_primary (struct ctl_be_lun *be_lun)
 
int ctl_lun_secondary (struct ctl_be_lun *be_lun)
 
int ctl_remove_lun (struct ctl_be_lun *be_lun)
 
void ctl_lun_capacity_changed (struct ctl_be_lun *be_lun)
 
int ctl_config_move_done (union ctl_io *io, bool samethr)
 
void ctl_data_submit_done (union ctl_io *io)
 
void ctl_config_write_done (union ctl_io *io)
 
void ctl_config_read_done (union ctl_io *io)
 
int ctl_scsi_release (struct ctl_scsiio *ctsio)
 
int ctl_scsi_reserve (struct ctl_scsiio *ctsio)
 
int ctl_start_stop (struct ctl_scsiio *ctsio)
 
int ctl_prevent_allow (struct ctl_scsiio *ctsio)
 
int ctl_sync_cache (struct ctl_scsiio *ctsio)
 
int ctl_format (struct ctl_scsiio *ctsio)
 
int ctl_read_buffer (struct ctl_scsiio *ctsio)
 
int ctl_write_buffer (struct ctl_scsiio *ctsio)
 
static int ctl_write_same_cont (union ctl_io *io)
 
int ctl_write_same (struct ctl_scsiio *ctsio)
 
int ctl_unmap (struct ctl_scsiio *ctsio)
 
int ctl_default_page_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr)
 
static void ctl_ie_timer (void *arg)
 
int ctl_ie_page_handler (struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, uint8_t *page_ptr)
 
int ctl_mode_select (struct ctl_scsiio *ctsio)
 
int ctl_mode_sense (struct ctl_scsiio *ctsio)
 
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_log_sense (struct ctl_scsiio *ctsio)
 
int ctl_read_capacity (struct ctl_scsiio *ctsio)
 
int ctl_read_capacity_16 (struct ctl_scsiio *ctsio)
 
int ctl_get_lba_status (struct ctl_scsiio *ctsio)
 
int ctl_read_defect (struct ctl_scsiio *ctsio)
 
int ctl_report_ident_info (struct ctl_scsiio *ctsio)
 
int ctl_report_tagret_port_groups (struct ctl_scsiio *ctsio)
 
int ctl_report_supported_opcodes (struct ctl_scsiio *ctsio)
 
int ctl_report_supported_tmf (struct ctl_scsiio *ctsio)
 
int ctl_report_timestamp (struct ctl_scsiio *ctsio)
 
int ctl_persistent_reserve_in (struct ctl_scsiio *ctsio)
 
int ctl_persistent_reserve_out (struct ctl_scsiio *ctsio)
 
int ctl_read_write (struct ctl_scsiio *ctsio)
 
static int ctl_cnw_cont (union ctl_io *io)
 
int ctl_cnw (struct ctl_scsiio *ctsio)
 
int ctl_verify (struct ctl_scsiio *ctsio)
 
int ctl_report_luns (struct ctl_scsiio *ctsio)
 
int ctl_request_sense (struct ctl_scsiio *ctsio)
 
int ctl_tur (struct ctl_scsiio *ctsio)
 
int ctl_inquiry (struct ctl_scsiio *ctsio)
 
int ctl_get_config (struct ctl_scsiio *ctsio)
 
int ctl_get_event_status (struct ctl_scsiio *ctsio)
 
int ctl_mechanism_status (struct ctl_scsiio *ctsio)
 
static void ctl_ultomsf (uint32_t lba, uint8_t *buf)
 
int ctl_read_toc (struct ctl_scsiio *ctsio)
 
static ctl_action ctl_extent_check_lba (uint64_t lba1, uint64_t len1, uint64_t lba2, uint64_t len2, bool seq)
 
static int ctl_extent_check_unmap (union ctl_io *io, uint64_t lba2, uint64_t len2)
 
static void ctl_failover_io (union ctl_io *io, int have_lock)
 
static void ctl_abort_tasks_lun (struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, int other_sc)
 
static void ctl_handle_isc (union ctl_io *io)
 
static ctl_lun_error_pattern ctl_cmd_pattern_match (struct ctl_scsiio *ctsio, struct ctl_error_desc *desc)
 
static void ctl_inject_error (struct ctl_lun *lun, union ctl_io *io)
 
static void ctl_datamove_done_process (union ctl_io *io)
 
void ctl_datamove_done (union ctl_io *io, bool samethr)
 
void ctl_datamove (union ctl_io *io)
 
int ctl_queue_sense (union ctl_io *io)
 
int ctl_queue (union ctl_io *io)
 
int ctl_run (union ctl_io *io)
 
void ctl_serseq_done (union ctl_io *io)
 
void ctl_done (union ctl_io *io)
 

Variables

struct ctl_softccontrol_softc = NULL
 
static const struct scsi_da_rw_recovery_page rw_er_page_default
 
static const struct scsi_da_rw_recovery_page rw_er_page_changeable
 
static const struct scsi_format_page format_page_default
 
static const struct scsi_format_page format_page_changeable
 
static const struct scsi_rigid_disk_page rigid_disk_page_default
 
static const struct scsi_rigid_disk_page rigid_disk_page_changeable
 
static const struct scsi_da_verify_recovery_page verify_er_page_default
 
static const struct scsi_da_verify_recovery_page verify_er_page_changeable
 
static const struct scsi_caching_page caching_page_default
 
static const struct scsi_caching_page caching_page_changeable
 
static const struct scsi_control_page control_page_default
 
static const struct scsi_control_page control_page_changeable
 
static const struct scsi_control_ext_page control_ext_page_default
 
static const struct scsi_control_ext_page control_ext_page_changeable
 
static const struct scsi_info_exceptions_page ie_page_default
 
static const struct scsi_info_exceptions_page ie_page_changeable
 
static const struct ctl_logical_block_provisioning_page lbp_page_default
 
static const struct ctl_logical_block_provisioning_page lbp_page_changeable
 
static const struct scsi_cddvd_capabilities_page cddvd_page_default
 
static const struct scsi_cddvd_capabilities_page cddvd_page_changeable
 
static int worker_threads = -1
 
static int ctl_debug = CTL_DEBUG_NONE
 
static int ctl_lun_map_size = 1024
 
static int ctl_max_luns = CTL_DEFAULT_MAX_LUNS
 
static int ctl_max_ports = CTL_DEFAULT_MAX_PORTS
 
static struct cdevsw ctl_cdevsw
 
static moduledata_t ctl_moduledata
 
static struct ctl_frontend ha_frontend
 

Macro Definition Documentation

◆ CTL_CEM_LEN

#define CTL_CEM_LEN   (sizeof(struct scsi_control_ext_page) - 4)

Definition at line 270 of file ctl.c.

◆ CTL_DEFAULT_MAX_LUNS

#define CTL_DEFAULT_MAX_LUNS   1024

Definition at line 429 of file ctl.c.

◆ CTL_DEFAULT_MAX_PORTS

#define CTL_DEFAULT_MAX_PORTS   256

Definition at line 438 of file ctl.c.

◆ CTL_LBPM_LEN

#define CTL_LBPM_LEN   (sizeof(struct ctl_logical_block_provisioning_page) - 4)

Definition at line 309 of file ctl.c.

◆ CTL_MAX_INITIATORS

#define CTL_MAX_INITIATORS   (CTL_MAX_INIT_PER_PORT * ctl_max_ports)

Definition at line 447 of file ctl.c.

◆ SCSI_EVPD_NUM_SUPPORTED_PAGES

#define SCSI_EVPD_NUM_SUPPORTED_PAGES   11

Definition at line 456 of file ctl.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ ctl_abort_task()

◆ ctl_abort_task_set()

◆ ctl_abort_tasks_lun()

◆ ctl_add_initiator()

int ctl_add_initiator ( struct ctl_port port,
int  iid,
uint64_t  wwpn,
char *  name 
)

Definition at line 2174 of file ctl.c.

References ctl_isc_announce_iid(), ctl_softc::ctl_lock, CTL_MAX_INIT_PER_PORT, ctl_port::ctl_softc, ctl_wwpn_iid::in_use, ctl_wwpn_iid::last_use, ctl_wwpn_iid::name, ctl_port::targ_port, ctl_wwpn_iid::wwpn, and ctl_port::wwpn_iid.

Referenced by cfiscsi_session_register_initiator(), and ctlfeasync().

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

◆ ctl_add_lun()

int ctl_add_lun ( struct ctl_be_lun be_lun)

Definition at line 4571 of file ctl.c.

References ctl_lun::backend, ctl_be_lun::be, ctl_lun::be_lun, control_softc, ctl_clear_mask(), CTL_DEVID_LEN, CTL_DEVID_MIN_LEN, ctl_enable_lun(), ctl_est_ua_all(), ctl_ffz(), ctl_init_log_page_index(), ctl_init_page_index(), ctl_is_set(), ctl_softc::ctl_lock, ctl_be_lun::ctl_lun, CTL_LUN_DISABLED, CTL_LUN_EJECTED, CTL_LUN_FLAG_EJECTED, CTL_LUN_FLAG_ID_REQ, CTL_LUN_FLAG_NO_MEDIA, CTL_LUN_FLAG_PRIMARY, CTL_LUN_FLAG_STOPPED, ctl_softc::ctl_lun_mask, CTL_LUN_NO_MEDIA, CTL_LUN_PRIMARY_SC, CTL_LUN_REMOVABLE, CTL_LUN_STOPPED, ctl_softc::ctl_luns, CTL_MAX_INITIATORS, ctl_max_luns, ctl_max_ports, ctl_set_mask(), ctl_lun::ctl_softc, ctl_tpc_lun_init(), CTL_UA_LUN_CHANGE, CTL_VENDOR, ctl_devid::data, ctl_be_lun::device_id, ctl_be_lun::flags, ctl_lun::flags, hex2bin(), scsi_vpd_id_descriptor::id_type, scsi_vpd_id_descriptor::identifier, ctl_lun::ie_callout, ctl_lun::ie_reported, ctl_io_stats::item, ctl_devid::len, scsi_vpd_id_descriptor::length, ctl_lun::lun, ctl_lun::lun_devid, ctl_be_lun::lun_id, ctl_lun::lun_lock, ctl_be_lun::lun_type, ctl_softc::num_luns, ctl_be_lun::options, ctl_lun::pending_sense, ctl_lun::pending_ua, ctl_lun::pr_keys, ctl_lun::prevent, scsi_vpd_id_descriptor::proto_codeset, ctl_be_lun::req_lun_id, ctl_lun::stats, SVPD_ID_ASSOC_LUN, SVPD_ID_CODESET_ASCII, SVPD_ID_CODESET_BINARY, SVPD_ID_CODESET_UTF8, SVPD_ID_PIV, SVPD_ID_TYPE_EUI64, SVPD_ID_TYPE_NAA, SVPD_ID_TYPE_SCSI_NAME, SVPD_ID_TYPE_T10, SVPD_ID_TYPE_UUID, T_CDROM, T_CHANGER, T_DIRECT, T_PROCESSOR, T_SEQUENTIAL, scsi_vpd_id_t10::vendor, and scsi_vpd_id_t10::vendor_spec_id.

Referenced by ctl_backend_ramdisk_create(), and ctl_be_block_create().

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

◆ ctl_alloc_io()

◆ ctl_alloc_io_nowait()

union ctl_io * ctl_alloc_io_nowait ( void *  pool_ref)

Definition at line 3976 of file ctl.c.

References CTL_SOFTC, ctl_io_pool::ctl_softc, ctl_io::io_hdr, ctl_io_hdr::pool, and ctl_io_pool::zone.

Referenced by cfcs_action(), ctlfedone(), and ctlferegister().

Here is the caller graph for this function:

◆ ctl_alloc_prkey()

static void ctl_alloc_prkey ( struct ctl_lun lun,
uint32_t  residx 
)
static

Definition at line 3890 of file ctl.c.

References CTL_MAX_INIT_PER_PORT, and ctl_lun::lun.

Referenced by ctl_hndl_per_res_out_on_other_sc(), ctl_isc_lun_sync(), and ctl_persistent_reserve_out().

Here is the caller graph for this function:

◆ ctl_check_for_blockage()

◆ ctl_check_ooa()

static ctl_action ctl_check_ooa ( struct ctl_lun lun,
union ctl_io pending_io,
union ctl_io **  starting_io 
)
static

◆ 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_close()

static int ctl_close ( struct cdev *  dev,
int  flags,
int  fmt,
struct thread *  td 
)
static

Definition at line 2135 of file ctl.c.

◆ ctl_clr_prkey()

static void ctl_clr_prkey ( struct ctl_lun lun,
uint32_t  residx 
)
static

Definition at line 3879 of file ctl.c.

References CTL_MAX_INIT_PER_PORT, and ctl_lun::lun.

Referenced by ctl_hndl_per_res_out_on_other_sc(), ctl_isc_lun_sync(), ctl_persistent_reserve_out(), ctl_pro_preempt(), and ctl_pro_preempt_other().

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_cmd_applicable()

static int ctl_cmd_applicable ( uint8_t  lun_type,
const struct ctl_cmd_entry entry 
)
static

Definition at line 11756 of file ctl.c.

References CTL_CMD_FLAG_OK_ON_CDROM, CTL_CMD_FLAG_OK_ON_DIRECT, CTL_CMD_FLAG_OK_ON_PROC, ctl_cmd_entry::flags, T_CDROM, T_DIRECT, and T_PROCESSOR.

Referenced by ctl_report_supported_opcodes(), and ctl_scsiio_precheck().

Here is the caller graph for this function:

◆ ctl_cmd_pattern_match()

static ctl_lun_error_pattern ctl_cmd_pattern_match ( struct ctl_scsiio ctsio,
struct ctl_error_desc desc 
)
static

◆ ctl_cnw()

◆ ctl_cnw_cont()

◆ 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_copy_sense_data()

static void ctl_copy_sense_data ( union ctl_ha_msg src,
union ctl_io dest 
)
static

◆ ctl_copy_sense_data_back()

static void ctl_copy_sense_data_back ( union ctl_io src,
union ctl_ha_msg dest 
)
static

◆ ctl_create_iid()

◆ 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_datamove_done_process()

◆ ctl_datamove_remote()

◆ ctl_datamove_remote_dm_read_cb()

static int ctl_datamove_remote_dm_read_cb ( union ctl_io io,
bool  samethr 
)
static

Definition at line 12719 of file ctl.c.

References CTL_LSGL, CTL_LSGLT, CTL_RSGL, ctl_send_datamove_done(), ctl_scsiio::kern_sg_entries, and ctl_io::scsiio.

Referenced by ctl_datamove_remote_read_cb().

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

◆ ctl_datamove_remote_dm_write_cb()

static int ctl_datamove_remote_dm_write_cb ( union ctl_io io,
bool  samethr 
)
static

Definition at line 12680 of file ctl.c.

References ctl_datamove_remote_write_cb(), ctl_datamove_remote_xfer(), and CTL_HA_DT_CMD_WRITE.

Referenced by ctl_datamove_remote_write().

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

◆ ctl_datamove_remote_read()

static void ctl_datamove_remote_read ( union ctl_io io)
static

Definition at line 12927 of file ctl.c.

References ctl_sg_entry::addr, ctl_datamove_remote_read_cb(), ctl_datamove_remote_sgl_setup(), ctl_datamove_remote_xfer(), CTL_HA_DT_CMD_READ, CTL_LSGL, CTL_LSGLT, CTL_RSGL, ctl_scsiio::kern_sg_entries, and ctl_io::scsiio.

Referenced by ctl_datamove_remote().

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

◆ ctl_datamove_remote_read_cb()

static void ctl_datamove_remote_read_cb ( struct ctl_ha_dt_req rq)
static

Definition at line 12739 of file ctl.c.

References ctl_scsiio::be_move_done, ctl_ha_dt_req::context, ctl_datamove_remote_dm_read_cb(), ctl_dt_req_free(), CTL_HA_STATUS_SUCCESS, CTL_LSGL, CTL_PORT, ctl_set_internal_failure(), ctl_scsiio::kern_data_ptr, ctl_ha_dt_req::ret, and ctl_io::scsiio.

Referenced by ctl_datamove_remote_read().

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

◆ ctl_datamove_remote_sgl_setup()

static int ctl_datamove_remote_sgl_setup ( union ctl_io io)
static

◆ ctl_datamove_remote_write()

static void ctl_datamove_remote_write ( union ctl_io io)
static

Definition at line 12690 of file ctl.c.

References ctl_scsiio::be_move_done, ctl_datamove_remote_dm_write_cb(), ctl_datamove_remote_sgl_setup(), CTL_LSGL, CTL_PORT, ctl_scsiio::kern_data_ptr, and ctl_io::scsiio.

Referenced by ctl_datamove_remote().

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

◆ ctl_datamove_remote_write_cb()

static void ctl_datamove_remote_write_cb ( struct ctl_ha_dt_req rq)
static

Definition at line 12645 of file ctl.c.

References ctl_ha_dt_req::context, ctl_dt_req_free(), CTL_HA_STATUS_SUCCESS, CTL_LSGL, CTL_LSGLT, CTL_RSGL, ctl_send_datamove_done(), ctl_set_internal_failure(), ctl_scsiio::kern_sg_entries, ctl_ha_dt_req::ret, and ctl_io::scsiio.

Referenced by ctl_datamove_remote_dm_write_cb().

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

◆ ctl_datamove_remote_xfer()

◆ 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_disable_lun()

static int ctl_disable_lun ( struct ctl_lun lun)
static

◆ ctl_do_lun_reset()

static void ctl_do_lun_reset ( struct ctl_lun lun,
uint32_t  initidx,
ctl_ua_type  ua_type 
)
static

◆ ctl_do_mode_select()

◆ 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_enable_lun()

static int ctl_enable_lun ( struct ctl_lun lun)
static

◆ 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_enqueue_done()

static void ctl_enqueue_done ( union ctl_io io)
static

Definition at line 13624 of file ctl.c.

References CTL_SOFTC, ctl_io::io_hdr, ctl_io_hdr::nexus, ctl_thread::queue_lock, ctl_nexus::targ_mapped_lun, ctl_softc::threads, and worker_threads.

Referenced by ctl_done().

Here is the caller graph for this function:

◆ ctl_enqueue_incoming()

static void ctl_enqueue_incoming ( union ctl_io io)
static

Definition at line 13595 of file ctl.c.

References CTL_SOFTC, ctl_nexus::initid, ctl_io::io_hdr, ctl_io_hdr::nexus, ctl_thread::queue_lock, ctl_nexus::targ_port, ctl_softc::threads, and worker_threads.

Referenced by ctl_queue().

Here is the caller graph for this function:

◆ ctl_enqueue_isc()

static void ctl_enqueue_isc ( union ctl_io io)
static

◆ ctl_enqueue_rtr()

static void ctl_enqueue_rtr ( union ctl_io io)
static

◆ 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_extent_check()

static ctl_action ctl_extent_check ( union ctl_io io1,
union ctl_io io2,
bool  seq 
)
static

Definition at line 10952 of file ctl.c.

References CTL_ACTION_SKIP, ctl_extent_check_lba(), ctl_extent_check_unmap(), CTL_FLAG_SERSEQ_DONE, ctl_get_lba_len(), ctl_io_hdr::flags, and ctl_io::io_hdr.

Referenced by ctl_check_for_blockage().

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

◆ ctl_extent_check_lba()

static ctl_action ctl_extent_check_lba ( uint64_t  lba1,
uint64_t  len1,
uint64_t  lba2,
uint64_t  len2,
bool  seq 
)
static

Definition at line 10903 of file ctl.c.

References CTL_ACTION_BLOCK, and CTL_ACTION_PASS.

Referenced by ctl_cmd_pattern_match(), and ctl_extent_check().

Here is the caller graph for this function:

◆ ctl_extent_check_unmap()

static int ctl_extent_check_unmap ( union ctl_io io,
uint64_t  lba2,
uint64_t  len2 
)
static

◆ ctl_failover_io()

static void ctl_failover_io ( union ctl_io io,
int  have_lock 
)
static

Definition at line 11399 of file ctl.c.

References ctl_done(), ctl_set_busy(), and ctl_io::scsiio.

Referenced by ctl_datamove_remote(), and ctl_send_datamove_done().

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

◆ ctl_failover_lun()

◆ 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_format()

◆ ctl_free_io()

◆ ctl_free_lun()

static int ctl_free_lun ( struct ctl_lun lun)
static

Definition at line 4810 of file ctl.c.

References ctl_clear_mask(), ctl_est_ua_all(), ctl_softc::ctl_lock, ctl_softc::ctl_lun_mask, ctl_softc::ctl_luns, ctl_max_ports, ctl_lun::ctl_softc, ctl_tpc_lun_shutdown(), CTL_UA_LUN_CHANGE, ctl_lun::lun, ctl_lun::lun_lock, and ctl_softc::num_luns.

Referenced by ctl_process_done(), and ctl_remove_lun().

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

◆ ctl_get_cmd_entry()

const struct ctl_cmd_entry * ctl_get_cmd_entry ( struct ctl_scsiio ctsio,
int *  sa 
)
static

◆ ctl_get_config()

◆ ctl_get_event_status()

◆ ctl_get_initindex()

◆ ctl_get_lba_len()

◆ ctl_get_lba_status()

◆ ctl_get_prkey()

static uint64_t ctl_get_prkey ( struct ctl_lun lun,
uint32_t  residx 
)
static

◆ ctl_ha_datamove()

◆ ctl_ha_done()

◆ ctl_ha_init()

static int ctl_ha_init ( void  )
static

◆ ctl_ha_role_sysctl()

static int ctl_ha_role_sysctl ( SYSCTL_HANDLER_ARGS  )
static

◆ ctl_ha_shutdown()

static int ctl_ha_shutdown ( void  )
static

◆ ctl_handle_isc()

◆ ctl_hndl_per_res_out_on_other_sc()

◆ ctl_i_t_nexus_loss()

static void ctl_i_t_nexus_loss ( struct ctl_softc softc,
uint32_t  initidx,
ctl_ua_type  ua_type 
)
static

◆ ctl_i_t_nexus_reset()

◆ ctl_id_sbuf()

◆ ctl_ie_log_sense_handler()

◆ ctl_ie_page_handler()

◆ ctl_ie_timer()

static void ctl_ie_timer ( void *  arg)
static

Definition at line 5963 of file ctl.c.

References ctl_est_ua_all(), CTL_UA_IE, ctl_lun::lun, scsi_4btoul(), and SIEP_MRIE_UA.

Referenced by ctl_ie_page_handler().

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

◆ ctl_init()

◆ ctl_init_log_page_index()

◆ ctl_init_page_index()

static int ctl_init_page_index ( struct ctl_lun lun)
static

Definition at line 4070 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::blocksize, scsi_format_page::bytes_per_sector, ctl_mode_pages::caching_page, caching_page_changeable, caching_page_default, ctl_mode_pages::cddvd_page, cddvd_page_changeable, cddvd_page_default, ctl_mode_pages::control_ext_page, control_ext_page_changeable, control_ext_page_default, ctl_mode_pages::control_page, control_page_changeable, control_page_default, CTL_DEFAULT_HEADS, CTL_DEFAULT_SECTORS_PER_TRACK, ctl_expand_number(), CTL_LBP_EXPONENT, CTL_NUM_MODE_PAGES, CTL_PAGE_CHANGEABLE, CTL_PAGE_CURRENT, CTL_PAGE_DEFAULT, CTL_PAGE_FLAG_CDROM, CTL_PAGE_FLAG_DIRECT, CTL_PAGE_FLAG_PROC, CTL_PAGE_SAVED, scsi_rigid_disk_page::cylinders, scsi_caching_page::flags1, ctl_mode_pages::format_page, format_page_changeable, format_page_default, ctl_mode_pages::ie_page, ie_page_changeable, ie_page_default, ctl_mode_pages::index, ctl_mode_pages::lbp_page, lbp_page_changeable, lbp_page_default, ctl_be_lun::lun_type, ctl_be_lun::maxlba, ctl_lun::mode_pages, ctl_be_lun::options, ctl_page_index::page_code, scsi_control_page::page_code, scsi_caching_page::page_code, scsi_format_page::page_code, scsi_rigid_disk_page::page_code, ctl_page_index::page_data, ctl_page_index::page_flags, page_index_template, scsi_control_page::queue_flags, ctl_mode_pages::rigid_disk_page, rigid_disk_page_changeable, rigid_disk_page_default, scsi_rigid_disk_page::rotation_rate, ctl_mode_pages::rw_er_page, rw_er_page_changeable, rw_er_page_default, SCP_QUEUE_ALG_UNRESTRICTED, SCP_RCD, scsi_ulto2b(), scsi_ulto3b(), scsi_ulto4b(), SLBPPD_ARMING_DEC, SLBPPD_ARMING_INC, SLBPPD_ENABLED, SMPH_PC_MASK, SMS_CACHING_PAGE, SMS_CDDVD_CAPS_PAGE, SMS_CONTROL_MODE_PAGE, SMS_FORMAT_DEVICE_PAGE, SMS_INFO_EXCEPTIONS_PAGE, SMS_RIGID_DISK_PAGE, SMS_RW_ERROR_RECOVERY_PAGE, SMS_SUBPAGE_PAGE_0, SMS_VERIFY_ERROR_RECOVERY_PAGE, ctl_page_index::subpage, T_CDROM, T_DIRECT, T_PROCESSOR, ctl_mode_pages::verify_er_page, verify_er_page_changeable, and verify_er_page_default.

Referenced by ctl_add_lun(), and ctl_mode_select().

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

◆ ctl_inject_error()

◆ ctl_inquiry()

int ctl_inquiry ( struct ctl_scsiio ctsio)

◆ ctl_inquiry_evpd()

◆ ctl_inquiry_evpd_bdc()

◆ ctl_inquiry_evpd_block_limits()

static int ctl_inquiry_evpd_block_limits ( struct ctl_scsiio ctsio,
int  alloc_len 
)
static

Definition at line 9923 of file ctl.c.

References scsi_vpd_block_limits::atomic_alignment, scsi_vpd_block_limits::atomic_transfer_length_granularity, ctl_be_lun::atomicblock, ctl_lun::be_lun, ctl_scsiio::be_move_done, ctl_config_move_done(), ctl_datamove(), ctl_expand_number(), CTL_FLAG_ALLOCATED, CTL_LUN, CTL_LUN_FLAG_UNMAP, CTL_RETVAL_COMPLETE, ctl_set_success(), scsi_vpd_block_limits::device, ctl_be_lun::flags, ctl_io_hdr::flags, scsi_vpd_block_limits::flags, ctl_scsiio::io_hdr, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_scsiio::kern_total_len, ctl_lun::lun, ctl_be_lun::lun_type, scsi_vpd_block_limits::max_atomic_boundary_size, scsi_vpd_block_limits::max_atomic_transfer_length, scsi_vpd_block_limits::max_atomic_transfer_length_with_atomic_boundary, scsi_vpd_block_limits::max_cmp_write_len, scsi_vpd_block_limits::max_txfer_len, scsi_vpd_block_limits::max_unmap_blk_cnt, scsi_vpd_block_limits::max_unmap_lba_cnt, scsi_vpd_block_limits::max_write_same_length, ctl_be_lun::maxlba, scsi_vpd_block_limits::opt_txfer_len, scsi_vpd_block_limits::opt_unmap_grain, ctl_be_lun::options, ctl_be_lun::opttxferlen, scsi_vpd_block_limits::page_code, scsi_vpd_block_limits::page_length, scsi_u64to8b(), scsi_ulto2b(), scsi_ulto4b(), SID_QUAL_LU_CONNECTED, SID_QUAL_LU_OFFLINE, SVPD_BL_WSNZ, SVPD_BLOCK_LIMITS, T_DIRECT, ctl_be_lun::ublockexp, ctl_be_lun::ublockoff, and scsi_vpd_block_limits::unmap_grain_align.

Referenced by ctl_inquiry_evpd().

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

◆ 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_std()

static int ctl_inquiry_std ( struct ctl_scsiio ctsio)
static

Definition at line 10168 of file ctl.c.

References scsi_inquiry_data::additional_length, ctl_lun::be_lun, ctl_scsiio::be_move_done, ctl_scsiio::cdb, CTL_CDROM_PRODUCT, ctl_config_move_done(), ctl_datamove(), CTL_DEBUG_PRINT, CTL_DIRECT_PRODUCT, CTL_FLAG_ALLOCATED, CTL_HA_LINK_UNKNOWN, CTL_LUN, CTL_LUN_PRIMARY_SC, CTL_LUN_REMOVABLE, CTL_PORT, CTL_PORT_FC, CTL_PORT_INTERNAL, CTL_PORT_IOCTL, CTL_PORT_ISCSI, CTL_PORT_SAS, CTL_PORT_SCSI, CTL_PORT_UMASS, CTL_PROCESSOR_PRODUCT, CTL_RETVAL_COMPLETE, ctl_set_success(), CTL_SOFTC, CTL_UNKNOWN_PRODUCT, CTL_VENDOR, scsi_inquiry_data::dev_qual2, scsi_inquiry_data::device, ctl_io_hdr::flags, ctl_lun::flags, scsi_inquiry_data::flags, ctl_softc::ha_link, ctl_scsiio::io_hdr, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_scsiio::kern_total_len, scsi_inquiry::length, ctl_lun::lun, ctl_be_lun::lun_type, ctl_be_lun::options, ctl_port::port_type, scsi_inquiry_data::product, scsi_inquiry_data::response_format, scsi_inquiry_data::revision, scsi_2btoul(), SCSI_REV_SPC5, scsi_ulto2b(), SID_CmdQue, SID_HiSup, SID_QUAL_BAD_LU, SID_QUAL_LU_CONNECTED, SID_QUAL_LU_OFFLINE, SID_RMB, SID_SPI_CLOCK_DT_ST, SID_SPI_IUS, SID_SPI_QAS, SID_Sync, SID_WBus16, scsi_inquiry_data::spc2_flags, SPC2_SID_ADDR16, SPC2_SID_MultiP, scsi_inquiry_data::spc3_flags, SPC3_SID_3PC, SPC3_SID_TPGS_IMPLICIT, scsi_inquiry_data::spi3data, T_CDROM, T_DIRECT, T_NODEVICE, T_PROCESSOR, scsi_inquiry_data::vendor, scsi_inquiry_data::version, scsi_inquiry_data::version1, scsi_inquiry_data::version2, scsi_inquiry_data::version3, and scsi_inquiry_data::version4.

Referenced by ctl_inquiry().

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

◆ ctl_ioctl()

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

Definition at line 2596 of file ctl.c.

References ctl_ooa::alloc_len, ctl_lun_list::alloc_len, ctl_ooa::alloc_num, ctl_lun_req::args, ctl_req::args, ctl_lun_req::args_len, ctl_req::args_len, ctl_lun_req::args_nvl, ctl_req::args_nvl, ctl_lun_req::backend, ctl_lun::backend, ctl_lun::be_lun, ctl_be_lun::blocksize, ctl_backend_find(), CTL_DELAY_IO, CTL_DELAY_LOC_DATAMOVE, CTL_DELAY_LOC_DONE, CTL_DELAY_STATUS_INVALID_LOC, CTL_DELAY_STATUS_INVALID_LUN, CTL_DELAY_STATUS_INVALID_TYPE, CTL_DELAY_STATUS_NOT_IMPLEMENTED, CTL_DELAY_STATUS_OK, CTL_DELAY_TYPE_CONT, CTL_DELAY_TYPE_ONESHOT, CTL_DISABLE_PORT, CTL_DUMP_STRUCTS, CTL_ENABLE_PORT, CTL_ERROR_INJECT, CTL_ERROR_INJECT_DELETE, ctl_est_ua_port(), ctl_frontend_find(), CTL_GET_LUN_STATS, CTL_GET_OOA, CTL_GET_PORT_STATS, ctl_id_sbuf(), CTL_IO, ctl_ioctl_fill_ooa(), ctl_ioctl_io(), ctl_isc_announce_port(), CTL_ISCSI, CTL_ISCSI_ERROR, ctl_softc::ctl_lock, CTL_LUN_DISABLED, CTL_LUN_ERROR, CTL_LUN_LIST, CTL_LUN_LIST_ERROR, CTL_LUN_LIST_NEED_MORE_SPACE, CTL_LUN_LIST_OK, CTL_LUN_MAP, ctl_lun_map_deinit(), ctl_lun_map_from_port(), ctl_lun_map_init(), ctl_lun_map_set(), ctl_lun_map_to_port(), ctl_lun_map_unset(), CTL_LUN_REQ, ctl_softc::ctl_luns, CTL_MAX_INIT_PER_PORT, ctl_max_luns, ctl_max_ports, CTL_OOA_FLAG_ALL_LUNS, CTL_OOA_NEED_MORE_SPACE, CTL_OOA_OK, CTL_PORT_LIST, CTL_PORT_NONE, ctl_port_offline(), ctl_port_online(), CTL_PORT_REQ, ctl_port_set_wwns(), CTL_PORT_STATUS_ONLINE, CTL_PORT_WWNN_VALID, CTL_PORT_WWPN_VALID, ctl_softc::ctl_ports, ctl_sbuf_printf_esc(), CTL_SET_PORT_WWNS, CTL_SS_NEED_MORE_SPACE, CTL_SS_OK, CTL_STATS_FLAG_NONE, CTL_STATS_FLAG_TIME_VALID, CTL_UA_LUN_CHANGE, ctl_ooa::cur_bt, ctl_lun_delay_info::datamove_delay, ctl_lun_delay_info::datamove_type, ctl_lun::delay_info, ctl_io_delay_info::delay_loc, ctl_io_delay_info::delay_secs, ctl_io_delay_info::delay_type, ctl_softc::dev, ctl_be_lun::device_id, ctl_lun_delay_info::done_delay, ctl_lun_delay_info::done_type, ctl_req::driver, ctl_ooa::dropped_num, ctl_ooa::entries, ctl_lun::error_serial, ctl_lun_req::error_str, ctl_lun_list::error_str, ctl_req::error_str, ctl_iscsi::error_str, ctl_frontend::fe_dump, ctl_ooa::fill_len, ctl_lun_list::fill_len, ctl_ooa::fill_num, ctl_port_entry::flags, ctl_ooa::flags, ctl_lun::flags, ctl_port::frontend, ctl_wwpn_iid::in_use, ctl_backend_driver::ioctl, ctl_frontend::ioctl, ctl_lun_map::lun, ctl_lun::lun, ctl_io_delay_info::lun_id, ctl_error_desc::lun_id, ctl_backend_driver::lun_info, ctl_lun::lun_lock, ctl_port::lun_map, ctl_port::lun_map_size, ctl_ooa::lun_num, ctl_be_lun::lun_type, ctl_lun_list::lun_xml, ctl_be_lun::maxlba, ctl_backend_driver::name, ctl_wwpn_iid::name, ctl_frontend::name, ctl_softc::num_luns, ctl_softc::num_ports, ctl_port::onoff_arg, ctl_be_lun::options, ctl_port::options, ctl_port::physical_port, ctl_lun_map::plun, ctl_lun_map::port, ctl_port::port_devid, ctl_port::port_info, ctl_softc::port_max, ctl_softc::port_min, ctl_port::port_name, ctl_port_entry::port_type, ctl_port::port_type, ctl_lun::pr_keys, ctl_lun_req::result, ctl_req::result, ctl_lun_req::result_len, ctl_req::result_len, ctl_lun_req::result_nvl, ctl_req::result_nvl, ctl_error_desc::serial, ctl_be_lun::serial_num, ctl_port::stats, ctl_get_io_stats::stats, ctl_lun::stats, ctl_port::status, ctl_io_delay_info::status, ctl_ooa::status, ctl_lun_req::status, ctl_lun_list::status, ctl_req::status, ctl_iscsi::status, ctl_port_entry::targ_port, ctl_port::targ_port, ctl_port::target_devid, ctl_port::virtual_port, ctl_port_entry::wwnn, ctl_port::wwnn, ctl_port_entry::wwpn, ctl_wwpn_iid::wwpn, ctl_port::wwpn, and ctl_port::wwpn_iid.

Here is the call graph for this function:

◆ ctl_ioctl_fill_ooa()

◆ 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_isc_event_handler()

static void ctl_isc_event_handler ( ctl_ha_channel  chanel,
ctl_ha_event  event,
int  param 
)
static

Definition at line 1488 of file ctl.c.

References ctl_sg_entry::addr, ctl_scsiio::cdb, ctl_ha_msg_scsi::cdb, ctl_scsiio::cdb_len, ctl_ha_msg_scsi::cdb_len, control_softc, ctl_alloc_io(), ctl_copy_sense_data(), CTL_DEBUG_PRINT, ctl_enqueue_isc(), CTL_FLAG_BUS_ADDR, CTL_FLAG_DATA_MASK, CTL_FLAG_FROM_OTHER_SC, CTL_FLAG_INT_COPY, CTL_FLAG_IO_ACTIVE, CTL_FLAG_STATUS_SENT, ctl_get_cmd_entry(), CTL_HA_CHAN_CTL, CTL_HA_DATAMOVE_SEGMENT, CTL_HA_EVT_LINK_CHANGE, CTL_HA_EVT_MSG_RECV, CTL_HA_LINK_ONLINE, CTL_HA_MODE_XFER, ctl_ha_msg_abort(), ctl_ha_msg_recv(), CTL_HA_STATUS_SUCCESS, CTL_IO_SCSI, CTL_IO_TASK, ctl_isc_ha_link_down(), ctl_isc_ha_link_up(), ctl_isc_handler_finish_ser_only(), ctl_isc_handler_finish_xfer(), ctl_isc_iid_sync(), ctl_isc_login(), ctl_isc_lun_sync(), ctl_isc_mode_sync(), ctl_isc_port_sync(), ctl_isc_ua(), CTL_LSGL, CTL_MAX_CDBLEN, CTL_MSG_BAD_JUJU, CTL_MSG_DATAMOVE, CTL_MSG_DATAMOVE_DONE, CTL_MSG_FINISH_IO, CTL_MSG_IID_SYNC, CTL_MSG_LOGIN, CTL_MSG_LUN_SYNC, CTL_MSG_MANAGE_TASKS, CTL_MSG_MODE_SYNC, CTL_MSG_PERS_ACTION, CTL_MSG_PORT_SYNC, CTL_MSG_R2R, CTL_MSG_SERIALIZE, CTL_MSG_UA, CTL_RSGL, ctl_run_task(), CTL_STATUS_NONE, CTL_SUCCESS, ctl_zero_io(), ctl_ha_msg_dt::cur_sg_entries, ctl_io_hdr::dma_start_bt, ctl_ha_msg::dt, ctl_io_hdr::flags, ctl_ha_msg_dt::flags, ctl_cmd_entry::flags, ctl_softc::ha_link, ctl_softc::ha_mode, ctl_ha_msg::hdr, ctl_taskio::io_hdr, ctl_io::io_hdr, ctl_io_hdr::io_type, ctl_scsiio::kern_data_len, ctl_ha_msg_dt::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_data_resid, ctl_ha_msg_dt::kern_data_resid, ctl_ha_msg_scsi::kern_data_resid, ctl_scsiio::kern_rel_offset, ctl_ha_msg_dt::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_ha_msg_dt::kern_sg_entries, ctl_scsiio::kern_total_len, ctl_ha_msg_dt::kern_total_len, ctl_sg_entry::len, ctl_io_hdr::msg_type, ctl_ha_msg_hdr::msg_type, ctl_io_hdr::nexus, ctl_ha_msg_hdr::nexus, ctl_ha_msg_hdr::original_sc, ctl_softc::othersc_pool, ctl_io_hdr::port_status, ctl_ha_msg_scsi::port_status, ctl_ha_msg::pr, ctl_scsiio::priority, ctl_ha_msg_scsi::priority, ctl_scsiio::rem_sg_entries, ctl_io_hdr::remote_io, ctl_ha_msg::scsi, ctl_scsiio::scsi_status, ctl_ha_msg_scsi::scsi_status, ctl_io::scsiio, ctl_scsiio::sense_data, ctl_ha_msg_scsi::sense_data, ctl_scsiio::sense_len, ctl_ha_msg_scsi::sense_len, ctl_ha_msg_dt::sent_sg_entries, ctl_ha_msg_hdr::serializing_sc, ctl_ha_msg_dt::sg_last, ctl_ha_msg_dt::sg_list, ctl_ha_msg_dt::sg_sequence, ctl_io_hdr::start_bt, ctl_io_hdr::start_time, ctl_io_hdr::status, ctl_ha_msg_hdr::status, ctl_scsiio::tag_num, ctl_taskio::tag_num, ctl_ha_msg_scsi::tag_num, ctl_ha_msg_task::tag_num, ctl_scsiio::tag_type, ctl_taskio::tag_type, ctl_ha_msg_scsi::tag_type, ctl_ha_msg_task::tag_type, ctl_ha_msg::task, ctl_taskio::task_action, and ctl_ha_msg_task::task_action.

Referenced by ctl_ha_init().

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

◆ ctl_isc_ha_link_down()

◆ ctl_isc_ha_link_up()

◆ ctl_isc_handler_finish_ser_only()

static void ctl_isc_handler_finish_ser_only ( struct ctl_softc ctl_softc,
union ctl_ha_msg msg_info 
)
static

Definition at line 814 of file ctl.c.

References ctl_enqueue_isc(), CTL_MSG_FINISH_IO, ctl_ha_msg::hdr, ctl_scsiio::io_hdr, ctl_io_hdr::msg_type, ctl_io::scsiio, and ctl_ha_msg_hdr::serializing_sc.

Referenced by ctl_isc_event_handler().

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

◆ ctl_isc_handler_finish_xfer()

static void ctl_isc_handler_finish_xfer ( struct ctl_softc ctl_softc,
union ctl_ha_msg msg_info 
)
static

◆ ctl_isc_iid_sync()

static void ctl_isc_iid_sync ( struct ctl_softc softc,
union ctl_ha_msg msg,
int  len 
)
static

◆ ctl_isc_login()

static void ctl_isc_login ( struct ctl_softc softc,
union ctl_ha_msg msg,
int  len 
)
static

◆ ctl_isc_lun_sync()

◆ ctl_isc_mode_sync()

◆ ctl_isc_port_sync()

◆ ctl_isc_ua()

◆ ctl_lbp_log_sense_handler()

◆ ctl_log_sense()

◆ ctl_lun_capacity_changed()

void ctl_lun_capacity_changed ( struct ctl_be_lun be_lun)

Definition at line 5073 of file ctl.c.

References ctl_lun::be_lun, ctl_est_ua_all(), CTL_HA_CHAN_CTL, CTL_HA_MODE_XFER, ctl_ha_msg_send(), ctl_be_lun::ctl_lun, CTL_MSG_UA, CTL_UA_CAPACITY_CHANGE, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_modify(), and ctl_be_block_modify().

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

◆ ctl_lun_ejected()

int ctl_lun_ejected ( struct ctl_be_lun be_lun)

Definition at line 5004 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, CTL_LUN_EJECTED, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_config_write(), and ctl_be_block_config_write().

Here is the caller graph for this function:

◆ ctl_lun_has_media()

int ctl_lun_has_media ( struct ctl_be_lun be_lun)

◆ ctl_lun_map_deinit()

int ctl_lun_map_deinit ( struct ctl_port port)

Definition at line 3659 of file ctl.c.

References ctl_isc_announce_port(), CTL_PORT_STATUS_ONLINE, ctl_port::ctl_softc, ctl_lun::lun, ctl_port::lun_enable, ctl_port::lun_map, ctl_port::lun_map_size, ctl_port::status, and ctl_port::targ_lun_arg.

Referenced by ctl_ioctl(), and ctl_port_deregister().

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

◆ ctl_lun_map_from_port()

uint32_t ctl_lun_map_from_port ( struct ctl_port port,
uint32_t  lun_id 
)

Definition at line 3720 of file ctl.c.

References ctl_port::lun_map, and ctl_port::lun_map_size.

Referenced by ctl_ioctl(), ctl_port_offline(), ctl_port_online(), ctl_queue(), ctl_queue_sense(), ctl_report_luns(), and ctl_run().

Here is the caller graph for this function:

◆ ctl_lun_map_init()

int ctl_lun_map_init ( struct ctl_port port)

Definition at line 3630 of file ctl.c.

References ctl_isc_announce_port(), ctl_lun_map_size, CTL_PORT_STATUS_ONLINE, ctl_port::ctl_softc, ctl_lun::lun, ctl_port::lun_disable, ctl_port::lun_map, ctl_port::lun_map_size, ctl_port::status, and ctl_port::targ_lun_arg.

Referenced by ctl_ioctl(), and ctl_lun_map_set().

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

◆ ctl_lun_map_set()

int ctl_lun_map_set ( struct ctl_port port,
uint32_t  plun,
uint32_t  glun 
)

Definition at line 3680 of file ctl.c.

References ctl_isc_announce_port(), ctl_lun_map_init(), CTL_PORT_STATUS_ONLINE, ctl_port::lun_enable, ctl_port::lun_map, ctl_port::lun_map_size, ctl_port::status, and ctl_port::targ_lun_arg.

Referenced by ctl_ioctl().

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

◆ ctl_lun_map_to_port()

uint32_t ctl_lun_map_to_port ( struct ctl_port port,
uint32_t  lun_id 
)

◆ ctl_lun_map_unset()

int ctl_lun_map_unset ( struct ctl_port port,
uint32_t  plun 
)

Definition at line 3703 of file ctl.c.

References ctl_isc_announce_port(), CTL_PORT_STATUS_ONLINE, ctl_port::lun_disable, ctl_port::lun_map, ctl_port::lun_map_size, ctl_port::status, and ctl_port::targ_lun_arg.

Referenced by ctl_ioctl().

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

◆ ctl_lun_no_media()

int ctl_lun_no_media ( struct ctl_be_lun be_lun)

Definition at line 4965 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, CTL_LUN_NO_MEDIA, and ctl_lun::lun.

Referenced by ctl_be_block_config_write(), ctl_be_block_modify(), and ctl_be_block_rm().

Here is the caller graph for this function:

◆ ctl_lun_primary()

int ctl_lun_primary ( struct ctl_be_lun be_lun)

Definition at line 5015 of file ctl.c.

References ctl_lun::be_lun, ctl_est_ua_all(), ctl_isc_announce_lun(), ctl_be_lun::ctl_lun, CTL_LUN_PRIMARY_SC, CTL_UA_ASYM_ACC_CHANGE, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_modify(), and ctl_be_block_modify().

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

◆ ctl_lun_reset()

◆ ctl_lun_secondary()

int ctl_lun_secondary ( struct ctl_be_lun be_lun)

Definition at line 5028 of file ctl.c.

References ctl_lun::be_lun, ctl_est_ua_all(), ctl_isc_announce_lun(), ctl_be_lun::ctl_lun, CTL_UA_ASYM_ACC_CHANGE, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_modify(), and ctl_be_block_modify().

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

◆ ctl_mechanism_status()

◆ ctl_mode_select()

◆ ctl_mode_sense()

int ctl_mode_sense ( struct ctl_scsiio ctsio)

Definition at line 6395 of file ctl.c.

References ctl_lun::be_lun, ctl_scsiio::be_move_done, scsi_mode_hdr_6::block_descr_len, scsi_mode_hdr_10::block_descr_len, scsi_mode_block_descr::block_len, scsi_mode_block_descr_dshort::block_len, scsi_mode_block_descr_dlong::block_len, ctl_be_lun::blocksize, scsi_mode_sense_6::byte2, scsi_mode_sense_10::byte2, ctl_scsiio::cdb, ctl_config_move_done(), ctl_datamove(), CTL_DEBUG_PRINT, ctl_done(), CTL_FLAG_ALLOCATED, CTL_LUN, CTL_LUN_FLAG_READONLY, CTL_NUM_MODE_PAGES, CTL_PAGE_FLAG_CDROM, CTL_PAGE_FLAG_DIRECT, CTL_PAGE_FLAG_PROC, CTL_RETVAL_COMPLETE, ctl_set_invalid_field(), ctl_set_invalid_opcode(), ctl_set_success(), scsi_mode_hdr_6::datalen, scsi_mode_hdr_10::datalen, scsi_mode_hdr_6::dev_specific, scsi_mode_hdr_10::dev_specific, ctl_be_lun::flags, ctl_io_hdr::flags, scsi_mode_hdr_10::flags, ctl_mode_pages::index, ctl_scsiio::io_hdr, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_scsiio::kern_total_len, scsi_mode_sense_6::length, scsi_mode_sense_10::length, ctl_lun::lun, ctl_be_lun::lun_type, ctl_be_lun::maxlba, ctl_lun::mode_pages, MODE_SENSE_10, MODE_SENSE_6, scsi_mode_block_descr_dshort::num_blocks, scsi_mode_block_descr_dlong::num_blocks, scsi_mode_sense_6::page, scsi_mode_sense_10::page, ctl_page_index::page_code, ctl_page_index::page_data, ctl_page_index::page_flags, ctl_page_index::page_len, SCP_SWP, scsi_2btoul(), scsi_u64to8b(), scsi_ulto2b(), scsi_ulto3b(), scsi_ulto4b(), ctl_page_index::sense_handler, SMH_LONGLBA, SMPH_PC_MASK, SMS10_LLBAA, SMS_ALL_PAGES_PAGE, SMS_DBD, SMS_PAGE_CODE, SMS_PAGE_CTRL_MASK, SMS_SUBPAGE_ALL, SMS_SUBPAGE_PAGE_0, ctl_page_index::subpage, scsi_mode_sense_6::subpage, scsi_mode_sense_10::subpage, T_CDROM, T_DIRECT, and T_PROCESSOR.

Here is the call graph for this function:

◆ ctl_module_event_handler()

static int ctl_module_event_handler ( module_t  mod,
int  what,
void *  arg 
)
static

Definition at line 2111 of file ctl.c.

References ctl_init(), and ctl_shutdown().

Here is the call graph for this function:

◆ ctl_open()

static int ctl_open ( struct cdev *  dev,
int  flags,
int  fmt,
struct thread *  td 
)
static

Definition at line 2129 of file ctl.c.

◆ ctl_persistent_reserve_in()

int ctl_persistent_reserve_in ( struct ctl_scsiio ctsio)

Definition at line 7690 of file ctl.c.

References scsi_per_res_in::action, scsi_per_res_in_full_desc::additional_length, ctl_scsiio::be_move_done, ctl_scsiio::cdb, ctl_config_move_done(), ctl_create_iid(), ctl_datamove(), CTL_DEBUG_PRINT, CTL_FLAG_ALLOCATED, ctl_get_prkey(), CTL_LUN, CTL_LUN_PR_RESERVED, CTL_MAX_INIT_PER_PORT, CTL_MAX_INITIATORS, ctl_softc::ctl_ports, CTL_PR_ALL_REGISTRANTS, CTL_RETVAL_COMPLETE, ctl_set_success(), CTL_SOFTC, scsi_per_res_in_rsrv::data, scsi_per_res_in_full::desc, ctl_io_hdr::flags, ctl_lun::flags, scsi_per_res_in_full_desc::flags, scsi_per_res_cap::flags1, scsi_per_res_cap::flags2, scsi_per_res_in_header::generation, scsi_per_res_in_keys::header, scsi_per_res_in_rsrv::header, scsi_per_res_in_full::header, ctl_scsiio::io_hdr, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_scsiio::kern_total_len, scsi_per_res_key::key, scsi_per_res_in_keys::keys, scsi_per_res_in::length, scsi_per_res_cap::length, scsi_per_res_in_header::length, ctl_lun::lun, ctl_lun::lun_lock, ctl_lun::pr_generation, ctl_lun::pr_key_count, ctl_lun::pr_res_idx, ctl_lun::pr_res_type, scsi_per_res_in_full_desc::rel_trgt_port_id, scsi_per_res_in_full_desc::res_key, scsi_per_res_in_rsrv_data::reservation, scsi_per_res_in_rsrv_data::scopetype, scsi_per_res_in_full_desc::scopetype, scsi_2btoul(), scsi_u64to8b(), scsi_ulto2b(), scsi_ulto4b(), SPRI_ALLOW_5, SPRI_CRH, SPRI_FULL_R_HOLDER, SPRI_RC, SPRI_RK, SPRI_RR, SPRI_RS, SPRI_TM_EX_AC, SPRI_TM_EX_AC_AR, SPRI_TM_EX_AC_RO, SPRI_TM_WR_EX, SPRI_TM_WR_EX_AR, SPRI_TM_WR_EX_RO, SPRI_TMV, scsi_per_res_in_full_desc::transport_id, and scsi_per_res_cap::type_mask.

Here is the call graph for this function:

◆ ctl_persistent_reserve_out()

int ctl_persistent_reserve_out ( struct ctl_scsiio ctsio)

Definition at line 8254 of file ctl.c.

References ctl_pr_info::action, scsi_per_res_out::action, ctl_scsiio::be_move_done, ctl_scsiio::cdb, ctl_alloc_prkey(), ctl_clr_prkey(), ctl_config_move_done(), ctl_datamove(), CTL_DEBUG_PRINT, ctl_done(), ctl_est_ua(), CTL_FLAG_ALLOCATED, ctl_get_initindex(), ctl_get_prkey(), CTL_HA_CHAN_CTL, ctl_ha_msg_send(), CTL_LUN, CTL_LUN_PR_RESERVED, CTL_MAX_INITIATORS, CTL_MSG_PERS_ACTION, CTL_PR_ALL_REGISTRANTS, CTL_PR_CLEAR, CTL_PR_NO_RESERVATION, CTL_PR_REG_KEY, CTL_PR_RELEASE, CTL_PR_RESERVE, CTL_PR_UNREG_KEY, ctl_pro_preempt(), CTL_RETVAL_COMPLETE, ctl_set_illegal_pr_release(), ctl_set_invalid_field(), ctl_set_prkey(), ctl_set_reservation_conflict(), ctl_set_success(), CTL_SOFTC, CTL_UA_REG_PREEMPT, CTL_UA_RES_RELEASE, ctl_io_hdr::flags, ctl_lun::flags, scsi_per_res_out_parms::flags, ctl_ha_msg::hdr, ctl_softc::init_min, ctl_scsiio::io_hdr, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_scsiio::kern_total_len, scsi_per_res_key::key, scsi_per_res_out::length, ctl_lun::lun, ctl_lun::lun_lock, ctl_ha_msg_hdr::msg_type, ctl_io_hdr::nexus, ctl_ha_msg_hdr::nexus, ctl_ha_msg::pr, ctl_lun::pr_generation, ctl_ha_msg_pr::pr_info, ctl_lun::pr_key_count, ctl_lun::pr_res_idx, ctl_lun::pr_res_type, scsi_per_res_out_parms::res_key, ctl_pr_info::res_type, ctl_pr_info::residx, ctl_pr_info::sa_res_key, scsi_per_res_out::scope_type, SCP_NUAR, scsi_4btoul(), scsi_8btou64(), scsi_per_res_out_parms::serv_act_res_key, SPR_ALL_TG_PT, SPR_APTPL, SPR_LU_SCOPE, SPR_SCOPE_MASK, SPR_SPEC_I_PT, SPR_TYPE_EX_AC, SPR_TYPE_EX_AC_AR, SPR_TYPE_EX_AC_RO, SPR_TYPE_MASK, SPR_TYPE_WR_EX, SPR_TYPE_WR_EX_AR, SPR_TYPE_WR_EX_RO, SPRO_ACTION_MASK, SPRO_CLEAR, SPRO_PRE_ABO, SPRO_PREEMPT, SPRO_REG_IGNO, SPRO_REGISTER, SPRO_RELEASE, and SPRO_RESERVE.

Here is the call graph for this function:

◆ ctl_pool_create()

int ctl_pool_create ( struct ctl_softc ctl_softc,
const char *  pool_name,
uint32_t  total_ctl_io,
void **  npool 
)

Definition at line 3923 of file ctl.c.

References ctl_io_pool::ctl_softc, ctl_softc::io_zone, ctl_io_pool::name, and ctl_io_pool::zone.

Referenced by ctl_ha_init(), and ctl_port_register().

Here is the caller graph for this function:

◆ ctl_pool_free()

void ctl_pool_free ( struct ctl_io_pool pool)

Definition at line 3948 of file ctl.c.

References ctl_io_pool::zone.

Referenced by ctl_ha_init(), ctl_ha_shutdown(), and ctl_port_deregister().

Here is the caller graph for this function:

◆ ctl_prevent_allow()

◆ ctl_pro_preempt()

◆ ctl_pro_preempt_other()

◆ ctl_process_done()

static void ctl_process_done ( union ctl_io io)
static

Definition at line 13002 of file ctl.c.

References ctl_io_stats::bytes, CTL_CMD_FLAG_NO_SENSE, ctl_debug, CTL_DEBUG_INFO, CTL_DEBUG_PRINT, CTL_FLAG_ABORT, CTL_FLAG_DATA_IN, CTL_FLAG_DATA_MASK, CTL_FLAG_DATA_OUT, CTL_FLAG_SENT_2OTHER_SC, CTL_FLAG_STATUS_SENT, ctl_free_lun(), ctl_get_cmd_entry(), CTL_HA_CHAN_CTL, CTL_HA_MODE_XFER, ctl_ha_msg_send(), ctl_inject_error(), ctl_io_error_print(), CTL_IO_SCSI, CTL_IO_TASK, CTL_LUN, CTL_LUN_INVALID, CTL_MSG_FINISH_IO, CTL_PORT, ctl_scsi_command_string(), ctl_scsi_path_string(), ctl_set_sense(), ctl_set_task_aborted(), CTL_SOFTC, CTL_STATS_NO_IO, CTL_STATS_READ, CTL_STATS_WRITE, CTL_STATUS_MASK, CTL_SUCCESS, ctl_try_unblock_others(), ctl_io_hdr::dma_bt, ctl_io_stats::dma_time, ctl_io_stats::dmas, ctl_io_hdr::flags, ctl_cmd_entry::flags, ctl_lun::flags, ctl_softc::ha_mode, ctl_ha_msg::hdr, ctl_lun::ie_asc, ctl_lun::ie_ascq, ctl_lun::ie_reported, ctl_io::io_hdr, ctl_io_hdr::io_type, ctl_scsiio::kern_total_len, ctl_lun::lun, ctl_lun::lun_lock, ctl_ha_msg_hdr::msg_type, ctl_io_hdr::nexus, ctl_ha_msg_hdr::nexus, ctl_io_hdr::num_dmas, ctl_io_stats::operations, ctl_ha_msg::port, ctl_port::port_lock, ctl_scsiio::priority, ctl_io_hdr::remote_io, ctl_ha_msg::scsi, ctl_io::scsiio, ctl_ha_msg_scsi::sense_data, ctl_ha_msg_hdr::serializing_sc, SIEP_MRIE_NO_SENSE, SIEP_MRIE_REC_COND, SIEP_MRIE_REC_UNCOND, SMS_RWER_PER, SMS_VER_PER, SSD_ELEM_NONE, SSD_KEY_NO_SENSE, SSD_KEY_RECOVERED_ERROR, ctl_io_hdr::start_bt, ctl_io_hdr::start_time, ctl_port::stats, ctl_lun::stats, ctl_io_hdr::status, ctl_scsiio::tag_num, ctl_taskio::tag_num, ctl_scsiio::tag_type, ctl_taskio::tag_type, ctl_nexus::targ_mapped_lun, ctl_taskio::task_action, ctl_io::taskio, and ctl_io_stats::time.

Referenced by ctl_work_thread().

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

◆ ctl_query_async_event()

static int ctl_query_async_event ( union ctl_io io)
static

◆ ctl_query_task()

◆ ctl_queue()

◆ ctl_queue_sense()

◆ ctl_read_buffer()

◆ ctl_read_capacity()

◆ ctl_read_capacity_16()

◆ ctl_read_defect()

◆ ctl_read_toc()

◆ ctl_read_write()

int ctl_read_write ( struct ctl_scsiio ctsio)

◆ ctl_remove_initiator()

int ctl_remove_initiator ( struct ctl_port port,
int  iid 
)

Definition at line 2145 of file ctl.c.

References ctl_i_t_nexus_loss(), ctl_isc_announce_iid(), ctl_softc::ctl_lock, CTL_MAX_INIT_PER_PORT, ctl_port::ctl_softc, CTL_UA_POWERON, ctl_wwpn_iid::in_use, ctl_wwpn_iid::last_use, and ctl_port::wwpn_iid.

Referenced by cfiscsi_session_unregister_initiator(), and ctlfeasync().

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

◆ ctl_remove_lun()

int ctl_remove_lun ( struct ctl_be_lun be_lun)

Definition at line 5047 of file ctl.c.

References ctl_lun::be_lun, ctl_disable_lun(), ctl_free_lun(), ctl_be_lun::ctl_lun, CTL_LUN_INVALID, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_rm(), ctl_backend_ramdisk_shutdown(), ctl_be_block_rm(), and ctl_be_block_shutdown().

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

◆ ctl_report_ident_info()

◆ ctl_report_luns()

◆ ctl_report_supported_opcodes()

int ctl_report_supported_opcodes ( struct ctl_scsiio ctsio)

Definition at line 7443 of file ctl.c.

References ctl_lun::be_lun, ctl_scsiio::be_move_done, ctl_scsiio::cdb, scsi_report_supported_opcodes_descr::cdb_length, scsi_report_supported_opcodes_one::cdb_length, scsi_report_supported_opcodes_one::cdb_usage, ctl_cmd_applicable(), CTL_CMD_FLAG_SA5, ctl_cmd_table, ctl_config_move_done(), ctl_datamove(), CTL_DEBUG_PRINT, ctl_done(), CTL_FLAG_ALLOCATED, CTL_LUN, CTL_RETVAL_COMPLETE, ctl_set_invalid_field(), ctl_set_success(), scsi_report_supported_opcodes_all::descr, ctl_cmd_entry::execute, ctl_io_hdr::flags, ctl_cmd_entry::flags, scsi_report_supported_opcodes_descr::flags, ctl_scsiio::io_hdr, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_scsiio::kern_total_len, ctl_cmd_entry::length, scsi_report_supported_opcodes::length, scsi_report_supported_opcodes_all::length, ctl_lun::lun, ctl_be_lun::lun_type, scsi_report_supported_opcodes::opcode, scsi_report_supported_opcodes_descr::opcode, scsi_report_supported_opcodes::options, scsi_report_supported_opcodes::requested_opcode, scsi_report_supported_opcodes::requested_service_action, RSO_OPTIONS_ALL, RSO_OPTIONS_MASK, RSO_OPTIONS_OC, RSO_OPTIONS_OC_ASA, RSO_OPTIONS_OC_SA, RSO_SERVACTV, scsi_2btoul(), scsi_4btoul(), scsi_ulto2b(), scsi_ulto4b(), scsi_report_supported_opcodes::service_action, scsi_report_supported_opcodes_descr::service_action, scsi_report_supported_opcodes_one::support, and ctl_cmd_entry::usage.

Here is the call graph for this function:

◆ ctl_report_supported_tmf()

◆ ctl_report_tagret_port_groups()

int ctl_report_tagret_port_groups ( struct ctl_scsiio ctsio)

Definition at line 7274 of file ctl.c.

References ctl_scsiio::be_move_done, scsi_maintenance_in::byte2, ctl_scsiio::cdb, ctl_config_move_done(), ctl_datamove(), CTL_DEBUG_PRINT, ctl_done(), CTL_FLAG_ALLOCATED, CTL_HA_LINK_OFFLINE, CTL_HA_LINK_UNKNOWN, CTL_HA_MODE_ACT_STBY, ctl_softc::ctl_lock, CTL_LUN, ctl_lun_map_to_port(), CTL_LUN_PEER_SC_PRIMARY, CTL_LUN_PRIMARY_SC, CTL_PORT_STATUS_HA_SHARED, CTL_PORT_STATUS_ONLINE, CTL_RETVAL_COMPLETE, ctl_set_invalid_field(), ctl_set_success(), CTL_SOFTC, scsi_target_port_group_descriptor::descriptors, ctl_io_hdr::flags, ctl_lun::flags, scsi_target_group_data_extended::format_type, scsi_target_group_data::groups, scsi_target_group_data_extended::groups, ctl_softc::ha_link, ctl_softc::ha_mode, scsi_target_group_data_extended::implicit_transition_time, ctl_scsiio::io_hdr, ctl_softc::is_single, ctl_scsiio::kern_data_len, ctl_scsiio::kern_data_ptr, ctl_scsiio::kern_rel_offset, ctl_scsiio::kern_sg_entries, ctl_scsiio::kern_total_len, scsi_maintenance_in::length, scsi_target_group_data::length, scsi_target_group_data_extended::length, ctl_lun::lun, NUM_HA_SHELVES, ctl_softc::port_cnt, ctl_softc::port_min, scsi_target_port_group_descriptor::pref_state, scsi_4btoul(), scsi_ulto2b(), scsi_ulto4b(), ctl_port::status, scsi_target_port_group_descriptor::status, STG_PDF_EXTENDED, STG_PDF_LENGTH, STG_PDF_MASK, scsi_target_port_group_descriptor::support, ctl_port::targ_port, scsi_target_port_group_descriptor::target_port_count, scsi_target_port_group_descriptor::target_port_group, TPG_AN_SUP, TPG_AO_SUP, TPG_ASYMMETRIC_ACCESS_NONOPTIMIZED, TPG_ASYMMETRIC_ACCESS_OPTIMIZED, TPG_ASYMMETRIC_ACCESS_STANDBY, TPG_ASYMMETRIC_ACCESS_TRANSITIONING, TPG_ASYMMETRIC_ACCESS_UNAVAILABLE, TPG_IMPLICIT, TPG_S_SUP, TPG_T_SUP, and TPG_U_SUP.

Here is the call graph for this function:

◆ ctl_report_timestamp()

◆ ctl_request_sense()

◆ ctl_run()

◆ ctl_run_task()

◆ 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_scsi_release()

int ctl_scsi_release ( struct ctl_scsiio ctsio)

Definition at line 5249 of file ctl.c.

References CTL_DEBUG_PRINT, ctl_done(), ctl_get_initindex(), CTL_LUN, CTL_LUN_RESERVED, CTL_RETVAL_COMPLETE, ctl_set_success(), ctl_scsiio::io_hdr, ctl_lun::lun, and ctl_io_hdr::nexus.

Here is the call graph for this function:

◆ ctl_scsi_reserve()

int ctl_scsi_reserve ( struct ctl_scsiio ctsio)

◆ ctl_scsiio()

static int ctl_scsiio ( struct ctl_scsiio ctsio)
static

Definition at line 11779 of file ctl.c.

References ctl_scsiio::cdb, CTL_DEBUG_PRINT, ctl_done(), CTL_FLAG_ABORT, ctl_get_cmd_entry(), CTL_RETVAL_COMPLETE, ctl_cmd_entry::execute, ctl_io_hdr::flags, and ctl_scsiio::io_hdr.

Referenced by ctl_config_move_done(), and ctl_work_thread().

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

◆ ctl_scsiio_lun_check()

◆ ctl_scsiio_precheck()

static void ctl_scsiio_precheck ( struct ctl_scsiio ctsio)
static

Definition at line 11488 of file ctl.c.

References ctl_lun::be_lun, ctl_io_hdr::blocker, ctl_scsiio::cdb, ctl_ha_msg_scsi::cdb, ctl_scsiio::cdb_len, ctl_ha_msg_scsi::cdb_len, CTL_ACTION_BLOCK, CTL_ACTION_OVERLAP, CTL_ACTION_OVERLAP_TAG, CTL_ACTION_PASS, CTL_ACTION_SKIP, CTL_AUTOSENSE, CTL_BACKEND_LUN, ctl_build_ua(), ctl_check_ooa(), ctl_cmd_applicable(), CTL_CMD_FLAG_NO_SENSE, CTL_CMD_FLAG_OK_ON_NO_LUN, CTL_CMD_FLAG_RUN_HERE, CTL_DEBUG_PRINT, ctl_done(), ctl_enqueue_rtr(), CTL_FLAG_DATA_MASK, CTL_FLAG_IS_WAS_ON_RTR, CTL_FLAG_SENT_2OTHER_SC, ctl_get_initindex(), CTL_HA_CHAN_CTL, ctl_ha_msg_send(), CTL_HA_STATUS_SUCCESS, CTL_LUN, CTL_LUN_DISABLED, CTL_LUN_PEER_SC_PRIMARY, CTL_LUN_PRIMARY_SC, ctl_softc::ctl_luns, CTL_MAX_CDBLEN, CTL_MAX_INIT_PER_PORT, ctl_max_luns, CTL_MSG_SERIALIZE, CTL_SCSI_ERROR, ctl_scsiio_lun_check(), ctl_set_busy(), ctl_set_invalid_opcode(), ctl_set_overlapped_cmd(), ctl_set_overlapped_tag(), ctl_set_unsupported_lun(), CTL_SOFTC, CTL_UA_NONE, ctl_validate_command(), scsi_sense_data::error_code, ctl_io_hdr::flags, ctl_cmd_entry::flags, ctl_lun::flags, ctl_ha_msg::hdr, ctl_scsiio::io_hdr, ctl_io::io_hdr, ctl_ha_msg::lun, ctl_lun::lun, ctl_lun::lun_lock, ctl_be_lun::lun_type, ctl_ha_msg_hdr::msg_type, ctl_io_hdr::nexus, ctl_ha_msg_hdr::nexus, ctl_ha_msg_hdr::original_sc, ctl_lun::pending_sense, ctl_scsiio::priority, ctl_ha_msg_scsi::priority, REQUEST_SENSE, ctl_ha_msg::scsi, ctl_scsiio::scsi_status, SCSI_STATUS_CHECK_COND, ctl_scsiio::sense_data, ctl_ha_msg_scsi::sense_data, ctl_scsiio::sense_len, ctl_ha_msg_hdr::serializing_sc, SSD_TYPE_NONE, ctl_io_hdr::status, ctl_scsiio::tag_num, ctl_ha_msg_scsi::tag_num, ctl_scsiio::tag_type, ctl_ha_msg_scsi::tag_type, and ctl_nexus::targ_mapped_lun.

Referenced by ctl_run(), and ctl_work_thread().

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

◆ ctl_send_datamove_done()

◆ ctl_seq_check()

static ctl_action ctl_seq_check ( union ctl_io io1,
union ctl_io io2 
)
static

Definition at line 10974 of file ctl.c.

References CTL_ACTION_BLOCK, CTL_ACTION_PASS, CTL_FLAG_SERSEQ_DONE, ctl_get_lba_len(), ctl_io_hdr::flags, and ctl_io::io_hdr.

Referenced by ctl_check_for_blockage().

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

◆ ctl_serialize_other_sc_cmd()

◆ 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_set_prkey()

static void ctl_set_prkey ( struct ctl_lun lun,
uint32_t  residx,
uint64_t  key 
)
static

Definition at line 3909 of file ctl.c.

References CTL_MAX_INIT_PER_PORT, and ctl_lun::lun.

Referenced by ctl_hndl_per_res_out_on_other_sc(), ctl_isc_lun_sync(), and ctl_persistent_reserve_out().

Here is the caller graph for this function:

◆ ctl_shutdown()

◆ ctl_start_lun()

int ctl_start_lun ( struct ctl_be_lun be_lun)

Definition at line 4943 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_config_write(), and ctl_be_block_config_write().

Here is the caller graph for this function:

◆ ctl_start_stop()

◆ ctl_stop_lun()

int ctl_stop_lun ( struct ctl_be_lun be_lun)

Definition at line 4954 of file ctl.c.

References ctl_lun::be_lun, ctl_be_lun::ctl_lun, CTL_LUN_STOPPED, and ctl_lun::lun.

Referenced by ctl_backend_ramdisk_config_write(), and ctl_be_block_config_write().

Here is the caller graph for this function:

◆ ctl_sync_cache()

◆ ctl_target_reset()

◆ ctl_temp_log_sense_handler()

◆ ctl_thresh_thread()

◆ ctl_try_unblock_io()

◆ ctl_try_unblock_others()

static void ctl_try_unblock_others ( struct ctl_lun lun,
union ctl_io io,
bool  skip 
)
static

Definition at line 11255 of file ctl.c.

References ctl_io_hdr::blocker, ctl_try_unblock_io(), ctl_io::io_hdr, and ctl_lun::lun_lock.

Referenced by ctl_failover_lun(), ctl_handle_isc(), ctl_process_done(), ctl_serseq_done(), ctl_try_unblock_io(), and ctl_unmap().

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

◆ ctl_tur()

int ctl_tur ( struct ctl_scsiio ctsio)

Definition at line 9432 of file ctl.c.

References CTL_DEBUG_PRINT, ctl_done(), CTL_RETVAL_COMPLETE, and ctl_set_success().

Here is the call graph for this function:

◆ ctl_ultomsf()

static void ctl_ultomsf ( uint32_t  lba,
uint8_t *  buf 
)
static

Definition at line 10662 of file ctl.c.

References scsi_mechanism_status_header::lba.

Referenced by ctl_read_toc().

Here is the caller graph for this function:

◆ ctl_unmap()

◆ ctl_validate_command()

const struct ctl_cmd_entry * ctl_validate_command ( struct ctl_scsiio ctsio)
static

Definition at line 11715 of file ctl.c.

References ctl_scsiio::cdb, ctl_done(), ctl_get_cmd_entry(), ctl_set_invalid_field(), ctl_set_invalid_opcode(), ctl_cmd_entry::execute, ctl_cmd_entry::length, ctl_scsiio::seridx, and ctl_cmd_entry::seridx.

Referenced by ctl_scsiio_precheck().

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

◆ ctl_verify()

◆ ctl_work_thread()

static void ctl_work_thread ( void *  arg)
static

◆ ctl_write_buffer()

◆ ctl_write_same()

◆ ctl_write_same_cont()

◆ ctl_zero_io()

void ctl_zero_io ( union ctl_io io)

◆ DECLARE_MODULE()

DECLARE_MODULE ( ctl  ,
ctl_moduledata  ,
SI_SUB_CONFIGURE  ,
SI_ORDER_THIRD   
)

◆ hex2bin()

static int hex2bin ( const char *  str,
uint8_t *  buf,
int  buf_size 
)
static

Definition at line 4534 of file ctl.c.

Referenced by ctl_add_lun(), and ctl_report_ident_info().

Here is the caller graph for this function:

◆ MALLOC_DEFINE()

MALLOC_DEFINE ( M_CTL  ,
"ctlmem"  ,
"Memory used for CTL"   
)

◆ MODULE_VERSION()

MODULE_VERSION ( ctl  ,
 
)

◆ SYSCTL_INT() [1/5]

SYSCTL_INT ( _kern_cam_ctl  ,
OID_AUTO  ,
debug  ,
CTLFLAG_RWTUN  ,
ctl_debug,
,
"Enabled debug flags"   
)

◆ SYSCTL_INT() [2/5]

SYSCTL_INT ( _kern_cam_ctl  ,
OID_AUTO  ,
lun_map_size  ,
CTLFLAG_RWTUN  ,
ctl_lun_map_size,
,
"Size of per-port LUN map (max LUN + 1)"   
)

◆ SYSCTL_INT() [3/5]

SYSCTL_INT ( _kern_cam_ctl  ,
OID_AUTO  ,
max_luns  ,
CTLFLAG_RDTUN  ,
ctl_max_luns,
CTL_DEFAULT_MAX_LUNS  ,
"Maximum number of LUNs"   
)

◆ SYSCTL_INT() [4/5]

SYSCTL_INT ( _kern_cam_ctl  ,
OID_AUTO  ,
max_ports  ,
CTLFLAG_RDTUN  ,
ctl_max_ports,
CTL_DEFAULT_MAX_LUNS  ,
"Maximum number of ports"   
)

◆ SYSCTL_INT() [5/5]

SYSCTL_INT ( _kern_cam_ctl  ,
OID_AUTO  ,
worker_threads  ,
CTLFLAG_RDTUN  ,
worker_threads,
,
"Number of worker threads"   
)

◆ SYSCTL_NODE()

SYSCTL_NODE ( _kern_cam  ,
OID_AUTO  ,
ctl  ,
CTLFLAG_RD|  CTLFLAG_MPSAFE,
,
"CAM Target Layer"   
)

◆ TUNABLE_INT() [1/2]

TUNABLE_INT ( "kern.cam.ctl.max_luns"  ,
ctl_max_luns 
)

◆ TUNABLE_INT() [2/2]

TUNABLE_INT ( "kern.cam.ctl.max_ports"  ,
ctl_max_ports 
)

Variable Documentation

◆ caching_page_changeable

const struct scsi_caching_page caching_page_changeable
static
Initial value:
= {
sizeof(struct scsi_caching_page) - 2,
0,
{0, 0},
{0, 0},
{0, 0},
{0, 0},
0,
0,
{0, 0},
0,
{0, 0, 0}
}
#define SMS_CACHING_PAGE
Definition: scsi_all.h:781
#define SCP_WCE
Definition: scsi_all.h:789
#define SCP_RCD
Definition: scsi_all.h:791

Definition at line 230 of file ctl.c.

Referenced by ctl_init_page_index().

◆ caching_page_default

const struct scsi_caching_page caching_page_default
static
Initial value:
= {
sizeof(struct scsi_caching_page) - 2,
0,
{0xff, 0xff},
{0, 0},
{0xff, 0xff},
{0xff, 0xff},
0,
0,
{0, 0},
0,
{0, 0, 0}
}
#define SCP_DISC
Definition: scsi_all.h:787

Definition at line 214 of file ctl.c.

Referenced by ctl_init_page_index().

◆ cddvd_page_changeable

const struct scsi_cddvd_capabilities_page cddvd_page_changeable
static
Initial value:
= {
sizeof(struct scsi_cddvd_capabilities_page) - 2,
0,
0,
0,
0,
0,
0,
{0, 0},
{0, 0},
{0, 0},
{0, 0},
0,
0,
0,
0,
0,
0,
0,
0,
}
#define SMS_CDDVD_CAPS_PAGE
Definition: scsi_cd.h:802

Definition at line 386 of file ctl.c.

Referenced by ctl_init_page_index().

◆ cddvd_page_default

const struct scsi_cddvd_capabilities_page cddvd_page_default
static
Initial value:
= {
sizeof(struct scsi_cddvd_capabilities_page) - 2,
0x3f,
0x00,
0xf0,
0x00,
0x29,
0x00,
{0, 0},
{0, 0},
{8, 0},
{0, 0},
0,
0,
0,
0,
0,
0,
0,
0,
}

Definition at line 363 of file ctl.c.

Referenced by ctl_init_page_index().

◆ control_ext_page_changeable

const struct scsi_control_ext_page control_ext_page_changeable
static
Initial value:
= {
0x01,
0,
0,
0xff
}
#define CTL_CEM_LEN
Definition: ctl.c:270
#define SMS_CONTROL_MODE_PAGE
Definition: scsi_all.h:199
#define SMPH_SPF
Definition: scsi_all.h:3665

Definition at line 281 of file ctl.c.

Referenced by ctl_init_page_index().

◆ control_ext_page_default

const struct scsi_control_ext_page control_ext_page_default
static
Initial value:
= {
0x01,
0,
0,
0
}

Definition at line 272 of file ctl.c.

Referenced by ctl_init_page_index().

◆ control_page_changeable

const struct scsi_control_page control_page_changeable
static
Initial value:
= {
sizeof(struct scsi_control_page) - 2,
0,
{0, 0},
{0, 0},
{0, 0}
}
#define SCP_QUEUE_ALG_MASK
Definition: scsi_all.h:721
#define SCP_SWP
Definition: scsi_all.h:730
#define SCP_DSENSE
Definition: scsi_all.h:714
#define SCP_NUAR
Definition: scsi_all.h:724

Definition at line 258 of file ctl.c.

Referenced by ctl_init_page_index().

◆ control_page_default

const struct scsi_control_page control_page_default
static
Initial value:
= {
sizeof(struct scsi_control_page) - 2,
0,
0,
{0, 0},
{0, 0},
{0, 0}
}
#define SCP_TAS
Definition: scsi_all.h:736
#define SCP_QUEUE_ALG_RESTRICTED
Definition: scsi_all.h:722

Definition at line 246 of file ctl.c.

Referenced by ctl_init_page_index().

◆ control_softc

◆ ctl_cdevsw

struct cdevsw ctl_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_flags = 0,
.d_open = ctl_open,
.d_close = ctl_close,
.d_ioctl = ctl_ioctl,
.d_name = "ctl",
}
static int ctl_open(struct cdev *dev, int flags, int fmt, struct thread *td)
Definition: ctl.c:2129
static int ctl_close(struct cdev *dev, int flags, int fmt, struct thread *td)
Definition: ctl.c:2135
static int ctl_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
Definition: ctl.c:2596

Definition at line 578 of file ctl.c.

Referenced by ctl_init().

◆ ctl_debug

int ctl_debug = CTL_DEBUG_NONE
static

◆ ctl_lun_map_size

int ctl_lun_map_size = 1024
static

Definition at line 417 of file ctl.c.

Referenced by ctl_lun_map_init().

◆ ctl_max_luns

◆ ctl_max_ports

int ctl_max_ports = CTL_DEFAULT_MAX_PORTS
static

◆ ctl_moduledata

moduledata_t ctl_moduledata
static
Initial value:
= {
"ctl",
NULL
}
static int ctl_module_event_handler(module_t, int, void *)
Definition: ctl.c:2111

Definition at line 591 of file ctl.c.

◆ format_page_changeable

const struct scsi_format_page format_page_changeable
static
Initial value:
= {
sizeof(struct scsi_format_page) - 2,
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
0,
{0, 0, 0}
}
#define SMS_FORMAT_DEVICE_PAGE
Definition: scsi_all.h:195

Definition at line 147 of file ctl.c.

Referenced by ctl_init_page_index().

◆ format_page_default

const struct scsi_format_page format_page_default
static
Initial value:
= {
sizeof(struct scsi_format_page) - 2,
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0},
{0, 0, 0}
}
#define CTL_DEFAULT_SECTORS_PER_TRACK
Definition: ctl_private.h:223
#define SFP_HSEC
Definition: scsi_da.h:577

Definition at line 130 of file ctl.c.

Referenced by ctl_init_page_index().

◆ ha_frontend

struct ctl_frontend ha_frontend
static
Initial value:
=
{
.name = "ha",
.init = ctl_ha_init,
.shutdown = ctl_ha_shutdown,
}
static int ctl_ha_init(void)
Definition: ctl.c:608
static int ctl_ha_shutdown(void)
Definition: ctl.c:629

Definition at line 600 of file ctl.c.

Referenced by ctl_ha_shutdown(), ctl_init(), ctl_isc_port_sync(), and ctl_shutdown().

◆ ie_page_changeable

const struct scsi_info_exceptions_page ie_page_changeable
static
Initial value:
= {
sizeof(struct scsi_info_exceptions_page) - 2,
0x0f,
{0xff, 0xff, 0xff, 0xff},
{0xff, 0xff, 0xff, 0xff}
}
#define SIEP_FLAGS_LOGERR
Definition: scsi_all.h:820
#define SIEP_FLAGS_DEXCPT
Definition: scsi_all.h:817
#define SIEP_FLAGS_EWASC
Definition: scsi_all.h:816
#define SIEP_FLAGS_TEST
Definition: scsi_all.h:818
#define SMS_INFO_EXCEPTIONS_PAGE
Definition: scsi_all.h:201

Definition at line 299 of file ctl.c.

Referenced by ctl_init_page_index().

◆ ie_page_default

const struct scsi_info_exceptions_page ie_page_default
static
Initial value:
= {
sizeof(struct scsi_info_exceptions_page) - 2,
{0, 0, 0, 0},
{0, 0, 0, 1}
}
#define SIEP_MRIE_NO
Definition: scsi_all.h:822

Definition at line 290 of file ctl.c.

Referenced by ctl_init_page_index().

◆ lbp_page_changeable

const struct ctl_logical_block_provisioning_page lbp_page_changeable
static
Initial value:
= {{
0x02,
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{}},
{{0,
0,
{0, 0},
{0, 0, 0, 0}},
{0,
0,
{0, 0},
{0, 0, 0, 0}},
{0,
0,
{0, 0},
{0, 0, 0, 0}},
{0,
0,
{0, 0},
{0, 0, 0, 0}}
}
}
#define CTL_LBPM_LEN
Definition: ctl.c:309
#define SLBPP_SITUA
Definition: scsi_all.h:849

Definition at line 337 of file ctl.c.

Referenced by ctl_init_page_index().

◆ lbp_page_default

const struct ctl_logical_block_provisioning_page lbp_page_default
static
Initial value:
= {{
0x02,
0,
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
{}},
{{0,
0x01,
{0, 0},
{0, 0, 0, 0}},
{0,
0x02,
{0, 0},
{0, 0, 0, 0}},
{0,
0xf1,
{0, 0},
{0, 0, 0, 0}},
{0,
0xf2,
{0, 0},
{0, 0, 0, 0}}
}
}

Definition at line 311 of file ctl.c.

Referenced by ctl_init_page_index().

◆ rigid_disk_page_changeable

const struct scsi_rigid_disk_page rigid_disk_page_changeable
static
Initial value:
= {
sizeof(struct scsi_rigid_disk_page) - 2,
{0, 0, 0},
0,
{0, 0, 0},
{0, 0, 0},
{0, 0},
{0, 0, 0},
0,
0,
0,
{0, 0},
{0, 0}
}
#define SMS_RIGID_DISK_PAGE
Definition: scsi_da.h:589

Definition at line 180 of file ctl.c.

Referenced by ctl_init_page_index().

◆ rigid_disk_page_default

const struct scsi_rigid_disk_page rigid_disk_page_default
static
Initial value:
= {
sizeof(struct scsi_rigid_disk_page) - 2,
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{0, 0},
{0, 0, 0},
0,
0,
{(CTL_DEFAULT_ROTATION_RATE >> 8) & 0xff,
{0, 0}
}
#define CTL_DEFAULT_ROTATION_RATE
Definition: ctl_private.h:226
#define CTL_DEFAULT_HEADS
Definition: ctl_private.h:224
#define SRDP_RPL_DISABLED
Definition: scsi_da.h:598

Definition at line 163 of file ctl.c.

Referenced by ctl_init_page_index().

◆ rw_er_page_changeable

const struct scsi_da_rw_recovery_page rw_er_page_changeable
static
Initial value:
= {
sizeof(struct scsi_da_rw_recovery_page) - 2,
0,
0,
0,
0,
0,
0,
{0, 0},
}
#define SMS_RWER_PER
Definition: scsi_da.h:618
#define SMS_RW_ERROR_RECOVERY_PAGE
Definition: scsi_da.h:610
#define SMS_RWER_LBPERE
Definition: scsi_da.h:626

Definition at line 116 of file ctl.c.

Referenced by ctl_init_page_index().

◆ rw_er_page_default

const struct scsi_da_rw_recovery_page rw_er_page_default
static
Initial value:
= {
sizeof(struct scsi_da_rw_recovery_page) - 2,
0,
0,
0,
0,
0,
0,
{0, 0},
}
#define SMS_RWER_AWRE
Definition: scsi_da.h:613
#define SMS_RWER_ARRE
Definition: scsi_da.h:614

Definition at line 102 of file ctl.c.

Referenced by ctl_init_page_index().

◆ verify_er_page_changeable

const struct scsi_da_verify_recovery_page verify_er_page_changeable
static
Initial value:
= {
sizeof(struct scsi_da_verify_recovery_page) - 2,
0,
{ 0, 0, 0, 0, 0, 0 },
{0, 0},
}
#define SMS_VERIFY_ERROR_RECOVERY_PAGE
Definition: scsi_da.h:634
#define SMS_VER_PER
Definition: scsi_da.h:638

Definition at line 205 of file ctl.c.

Referenced by ctl_init_page_index().

◆ verify_er_page_default

const struct scsi_da_verify_recovery_page verify_er_page_default
static
Initial value:
= {
sizeof(struct scsi_da_verify_recovery_page) - 2,
0,
0,
{ 0, 0, 0, 0, 0, 0 },
{0, 0},
}

Definition at line 196 of file ctl.c.

Referenced by ctl_init_page_index().

◆ worker_threads

int worker_threads = -1
static