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_H__
37 #define __ECORE_ISCSI_H__
38 
39 #include "ecore.h"
40 #include "ecore_chain.h"
41 #include "ecore_hsi_common.h"
42 #include "tcp_common.h"
43 #include "ecore_hsi_iscsi.h"
44 #include "ecore_sp_commands.h"
45 #include "ecore_iscsi_api.h"
46 
47 struct ecore_iscsi_info {
48 	osal_spinlock_t	 lock;
49 	osal_list_t	 free_list;
50 	u16		 max_num_outstanding_tasks;
51 	void		 *event_context;
52 	iscsi_event_cb_t event_cb;
53 };
54 
55 enum _ecore_status_t ecore_iscsi_alloc(struct ecore_hwfn *p_hwfn);
56 
57 void ecore_iscsi_setup(struct ecore_hwfn *p_hwfn);
58 
59 void ecore_iscsi_free(struct ecore_hwfn *p_hwfn);
60 
61 void ecore_iscsi_free_connection(struct ecore_hwfn *p_hwfn,
62 				 struct ecore_iscsi_conn *p_conn);
63 
64 /**
65  * @brief ecore_sp_iscsi_conn_offload - iSCSI connection offload
66  *
67  * This ramrod offloads iSCSI connection to FW
68  *
69  * @param p_path
70  * @param p_conn
71  * @param comp_mode
72  * @param comp_addr
73  *
74  * @return enum _ecore_status_t
75  */
76 enum _ecore_status_t
77 ecore_sp_iscsi_conn_offload(struct ecore_hwfn *p_hwfn,
78 			    struct ecore_iscsi_conn *p_conn,
79 			    enum spq_mode comp_mode,
80 			    struct ecore_spq_comp_cb *p_comp_addr);
81 
82 /**
83  * @brief ecore_sp_iscsi_conn_update - iSCSI connection update
84  *
85  * This ramrod updatess iSCSI ofloadedconnection in FW
86  *
87  * @param p_path
88  * @param p_conn
89  * @param comp_mode
90  * @param comp_addr
91  *
92  * @return enum _ecore_status_t
93  */
94 enum _ecore_status_t
95 ecore_sp_iscsi_conn_update(struct ecore_hwfn *p_hwfn,
96 			   struct ecore_iscsi_conn *p_conn,
97 			   enum spq_mode comp_mode,
98 			   struct ecore_spq_comp_cb *p_comp_addr);
99 
100 /**
101  * @brief ecore_sp_iscsi_mac_update - iSCSI connection's MAC update
102  *
103  * This ramrod updates remote MAC for iSCSI offloaded connection in FW
104  *
105  * @param p_path
106  * @param p_conn
107  * @param comp_mode
108  * @param comp_addr
109  *
110  * @return enum _ecore_status_t
111  */
112 enum _ecore_status_t
113 ecore_sp_iscsi_mac_update(struct ecore_hwfn *p_hwfn,
114 			  struct ecore_iscsi_conn *p_conn,
115 			  enum spq_mode comp_mode,
116 			  struct ecore_spq_comp_cb *p_comp_addr);
117 
118 /**
119  * @brief ecore_sp_iscsi_conn_terminate - iSCSI connection
120  *        terminate
121  *
122  * This ramrod deletes iSCSI offloaded connection in FW
123  *
124  * @param p_path
125  * @param p_conn
126  * @param comp_mode
127  * @param comp_addr
128  *
129  * @return enum _ecore_status_t
130  */
131 enum _ecore_status_t
132 ecore_sp_iscsi_conn_terminate(struct ecore_hwfn *p_hwfn,
133 			      struct ecore_iscsi_conn *p_conn,
134 			      enum spq_mode comp_mode,
135 			      struct ecore_spq_comp_cb *p_comp_addr);
136 
137 /**
138  * @brief ecore_sp_iscsi_conn_clear_sq - iSCSI connection
139  *        clear SQ
140  *
141  * This ramrod clears connection's SQ in FW
142  *
143  * @param p_path
144  * @param p_conn
145  * @param comp_mode
146  * @param comp_addr
147  *
148  * @return enum _ecore_status_t
149  */
150 enum _ecore_status_t
151 ecore_sp_iscsi_conn_clear_sq(struct ecore_hwfn *p_hwfn,
152 			     struct ecore_iscsi_conn *p_conn,
153 			     enum spq_mode comp_mode,
154 			     struct ecore_spq_comp_cb *p_comp_addr);
155 
156 #endif  /*__ECORE_ISCSI_H__*/
157 
158