zfcp_def.h
来自「Linux Kernel 2.6.9 for OMAP1710」· C头文件 代码 · 共 1,175 行 · 第 1/3 页
H
1,175 行
* @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 * @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 * @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_port *port; 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_status_read { struct fsf_status_read_buffer *buffer;};struct zfcp_fsf_done { struct completion *complete; int status;};/* request specific data */union zfcp_req_data { struct zfcp_exchange_config_data exchange_config_data; struct zfcp_open_port open_port; struct zfcp_close_port close_port; struct zfcp_open_unit open_unit; struct zfcp_close_unit close_unit; struct zfcp_close_physical_port close_physical_port; struct zfcp_send_fcp_command_task send_fcp_command_task; struct zfcp_send_fcp_command_task_management send_fcp_command_task_management; struct zfcp_abort_fcp_command abort_fcp_command; struct zfcp_send_ct *send_ct; struct zfcp_send_els *send_els; struct zfcp_status_read status_read; struct fsf_qtcb_bottom_port *port_data;};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 wwnn; /* WWNN */ wwn_t wwpn; /* WWPN */ fc_id_t s_id; /* N_Port ID */ struct ccw_device *ccw_device; /* S/390 ccw device */ u8 fc_service_class; u32 fc_topology; /* FC topology */ u32 fc_link_speed; /* FC interface speed */ u32 hydra_version; /* Hydra version */ u32 fsf_lic_version; u32 supported_features;/* of FCP channel */ u32 hardware_version; /* of FCP channel */ u8 serial_number[32]; /* of hardware */ 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 */ rwlock_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; /* S/390 debug features */ debug_info_t *abort_dbf; debug_info_t *in_els_dbf; debug_info_t *cmd_dbf; rwlock_t cmd_dbf_lock; 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 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 */ scsi_id_t scsi_id; /* own SCSI ID */ wwn_t wwnn; /* WWNN if known */ wwn_t wwpn; /* WWPN */ fc_id_t 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; atomic_t scsi_add_work; /* used to synchronize */ wait_queue_head_t scsi_add_wq; /* wait for scsi_add_device */};/* 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 */ union zfcp_req_data data; /* Info fields 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 */};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;};/** * 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 + =
减小字号Ctrl + -
显示快捷键?