aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_def.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_def.h')
-rw-r--r--drivers/s390/scsi/zfcp_def.h114
1 files changed, 9 insertions, 105 deletions
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index e1b5b88e2ddb..7131c7db1f04 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Global definitions for the zfcp device driver. 4 * Global definitions for the zfcp device driver.
5 * 5 *
6 * Copyright IBM Corporation 2002, 2009 6 * Copyright IBM Corporation 2002, 2010
7 */ 7 */
8 8
9#ifndef ZFCP_DEF_H 9#ifndef ZFCP_DEF_H
@@ -33,15 +33,13 @@
33#include <scsi/scsi_transport_fc.h> 33#include <scsi/scsi_transport_fc.h>
34#include <scsi/scsi_bsg_fc.h> 34#include <scsi/scsi_bsg_fc.h>
35#include <asm/ccwdev.h> 35#include <asm/ccwdev.h>
36#include <asm/qdio.h>
37#include <asm/debug.h> 36#include <asm/debug.h>
38#include <asm/ebcdic.h> 37#include <asm/ebcdic.h>
39#include <asm/sysinfo.h> 38#include <asm/sysinfo.h>
40#include "zfcp_fsf.h" 39#include "zfcp_fsf.h"
40#include "zfcp_qdio.h"
41 41
42/********************* GENERAL DEFINES *********************************/ 42struct zfcp_reqlist;
43
44#define REQUEST_LIST_SIZE 128
45 43
46/********************* SCSI SPECIFIC DEFINES *********************************/ 44/********************* SCSI SPECIFIC DEFINES *********************************/
47#define ZFCP_SCSI_ER_TIMEOUT (10*HZ) 45#define ZFCP_SCSI_ER_TIMEOUT (10*HZ)
@@ -129,12 +127,6 @@ struct zfcp_adapter_mempool {
129 mempool_t *qtcb_pool; 127 mempool_t *qtcb_pool;
130}; 128};
131 129
132struct zfcp_qdio_queue {
133 struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q];
134 u8 first; /* index of next free bfr in queue */
135 atomic_t count; /* number of free buffers in queue */
136};
137
138struct zfcp_erp_action { 130struct zfcp_erp_action {
139 struct list_head list; 131 struct list_head list;
140 int action; /* requested action code */ 132 int action; /* requested action code */
@@ -143,8 +135,7 @@ struct zfcp_erp_action {
143 struct zfcp_unit *unit; 135 struct zfcp_unit *unit;
144 u32 status; /* recovery status */ 136 u32 status; /* recovery status */
145 u32 step; /* active step of this erp action */ 137 u32 step; /* active step of this erp action */
146 struct zfcp_fsf_req *fsf_req; /* fsf request currently pending 138 unsigned long fsf_req_id;
147 for this action */
148 struct timer_list timer; 139 struct timer_list timer;
149}; 140};
150 141
@@ -167,29 +158,6 @@ struct zfcp_latencies {
167 spinlock_t lock; 158 spinlock_t lock;
168}; 159};
169 160
170/** struct zfcp_qdio - basic QDIO data structure
171 * @resp_q: response queue
172 * @req_q: request queue
173 * @stat_lock: lock to protect req_q_util and req_q_time
174 * @req_q_lock; lock to serialize access to request queue
175 * @req_q_time: time of last fill level change
176 * @req_q_util: used for accounting
177 * @req_q_full: queue full incidents
178 * @req_q_wq: used to wait for SBAL availability
179 * @adapter: adapter used in conjunction with this QDIO structure
180 */
181struct zfcp_qdio {
182 struct zfcp_qdio_queue resp_q;
183 struct zfcp_qdio_queue req_q;
184 spinlock_t stat_lock;
185 spinlock_t req_q_lock;
186 unsigned long long req_q_time;
187 u64 req_q_util;
188 atomic_t req_q_full;
189 wait_queue_head_t req_q_wq;
190 struct zfcp_adapter *adapter;
191};
192
193struct zfcp_adapter { 161struct zfcp_adapter {
194 struct kref ref; 162 struct kref ref;
195 u64 peer_wwnn; /* P2P peer WWNN */ 163 u64 peer_wwnn; /* P2P peer WWNN */
@@ -207,8 +175,7 @@ struct zfcp_adapter {
207 struct list_head port_list; /* remote port list */ 175 struct list_head port_list; /* remote port list */
208 rwlock_t port_list_lock; /* port list lock */ 176 rwlock_t port_list_lock; /* port list lock */
209 unsigned long req_no; /* unique FSF req number */ 177 unsigned long req_no; /* unique FSF req number */
210 struct list_head *req_list; /* list of pending reqs */ 178 struct zfcp_reqlist *req_list;
211 spinlock_t req_list_lock; /* request list lock */
212 u32 fsf_req_seq_no; /* FSF cmnd seq number */ 179 u32 fsf_req_seq_no; /* FSF cmnd seq number */
213 rwlock_t abort_lock; /* Protects against SCSI 180 rwlock_t abort_lock; /* Protects against SCSI
214 stack abort/command 181 stack abort/command
@@ -241,7 +208,7 @@ struct zfcp_adapter {
241}; 208};
242 209
243struct zfcp_port { 210struct zfcp_port {
244 struct device sysfs_device; /* sysfs device */ 211 struct device dev;
245 struct fc_rport *rport; /* rport of fc transport class */ 212 struct fc_rport *rport; /* rport of fc transport class */
246 struct list_head list; /* list of remote ports */ 213 struct list_head list; /* list of remote ports */
247 struct zfcp_adapter *adapter; /* adapter used to access port */ 214 struct zfcp_adapter *adapter; /* adapter used to access port */
@@ -263,7 +230,7 @@ struct zfcp_port {
263}; 230};
264 231
265struct zfcp_unit { 232struct zfcp_unit {
266 struct device sysfs_device; /* sysfs device */ 233 struct device dev;
267 struct list_head list; /* list of logical units */ 234 struct list_head list; /* list of logical units */
268 struct zfcp_port *port; /* remote port of unit */ 235 struct zfcp_port *port; /* remote port of unit */
269 atomic_t status; /* status of this logical unit */ 236 atomic_t status; /* status of this logical unit */
@@ -277,33 +244,11 @@ struct zfcp_unit {
277}; 244};
278 245
279/** 246/**
280 * struct zfcp_queue_req - queue related values for a request
281 * @sbal_number: number of free SBALs
282 * @sbal_first: first SBAL for this request
283 * @sbal_last: last SBAL for this request
284 * @sbal_limit: last possible SBAL for this request
285 * @sbale_curr: current SBALE at creation of this request
286 * @sbal_response: SBAL used in interrupt
287 * @qdio_outb_usage: usage of outbound queue
288 * @qdio_inb_usage: usage of inbound queue
289 */
290struct zfcp_queue_req {
291 u8 sbal_number;
292 u8 sbal_first;
293 u8 sbal_last;
294 u8 sbal_limit;
295 u8 sbale_curr;
296 u8 sbal_response;
297 u16 qdio_outb_usage;
298 u16 qdio_inb_usage;
299};
300
301/**
302 * struct zfcp_fsf_req - basic FSF request structure 247 * struct zfcp_fsf_req - basic FSF request structure
303 * @list: list of FSF requests 248 * @list: list of FSF requests
304 * @req_id: unique request ID 249 * @req_id: unique request ID
305 * @adapter: adapter this request belongs to 250 * @adapter: adapter this request belongs to
306 * @queue_req: queue related values 251 * @qdio_req: qdio queue related values
307 * @completion: used to signal the completion of the request 252 * @completion: used to signal the completion of the request
308 * @status: status of the request 253 * @status: status of the request
309 * @fsf_command: FSF command issued 254 * @fsf_command: FSF command issued
@@ -321,7 +266,7 @@ struct zfcp_fsf_req {
321 struct list_head list; 266 struct list_head list;
322 unsigned long req_id; 267 unsigned long req_id;
323 struct zfcp_adapter *adapter; 268 struct zfcp_adapter *adapter;
324 struct zfcp_queue_req queue_req; 269 struct zfcp_qdio_req qdio_req;
325 struct completion completion; 270 struct completion completion;
326 u32 status; 271 u32 status;
327 u32 fsf_command; 272 u32 fsf_command;
@@ -352,45 +297,4 @@ struct zfcp_data {
352#define ZFCP_SET 0x00000100 297#define ZFCP_SET 0x00000100
353#define ZFCP_CLEAR 0x00000200 298#define ZFCP_CLEAR 0x00000200
354 299
355/*
356 * Helper functions for request ID management.
357 */
358static inline int zfcp_reqlist_hash(unsigned long req_id)
359{
360 return req_id % REQUEST_LIST_SIZE;
361}
362
363static inline void zfcp_reqlist_remove(struct zfcp_adapter *adapter,
364 struct zfcp_fsf_req *fsf_req)
365{
366 list_del(&fsf_req->list);
367}
368
369static inline struct zfcp_fsf_req *
370zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id)
371{
372 struct zfcp_fsf_req *request;
373 unsigned int idx;
374
375 idx = zfcp_reqlist_hash(req_id);
376 list_for_each_entry(request, &adapter->req_list[idx], list)
377 if (request->req_id == req_id)
378 return request;
379 return NULL;
380}
381
382static inline struct zfcp_fsf_req *
383zfcp_reqlist_find_safe(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req)
384{
385 struct zfcp_fsf_req *request;
386 unsigned int idx;
387
388 for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) {
389 list_for_each_entry(request, &adapter->req_list[idx], list)
390 if (request == req)
391 return request;
392 }
393 return NULL;
394}
395
396#endif /* ZFCP_DEF_H */ 300#endif /* ZFCP_DEF_H */