xref: /f-stack/dpdk/drivers/net/qede/base/ecore_cxt.h (revision 031be553)
1 /*
2  * Copyright (c) 2016 QLogic Corporation.
3  * All rights reserved.
4  * www.qlogic.com
5  *
6  * See LICENSE.qede_pmd for copyright and licensing details.
7  */
8 
9 #ifndef _ECORE_CID_
10 #define _ECORE_CID_
11 
12 #include "ecore_hsi_common.h"
13 #include "ecore_proto_if.h"
14 #include "ecore_cxt_api.h"
15 
16 /* Tasks segments definitions  */
17 #define ECORE_CXT_ISCSI_TID_SEG			PROTOCOLID_ISCSI	/* 0 */
18 #define ECORE_CXT_FCOE_TID_SEG			PROTOCOLID_FCOE		/* 1 */
19 #define ECORE_CXT_ROCE_TID_SEG			PROTOCOLID_ROCE		/* 2 */
20 
21 enum ecore_cxt_elem_type {
22 	ECORE_ELEM_CXT,
23 	ECORE_ELEM_SRQ,
24 	ECORE_ELEM_TASK
25 };
26 
27 u32 ecore_cxt_get_proto_cid_count(struct ecore_hwfn *p_hwfn,
28 				  enum protocol_type type,
29 				  u32 *vf_cid);
30 
31 u32 ecore_cxt_get_proto_tid_count(struct ecore_hwfn *p_hwfn,
32 				  enum protocol_type type);
33 
34 u32 ecore_cxt_get_proto_cid_start(struct ecore_hwfn *p_hwfn,
35 				  enum protocol_type type);
36 u32 ecore_cxt_get_srq_count(struct ecore_hwfn *p_hwfn);
37 
38 /**
39  * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init
40  *
41  * @param p_hwfn
42  *
43  * @return enum _ecore_status_t
44  */
45 enum _ecore_status_t ecore_cxt_set_pf_params(struct ecore_hwfn *p_hwfn);
46 
47 /**
48  * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters
49  *
50  * @param p_hwfn
51  *
52  * @return enum _ecore_status_t
53  */
54 enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn);
55 
56 /**
57  * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct
58  *
59  * @param p_hwfn
60  *
61  * @return enum _ecore_status_t
62  */
63 enum _ecore_status_t ecore_cxt_mngr_alloc(struct ecore_hwfn *p_hwfn);
64 
65 /**
66  * @brief ecore_cxt_mngr_free
67  *
68  * @param p_hwfn
69  */
70 void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn);
71 
72 /**
73  * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired
74  *        map
75  *
76  * @param p_hwfn
77  *
78  * @return enum _ecore_status_t
79  */
80 enum _ecore_status_t ecore_cxt_tables_alloc(struct ecore_hwfn *p_hwfn);
81 
82 /**
83  * @brief ecore_cxt_mngr_setup - Reset the acquired CIDs
84  *
85  * @param p_hwfn
86  */
87 void ecore_cxt_mngr_setup(struct ecore_hwfn *p_hwfn);
88 
89 /**
90  * @brief ecore_cxt_hw_init_common - Initailze ILT and DQ, common phase, per
91  *        path.
92  *
93  * @param p_hwfn
94  */
95 void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn);
96 
97 /**
98  * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
99  *
100  * @param p_hwfn
101  * @param p_ptt
102  */
103 void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
104 
105 /**
106  * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path
107  *
108  * @param p_hwfn
109  * @param p_ptt
110  */
111 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
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