19765b1f3SNicholas Bellinger #define TCM_LOOP_VERSION "v2.1-rc2" 23703b2c5SNicholas Bellinger #define TL_WWN_ADDR_LEN 256 33703b2c5SNicholas Bellinger #define TL_TPGS_PER_HBA 32 42e88efd3SChristoph Hellwig 53703b2c5SNicholas Bellinger /* 63703b2c5SNicholas Bellinger * Used in tcm_loop_driver_probe() for struct Scsi_Host->max_cmd_len 73703b2c5SNicholas Bellinger */ 83703b2c5SNicholas Bellinger #define TL_SCSI_MAX_CMD_LEN 32 93703b2c5SNicholas Bellinger 103703b2c5SNicholas Bellinger struct tcm_loop_cmd { 113703b2c5SNicholas Bellinger /* State of Linux/SCSI CDB+Data descriptor */ 123703b2c5SNicholas Bellinger u32 sc_cmd_state; 13*969871cdSHannes Reinecke /* Tagged command queueing */ 14*969871cdSHannes Reinecke u32 sc_cmd_tag; 153703b2c5SNicholas Bellinger /* Pointer to the CDB+Data descriptor from Linux/SCSI subsystem */ 163703b2c5SNicholas Bellinger struct scsi_cmnd *sc; 173703b2c5SNicholas Bellinger /* The TCM I/O descriptor that is accessed via container_of() */ 183703b2c5SNicholas Bellinger struct se_cmd tl_se_cmd; 19afe2cb7fSChristoph Hellwig struct work_struct work; 203703b2c5SNicholas Bellinger /* Sense buffer that will be mapped into outgoing status */ 213703b2c5SNicholas Bellinger unsigned char tl_sense_buf[TRANSPORT_SENSE_BUFFER]; 223703b2c5SNicholas Bellinger }; 233703b2c5SNicholas Bellinger 243703b2c5SNicholas Bellinger struct tcm_loop_tmr { 253703b2c5SNicholas Bellinger atomic_t tmr_complete; 263703b2c5SNicholas Bellinger wait_queue_head_t tl_tmr_wait; 273703b2c5SNicholas Bellinger }; 283703b2c5SNicholas Bellinger 293703b2c5SNicholas Bellinger struct tcm_loop_nexus { 303703b2c5SNicholas Bellinger int it_nexus_active; 313703b2c5SNicholas Bellinger /* 323703b2c5SNicholas Bellinger * Pointer to Linux/SCSI HBA from linux/include/scsi_host.h 333703b2c5SNicholas Bellinger */ 343703b2c5SNicholas Bellinger struct scsi_host *sh; 353703b2c5SNicholas Bellinger /* 363703b2c5SNicholas Bellinger * Pointer to TCM session for I_T Nexus 373703b2c5SNicholas Bellinger */ 383703b2c5SNicholas Bellinger struct se_session *se_sess; 393703b2c5SNicholas Bellinger }; 403703b2c5SNicholas Bellinger 413703b2c5SNicholas Bellinger struct tcm_loop_nacl { 423703b2c5SNicholas Bellinger struct se_node_acl se_node_acl; 433703b2c5SNicholas Bellinger }; 443703b2c5SNicholas Bellinger 45fb2b2844SHannes Reinecke #define TCM_TRANSPORT_ONLINE 0 46fb2b2844SHannes Reinecke #define TCM_TRANSPORT_OFFLINE 1 47fb2b2844SHannes Reinecke 483703b2c5SNicholas Bellinger struct tcm_loop_tpg { 493703b2c5SNicholas Bellinger unsigned short tl_tpgt; 50fb2b2844SHannes Reinecke unsigned short tl_transport_status; 513703b2c5SNicholas Bellinger atomic_t tl_tpg_port_count; 523703b2c5SNicholas Bellinger struct se_portal_group tl_se_tpg; 533703b2c5SNicholas Bellinger struct tcm_loop_hba *tl_hba; 543703b2c5SNicholas Bellinger }; 553703b2c5SNicholas Bellinger 563703b2c5SNicholas Bellinger struct tcm_loop_hba { 573703b2c5SNicholas Bellinger u8 tl_proto_id; 583703b2c5SNicholas Bellinger unsigned char tl_wwn_address[TL_WWN_ADDR_LEN]; 593703b2c5SNicholas Bellinger struct se_hba_s *se_hba; 603703b2c5SNicholas Bellinger struct se_lun *tl_hba_lun; 613703b2c5SNicholas Bellinger struct se_port *tl_hba_lun_sep; 623703b2c5SNicholas Bellinger struct tcm_loop_nexus *tl_nexus; 633703b2c5SNicholas Bellinger struct device dev; 643703b2c5SNicholas Bellinger struct Scsi_Host *sh; 653703b2c5SNicholas Bellinger struct tcm_loop_tpg tl_hba_tpgs[TL_TPGS_PER_HBA]; 663703b2c5SNicholas Bellinger struct se_wwn tl_hba_wwn; 673703b2c5SNicholas Bellinger }; 68