diff options
Diffstat (limited to 'include/scsi/libfc.h')
-rw-r--r-- | include/scsi/libfc.h | 1158 |
1 files changed, 563 insertions, 595 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 65dc9aacbf7..4b912eee33e 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <scsi/scsi_transport.h> | 27 | #include <scsi/scsi_transport.h> |
28 | #include <scsi/scsi_transport_fc.h> | 28 | #include <scsi/scsi_transport_fc.h> |
29 | #include <scsi/scsi_bsg_fc.h> | ||
29 | 30 | ||
30 | #include <scsi/fc/fc_fcp.h> | 31 | #include <scsi/fc/fc_fcp.h> |
31 | #include <scsi/fc/fc_ns.h> | 32 | #include <scsi/fc/fc_ns.h> |
@@ -34,67 +35,6 @@ | |||
34 | 35 | ||
35 | #include <scsi/fc_frame.h> | 36 | #include <scsi/fc_frame.h> |
36 | 37 | ||
37 | #define FC_LIBFC_LOGGING 0x01 /* General logging, not categorized */ | ||
38 | #define FC_LPORT_LOGGING 0x02 /* lport layer logging */ | ||
39 | #define FC_DISC_LOGGING 0x04 /* discovery layer logging */ | ||
40 | #define FC_RPORT_LOGGING 0x08 /* rport layer logging */ | ||
41 | #define FC_FCP_LOGGING 0x10 /* I/O path logging */ | ||
42 | #define FC_EM_LOGGING 0x20 /* Exchange Manager logging */ | ||
43 | #define FC_EXCH_LOGGING 0x40 /* Exchange/Sequence logging */ | ||
44 | #define FC_SCSI_LOGGING 0x80 /* SCSI logging (mostly error handling) */ | ||
45 | |||
46 | extern unsigned int fc_debug_logging; | ||
47 | |||
48 | #define FC_CHECK_LOGGING(LEVEL, CMD) \ | ||
49 | do { \ | ||
50 | if (unlikely(fc_debug_logging & LEVEL)) \ | ||
51 | do { \ | ||
52 | CMD; \ | ||
53 | } while (0); \ | ||
54 | } while (0) | ||
55 | |||
56 | #define FC_LIBFC_DBG(fmt, args...) \ | ||
57 | FC_CHECK_LOGGING(FC_LIBFC_LOGGING, \ | ||
58 | printk(KERN_INFO "libfc: " fmt, ##args)) | ||
59 | |||
60 | #define FC_LPORT_DBG(lport, fmt, args...) \ | ||
61 | FC_CHECK_LOGGING(FC_LPORT_LOGGING, \ | ||
62 | printk(KERN_INFO "host%u: lport %6x: " fmt, \ | ||
63 | (lport)->host->host_no, \ | ||
64 | fc_host_port_id((lport)->host), ##args)) | ||
65 | |||
66 | #define FC_DISC_DBG(disc, fmt, args...) \ | ||
67 | FC_CHECK_LOGGING(FC_DISC_LOGGING, \ | ||
68 | printk(KERN_INFO "host%u: disc: " fmt, \ | ||
69 | (disc)->lport->host->host_no, \ | ||
70 | ##args)) | ||
71 | |||
72 | #define FC_RPORT_ID_DBG(lport, port_id, fmt, args...) \ | ||
73 | FC_CHECK_LOGGING(FC_RPORT_LOGGING, \ | ||
74 | printk(KERN_INFO "host%u: rport %6x: " fmt, \ | ||
75 | (lport)->host->host_no, \ | ||
76 | (port_id), ##args)) | ||
77 | |||
78 | #define FC_RPORT_DBG(rdata, fmt, args...) \ | ||
79 | FC_RPORT_ID_DBG((rdata)->local_port, (rdata)->ids.port_id, fmt, ##args) | ||
80 | |||
81 | #define FC_FCP_DBG(pkt, fmt, args...) \ | ||
82 | FC_CHECK_LOGGING(FC_FCP_LOGGING, \ | ||
83 | printk(KERN_INFO "host%u: fcp: %6x: " fmt, \ | ||
84 | (pkt)->lp->host->host_no, \ | ||
85 | pkt->rport->port_id, ##args)) | ||
86 | |||
87 | #define FC_EXCH_DBG(exch, fmt, args...) \ | ||
88 | FC_CHECK_LOGGING(FC_EXCH_LOGGING, \ | ||
89 | printk(KERN_INFO "host%u: xid %4x: " fmt, \ | ||
90 | (exch)->lp->host->host_no, \ | ||
91 | exch->xid, ##args)) | ||
92 | |||
93 | #define FC_SCSI_DBG(lport, fmt, args...) \ | ||
94 | FC_CHECK_LOGGING(FC_SCSI_LOGGING, \ | ||
95 | printk(KERN_INFO "host%u: scsi: " fmt, \ | ||
96 | (lport)->host->host_no, ##args)) | ||
97 | |||
98 | /* | 38 | /* |
99 | * libfc error codes | 39 | * libfc error codes |
100 | */ | 40 | */ |
@@ -115,15 +55,28 @@ do { \ | |||
115 | p[2] = ((v) & 0xFF); \ | 55 | p[2] = ((v) & 0xFF); \ |
116 | } while (0) | 56 | } while (0) |
117 | 57 | ||
118 | /* | 58 | /** |
119 | * FC HBA status | 59 | * enum fc_lport_state - Local port states |
60 | * @LPORT_ST_DISABLED: Disabled | ||
61 | * @LPORT_ST_FLOGI: Fabric login (FLOGI) sent | ||
62 | * @LPORT_ST_DNS: Waiting for name server remote port to become ready | ||
63 | * @LPORT_ST_RPN_ID: Register port name by ID (RPN_ID) sent | ||
64 | * @LPORT_ST_RFT_ID: Register Fibre Channel types by ID (RFT_ID) sent | ||
65 | * @LPORT_ST_RFF_ID: Register FC-4 Features by ID (RFF_ID) sent | ||
66 | * @LPORT_ST_SCR: State Change Register (SCR) sent | ||
67 | * @LPORT_ST_READY: Ready for use | ||
68 | * @LPORT_ST_LOGO: Local port logout (LOGO) sent | ||
69 | * @LPORT_ST_RESET: Local port reset | ||
120 | */ | 70 | */ |
121 | enum fc_lport_state { | 71 | enum fc_lport_state { |
122 | LPORT_ST_DISABLED = 0, | 72 | LPORT_ST_DISABLED = 0, |
123 | LPORT_ST_FLOGI, | 73 | LPORT_ST_FLOGI, |
124 | LPORT_ST_DNS, | 74 | LPORT_ST_DNS, |
125 | LPORT_ST_RPN_ID, | 75 | LPORT_ST_RNN_ID, |
76 | LPORT_ST_RSNN_NN, | ||
77 | LPORT_ST_RSPN_ID, | ||
126 | LPORT_ST_RFT_ID, | 78 | LPORT_ST_RFT_ID, |
79 | LPORT_ST_RFF_ID, | ||
127 | LPORT_ST_SCR, | 80 | LPORT_ST_SCR, |
128 | LPORT_ST_READY, | 81 | LPORT_ST_READY, |
129 | LPORT_ST_LOGO, | 82 | LPORT_ST_LOGO, |
@@ -136,15 +89,28 @@ enum fc_disc_event { | |||
136 | DISC_EV_FAILED | 89 | DISC_EV_FAILED |
137 | }; | 90 | }; |
138 | 91 | ||
92 | /** | ||
93 | * enum fc_rport_state - Remote port states | ||
94 | * @RPORT_ST_INIT: Initialized | ||
95 | * @RPORT_ST_PLOGI: Waiting for PLOGI completion | ||
96 | * @RPORT_ST_PRLI: Waiting for PRLI completion | ||
97 | * @RPORT_ST_RTV: Waiting for RTV completion | ||
98 | * @RPORT_ST_READY: Ready for use | ||
99 | * @RPORT_ST_LOGO: Remote port logout (LOGO) sent | ||
100 | * @RPORT_ST_ADISC: Discover Address sent | ||
101 | * @RPORT_ST_DELETE: Remote port being deleted | ||
102 | * @RPORT_ST_RESTART: Remote port being deleted and will restart | ||
103 | */ | ||
139 | enum fc_rport_state { | 104 | enum fc_rport_state { |
140 | RPORT_ST_INIT, /* initialized */ | 105 | RPORT_ST_INIT, |
141 | RPORT_ST_PLOGI, /* waiting for PLOGI completion */ | 106 | RPORT_ST_PLOGI, |
142 | RPORT_ST_PRLI, /* waiting for PRLI completion */ | 107 | RPORT_ST_PRLI, |
143 | RPORT_ST_RTV, /* waiting for RTV completion */ | 108 | RPORT_ST_RTV, |
144 | RPORT_ST_READY, /* ready for use */ | 109 | RPORT_ST_READY, |
145 | RPORT_ST_LOGO, /* port logout sent */ | 110 | RPORT_ST_LOGO, |
146 | RPORT_ST_ADISC, /* Discover Address sent */ | 111 | RPORT_ST_ADISC, |
147 | RPORT_ST_DELETE, /* port being deleted */ | 112 | RPORT_ST_DELETE, |
113 | RPORT_ST_RESTART, | ||
148 | }; | 114 | }; |
149 | 115 | ||
150 | /** | 116 | /** |
@@ -155,12 +121,20 @@ enum fc_rport_state { | |||
155 | * @port_id: Port ID of the discovered port | 121 | * @port_id: Port ID of the discovered port |
156 | */ | 122 | */ |
157 | struct fc_disc_port { | 123 | struct fc_disc_port { |
158 | struct fc_lport *lp; | 124 | struct fc_lport *lp; |
159 | struct list_head peers; | 125 | struct list_head peers; |
160 | struct work_struct rport_work; | 126 | struct work_struct rport_work; |
161 | u32 port_id; | 127 | u32 port_id; |
162 | }; | 128 | }; |
163 | 129 | ||
130 | /** | ||
131 | * enum fc_rport_event - Remote port events | ||
132 | * @RPORT_EV_NONE: No event | ||
133 | * @RPORT_EV_READY: Remote port is ready for use | ||
134 | * @RPORT_EV_FAILED: State machine failed, remote port is not ready | ||
135 | * @RPORT_EV_STOP: Remote port has been stopped | ||
136 | * @RPORT_EV_LOGO: Remote port logout (LOGO) sent | ||
137 | */ | ||
164 | enum fc_rport_event { | 138 | enum fc_rport_event { |
165 | RPORT_EV_NONE = 0, | 139 | RPORT_EV_NONE = 0, |
166 | RPORT_EV_READY, | 140 | RPORT_EV_READY, |
@@ -171,6 +145,10 @@ enum fc_rport_event { | |||
171 | 145 | ||
172 | struct fc_rport_priv; | 146 | struct fc_rport_priv; |
173 | 147 | ||
148 | /** | ||
149 | * struct fc_rport_operations - Operations for a remote port | ||
150 | * @event_callback: Function to be called for remote port events | ||
151 | */ | ||
174 | struct fc_rport_operations { | 152 | struct fc_rport_operations { |
175 | void (*event_callback)(struct fc_lport *, struct fc_rport_priv *, | 153 | void (*event_callback)(struct fc_lport *, struct fc_rport_priv *, |
176 | enum fc_rport_event); | 154 | enum fc_rport_event); |
@@ -178,11 +156,11 @@ struct fc_rport_operations { | |||
178 | 156 | ||
179 | /** | 157 | /** |
180 | * struct fc_rport_libfc_priv - libfc internal information about a remote port | 158 | * struct fc_rport_libfc_priv - libfc internal information about a remote port |
181 | * @local_port: Fibre Channel host port instance | 159 | * @local_port: The associated local port |
182 | * @rp_state: indicates READY for I/O or DELETE when blocked. | 160 | * @rp_state: Indicates READY for I/O or DELETE when blocked |
183 | * @flags: REC and RETRY supported flags | 161 | * @flags: REC and RETRY supported flags |
184 | * @e_d_tov: error detect timeout value (in msec) | 162 | * @e_d_tov: Error detect timeout value (in msec) |
185 | * @r_a_tov: resource allocation timeout value (in msec) | 163 | * @r_a_tov: Resource allocation timeout value (in msec) |
186 | */ | 164 | */ |
187 | struct fc_rport_libfc_priv { | 165 | struct fc_rport_libfc_priv { |
188 | struct fc_lport *local_port; | 166 | struct fc_lport *local_port; |
@@ -195,47 +173,66 @@ struct fc_rport_libfc_priv { | |||
195 | }; | 173 | }; |
196 | 174 | ||
197 | /** | 175 | /** |
198 | * struct fc_rport_priv - libfc rport and discovery info about a remote port | 176 | * struct fc_rport_priv - libfc remote port and discovery info |
199 | * @local_port: Fibre Channel host port instance | 177 | * @local_port: The associated local port |
200 | * @rport: transport remote port | 178 | * @rport: The FC transport remote port |
201 | * @kref: reference counter | 179 | * @kref: Reference counter |
202 | * @rp_state: state tracks progress of PLOGI, PRLI, and RTV exchanges | 180 | * @rp_state: Enumeration that tracks progress of PLOGI, PRLI, |
203 | * @ids: remote port identifiers and roles | 181 | * and RTV exchanges |
204 | * @flags: REC and RETRY supported flags | 182 | * @ids: The remote port identifiers and roles |
205 | * @max_seq: maximum number of concurrent sequences | 183 | * @flags: REC and RETRY supported flags |
206 | * @disc_id: discovery identifier | 184 | * @max_seq: Maximum number of concurrent sequences |
207 | * @maxframe_size: maximum frame size | 185 | * @disc_id: The discovery identifier |
208 | * @retries: retry count in current state | 186 | * @maxframe_size: The maximum frame size |
209 | * @e_d_tov: error detect timeout value (in msec) | 187 | * @retries: The retry count for the current state |
210 | * @r_a_tov: resource allocation timeout value (in msec) | 188 | * @e_d_tov: Error detect timeout value (in msec) |
211 | * @rp_mutex: mutex protects rport | 189 | * @r_a_tov: Resource allocation timeout value (in msec) |
212 | * @retry_work: | 190 | * @rp_mutex: The mutex that protects the remote port |
213 | * @event_callback: Callback for rport READY, FAILED or LOGO | 191 | * @retry_work: Handle for retries |
192 | * @event_callback: Callback when READY, FAILED or LOGO states complete | ||
214 | */ | 193 | */ |
215 | struct fc_rport_priv { | 194 | struct fc_rport_priv { |
216 | struct fc_lport *local_port; | 195 | struct fc_lport *local_port; |
217 | struct fc_rport *rport; | 196 | struct fc_rport *rport; |
218 | struct kref kref; | 197 | struct kref kref; |
219 | enum fc_rport_state rp_state; | 198 | enum fc_rport_state rp_state; |
220 | struct fc_rport_identifiers ids; | 199 | struct fc_rport_identifiers ids; |
221 | u16 flags; | 200 | u16 flags; |
222 | u16 max_seq; | 201 | u16 max_seq; |
223 | u16 disc_id; | 202 | u16 disc_id; |
224 | u16 maxframe_size; | 203 | u16 maxframe_size; |
225 | unsigned int retries; | 204 | unsigned int retries; |
226 | unsigned int e_d_tov; | 205 | unsigned int e_d_tov; |
227 | unsigned int r_a_tov; | 206 | unsigned int r_a_tov; |
228 | struct mutex rp_mutex; | 207 | struct mutex rp_mutex; |
229 | struct delayed_work retry_work; | 208 | struct delayed_work retry_work; |
230 | enum fc_rport_event event; | 209 | enum fc_rport_event event; |
231 | struct fc_rport_operations *ops; | 210 | struct fc_rport_operations *ops; |
232 | struct list_head peers; | 211 | struct list_head peers; |
233 | struct work_struct event_work; | 212 | struct work_struct event_work; |
234 | u32 supported_classes; | 213 | u32 supported_classes; |
235 | }; | 214 | }; |
236 | 215 | ||
237 | /* | 216 | /** |
238 | * fcoe stats structure | 217 | * struct fcoe_dev_stats - fcoe stats structure |
218 | * @SecondsSinceLastReset: Seconds since the last reset | ||
219 | * @TxFrames: Number of transmitted frames | ||
220 | * @TxWords: Number of transmitted words | ||
221 | * @RxFrames: Number of received frames | ||
222 | * @RxWords: Number of received words | ||
223 | * @ErrorFrames: Number of received error frames | ||
224 | * @DumpedFrames: Number of dumped frames | ||
225 | * @LinkFailureCount: Number of link failures | ||
226 | * @LossOfSignalCount: Number for signal losses | ||
227 | * @InvalidTxWordCount: Number of invalid transmitted words | ||
228 | * @InvalidCRCCount: Number of invalid CRCs | ||
229 | * @InputRequests: Number of input requests | ||
230 | * @OutputRequests: Number of output requests | ||
231 | * @ControlRequests: Number of control requests | ||
232 | * @InputMegabytes: Number of received megabytes | ||
233 | * @OutputMegabytes: Number of transmitted megabytes | ||
234 | * @VLinkFailureCount: Number of virtual link failures | ||
235 | * @MissDiscAdvCount: Number of missing FIP discovery advertisement | ||
239 | */ | 236 | */ |
240 | struct fcoe_dev_stats { | 237 | struct fcoe_dev_stats { |
241 | u64 SecondsSinceLastReset; | 238 | u64 SecondsSinceLastReset; |
@@ -254,12 +251,17 @@ struct fcoe_dev_stats { | |||
254 | u64 ControlRequests; | 251 | u64 ControlRequests; |
255 | u64 InputMegabytes; | 252 | u64 InputMegabytes; |
256 | u64 OutputMegabytes; | 253 | u64 OutputMegabytes; |
254 | u64 VLinkFailureCount; | ||
255 | u64 MissDiscAdvCount; | ||
257 | }; | 256 | }; |
258 | 257 | ||
259 | /* | 258 | /** |
260 | * els data is used for passing ELS respone specific | 259 | * struct fc_seq_els_data - ELS data used for passing ELS specific responses |
261 | * data to send ELS response mainly using infomation | 260 | * @fp: The ELS frame |
262 | * in exchange and sequence in EM layer. | 261 | * @reason: The reason for rejection |
262 | * @explan: The explaination of the rejection | ||
263 | * | ||
264 | * Mainly used by the exchange manager layer. | ||
263 | */ | 265 | */ |
264 | struct fc_seq_els_data { | 266 | struct fc_seq_els_data { |
265 | struct fc_frame *fp; | 267 | struct fc_frame *fp; |
@@ -267,77 +269,87 @@ struct fc_seq_els_data { | |||
267 | enum fc_els_rjt_explan explan; | 269 | enum fc_els_rjt_explan explan; |
268 | }; | 270 | }; |
269 | 271 | ||
270 | /* | 272 | /** |
271 | * FCP request structure, one for each scsi cmd request | 273 | * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request) |
274 | * @lp: The associated local port | ||
275 | * @state: The state of the I/O | ||
276 | * @tgt_flags: Target's flags | ||
277 | * @ref_cnt: Reference count | ||
278 | * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the | ||
279 | * host_lock if both are to be held at the same time) | ||
280 | * @cmd: The SCSI command (set and clear with the host_lock held) | ||
281 | * @list: Tracks queued commands (accessed with the host_lock held) | ||
282 | * @timer: The command timer | ||
283 | * @tm_done: Completion indicator | ||
284 | * @wait_for_comp: Indicator to wait for completion of the I/O (in jiffies) | ||
285 | * @start_time: Timestamp indicating the start of the I/O (in jiffies) | ||
286 | * @end_time: Timestamp indicating the end of the I/O (in jiffies) | ||
287 | * @last_pkt_time: Timestamp of the last frame received (in jiffies) | ||
288 | * @data_len: The length of the data | ||
289 | * @cdb_cmd: The CDB command | ||
290 | * @xfer_len: The transfer length | ||
291 | * @xfer_ddp: Indicates if this transfer used DDP (XID of the exchange | ||
292 | * will be set here if DDP was setup) | ||
293 | * @xfer_contig_end: The offset into the buffer if the buffer is contiguous | ||
294 | * (Tx and Rx) | ||
295 | * @max_payload: The maximum payload size (in bytes) | ||
296 | * @io_status: SCSI result (upper 24 bits) | ||
297 | * @cdb_status: CDB status | ||
298 | * @status_code: FCP I/O status | ||
299 | * @scsi_comp_flags: Completion flags (bit 3 Underrun bit 2: overrun) | ||
300 | * @req_flags: Request flags (bit 0: read bit:1 write) | ||
301 | * @scsi_resid: SCSI residule length | ||
302 | * @rport: The remote port that the SCSI command is targeted at | ||
303 | * @seq_ptr: The sequence that will carry the SCSI command | ||
304 | * @recov_retry: Number of recovery retries | ||
305 | * @recov_seq: The sequence for REC or SRR | ||
272 | */ | 306 | */ |
273 | struct fc_fcp_pkt { | 307 | struct fc_fcp_pkt { |
274 | /* | 308 | /* Housekeeping information */ |
275 | * housekeeping stuff | 309 | struct fc_lport *lp; |
276 | */ | 310 | u16 state; |
277 | struct fc_lport *lp; /* handle to hba struct */ | 311 | u16 tgt_flags; |
278 | u16 state; /* scsi_pkt state state */ | 312 | atomic_t ref_cnt; |
279 | u16 tgt_flags; /* target flags */ | 313 | spinlock_t scsi_pkt_lock; |
280 | atomic_t ref_cnt; /* fcp pkt ref count */ | 314 | |
281 | spinlock_t scsi_pkt_lock; /* Must be taken before the host lock | 315 | /* SCSI I/O related information */ |
282 | * if both are held at the same time */ | 316 | struct scsi_cmnd *cmd; |
283 | /* | 317 | struct list_head list; |
284 | * SCSI I/O related stuff | 318 | |
285 | */ | 319 | /* Timeout related information */ |
286 | struct scsi_cmnd *cmd; /* scsi command pointer. set/clear | 320 | struct timer_list timer; |
287 | * under host lock */ | ||
288 | struct list_head list; /* tracks queued commands. access under | ||
289 | * host lock */ | ||
290 | /* | ||
291 | * timeout related stuff | ||
292 | */ | ||
293 | struct timer_list timer; /* command timer */ | ||
294 | struct completion tm_done; | 321 | struct completion tm_done; |
295 | int wait_for_comp; | 322 | int wait_for_comp; |
296 | unsigned long start_time; /* start jiffie */ | 323 | unsigned long start_time; |
297 | unsigned long end_time; /* end jiffie */ | 324 | unsigned long end_time; |
298 | unsigned long last_pkt_time; /* jiffies of last frame received */ | 325 | unsigned long last_pkt_time; |
299 | 326 | ||
300 | /* | 327 | /* SCSI command and data transfer information */ |
301 | * scsi cmd and data transfer information | 328 | u32 data_len; |
302 | */ | 329 | |
303 | u32 data_len; | 330 | /* Transport related veriables */ |
304 | /* | 331 | struct fcp_cmnd cdb_cmd; |
305 | * transport related veriables | 332 | size_t xfer_len; |
306 | */ | 333 | u16 xfer_ddp; |
307 | struct fcp_cmnd cdb_cmd; | 334 | u32 xfer_contig_end; |
308 | size_t xfer_len; | 335 | u16 max_payload; |
309 | u16 xfer_ddp; /* this xfer is ddped */ | 336 | |
310 | u32 xfer_contig_end; /* offset of end of contiguous xfer */ | 337 | /* SCSI/FCP return status */ |
311 | u16 max_payload; /* max payload size in bytes */ | 338 | u32 io_status; |
312 | 339 | u8 cdb_status; | |
313 | /* | 340 | u8 status_code; |
314 | * scsi/fcp return status | 341 | u8 scsi_comp_flags; |
315 | */ | 342 | u32 req_flags; |
316 | u32 io_status; /* SCSI result upper 24 bits */ | 343 | u32 scsi_resid; |
317 | u8 cdb_status; | 344 | |
318 | u8 status_code; /* FCP I/O status */ | 345 | /* Associated structures */ |
319 | /* bit 3 Underrun bit 2: overrun */ | 346 | struct fc_rport *rport; |
320 | u8 scsi_comp_flags; | 347 | struct fc_seq *seq_ptr; |
321 | u32 req_flags; /* bit 0: read bit:1 write */ | 348 | |
322 | u32 scsi_resid; /* residule length */ | 349 | /* Error Processing information */ |
323 | 350 | u8 recov_retry; | |
324 | struct fc_rport *rport; /* remote port pointer */ | 351 | struct fc_seq *recov_seq; |
325 | struct fc_seq *seq_ptr; /* current sequence pointer */ | ||
326 | /* | ||
327 | * Error Processing | ||
328 | */ | ||
329 | u8 recov_retry; /* count of recovery retries */ | ||
330 | struct fc_seq *recov_seq; /* sequence for REC or SRR */ | ||
331 | }; | 352 | }; |
332 | /* | ||
333 | * FC_FCP HELPER FUNCTIONS | ||
334 | *****************************/ | ||
335 | static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | ||
336 | { | ||
337 | if (fsp && fsp->cmd) | ||
338 | return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; | ||
339 | return false; | ||
340 | } | ||
341 | 353 | ||
342 | /* | 354 | /* |
343 | * Structure and function definitions for managing Fibre Channel Exchanges | 355 | * Structure and function definitions for managing Fibre Channel Exchanges |
@@ -350,23 +362,51 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | |||
350 | 362 | ||
351 | struct fc_exch_mgr; | 363 | struct fc_exch_mgr; |
352 | struct fc_exch_mgr_anchor; | 364 | struct fc_exch_mgr_anchor; |
353 | extern u16 fc_cpu_mask; /* cpu mask for possible cpus */ | 365 | extern u16 fc_cpu_mask; /* cpu mask for possible cpus */ |
354 | 366 | ||
355 | /* | 367 | /** |
356 | * Sequence. | 368 | * struct fc_seq - FC sequence |
369 | * @id: The sequence ID | ||
370 | * @ssb_stat: Status flags for the sequence status block (SSB) | ||
371 | * @cnt: Number of frames sent so far | ||
372 | * @rec_data: FC-4 value for REC | ||
357 | */ | 373 | */ |
358 | struct fc_seq { | 374 | struct fc_seq { |
359 | u8 id; /* seq ID */ | 375 | u8 id; |
360 | u16 ssb_stat; /* status flags for sequence status block */ | 376 | u16 ssb_stat; |
361 | u16 cnt; /* frames sent so far on sequence */ | 377 | u16 cnt; |
362 | u32 rec_data; /* FC-4 value for REC */ | 378 | u32 rec_data; |
363 | }; | 379 | }; |
364 | 380 | ||
365 | #define FC_EX_DONE (1 << 0) /* ep is completed */ | 381 | #define FC_EX_DONE (1 << 0) /* ep is completed */ |
366 | #define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */ | 382 | #define FC_EX_RST_CLEANUP (1 << 1) /* reset is forcing completion */ |
367 | 383 | ||
368 | /* | 384 | /** |
369 | * Exchange. | 385 | * struct fc_exch - Fibre Channel Exchange |
386 | * @em: Exchange manager | ||
387 | * @pool: Exchange pool | ||
388 | * @state: The exchange's state | ||
389 | * @xid: The exchange ID | ||
390 | * @ex_list: Handle used by the EM to track free exchanges | ||
391 | * @ex_lock: Lock that protects the exchange | ||
392 | * @ex_refcnt: Reference count | ||
393 | * @timeout_work: Handle for timeout handler | ||
394 | * @lp: The local port that this exchange is on | ||
395 | * @oxid: Originator's exchange ID | ||
396 | * @rxid: Responder's exchange ID | ||
397 | * @oid: Originator's FCID | ||
398 | * @sid: Source FCID | ||
399 | * @did: Destination FCID | ||
400 | * @esb_stat: ESB exchange status | ||
401 | * @r_a_tov: Resouce allocation time out value (in msecs) | ||
402 | * @seq_id: The next sequence ID to use | ||
403 | * @f_ctl: F_CTL flags for the sequence | ||
404 | * @fh_type: The frame type | ||
405 | * @class: The class of service | ||
406 | * @seq: The sequence in use on this exchange | ||
407 | * @resp: Callback for responses on this exchange | ||
408 | * @destructor: Called when destroying the exchange | ||
409 | * @arg: Passed as a void pointer to the resp() callback | ||
370 | * | 410 | * |
371 | * Locking notes: The ex_lock protects following items: | 411 | * Locking notes: The ex_lock protects following items: |
372 | * state, esb_stat, f_ctl, seq.ssb_stat | 412 | * state, esb_stat, f_ctl, seq.ssb_stat |
@@ -374,76 +414,59 @@ struct fc_seq { | |||
374 | * sequence allocation | 414 | * sequence allocation |
375 | */ | 415 | */ |
376 | struct fc_exch { | 416 | struct fc_exch { |
377 | struct fc_exch_mgr *em; /* exchange manager */ | 417 | struct fc_exch_mgr *em; |
378 | struct fc_exch_pool *pool; /* per cpu exches pool */ | 418 | struct fc_exch_pool *pool; |
379 | u32 state; /* internal driver state */ | 419 | u32 state; |
380 | u16 xid; /* our exchange ID */ | 420 | u16 xid; |
381 | struct list_head ex_list; /* free or busy list linkage */ | 421 | struct list_head ex_list; |
382 | spinlock_t ex_lock; /* lock covering exchange state */ | 422 | spinlock_t ex_lock; |
383 | atomic_t ex_refcnt; /* reference counter */ | 423 | atomic_t ex_refcnt; |
384 | struct delayed_work timeout_work; /* timer for upper level protocols */ | 424 | struct delayed_work timeout_work; |
385 | struct fc_lport *lp; /* fc device instance */ | 425 | struct fc_lport *lp; |
386 | u16 oxid; /* originator's exchange ID */ | 426 | u16 oxid; |
387 | u16 rxid; /* responder's exchange ID */ | 427 | u16 rxid; |
388 | u32 oid; /* originator's FCID */ | 428 | u32 oid; |
389 | u32 sid; /* source FCID */ | 429 | u32 sid; |
390 | u32 did; /* destination FCID */ | 430 | u32 did; |
391 | u32 esb_stat; /* exchange status for ESB */ | 431 | u32 esb_stat; |
392 | u32 r_a_tov; /* r_a_tov from rport (msec) */ | 432 | u32 r_a_tov; |
393 | u8 seq_id; /* next sequence ID to use */ | 433 | u8 seq_id; |
394 | u32 f_ctl; /* F_CTL flags for sequences */ | 434 | u32 f_ctl; |
395 | u8 fh_type; /* frame type */ | 435 | u8 fh_type; |
396 | enum fc_class class; /* class of service */ | 436 | enum fc_class class; |
397 | struct fc_seq seq; /* single sequence */ | 437 | struct fc_seq seq; |
398 | /* | 438 | |
399 | * Handler for responses to this current exchange. | 439 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); |
400 | */ | 440 | void *arg; |
401 | void (*resp)(struct fc_seq *, struct fc_frame *, void *); | 441 | |
402 | void (*destructor)(struct fc_seq *, void *); | 442 | void (*destructor)(struct fc_seq *, void *); |
403 | /* | 443 | |
404 | * arg is passed as void pointer to exchange | ||
405 | * resp and destructor handlers | ||
406 | */ | ||
407 | void *arg; | ||
408 | }; | 444 | }; |
409 | #define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq) | 445 | #define fc_seq_exch(sp) container_of(sp, struct fc_exch, seq) |
410 | 446 | ||
411 | struct libfc_function_template { | ||
412 | 447 | ||
448 | struct libfc_function_template { | ||
413 | /* | 449 | /* |
414 | * Interface to send a FC frame | 450 | * Interface to send a FC frame |
415 | * | 451 | * |
416 | * STATUS: REQUIRED | 452 | * STATUS: REQUIRED |
417 | */ | 453 | */ |
418 | int (*frame_send)(struct fc_lport *lp, struct fc_frame *fp); | 454 | int (*frame_send)(struct fc_lport *, struct fc_frame *); |
419 | 455 | ||
420 | /* | 456 | /* |
421 | * Interface to send ELS/CT frames | 457 | * Interface to send ELS/CT frames |
422 | * | 458 | * |
423 | * STATUS: OPTIONAL | 459 | * STATUS: OPTIONAL |
424 | */ | 460 | */ |
425 | struct fc_seq *(*elsct_send)(struct fc_lport *lport, | 461 | struct fc_seq *(*elsct_send)(struct fc_lport *, u32 did, |
426 | u32 did, | 462 | struct fc_frame *, unsigned int op, |
427 | struct fc_frame *fp, | ||
428 | unsigned int op, | ||
429 | void (*resp)(struct fc_seq *, | 463 | void (*resp)(struct fc_seq *, |
430 | struct fc_frame *fp, | 464 | struct fc_frame *, void *arg), |
431 | void *arg), | ||
432 | void *arg, u32 timer_msec); | 465 | void *arg, u32 timer_msec); |
433 | 466 | ||
434 | /* | 467 | /* |
435 | * Send the FC frame payload using a new exchange and sequence. | 468 | * Send the FC frame payload using a new exchange and sequence. |
436 | * | 469 | * |
437 | * The frame pointer with some of the header's fields must be | ||
438 | * filled before calling exch_seq_send(), those fields are, | ||
439 | * | ||
440 | * - routing control | ||
441 | * - FC port did | ||
442 | * - FC port sid | ||
443 | * - FC header type | ||
444 | * - frame control | ||
445 | * - parameter or relative offset | ||
446 | * | ||
447 | * The exchange response handler is set in this routine to resp() | 470 | * The exchange response handler is set in this routine to resp() |
448 | * function pointer. It can be called in two scenarios: if a timeout | 471 | * function pointer. It can be called in two scenarios: if a timeout |
449 | * occurs or if a response frame is received for the exchange. The | 472 | * occurs or if a response frame is received for the exchange. The |
@@ -464,14 +487,13 @@ struct libfc_function_template { | |||
464 | * | 487 | * |
465 | * STATUS: OPTIONAL | 488 | * STATUS: OPTIONAL |
466 | */ | 489 | */ |
467 | struct fc_seq *(*exch_seq_send)(struct fc_lport *lp, | 490 | struct fc_seq *(*exch_seq_send)(struct fc_lport *, struct fc_frame *, |
468 | struct fc_frame *fp, | 491 | void (*resp)(struct fc_seq *, |
469 | void (*resp)(struct fc_seq *sp, | 492 | struct fc_frame *, |
470 | struct fc_frame *fp, | 493 | void *), |
471 | void *arg), | 494 | void (*destructor)(struct fc_seq *, |
472 | void (*destructor)(struct fc_seq *sp, | 495 | void *), |
473 | void *arg), | 496 | void *, unsigned int timer_msec); |
474 | void *arg, unsigned int timer_msec); | ||
475 | 497 | ||
476 | /* | 498 | /* |
477 | * Sets up the DDP context for a given exchange id on the given | 499 | * Sets up the DDP context for a given exchange id on the given |
@@ -479,22 +501,28 @@ struct libfc_function_template { | |||
479 | * | 501 | * |
480 | * STATUS: OPTIONAL | 502 | * STATUS: OPTIONAL |
481 | */ | 503 | */ |
482 | int (*ddp_setup)(struct fc_lport *lp, u16 xid, | 504 | int (*ddp_setup)(struct fc_lport *, u16, struct scatterlist *, |
483 | struct scatterlist *sgl, unsigned int sgc); | 505 | unsigned int); |
484 | /* | 506 | /* |
485 | * Completes the DDP transfer and returns the length of data DDPed | 507 | * Completes the DDP transfer and returns the length of data DDPed |
486 | * for the given exchange id. | 508 | * for the given exchange id. |
487 | * | 509 | * |
488 | * STATUS: OPTIONAL | 510 | * STATUS: OPTIONAL |
489 | */ | 511 | */ |
490 | int (*ddp_done)(struct fc_lport *lp, u16 xid); | 512 | int (*ddp_done)(struct fc_lport *, u16); |
513 | /* | ||
514 | * Allow LLD to fill its own Link Error Status Block | ||
515 | * | ||
516 | * STATUS: OPTIONAL | ||
517 | */ | ||
518 | void (*get_lesb)(struct fc_lport *, struct fc_els_lesb *lesb); | ||
491 | /* | 519 | /* |
492 | * Send a frame using an existing sequence and exchange. | 520 | * Send a frame using an existing sequence and exchange. |
493 | * | 521 | * |
494 | * STATUS: OPTIONAL | 522 | * STATUS: OPTIONAL |
495 | */ | 523 | */ |
496 | int (*seq_send)(struct fc_lport *lp, struct fc_seq *sp, | 524 | int (*seq_send)(struct fc_lport *, struct fc_seq *, |
497 | struct fc_frame *fp); | 525 | struct fc_frame *); |
498 | 526 | ||
499 | /* | 527 | /* |
500 | * Send an ELS response using infomation from a previous | 528 | * Send an ELS response using infomation from a previous |
@@ -502,8 +530,8 @@ struct libfc_function_template { | |||
502 | * | 530 | * |
503 | * STATUS: OPTIONAL | 531 | * STATUS: OPTIONAL |
504 | */ | 532 | */ |
505 | void (*seq_els_rsp_send)(struct fc_seq *sp, enum fc_els_cmd els_cmd, | 533 | void (*seq_els_rsp_send)(struct fc_seq *, enum fc_els_cmd, |
506 | struct fc_seq_els_data *els_data); | 534 | struct fc_seq_els_data *); |
507 | 535 | ||
508 | /* | 536 | /* |
509 | * Abort an exchange and sequence. Generally called because of a | 537 | * Abort an exchange and sequence. Generally called because of a |
@@ -515,7 +543,7 @@ struct libfc_function_template { | |||
515 | * | 543 | * |
516 | * STATUS: OPTIONAL | 544 | * STATUS: OPTIONAL |
517 | */ | 545 | */ |
518 | int (*seq_exch_abort)(const struct fc_seq *req_sp, | 546 | int (*seq_exch_abort)(const struct fc_seq *, |
519 | unsigned int timer_msec); | 547 | unsigned int timer_msec); |
520 | 548 | ||
521 | /* | 549 | /* |
@@ -524,14 +552,14 @@ struct libfc_function_template { | |||
524 | * | 552 | * |
525 | * STATUS: OPTIONAL | 553 | * STATUS: OPTIONAL |
526 | */ | 554 | */ |
527 | void (*exch_done)(struct fc_seq *sp); | 555 | void (*exch_done)(struct fc_seq *); |
528 | 556 | ||
529 | /* | 557 | /* |
530 | * Start a new sequence on the same exchange/sequence tuple. | 558 | * Start a new sequence on the same exchange/sequence tuple. |
531 | * | 559 | * |
532 | * STATUS: OPTIONAL | 560 | * STATUS: OPTIONAL |
533 | */ | 561 | */ |
534 | struct fc_seq *(*seq_start_next)(struct fc_seq *sp); | 562 | struct fc_seq *(*seq_start_next)(struct fc_seq *); |
535 | 563 | ||
536 | /* | 564 | /* |
537 | * Reset an exchange manager, completing all sequences and exchanges. | 565 | * Reset an exchange manager, completing all sequences and exchanges. |
@@ -540,8 +568,7 @@ struct libfc_function_template { | |||
540 | * | 568 | * |
541 | * STATUS: OPTIONAL | 569 | * STATUS: OPTIONAL |
542 | */ | 570 | */ |
543 | void (*exch_mgr_reset)(struct fc_lport *, | 571 | void (*exch_mgr_reset)(struct fc_lport *, u32 s_id, u32 d_id); |
544 | u32 s_id, u32 d_id); | ||
545 | 572 | ||
546 | /* | 573 | /* |
547 | * Flush the rport work queue. Generally used before shutdown. | 574 | * Flush the rport work queue. Generally used before shutdown. |
@@ -555,8 +582,8 @@ struct libfc_function_template { | |||
555 | * | 582 | * |
556 | * STATUS: OPTIONAL | 583 | * STATUS: OPTIONAL |
557 | */ | 584 | */ |
558 | void (*lport_recv)(struct fc_lport *lp, struct fc_seq *sp, | 585 | void (*lport_recv)(struct fc_lport *, struct fc_seq *, |
559 | struct fc_frame *fp); | 586 | struct fc_frame *); |
560 | 587 | ||
561 | /* | 588 | /* |
562 | * Reset the local port. | 589 | * Reset the local port. |
@@ -566,6 +593,26 @@ struct libfc_function_template { | |||
566 | int (*lport_reset)(struct fc_lport *); | 593 | int (*lport_reset)(struct fc_lport *); |
567 | 594 | ||
568 | /* | 595 | /* |
596 | * Set the local port FC_ID. | ||
597 | * | ||
598 | * This may be provided by the LLD to allow it to be | ||
599 | * notified when the local port is assigned a FC-ID. | ||
600 | * | ||
601 | * The frame, if non-NULL, is the incoming frame with the | ||
602 | * FLOGI LS_ACC or FLOGI, and may contain the granted MAC | ||
603 | * address for the LLD. The frame pointer may be NULL if | ||
604 | * no MAC is associated with this assignment (LOGO or PLOGI). | ||
605 | * | ||
606 | * If FC_ID is non-zero, r_a_tov and e_d_tov must be valid. | ||
607 | * | ||
608 | * Note: this is called with the local port mutex held. | ||
609 | * | ||
610 | * STATUS: OPTIONAL | ||
611 | */ | ||
612 | void (*lport_set_port_id)(struct fc_lport *, u32 port_id, | ||
613 | struct fc_frame *); | ||
614 | |||
615 | /* | ||
569 | * Create a remote port with a given port ID | 616 | * Create a remote port with a given port ID |
570 | * | 617 | * |
571 | * STATUS: OPTIONAL | 618 | * STATUS: OPTIONAL |
@@ -622,31 +669,31 @@ struct libfc_function_template { | |||
622 | * | 669 | * |
623 | * STATUS: OPTIONAL | 670 | * STATUS: OPTIONAL |
624 | */ | 671 | */ |
625 | int (*fcp_cmd_send)(struct fc_lport *lp, struct fc_fcp_pkt *fsp, | 672 | int (*fcp_cmd_send)(struct fc_lport *, struct fc_fcp_pkt *, |
626 | void (*resp)(struct fc_seq *, struct fc_frame *fp, | 673 | void (*resp)(struct fc_seq *, struct fc_frame *, |
627 | void *arg)); | 674 | void *)); |
628 | 675 | ||
629 | /* | 676 | /* |
630 | * Cleanup the FCP layer, used durring link down and reset | 677 | * Cleanup the FCP layer, used durring link down and reset |
631 | * | 678 | * |
632 | * STATUS: OPTIONAL | 679 | * STATUS: OPTIONAL |
633 | */ | 680 | */ |
634 | void (*fcp_cleanup)(struct fc_lport *lp); | 681 | void (*fcp_cleanup)(struct fc_lport *); |
635 | 682 | ||
636 | /* | 683 | /* |
637 | * Abort all I/O on a local port | 684 | * Abort all I/O on a local port |
638 | * | 685 | * |
639 | * STATUS: OPTIONAL | 686 | * STATUS: OPTIONAL |
640 | */ | 687 | */ |
641 | void (*fcp_abort_io)(struct fc_lport *lp); | 688 | void (*fcp_abort_io)(struct fc_lport *); |
642 | 689 | ||
643 | /* | 690 | /* |
644 | * Receive a request for the discovery layer. | 691 | * Receive a request for the discovery layer. |
645 | * | 692 | * |
646 | * STATUS: OPTIONAL | 693 | * STATUS: OPTIONAL |
647 | */ | 694 | */ |
648 | void (*disc_recv_req)(struct fc_seq *, | 695 | void (*disc_recv_req)(struct fc_seq *, struct fc_frame *, |
649 | struct fc_frame *, struct fc_lport *); | 696 | struct fc_lport *); |
650 | 697 | ||
651 | /* | 698 | /* |
652 | * Start discovery for a local port. | 699 | * Start discovery for a local port. |
@@ -675,419 +722,340 @@ struct libfc_function_template { | |||
675 | void (*disc_stop_final) (struct fc_lport *); | 722 | void (*disc_stop_final) (struct fc_lport *); |
676 | }; | 723 | }; |
677 | 724 | ||
678 | /* information used by the discovery layer */ | 725 | /** |
726 | * struct fc_disc - Discovery context | ||
727 | * @retry_count: Number of retries | ||
728 | * @pending: 1 if discovery is pending, 0 if not | ||
729 | * @requesting: 1 if discovery has been requested, 0 if not | ||
730 | * @seq_count: Number of sequences used for discovery | ||
731 | * @buf_len: Length of the discovery buffer | ||
732 | * @disc_id: Discovery ID | ||
733 | * @rports: List of discovered remote ports | ||
734 | * @lport: The local port that discovery is for | ||
735 | * @disc_mutex: Mutex that protects the discovery context | ||
736 | * @partial_buf: Partial name buffer (if names are returned | ||
737 | * in multiple frames) | ||
738 | * @disc_work: handle for delayed work context | ||
739 | * @disc_callback: Callback routine called when discovery completes | ||
740 | */ | ||
679 | struct fc_disc { | 741 | struct fc_disc { |
680 | unsigned char retry_count; | 742 | unsigned char retry_count; |
681 | unsigned char pending; | 743 | unsigned char pending; |
682 | unsigned char requested; | 744 | unsigned char requested; |
683 | unsigned short seq_count; | 745 | unsigned short seq_count; |
684 | unsigned char buf_len; | 746 | unsigned char buf_len; |
685 | u16 disc_id; | 747 | u16 disc_id; |
748 | |||
749 | struct list_head rports; | ||
750 | struct fc_lport *lport; | ||
751 | struct mutex disc_mutex; | ||
752 | struct fc_gpn_ft_resp partial_buf; | ||
753 | struct delayed_work disc_work; | ||
686 | 754 | ||
687 | void (*disc_callback)(struct fc_lport *, | 755 | void (*disc_callback)(struct fc_lport *, |
688 | enum fc_disc_event); | 756 | enum fc_disc_event); |
689 | |||
690 | struct list_head rports; | ||
691 | struct fc_lport *lport; | ||
692 | struct mutex disc_mutex; | ||
693 | struct fc_gpn_ft_resp partial_buf; /* partial name buffer */ | ||
694 | struct delayed_work disc_work; | ||
695 | }; | 757 | }; |
696 | 758 | ||
759 | /** | ||
760 | * struct fc_lport - Local port | ||
761 | * @host: The SCSI host associated with a local port | ||
762 | * @ema_list: Exchange manager anchor list | ||
763 | * @dns_rdata: The directory server remote port | ||
764 | * @ptp_rdata: Point to point remote port | ||
765 | * @scsi_priv: FCP layer internal data | ||
766 | * @disc: Discovery context | ||
767 | * @vports: Child vports if N_Port | ||
768 | * @vport: Parent vport if VN_Port | ||
769 | * @tt: Libfc function template | ||
770 | * @link_up: Link state (1 = link up, 0 = link down) | ||
771 | * @qfull: Queue state (1 queue is full, 0 queue is not full) | ||
772 | * @state: Identifies the state | ||
773 | * @boot_time: Timestamp indicating when the local port came online | ||
774 | * @host_stats: SCSI host statistics | ||
775 | * @dev_stats: FCoE device stats (TODO: libfc should not be | ||
776 | * FCoE aware) | ||
777 | * @retry_count: Number of retries in the current state | ||
778 | * @wwpn: World Wide Port Name | ||
779 | * @wwnn: World Wide Node Name | ||
780 | * @service_params: Common service parameters | ||
781 | * @e_d_tov: Error detection timeout value | ||
782 | * @r_a_tov: Resouce allocation timeout value | ||
783 | * @rnid_gen: RNID information | ||
784 | * @sg_supp: Indicates if scatter gather is supported | ||
785 | * @seq_offload: Indicates if sequence offload is supported | ||
786 | * @crc_offload: Indicates if CRC offload is supported | ||
787 | * @lro_enabled: Indicates if large receive offload is supported | ||
788 | * @does_npiv: Supports multiple vports | ||
789 | * @npiv_enabled: Switch/fabric allows NPIV | ||
790 | * @mfs: The maximum Fibre Channel payload size | ||
791 | * @max_retry_count: The maximum retry attempts | ||
792 | * @max_rport_retry_count: The maximum remote port retry attempts | ||
793 | * @lro_xid: The maximum XID for LRO | ||
794 | * @lso_max: The maximum large offload send size | ||
795 | * @fcts: FC-4 type mask | ||
796 | * @lp_mutex: Mutex to protect the local port | ||
797 | * @list: Handle for list of local ports | ||
798 | * @retry_work: Handle to local port for delayed retry context | ||
799 | */ | ||
697 | struct fc_lport { | 800 | struct fc_lport { |
698 | struct list_head list; | ||
699 | |||
700 | /* Associations */ | 801 | /* Associations */ |
701 | struct Scsi_Host *host; | 802 | struct Scsi_Host *host; |
702 | struct list_head ema_list; | 803 | struct list_head ema_list; |
703 | struct fc_rport_priv *dns_rp; | 804 | struct fc_rport_priv *dns_rdata; |
704 | struct fc_rport_priv *ptp_rp; | 805 | struct fc_rport_priv *ptp_rdata; |
705 | void *scsi_priv; | 806 | void *scsi_priv; |
706 | struct fc_disc disc; | 807 | struct fc_disc disc; |
808 | |||
809 | /* Virtual port information */ | ||
810 | struct list_head vports; | ||
811 | struct fc_vport *vport; | ||
707 | 812 | ||
708 | /* Operational Information */ | 813 | /* Operational Information */ |
709 | struct libfc_function_template tt; | 814 | struct libfc_function_template tt; |
710 | u8 link_up; | 815 | u8 link_up; |
711 | u8 qfull; | 816 | u8 qfull; |
712 | enum fc_lport_state state; | 817 | enum fc_lport_state state; |
713 | unsigned long boot_time; | 818 | unsigned long boot_time; |
714 | 819 | struct fc_host_statistics host_stats; | |
715 | struct fc_host_statistics host_stats; | 820 | struct fcoe_dev_stats *dev_stats; |
716 | struct fcoe_dev_stats *dev_stats; | 821 | u8 retry_count; |
717 | 822 | ||
718 | u64 wwpn; | 823 | /* Fabric information */ |
719 | u64 wwnn; | 824 | u64 wwpn; |
720 | u8 retry_count; | 825 | u64 wwnn; |
826 | unsigned int service_params; | ||
827 | unsigned int e_d_tov; | ||
828 | unsigned int r_a_tov; | ||
829 | struct fc_els_rnid_gen rnid_gen; | ||
721 | 830 | ||
722 | /* Capabilities */ | 831 | /* Capabilities */ |
723 | u32 sg_supp:1; /* scatter gather supported */ | 832 | u32 sg_supp:1; |
724 | u32 seq_offload:1; /* seq offload supported */ | 833 | u32 seq_offload:1; |
725 | u32 crc_offload:1; /* crc offload supported */ | 834 | u32 crc_offload:1; |
726 | u32 lro_enabled:1; /* large receive offload */ | 835 | u32 lro_enabled:1; |
727 | u32 mfs; /* max FC payload size */ | 836 | u32 does_npiv:1; |
728 | unsigned int service_params; | 837 | u32 npiv_enabled:1; |
729 | unsigned int e_d_tov; | 838 | u32 mfs; |
730 | unsigned int r_a_tov; | 839 | u8 max_retry_count; |
731 | u8 max_retry_count; | 840 | u8 max_rport_retry_count; |
732 | u8 max_rport_retry_count; | 841 | u16 link_speed; |
733 | u16 link_speed; | 842 | u16 link_supported_speeds; |
734 | u16 link_supported_speeds; | 843 | u16 lro_xid; |
735 | u16 lro_xid; /* max xid for fcoe lro */ | 844 | unsigned int lso_max; |
736 | unsigned int lso_max; /* max large send size */ | 845 | struct fc_ns_fts fcts; |
737 | struct fc_ns_fts fcts; /* FC-4 type masks */ | ||
738 | struct fc_els_rnid_gen rnid_gen; /* RNID information */ | ||
739 | |||
740 | /* Semaphores */ | ||
741 | struct mutex lp_mutex; | ||
742 | 846 | ||
743 | /* Miscellaneous */ | 847 | /* Miscellaneous */ |
744 | struct delayed_work retry_work; | 848 | struct mutex lp_mutex; |
745 | struct delayed_work disc_work; | 849 | struct list_head list; |
850 | struct delayed_work retry_work; | ||
746 | }; | 851 | }; |
747 | 852 | ||
748 | /* | 853 | /* |
749 | * FC_LPORT HELPER FUNCTIONS | 854 | * FC_LPORT HELPER FUNCTIONS |
750 | *****************************/ | 855 | *****************************/ |
751 | static inline int fc_lport_test_ready(struct fc_lport *lp) | 856 | |
857 | /** | ||
858 | * fc_lport_test_ready() - Determine if a local port is in the READY state | ||
859 | * @lport: The local port to test | ||
860 | */ | ||
861 | static inline int fc_lport_test_ready(struct fc_lport *lport) | ||
752 | { | 862 | { |
753 | return lp->state == LPORT_ST_READY; | 863 | return lport->state == LPORT_ST_READY; |
754 | } | 864 | } |
755 | 865 | ||
756 | static inline void fc_set_wwnn(struct fc_lport *lp, u64 wwnn) | 866 | /** |
867 | * fc_set_wwnn() - Set the World Wide Node Name of a local port | ||
868 | * @lport: The local port whose WWNN is to be set | ||
869 | * @wwnn: The new WWNN | ||
870 | */ | ||
871 | static inline void fc_set_wwnn(struct fc_lport *lport, u64 wwnn) | ||
757 | { | 872 | { |
758 | lp->wwnn = wwnn; | 873 | lport->wwnn = wwnn; |
759 | } | 874 | } |
760 | 875 | ||
761 | static inline void fc_set_wwpn(struct fc_lport *lp, u64 wwnn) | 876 | /** |
877 | * fc_set_wwpn() - Set the World Wide Port Name of a local port | ||
878 | * @lport: The local port whose WWPN is to be set | ||
879 | * @wwnn: The new WWPN | ||
880 | */ | ||
881 | static inline void fc_set_wwpn(struct fc_lport *lport, u64 wwnn) | ||
762 | { | 882 | { |
763 | lp->wwpn = wwnn; | 883 | lport->wwpn = wwnn; |
764 | } | 884 | } |
765 | 885 | ||
766 | static inline void fc_lport_state_enter(struct fc_lport *lp, | 886 | /** |
887 | * fc_lport_state_enter() - Change a local port's state | ||
888 | * @lport: The local port whose state is to change | ||
889 | * @state: The new state | ||
890 | */ | ||
891 | static inline void fc_lport_state_enter(struct fc_lport *lport, | ||
767 | enum fc_lport_state state) | 892 | enum fc_lport_state state) |
768 | { | 893 | { |
769 | if (state != lp->state) | 894 | if (state != lport->state) |
770 | lp->retry_count = 0; | 895 | lport->retry_count = 0; |
771 | lp->state = state; | 896 | lport->state = state; |
772 | } | 897 | } |
773 | 898 | ||
774 | static inline int fc_lport_init_stats(struct fc_lport *lp) | 899 | /** |
900 | * fc_lport_init_stats() - Allocate per-CPU statistics for a local port | ||
901 | * @lport: The local port whose statistics are to be initialized | ||
902 | */ | ||
903 | static inline int fc_lport_init_stats(struct fc_lport *lport) | ||
775 | { | 904 | { |
776 | /* allocate per cpu stats block */ | 905 | lport->dev_stats = alloc_percpu(struct fcoe_dev_stats); |
777 | lp->dev_stats = alloc_percpu(struct fcoe_dev_stats); | 906 | if (!lport->dev_stats) |
778 | if (!lp->dev_stats) | ||
779 | return -ENOMEM; | 907 | return -ENOMEM; |
780 | return 0; | 908 | return 0; |
781 | } | 909 | } |
782 | 910 | ||
783 | static inline void fc_lport_free_stats(struct fc_lport *lp) | 911 | /** |
912 | * fc_lport_free_stats() - Free memory for a local port's statistics | ||
913 | * @lport: The local port whose statistics are to be freed | ||
914 | */ | ||
915 | static inline void fc_lport_free_stats(struct fc_lport *lport) | ||
784 | { | 916 | { |
785 | free_percpu(lp->dev_stats); | 917 | free_percpu(lport->dev_stats); |
786 | } | 918 | } |
787 | 919 | ||
788 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lp) | 920 | /** |
921 | * fc_lport_get_stats() - Get a local port's statistics | ||
922 | * @lport: The local port whose statistics are to be retreived | ||
923 | */ | ||
924 | static inline struct fcoe_dev_stats *fc_lport_get_stats(struct fc_lport *lport) | ||
789 | { | 925 | { |
790 | return per_cpu_ptr(lp->dev_stats, smp_processor_id()); | 926 | return per_cpu_ptr(lport->dev_stats, smp_processor_id()); |
791 | } | 927 | } |
792 | 928 | ||
793 | static inline void *lport_priv(const struct fc_lport *lp) | 929 | /** |
930 | * lport_priv() - Return the private data from a local port | ||
931 | * @lport: The local port whose private data is to be retreived | ||
932 | */ | ||
933 | static inline void *lport_priv(const struct fc_lport *lport) | ||
794 | { | 934 | { |
795 | return (void *)(lp + 1); | 935 | return (void *)(lport + 1); |
796 | } | 936 | } |
797 | 937 | ||
798 | /** | 938 | /** |
799 | * libfc_host_alloc() - Allocate a Scsi_Host with room for the fc_lport | 939 | * libfc_host_alloc() - Allocate a Scsi_Host with room for a local port and |
800 | * @sht: ptr to the scsi host templ | 940 | * LLD private data |
801 | * @priv_size: size of private data after fc_lport | 941 | * @sht: The SCSI host template |
942 | * @priv_size: Size of private data | ||
802 | * | 943 | * |
803 | * Returns: ptr to Scsi_Host | 944 | * Returns: libfc lport |
804 | */ | 945 | */ |
805 | static inline struct Scsi_Host * | 946 | static inline struct fc_lport * |
806 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) | 947 | libfc_host_alloc(struct scsi_host_template *sht, int priv_size) |
807 | { | 948 | { |
808 | return scsi_host_alloc(sht, sizeof(struct fc_lport) + priv_size); | 949 | struct fc_lport *lport; |
950 | struct Scsi_Host *shost; | ||
951 | |||
952 | shost = scsi_host_alloc(sht, sizeof(*lport) + priv_size); | ||
953 | if (!shost) | ||
954 | return NULL; | ||
955 | lport = shost_priv(shost); | ||
956 | lport->host = shost; | ||
957 | INIT_LIST_HEAD(&lport->ema_list); | ||
958 | INIT_LIST_HEAD(&lport->vports); | ||
959 | return lport; | ||
809 | } | 960 | } |
810 | 961 | ||
811 | /* | 962 | /* |
812 | * LOCAL PORT LAYER | 963 | * FC_FCP HELPER FUNCTIONS |
813 | *****************************/ | 964 | *****************************/ |
814 | int fc_lport_init(struct fc_lport *lp); | 965 | static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) |
815 | 966 | { | |
816 | /* | 967 | if (fsp && fsp->cmd) |
817 | * Destroy the specified local port by finding and freeing all | 968 | return fsp->cmd->sc_data_direction == DMA_FROM_DEVICE; |
818 | * fc_rports associated with it and then by freeing the fc_lport | 969 | return false; |
819 | * itself. | 970 | } |
820 | */ | ||
821 | int fc_lport_destroy(struct fc_lport *lp); | ||
822 | |||
823 | /* | ||
824 | * Logout the specified local port from the fabric | ||
825 | */ | ||
826 | int fc_fabric_logoff(struct fc_lport *lp); | ||
827 | |||
828 | /* | ||
829 | * Initiate the LP state machine. This handler will use fc_host_attr | ||
830 | * to store the FLOGI service parameters, so fc_host_attr must be | ||
831 | * initialized before calling this handler. | ||
832 | */ | ||
833 | int fc_fabric_login(struct fc_lport *lp); | ||
834 | 971 | ||
835 | /* | 972 | /* |
836 | * The link is up for the given local port. | 973 | * LOCAL PORT LAYER |
837 | */ | 974 | *****************************/ |
975 | int fc_lport_init(struct fc_lport *); | ||
976 | int fc_lport_destroy(struct fc_lport *); | ||
977 | int fc_fabric_logoff(struct fc_lport *); | ||
978 | int fc_fabric_login(struct fc_lport *); | ||
979 | void __fc_linkup(struct fc_lport *); | ||
838 | void fc_linkup(struct fc_lport *); | 980 | void fc_linkup(struct fc_lport *); |
839 | 981 | void __fc_linkdown(struct fc_lport *); | |
840 | /* | ||
841 | * Link is down for the given local port. | ||
842 | */ | ||
843 | void fc_linkdown(struct fc_lport *); | 982 | void fc_linkdown(struct fc_lport *); |
844 | 983 | void fc_vport_setlink(struct fc_lport *); | |
845 | /* | 984 | void fc_vports_linkchange(struct fc_lport *); |
846 | * Configure the local port. | ||
847 | */ | ||
848 | int fc_lport_config(struct fc_lport *); | 985 | int fc_lport_config(struct fc_lport *); |
849 | |||
850 | /* | ||
851 | * Reset the local port. | ||
852 | */ | ||
853 | int fc_lport_reset(struct fc_lport *); | 986 | int fc_lport_reset(struct fc_lport *); |
854 | 987 | int fc_set_mfs(struct fc_lport *, u32 mfs); | |
855 | /* | 988 | struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize); |
856 | * Set the mfs or reset | 989 | struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); |
857 | */ | 990 | int fc_lport_bsg_request(struct fc_bsg_job *); |
858 | int fc_set_mfs(struct fc_lport *lp, u32 mfs); | ||
859 | |||
860 | 991 | ||
861 | /* | 992 | /* |
862 | * REMOTE PORT LAYER | 993 | * REMOTE PORT LAYER |
863 | *****************************/ | 994 | *****************************/ |
864 | int fc_rport_init(struct fc_lport *lp); | 995 | int fc_rport_init(struct fc_lport *); |
865 | void fc_rport_terminate_io(struct fc_rport *rp); | 996 | void fc_rport_terminate_io(struct fc_rport *); |
866 | 997 | ||
867 | /* | 998 | /* |
868 | * DISCOVERY LAYER | 999 | * DISCOVERY LAYER |
869 | *****************************/ | 1000 | *****************************/ |
870 | int fc_disc_init(struct fc_lport *lp); | 1001 | int fc_disc_init(struct fc_lport *); |
871 | |||
872 | 1002 | ||
873 | /* | 1003 | /* |
874 | * SCSI LAYER | 1004 | * FCP LAYER |
875 | *****************************/ | 1005 | *****************************/ |
876 | /* | ||
877 | * Initialize the SCSI block of libfc | ||
878 | */ | ||
879 | int fc_fcp_init(struct fc_lport *); | 1006 | int fc_fcp_init(struct fc_lport *); |
880 | |||
881 | /* | ||
882 | * This section provides an API which allows direct interaction | ||
883 | * with the SCSI-ml. Each of these functions satisfies a function | ||
884 | * pointer defined in Scsi_Host and therefore is always called | ||
885 | * directly from the SCSI-ml. | ||
886 | */ | ||
887 | int fc_queuecommand(struct scsi_cmnd *sc_cmd, | ||
888 | void (*done)(struct scsi_cmnd *)); | ||
889 | |||
890 | /* | ||
891 | * complete processing of a fcp packet | ||
892 | * | ||
893 | * This function may sleep if a fsp timer is pending. | ||
894 | * The host lock must not be held by caller. | ||
895 | */ | ||
896 | void fc_fcp_complete(struct fc_fcp_pkt *fsp); | ||
897 | |||
898 | /* | ||
899 | * Send an ABTS frame to the target device. The sc_cmd argument | ||
900 | * is a pointer to the SCSI command to be aborted. | ||
901 | */ | ||
902 | int fc_eh_abort(struct scsi_cmnd *sc_cmd); | ||
903 | |||
904 | /* | ||
905 | * Reset a LUN by sending send the tm cmd to the target. | ||
906 | */ | ||
907 | int fc_eh_device_reset(struct scsi_cmnd *sc_cmd); | ||
908 | |||
909 | /* | ||
910 | * Reset the host adapter. | ||
911 | */ | ||
912 | int fc_eh_host_reset(struct scsi_cmnd *sc_cmd); | ||
913 | |||
914 | /* | ||
915 | * Check rport status. | ||
916 | */ | ||
917 | int fc_slave_alloc(struct scsi_device *sdev); | ||
918 | |||
919 | /* | ||
920 | * Adjust the queue depth. | ||
921 | */ | ||
922 | int fc_change_queue_depth(struct scsi_device *sdev, int qdepth); | ||
923 | |||
924 | /* | ||
925 | * Change the tag type. | ||
926 | */ | ||
927 | int fc_change_queue_type(struct scsi_device *sdev, int tag_type); | ||
928 | |||
929 | /* | ||
930 | * Free memory pools used by the FCP layer. | ||
931 | */ | ||
932 | void fc_fcp_destroy(struct fc_lport *); | 1007 | void fc_fcp_destroy(struct fc_lport *); |
933 | 1008 | ||
934 | /* | 1009 | /* |
935 | * Set up direct-data placement for this I/O request | 1010 | * SCSI INTERACTION LAYER |
936 | */ | 1011 | *****************************/ |
937 | void fc_fcp_ddp_setup(struct fc_fcp_pkt *fsp, u16 xid); | 1012 | int fc_queuecommand(struct scsi_cmnd *, |
1013 | void (*done)(struct scsi_cmnd *)); | ||
1014 | int fc_eh_abort(struct scsi_cmnd *); | ||
1015 | int fc_eh_device_reset(struct scsi_cmnd *); | ||
1016 | int fc_eh_host_reset(struct scsi_cmnd *); | ||
1017 | int fc_slave_alloc(struct scsi_device *); | ||
1018 | int fc_change_queue_depth(struct scsi_device *, int qdepth, int reason); | ||
1019 | int fc_change_queue_type(struct scsi_device *, int tag_type); | ||
938 | 1020 | ||
939 | /* | 1021 | /* |
940 | * ELS/CT interface | 1022 | * ELS/CT interface |
941 | *****************************/ | 1023 | *****************************/ |
942 | /* | 1024 | int fc_elsct_init(struct fc_lport *); |
943 | * Initializes ELS/CT interface | 1025 | struct fc_seq *fc_elsct_send(struct fc_lport *, u32 did, |
944 | */ | 1026 | struct fc_frame *, |
945 | int fc_elsct_init(struct fc_lport *lp); | 1027 | unsigned int op, |
1028 | void (*resp)(struct fc_seq *, | ||
1029 | struct fc_frame *, | ||
1030 | void *arg), | ||
1031 | void *arg, u32 timer_msec); | ||
1032 | void fc_lport_flogi_resp(struct fc_seq *, struct fc_frame *, void *); | ||
1033 | void fc_lport_logo_resp(struct fc_seq *, struct fc_frame *, void *); | ||
946 | 1034 | ||
947 | 1035 | ||
948 | /* | 1036 | /* |
949 | * EXCHANGE MANAGER LAYER | 1037 | * EXCHANGE MANAGER LAYER |
950 | *****************************/ | 1038 | *****************************/ |
951 | /* | 1039 | int fc_exch_init(struct fc_lport *); |
952 | * Initializes Exchange Manager related | 1040 | struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *, |
953 | * function pointers in struct libfc_function_template. | 1041 | struct fc_exch_mgr *, |
954 | */ | ||
955 | int fc_exch_init(struct fc_lport *lp); | ||
956 | |||
957 | /* | ||
958 | * Adds Exchange Manager (EM) mp to lport. | ||
959 | * | ||
960 | * Adds specified mp to lport using struct fc_exch_mgr_anchor, | ||
961 | * the struct fc_exch_mgr_anchor allows same EM sharing by | ||
962 | * more than one lport with their specified match function, | ||
963 | * the match function is used in allocating exchange from | ||
964 | * added mp. | ||
965 | */ | ||
966 | struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport, | ||
967 | struct fc_exch_mgr *mp, | ||
968 | bool (*match)(struct fc_frame *)); | 1042 | bool (*match)(struct fc_frame *)); |
969 | 1043 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *); | |
970 | /* | 1044 | int fc_exch_mgr_list_clone(struct fc_lport *src, struct fc_lport *dst); |
971 | * Deletes Exchange Manager (EM) from lport by removing | 1045 | struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *, enum fc_class class, |
972 | * its anchor ema from lport. | 1046 | u16 min_xid, u16 max_xid, |
973 | * | ||
974 | * If removed anchor ema was the last user of its associated EM | ||
975 | * then also destroys associated EM. | ||
976 | */ | ||
977 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema); | ||
978 | |||
979 | /* | ||
980 | * Allocates an Exchange Manager (EM). | ||
981 | * | ||
982 | * The EM manages exchanges for their allocation and | ||
983 | * free, also allows exchange lookup for received | ||
984 | * frame. | ||
985 | * | ||
986 | * The class is used for initializing FC class of | ||
987 | * allocated exchange from EM. | ||
988 | * | ||
989 | * The min_xid and max_xid will limit new | ||
990 | * exchange ID (XID) within this range for | ||
991 | * a new exchange. | ||
992 | * The LLD may choose to have multiple EMs, | ||
993 | * e.g. one EM instance per CPU receive thread in LLD. | ||
994 | * | ||
995 | * Specified match function is used in allocating exchanges | ||
996 | * from newly allocated EM. | ||
997 | */ | ||
998 | struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp, | ||
999 | enum fc_class class, | ||
1000 | u16 min_xid, | ||
1001 | u16 max_xid, | ||
1002 | bool (*match)(struct fc_frame *)); | 1047 | bool (*match)(struct fc_frame *)); |
1003 | 1048 | void fc_exch_mgr_free(struct fc_lport *); | |
1004 | /* | 1049 | void fc_exch_recv(struct fc_lport *, struct fc_frame *); |
1005 | * Free all exchange managers of a lport. | ||
1006 | */ | ||
1007 | void fc_exch_mgr_free(struct fc_lport *lport); | ||
1008 | |||
1009 | /* | ||
1010 | * Receive a frame on specified local port and exchange manager. | ||
1011 | */ | ||
1012 | void fc_exch_recv(struct fc_lport *lp, struct fc_frame *fp); | ||
1013 | |||
1014 | /* | ||
1015 | * This function is for exch_seq_send function pointer in | ||
1016 | * struct libfc_function_template, see comment block on | ||
1017 | * exch_seq_send for description of this function. | ||
1018 | */ | ||
1019 | struct fc_seq *fc_exch_seq_send(struct fc_lport *lp, | ||
1020 | struct fc_frame *fp, | ||
1021 | void (*resp)(struct fc_seq *sp, | ||
1022 | struct fc_frame *fp, | ||
1023 | void *arg), | ||
1024 | void (*destructor)(struct fc_seq *sp, | ||
1025 | void *arg), | ||
1026 | void *arg, u32 timer_msec); | ||
1027 | |||
1028 | /* | ||
1029 | * send a frame using existing sequence and exchange. | ||
1030 | */ | ||
1031 | int fc_seq_send(struct fc_lport *lp, struct fc_seq *sp, struct fc_frame *fp); | ||
1032 | |||
1033 | /* | ||
1034 | * Send ELS response using mainly infomation | ||
1035 | * in exchange and sequence in EM layer. | ||
1036 | */ | ||
1037 | void fc_seq_els_rsp_send(struct fc_seq *sp, enum fc_els_cmd els_cmd, | ||
1038 | struct fc_seq_els_data *els_data); | ||
1039 | |||
1040 | /* | ||
1041 | * This function is for seq_exch_abort function pointer in | ||
1042 | * struct libfc_function_template, see comment block on | ||
1043 | * seq_exch_abort for description of this function. | ||
1044 | */ | ||
1045 | int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec); | ||
1046 | |||
1047 | /* | ||
1048 | * Indicate that an exchange/sequence tuple is complete and the memory | ||
1049 | * allocated for the related objects may be freed. | ||
1050 | */ | ||
1051 | void fc_exch_done(struct fc_seq *sp); | ||
1052 | |||
1053 | /* | ||
1054 | * Allocate a new exchange and sequence pair. | ||
1055 | */ | ||
1056 | struct fc_exch *fc_exch_alloc(struct fc_lport *lport, struct fc_frame *fp); | ||
1057 | /* | ||
1058 | * Start a new sequence on the same exchange as the supplied sequence. | ||
1059 | */ | ||
1060 | struct fc_seq *fc_seq_start_next(struct fc_seq *sp); | ||
1061 | |||
1062 | |||
1063 | /* | ||
1064 | * Reset all EMs of a lport, releasing its all sequences and | ||
1065 | * exchanges. If sid is non-zero, then reset only exchanges | ||
1066 | * we sourced from that FID. If did is non-zero, reset only | ||
1067 | * exchanges destined to that FID. | ||
1068 | */ | ||
1069 | void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); | 1050 | void fc_exch_mgr_reset(struct fc_lport *, u32 s_id, u32 d_id); |
1070 | 1051 | ||
1071 | /* | 1052 | /* |
1072 | * Functions for fc_functions_template | 1053 | * Functions for fc_functions_template |
1073 | */ | 1054 | */ |
1074 | void fc_get_host_speed(struct Scsi_Host *shost); | 1055 | void fc_get_host_speed(struct Scsi_Host *); |
1075 | void fc_get_host_port_type(struct Scsi_Host *shost); | 1056 | void fc_get_host_port_type(struct Scsi_Host *); |
1076 | void fc_get_host_port_state(struct Scsi_Host *shost); | 1057 | void fc_get_host_port_state(struct Scsi_Host *); |
1077 | void fc_set_rport_loss_tmo(struct fc_rport *rport, u32 timeout); | 1058 | void fc_set_rport_loss_tmo(struct fc_rport *, u32 timeout); |
1078 | struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); | 1059 | struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *); |
1079 | 1060 | ||
1080 | /* | ||
1081 | * module setup functions. | ||
1082 | */ | ||
1083 | int fc_setup_exch_mgr(void); | ||
1084 | void fc_destroy_exch_mgr(void); | ||
1085 | int fc_setup_rport(void); | ||
1086 | void fc_destroy_rport(void); | ||
1087 | |||
1088 | /* | ||
1089 | * Internal libfc functions. | ||
1090 | */ | ||
1091 | const char *fc_els_resp_type(struct fc_frame *); | ||
1092 | |||
1093 | #endif /* _LIBFC_H_ */ | 1061 | #endif /* _LIBFC_H_ */ |