1*8dcf07beSBart Van Assche #include <linux/types.h> 2*8dcf07beSBart Van Assche #include <linux/device.h> 3*8dcf07beSBart Van Assche #include <target/target_core_base.h> /* struct se_cmd */ 4*8dcf07beSBart Van Assche 59765b1f3SNicholas Bellinger #define TCM_LOOP_VERSION "v2.1-rc2" 63703b2c5SNicholas Bellinger #define TL_WWN_ADDR_LEN 256 73703b2c5SNicholas Bellinger #define TL_TPGS_PER_HBA 32 82e88efd3SChristoph Hellwig 93703b2c5SNicholas Bellinger struct tcm_loop_cmd { 103703b2c5SNicholas Bellinger /* State of Linux/SCSI CDB+Data descriptor */ 113703b2c5SNicholas Bellinger u32 sc_cmd_state; 12969871cdSHannes Reinecke /* Tagged command queueing */ 13969871cdSHannes Reinecke u32 sc_cmd_tag; 143703b2c5SNicholas Bellinger /* Pointer to the CDB+Data descriptor from Linux/SCSI subsystem */ 153703b2c5SNicholas Bellinger struct scsi_cmnd *sc; 163703b2c5SNicholas Bellinger /* The TCM I/O descriptor that is accessed via container_of() */ 173703b2c5SNicholas Bellinger struct se_cmd tl_se_cmd; 18afe2cb7fSChristoph Hellwig struct work_struct work; 193703b2c5SNicholas Bellinger /* Sense buffer that will be mapped into outgoing status */ 203703b2c5SNicholas Bellinger unsigned char tl_sense_buf[TRANSPORT_SENSE_BUFFER]; 213703b2c5SNicholas Bellinger }; 223703b2c5SNicholas Bellinger 233703b2c5SNicholas Bellinger struct tcm_loop_tmr { 243703b2c5SNicholas Bellinger atomic_t tmr_complete; 253703b2c5SNicholas Bellinger wait_queue_head_t tl_tmr_wait; 263703b2c5SNicholas Bellinger }; 273703b2c5SNicholas Bellinger 283703b2c5SNicholas Bellinger struct tcm_loop_nexus { 293703b2c5SNicholas Bellinger /* 303703b2c5SNicholas Bellinger * Pointer to TCM session for I_T Nexus 313703b2c5SNicholas Bellinger */ 323703b2c5SNicholas Bellinger struct se_session *se_sess; 333703b2c5SNicholas Bellinger }; 343703b2c5SNicholas Bellinger 35fb2b2844SHannes Reinecke #define TCM_TRANSPORT_ONLINE 0 36fb2b2844SHannes Reinecke #define TCM_TRANSPORT_OFFLINE 1 37fb2b2844SHannes Reinecke 383703b2c5SNicholas Bellinger struct tcm_loop_tpg { 393703b2c5SNicholas Bellinger unsigned short tl_tpgt; 40fb2b2844SHannes Reinecke unsigned short tl_transport_status; 41436f4a0aSNicholas Bellinger enum target_prot_type tl_fabric_prot_type; 423703b2c5SNicholas Bellinger atomic_t tl_tpg_port_count; 433703b2c5SNicholas Bellinger struct se_portal_group tl_se_tpg; 443703b2c5SNicholas Bellinger struct tcm_loop_hba *tl_hba; 45506787a2SHannes Reinecke struct tcm_loop_nexus *tl_nexus; 463703b2c5SNicholas Bellinger }; 473703b2c5SNicholas Bellinger 483703b2c5SNicholas Bellinger struct tcm_loop_hba { 493703b2c5SNicholas Bellinger u8 tl_proto_id; 503703b2c5SNicholas Bellinger unsigned char tl_wwn_address[TL_WWN_ADDR_LEN]; 513703b2c5SNicholas Bellinger struct se_hba_s *se_hba; 523703b2c5SNicholas Bellinger struct se_lun *tl_hba_lun; 533703b2c5SNicholas Bellinger struct se_port *tl_hba_lun_sep; 543703b2c5SNicholas Bellinger struct device dev; 553703b2c5SNicholas Bellinger struct Scsi_Host *sh; 563703b2c5SNicholas Bellinger struct tcm_loop_tpg tl_hba_tpgs[TL_TPGS_PER_HBA]; 573703b2c5SNicholas Bellinger struct se_wwn tl_hba_wwn; 583703b2c5SNicholas Bellinger }; 59