0001
0002
0003
0004
0005
0006
0007 #if !defined(__EFCT_IO_H__)
0008 #define __EFCT_IO_H__
0009
0010 #include "efct_lio.h"
0011
0012 #define EFCT_LOG_ENABLE_IO_ERRORS(efct) \
0013 (((efct) != NULL) ? (((efct)->logmask & (1U << 6)) != 0) : 0)
0014
0015 #define io_error_log(io, fmt, ...) \
0016 do { \
0017 if (EFCT_LOG_ENABLE_IO_ERRORS(io->efct)) \
0018 efc_log_warn(io->efct, fmt, ##__VA_ARGS__); \
0019 } while (0)
0020
0021 #define SCSI_CMD_BUF_LENGTH 48
0022 #define SCSI_RSP_BUF_LENGTH (FCP_RESP_WITH_EXT + SCSI_SENSE_BUFFERSIZE)
0023 #define EFCT_NUM_SCSI_IOS 8192
0024
0025 enum efct_io_type {
0026 EFCT_IO_TYPE_IO = 0,
0027 EFCT_IO_TYPE_ELS,
0028 EFCT_IO_TYPE_CT,
0029 EFCT_IO_TYPE_CT_RESP,
0030 EFCT_IO_TYPE_BLS_RESP,
0031 EFCT_IO_TYPE_ABORT,
0032
0033 EFCT_IO_TYPE_MAX,
0034 };
0035
0036 enum efct_els_state {
0037 EFCT_ELS_REQUEST = 0,
0038 EFCT_ELS_REQUEST_DELAYED,
0039 EFCT_ELS_REQUEST_DELAY_ABORT,
0040 EFCT_ELS_REQ_ABORT,
0041 EFCT_ELS_REQ_ABORTED,
0042 EFCT_ELS_ABORT_IO_COMPL,
0043 };
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096 struct efct_io {
0097 struct efct *efct;
0098 u32 instance_index;
0099 const char *display_name;
0100 struct efct_node *node;
0101
0102 struct list_head list_entry;
0103 struct list_head io_pending_link;
0104 struct kref ref;
0105 void (*release)(struct kref *arg);
0106 u32 init_task_tag;
0107 u32 tgt_task_tag;
0108 u32 hw_tag;
0109 u32 tag;
0110 struct efct_scsi_sgl *sgl;
0111 u32 sgl_allocated;
0112 u32 sgl_count;
0113 struct efct_scsi_tgt_io tgt_io;
0114 u32 exp_xfer_len;
0115
0116 void *hw_priv;
0117
0118 enum efct_io_type io_type;
0119 struct efct_hw_io *hio;
0120 size_t transferred;
0121
0122 bool auto_resp;
0123 bool low_latency;
0124 u8 wq_steering;
0125 u8 wq_class;
0126 u64 xfer_req;
0127 efct_scsi_io_cb_t scsi_tgt_cb;
0128 void *scsi_tgt_cb_arg;
0129 efct_scsi_io_cb_t abort_cb;
0130 void *abort_cb_arg;
0131 efct_scsi_io_cb_t bls_cb;
0132 void *bls_cb_arg;
0133 enum efct_scsi_tmf_cmd tmf_cmd;
0134 u16 abort_rx_id;
0135
0136 bool cmd_tgt;
0137 bool send_abts;
0138 bool cmd_ini;
0139 bool seq_init;
0140 union efct_hw_io_param_u iparam;
0141 enum efct_hw_io_type hio_type;
0142 u64 wire_len;
0143 void *hw_cb;
0144
0145 struct efct_io *io_to_abort;
0146
0147 struct efc_dma rspbuf;
0148 u32 timeout;
0149 u8 cs_ctl;
0150 u8 io_free;
0151 u32 app_id;
0152 };
0153
0154 struct efct_io_cb_arg {
0155 int status;
0156 int ext_status;
0157 void *app;
0158 };
0159
0160 struct efct_io_pool *
0161 efct_io_pool_create(struct efct *efct, u32 num_sgl);
0162 int
0163 efct_io_pool_free(struct efct_io_pool *io_pool);
0164 u32
0165 efct_io_pool_allocated(struct efct_io_pool *io_pool);
0166
0167 struct efct_io *
0168 efct_io_pool_io_alloc(struct efct_io_pool *io_pool);
0169 void
0170 efct_io_pool_io_free(struct efct_io_pool *io_pool, struct efct_io *io);
0171 struct efct_io *
0172 efct_io_find_tgt_io(struct efct *efct, struct efct_node *node,
0173 u16 ox_id, u16 rx_id);
0174 #endif