diff options
Diffstat (limited to 'drivers/s390/scsi/zfcp_def.h')
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 323 |
1 files changed, 8 insertions, 315 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 7da2fad8f515..e1b5b88e2ddb 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -71,131 +71,6 @@ | |||
71 | /* timeout value for "default timer" for fsf requests */ | 71 | /* timeout value for "default timer" for fsf requests */ |
72 | #define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ) | 72 | #define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ) |
73 | 73 | ||
74 | /*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/ | ||
75 | |||
76 | /* task attribute values in FCP-2 FCP_CMND IU */ | ||
77 | #define SIMPLE_Q 0 | ||
78 | #define HEAD_OF_Q 1 | ||
79 | #define ORDERED_Q 2 | ||
80 | #define ACA_Q 4 | ||
81 | #define UNTAGGED 5 | ||
82 | |||
83 | /* task management flags in FCP-2 FCP_CMND IU */ | ||
84 | #define FCP_CLEAR_ACA 0x40 | ||
85 | #define FCP_TARGET_RESET 0x20 | ||
86 | #define FCP_LOGICAL_UNIT_RESET 0x10 | ||
87 | #define FCP_CLEAR_TASK_SET 0x04 | ||
88 | #define FCP_ABORT_TASK_SET 0x02 | ||
89 | |||
90 | #define FCP_CDB_LENGTH 16 | ||
91 | |||
92 | #define ZFCP_DID_MASK 0x00FFFFFF | ||
93 | |||
94 | /* FCP(-2) FCP_CMND IU */ | ||
95 | struct fcp_cmnd_iu { | ||
96 | u64 fcp_lun; /* FCP logical unit number */ | ||
97 | u8 crn; /* command reference number */ | ||
98 | u8 reserved0:5; /* reserved */ | ||
99 | u8 task_attribute:3; /* task attribute */ | ||
100 | u8 task_management_flags; /* task management flags */ | ||
101 | u8 add_fcp_cdb_length:6; /* additional FCP_CDB length */ | ||
102 | u8 rddata:1; /* read data */ | ||
103 | u8 wddata:1; /* write data */ | ||
104 | u8 fcp_cdb[FCP_CDB_LENGTH]; | ||
105 | } __attribute__((packed)); | ||
106 | |||
107 | /* FCP(-2) FCP_RSP IU */ | ||
108 | struct fcp_rsp_iu { | ||
109 | u8 reserved0[10]; | ||
110 | union { | ||
111 | struct { | ||
112 | u8 reserved1:3; | ||
113 | u8 fcp_conf_req:1; | ||
114 | u8 fcp_resid_under:1; | ||
115 | u8 fcp_resid_over:1; | ||
116 | u8 fcp_sns_len_valid:1; | ||
117 | u8 fcp_rsp_len_valid:1; | ||
118 | } bits; | ||
119 | u8 value; | ||
120 | } validity; | ||
121 | u8 scsi_status; | ||
122 | u32 fcp_resid; | ||
123 | u32 fcp_sns_len; | ||
124 | u32 fcp_rsp_len; | ||
125 | } __attribute__((packed)); | ||
126 | |||
127 | |||
128 | #define RSP_CODE_GOOD 0 | ||
129 | #define RSP_CODE_LENGTH_MISMATCH 1 | ||
130 | #define RSP_CODE_FIELD_INVALID 2 | ||
131 | #define RSP_CODE_RO_MISMATCH 3 | ||
132 | #define RSP_CODE_TASKMAN_UNSUPP 4 | ||
133 | #define RSP_CODE_TASKMAN_FAILED 5 | ||
134 | |||
135 | /* see fc-fs */ | ||
136 | #define LS_RSCN 0x61 | ||
137 | #define LS_LOGO 0x05 | ||
138 | #define LS_PLOGI 0x03 | ||
139 | |||
140 | struct fcp_rscn_head { | ||
141 | u8 command; | ||
142 | u8 page_length; /* always 0x04 */ | ||
143 | u16 payload_len; | ||
144 | } __attribute__((packed)); | ||
145 | |||
146 | struct fcp_rscn_element { | ||
147 | u8 reserved:2; | ||
148 | u8 event_qual:4; | ||
149 | u8 addr_format:2; | ||
150 | u32 nport_did:24; | ||
151 | } __attribute__((packed)); | ||
152 | |||
153 | /* see fc-ph */ | ||
154 | struct fcp_logo { | ||
155 | u32 command; | ||
156 | u32 nport_did; | ||
157 | u64 nport_wwpn; | ||
158 | } __attribute__((packed)); | ||
159 | |||
160 | /* | ||
161 | * FC-FS stuff | ||
162 | */ | ||
163 | #define R_A_TOV 10 /* seconds */ | ||
164 | |||
165 | #define ZFCP_LS_RLS 0x0f | ||
166 | #define ZFCP_LS_ADISC 0x52 | ||
167 | #define ZFCP_LS_RPS 0x56 | ||
168 | #define ZFCP_LS_RSCN 0x61 | ||
169 | #define ZFCP_LS_RNID 0x78 | ||
170 | |||
171 | struct zfcp_ls_adisc { | ||
172 | u8 code; | ||
173 | u8 field[3]; | ||
174 | u32 hard_nport_id; | ||
175 | u64 wwpn; | ||
176 | u64 wwnn; | ||
177 | u32 nport_id; | ||
178 | } __attribute__ ((packed)); | ||
179 | |||
180 | /* | ||
181 | * FC-GS-2 stuff | ||
182 | */ | ||
183 | #define ZFCP_CT_REVISION 0x01 | ||
184 | #define ZFCP_CT_DIRECTORY_SERVICE 0xFC | ||
185 | #define ZFCP_CT_NAME_SERVER 0x02 | ||
186 | #define ZFCP_CT_SYNCHRONOUS 0x00 | ||
187 | #define ZFCP_CT_SCSI_FCP 0x08 | ||
188 | #define ZFCP_CT_UNABLE_TO_PERFORM_CMD 0x09 | ||
189 | #define ZFCP_CT_GID_PN 0x0121 | ||
190 | #define ZFCP_CT_GPN_FT 0x0172 | ||
191 | #define ZFCP_CT_ACCEPT 0x8002 | ||
192 | #define ZFCP_CT_REJECT 0x8001 | ||
193 | |||
194 | /* | ||
195 | * FC-GS-4 stuff | ||
196 | */ | ||
197 | #define ZFCP_CT_TIMEOUT (3 * R_A_TOV) | ||
198 | |||
199 | /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/ | 74 | /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/ |
200 | 75 | ||
201 | /* | 76 | /* |
@@ -205,7 +80,6 @@ struct zfcp_ls_adisc { | |||
205 | #define ZFCP_COMMON_FLAGS 0xfff00000 | 80 | #define ZFCP_COMMON_FLAGS 0xfff00000 |
206 | 81 | ||
207 | /* common status bits */ | 82 | /* common status bits */ |
208 | #define ZFCP_STATUS_COMMON_REMOVE 0x80000000 | ||
209 | #define ZFCP_STATUS_COMMON_RUNNING 0x40000000 | 83 | #define ZFCP_STATUS_COMMON_RUNNING 0x40000000 |
210 | #define ZFCP_STATUS_COMMON_ERP_FAILED 0x20000000 | 84 | #define ZFCP_STATUS_COMMON_ERP_FAILED 0x20000000 |
211 | #define ZFCP_STATUS_COMMON_UNBLOCKED 0x10000000 | 85 | #define ZFCP_STATUS_COMMON_UNBLOCKED 0x10000000 |
@@ -222,21 +96,10 @@ struct zfcp_ls_adisc { | |||
222 | #define ZFCP_STATUS_ADAPTER_ERP_PENDING 0x00000100 | 96 | #define ZFCP_STATUS_ADAPTER_ERP_PENDING 0x00000100 |
223 | #define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 0x00000200 | 97 | #define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 0x00000200 |
224 | 98 | ||
225 | /* FC-PH/FC-GS well-known address identifiers for generic services */ | ||
226 | #define ZFCP_DID_WKA 0xFFFFF0 | ||
227 | |||
228 | /* remote port status */ | 99 | /* remote port status */ |
229 | #define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001 | 100 | #define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001 |
230 | #define ZFCP_STATUS_PORT_LINK_TEST 0x00000002 | 101 | #define ZFCP_STATUS_PORT_LINK_TEST 0x00000002 |
231 | 102 | ||
232 | /* well known address (WKA) port status*/ | ||
233 | enum zfcp_wka_status { | ||
234 | ZFCP_WKA_PORT_OFFLINE, | ||
235 | ZFCP_WKA_PORT_CLOSING, | ||
236 | ZFCP_WKA_PORT_OPENING, | ||
237 | ZFCP_WKA_PORT_ONLINE, | ||
238 | }; | ||
239 | |||
240 | /* logical unit status */ | 103 | /* logical unit status */ |
241 | #define ZFCP_STATUS_UNIT_SHARED 0x00000004 | 104 | #define ZFCP_STATUS_UNIT_SHARED 0x00000004 |
242 | #define ZFCP_STATUS_UNIT_READONLY 0x00000008 | 105 | #define ZFCP_STATUS_UNIT_READONLY 0x00000008 |
@@ -247,10 +110,7 @@ enum zfcp_wka_status { | |||
247 | #define ZFCP_STATUS_FSFREQ_CLEANUP 0x00000010 | 110 | #define ZFCP_STATUS_FSFREQ_CLEANUP 0x00000010 |
248 | #define ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED 0x00000040 | 111 | #define ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED 0x00000040 |
249 | #define ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED 0x00000080 | 112 | #define ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED 0x00000080 |
250 | #define ZFCP_STATUS_FSFREQ_ABORTED 0x00000100 | ||
251 | #define ZFCP_STATUS_FSFREQ_TMFUNCFAILED 0x00000200 | 113 | #define ZFCP_STATUS_FSFREQ_TMFUNCFAILED 0x00000200 |
252 | #define ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP 0x00000400 | ||
253 | #define ZFCP_STATUS_FSFREQ_RETRY 0x00000800 | ||
254 | #define ZFCP_STATUS_FSFREQ_DISMISSED 0x00001000 | 114 | #define ZFCP_STATUS_FSFREQ_DISMISSED 0x00001000 |
255 | 115 | ||
256 | /************************* STRUCTURE DEFINITIONS *****************************/ | 116 | /************************* STRUCTURE DEFINITIONS *****************************/ |
@@ -265,125 +125,10 @@ struct zfcp_adapter_mempool { | |||
265 | mempool_t *scsi_abort; | 125 | mempool_t *scsi_abort; |
266 | mempool_t *status_read_req; | 126 | mempool_t *status_read_req; |
267 | mempool_t *status_read_data; | 127 | mempool_t *status_read_data; |
268 | mempool_t *gid_pn_data; | 128 | mempool_t *gid_pn; |
269 | mempool_t *qtcb_pool; | 129 | mempool_t *qtcb_pool; |
270 | }; | 130 | }; |
271 | 131 | ||
272 | /* | ||
273 | * header for CT_IU | ||
274 | */ | ||
275 | struct ct_hdr { | ||
276 | u8 revision; // 0x01 | ||
277 | u8 in_id[3]; // 0x00 | ||
278 | u8 gs_type; // 0xFC Directory Service | ||
279 | u8 gs_subtype; // 0x02 Name Server | ||
280 | u8 options; // 0x00 single bidirectional exchange | ||
281 | u8 reserved0; | ||
282 | u16 cmd_rsp_code; // 0x0121 GID_PN, or 0x0100 GA_NXT | ||
283 | u16 max_res_size; // <= (4096 - 16) / 4 | ||
284 | u8 reserved1; | ||
285 | u8 reason_code; | ||
286 | u8 reason_code_expl; | ||
287 | u8 vendor_unique; | ||
288 | } __attribute__ ((packed)); | ||
289 | |||
290 | /* nameserver request CT_IU -- for requests where | ||
291 | * a port name is required */ | ||
292 | struct ct_iu_gid_pn_req { | ||
293 | struct ct_hdr header; | ||
294 | u64 wwpn; | ||
295 | } __attribute__ ((packed)); | ||
296 | |||
297 | /* FS_ACC IU and data unit for GID_PN nameserver request */ | ||
298 | struct ct_iu_gid_pn_resp { | ||
299 | struct ct_hdr header; | ||
300 | u32 d_id; | ||
301 | } __attribute__ ((packed)); | ||
302 | |||
303 | struct ct_iu_gpn_ft_req { | ||
304 | struct ct_hdr header; | ||
305 | u8 flags; | ||
306 | u8 domain_id_scope; | ||
307 | u8 area_id_scope; | ||
308 | u8 fc4_type; | ||
309 | } __attribute__ ((packed)); | ||
310 | |||
311 | |||
312 | /** | ||
313 | * struct zfcp_send_ct - used to pass parameters to function zfcp_fsf_send_ct | ||
314 | * @wka_port: port where the request is sent to | ||
315 | * @req: scatter-gather list for request | ||
316 | * @resp: scatter-gather list for response | ||
317 | * @handler: handler function (called for response to the request) | ||
318 | * @handler_data: data passed to handler function | ||
319 | * @completion: completion for synchronization purposes | ||
320 | * @status: used to pass error status to calling function | ||
321 | */ | ||
322 | struct zfcp_send_ct { | ||
323 | struct zfcp_wka_port *wka_port; | ||
324 | struct scatterlist *req; | ||
325 | struct scatterlist *resp; | ||
326 | void (*handler)(unsigned long); | ||
327 | unsigned long handler_data; | ||
328 | struct completion *completion; | ||
329 | int status; | ||
330 | }; | ||
331 | |||
332 | /* used for name server requests in error recovery */ | ||
333 | struct zfcp_gid_pn_data { | ||
334 | struct zfcp_send_ct ct; | ||
335 | struct scatterlist req; | ||
336 | struct scatterlist resp; | ||
337 | struct ct_iu_gid_pn_req ct_iu_req; | ||
338 | struct ct_iu_gid_pn_resp ct_iu_resp; | ||
339 | struct zfcp_port *port; | ||
340 | }; | ||
341 | |||
342 | /** | ||
343 | * struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els | ||
344 | * @adapter: adapter where request is sent from | ||
345 | * @port: port where ELS is destinated (port reference count has to be increased) | ||
346 | * @d_id: destiniation id of port where request is sent to | ||
347 | * @req: scatter-gather list for request | ||
348 | * @resp: scatter-gather list for response | ||
349 | * @handler: handler function (called for response to the request) | ||
350 | * @handler_data: data passed to handler function | ||
351 | * @completion: completion for synchronization purposes | ||
352 | * @ls_code: hex code of ELS command | ||
353 | * @status: used to pass error status to calling function | ||
354 | */ | ||
355 | struct zfcp_send_els { | ||
356 | struct zfcp_adapter *adapter; | ||
357 | struct zfcp_port *port; | ||
358 | u32 d_id; | ||
359 | struct scatterlist *req; | ||
360 | struct scatterlist *resp; | ||
361 | void (*handler)(unsigned long); | ||
362 | unsigned long handler_data; | ||
363 | struct completion *completion; | ||
364 | int ls_code; | ||
365 | int status; | ||
366 | }; | ||
367 | |||
368 | struct zfcp_wka_port { | ||
369 | struct zfcp_adapter *adapter; | ||
370 | wait_queue_head_t completion_wq; | ||
371 | enum zfcp_wka_status status; | ||
372 | atomic_t refcount; | ||
373 | u32 d_id; | ||
374 | u32 handle; | ||
375 | struct mutex mutex; | ||
376 | struct delayed_work work; | ||
377 | }; | ||
378 | |||
379 | struct zfcp_wka_ports { | ||
380 | struct zfcp_wka_port ms; /* management service */ | ||
381 | struct zfcp_wka_port ts; /* time service */ | ||
382 | struct zfcp_wka_port ds; /* directory service */ | ||
383 | struct zfcp_wka_port as; /* alias service */ | ||
384 | struct zfcp_wka_port ks; /* key distribution service */ | ||
385 | }; | ||
386 | |||
387 | struct zfcp_qdio_queue { | 132 | struct zfcp_qdio_queue { |
388 | struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q]; | 133 | struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q]; |
389 | u8 first; /* index of next free bfr in queue */ | 134 | u8 first; /* index of next free bfr in queue */ |
@@ -446,9 +191,7 @@ struct zfcp_qdio { | |||
446 | }; | 191 | }; |
447 | 192 | ||
448 | struct zfcp_adapter { | 193 | struct zfcp_adapter { |
449 | atomic_t refcount; /* reference count */ | 194 | struct kref ref; |
450 | wait_queue_head_t remove_wq; /* can be used to wait for | ||
451 | refcount drop to zero */ | ||
452 | u64 peer_wwnn; /* P2P peer WWNN */ | 195 | u64 peer_wwnn; /* P2P peer WWNN */ |
453 | u64 peer_wwpn; /* P2P peer WWPN */ | 196 | u64 peer_wwpn; /* P2P peer WWPN */ |
454 | u32 peer_d_id; /* P2P peer D_ID */ | 197 | u32 peer_d_id; /* P2P peer D_ID */ |
@@ -461,7 +204,8 @@ struct zfcp_adapter { | |||
461 | u32 hardware_version; /* of FCP channel */ | 204 | u32 hardware_version; /* of FCP channel */ |
462 | u16 timer_ticks; /* time int for a tick */ | 205 | u16 timer_ticks; /* time int for a tick */ |
463 | struct Scsi_Host *scsi_host; /* Pointer to mid-layer */ | 206 | struct Scsi_Host *scsi_host; /* Pointer to mid-layer */ |
464 | struct list_head port_list_head; /* remote port list */ | 207 | struct list_head port_list; /* remote port list */ |
208 | rwlock_t port_list_lock; /* port list lock */ | ||
465 | unsigned long req_no; /* unique FSF req number */ | 209 | unsigned long req_no; /* unique FSF req number */ |
466 | struct list_head *req_list; /* list of pending reqs */ | 210 | struct list_head *req_list; /* list of pending reqs */ |
467 | spinlock_t req_list_lock; /* request list lock */ | 211 | spinlock_t req_list_lock; /* request list lock */ |
@@ -485,7 +229,7 @@ struct zfcp_adapter { | |||
485 | u32 erp_low_mem_count; /* nr of erp actions waiting | 229 | u32 erp_low_mem_count; /* nr of erp actions waiting |
486 | for memory */ | 230 | for memory */ |
487 | struct task_struct *erp_thread; | 231 | struct task_struct *erp_thread; |
488 | struct zfcp_wka_ports *gs; /* generic services */ | 232 | struct zfcp_fc_wka_ports *gs; /* generic services */ |
489 | struct zfcp_dbf *dbf; /* debug traces */ | 233 | struct zfcp_dbf *dbf; /* debug traces */ |
490 | struct zfcp_adapter_mempool pool; /* Adapter memory pools */ | 234 | struct zfcp_adapter_mempool pool; /* Adapter memory pools */ |
491 | struct fc_host_statistics *fc_stats; | 235 | struct fc_host_statistics *fc_stats; |
@@ -500,11 +244,9 @@ struct zfcp_port { | |||
500 | struct device sysfs_device; /* sysfs device */ | 244 | struct device sysfs_device; /* sysfs device */ |
501 | struct fc_rport *rport; /* rport of fc transport class */ | 245 | struct fc_rport *rport; /* rport of fc transport class */ |
502 | struct list_head list; /* list of remote ports */ | 246 | struct list_head list; /* list of remote ports */ |
503 | atomic_t refcount; /* reference count */ | ||
504 | wait_queue_head_t remove_wq; /* can be used to wait for | ||
505 | refcount drop to zero */ | ||
506 | struct zfcp_adapter *adapter; /* adapter used to access port */ | 247 | struct zfcp_adapter *adapter; /* adapter used to access port */ |
507 | struct list_head unit_list_head; /* head of logical unit list */ | 248 | struct list_head unit_list; /* head of logical unit list */ |
249 | rwlock_t unit_list_lock; /* unit list lock */ | ||
508 | atomic_t status; /* status of this remote port */ | 250 | atomic_t status; /* status of this remote port */ |
509 | u64 wwnn; /* WWNN if known */ | 251 | u64 wwnn; /* WWNN if known */ |
510 | u64 wwpn; /* WWPN */ | 252 | u64 wwpn; /* WWPN */ |
@@ -523,9 +265,6 @@ struct zfcp_port { | |||
523 | struct zfcp_unit { | 265 | struct zfcp_unit { |
524 | struct device sysfs_device; /* sysfs device */ | 266 | struct device sysfs_device; /* sysfs device */ |
525 | struct list_head list; /* list of logical units */ | 267 | struct list_head list; /* list of logical units */ |
526 | atomic_t refcount; /* reference count */ | ||
527 | wait_queue_head_t remove_wq; /* can be used to wait for | ||
528 | refcount drop to zero */ | ||
529 | struct zfcp_port *port; /* remote port of unit */ | 268 | struct zfcp_port *port; /* remote port of unit */ |
530 | atomic_t status; /* status of this logical unit */ | 269 | atomic_t status; /* status of this logical unit */ |
531 | u64 fcp_lun; /* own FCP_LUN */ | 270 | u64 fcp_lun; /* own FCP_LUN */ |
@@ -601,14 +340,11 @@ struct zfcp_fsf_req { | |||
601 | struct zfcp_data { | 340 | struct zfcp_data { |
602 | struct scsi_host_template scsi_host_template; | 341 | struct scsi_host_template scsi_host_template; |
603 | struct scsi_transport_template *scsi_transport_template; | 342 | struct scsi_transport_template *scsi_transport_template; |
604 | rwlock_t config_lock; /* serialises changes | ||
605 | to adapter/port/unit | ||
606 | lists */ | ||
607 | struct mutex config_mutex; | ||
608 | struct kmem_cache *gpn_ft_cache; | 343 | struct kmem_cache *gpn_ft_cache; |
609 | struct kmem_cache *qtcb_cache; | 344 | struct kmem_cache *qtcb_cache; |
610 | struct kmem_cache *sr_buffer_cache; | 345 | struct kmem_cache *sr_buffer_cache; |
611 | struct kmem_cache *gid_pn_cache; | 346 | struct kmem_cache *gid_pn_cache; |
347 | struct kmem_cache *adisc_cache; | ||
612 | }; | 348 | }; |
613 | 349 | ||
614 | /********************** ZFCP SPECIFIC DEFINES ********************************/ | 350 | /********************** ZFCP SPECIFIC DEFINES ********************************/ |
@@ -657,47 +393,4 @@ zfcp_reqlist_find_safe(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req) | |||
657 | return NULL; | 393 | return NULL; |
658 | } | 394 | } |
659 | 395 | ||
660 | /* | ||
661 | * functions needed for reference/usage counting | ||
662 | */ | ||
663 | |||
664 | static inline void | ||
665 | zfcp_unit_get(struct zfcp_unit *unit) | ||
666 | { | ||
667 | atomic_inc(&unit->refcount); | ||
668 | } | ||
669 | |||
670 | static inline void | ||
671 | zfcp_unit_put(struct zfcp_unit *unit) | ||
672 | { | ||
673 | if (atomic_dec_return(&unit->refcount) == 0) | ||
674 | wake_up(&unit->remove_wq); | ||
675 | } | ||
676 | |||
677 | static inline void | ||
678 | zfcp_port_get(struct zfcp_port *port) | ||
679 | { | ||
680 | atomic_inc(&port->refcount); | ||
681 | } | ||
682 | |||
683 | static inline void | ||
684 | zfcp_port_put(struct zfcp_port *port) | ||
685 | { | ||
686 | if (atomic_dec_return(&port->refcount) == 0) | ||
687 | wake_up(&port->remove_wq); | ||
688 | } | ||
689 | |||
690 | static inline void | ||
691 | zfcp_adapter_get(struct zfcp_adapter *adapter) | ||
692 | { | ||
693 | atomic_inc(&adapter->refcount); | ||
694 | } | ||
695 | |||
696 | static inline void | ||
697 | zfcp_adapter_put(struct zfcp_adapter *adapter) | ||
698 | { | ||
699 | if (atomic_dec_return(&adapter->refcount) == 0) | ||
700 | wake_up(&adapter->remove_wq); | ||
701 | } | ||
702 | |||
703 | #endif /* ZFCP_DEF_H */ | 396 | #endif /* ZFCP_DEF_H */ |