xref: /openbmc/linux/drivers/s390/scsi/zfcp_def.h (revision a17c7846)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
21da177e4SLinus Torvalds /*
3553448f6SChristof Schmitt  * zfcp device driver
41da177e4SLinus Torvalds  *
5553448f6SChristof Schmitt  * Global definitions for the zfcp device driver.
61da177e4SLinus Torvalds  *
7a17c7846SJens Remus  * Copyright IBM Corp. 2002, 2020
81da177e4SLinus Torvalds  */
91da177e4SLinus Torvalds 
101da177e4SLinus Torvalds #ifndef ZFCP_DEF_H
111da177e4SLinus Torvalds #define ZFCP_DEF_H
121da177e4SLinus Torvalds 
131da177e4SLinus Torvalds /*************************** INCLUDES *****************************************/
141da177e4SLinus Torvalds 
151da177e4SLinus Torvalds #include <linux/init.h>
161da177e4SLinus Torvalds #include <linux/moduleparam.h>
171da177e4SLinus Torvalds #include <linux/major.h>
181da177e4SLinus Torvalds #include <linux/blkdev.h>
191da177e4SLinus Torvalds #include <linux/delay.h>
201da177e4SLinus Torvalds #include <linux/timer.h>
21dd52e0eaSHeiko Carstens #include <linux/slab.h>
22dd52e0eaSHeiko Carstens #include <linux/mempool.h>
23dd52e0eaSHeiko Carstens #include <linux/syscalls.h>
24f1346372SFUJITA Tomonori #include <linux/scatterlist.h>
25dd52e0eaSHeiko Carstens #include <linux/ioctl.h>
269d544f2bSSven Schuetz #include <scsi/fc/fc_fs.h>
279d544f2bSSven Schuetz #include <scsi/fc/fc_gs.h>
281da177e4SLinus Torvalds #include <scsi/scsi.h>
291da177e4SLinus Torvalds #include <scsi/scsi_tcq.h>
301da177e4SLinus Torvalds #include <scsi/scsi_cmnd.h>
311da177e4SLinus Torvalds #include <scsi/scsi_device.h>
321da177e4SLinus Torvalds #include <scsi/scsi_host.h>
331da177e4SLinus Torvalds #include <scsi/scsi_transport.h>
341da177e4SLinus Torvalds #include <scsi/scsi_transport_fc.h>
359d544f2bSSven Schuetz #include <scsi/scsi_bsg_fc.h>
361da177e4SLinus Torvalds #include <asm/ccwdev.h>
371da177e4SLinus Torvalds #include <asm/debug.h>
381da177e4SLinus Torvalds #include <asm/ebcdic.h>
39bd43a42bSChristof Schmitt #include <asm/sysinfo.h>
40dd52e0eaSHeiko Carstens #include "zfcp_fsf.h"
412d1e547fSSven Schuetz #include "zfcp_fc.h"
4234c2b712SChristof Schmitt #include "zfcp_qdio.h"
431da177e4SLinus Torvalds 
441da177e4SLinus Torvalds /********************* FSF SPECIFIC DEFINES *********************************/
451da177e4SLinus Torvalds 
461da177e4SLinus Torvalds /* ATTENTION: value must not be used by hardware */
471da177e4SLinus Torvalds #define FSF_QTCB_UNSOLICITED_STATUS		0x6305
4822753fa5SAndreas Herrmann 
491da177e4SLinus Torvalds /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
501da177e4SLinus Torvalds 
511da177e4SLinus Torvalds /*
52e0c1da39SSteffen Maier  * Note, the leftmost 12 status bits (3 nibbles) are common among adapter, port
53e0c1da39SSteffen Maier  * and unit. This is a mask for bitwise 'and' with status values.
541da177e4SLinus Torvalds  */
551da177e4SLinus Torvalds #define ZFCP_COMMON_FLAGS			0xfff00000
561da177e4SLinus Torvalds 
571da177e4SLinus Torvalds /* common status bits */
581da177e4SLinus Torvalds #define ZFCP_STATUS_COMMON_RUNNING		0x40000000
591da177e4SLinus Torvalds #define ZFCP_STATUS_COMMON_ERP_FAILED		0x20000000
601da177e4SLinus Torvalds #define ZFCP_STATUS_COMMON_UNBLOCKED		0x10000000
611da177e4SLinus Torvalds #define ZFCP_STATUS_COMMON_OPEN                 0x04000000
621da177e4SLinus Torvalds #define ZFCP_STATUS_COMMON_ERP_INUSE		0x01000000
631da177e4SLinus Torvalds #define ZFCP_STATUS_COMMON_ACCESS_DENIED	0x00800000
64d736a27bSAndreas Herrmann #define ZFCP_STATUS_COMMON_ACCESS_BOXED		0x00400000
65cc8c2829SSwen Schillig #define ZFCP_STATUS_COMMON_NOESC		0x00200000
661da177e4SLinus Torvalds 
671da177e4SLinus Torvalds /* adapter status */
6886a9668aSSwen Schillig #define ZFCP_STATUS_ADAPTER_MB_ACT		0x00000001
691da177e4SLinus Torvalds #define ZFCP_STATUS_ADAPTER_QDIOUP		0x00000002
70339f4f4eSChristof Schmitt #define ZFCP_STATUS_ADAPTER_SIOSL_ISSUED	0x00000004
711da177e4SLinus Torvalds #define ZFCP_STATUS_ADAPTER_XCONFIG_OK		0x00000008
721da177e4SLinus Torvalds #define ZFCP_STATUS_ADAPTER_HOST_CON_INIT	0x00000010
73cb452149SSteffen Maier #define ZFCP_STATUS_ADAPTER_SUSPENDED		0x00000040
741da177e4SLinus Torvalds #define ZFCP_STATUS_ADAPTER_ERP_PENDING		0x00000100
751da177e4SLinus Torvalds #define ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED	0x00000200
76dcc18f48SChristof Schmitt #define ZFCP_STATUS_ADAPTER_DATA_DIV_ENABLED	0x00000400
771da177e4SLinus Torvalds 
781da177e4SLinus Torvalds /* remote port status */
791da177e4SLinus Torvalds #define ZFCP_STATUS_PORT_PHYS_OPEN		0x00000001
8014e242eaSChristof Schmitt #define ZFCP_STATUS_PORT_LINK_TEST		0x00000002
811da177e4SLinus Torvalds 
821da177e4SLinus Torvalds /* FSF request status (this does not have a common part) */
831da177e4SLinus Torvalds #define ZFCP_STATUS_FSFREQ_ERROR		0x00000008
841da177e4SLinus Torvalds #define ZFCP_STATUS_FSFREQ_CLEANUP		0x00000010
851da177e4SLinus Torvalds #define ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED	0x00000040
861da177e4SLinus Torvalds #define ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED       0x00000080
871da177e4SLinus Torvalds #define ZFCP_STATUS_FSFREQ_TMFUNCFAILED         0x00000200
881da177e4SLinus Torvalds #define ZFCP_STATUS_FSFREQ_DISMISSED            0x00001000
8992953c6eSBenjamin Block #define ZFCP_STATUS_FSFREQ_XDATAINCOMPLETE	0x00020000
901da177e4SLinus Torvalds 
911da177e4SLinus Torvalds /************************* STRUCTURE DEFINITIONS *****************************/
921da177e4SLinus Torvalds 
93df91eefdSSteffen Maier /**
94df91eefdSSteffen Maier  * enum zfcp_erp_act_type - Type of ERP action object.
95df91eefdSSteffen Maier  * @ZFCP_ERP_ACTION_REOPEN_LUN: LUN recovery.
96df91eefdSSteffen Maier  * @ZFCP_ERP_ACTION_REOPEN_PORT: Port recovery.
97df91eefdSSteffen Maier  * @ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: Forced port recovery.
98df91eefdSSteffen Maier  * @ZFCP_ERP_ACTION_REOPEN_ADAPTER: Adapter recovery.
99df91eefdSSteffen Maier  *
100df91eefdSSteffen Maier  * Values must fit into u8 because of code dependencies:
101df91eefdSSteffen Maier  * zfcp_dbf_rec_trig(), &zfcp_dbf_rec_trigger.want, &zfcp_dbf_rec_trigger.need;
102df91eefdSSteffen Maier  * zfcp_dbf_rec_run_lvl(), zfcp_dbf_rec_run(), &zfcp_dbf_rec_running.rec_action.
103df91eefdSSteffen Maier  */
104df91eefdSSteffen Maier enum zfcp_erp_act_type {
105df91eefdSSteffen Maier 	ZFCP_ERP_ACTION_REOPEN_LUN	   = 1,
106df91eefdSSteffen Maier 	ZFCP_ERP_ACTION_REOPEN_PORT	   = 2,
107df91eefdSSteffen Maier 	ZFCP_ERP_ACTION_REOPEN_PORT_FORCED = 3,
108df91eefdSSteffen Maier 	ZFCP_ERP_ACTION_REOPEN_ADAPTER	   = 4,
109df91eefdSSteffen Maier };
110df91eefdSSteffen Maier 
1110023beecSSteffen Maier /*
1120023beecSSteffen Maier  * Values must fit into u16 because of code dependencies:
1130023beecSSteffen Maier  * zfcp_dbf_rec_run_lvl(), zfcp_dbf_rec_run(), zfcp_dbf_rec_run_wka(),
1140023beecSSteffen Maier  * &zfcp_dbf_rec_running.rec_step.
1150023beecSSteffen Maier  */
1160023beecSSteffen Maier enum zfcp_erp_steps {
1170023beecSSteffen Maier 	ZFCP_ERP_STEP_UNINITIALIZED	= 0x0000,
1180023beecSSteffen Maier 	ZFCP_ERP_STEP_PHYS_PORT_CLOSING	= 0x0010,
1190023beecSSteffen Maier 	ZFCP_ERP_STEP_PORT_CLOSING	= 0x0100,
1200023beecSSteffen Maier 	ZFCP_ERP_STEP_PORT_OPENING	= 0x0800,
1210023beecSSteffen Maier 	ZFCP_ERP_STEP_LUN_CLOSING	= 0x1000,
1220023beecSSteffen Maier 	ZFCP_ERP_STEP_LUN_OPENING	= 0x2000,
1230023beecSSteffen Maier };
1240023beecSSteffen Maier 
1251da177e4SLinus Torvalds struct zfcp_erp_action {
1261da177e4SLinus Torvalds 	struct list_head list;
127df91eefdSSteffen Maier 	enum zfcp_erp_act_type type;  /* requested action code */
1281da177e4SLinus Torvalds 	struct zfcp_adapter *adapter; /* device which should be recovered */
1291da177e4SLinus Torvalds 	struct zfcp_port *port;
130b62a8d9bSChristof Schmitt 	struct scsi_device *sdev;
13144cc76f2SSwen Schillig 	u32		status;	      /* recovery status */
1320023beecSSteffen Maier 	enum zfcp_erp_steps	step;	/* active step of this erp action */
133e60a6d69SChristof Schmitt 	unsigned long		fsf_req_id;
1341da177e4SLinus Torvalds 	struct timer_list timer;
1351da177e4SLinus Torvalds };
1361da177e4SLinus Torvalds 
13721cb0bccSSteffen Maier /* holds various memory pools of an adapter */
13821cb0bccSSteffen Maier struct zfcp_adapter_mempool {
13921cb0bccSSteffen Maier 	mempool_t *erp_req;
14021cb0bccSSteffen Maier 	mempool_t *gid_pn_req;
14121cb0bccSSteffen Maier 	mempool_t *scsi_req;
14221cb0bccSSteffen Maier 	mempool_t *scsi_abort;
14321cb0bccSSteffen Maier 	mempool_t *status_read_req;
14421cb0bccSSteffen Maier 	mempool_t *sr_data;
14521cb0bccSSteffen Maier 	mempool_t *gid_pn;
14621cb0bccSSteffen Maier 	mempool_t *qtcb_pool;
147c9615858SChristof Schmitt };
1481da177e4SLinus Torvalds 
1491da177e4SLinus Torvalds struct zfcp_adapter {
150f3450c7bSSwen Schillig 	struct kref		ref;
1517ba58c9cSSwen Schillig 	u64			peer_wwnn;	   /* P2P peer WWNN */
1527ba58c9cSSwen Schillig 	u64			peer_wwpn;	   /* P2P peer WWPN */
15313e1e1f0SAndreas Herrmann 	u32			peer_d_id;	   /* P2P peer D_ID */
1541da177e4SLinus Torvalds 	struct ccw_device       *ccw_device;	   /* S/390 ccw device */
155564e1c86SSwen Schillig 	struct zfcp_qdio	*qdio;
1561da177e4SLinus Torvalds 	u32			hydra_version;	   /* Hydra version */
1571da177e4SLinus Torvalds 	u32			fsf_lic_version;
158aef4a983SMaxim Shchetynin 	u32			adapter_features;  /* FCP channel features */
159aef4a983SMaxim Shchetynin 	u32			connection_features; /* host connection features */
1601da177e4SLinus Torvalds         u32			hardware_version;  /* of FCP channel */
161a17c7846SJens Remus 	u32			fc_security_algorithms; /* of FCP channel */
162c9615858SChristof Schmitt 	u16			timer_ticks;       /* time int for a tick */
1631da177e4SLinus Torvalds 	struct Scsi_Host	*scsi_host;	   /* Pointer to mid-layer */
164ecf0c772SSwen Schillig 	struct list_head	port_list;	   /* remote port list */
165ecf0c772SSwen Schillig 	rwlock_t		port_list_lock;    /* port list lock */
166fea9d6c7SVolker Sameske 	unsigned long		req_no;		   /* unique FSF req number */
167b6bd2fb9SChristof Schmitt 	struct zfcp_reqlist	*req_list;
1681da177e4SLinus Torvalds 	u32			fsf_req_seq_no;	   /* FSF cmnd seq number */
1691da177e4SLinus Torvalds 	rwlock_t		abort_lock;        /* Protects against SCSI
1701da177e4SLinus Torvalds 						      stack abort/command
1711da177e4SLinus Torvalds 						      completion races */
172d26ab06eSSwen Schillig 	atomic_t		stat_miss;	   /* # missing status reads*/
17364deb6efSChristof Schmitt 	unsigned int		stat_read_buf_num;
174d26ab06eSSwen Schillig 	struct work_struct	stat_work;
1751da177e4SLinus Torvalds 	atomic_t		status;	           /* status of this adapter */
1761da177e4SLinus Torvalds 	struct list_head	erp_ready_head;	   /* error recovery for this
1771da177e4SLinus Torvalds 						      adapter/devices */
178347c6a96SChristof Schmitt 	wait_queue_head_t	erp_ready_wq;
1791da177e4SLinus Torvalds 	struct list_head	erp_running_head;
1801da177e4SLinus Torvalds 	rwlock_t		erp_lock;
1811da177e4SLinus Torvalds 	wait_queue_head_t	erp_done_wqh;
1821da177e4SLinus Torvalds 	struct zfcp_erp_action	erp_action;	   /* pending error recovery */
1831da177e4SLinus Torvalds         atomic_t                erp_counter;
1841da177e4SLinus Torvalds 	u32			erp_total_count;   /* total nr of enqueued erp
1851da177e4SLinus Torvalds 						      actions */
1861da177e4SLinus Torvalds 	u32			erp_low_mem_count; /* nr of erp actions waiting
1871da177e4SLinus Torvalds 						      for memory */
188347c6a96SChristof Schmitt 	struct task_struct	*erp_thread;
189bd0072ecSChristof Schmitt 	struct zfcp_fc_wka_ports *gs;		   /* generic services */
190d46f384aSChristof Schmitt 	struct zfcp_dbf		*dbf;		   /* debug traces */
1911da177e4SLinus Torvalds 	struct zfcp_adapter_mempool	pool;      /* Adapter memory pools */
192f6cd94b1SAndreas Herrmann 	struct fc_host_statistics *fc_stats;
193f6cd94b1SAndreas Herrmann 	struct fsf_qtcb_bottom_port *stats_reset_data;
194f6cd94b1SAndreas Herrmann 	unsigned long		stats_reset;
19518f87a67SMartin Peschke 	struct delayed_work	scan_work;
196038d9446SChristof Schmitt 	struct work_struct	ns_up_work;
197bd43a42bSChristof Schmitt 	struct service_level	service_level;
1984544683aSSwen Schillig 	struct workqueue_struct	*work_queue;
19968322984SChristof Schmitt 	struct device_dma_parameters dma_parms;
2002d1e547fSSven Schuetz 	struct zfcp_fc_events events;
20118f87a67SMartin Peschke 	unsigned long		next_port_scan;
2027e418833SBenjamin Block 	struct zfcp_diag_adapter	*diagnostics;
2031da177e4SLinus Torvalds };
2041da177e4SLinus Torvalds 
2051da177e4SLinus Torvalds struct zfcp_port {
206615f59e0SChristof Schmitt 	struct device          dev;
2073859f6a2SAndreas Herrmann 	struct fc_rport        *rport;         /* rport of fc transport class */
2081da177e4SLinus Torvalds 	struct list_head       list;	       /* list of remote ports */
2091da177e4SLinus Torvalds 	struct zfcp_adapter    *adapter;       /* adapter used to access port */
210ecf0c772SSwen Schillig 	struct list_head	unit_list;	/* head of logical unit list */
211ecf0c772SSwen Schillig 	rwlock_t		unit_list_lock; /* unit list lock */
212d99b601bSSteffen Maier 	atomic_t		units;	       /* zfcp_unit count */
2131da177e4SLinus Torvalds 	atomic_t	       status;	       /* status of this remote port */
2147ba58c9cSSwen Schillig 	u64		       wwnn;	       /* WWNN if known */
2157ba58c9cSSwen Schillig 	u64		       wwpn;	       /* WWPN */
21613e1e1f0SAndreas Herrmann 	u32		       d_id;	       /* D_ID */
2171da177e4SLinus Torvalds 	u32		       handle;	       /* handle assigned by FSF */
2181da177e4SLinus Torvalds 	struct zfcp_erp_action erp_action;     /* pending error recovery */
2191da177e4SLinus Torvalds         atomic_t               erp_counter;
22075bfc283SRalph Wuerthner 	u32                    maxframe_size;
22175bfc283SRalph Wuerthner 	u32                    supported_classes;
222a17c7846SJens Remus 	u32                    connection_info;
2235ab944f9SSwen Schillig 	struct work_struct     gid_pn_work;
2248fdf30d5SChristof Schmitt 	struct work_struct     test_link_work;
225a2fa0aedSChristof Schmitt 	struct work_struct     rport_work;
226a2fa0aedSChristof Schmitt 	enum { RPORT_NONE, RPORT_ADD, RPORT_DEL }  rport_task;
2271bf3ff02SChristof Schmitt 	unsigned int		starget_id;
2281da177e4SLinus Torvalds };
2291da177e4SLinus Torvalds 
23021cb0bccSSteffen Maier struct zfcp_latency_record {
23121cb0bccSSteffen Maier 	u32 min;
23221cb0bccSSteffen Maier 	u32 max;
23321cb0bccSSteffen Maier 	u64 sum;
23421cb0bccSSteffen Maier };
23521cb0bccSSteffen Maier 
23621cb0bccSSteffen Maier struct zfcp_latency_cont {
23721cb0bccSSteffen Maier 	struct zfcp_latency_record channel;
23821cb0bccSSteffen Maier 	struct zfcp_latency_record fabric;
23921cb0bccSSteffen Maier 	u64 counter;
24021cb0bccSSteffen Maier };
24121cb0bccSSteffen Maier 
24221cb0bccSSteffen Maier struct zfcp_latencies {
24321cb0bccSSteffen Maier 	struct zfcp_latency_cont read;
24421cb0bccSSteffen Maier 	struct zfcp_latency_cont write;
24521cb0bccSSteffen Maier 	struct zfcp_latency_cont cmd;
24621cb0bccSSteffen Maier 	spinlock_t lock;
24721cb0bccSSteffen Maier };
24821cb0bccSSteffen Maier 
249b62a8d9bSChristof Schmitt /**
250b62a8d9bSChristof Schmitt  * struct zfcp_unit - LUN configured via zfcp sysfs
251b62a8d9bSChristof Schmitt  * @dev: struct device for sysfs representation and reference counting
252b62a8d9bSChristof Schmitt  * @list: entry in LUN/unit list per zfcp_port
253b62a8d9bSChristof Schmitt  * @port: reference to zfcp_port where this LUN is configured
254b62a8d9bSChristof Schmitt  * @fcp_lun: 64 bit LUN value
255b62a8d9bSChristof Schmitt  * @scsi_work: for running scsi_scan_target
256b62a8d9bSChristof Schmitt  *
257b62a8d9bSChristof Schmitt  * This is the representation of a LUN that has been configured for
258b62a8d9bSChristof Schmitt  * usage. The main data here is the 64 bit LUN value, data for
259b62a8d9bSChristof Schmitt  * running I/O and recovery is in struct zfcp_scsi_dev.
260b62a8d9bSChristof Schmitt  */
2611da177e4SLinus Torvalds struct zfcp_unit {
262615f59e0SChristof Schmitt 	struct device		dev;
263b62a8d9bSChristof Schmitt 	struct list_head	list;
264b62a8d9bSChristof Schmitt 	struct zfcp_port	*port;
265b62a8d9bSChristof Schmitt 	u64			fcp_lun;
26692d5193bSSwen Schillig 	struct work_struct	scsi_work;
2671da177e4SLinus Torvalds };
2681da177e4SLinus Torvalds 
26942428f74SSwen Schillig /**
27057c23773SChristof Schmitt  * struct zfcp_scsi_dev - zfcp data per SCSI device
27157c23773SChristof Schmitt  * @status: zfcp internal status flags
27257c23773SChristof Schmitt  * @lun_handle: handle from "open lun" for issuing FSF requests
27357c23773SChristof Schmitt  * @erp_action: zfcp erp data for opening and recovering this LUN
27457c23773SChristof Schmitt  * @erp_counter: zfcp erp counter for this LUN
27557c23773SChristof Schmitt  * @latencies: FSF channel and fabric latencies
27657c23773SChristof Schmitt  * @port: zfcp_port where this LUN belongs to
27757c23773SChristof Schmitt  */
27857c23773SChristof Schmitt struct zfcp_scsi_dev {
27957c23773SChristof Schmitt 	atomic_t		status;
28057c23773SChristof Schmitt 	u32			lun_handle;
28157c23773SChristof Schmitt 	struct zfcp_erp_action	erp_action;
28257c23773SChristof Schmitt 	atomic_t		erp_counter;
28357c23773SChristof Schmitt 	struct zfcp_latencies	latencies;
28457c23773SChristof Schmitt 	struct zfcp_port	*port;
28557c23773SChristof Schmitt };
28657c23773SChristof Schmitt 
28757c23773SChristof Schmitt /**
28857c23773SChristof Schmitt  * sdev_to_zfcp - Access zfcp LUN data for SCSI device
28957c23773SChristof Schmitt  * @sdev: scsi_device where to get the zfcp_scsi_dev pointer
29057c23773SChristof Schmitt  */
29157c23773SChristof Schmitt static inline struct zfcp_scsi_dev *sdev_to_zfcp(struct scsi_device *sdev)
29257c23773SChristof Schmitt {
29357c23773SChristof Schmitt 	return scsi_transport_device_data(sdev);
29457c23773SChristof Schmitt }
29557c23773SChristof Schmitt 
29657c23773SChristof Schmitt /**
29757c23773SChristof Schmitt  * zfcp_scsi_dev_lun - Return SCSI device LUN as 64 bit FCP LUN
29857c23773SChristof Schmitt  * @sdev: SCSI device where to get the LUN from
29957c23773SChristof Schmitt  */
30057c23773SChristof Schmitt static inline u64 zfcp_scsi_dev_lun(struct scsi_device *sdev)
30157c23773SChristof Schmitt {
30257c23773SChristof Schmitt 	u64 fcp_lun;
30357c23773SChristof Schmitt 
30457c23773SChristof Schmitt 	int_to_scsilun(sdev->lun, (struct scsi_lun *)&fcp_lun);
30557c23773SChristof Schmitt 	return fcp_lun;
30657c23773SChristof Schmitt }
30757c23773SChristof Schmitt 
30857c23773SChristof Schmitt /**
30942428f74SSwen Schillig  * struct zfcp_fsf_req - basic FSF request structure
31042428f74SSwen Schillig  * @list: list of FSF requests
31142428f74SSwen Schillig  * @req_id: unique request ID
31242428f74SSwen Schillig  * @adapter: adapter this request belongs to
31334c2b712SChristof Schmitt  * @qdio_req: qdio queue related values
31442428f74SSwen Schillig  * @completion: used to signal the completion of the request
31542428f74SSwen Schillig  * @status: status of the request
31642428f74SSwen Schillig  * @qtcb: associated QTCB
31742428f74SSwen Schillig  * @data: private data
31842428f74SSwen Schillig  * @timer: timer data of this request
31942428f74SSwen Schillig  * @erp_action: reference to erp action if request issued on behalf of ERP
32042428f74SSwen Schillig  * @pool: reference to memory pool if used for this request
32142428f74SSwen Schillig  * @issued: time when request was send (STCK)
32242428f74SSwen Schillig  * @handler: handler which should be called to process response
32342428f74SSwen Schillig  */
3241da177e4SLinus Torvalds struct zfcp_fsf_req {
32542428f74SSwen Schillig 	struct list_head	list;
32642428f74SSwen Schillig 	unsigned long		req_id;
32742428f74SSwen Schillig 	struct zfcp_adapter	*adapter;
32834c2b712SChristof Schmitt 	struct zfcp_qdio_req	qdio_req;
32942428f74SSwen Schillig 	struct completion	completion;
33042428f74SSwen Schillig 	u32			status;
33142428f74SSwen Schillig 	struct fsf_qtcb		*qtcb;
33242428f74SSwen Schillig 	void			*data;
33342428f74SSwen Schillig 	struct timer_list	timer;
33442428f74SSwen Schillig 	struct zfcp_erp_action	*erp_action;
33542428f74SSwen Schillig 	mempool_t		*pool;
33642428f74SSwen Schillig 	unsigned long long	issued;
337c41f8cbdSSwen Schillig 	void			(*handler)(struct zfcp_fsf_req *);
3381da177e4SLinus Torvalds };
3391da177e4SLinus Torvalds 
34086a9668aSSwen Schillig static inline
34186a9668aSSwen Schillig int zfcp_adapter_multi_buffer_active(struct zfcp_adapter *adapter)
34286a9668aSSwen Schillig {
34386a9668aSSwen Schillig 	return atomic_read(&adapter->status) & ZFCP_STATUS_ADAPTER_MB_ACT;
34486a9668aSSwen Schillig }
34586a9668aSSwen Schillig 
346f9eca022SSteffen Maier static inline bool zfcp_fsf_req_is_status_read_buffer(struct zfcp_fsf_req *req)
347f9eca022SSteffen Maier {
348f9eca022SSteffen Maier 	return req->qtcb == NULL;
349f9eca022SSteffen Maier }
350f9eca022SSteffen Maier 
3511da177e4SLinus Torvalds #endif /* ZFCP_DEF_H */
352