1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
10 #include "ecore_hsi_common.h"
11 #include "ecore_proto_if.h"
12 #include "ecore_cxt_api.h"
14 /* Tasks segments definitions */
15 #define ECORE_CXT_ISCSI_TID_SEG PROTOCOLID_ISCSI /* 0 */
16 #define ECORE_CXT_FCOE_TID_SEG PROTOCOLID_FCOE /* 1 */
17 #define ECORE_CXT_ROCE_TID_SEG PROTOCOLID_ROCE /* 2 */
19 enum ecore_cxt_elem_type {
25 u32 ecore_cxt_get_proto_cid_count(struct ecore_hwfn *p_hwfn,
26 enum protocol_type type,
29 u32 ecore_cxt_get_proto_tid_count(struct ecore_hwfn *p_hwfn,
30 enum protocol_type type);
32 u32 ecore_cxt_get_proto_cid_start(struct ecore_hwfn *p_hwfn,
33 enum protocol_type type);
34 u32 ecore_cxt_get_srq_count(struct ecore_hwfn *p_hwfn);
37 * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init
41 * @return enum _ecore_status_t
43 enum _ecore_status_t ecore_cxt_set_pf_params(struct ecore_hwfn *p_hwfn);
46 * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters
50 * @return enum _ecore_status_t
52 enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn);
55 * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct
59 * @return enum _ecore_status_t
61 enum _ecore_status_t ecore_cxt_mngr_alloc(struct ecore_hwfn *p_hwfn);
64 * @brief ecore_cxt_mngr_free
68 void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn);
71 * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired
76 * @return enum _ecore_status_t
78 enum _ecore_status_t ecore_cxt_tables_alloc(struct ecore_hwfn *p_hwfn);
81 * @brief ecore_cxt_mngr_setup - Reset the acquired CIDs
85 void ecore_cxt_mngr_setup(struct ecore_hwfn *p_hwfn);
88 * @brief ecore_cxt_hw_init_common - Initailze ILT and DQ, common phase, per
93 void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn);
96 * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
101 void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
104 * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path
108 * @param is_pf_loading
110 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
114 * @brief Reconfigures QM pf on the fly
119 * @return enum _ecore_status_t
121 enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn,
122 struct ecore_ptt *p_ptt);
124 #define ECORE_CXT_PF_CID (0xff)
127 * @brief ecore_cxt_release - Release a cid
132 void ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, u32 cid);
135 * @brief ecore_cxt_release - Release a cid belonging to a vf-queue
139 * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF
141 void _ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn,
145 * @brief ecore_cxt_acquire - Acquire a new cid of a specific protocol type
151 * @return enum _ecore_status_t
153 enum _ecore_status_t ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn,
154 enum protocol_type type,
158 * @brief _ecore_cxt_acquire - Acquire a new cid of a specific protocol type
164 * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF
166 * @return enum _ecore_status_t
168 enum _ecore_status_t _ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn,
169 enum protocol_type type,
170 u32 *p_cid, u8 vfid);
173 * @brief ecore_cxt_get_tid_mem_info - function checks if the
174 * page containing the iid in the ilt is already
175 * allocated, if it is not it allocates the page.
181 * @return enum _ecore_status_t
184 ecore_cxt_dynamic_ilt_alloc(struct ecore_hwfn *p_hwfn,
185 enum ecore_cxt_elem_type elem_type,
189 * @brief ecore_cxt_free_proto_ilt - function frees ilt pages
190 * associated with the protocol passed.
195 * @return enum _ecore_status_t
197 enum _ecore_status_t ecore_cxt_free_proto_ilt(struct ecore_hwfn *p_hwfn,
198 enum protocol_type proto);
200 #define ECORE_CTX_WORKING_MEM 0
201 #define ECORE_CTX_FL_MEM 1
203 #endif /* _ECORE_CID_ */