9506 Want support for QLogic QL41000/45000 series devices
[unleashed.git] / usr / src / uts / common / io / qede / 579xx / drivers / ecore / ecore_cxt.h
blob81d18c3de5fa57d9ad67f93ce4915060142fcc0d
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
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").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
36 #ifndef _ECORE_CID_
37 #define _ECORE_CID_
39 #include "ecore_hsi_common.h"
40 #include "ecore_proto_if.h"
41 #include "ecore_cxt_api.h"
43 /* Tasks segments definitions */
44 #define ECORE_CXT_ISCSI_TID_SEG PROTOCOLID_ISCSI /* 0 */
45 #define ECORE_CXT_FCOE_TID_SEG PROTOCOLID_FCOE /* 1 */
46 #define ECORE_CXT_ROCE_TID_SEG PROTOCOLID_ROCE /* 2 */
48 enum ecore_cxt_elem_type {
49 ECORE_ELEM_CXT,
50 ECORE_ELEM_SRQ,
51 ECORE_ELEM_TASK
54 u32 ecore_cxt_get_proto_cid_count(struct ecore_hwfn *p_hwfn,
55 enum protocol_type type,
56 u32 *vf_cid);
58 u32 ecore_cxt_get_proto_tid_count(struct ecore_hwfn *p_hwfn,
59 enum protocol_type type);
61 u32 ecore_cxt_get_proto_cid_start(struct ecore_hwfn *p_hwfn,
62 enum protocol_type type);
63 u32 ecore_cxt_get_srq_count(struct ecore_hwfn *p_hwfn);
65 /**
66 * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init
68 * @param p_hwfn
70 * @return enum _ecore_status_t
72 enum _ecore_status_t ecore_cxt_set_pf_params(struct ecore_hwfn *p_hwfn,
73 u32 rdma_tasks);
75 /**
76 * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters
78 * @param p_hwfn
79 * @param last_line
81 * @return enum _ecore_status_t
83 enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn,
84 u32 *last_line);
86 /**
87 * @brief ecore_cxt_cfg_ilt_compute_excess - how many lines can be decreased
89 * @param p_hwfn
90 * @param used_lines
92 u32 ecore_cxt_cfg_ilt_compute_excess(struct ecore_hwfn *p_hwfn, u32 used_lines);
94 /**
95 * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct
97 * @param p_hwfn
99 * @return enum _ecore_status_t
101 enum _ecore_status_t ecore_cxt_mngr_alloc(struct ecore_hwfn *p_hwfn);
104 * @brief ecore_cxt_mngr_free
106 * @param p_hwfn
108 void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn);
111 * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map
113 * @param p_hwfn
115 * @return enum _ecore_status_t
117 enum _ecore_status_t ecore_cxt_tables_alloc(struct ecore_hwfn *p_hwfn);
120 * @brief ecore_cxt_mngr_setup - Reset the acquired CIDs
122 * @param p_hwfn
124 void ecore_cxt_mngr_setup(struct ecore_hwfn *p_hwfn);
127 * @brief ecore_cxt_hw_init_common - Initailze ILT and DQ, common phase, per path.
129 * @param p_hwfn
131 void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn);
134 * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
136 * @param p_hwfn
138 void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn);
141 * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path
143 * @param p_hwfn
145 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn);
148 * @brief Reconfigures QM pf on the fly
150 * @param p_hwfn
151 * @param p_ptt
153 * @return enum _ecore_status_t
155 enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn,
156 struct ecore_ptt *p_ptt);
158 #define ECORE_CXT_PF_CID (0xff)
161 * @brief ecore_cxt_release - Release a cid
163 * @param p_hwfn
164 * @param cid
166 void ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, u32 cid);
169 * @brief ecore_cxt_release - Release a cid belonging to a vf-queue
171 * @param p_hwfn
172 * @param cid
173 * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF
175 void _ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn,
176 u32 cid, u8 vfid);
179 * @brief ecore_cxt_acquire - Acquire a new cid of a specific protocol type
181 * @param p_hwfn
182 * @param type
183 * @param p_cid
185 * @return enum _ecore_status_t
187 enum _ecore_status_t ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn,
188 enum protocol_type type,
189 u32 *p_cid);
192 * @brief _ecore_cxt_acquire - Acquire a new cid of a specific protocol type
193 * for a vf-queue
195 * @param p_hwfn
196 * @param type
197 * @param p_cid
198 * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF
200 * @return enum _ecore_status_t
202 enum _ecore_status_t _ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn,
203 enum protocol_type type,
204 u32 *p_cid, u8 vfid);
207 * @brief ecore_cxt_get_tid_mem_info - function checks if the
208 * page containing the iid in the ilt is already
209 * allocated, if it is not it allocates the page.
211 * @param p_hwfn
212 * @param elem_type
213 * @param iid
215 * @return enum _ecore_status_t
217 enum _ecore_status_t
218 ecore_cxt_dynamic_ilt_alloc(struct ecore_hwfn *p_hwfn,
219 enum ecore_cxt_elem_type elem_type,
220 u32 iid);
223 * @brief ecore_cxt_free_ilt_range - function frees ilt pages
224 * associated with the protocol and element type passed.
226 * @param p_hwfn
227 * @param proto
229 * @return enum _ecore_status_t
231 enum _ecore_status_t
232 ecore_cxt_free_ilt_range(struct ecore_hwfn *p_hwfn,
233 enum ecore_cxt_elem_type elem_type,
234 u32 start_iid, u32 count);
236 #define ECORE_CTX_WORKING_MEM 0
237 #define ECORE_CTX_FL_MEM 1
238 enum _ecore_status_t ecore_cxt_get_task_ctx(struct ecore_hwfn *p_hwfn,
239 u32 tid,
240 u8 ctx_type,
241 void **task_ctx);
243 #endif /* _ECORE_CID_ */