1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, v.1, (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9 * or http://opensource.org/licenses/CDDL-1.0. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets "[]" replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2014-2017 Cavium, Inc. 24 * The contents of this file are subject to the terms of the Common Development 25 * and Distribution License, v.1, (the "License"). 26 27 * You may not use this file except in compliance with the License. 28 29 * You can obtain a copy of the License at available 30 * at http://opensource.org/licenses/CDDL-1.0 31 32 * See the License for the specific language governing permissions and 33 * limitations under the License. 34 */ 35 36 #ifndef __ECORE_ISCSI_API_H__ 37 #define __ECORE_ISCSI_API_H__ 38 39 #ifndef __EXTRACT__LINUX__ 40 typedef enum _ecore_status_t (*iscsi_event_cb_t)(void *context, 41 u8 fw_event_code, 42 void *fw_handle); 43 #endif 44 45 struct ecore_iscsi_conn { 46 osal_list_entry_t list_entry; 47 bool free_on_delete; 48 49 u16 conn_id; 50 u32 icid; 51 u32 fw_cid; 52 53 u8 layer_code; 54 u8 offl_flags; 55 u8 connect_mode; 56 u32 initial_ack; 57 dma_addr_t sq_pbl_addr; 58 struct ecore_chain r2tq; 59 struct ecore_chain xhq; 60 struct ecore_chain uhq; 61 62 struct tcp_upload_params *tcp_upload_params_virt_addr; 63 dma_addr_t tcp_upload_params_phys_addr; 64 struct scsi_terminate_extra_params *queue_cnts_virt_addr; 65 dma_addr_t queue_cnts_phys_addr; 66 dma_addr_t syn_phy_addr; 67 68 u16 syn_ip_payload_length; 69 u8 local_mac[6]; 70 u8 remote_mac[6]; 71 u16 vlan_id; 72 u8 tcp_flags; 73 u8 ip_version; 74 u32 remote_ip[4]; 75 u32 local_ip[4]; 76 u8 ka_max_probe_cnt; 77 u8 dup_ack_theshold; 78 u32 rcv_next; 79 u32 snd_una; 80 u32 snd_next; 81 u32 snd_max; 82 u32 snd_wnd; 83 u32 rcv_wnd; 84 u32 snd_wl1; 85 u32 cwnd; 86 u32 ss_thresh; 87 u16 srtt; 88 u16 rtt_var; 89 u32 ts_recent; 90 u32 ts_recent_age; 91 u32 total_rt; 92 u32 ka_timeout_delta; 93 u32 rt_timeout_delta; 94 u8 dup_ack_cnt; 95 u8 snd_wnd_probe_cnt; 96 u8 ka_probe_cnt; 97 u8 rt_cnt; 98 u32 flow_label; 99 u32 ka_timeout; 100 u32 ka_interval; 101 u32 max_rt_time; 102 u32 initial_rcv_wnd; 103 u8 ttl; 104 u8 tos_or_tc; 105 u16 remote_port; 106 u16 local_port; 107 u16 mss; 108 u8 snd_wnd_scale; 109 u8 rcv_wnd_scale; 110 u16 da_timeout_value; 111 u8 ack_frequency; 112 113 u8 update_flag; 114 #define ECORE_ISCSI_CONN_HD_EN 0x01 115 #define ECORE_ISCSI_CONN_DD_EN 0x02 116 #define ECORE_ISCSI_CONN_INITIAL_R2T 0x04 117 #define ECORE_ISCSI_CONN_IMMEDIATE_DATA 0x08 118 119 u8 default_cq; 120 u32 max_seq_size; 121 u32 max_recv_pdu_length; 122 u32 max_send_pdu_length; 123 u32 first_seq_length; 124 u32 exp_stat_sn; 125 u32 stat_sn; 126 u16 physical_q0; 127 u16 physical_q1; 128 u8 abortive_dsconnect; 129 }; 130 131 #ifndef __EXTRACT__LINUX__ 132 struct ecore_iscsi_stats 133 { 134 u64 iscsi_rx_bytes_cnt; 135 u64 iscsi_rx_packet_cnt; 136 u64 iscsi_rx_new_ooo_isle_events_cnt; 137 u32 iscsi_cmdq_threshold_cnt; 138 u32 iscsi_rq_threshold_cnt; 139 u32 iscsi_immq_threshold_cnt; 140 141 u64 iscsi_rx_dropped_pdus_task_not_valid; 142 143 u64 iscsi_rx_data_pdu_cnt; 144 u64 iscsi_rx_r2t_pdu_cnt; 145 u64 iscsi_rx_total_pdu_cnt; 146 147 u64 iscsi_tx_go_to_slow_start_event_cnt; 148 u64 iscsi_tx_fast_retransmit_event_cnt; 149 150 u64 iscsi_tx_data_pdu_cnt; 151 u64 iscsi_tx_r2t_pdu_cnt; 152 u64 iscsi_tx_total_pdu_cnt; 153 154 u64 iscsi_tx_bytes_cnt; 155 u64 iscsi_tx_packet_cnt; 156 }; 157 #endif 158 159 /** 160 * @brief ecore_iscsi_acquire_connection - allocate resources, 161 * provides connecion handle (CID)as out parameter. 162 * 163 * @param p_path 164 * @param p_conn partially initialized incoming container of 165 * iSCSI connection data 166 * @return enum _ecore_status_t 167 */ 168 enum _ecore_status_t 169 ecore_iscsi_acquire_connection(struct ecore_hwfn *p_hwfn, 170 struct ecore_iscsi_conn *p_in_conn, 171 struct ecore_iscsi_conn **p_out_conn); 172 173 void OSAL_IOMEM *ecore_iscsi_get_db_addr(struct ecore_hwfn *p_hwfn, 174 u32 cid); 175 176 void OSAL_IOMEM *ecore_iscsi_get_global_cmdq_cons(struct ecore_hwfn *p_hwfn, 177 u8 relative_q_id); 178 179 void OSAL_IOMEM *ecore_iscsi_get_primary_bdq_prod(struct ecore_hwfn *p_hwfn, 180 u8 bdq_id); 181 182 void OSAL_IOMEM *ecore_iscsi_get_secondary_bdq_prod(struct ecore_hwfn *p_hwfn, 183 u8 bdq_id); 184 185 /** 186 * @brief ecore_iscsi_offload_connection - offload previously 187 * allocated iSCSI connection 188 * 189 * @param p_path 190 * @param p_conn container of iSCSI connection data 191 * 192 * @return enum _ecore_status_t 193 */ 194 enum _ecore_status_t 195 ecore_iscsi_offload_connection(struct ecore_hwfn *p_hwfn, 196 struct ecore_iscsi_conn *p_conn); 197 198 /** 199 * @brief ecore_iscsi_release_connection - deletes connecton 200 * resources (incliding container of iSCSI connection 201 * data) 202 * 203 * @param p_path 204 * @param p_conn container of iSCSI connection data 205 */ 206 void ecore_iscsi_release_connection(struct ecore_hwfn *p_hwfn, 207 struct ecore_iscsi_conn *p_conn); 208 209 /** 210 * @brief ecore_iscsi_terminate_connection - destroys previously 211 * offloaded iSCSI connection 212 * 213 * @param p_path 214 * @param p_conn container of iSCSI connection data 215 * 216 * @return enum _ecore_status_t 217 */ 218 enum _ecore_status_t 219 ecore_iscsi_terminate_connection(struct ecore_hwfn *p_hwfn, 220 struct ecore_iscsi_conn *p_conn); 221 222 223 /** 224 * @brief ecore_iscsi_update_connection - updates previously 225 * offloaded iSCSI connection 226 * 227 * 228 * @param p_path 229 * @param p_conn container of iSCSI connection data 230 * 231 * @return enum _ecore_status_t 232 */ 233 enum _ecore_status_t 234 ecore_iscsi_update_connection(struct ecore_hwfn *p_hwfn, 235 struct ecore_iscsi_conn *p_conn); 236 237 /** 238 * @brief ecore_iscsi_mac_update_connection - updates remote MAC for previously 239 * offloaded iSCSI connection 240 * 241 * 242 * @param p_path 243 * @param p_conn container of iSCSI connection data 244 * 245 * @return enum _ecore_status_t 246 */ 247 enum _ecore_status_t 248 ecore_iscsi_update_remote_mac(struct ecore_hwfn *p_hwfn, 249 struct ecore_iscsi_conn *p_conn); 250 251 /** 252 * @brief ecore_iscsi_clear_connection_sq - clear SQ 253 * offloaded iSCSI connection 254 * 255 * 256 * @param p_path 257 * @param p_conn container of iSCSI connection data 258 * 259 * @return enum _ecore_status_t 260 */ 261 enum _ecore_status_t 262 ecore_iscsi_clear_connection_sq(struct ecore_hwfn *p_hwfn, 263 struct ecore_iscsi_conn *p_conn); 264 265 /** 266 * @brief ecore_sp_iscsi_func_start 267 * 268 * This ramrod inits iSCSI functionality in FW 269 * 270 * @param p_path 271 * @param comp_mode 272 * @param comp_addr 273 * 274 * @return enum _ecore_status_t 275 */ 276 enum _ecore_status_t 277 ecore_sp_iscsi_func_start(struct ecore_hwfn *p_hwfn, 278 enum spq_mode comp_mode, 279 struct ecore_spq_comp_cb *p_comp_addr, 280 void *async_event_context, 281 iscsi_event_cb_t async_event_cb); 282 283 enum _ecore_status_t 284 ecore_sp_iscsi_func_stop(struct ecore_hwfn *p_hwfn, 285 enum spq_mode comp_mode, 286 struct ecore_spq_comp_cb *p_comp_addr); 287 288 enum _ecore_status_t 289 ecore_iscsi_get_stats(struct ecore_hwfn *p_hwfn, 290 struct ecore_iscsi_stats *stats); 291 292 #endif 293