1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 2021 Broadcom. All Rights Reserved. The term
4 * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
7 #if !defined(__EFCT_IO_H__)
12 #define EFCT_LOG_ENABLE_IO_ERRORS(efct) \
13 (((efct) != NULL) ? (((efct)->logmask & (1U << 6)) != 0) : 0)
15 #define io_error_log(io, fmt, ...) \
17 if (EFCT_LOG_ENABLE_IO_ERRORS(io->efct)) \
18 efc_log_warn(io->efct, fmt, ##__VA_ARGS__); \
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
30 EFCT_IO_TYPE_BLS_RESP
,
38 EFCT_ELS_REQUEST_DELAYED
,
39 EFCT_ELS_REQUEST_DELAY_ABORT
,
42 EFCT_ELS_ABORT_IO_COMPL
,
46 * Scsi target IO object
47 * @efct: pointer back to efct
48 * @instance_index: unique instance index value
49 * @io: IO display name
50 * @node: pointer to node
51 * @list_entry: io list entry
52 * @io_pending_link: io pending list entry
53 * @ref: reference counter
54 * @release: release callback function
55 * @init_task_tag: initiator task tag (OX_ID) for back-end and SCSI logging
56 * @tgt_task_tag: target task tag (RX_ID) for back-end and SCSI logging
57 * @hw_tag: HW layer unique IO id
58 * @tag: unique IO identifier
60 * @sgl_allocated: Number of allocated SGEs
61 * @sgl_count: Number of SGEs in this SGL
62 * @tgt_io: backend target private IO data
63 * @exp_xfer_len: expected data transfer length, based on FC header
64 * @hw_priv: Declarations private to HW/SLI
65 * @io_type: indicates what this struct efct_io structure is used for
67 * @transferred: Number of bytes transferred
68 * @auto_resp: set if auto_trsp was set
69 * @low_latency: set if low latency request
70 * @wq_steering: selected WQ steering request
71 * @wq_class: selected WQ class if steering is class
72 * @xfer_req: transfer size for current request
73 * @scsi_tgt_cb: target callback function
74 * @scsi_tgt_cb_arg: target callback function argument
75 * @abort_cb: abort callback function
76 * @abort_cb_arg: abort callback function argument
77 * @bls_cb: BLS callback function
78 * @bls_cb_arg: BLS callback function argument
79 * @tmf_cmd: TMF command being processed
80 * @abort_rx_id: rx_id from the ABTS that initiated the command abort
81 * @cmd_tgt: True if this is a Target command
82 * @send_abts: when aborting, indicates ABTS is to be sent
83 * @cmd_ini: True if this is an Initiator command
84 * @seq_init: True if local node has sequence initiative
85 * @iparam: iparams for hw io send call
86 * @hio_type: HW IO type
87 * @wire_len: wire length
88 * @hw_cb: saved HW callback
89 * @io_to_abort: for abort handling, pointer to IO to abort
90 * @rspbuf: SCSI Response buffer
91 * @timeout: Timeout value in seconds for this IO
92 * @cs_ctl: CS_CTL priority for this IO
93 * @io_free: Is io object in freelist
94 * @app_id: application id
99 const char *display_name
;
100 struct efct_node
*node
;
102 struct list_head list_entry
;
103 struct list_head io_pending_link
;
105 void (*release
)(struct kref
*arg
);
110 struct efct_scsi_sgl
*sgl
;
113 struct efct_scsi_tgt_io tgt_io
;
118 enum efct_io_type io_type
;
119 struct efct_hw_io
*hio
;
127 efct_scsi_io_cb_t scsi_tgt_cb
;
128 void *scsi_tgt_cb_arg
;
129 efct_scsi_io_cb_t abort_cb
;
131 efct_scsi_io_cb_t bls_cb
;
133 enum efct_scsi_tmf_cmd tmf_cmd
;
140 union efct_hw_io_param_u iparam
;
141 enum efct_hw_io_type hio_type
;
145 struct efct_io
*io_to_abort
;
147 struct efc_dma rspbuf
;
154 struct efct_io_cb_arg
{
160 struct efct_io_pool
*
161 efct_io_pool_create(struct efct
*efct
, u32 num_sgl
);
163 efct_io_pool_free(struct efct_io_pool
*io_pool
);
165 efct_io_pool_allocated(struct efct_io_pool
*io_pool
);
168 efct_io_pool_io_alloc(struct efct_io_pool
*io_pool
);
170 efct_io_pool_io_free(struct efct_io_pool
*io_pool
, struct efct_io
*io
);
172 efct_io_find_tgt_io(struct efct
*efct
, struct efct_node
*node
,
173 u16 ox_id
, u16 rx_id
);
174 #endif /* __EFCT_IO_H__ */