1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _SNIC_IO_H
19#define _SNIC_IO_H
20
21#define SNIC_DFLT_SG_DESC_CNT 32
22#define SNIC_MAX_SG_DESC_CNT 60
23#define SNIC_SG_DESC_ALIGN 16
24
25
26struct snic_sg_desc {
27 __le64 addr;
28 __le32 len;
29 u32 _resvd;
30};
31
32struct snic_dflt_sgl {
33 struct snic_sg_desc sg_desc[SNIC_DFLT_SG_DESC_CNT];
34};
35
36struct snic_max_sgl {
37 struct snic_sg_desc sg_desc[SNIC_MAX_SG_DESC_CNT];
38};
39
40enum snic_req_cache_type {
41 SNIC_REQ_CACHE_DFLT_SGL = 0,
42 SNIC_REQ_CACHE_MAX_SGL,
43 SNIC_REQ_TM_CACHE,
44
45 SNIC_REQ_MAX_CACHES
46};
47
48
49struct snic_internal_io_state {
50 char *rqi;
51 u64 flags;
52 u32 state;
53 u32 abts_status;
54 u32 lr_status;
55};
56
57
58enum snic_ioreq_state {
59 SNIC_IOREQ_NOT_INITED = 0,
60 SNIC_IOREQ_PENDING,
61 SNIC_IOREQ_ABTS_PENDING,
62 SNIC_IOREQ_ABTS_COMPLETE,
63 SNIC_IOREQ_LR_PENDING,
64 SNIC_IOREQ_LR_COMPLETE,
65 SNIC_IOREQ_COMPLETE,
66};
67
68struct snic;
69struct snic_host_req;
70
71
72
73
74
75
76struct snic_req_info {
77 struct list_head list;
78 struct snic_host_req *req;
79 u64 start_time;
80 u16 rq_pool_type;
81 u16 req_len;
82 u32 tgt_id;
83
84 u32 tm_tag;
85 u8 io_cmpl:1;
86 u8 resvd[3];
87 struct scsi_cmnd *sc;
88 struct snic *snic;
89 ulong sge_va;
90 u64 snsbuf_va;
91
92 struct snic_host_req *abort_req;
93 struct completion *abts_done;
94
95 struct snic_host_req *dr_req;
96 struct completion *dr_done;
97};
98
99
100#define rqi_to_req(rqi) \
101 ((struct snic_host_req *) (((struct snic_req_info *)rqi)->req))
102
103#define req_to_rqi(req) \
104 ((struct snic_req_info *) (((struct snic_host_req *)req)->hdr.init_ctx))
105
106#define req_to_sgl(req) \
107 ((struct snic_sg_desc *) (((struct snic_host_req *)req)+1))
108
109struct snic_req_info *
110snic_req_init(struct snic *, int sg_cnt);
111void snic_req_free(struct snic *, struct snic_req_info *);
112void snic_calc_io_process_time(struct snic *, struct snic_req_info *);
113void snic_pci_unmap_rsp_buf(struct snic *, struct snic_req_info *);
114struct snic_host_req *
115snic_abort_req_init(struct snic *, struct snic_req_info *);
116struct snic_host_req *
117snic_dr_req_init(struct snic *, struct snic_req_info *);
118#endif
119