📄 zfcp_def.h
字号:
struct ct_hdr header; wwn_t wwpn;} __attribute__ ((packed));/* FS_ACC IU and data unit for GID_PN nameserver request */struct ct_iu_gid_pn_resp { struct ct_hdr header; u32 d_id;} __attribute__ ((packed));typedef void (*zfcp_send_ct_handler_t)(unsigned long);/** * struct zfcp_send_ct - used to pass parameters to function zfcp_fsf_send_ct * @port: port where the request is sent to * @req: scatter-gather list for request * @resp: scatter-gather list for response * @req_count: number of elements in request scatter-gather list * @resp_count: number of elements in response scatter-gather list * @handler: handler function (called for response to the request) * @handler_data: data passed to handler function * @pool: pointer to memory pool for ct request structure * @timeout: FSF timeout for this request * @timer: timer (e.g. for request initiated by erp) * @completion: completion for synchronization purposes * @status: used to pass error status to calling function */struct zfcp_send_ct { struct zfcp_port *port; struct scatterlist *req; struct scatterlist *resp; unsigned int req_count; unsigned int resp_count; zfcp_send_ct_handler_t handler; unsigned long handler_data; mempool_t *pool; int timeout; struct timer_list *timer; struct completion *completion; int status;};/* used for name server requests in error recovery */struct zfcp_gid_pn_data { struct zfcp_send_ct ct; struct scatterlist req; struct scatterlist resp; struct ct_iu_gid_pn_req ct_iu_req; struct ct_iu_gid_pn_resp ct_iu_resp; struct zfcp_port *port;};typedef void (*zfcp_send_els_handler_t)(unsigned long);/** * struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els * @adapter: adapter where request is sent from * @port: port where ELS is destinated (port reference count has to be increased) * @d_id: destiniation id of port where request is sent to * @req: scatter-gather list for request * @resp: scatter-gather list for response * @req_count: number of elements in request scatter-gather list * @resp_count: number of elements in response scatter-gather list * @handler: handler function (called for response to the request) * @handler_data: data passed to handler function * @timer: timer (e.g. for request initiated by erp) * @completion: completion for synchronization purposes * @ls_code: hex code of ELS command * @status: used to pass error status to calling function */struct zfcp_send_els { struct zfcp_adapter *adapter; struct zfcp_port *port; u32 d_id; struct scatterlist *req; struct scatterlist *resp; unsigned int req_count; unsigned int resp_count; zfcp_send_els_handler_t handler; unsigned long handler_data; struct timer_list *timer; struct completion *completion; int ls_code; int status;};struct zfcp_qdio_queue { struct qdio_buffer *buffer[QDIO_MAX_BUFFERS_PER_Q]; /* SBALs */ u8 free_index; /* index of next free bfr in queue (free_count>0) */ atomic_t free_count; /* number of free buffers in queue */ rwlock_t queue_lock; /* lock for operations on queue */ int distance_from_int; /* SBALs used since PCI indication was last set */};struct zfcp_erp_action { struct list_head list; int action; /* requested action code */ struct zfcp_adapter *adapter; /* device which should be recovered */ struct zfcp_port *port; struct zfcp_unit *unit; volatile u32 status; /* recovery status */ u32 step; /* active step of this erp action */ struct zfcp_fsf_req *fsf_req; /* fsf request currently pending for this action */ struct timer_list timer;};struct zfcp_adapter { struct list_head list; /* list of adapters */ atomic_t refcount; /* reference count */ wait_queue_head_t remove_wq; /* can be used to wait for refcount drop to zero */ wwn_t peer_wwnn; /* P2P peer WWNN */ wwn_t peer_wwpn; /* P2P peer WWPN */ u32 peer_d_id; /* P2P peer D_ID */ wwn_t physical_wwpn; /* WWPN of physical port */ u32 physical_s_id; /* local FC port ID */ struct ccw_device *ccw_device; /* S/390 ccw device */ u8 fc_service_class; u32 fc_topology; /* FC topology */ u32 hydra_version; /* Hydra version */ u32 fsf_lic_version; u32 adapter_features; /* FCP channel features */ u32 connection_features; /* host connection features */ u32 hardware_version; /* of FCP channel */ struct Scsi_Host *scsi_host; /* Pointer to mid-layer */ unsigned short scsi_host_no; /* Assigned host number */ unsigned char name[9]; struct list_head port_list_head; /* remote port list */ struct list_head port_remove_lh; /* head of ports to be removed */ u32 ports; /* number of remote ports */ struct timer_list scsi_er_timer; /* SCSI err recovery watch */ struct list_head fsf_req_list_head; /* head of FSF req list */ spinlock_t fsf_req_list_lock; /* lock for ops on list of FSF requests */ atomic_t fsf_reqs_active; /* # active FSF reqs */ struct zfcp_qdio_queue request_queue; /* request queue */ u32 fsf_req_seq_no; /* FSF cmnd seq number */ wait_queue_head_t request_wq; /* can be used to wait for more avaliable SBALs */ struct zfcp_qdio_queue response_queue; /* response queue */ rwlock_t abort_lock; /* Protects against SCSI stack abort/command completion races */ u16 status_read_failed; /* # failed status reads */ atomic_t status; /* status of this adapter */ struct list_head erp_ready_head; /* error recovery for this adapter/devices */ struct list_head erp_running_head; rwlock_t erp_lock; struct semaphore erp_ready_sem; wait_queue_head_t erp_thread_wqh; wait_queue_head_t erp_done_wqh; struct zfcp_erp_action erp_action; /* pending error recovery */ atomic_t erp_counter; u32 erp_total_count; /* total nr of enqueued erp actions */ u32 erp_low_mem_count; /* nr of erp actions waiting for memory */ struct zfcp_port *nameserver_port; /* adapter's nameserver */ debug_info_t *erp_dbf; debug_info_t *hba_dbf; debug_info_t *san_dbf; /* debug feature areas */ debug_info_t *scsi_dbf; spinlock_t erp_dbf_lock; spinlock_t hba_dbf_lock; spinlock_t san_dbf_lock; spinlock_t scsi_dbf_lock; struct zfcp_erp_dbf_record erp_dbf_buf; struct zfcp_hba_dbf_record hba_dbf_buf; struct zfcp_san_dbf_record san_dbf_buf; struct zfcp_scsi_dbf_record scsi_dbf_buf; struct zfcp_adapter_mempool pool; /* Adapter memory pools */ struct qdio_initialize qdio_init_data; /* for qdio_establish */ struct device generic_services; /* directory for WKA ports */};/* * the struct device sysfs_device must be at the beginning of this structure. * pointer to struct device is used to free port structure in release function * of the device. don't change! */struct zfcp_port { struct device sysfs_device; /* sysfs device */ struct fc_rport *rport; /* rport of fc transport class */ struct list_head list; /* list of remote ports */ atomic_t refcount; /* reference count */ wait_queue_head_t remove_wq; /* can be used to wait for refcount drop to zero */ struct zfcp_adapter *adapter; /* adapter used to access port */ struct list_head unit_list_head; /* head of logical unit list */ struct list_head unit_remove_lh; /* head of luns to be removed list */ u32 units; /* # of logical units in list */ atomic_t status; /* status of this remote port */ wwn_t wwnn; /* WWNN if known */ wwn_t wwpn; /* WWPN */ u32 d_id; /* D_ID */ u32 handle; /* handle assigned by FSF */ struct zfcp_erp_action erp_action; /* pending error recovery */ atomic_t erp_counter;};/* the struct device sysfs_device must be at the beginning of this structure. * pointer to struct device is used to free unit structure in release function * of the device. don't change! */struct zfcp_unit { struct device sysfs_device; /* sysfs device */ struct list_head list; /* list of logical units */ atomic_t refcount; /* reference count */ wait_queue_head_t remove_wq; /* can be used to wait for refcount drop to zero */ struct zfcp_port *port; /* remote port of unit */ atomic_t status; /* status of this logical unit */ scsi_lun_t scsi_lun; /* own SCSI LUN */ fcp_lun_t fcp_lun; /* own FCP_LUN */ u32 handle; /* handle assigned by FSF */ struct scsi_device *device; /* scsi device struct pointer */ struct zfcp_erp_action erp_action; /* pending error recovery */ atomic_t erp_counter;};/* FSF request */struct zfcp_fsf_req { struct list_head list; /* list of FSF requests */ struct zfcp_adapter *adapter; /* adapter request belongs to */ u8 sbal_number; /* nr of SBALs free for use */ u8 sbal_first; /* first SBAL for this request */ u8 sbal_last; /* last possible SBAL for this reuest */ u8 sbal_curr; /* current SBAL during creation of request */ u8 sbale_curr; /* current SBALE during creation of request */ wait_queue_head_t completion_wq; /* can be used by a routine to wait for completion */ volatile u32 status; /* status of this request */ u32 fsf_command; /* FSF Command copy */ struct fsf_qtcb *qtcb; /* address of associated QTCB */ u32 seq_no; /* Sequence number of request */ unsigned long data; /* private data of request */ struct zfcp_erp_action *erp_action; /* used if this request is issued on behalf of erp */ mempool_t *pool; /* used if request was alloacted from emergency pool */ unsigned long long issued; /* request sent time (STCK) */ struct zfcp_unit *unit;};typedef void zfcp_fsf_req_handler_t(struct zfcp_fsf_req*);/* driver data */struct zfcp_data { struct scsi_host_template scsi_host_template; atomic_t status; /* Module status flags */ struct list_head adapter_list_head; /* head of adapter list */ struct list_head adapter_remove_lh; /* head of adapters to be removed */ rwlock_t status_read_lock; /* for status read thread */ struct list_head status_read_receive_head; struct list_head status_read_send_head; struct semaphore status_read_sema; wait_queue_head_t status_read_thread_wqh; u32 adapters; /* # of adapters in list */ rwlock_t config_lock; /* serialises changes to adapter/port/unit lists */ struct semaphore config_sema; /* serialises configuration changes */ atomic_t loglevel; /* current loglevel */ char init_busid[BUS_ID_SIZE]; wwn_t init_wwpn; fcp_lun_t init_fcp_lun; char *driver_version;};/** * struct zfcp_sg_list - struct describing a scatter-gather list * @sg: pointer to array of (struct scatterlist) * @count: number of elements in scatter-gather list */struct zfcp_sg_list { struct scatterlist *sg; unsigned int count;};/* number of elements for various memory pools */#define ZFCP_POOL_FSF_REQ_ERP_NR 1#define ZFCP_POOL_FSF_REQ_SCSI_NR 1#define ZFCP_POOL_FSF_REQ_ABORT_NR 1#define ZFCP_POOL_STATUS_READ_NR ZFCP_STATUS_READS_RECOM#define ZFCP_POOL_DATA_GID_PN_NR 1/* struct used by memory pools for fsf_requests */struct zfcp_fsf_req_pool_element { struct zfcp_fsf_req fsf_req; struct fsf_qtcb qtcb;};/********************** ZFCP SPECIFIC DEFINES ********************************/#define ZFCP_FSFREQ_CLEANUP_TIMEOUT HZ/10#define ZFCP_KNOWN 0x00000001#define ZFCP_REQ_AUTO_CLEANUP 0x00000002#define ZFCP_WAIT_FOR_SBAL 0x00000004#define ZFCP_REQ_NO_QTCB 0x00000008#define ZFCP_SET 0x00000100#define ZFCP_CLEAR 0x00000200#define ZFCP_INTERRUPTIBLE 1#define ZFCP_UNINTERRUPTIBLE 0#ifndef atomic_test_mask#define atomic_test_mask(mask, target) \ ((atomic_read(target) & mask) == mask)#endifextern void _zfcp_hex_dump(char *, int);#define ZFCP_HEX_DUMP(level, addr, count) \ if (ZFCP_LOG_CHECK(level)) { \ _zfcp_hex_dump(addr, count); \ }#define zfcp_get_busid_by_adapter(adapter) (adapter->ccw_device->dev.bus_id)#define zfcp_get_busid_by_port(port) (zfcp_get_busid_by_adapter(port->adapter))#define zfcp_get_busid_by_unit(unit) (zfcp_get_busid_by_port(unit->port))/* * functions needed for reference/usage counting */static inline voidzfcp_unit_get(struct zfcp_unit *unit){ atomic_inc(&unit->refcount);}static inline voidzfcp_unit_put(struct zfcp_unit *unit){ if (atomic_dec_return(&unit->refcount) == 0) wake_up(&unit->remove_wq);}static inline voidzfcp_unit_wait(struct zfcp_unit *unit){ wait_event(unit->remove_wq, atomic_read(&unit->refcount) == 0);}static inline voidzfcp_port_get(struct zfcp_port *port){ atomic_inc(&port->refcount);}static inline voidzfcp_port_put(struct zfcp_port *port){ if (atomic_dec_return(&port->refcount) == 0) wake_up(&port->remove_wq);}static inline voidzfcp_port_wait(struct zfcp_port *port){ wait_event(port->remove_wq, atomic_read(&port->refcount) == 0);}static inline voidzfcp_adapter_get(struct zfcp_adapter *adapter){ atomic_inc(&adapter->refcount);}static inline voidzfcp_adapter_put(struct zfcp_adapter *adapter){ if (atomic_dec_return(&adapter->refcount) == 0) wake_up(&adapter->remove_wq);}static inline voidzfcp_adapter_wait(struct zfcp_adapter *adapter){ wait_event(adapter->remove_wq, atomic_read(&adapter->refcount) == 0);}#endif /* ZFCP_DEF_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -