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;
124 struct ecore_iscsi_stats
126 u64 iscsi_rx_bytes_cnt;
127 u64 iscsi_rx_packet_cnt;
128 u64 iscsi_rx_new_ooo_isle_events_cnt;
129 u32 iscsi_cmdq_threshold_cnt;
130 u32 iscsi_rq_threshold_cnt;
131 u32 iscsi_immq_threshold_cnt;
133 u64 iscsi_rx_dropped_pdus_task_not_valid;
135 u64 iscsi_rx_data_pdu_cnt;
136 u64 iscsi_rx_r2t_pdu_cnt;
137 u64 iscsi_rx_total_pdu_cnt;
139 u64 iscsi_tx_go_to_slow_start_event_cnt;
140 u64 iscsi_tx_fast_retransmit_event_cnt;
142 u64 iscsi_tx_data_pdu_cnt;
143 u64 iscsi_tx_r2t_pdu_cnt;
144 u64 iscsi_tx_total_pdu_cnt;
146 u64 iscsi_tx_bytes_cnt;
147 u64 iscsi_tx_packet_cnt;
151 * @brief ecore_iscsi_acquire_connection - allocate resources,
152 * provides connecion handle (CID)as out parameter.
155 * @param p_conn partially initialized incoming container of
156 * iSCSI connection data
157 * @return enum _ecore_status_t
160 ecore_iscsi_acquire_connection(struct ecore_hwfn *p_hwfn,
161 struct ecore_iscsi_conn *p_in_conn,
162 struct ecore_iscsi_conn **p_out_conn);
164 void OSAL_IOMEM *ecore_iscsi_get_db_addr(struct ecore_hwfn *p_hwfn,
167 void OSAL_IOMEM *ecore_iscsi_get_global_cmdq_cons(struct ecore_hwfn *p_hwfn,
170 void OSAL_IOMEM *ecore_iscsi_get_primary_bdq_prod(struct ecore_hwfn *p_hwfn,
173 void OSAL_IOMEM *ecore_iscsi_get_secondary_bdq_prod(struct ecore_hwfn *p_hwfn,
177 * @brief ecore_iscsi_offload_connection - offload previously
178 * allocated iSCSI connection
181 * @param p_conn container of iSCSI connection data
183 * @return enum _ecore_status_t
186 ecore_iscsi_offload_connection(struct ecore_hwfn *p_hwfn,
187 struct ecore_iscsi_conn *p_conn);
190 * @brief ecore_iscsi_release_connection - deletes connecton
191 * resources (incliding container of iSCSI connection
195 * @param p_conn container of iSCSI connection data
197 void ecore_iscsi_release_connection(struct ecore_hwfn *p_hwfn,
198 struct ecore_iscsi_conn *p_conn);
201 * @brief ecore_iscsi_terminate_connection - destroys previously
202 * offloaded iSCSI connection
205 * @param p_conn container of iSCSI connection data
207 * @return enum _ecore_status_t
210 ecore_iscsi_terminate_connection(struct ecore_hwfn *p_hwfn,
211 struct ecore_iscsi_conn *p_conn);
215 * @brief ecore_iscsi_update_connection - updates previously
216 * offloaded iSCSI connection
220 * @param p_conn container of iSCSI connection data
222 * @return enum _ecore_status_t
225 ecore_iscsi_update_connection(struct ecore_hwfn *p_hwfn,
226 struct ecore_iscsi_conn *p_conn);
229 * @brief ecore_iscsi_mac_update_connection - updates remote MAC for previously
230 * offloaded iSCSI connection
234 * @param p_conn container of iSCSI connection data
236 * @return enum _ecore_status_t
239 ecore_iscsi_update_remote_mac(struct ecore_hwfn *p_hwfn,
240 struct ecore_iscsi_conn *p_conn);
243 * @brief ecore_iscsi_clear_connection_sq - clear SQ
244 * offloaded iSCSI connection
248 * @param p_conn container of iSCSI connection data
250 * @return enum _ecore_status_t
253 ecore_iscsi_clear_connection_sq(struct ecore_hwfn *p_hwfn,
254 struct ecore_iscsi_conn *p_conn);
257 * @brief ecore_sp_iscsi_func_start
259 * This ramrod inits iSCSI functionality in FW
265 * @return enum _ecore_status_t
268 ecore_sp_iscsi_func_start(struct ecore_hwfn *p_hwfn,
269 enum spq_mode comp_mode,
270 struct ecore_spq_comp_cb *p_comp_addr,
271 void *async_event_context,
272 iscsi_event_cb_t async_event_cb);
275 ecore_sp_iscsi_func_stop(struct ecore_hwfn *p_hwfn,
276 enum spq_mode comp_mode,
277 struct ecore_spq_comp_cb *p_comp_addr);
280 ecore_iscsi_get_stats(struct ecore_hwfn *p_hwfn,
281 struct ecore_iscsi_stats *stats);