1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright (c) 2016 - 2018 Cavium Inc. 3 * All rights reserved. 4 * www.cavium.com 5 */ 6 7 #ifndef _ECORE_CID_ 8 #define _ECORE_CID_ 9 10 #include "ecore_hsi_common.h" 11 #include "ecore_proto_if.h" 12 #include "ecore_cxt_api.h" 13 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 */ 18 19 enum ecore_cxt_elem_type { 20 ECORE_ELEM_CXT, 21 ECORE_ELEM_SRQ, 22 ECORE_ELEM_TASK 23 }; 24 25 u32 ecore_cxt_get_proto_cid_count(struct ecore_hwfn *p_hwfn, 26 enum protocol_type type, 27 u32 *vf_cid); 28 29 u32 ecore_cxt_get_proto_tid_count(struct ecore_hwfn *p_hwfn, 30 enum protocol_type type); 31 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); 35 36 /** 37 * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init 38 * 39 * @param p_hwfn 40 * 41 * @return enum _ecore_status_t 42 */ 43 enum _ecore_status_t ecore_cxt_set_pf_params(struct ecore_hwfn *p_hwfn); 44 45 /** 46 * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters 47 * 48 * @param p_hwfn 49 * 50 * @return enum _ecore_status_t 51 */ 52 enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn); 53 54 /** 55 * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct 56 * 57 * @param p_hwfn 58 * 59 * @return enum _ecore_status_t 60 */ 61 enum _ecore_status_t ecore_cxt_mngr_alloc(struct ecore_hwfn *p_hwfn); 62 63 /** 64 * @brief ecore_cxt_mngr_free 65 * 66 * @param p_hwfn 67 */ 68 void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn); 69 70 /** 71 * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired 72 * map 73 * 74 * @param p_hwfn 75 * 76 * @return enum _ecore_status_t 77 */ 78 enum _ecore_status_t ecore_cxt_tables_alloc(struct ecore_hwfn *p_hwfn); 79 80 /** 81 * @brief ecore_cxt_mngr_setup - Reset the acquired CIDs 82 * 83 * @param p_hwfn 84 */ 85 void ecore_cxt_mngr_setup(struct ecore_hwfn *p_hwfn); 86 87 /** 88 * @brief ecore_cxt_hw_init_common - Initailze ILT and DQ, common phase, per 89 * path. 90 * 91 * @param p_hwfn 92 */ 93 void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn); 94 95 /** 96 * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path. 97 * 98 * @param p_hwfn 99 * @param p_ptt 100 */ 101 void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt); 102 103 /** 104 * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path 105 * 106 * @param p_hwfn 107 * @param p_ptt 108 * @param is_pf_loading 109 */ 110 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, 111 bool is_pf_loading); 112 113 /** 114 * @brief Reconfigures QM pf on the fly 115 * 116 * @param p_hwfn 117 * @param p_ptt 118 * 119 * @return enum _ecore_status_t 120 */ 121 enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn, 122 struct ecore_ptt *p_ptt); 123 124 #define ECORE_CXT_PF_CID (0xff) 125 126 /** 127 * @brief ecore_cxt_release - Release a cid 128 * 129 * @param p_hwfn 130 * @param cid 131 */ 132 void ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, u32 cid); 133 134 /** 135 * @brief ecore_cxt_release - Release a cid belonging to a vf-queue 136 * 137 * @param p_hwfn 138 * @param cid 139 * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF 140 */ 141 void _ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, 142 u32 cid, u8 vfid); 143 144 /** 145 * @brief ecore_cxt_acquire - Acquire a new cid of a specific protocol type 146 * 147 * @param p_hwfn 148 * @param type 149 * @param p_cid 150 * 151 * @return enum _ecore_status_t 152 */ 153 enum _ecore_status_t ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn, 154 enum protocol_type type, 155 u32 *p_cid); 156 157 /** 158 * @brief _ecore_cxt_acquire - Acquire a new cid of a specific protocol type 159 * for a vf-queue 160 * 161 * @param p_hwfn 162 * @param type 163 * @param p_cid 164 * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF 165 * 166 * @return enum _ecore_status_t 167 */ 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); 171 172 /** 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. 176 * 177 * @param p_hwfn 178 * @param elem_type 179 * @param iid 180 * 181 * @return enum _ecore_status_t 182 */ 183 enum _ecore_status_t 184 ecore_cxt_dynamic_ilt_alloc(struct ecore_hwfn *p_hwfn, 185 enum ecore_cxt_elem_type elem_type, 186 u32 iid); 187 188 /** 189 * @brief ecore_cxt_free_proto_ilt - function frees ilt pages 190 * associated with the protocol passed. 191 * 192 * @param p_hwfn 193 * @param proto 194 * 195 * @return enum _ecore_status_t 196 */ 197 enum _ecore_status_t ecore_cxt_free_proto_ilt(struct ecore_hwfn *p_hwfn, 198 enum protocol_type proto); 199 200 #define ECORE_CTX_WORKING_MEM 0 201 #define ECORE_CTX_FL_MEM 1 202 203 #endif /* _ECORE_CID_ */ 204