net/qede/base: upgrade FW to 8.33.12.0
[dpdk.git] / drivers / net / qede / base / ecore_cxt.h
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  * @param is_pf_loading
111  */
112 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
113                       bool is_pf_loading);
114
115  /**
116  * @brief Reconfigures QM pf on the fly
117  *
118  * @param p_hwfn
119  * @param p_ptt
120  *
121  * @return enum _ecore_status_t
122  */
123 enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn,
124                                      struct ecore_ptt *p_ptt);
125
126 #define ECORE_CXT_PF_CID (0xff)
127
128 /**
129  * @brief ecore_cxt_release - Release a cid
130  *
131  * @param p_hwfn
132  * @param cid
133  */
134 void ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, u32 cid);
135
136 /**
137  * @brief ecore_cxt_release - Release a cid belonging to a vf-queue
138  *
139  * @param p_hwfn
140  * @param cid
141  * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF
142  */
143 void _ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn,
144                             u32 cid, u8 vfid);
145
146 /**
147  * @brief ecore_cxt_acquire - Acquire a new cid of a specific protocol type
148  *
149  * @param p_hwfn
150  * @param type
151  * @param p_cid
152  *
153  * @return enum _ecore_status_t
154  */
155 enum _ecore_status_t ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn,
156                                            enum protocol_type type,
157                                            u32 *p_cid);
158
159 /**
160  * @brief _ecore_cxt_acquire - Acquire a new cid of a specific protocol type
161  *                             for a vf-queue
162  *
163  * @param p_hwfn
164  * @param type
165  * @param p_cid
166  * @param vfid - engine relative index. ECORE_CXT_PF_CID if belongs to PF
167  *
168  * @return enum _ecore_status_t
169  */
170 enum _ecore_status_t _ecore_cxt_acquire_cid(struct ecore_hwfn *p_hwfn,
171                                             enum protocol_type type,
172                                             u32 *p_cid, u8 vfid);
173
174 /**
175  * @brief ecore_cxt_get_tid_mem_info - function checks if the
176  *        page containing the iid in the ilt is already
177  *        allocated, if it is not it allocates the page.
178  *
179  * @param p_hwfn
180  * @param elem_type
181  * @param iid
182  *
183  * @return enum _ecore_status_t
184  */
185 enum _ecore_status_t
186 ecore_cxt_dynamic_ilt_alloc(struct ecore_hwfn *p_hwfn,
187                             enum ecore_cxt_elem_type elem_type,
188                             u32 iid);
189
190 /**
191  * @brief ecore_cxt_free_proto_ilt - function frees ilt pages
192  *        associated with the protocol passed.
193  *
194  * @param p_hwfn
195  * @param proto
196  *
197  * @return enum _ecore_status_t
198  */
199 enum _ecore_status_t ecore_cxt_free_proto_ilt(struct ecore_hwfn *p_hwfn,
200                                               enum protocol_type proto);
201
202 #define ECORE_CTX_WORKING_MEM 0
203 #define ECORE_CTX_FL_MEM 1
204
205 #endif /* _ECORE_CID_ */