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_CID_ 37 #define _ECORE_CID_ 38 39 #include "ecore_hsi_common.h" 40 #include "ecore_proto_if.h" 41 #include "ecore_cxt_api.h" 42 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 */ 47 48 enum ecore_cxt_elem_type { 49 ECORE_ELEM_CXT, 50 ECORE_ELEM_SRQ, 51 ECORE_ELEM_TASK 52 }; 53 54 u32 ecore_cxt_get_proto_cid_count(struct ecore_hwfn *p_hwfn, 55 enum protocol_type type, 56 u32 *vf_cid); 57 58 u32 ecore_cxt_get_proto_tid_count(struct ecore_hwfn *p_hwfn, 59 enum protocol_type type); 60 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); 64 65 /** 66 * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init 67 * 68 * @param p_hwfn 69 * 70 * @return enum _ecore_status_t 71 */ 72 enum _ecore_status_t ecore_cxt_set_pf_params(struct ecore_hwfn *p_hwfn, 73 u32 rdma_tasks); 74 75 /** 76 * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters 77 * 78 * @param p_hwfn 79 * @param last_line 80 * 81 * @return enum _ecore_status_t 82 */ 83 enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn, 84 u32 *last_line); 85 86 /** 87 * @brief ecore_cxt_cfg_ilt_compute_excess - how many lines can be decreased 88 * 89 * @param p_hwfn 90 * @param used_lines 91 */ 92 u32 ecore_cxt_cfg_ilt_compute_excess(struct ecore_hwfn *p_hwfn, u32 used_lines); 93 94 /** 95 * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct 96 * 97 * @param p_hwfn 98 * 99 * @return enum _ecore_status_t 100 */ 101 enum _ecore_status_t ecore_cxt_mngr_alloc(struct ecore_hwfn *p_hwfn); 102 103 /** 104 * @brief ecore_cxt_mngr_free 105 * 106 * @param p_hwfn 107 */ 108 void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn); 109 110 /** 111 * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map 112 * 113 * @param p_hwfn 114 * 115 * @return enum _ecore_status_t 116 */ 117 enum _ecore_status_t ecore_cxt_tables_alloc(struct ecore_hwfn *p_hwfn); 118 119 /** 120 * @brief ecore_cxt_mngr_setup - Reset the acquired CIDs 121 * 122 * @param p_hwfn 123 */ 124 void ecore_cxt_mngr_setup(struct ecore_hwfn *p_hwfn); 125 126 /** 127 * @brief ecore_cxt_hw_init_common - Initailze ILT and DQ, common phase, per path. 128 * 129 * @param p_hwfn 130 */ 131 void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn); 132 133 /** 134 * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path. 135 * 136 * @param p_hwfn 137 */ 138 void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn); 139 140 /** 141 * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path 142 * 143 * @param p_hwfn 144 */ 145 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn); 146 147 /** 148 * @brief Reconfigures QM pf on the fly 149 * 150 * @param p_hwfn 151 * @param p_ptt 152 * 153 * @return enum _ecore_status_t 154 */ 155 enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn, 156 struct ecore_ptt *p_ptt); 157 158 #define ECORE_CXT_PF_CID (0xff) 159 160 /** 161 * @brief ecore_cxt_release - Release a cid 162 * 163 * @param p_hwfn 164 * @param cid 165 */ 166 void ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, u32 cid); 167 168 /** 169 * @brief ecore_cxt_release - Release a cid belonging to a vf-queue 170 * 171 * @param p_hwfn 172 * @param cid 173 * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF 174 */ 175 void _ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, 176 u32 cid, u8 vfid); 177 178 /** 179 * @brief ecore_cxt_acquire - Acquire a new cid of a specific protocol type 180 * 181 * @param p_hwfn 182 * @param type 183 * @param p_cid 184 * 185 * @return enum _ecore_status_t 186 */ 187 enum _ecore_status_t ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn, 188 enum protocol_type type, 189 u32 *p_cid); 190 191 /** 192 * @brief _ecore_cxt_acquire - Acquire a new cid of a specific protocol type 193 * for a vf-queue 194 * 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 199 * 200 * @return enum _ecore_status_t 201 */ 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); 205 206 /** 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. 210 * 211 * @param p_hwfn 212 * @param elem_type 213 * @param iid 214 * 215 * @return enum _ecore_status_t 216 */ 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); 221 222 /** 223 * @brief ecore_cxt_free_ilt_range - function frees ilt pages 224 * associated with the protocol and element type passed. 225 * 226 * @param p_hwfn 227 * @param proto 228 * 229 * @return enum _ecore_status_t 230 */ 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); 235 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); 242 243 #endif /* _ECORE_CID_ */ 244