0001
0002
0003
0004 #ifndef _SNIC_IO_H
0005 #define _SNIC_IO_H
0006
0007 #define SNIC_DFLT_SG_DESC_CNT 32
0008 #define SNIC_MAX_SG_DESC_CNT 60
0009 #define SNIC_SG_DESC_ALIGN 16
0010
0011
0012 struct snic_sg_desc {
0013 __le64 addr;
0014 __le32 len;
0015 u32 _resvd;
0016 };
0017
0018 struct snic_dflt_sgl {
0019 struct snic_sg_desc sg_desc[SNIC_DFLT_SG_DESC_CNT];
0020 };
0021
0022 struct snic_max_sgl {
0023 struct snic_sg_desc sg_desc[SNIC_MAX_SG_DESC_CNT];
0024 };
0025
0026 enum snic_req_cache_type {
0027 SNIC_REQ_CACHE_DFLT_SGL = 0,
0028 SNIC_REQ_CACHE_MAX_SGL,
0029 SNIC_REQ_TM_CACHE,
0030
0031 SNIC_REQ_MAX_CACHES
0032 };
0033
0034
0035 struct snic_internal_io_state {
0036 char *rqi;
0037 u64 flags;
0038 u32 state;
0039 u32 abts_status;
0040 u32 lr_status;
0041 };
0042
0043
0044 enum snic_ioreq_state {
0045 SNIC_IOREQ_NOT_INITED = 0,
0046 SNIC_IOREQ_PENDING,
0047 SNIC_IOREQ_ABTS_PENDING,
0048 SNIC_IOREQ_ABTS_COMPLETE,
0049 SNIC_IOREQ_LR_PENDING,
0050 SNIC_IOREQ_LR_COMPLETE,
0051 SNIC_IOREQ_COMPLETE,
0052 };
0053
0054 struct snic;
0055 struct snic_host_req;
0056
0057
0058
0059
0060
0061
0062 struct snic_req_info {
0063 struct list_head list;
0064 struct snic_host_req *req;
0065 u64 start_time;
0066 u16 rq_pool_type;
0067 u16 req_len;
0068 u32 tgt_id;
0069
0070 u32 tm_tag;
0071 u8 io_cmpl:1;
0072 u8 resvd[3];
0073 struct scsi_cmnd *sc;
0074 struct snic *snic;
0075 ulong sge_va;
0076 u64 snsbuf_va;
0077
0078 struct snic_host_req *abort_req;
0079 struct completion *abts_done;
0080
0081 struct snic_host_req *dr_req;
0082 struct completion *dr_done;
0083 };
0084
0085
0086 #define rqi_to_req(rqi) \
0087 ((struct snic_host_req *) (((struct snic_req_info *)rqi)->req))
0088
0089 #define req_to_rqi(req) \
0090 ((struct snic_req_info *) (((struct snic_host_req *)req)->hdr.init_ctx))
0091
0092 #define req_to_sgl(req) \
0093 ((struct snic_sg_desc *) (((struct snic_host_req *)req)+1))
0094
0095 struct snic_req_info *
0096 snic_req_init(struct snic *, int sg_cnt);
0097 void snic_req_free(struct snic *, struct snic_req_info *);
0098 void snic_calc_io_process_time(struct snic *, struct snic_req_info *);
0099 void snic_pci_unmap_rsp_buf(struct snic *, struct snic_req_info *);
0100 struct snic_host_req *
0101 snic_abort_req_init(struct snic *, struct snic_req_info *);
0102 struct snic_host_req *
0103 snic_dr_req_init(struct snic *, struct snic_req_info *);
0104 #endif