xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_iscsi.h (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1 /*
2  * Copyright (c) 2017-2018 Cavium, Inc.
3  * All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions
7  *  are met:
8  *
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.
14  *
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.
26  *
27  */
28 
29 #ifndef __ECORE_ISCSI_H__
30 #define __ECORE_ISCSI_H__
31 
32 #include "ecore.h"
33 #include "ecore_chain.h"
34 #include "ecore_hsi_common.h"
35 #include "tcp_common.h"
36 #include "ecore_hsi_iscsi.h"
37 #include "ecore_sp_commands.h"
38 #include "ecore_iscsi_api.h"
39 
40 #ifndef __EXTRACT__LINUX__H__
41 struct ecore_iscsi_info {
42 	osal_spinlock_t	 lock;
43 	osal_list_t	 free_list;
44 	u16		 max_num_outstanding_tasks;
45 	void		 *event_context;
46 	iscsi_event_cb_t event_cb;
47 };
48 
49 #ifdef CONFIG_ECORE_ISCSI
50 enum _ecore_status_t ecore_iscsi_alloc(struct ecore_hwfn *p_hwfn);
51 
52 void ecore_iscsi_setup(struct ecore_hwfn *p_hwfn);
53 
54 void ecore_iscsi_free(struct ecore_hwfn *p_hwfn);
55 #else
56 static inline enum _ecore_status_t
57 ecore_iscsi_alloc(struct ecore_hwfn OSAL_UNUSED *p_hwfn)
58 {
59 	return ECORE_INVAL;
60 }
61 
62 static inline void
63 ecore_iscsi_setup(struct ecore_hwfn OSAL_UNUSED *p_hwfn) {}
64 
65 static inline void
66 ecore_iscsi_free(struct ecore_hwfn OSAL_UNUSED *p_hwfn) {}
67 #endif
68 #endif
69 
70 void ecore_iscsi_free_connection(struct ecore_hwfn *p_hwfn,
71 				 struct ecore_iscsi_conn *p_conn);
72 
73 /**
74  * @brief ecore_sp_iscsi_conn_offload - iSCSI connection offload
75  *
76  * This ramrod offloads iSCSI connection to FW
77  *
78  * @param p_path
79  * @param p_conn
80  * @param comp_mode
81  * @param comp_addr
82  *
83  * @return enum _ecore_status_t
84  */
85 enum _ecore_status_t
86 ecore_sp_iscsi_conn_offload(struct ecore_hwfn *p_hwfn,
87 			    struct ecore_iscsi_conn *p_conn,
88 			    enum spq_mode comp_mode,
89 			    struct ecore_spq_comp_cb *p_comp_addr);
90 
91 /**
92  * @brief ecore_sp_iscsi_conn_update - iSCSI connection update
93  *
94  * This ramrod updatess iSCSI ofloadedconnection in FW
95  *
96  * @param p_path
97  * @param p_conn
98  * @param comp_mode
99  * @param comp_addr
100  *
101  * @return enum _ecore_status_t
102  */
103 enum _ecore_status_t
104 ecore_sp_iscsi_conn_update(struct ecore_hwfn *p_hwfn,
105 			   struct ecore_iscsi_conn *p_conn,
106 			   enum spq_mode comp_mode,
107 			   struct ecore_spq_comp_cb *p_comp_addr);
108 
109 /**
110  * @brief ecore_sp_iscsi_mac_update - iSCSI connection's MAC update
111  *
112  * This ramrod updates remote MAC for iSCSI offloaded connection in FW
113  *
114  * @param p_path
115  * @param p_conn
116  * @param comp_mode
117  * @param comp_addr
118  *
119  * @return enum _ecore_status_t
120  */
121 enum _ecore_status_t
122 ecore_sp_iscsi_mac_update(struct ecore_hwfn *p_hwfn,
123 			  struct ecore_iscsi_conn *p_conn,
124 			  enum spq_mode comp_mode,
125 			  struct ecore_spq_comp_cb *p_comp_addr);
126 
127   /**
128  * @brief ecore_sp_iscsi_mac_update - iSCSI connection's MAC update
129  *
130  * This ramrod updates remote MAC for iSCSI offloaded connection in FW
131  *
132  * @param p_path
133  * @param p_conn
134  * @param reset
135  * @param comp_mode
136  * @param comp_addr
137  *
138  * @return enum _ecore_status_t
139  */
140 enum _ecore_status_t
141 ecore_sp_iscsi_stats_tcp_update(struct ecore_hwfn *p_hwfn,
142 				struct ecore_iscsi_conn *p_conn,
143 				bool reset,
144 				enum spq_mode comp_mode,
145 				struct ecore_spq_comp_cb *p_comp_addr);
146 
147 /**
148  * @brief ecore_sp_iscsi_conn_terminate - iSCSI connection
149  *        terminate
150  *
151  * This ramrod deletes iSCSI offloaded connection in FW
152  *
153  * @param p_path
154  * @param p_conn
155  * @param comp_mode
156  * @param comp_addr
157  *
158  * @return enum _ecore_status_t
159  */
160 enum _ecore_status_t
161 ecore_sp_iscsi_conn_terminate(struct ecore_hwfn *p_hwfn,
162 			      struct ecore_iscsi_conn *p_conn,
163 			      enum spq_mode comp_mode,
164 			      struct ecore_spq_comp_cb *p_comp_addr);
165 
166 /**
167  * @brief ecore_sp_iscsi_conn_clear_sq - iSCSI connection
168  *        clear SQ
169  *
170  * This ramrod clears connection's SQ in FW
171  *
172  * @param p_path
173  * @param p_conn
174  * @param comp_mode
175  * @param comp_addr
176  *
177  * @return enum _ecore_status_t
178  */
179 enum _ecore_status_t
180 ecore_sp_iscsi_conn_clear_sq(struct ecore_hwfn *p_hwfn,
181 			     struct ecore_iscsi_conn *p_conn,
182 			     enum spq_mode comp_mode,
183 			     struct ecore_spq_comp_cb *p_comp_addr);
184 
185 #endif  /*__ECORE_ISCSI_H__*/
186