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]
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.
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
{
54 u32
ecore_cxt_get_proto_cid_count(struct ecore_hwfn
*p_hwfn
,
55 enum protocol_type type
,
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
);
66 * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init
70 * @return enum _ecore_status_t
72 enum _ecore_status_t
ecore_cxt_set_pf_params(struct ecore_hwfn
*p_hwfn
,
76 * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters
81 * @return enum _ecore_status_t
83 enum _ecore_status_t
ecore_cxt_cfg_ilt_compute(struct ecore_hwfn
*p_hwfn
,
87 * @brief ecore_cxt_cfg_ilt_compute_excess - how many lines can be decreased
92 u32
ecore_cxt_cfg_ilt_compute_excess(struct ecore_hwfn
*p_hwfn
, u32 used_lines
);
95 * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct
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
108 void ecore_cxt_mngr_free(struct ecore_hwfn
*p_hwfn
);
111 * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map
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
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.
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.
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
145 void ecore_qm_init_pf(struct ecore_hwfn
*p_hwfn
);
148 * @brief Reconfigures QM pf on the fly
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
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
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
,
179 * @brief ecore_cxt_acquire - Acquire a new cid of a specific protocol type
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
,
192 * @brief _ecore_cxt_acquire - Acquire a new cid of a specific protocol type
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.
215 * @return enum _ecore_status_t
218 ecore_cxt_dynamic_ilt_alloc(struct ecore_hwfn
*p_hwfn
,
219 enum ecore_cxt_elem_type elem_type
,
223 * @brief ecore_cxt_free_ilt_range - function frees ilt pages
224 * associated with the protocol and element type passed.
229 * @return 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
,
243 #endif /* _ECORE_CID_ */