zfcp_def.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. /*
  2. * zfcp device driver
  3. *
  4. * Global definitions for the zfcp device driver.
  5. *
  6. * Copyright IBM Corporation 2002, 2009
  7. */
  8. #ifndef ZFCP_DEF_H
  9. #define ZFCP_DEF_H
  10. /*************************** INCLUDES *****************************************/
  11. #include <linux/init.h>
  12. #include <linux/moduleparam.h>
  13. #include <linux/major.h>
  14. #include <linux/blkdev.h>
  15. #include <linux/delay.h>
  16. #include <linux/timer.h>
  17. #include <linux/slab.h>
  18. #include <linux/mempool.h>
  19. #include <linux/syscalls.h>
  20. #include <linux/scatterlist.h>
  21. #include <linux/ioctl.h>
  22. #include <scsi/fc/fc_fs.h>
  23. #include <scsi/fc/fc_gs.h>
  24. #include <scsi/scsi.h>
  25. #include <scsi/scsi_tcq.h>
  26. #include <scsi/scsi_cmnd.h>
  27. #include <scsi/scsi_device.h>
  28. #include <scsi/scsi_host.h>
  29. #include <scsi/scsi_transport.h>
  30. #include <scsi/scsi_transport_fc.h>
  31. #include <scsi/scsi_bsg_fc.h>
  32. #include <asm/ccwdev.h>
  33. #include <asm/qdio.h>
  34. #include <asm/debug.h>
  35. #include <asm/ebcdic.h>
  36. #include <asm/sysinfo.h>
  37. #include "zfcp_fsf.h"
  38. /********************* GENERAL DEFINES *********************************/
  39. #define REQUEST_LIST_SIZE 128
  40. /********************* SCSI SPECIFIC DEFINES *********************************/
  41. #define ZFCP_SCSI_ER_TIMEOUT (10*HZ)
  42. /********************* CIO/QDIO SPECIFIC DEFINES *****************************/
  43. /* DMQ bug workaround: don't use last SBALE */
  44. #define ZFCP_MAX_SBALES_PER_SBAL (QDIO_MAX_ELEMENTS_PER_BUFFER - 1)
  45. /* index of last SBALE (with respect to DMQ bug workaround) */
  46. #define ZFCP_LAST_SBALE_PER_SBAL (ZFCP_MAX_SBALES_PER_SBAL - 1)
  47. /* max. number of (data buffer) SBALEs in largest SBAL chain */
  48. #define ZFCP_MAX_SBALES_PER_REQ \
  49. (FSF_MAX_SBALS_PER_REQ * ZFCP_MAX_SBALES_PER_SBAL - 2)
  50. /* request ID + QTCB in SBALE 0 + 1 of first SBAL in chain */
  51. #define ZFCP_MAX_SECTORS (ZFCP_MAX_SBALES_PER_REQ * 8)
  52. /* max. number of (data buffer) SBALEs in largest SBAL chain
  53. multiplied with number of sectors per 4k block */
  54. /********************* FSF SPECIFIC DEFINES *********************************/
  55. /* ATTENTION: value must not be used by hardware */
  56. #define FSF_QTCB_UNSOLICITED_STATUS 0x6305
  57. /* timeout value for "default timer" for fsf requests */
  58. #define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ)
  59. /*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/
  60. #define ZFCP_DID_MASK 0x00FFFFFF
  61. /* see fc-fs */
  62. #define LS_RSCN 0x61
  63. #define LS_LOGO 0x05
  64. #define LS_PLOGI 0x03
  65. struct fcp_rscn_head {
  66. u8 command;
  67. u8 page_length; /* always 0x04 */
  68. u16 payload_len;
  69. } __attribute__((packed));
  70. struct fcp_rscn_element {
  71. u8 reserved:2;
  72. u8 event_qual:4;
  73. u8 addr_format:2;
  74. u32 nport_did:24;
  75. } __attribute__((packed));
  76. /* see fc-ph */
  77. struct fcp_logo {
  78. u32 command;
  79. u32 nport_did;
  80. u64 nport_wwpn;
  81. } __attribute__((packed));
  82. /*
  83. * FC-FS stuff
  84. */
  85. #define R_A_TOV 10 /* seconds */
  86. #define ZFCP_LS_RLS 0x0f
  87. #define ZFCP_LS_ADISC 0x52
  88. #define ZFCP_LS_RPS 0x56
  89. #define ZFCP_LS_RSCN 0x61
  90. #define ZFCP_LS_RNID 0x78
  91. struct zfcp_ls_adisc {
  92. u8 code;
  93. u8 field[3];
  94. u32 hard_nport_id;
  95. u64 wwpn;
  96. u64 wwnn;
  97. u32 nport_id;
  98. } __attribute__ ((packed));
  99. /*
  100. * FC-GS-2 stuff
  101. */
  102. #define ZFCP_CT_REVISION 0x01
  103. #define ZFCP_CT_DIRECTORY_SERVICE 0xFC
  104. #define ZFCP_CT_NAME_SERVER 0x02
  105. #define ZFCP_CT_SYNCHRONOUS 0x00
  106. #define ZFCP_CT_SCSI_FCP 0x08
  107. #define ZFCP_CT_UNABLE_TO_PERFORM_CMD 0x09
  108. #define ZFCP_CT_GID_PN 0x0121
  109. #define ZFCP_CT_GPN_FT 0x0172
  110. #define ZFCP_CT_ACCEPT 0x8002
  111. #define ZFCP_CT_REJECT 0x8001
  112. /*
  113. * FC-GS-4 stuff
  114. */
  115. #define ZFCP_CT_TIMEOUT (3 * R_A_TOV)
  116. /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
  117. /*
  118. * Note, the leftmost status byte is common among adapter, port
  119. * and unit
  120. */
  121. #define ZFCP_COMMON_FLAGS 0xfff00000
  122. /* common status bits */
  123. #define ZFCP_STATUS_COMMON_RUNNING 0x40000000
  124. #define ZFCP_STATUS_COMMON_ERP_FAILED 0x20000000
  125. #define ZFCP_STATUS_COMMON_UNBLOCKED 0x10000000
  126. #define ZFCP_STATUS_COMMON_OPEN 0x04000000
  127. #define ZFCP_STATUS_COMMON_ERP_INUSE 0x01000000
  128. #define ZFCP_STATUS_COMMON_ACCESS_DENIED 0x00800000
  129. #define ZFCP_STATUS_COMMON_ACCESS_BOXED 0x00400000
  130. #define ZFCP_STATUS_COMMON_NOESC 0x00200000
  131. /* adapter status */
  132. #define ZFCP_STATUS_ADAPTER_QDIOUP 0x00000002
  133. #define ZFCP_STATUS_ADAPTER_XCONFIG_OK 0x00000008
  134. #define ZFCP_STATUS_ADAPTER_HOST_CON_INIT 0x00000010
  135. #define ZFCP_STATUS_ADAPTER_ERP_PENDING 0x00000100
  136. #define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED 0x00000200
  137. /* FC-PH/FC-GS well-known address identifiers for generic services */
  138. #define ZFCP_DID_WKA 0xFFFFF0
  139. /* remote port status */
  140. #define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001
  141. #define ZFCP_STATUS_PORT_LINK_TEST 0x00000002
  142. /* well known address (WKA) port status*/
  143. enum zfcp_wka_status {
  144. ZFCP_WKA_PORT_OFFLINE,
  145. ZFCP_WKA_PORT_CLOSING,
  146. ZFCP_WKA_PORT_OPENING,
  147. ZFCP_WKA_PORT_ONLINE,
  148. };
  149. /* logical unit status */
  150. #define ZFCP_STATUS_UNIT_SHARED 0x00000004
  151. #define ZFCP_STATUS_UNIT_READONLY 0x00000008
  152. /* FSF request status (this does not have a common part) */
  153. #define ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT 0x00000002
  154. #define ZFCP_STATUS_FSFREQ_ERROR 0x00000008
  155. #define ZFCP_STATUS_FSFREQ_CLEANUP 0x00000010
  156. #define ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED 0x00000040
  157. #define ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED 0x00000080
  158. #define ZFCP_STATUS_FSFREQ_ABORTED 0x00000100
  159. #define ZFCP_STATUS_FSFREQ_TMFUNCFAILED 0x00000200
  160. #define ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP 0x00000400
  161. #define ZFCP_STATUS_FSFREQ_RETRY 0x00000800
  162. #define ZFCP_STATUS_FSFREQ_DISMISSED 0x00001000
  163. /************************* STRUCTURE DEFINITIONS *****************************/
  164. struct zfcp_fsf_req;
  165. /* holds various memory pools of an adapter */
  166. struct zfcp_adapter_mempool {
  167. mempool_t *erp_req;
  168. mempool_t *gid_pn_req;
  169. mempool_t *scsi_req;
  170. mempool_t *scsi_abort;
  171. mempool_t *status_read_req;
  172. mempool_t *status_read_data;
  173. mempool_t *gid_pn_data;
  174. mempool_t *qtcb_pool;
  175. };
  176. /*
  177. * header for CT_IU
  178. */
  179. struct ct_hdr {
  180. u8 revision; // 0x01
  181. u8 in_id[3]; // 0x00
  182. u8 gs_type; // 0xFC Directory Service
  183. u8 gs_subtype; // 0x02 Name Server
  184. u8 options; // 0x00 single bidirectional exchange
  185. u8 reserved0;
  186. u16 cmd_rsp_code; // 0x0121 GID_PN, or 0x0100 GA_NXT
  187. u16 max_res_size; // <= (4096 - 16) / 4
  188. u8 reserved1;
  189. u8 reason_code;
  190. u8 reason_code_expl;
  191. u8 vendor_unique;
  192. } __attribute__ ((packed));
  193. /* nameserver request CT_IU -- for requests where
  194. * a port name is required */
  195. struct ct_iu_gid_pn_req {
  196. struct ct_hdr header;
  197. u64 wwpn;
  198. } __attribute__ ((packed));
  199. /* FS_ACC IU and data unit for GID_PN nameserver request */
  200. struct ct_iu_gid_pn_resp {
  201. struct ct_hdr header;
  202. u32 d_id;
  203. } __attribute__ ((packed));
  204. struct ct_iu_gpn_ft_req {
  205. struct ct_hdr header;
  206. u8 flags;
  207. u8 domain_id_scope;
  208. u8 area_id_scope;
  209. u8 fc4_type;
  210. } __attribute__ ((packed));
  211. /**
  212. * struct zfcp_send_ct - used to pass parameters to function zfcp_fsf_send_ct
  213. * @wka_port: port where the request is sent to
  214. * @req: scatter-gather list for request
  215. * @resp: scatter-gather list for response
  216. * @handler: handler function (called for response to the request)
  217. * @handler_data: data passed to handler function
  218. * @completion: completion for synchronization purposes
  219. * @status: used to pass error status to calling function
  220. */
  221. struct zfcp_send_ct {
  222. struct zfcp_wka_port *wka_port;
  223. struct scatterlist *req;
  224. struct scatterlist *resp;
  225. void (*handler)(unsigned long);
  226. unsigned long handler_data;
  227. struct completion *completion;
  228. int status;
  229. };
  230. /* used for name server requests in error recovery */
  231. struct zfcp_gid_pn_data {
  232. struct zfcp_send_ct ct;
  233. struct scatterlist req;
  234. struct scatterlist resp;
  235. struct ct_iu_gid_pn_req ct_iu_req;
  236. struct ct_iu_gid_pn_resp ct_iu_resp;
  237. struct zfcp_port *port;
  238. };
  239. /**
  240. * struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els
  241. * @adapter: adapter where request is sent from
  242. * @port: port where ELS is destinated (port reference count has to be increased)
  243. * @d_id: destiniation id of port where request is sent to
  244. * @req: scatter-gather list for request
  245. * @resp: scatter-gather list for response
  246. * @handler: handler function (called for response to the request)
  247. * @handler_data: data passed to handler function
  248. * @completion: completion for synchronization purposes
  249. * @ls_code: hex code of ELS command
  250. * @status: used to pass error status to calling function
  251. */
  252. struct zfcp_send_els {
  253. struct zfcp_adapter *adapter;
  254. struct zfcp_port *port;
  255. u32 d_id;
  256. struct scatterlist *req;
  257. struct scatterlist *resp;
  258. void (*handler)(unsigned long);
  259. unsigned long handler_data;
  260. struct completion *completion;
  261. int ls_code;
  262. int status;
  263. };
  264. struct zfcp_wka_port {
  265. struct zfcp_adapter *adapter;
  266. wait_queue_head_t completion_wq;
  267. enum zfcp_wka_status status;
  268. atomic_t refcount;
  269. u32 d_id;
  270. u32 handle;
  271. struct mutex mutex;
  272. struct delayed_work work;
  273. };
  274. struct zfcp_wka_ports {
  275. struct zfcp_wka_port ms; /* management service */
  276. struct zfcp_wka_port ts; /* time service */
  277. struct zfcp_wka_port ds; /* directory service */
  278. struct zfcp_wka_port as; /* alias service */
  279. struct zfcp_wka_port ks; /* key distribution service */
  280. };
  281. struct zfcp_qdio_queue {
  282. struct qdio_buffer *sbal[QDIO_MAX_BUFFERS_PER_Q];
  283. u8 first; /* index of next free bfr in queue */
  284. atomic_t count; /* number of free buffers in queue */
  285. };
  286. struct zfcp_erp_action {
  287. struct list_head list;
  288. int action; /* requested action code */
  289. struct zfcp_adapter *adapter; /* device which should be recovered */
  290. struct zfcp_port *port;
  291. struct zfcp_unit *unit;
  292. u32 status; /* recovery status */
  293. u32 step; /* active step of this erp action */
  294. struct zfcp_fsf_req *fsf_req; /* fsf request currently pending
  295. for this action */
  296. struct timer_list timer;
  297. };
  298. struct fsf_latency_record {
  299. u32 min;
  300. u32 max;
  301. u64 sum;
  302. };
  303. struct latency_cont {
  304. struct fsf_latency_record channel;
  305. struct fsf_latency_record fabric;
  306. u64 counter;
  307. };
  308. struct zfcp_latencies {
  309. struct latency_cont read;
  310. struct latency_cont write;
  311. struct latency_cont cmd;
  312. spinlock_t lock;
  313. };
  314. /** struct zfcp_qdio - basic QDIO data structure
  315. * @resp_q: response queue
  316. * @req_q: request queue
  317. * @stat_lock: lock to protect req_q_util and req_q_time
  318. * @req_q_lock; lock to serialize access to request queue
  319. * @req_q_time: time of last fill level change
  320. * @req_q_util: used for accounting
  321. * @req_q_full: queue full incidents
  322. * @req_q_wq: used to wait for SBAL availability
  323. * @adapter: adapter used in conjunction with this QDIO structure
  324. */
  325. struct zfcp_qdio {
  326. struct zfcp_qdio_queue resp_q;
  327. struct zfcp_qdio_queue req_q;
  328. spinlock_t stat_lock;
  329. spinlock_t req_q_lock;
  330. unsigned long long req_q_time;
  331. u64 req_q_util;
  332. atomic_t req_q_full;
  333. wait_queue_head_t req_q_wq;
  334. struct zfcp_adapter *adapter;
  335. };
  336. struct zfcp_adapter {
  337. struct kref ref;
  338. u64 peer_wwnn; /* P2P peer WWNN */
  339. u64 peer_wwpn; /* P2P peer WWPN */
  340. u32 peer_d_id; /* P2P peer D_ID */
  341. struct ccw_device *ccw_device; /* S/390 ccw device */
  342. struct zfcp_qdio *qdio;
  343. u32 hydra_version; /* Hydra version */
  344. u32 fsf_lic_version;
  345. u32 adapter_features; /* FCP channel features */
  346. u32 connection_features; /* host connection features */
  347. u32 hardware_version; /* of FCP channel */
  348. u16 timer_ticks; /* time int for a tick */
  349. struct Scsi_Host *scsi_host; /* Pointer to mid-layer */
  350. struct list_head port_list; /* remote port list */
  351. rwlock_t port_list_lock; /* port list lock */
  352. unsigned long req_no; /* unique FSF req number */
  353. struct list_head *req_list; /* list of pending reqs */
  354. spinlock_t req_list_lock; /* request list lock */
  355. u32 fsf_req_seq_no; /* FSF cmnd seq number */
  356. rwlock_t abort_lock; /* Protects against SCSI
  357. stack abort/command
  358. completion races */
  359. atomic_t stat_miss; /* # missing status reads*/
  360. struct work_struct stat_work;
  361. atomic_t status; /* status of this adapter */
  362. struct list_head erp_ready_head; /* error recovery for this
  363. adapter/devices */
  364. wait_queue_head_t erp_ready_wq;
  365. struct list_head erp_running_head;
  366. rwlock_t erp_lock;
  367. wait_queue_head_t erp_done_wqh;
  368. struct zfcp_erp_action erp_action; /* pending error recovery */
  369. atomic_t erp_counter;
  370. u32 erp_total_count; /* total nr of enqueued erp
  371. actions */
  372. u32 erp_low_mem_count; /* nr of erp actions waiting
  373. for memory */
  374. struct task_struct *erp_thread;
  375. struct zfcp_wka_ports *gs; /* generic services */
  376. struct zfcp_dbf *dbf; /* debug traces */
  377. struct zfcp_adapter_mempool pool; /* Adapter memory pools */
  378. struct fc_host_statistics *fc_stats;
  379. struct fsf_qtcb_bottom_port *stats_reset_data;
  380. unsigned long stats_reset;
  381. struct work_struct scan_work;
  382. struct service_level service_level;
  383. struct workqueue_struct *work_queue;
  384. };
  385. struct zfcp_port {
  386. struct device sysfs_device; /* sysfs device */
  387. struct fc_rport *rport; /* rport of fc transport class */
  388. struct list_head list; /* list of remote ports */
  389. struct zfcp_adapter *adapter; /* adapter used to access port */
  390. struct list_head unit_list; /* head of logical unit list */
  391. rwlock_t unit_list_lock; /* unit list lock */
  392. atomic_t status; /* status of this remote port */
  393. u64 wwnn; /* WWNN if known */
  394. u64 wwpn; /* WWPN */
  395. u32 d_id; /* D_ID */
  396. u32 handle; /* handle assigned by FSF */
  397. struct zfcp_erp_action erp_action; /* pending error recovery */
  398. atomic_t erp_counter;
  399. u32 maxframe_size;
  400. u32 supported_classes;
  401. struct work_struct gid_pn_work;
  402. struct work_struct test_link_work;
  403. struct work_struct rport_work;
  404. enum { RPORT_NONE, RPORT_ADD, RPORT_DEL } rport_task;
  405. };
  406. struct zfcp_unit {
  407. struct device sysfs_device; /* sysfs device */
  408. struct list_head list; /* list of logical units */
  409. struct zfcp_port *port; /* remote port of unit */
  410. atomic_t status; /* status of this logical unit */
  411. u64 fcp_lun; /* own FCP_LUN */
  412. u32 handle; /* handle assigned by FSF */
  413. struct scsi_device *device; /* scsi device struct pointer */
  414. struct zfcp_erp_action erp_action; /* pending error recovery */
  415. atomic_t erp_counter;
  416. struct zfcp_latencies latencies;
  417. struct work_struct scsi_work;
  418. };
  419. /**
  420. * struct zfcp_queue_req - queue related values for a request
  421. * @sbal_number: number of free SBALs
  422. * @sbal_first: first SBAL for this request
  423. * @sbal_last: last SBAL for this request
  424. * @sbal_limit: last possible SBAL for this request
  425. * @sbale_curr: current SBALE at creation of this request
  426. * @sbal_response: SBAL used in interrupt
  427. * @qdio_outb_usage: usage of outbound queue
  428. * @qdio_inb_usage: usage of inbound queue
  429. */
  430. struct zfcp_queue_req {
  431. u8 sbal_number;
  432. u8 sbal_first;
  433. u8 sbal_last;
  434. u8 sbal_limit;
  435. u8 sbale_curr;
  436. u8 sbal_response;
  437. u16 qdio_outb_usage;
  438. u16 qdio_inb_usage;
  439. };
  440. /**
  441. * struct zfcp_fsf_req - basic FSF request structure
  442. * @list: list of FSF requests
  443. * @req_id: unique request ID
  444. * @adapter: adapter this request belongs to
  445. * @queue_req: queue related values
  446. * @completion: used to signal the completion of the request
  447. * @status: status of the request
  448. * @fsf_command: FSF command issued
  449. * @qtcb: associated QTCB
  450. * @seq_no: sequence number of this request
  451. * @data: private data
  452. * @timer: timer data of this request
  453. * @erp_action: reference to erp action if request issued on behalf of ERP
  454. * @pool: reference to memory pool if used for this request
  455. * @issued: time when request was send (STCK)
  456. * @unit: reference to unit if this request is a SCSI request
  457. * @handler: handler which should be called to process response
  458. */
  459. struct zfcp_fsf_req {
  460. struct list_head list;
  461. unsigned long req_id;
  462. struct zfcp_adapter *adapter;
  463. struct zfcp_queue_req queue_req;
  464. struct completion completion;
  465. u32 status;
  466. u32 fsf_command;
  467. struct fsf_qtcb *qtcb;
  468. u32 seq_no;
  469. void *data;
  470. struct timer_list timer;
  471. struct zfcp_erp_action *erp_action;
  472. mempool_t *pool;
  473. unsigned long long issued;
  474. struct zfcp_unit *unit;
  475. void (*handler)(struct zfcp_fsf_req *);
  476. };
  477. /* driver data */
  478. struct zfcp_data {
  479. struct scsi_host_template scsi_host_template;
  480. struct scsi_transport_template *scsi_transport_template;
  481. struct kmem_cache *gpn_ft_cache;
  482. struct kmem_cache *qtcb_cache;
  483. struct kmem_cache *sr_buffer_cache;
  484. struct kmem_cache *gid_pn_cache;
  485. };
  486. /********************** ZFCP SPECIFIC DEFINES ********************************/
  487. #define ZFCP_SET 0x00000100
  488. #define ZFCP_CLEAR 0x00000200
  489. /*
  490. * Helper functions for request ID management.
  491. */
  492. static inline int zfcp_reqlist_hash(unsigned long req_id)
  493. {
  494. return req_id % REQUEST_LIST_SIZE;
  495. }
  496. static inline void zfcp_reqlist_remove(struct zfcp_adapter *adapter,
  497. struct zfcp_fsf_req *fsf_req)
  498. {
  499. list_del(&fsf_req->list);
  500. }
  501. static inline struct zfcp_fsf_req *
  502. zfcp_reqlist_find(struct zfcp_adapter *adapter, unsigned long req_id)
  503. {
  504. struct zfcp_fsf_req *request;
  505. unsigned int idx;
  506. idx = zfcp_reqlist_hash(req_id);
  507. list_for_each_entry(request, &adapter->req_list[idx], list)
  508. if (request->req_id == req_id)
  509. return request;
  510. return NULL;
  511. }
  512. static inline struct zfcp_fsf_req *
  513. zfcp_reqlist_find_safe(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req)
  514. {
  515. struct zfcp_fsf_req *request;
  516. unsigned int idx;
  517. for (idx = 0; idx < REQUEST_LIST_SIZE; idx++) {
  518. list_for_each_entry(request, &adapter->req_list[idx], list)
  519. if (request == req)
  520. return request;
  521. }
  522. return NULL;
  523. }
  524. #endif /* ZFCP_DEF_H */