Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #include <linux/types.h>
0003 #include <linux/device.h>
0004 #include <target/target_core_base.h> /* struct se_cmd */
0005 
0006 #define TCM_LOOP_VERSION        "v2.1-rc2"
0007 #define TL_WWN_ADDR_LEN         256
0008 #define TL_TPGS_PER_HBA         32
0009 
0010 struct tcm_loop_cmd {
0011     /* State of Linux/SCSI CDB+Data descriptor */
0012     u32 sc_cmd_state;
0013     /* Tagged command queueing */
0014     u32 sc_cmd_tag;
0015     /* Pointer to the CDB+Data descriptor from Linux/SCSI subsystem */
0016     struct scsi_cmnd *sc;
0017     /* The TCM I/O descriptor that is accessed via container_of() */
0018     struct se_cmd tl_se_cmd;
0019     struct completion tmr_done;
0020     /* Sense buffer that will be mapped into outgoing status */
0021     unsigned char tl_sense_buf[TRANSPORT_SENSE_BUFFER];
0022 };
0023 
0024 struct tcm_loop_nexus {
0025     /*
0026      * Pointer to TCM session for I_T Nexus
0027      */
0028     struct se_session *se_sess;
0029 };
0030 
0031 #define TCM_TRANSPORT_ONLINE 0
0032 #define TCM_TRANSPORT_OFFLINE 1
0033 
0034 struct tcm_loop_tpg {
0035     unsigned short tl_tpgt;
0036     unsigned short tl_transport_status;
0037     enum target_prot_type tl_fabric_prot_type;
0038     atomic_t tl_tpg_port_count;
0039     struct se_portal_group tl_se_tpg;
0040     struct tcm_loop_hba *tl_hba;
0041     struct tcm_loop_nexus *tl_nexus;
0042 };
0043 
0044 struct tcm_loop_hba {
0045     u8 tl_proto_id;
0046     unsigned char tl_wwn_address[TL_WWN_ADDR_LEN];
0047     struct se_hba_s *se_hba;
0048     struct se_lun *tl_hba_lun;
0049     struct se_port *tl_hba_lun_sep;
0050     struct device dev;
0051     struct Scsi_Host *sh;
0052     struct tcm_loop_tpg tl_hba_tpgs[TL_TPGS_PER_HBA];
0053     struct se_wwn tl_hba_wwn;
0054 };