diff options
Diffstat (limited to 'include/scsi')
-rw-r--r-- | include/scsi/scsi_bsg_iscsi.h | 110 | ||||
-rw-r--r-- | include/scsi/scsi_transport_iscsi.h | 7 |
2 files changed, 116 insertions, 1 deletions
diff --git a/include/scsi/scsi_bsg_iscsi.h b/include/scsi/scsi_bsg_iscsi.h new file mode 100644 index 000000000000..fd5689d4c052 --- /dev/null +++ b/include/scsi/scsi_bsg_iscsi.h | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * iSCSI Transport BSG Interface | ||
3 | * | ||
4 | * Copyright (C) 2009 James Smart, Emulex Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #ifndef SCSI_BSG_ISCSI_H | ||
23 | #define SCSI_BSG_ISCSI_H | ||
24 | |||
25 | /* | ||
26 | * This file intended to be included by both kernel and user space | ||
27 | */ | ||
28 | |||
29 | #include <scsi/scsi.h> | ||
30 | |||
31 | /* | ||
32 | * iSCSI Transport SGIO v4 BSG Message Support | ||
33 | */ | ||
34 | |||
35 | /* Default BSG request timeout (in seconds) */ | ||
36 | #define ISCSI_DEFAULT_BSG_TIMEOUT (10 * HZ) | ||
37 | |||
38 | |||
39 | /* | ||
40 | * Request Message Codes supported by the iSCSI Transport | ||
41 | */ | ||
42 | |||
43 | /* define the class masks for the message codes */ | ||
44 | #define ISCSI_BSG_CLS_MASK 0xF0000000 /* find object class */ | ||
45 | #define ISCSI_BSG_HST_MASK 0x80000000 /* iscsi host class */ | ||
46 | |||
47 | /* iscsi host Message Codes */ | ||
48 | #define ISCSI_BSG_HST_VENDOR (ISCSI_BSG_HST_MASK | 0x000000FF) | ||
49 | |||
50 | |||
51 | /* | ||
52 | * iSCSI Host Messages | ||
53 | */ | ||
54 | |||
55 | /* ISCSI_BSG_HST_VENDOR : */ | ||
56 | |||
57 | /* Request: | ||
58 | * Note: When specifying vendor_id, be sure to read the Vendor Type and ID | ||
59 | * formatting requirements specified in scsi_netlink.h | ||
60 | */ | ||
61 | struct iscsi_bsg_host_vendor { | ||
62 | /* | ||
63 | * Identifies the vendor that the message is formatted for. This | ||
64 | * should be the recipient of the message. | ||
65 | */ | ||
66 | uint64_t vendor_id; | ||
67 | |||
68 | /* start of vendor command area */ | ||
69 | uint32_t vendor_cmd[0]; | ||
70 | }; | ||
71 | |||
72 | /* Response: | ||
73 | */ | ||
74 | struct iscsi_bsg_host_vendor_reply { | ||
75 | /* start of vendor response area */ | ||
76 | uint32_t vendor_rsp[0]; | ||
77 | }; | ||
78 | |||
79 | |||
80 | /* request (CDB) structure of the sg_io_v4 */ | ||
81 | struct iscsi_bsg_request { | ||
82 | uint32_t msgcode; | ||
83 | union { | ||
84 | struct iscsi_bsg_host_vendor h_vendor; | ||
85 | } rqst_data; | ||
86 | } __attribute__((packed)); | ||
87 | |||
88 | |||
89 | /* response (request sense data) structure of the sg_io_v4 */ | ||
90 | struct iscsi_bsg_reply { | ||
91 | /* | ||
92 | * The completion result. Result exists in two forms: | ||
93 | * if negative, it is an -Exxx system errno value. There will | ||
94 | * be no further reply information supplied. | ||
95 | * else, it's the 4-byte scsi error result, with driver, host, | ||
96 | * msg and status fields. The per-msgcode reply structure | ||
97 | * will contain valid data. | ||
98 | */ | ||
99 | uint32_t result; | ||
100 | |||
101 | /* If there was reply_payload, how much was recevied ? */ | ||
102 | uint32_t reply_payload_rcv_len; | ||
103 | |||
104 | union { | ||
105 | struct iscsi_bsg_host_vendor_reply vendor_reply; | ||
106 | } reply_data; | ||
107 | }; | ||
108 | |||
109 | |||
110 | #endif /* SCSI_BSG_ISCSI_H */ | ||
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h index 77e6dd60fb4b..4a3edeeae8f6 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h | |||
@@ -38,6 +38,7 @@ struct iscsi_conn; | |||
38 | struct iscsi_task; | 38 | struct iscsi_task; |
39 | struct sockaddr; | 39 | struct sockaddr; |
40 | struct iscsi_iface; | 40 | struct iscsi_iface; |
41 | struct bsg_job; | ||
41 | 42 | ||
42 | /** | 43 | /** |
43 | * struct iscsi_transport - iSCSI Transport template | 44 | * struct iscsi_transport - iSCSI Transport template |
@@ -141,9 +142,9 @@ struct iscsi_transport { | |||
141 | enum iscsi_param_type param_type, | 142 | enum iscsi_param_type param_type, |
142 | int param, char *buf); | 143 | int param, char *buf); |
143 | mode_t (*attr_is_visible)(int param_type, int param); | 144 | mode_t (*attr_is_visible)(int param_type, int param); |
145 | int (*bsg_request)(struct bsg_job *job); | ||
144 | }; | 146 | }; |
145 | 147 | ||
146 | |||
147 | /* | 148 | /* |
148 | * transport registration upcalls | 149 | * transport registration upcalls |
149 | */ | 150 | */ |
@@ -227,8 +228,12 @@ struct iscsi_cls_session { | |||
227 | struct iscsi_cls_host { | 228 | struct iscsi_cls_host { |
228 | atomic_t nr_scans; | 229 | atomic_t nr_scans; |
229 | struct mutex mutex; | 230 | struct mutex mutex; |
231 | struct request_queue *bsg_q; | ||
230 | }; | 232 | }; |
231 | 233 | ||
234 | #define iscsi_job_to_shost(_job) \ | ||
235 | dev_to_shost(_job->dev) | ||
236 | |||
232 | extern void iscsi_host_for_each_session(struct Scsi_Host *shost, | 237 | extern void iscsi_host_for_each_session(struct Scsi_Host *shost, |
233 | void (*fn)(struct iscsi_cls_session *)); | 238 | void (*fn)(struct iscsi_cls_session *)); |
234 | 239 | ||