1
2
3
4
5
6
7#if !defined(__EFCT_IO_H__)
8#define __EFCT_IO_H__
9
10#include "efct_lio.h"
11
12#define EFCT_LOG_ENABLE_IO_ERRORS(efct) \
13 (((efct) != NULL) ? (((efct)->logmask & (1U << 6)) != 0) : 0)
14
15#define io_error_log(io, fmt, ...) \
16 do { \
17 if (EFCT_LOG_ENABLE_IO_ERRORS(io->efct)) \
18 efc_log_warn(io->efct, fmt, ##__VA_ARGS__); \
19 } while (0)
20
21#define SCSI_CMD_BUF_LENGTH 48
22#define SCSI_RSP_BUF_LENGTH (FCP_RESP_WITH_EXT + SCSI_SENSE_BUFFERSIZE)
23#define EFCT_NUM_SCSI_IOS 8192
24
25enum efct_io_type {
26 EFCT_IO_TYPE_IO = 0,
27 EFCT_IO_TYPE_ELS,
28 EFCT_IO_TYPE_CT,
29 EFCT_IO_TYPE_CT_RESP,
30 EFCT_IO_TYPE_BLS_RESP,
31 EFCT_IO_TYPE_ABORT,
32
33 EFCT_IO_TYPE_MAX,
34};
35
36enum efct_els_state {
37 EFCT_ELS_REQUEST = 0,
38 EFCT_ELS_REQUEST_DELAYED,
39 EFCT_ELS_REQUEST_DELAY_ABORT,
40 EFCT_ELS_REQ_ABORT,
41 EFCT_ELS_REQ_ABORTED,
42 EFCT_ELS_ABORT_IO_COMPL,
43};
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96struct efct_io {
97 struct efct *efct;
98 u32 instance_index;
99 const char *display_name;
100 struct efct_node *node;
101
102 struct list_head list_entry;
103 struct list_head io_pending_link;
104 struct kref ref;
105 void (*release)(struct kref *arg);
106 u32 init_task_tag;
107 u32 tgt_task_tag;
108 u32 hw_tag;
109 u32 tag;
110 struct efct_scsi_sgl *sgl;
111 u32 sgl_allocated;
112 u32 sgl_count;
113 struct efct_scsi_tgt_io tgt_io;
114 u32 exp_xfer_len;
115
116 void *hw_priv;
117
118 enum efct_io_type io_type;
119 struct efct_hw_io *hio;
120 size_t transferred;
121
122 bool auto_resp;
123 bool low_latency;
124 u8 wq_steering;
125 u8 wq_class;
126 u64 xfer_req;
127 efct_scsi_io_cb_t scsi_tgt_cb;
128 void *scsi_tgt_cb_arg;
129 efct_scsi_io_cb_t abort_cb;
130 void *abort_cb_arg;
131 efct_scsi_io_cb_t bls_cb;
132 void *bls_cb_arg;
133 enum efct_scsi_tmf_cmd tmf_cmd;
134 u16 abort_rx_id;
135
136 bool cmd_tgt;
137 bool send_abts;
138 bool cmd_ini;
139 bool seq_init;
140 union efct_hw_io_param_u iparam;
141 enum efct_hw_io_type hio_type;
142 u64 wire_len;
143 void *hw_cb;
144
145 struct efct_io *io_to_abort;
146
147 struct efc_dma rspbuf;
148 u32 timeout;
149 u8 cs_ctl;
150 u8 io_free;
151 u32 app_id;
152};
153
154struct efct_io_cb_arg {
155 int status;
156 int ext_status;
157 void *app;
158};
159
160struct efct_io_pool *
161efct_io_pool_create(struct efct *efct, u32 num_sgl);
162int
163efct_io_pool_free(struct efct_io_pool *io_pool);
164u32
165efct_io_pool_allocated(struct efct_io_pool *io_pool);
166
167struct efct_io *
168efct_io_pool_io_alloc(struct efct_io_pool *io_pool);
169void
170efct_io_pool_io_free(struct efct_io_pool *io_pool, struct efct_io *io);
171struct efct_io *
172efct_io_find_tgt_io(struct efct *efct, struct efct_node *node,
173 u16 ox_id, u16 rx_id);
174#endif
175