13703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger#define TCM_LOOP_VERSION "v2.1-rc1" 23703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger#define TL_WWN_ADDR_LEN 256 33703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger#define TL_TPGS_PER_HBA 32 42e88efd3aaafa0df05593cdfa5fd17afe922781dChristoph Hellwig 53703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger/* 63703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger * Used in tcm_loop_driver_probe() for struct Scsi_Host->max_cmd_len 73703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger */ 83703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger#define TL_SCSI_MAX_CMD_LEN 32 93703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger 103703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellingerstruct tcm_loop_cmd { 113703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger /* State of Linux/SCSI CDB+Data descriptor */ 123703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger u32 sc_cmd_state; 133703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger /* Pointer to the CDB+Data descriptor from Linux/SCSI subsystem */ 143703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct scsi_cmnd *sc; 153703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct list_head *tl_cmd_list; 163703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger /* The TCM I/O descriptor that is accessed via container_of() */ 173703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_cmd tl_se_cmd; 183703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger /* Sense buffer that will be mapped into outgoing status */ 193703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger unsigned char tl_sense_buf[TRANSPORT_SENSE_BUFFER]; 203703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger}; 213703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger 223703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellingerstruct tcm_loop_tmr { 233703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger atomic_t tmr_complete; 243703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger wait_queue_head_t tl_tmr_wait; 253703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger}; 263703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger 273703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellingerstruct tcm_loop_nexus { 283703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger int it_nexus_active; 293703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger /* 303703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger * Pointer to Linux/SCSI HBA from linux/include/scsi_host.h 313703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger */ 323703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct scsi_host *sh; 333703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger /* 343703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger * Pointer to TCM session for I_T Nexus 353703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger */ 363703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_session *se_sess; 373703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger}; 383703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger 393703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellingerstruct tcm_loop_nacl { 403703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_node_acl se_node_acl; 413703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger}; 423703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger 433703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellingerstruct tcm_loop_tpg { 443703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger unsigned short tl_tpgt; 453703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger atomic_t tl_tpg_port_count; 463703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_portal_group tl_se_tpg; 473703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct tcm_loop_hba *tl_hba; 483703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger}; 493703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger 503703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellingerstruct tcm_loop_hba { 513703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger u8 tl_proto_id; 523703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger unsigned char tl_wwn_address[TL_WWN_ADDR_LEN]; 533703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_hba_s *se_hba; 543703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_lun *tl_hba_lun; 553703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_port *tl_hba_lun_sep; 563703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_device_s *se_dev_hba_ptr; 573703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct tcm_loop_nexus *tl_nexus; 583703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct device dev; 593703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct Scsi_Host *sh; 603703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct tcm_loop_tpg tl_hba_tpgs[TL_TPGS_PER_HBA]; 613703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger struct se_wwn tl_hba_wwn; 623703b2c5d041a68095cdd22380c23ce27d449ad7Nicholas Bellinger}; 63