]>
Commit | Line | Data |
---|---|---|
057cbf49 NB |
1 | #define TCM_VHOST_VERSION "v0.1" |
2 | #define TCM_VHOST_NAMELEN 256 | |
3 | #define TCM_VHOST_MAX_CDB_SIZE 32 | |
4 | ||
5 | struct tcm_vhost_cmd { | |
6 | /* Descriptor from vhost_get_vq_desc() for virt_queue segment */ | |
7 | int tvc_vq_desc; | |
8 | /* The Tag from include/linux/virtio_scsi.h:struct virtio_scsi_cmd_req */ | |
9 | u64 tvc_tag; | |
10 | /* The number of scatterlists associated with this cmd */ | |
11 | u32 tvc_sgl_count; | |
12 | /* Saved unpacked SCSI LUN for tcm_vhost_submission_work() */ | |
13 | u32 tvc_lun; | |
14 | /* Pointer to the SGL formatted memory from virtio-scsi */ | |
15 | struct scatterlist *tvc_sgl; | |
16 | /* Pointer to response */ | |
17 | struct virtio_scsi_cmd_resp __user *tvc_resp; | |
18 | /* Pointer to vhost_scsi for our device */ | |
19 | struct vhost_scsi *tvc_vhost; | |
20 | /* The TCM I/O descriptor that is accessed via container_of() */ | |
21 | struct se_cmd tvc_se_cmd; | |
22 | /* work item used for cmwq dispatch to tcm_vhost_submission_work() */ | |
23 | struct work_struct work; | |
24 | /* Copy of the incoming SCSI command descriptor block (CDB) */ | |
25 | unsigned char tvc_cdb[TCM_VHOST_MAX_CDB_SIZE]; | |
26 | /* Sense buffer that will be mapped into outgoing status */ | |
27 | unsigned char tvc_sense_buf[TRANSPORT_SENSE_BUFFER]; | |
28 | /* Completed commands list, serviced from vhost worker thread */ | |
29 | struct list_head tvc_completion_list; | |
30 | }; | |
31 | ||
32 | struct tcm_vhost_nexus { | |
33 | /* Pointer to TCM session for I_T Nexus */ | |
34 | struct se_session *tvn_se_sess; | |
35 | }; | |
36 | ||
37 | struct tcm_vhost_nacl { | |
38 | /* Binary World Wide unique Port Name for Vhost Initiator port */ | |
39 | u64 iport_wwpn; | |
40 | /* ASCII formatted WWPN for Sas Initiator port */ | |
41 | char iport_name[TCM_VHOST_NAMELEN]; | |
42 | /* Returned by tcm_vhost_make_nodeacl() */ | |
43 | struct se_node_acl se_node_acl; | |
44 | }; | |
45 | ||
46 | struct tcm_vhost_tpg { | |
47 | /* Vhost port target portal group tag for TCM */ | |
48 | u16 tport_tpgt; | |
49 | /* Used to track number of TPG Port/Lun Links wrt to explict I_T Nexus shutdown */ | |
50 | atomic_t tv_tpg_port_count; | |
51 | /* Used for vhost_scsi device reference to tpg_nexus */ | |
52 | atomic_t tv_tpg_vhost_count; | |
53 | /* list for tcm_vhost_list */ | |
54 | struct list_head tv_tpg_list; | |
55 | /* Used to protect access for tpg_nexus */ | |
56 | struct mutex tv_tpg_mutex; | |
57 | /* Pointer to the TCM VHost I_T Nexus for this TPG endpoint */ | |
58 | struct tcm_vhost_nexus *tpg_nexus; | |
59 | /* Pointer back to tcm_vhost_tport */ | |
60 | struct tcm_vhost_tport *tport; | |
61 | /* Returned by tcm_vhost_make_tpg() */ | |
62 | struct se_portal_group se_tpg; | |
63 | }; | |
64 | ||
65 | struct tcm_vhost_tport { | |
66 | /* SCSI protocol the tport is providing */ | |
67 | u8 tport_proto_id; | |
68 | /* Binary World Wide unique Port Name for Vhost Target port */ | |
69 | u64 tport_wwpn; | |
70 | /* ASCII formatted WWPN for Vhost Target port */ | |
71 | char tport_name[TCM_VHOST_NAMELEN]; | |
72 | /* Returned by tcm_vhost_make_tport() */ | |
73 | struct se_wwn tport_wwn; | |
74 | }; | |
75 | ||
76 | /* | |
77 | * As per request from MST, keep TCM_VHOST related ioctl defines out of | |
78 | * linux/vhost.h (user-space) for now.. | |
79 | */ | |
80 | ||
81 | #include <linux/vhost.h> | |
82 | ||
83 | /* | |
84 | * Used by QEMU userspace to ensure a consistent vhost-scsi ABI. | |
85 | * | |
86 | * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate + | |
87 | * RFC-v2 vhost-scsi userspace. Add GET_ABI_VERSION ioctl usage | |
88 | */ | |
89 | ||
90 | #define VHOST_SCSI_ABI_VERSION 0 | |
91 | ||
92 | struct vhost_scsi_target { | |
93 | int abi_version; | |
94 | unsigned char vhost_wwpn[TRANSPORT_IQN_LEN]; | |
95 | unsigned short vhost_tpgt; | |
96 | }; | |
97 | ||
98 | /* VHOST_SCSI specific defines */ | |
99 | #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target) | |
100 | #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) | |
101 | #define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, struct vhost_scsi_target) |