net/qede/base: move code bits
[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 #ifndef LINUX_REMOVE
39 /**
40  * @brief ecore_cxt_qm_iids - fills the cid/tid counts for the QM configuration
41  *
42  * @param p_hwfn
43  * @param iids [out], a structure holding all the counters
44  */
45 void ecore_cxt_qm_iids(struct ecore_hwfn *p_hwfn,
46                        struct ecore_qm_iids *iids);
47 #endif
48
49 /**
50  * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init
51  *
52  * @param p_hwfn
53  *
54  * @return enum _ecore_status_t
55  */
56 enum _ecore_status_t ecore_cxt_set_pf_params(struct ecore_hwfn *p_hwfn);
57
58 /**
59  * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters
60  *
61  * @param p_hwfn
62  *
63  * @return enum _ecore_status_t
64  */
65 enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn);
66
67 /**
68  * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct
69  *
70  * @param p_hwfn
71  *
72  * @return enum _ecore_status_t
73  */
74 enum _ecore_status_t ecore_cxt_mngr_alloc(struct ecore_hwfn *p_hwfn);
75
76 /**
77  * @brief ecore_cxt_mngr_free
78  *
79  * @param p_hwfn
80  */
81 void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn);
82
83 /**
84  * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired
85  *        map
86  *
87  * @param p_hwfn
88  *
89  * @return enum _ecore_status_t
90  */
91 enum _ecore_status_t ecore_cxt_tables_alloc(struct ecore_hwfn *p_hwfn);
92
93 /**
94  * @brief ecore_cxt_mngr_setup - Reset the acquired CIDs
95  *
96  * @param p_hwfn
97  */
98 void ecore_cxt_mngr_setup(struct ecore_hwfn *p_hwfn);
99
100 /**
101  * @brief ecore_cxt_hw_init_common - Initailze ILT and DQ, common phase, per
102  *        path.
103  *
104  * @param p_hwfn
105  */
106 void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn);
107
108 /**
109  * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
110  *
111  * @param p_hwfn
112  */
113 void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn);
114
115 /**
116  * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path
117  *
118  * @param p_hwfn
119  */
120 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn);
121
122  /**
123  * @brief Reconfigures QM pf on the fly
124  *
125  * @param p_hwfn
126  * @param p_ptt
127  *
128  * @return enum _ecore_status_t
129  */
130 enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn,
131                                      struct ecore_ptt *p_ptt);
132
133 /**
134 * @brief ecore_cxt_release - Release a cid
135 *
136 * @param p_hwfn
137 * @param cid
138 */
139 void ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn,
140                            u32 cid);
141
142 /**
143  * @brief ecore_cxt_get_tid_mem_info - function checks if the
144  *        page containing the iid in the ilt is already
145  *        allocated, if it is not it allocates the page.
146  *
147  * @param p_hwfn
148  * @param elem_type
149  * @param iid
150  *
151  * @return enum _ecore_status_t
152  */
153 enum _ecore_status_t
154 ecore_cxt_dynamic_ilt_alloc(struct ecore_hwfn *p_hwfn,
155                             enum ecore_cxt_elem_type elem_type,
156                             u32 iid);
157
158 /**
159  * @brief ecore_cxt_free_proto_ilt - function frees ilt pages
160  *        associated with the protocol passed.
161  *
162  * @param p_hwfn
163  * @param proto
164  *
165  * @return enum _ecore_status_t
166  */
167 enum _ecore_status_t ecore_cxt_free_proto_ilt(struct ecore_hwfn *p_hwfn,
168                                               enum protocol_type proto);
169
170 #define ECORE_CTX_WORKING_MEM 0
171 #define ECORE_CTX_FL_MEM 1
172 enum _ecore_status_t ecore_cxt_get_task_ctx(struct ecore_hwfn *p_hwfn,
173                                             u32 tid,
174                                             u8 ctx_type,
175                                             void **task_ctx);
176
177 #endif /* _ECORE_CID_ */