diff options
author | FUJITA Tomonori <tomof@acm.org> | 2007-07-11 02:08:17 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:37:50 -0400 |
commit | 2c47f9efbedbe5749b6bb16e59bc11d6e460855f (patch) | |
tree | bfc1a2154f67c3aa45f92e586678ffc37e5f80eb /include | |
parent | aebd5e476ecc8ceb53577b20f2a352ff4ceffd8d (diff) |
[SCSI] tgt: add I_T nexus support
tgt uses scsi_host as I_T nexus. This works for ibmvstgt because it
creates one scsi_host for one initiator. However, other target drivers
don't work like that.
This adds I_T nexus support, which enable one scsi_host to handle
multiple initiators. New scsi_tgt_it_nexus_create/destroy functions
are expected be called transport classes. For example, ibmvstgt
creates an initiator remote port, then the srp transport calls
tgt_it_nexus_create. tgt doesn't manages I_T nexus, instead it tells
tgtd, user-space daemon, to create a new I_T nexus.
On the receiving the response from tgtd, tgt calls
shost->transportt->it_nexus_response. transports should notify a
lld. The srp transport uses it_nexus_response callback in
srp_function_template to do that.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/scsi/scsi_host.h | 2 | ||||
-rw-r--r-- | include/scsi/scsi_tgt.h | 8 | ||||
-rw-r--r-- | include/scsi/scsi_tgt_if.h | 35 | ||||
-rw-r--r-- | include/scsi/scsi_transport.h | 6 |
4 files changed, 39 insertions, 12 deletions
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 3b8a6a85c2f8..89c40c4bd5c4 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h | |||
@@ -146,7 +146,7 @@ struct scsi_host_template { | |||
146 | void (*done)(struct scsi_cmnd *)); | 146 | void (*done)(struct scsi_cmnd *)); |
147 | 147 | ||
148 | /* Used as callback for the completion of task management request. */ | 148 | /* Used as callback for the completion of task management request. */ |
149 | int (* tsk_mgmt_response)(u64 mid, int result); | 149 | int (* tsk_mgmt_response)(struct Scsi_Host *, u64, u64 mid, int result); |
150 | 150 | ||
151 | /* | 151 | /* |
152 | * This is an error handling strategy routine. You don't need to | 152 | * This is an error handling strategy routine. You don't need to |
diff --git a/include/scsi/scsi_tgt.h b/include/scsi/scsi_tgt.h index 4f4427937af2..d0fefb96158f 100644 --- a/include/scsi/scsi_tgt.h +++ b/include/scsi/scsi_tgt.h | |||
@@ -11,9 +11,11 @@ struct scsi_lun; | |||
11 | extern struct Scsi_Host *scsi_tgt_cmd_to_host(struct scsi_cmnd *); | 11 | extern struct Scsi_Host *scsi_tgt_cmd_to_host(struct scsi_cmnd *); |
12 | extern int scsi_tgt_alloc_queue(struct Scsi_Host *); | 12 | extern int scsi_tgt_alloc_queue(struct Scsi_Host *); |
13 | extern void scsi_tgt_free_queue(struct Scsi_Host *); | 13 | extern void scsi_tgt_free_queue(struct Scsi_Host *); |
14 | extern int scsi_tgt_queue_command(struct scsi_cmnd *, struct scsi_lun *, u64); | 14 | extern int scsi_tgt_queue_command(struct scsi_cmnd *, u64, struct scsi_lun *, u64); |
15 | extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, int, u64, struct scsi_lun *, | 15 | extern int scsi_tgt_tsk_mgmt_request(struct Scsi_Host *, u64, int, u64, |
16 | void *); | 16 | struct scsi_lun *, void *); |
17 | extern struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *, | 17 | extern struct scsi_cmnd *scsi_host_get_command(struct Scsi_Host *, |
18 | enum dma_data_direction, gfp_t); | 18 | enum dma_data_direction, gfp_t); |
19 | extern void scsi_host_put_command(struct Scsi_Host *, struct scsi_cmnd *); | 19 | extern void scsi_host_put_command(struct Scsi_Host *, struct scsi_cmnd *); |
20 | extern int scsi_tgt_it_nexus_create(struct Scsi_Host *, u64, char *); | ||
21 | extern int scsi_tgt_it_nexus_destroy(struct Scsi_Host *, u64); | ||
diff --git a/include/scsi/scsi_tgt_if.h b/include/scsi/scsi_tgt_if.h index 4cf9dff29a2f..f2ee7c238a45 100644 --- a/include/scsi/scsi_tgt_if.h +++ b/include/scsi/scsi_tgt_if.h | |||
@@ -23,13 +23,15 @@ | |||
23 | #define __SCSI_TARGET_IF_H | 23 | #define __SCSI_TARGET_IF_H |
24 | 24 | ||
25 | /* user -> kernel */ | 25 | /* user -> kernel */ |
26 | #define TGT_UEVENT_CMD_RSP 0x0001 | 26 | #define TGT_UEVENT_CMD_RSP 0x0001 |
27 | #define TGT_UEVENT_TSK_MGMT_RSP 0x0002 | 27 | #define TGT_UEVENT_IT_NEXUS_RSP 0x0002 |
28 | #define TGT_UEVENT_TSK_MGMT_RSP 0x0003 | ||
28 | 29 | ||
29 | /* kernel -> user */ | 30 | /* kernel -> user */ |
30 | #define TGT_KEVENT_CMD_REQ 0x1001 | 31 | #define TGT_KEVENT_CMD_REQ 0x1001 |
31 | #define TGT_KEVENT_CMD_DONE 0x1002 | 32 | #define TGT_KEVENT_CMD_DONE 0x1002 |
32 | #define TGT_KEVENT_TSK_MGMT_REQ 0x1003 | 33 | #define TGT_KEVENT_IT_NEXUS_REQ 0x1003 |
34 | #define TGT_KEVENT_TSK_MGMT_REQ 0x1004 | ||
33 | 35 | ||
34 | struct tgt_event_hdr { | 36 | struct tgt_event_hdr { |
35 | uint16_t version; | 37 | uint16_t version; |
@@ -46,6 +48,7 @@ struct tgt_event { | |||
46 | struct { | 48 | struct { |
47 | int host_no; | 49 | int host_no; |
48 | int result; | 50 | int result; |
51 | aligned_u64 itn_id; | ||
49 | aligned_u64 tag; | 52 | aligned_u64 tag; |
50 | aligned_u64 uaddr; | 53 | aligned_u64 uaddr; |
51 | aligned_u64 sense_uaddr; | 54 | aligned_u64 sense_uaddr; |
@@ -55,15 +58,22 @@ struct tgt_event { | |||
55 | } cmd_rsp; | 58 | } cmd_rsp; |
56 | struct { | 59 | struct { |
57 | int host_no; | 60 | int host_no; |
58 | aligned_u64 mid; | ||
59 | int result; | 61 | int result; |
62 | aligned_u64 itn_id; | ||
63 | aligned_u64 mid; | ||
60 | } tsk_mgmt_rsp; | 64 | } tsk_mgmt_rsp; |
61 | 65 | struct { | |
66 | __s32 host_no; | ||
67 | __s32 result; | ||
68 | aligned_u64 itn_id; | ||
69 | __u32 function; | ||
70 | } it_nexus_rsp; | ||
62 | 71 | ||
63 | /* kernel -> user */ | 72 | /* kernel -> user */ |
64 | struct { | 73 | struct { |
65 | int host_no; | 74 | int host_no; |
66 | uint32_t data_len; | 75 | uint32_t data_len; |
76 | aligned_u64 itn_id; | ||
67 | uint8_t scb[16]; | 77 | uint8_t scb[16]; |
68 | uint8_t lun[8]; | 78 | uint8_t lun[8]; |
69 | int attribute; | 79 | int attribute; |
@@ -71,16 +81,25 @@ struct tgt_event { | |||
71 | } cmd_req; | 81 | } cmd_req; |
72 | struct { | 82 | struct { |
73 | int host_no; | 83 | int host_no; |
74 | aligned_u64 tag; | ||
75 | int result; | 84 | int result; |
85 | aligned_u64 itn_id; | ||
86 | aligned_u64 tag; | ||
76 | } cmd_done; | 87 | } cmd_done; |
77 | struct { | 88 | struct { |
78 | int host_no; | 89 | int host_no; |
79 | int function; | 90 | int function; |
91 | aligned_u64 itn_id; | ||
80 | aligned_u64 tag; | 92 | aligned_u64 tag; |
81 | uint8_t lun[8]; | 93 | uint8_t lun[8]; |
82 | aligned_u64 mid; | 94 | aligned_u64 mid; |
83 | } tsk_mgmt_req; | 95 | } tsk_mgmt_req; |
96 | struct { | ||
97 | __s32 host_no; | ||
98 | __u32 function; | ||
99 | aligned_u64 itn_id; | ||
100 | __u32 max_cmds; | ||
101 | __u8 initiator_id[16]; | ||
102 | } it_nexus_req; | ||
84 | } p; | 103 | } p; |
85 | } __attribute__ ((aligned (sizeof(uint64_t)))); | 104 | } __attribute__ ((aligned (sizeof(uint64_t)))); |
86 | 105 | ||
diff --git a/include/scsi/scsi_transport.h b/include/scsi/scsi_transport.h index 3c18baa65a72..af5b3e15e64e 100644 --- a/include/scsi/scsi_transport.h +++ b/include/scsi/scsi_transport.h | |||
@@ -65,6 +65,12 @@ struct scsi_transport_template { | |||
65 | * EH_NOT_HANDLED Begin normal error recovery | 65 | * EH_NOT_HANDLED Begin normal error recovery |
66 | */ | 66 | */ |
67 | enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); | 67 | enum scsi_eh_timer_return (* eh_timed_out)(struct scsi_cmnd *); |
68 | |||
69 | /* | ||
70 | * Used as callback for the completion of i_t_nexus request | ||
71 | * for target drivers. | ||
72 | */ | ||
73 | int (* it_nexus_response)(struct Scsi_Host *, u64, int); | ||
68 | }; | 74 | }; |
69 | 75 | ||
70 | #define transport_class_to_shost(tc) \ | 76 | #define transport_class_to_shost(tc) \ |