2 * Copyright (c) 2017-2018 Cavium, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ECORE_ISCSI_API_H__
32 #define __ECORE_ISCSI_API_H__
34 typedef enum _ecore_status_t (*iscsi_event_cb_t)(void *context,
38 struct ecore_iscsi_conn {
39 osal_list_entry_t list_entry;
50 dma_addr_t sq_pbl_addr;
51 struct ecore_chain r2tq;
52 struct ecore_chain xhq;
53 struct ecore_chain uhq;
55 struct tcp_upload_params *tcp_upload_params_virt_addr;
56 dma_addr_t tcp_upload_params_phys_addr;
57 struct scsi_terminate_extra_params *queue_cnts_virt_addr;
58 dma_addr_t queue_cnts_phys_addr;
59 dma_addr_t syn_phy_addr;
61 u16 syn_ip_payload_length;
103 u16 da_timeout_value;
107 #define ECORE_ISCSI_CONN_HD_EN 0x01
108 #define ECORE_ISCSI_CONN_DD_EN 0x02
109 #define ECORE_ISCSI_CONN_INITIAL_R2T 0x04
110 #define ECORE_ISCSI_CONN_IMMEDIATE_DATA 0x08
114 u32 max_recv_pdu_length;
115 u32 max_send_pdu_length;
116 u32 first_seq_length;
121 u8 abortive_dsconnect;
123 #define ECORE_ISCSI_CONN_DIF_ON_IMM_DIS 0
124 #define ECORE_ISCSI_CONN_DIF_ON_IMM_DEFAULT 1
125 #define ECORE_ISCSI_CONN_DIF_ON_IMM_LUN_MAPPER 2
127 dma_addr_t lun_mapper_phys_addr;
130 u16 application_tag_mask;
137 u8 interval_size; /* 0=512B, 1=4KB */
138 u8 network_interface; /* 0=None, 1=DIF */
139 u8 host_interface; /* 0=None, 1=DIF, 2=DIX */
140 u8 ref_tag_mask; /* mask for refernce tag handling */
141 u8 forward_app_tag_with_mask;
142 u8 forward_ref_tag_with_mask;
145 u8 initial_ref_tag_is_valid;
146 u8 host_guard_type; /* 0 = IP checksum, 1 = CRC */
147 u8 protection_type; /* 1/2/3 - Protection Type */
148 u8 crc_seed; /* 0=0x0000, 1=0xffff */
149 u8 keep_ref_tag_const;
152 struct ecore_iscsi_stats
154 u64 iscsi_rx_bytes_cnt;
155 u64 iscsi_rx_packet_cnt;
156 u64 iscsi_rx_new_ooo_isle_events_cnt;
157 u32 iscsi_cmdq_threshold_cnt;
158 u32 iscsi_rq_threshold_cnt;
159 u32 iscsi_immq_threshold_cnt;
161 u64 iscsi_rx_dropped_pdus_task_not_valid;
163 u64 iscsi_rx_data_pdu_cnt;
164 u64 iscsi_rx_r2t_pdu_cnt;
165 u64 iscsi_rx_total_pdu_cnt;
167 u64 iscsi_tx_go_to_slow_start_event_cnt;
168 u64 iscsi_tx_fast_retransmit_event_cnt;
170 u64 iscsi_tx_data_pdu_cnt;
171 u64 iscsi_tx_r2t_pdu_cnt;
172 u64 iscsi_tx_total_pdu_cnt;
174 u64 iscsi_tx_bytes_cnt;
175 u64 iscsi_tx_packet_cnt;
179 * @brief ecore_iscsi_acquire_connection - allocate resources,
180 * provides connecion handle (CID)as out parameter.
183 * @param p_conn partially initialized incoming container of
184 * iSCSI connection data
185 * @return enum _ecore_status_t
188 ecore_iscsi_acquire_connection(struct ecore_hwfn *p_hwfn,
189 struct ecore_iscsi_conn *p_in_conn,
190 struct ecore_iscsi_conn **p_out_conn);
192 void OSAL_IOMEM *ecore_iscsi_get_db_addr(struct ecore_hwfn *p_hwfn,
195 void OSAL_IOMEM *ecore_iscsi_get_global_cmdq_cons(struct ecore_hwfn *p_hwfn,
198 void OSAL_IOMEM *ecore_iscsi_get_primary_bdq_prod(struct ecore_hwfn *p_hwfn,
201 void OSAL_IOMEM *ecore_iscsi_get_secondary_bdq_prod(struct ecore_hwfn *p_hwfn,
205 * @brief ecore_iscsi_offload_connection - offload previously
206 * allocated iSCSI connection
209 * @param p_conn container of iSCSI connection data
211 * @return enum _ecore_status_t
214 ecore_iscsi_offload_connection(struct ecore_hwfn *p_hwfn,
215 struct ecore_iscsi_conn *p_conn);
218 * @brief ecore_iscsi_release_connection - deletes connecton
219 * resources (incliding container of iSCSI connection
223 * @param p_conn container of iSCSI connection data
225 void ecore_iscsi_release_connection(struct ecore_hwfn *p_hwfn,
226 struct ecore_iscsi_conn *p_conn);
229 * @brief ecore_iscsi_terminate_connection - destroys previously
230 * offloaded iSCSI connection
233 * @param p_conn container of iSCSI connection data
235 * @return enum _ecore_status_t
238 ecore_iscsi_terminate_connection(struct ecore_hwfn *p_hwfn,
239 struct ecore_iscsi_conn *p_conn);
243 * @brief ecore_iscsi_update_connection - updates previously
244 * offloaded iSCSI connection
248 * @param p_conn container of iSCSI connection data
250 * @return enum _ecore_status_t
253 ecore_iscsi_update_connection(struct ecore_hwfn *p_hwfn,
254 struct ecore_iscsi_conn *p_conn);
257 * @brief ecore_iscsi_mac_update_connection - updates remote MAC for previously
258 * offloaded iSCSI connection
262 * @param p_conn container of iSCSI connection data
264 * @return enum _ecore_status_t
267 ecore_iscsi_update_remote_mac(struct ecore_hwfn *p_hwfn,
268 struct ecore_iscsi_conn *p_conn);
271 * @brief ecore_iscsi_clear_connection_sq - clear SQ
272 * offloaded iSCSI connection
276 * @param p_conn container of iSCSI connection data
278 * @return enum _ecore_status_t
281 ecore_iscsi_clear_connection_sq(struct ecore_hwfn *p_hwfn,
282 struct ecore_iscsi_conn *p_conn);
285 * @brief ecore_sp_iscsi_func_start
287 * This ramrod inits iSCSI functionality in FW
293 * @return enum _ecore_status_t
296 ecore_sp_iscsi_func_start(struct ecore_hwfn *p_hwfn,
297 enum spq_mode comp_mode,
298 struct ecore_spq_comp_cb *p_comp_addr,
299 void *async_event_context,
300 iscsi_event_cb_t async_event_cb);
303 ecore_sp_iscsi_func_stop(struct ecore_hwfn *p_hwfn,
304 enum spq_mode comp_mode,
305 struct ecore_spq_comp_cb *p_comp_addr);
308 ecore_iscsi_get_stats(struct ecore_hwfn *p_hwfn,
309 struct ecore_iscsi_stats *stats);