Imported Upstream version 16.07-rc1
[deb_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 enum ecore_cxt_elem_type {
17         ECORE_ELEM_CXT,
18         ECORE_ELEM_TASK
19 };
20
21 u32 ecore_cxt_get_proto_cid_count(struct ecore_hwfn *p_hwfn,
22                                   enum protocol_type type, u32 *vf_cid);
23
24 u32 ecore_cxt_get_proto_cid_start(struct ecore_hwfn *p_hwfn,
25                                   enum protocol_type type);
26
27 /**
28  * @brief ecore_cxt_qm_iids - fills the cid/tid counts for the QM configuration
29  *
30  * @param p_hwfn
31  * @param iids [out], a structure holding all the counters
32  */
33 void ecore_cxt_qm_iids(struct ecore_hwfn *p_hwfn, struct ecore_qm_iids *iids);
34
35 /**
36  * @brief ecore_cxt_set_pf_params - Set the PF params for cxt init
37  *
38  * @param p_hwfn
39  *
40  * @return enum _ecore_status_t
41  */
42 enum _ecore_status_t ecore_cxt_set_pf_params(struct ecore_hwfn *p_hwfn);
43
44 /**
45  * @brief ecore_cxt_set_proto_cid_count - Set the max cids per protocol for cxt
46  *        init
47  *
48  * @param p_hwfn
49  * @param type
50  * @param cid_cnt - number of pf cids
51  * @param vf_cid_cnt - number of vf cids
52  */
53 void ecore_cxt_set_proto_cid_count(struct ecore_hwfn *p_hwfn,
54                                    enum protocol_type type,
55                                    u32 cid_cnt, u32 vf_cid_cnt);
56 /**
57  * @brief ecore_cxt_cfg_ilt_compute - compute ILT init parameters
58  *
59  * @param p_hwfn
60  *
61  * @return enum _ecore_status_t
62  */
63 enum _ecore_status_t ecore_cxt_cfg_ilt_compute(struct ecore_hwfn *p_hwfn);
64
65 /**
66  * @brief ecore_cxt_mngr_alloc - Allocate and init the context manager struct
67  *
68  * @param p_hwfn
69  *
70  * @return enum _ecore_status_t
71  */
72 enum _ecore_status_t ecore_cxt_mngr_alloc(struct ecore_hwfn *p_hwfn);
73
74 /**
75  * @brief ecore_cxt_mngr_free
76  *
77  * @param p_hwfn
78  */
79 void ecore_cxt_mngr_free(struct ecore_hwfn *p_hwfn);
80
81 /**
82  * @brief ecore_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired
83  *        map
84  *
85  * @param p_hwfn
86  *
87  * @return enum _ecore_status_t
88  */
89 enum _ecore_status_t ecore_cxt_tables_alloc(struct ecore_hwfn *p_hwfn);
90
91 /**
92  * @brief ecore_cxt_mngr_setup - Reset the acquired CIDs
93  *
94  * @param p_hwfn
95  */
96 void ecore_cxt_mngr_setup(struct ecore_hwfn *p_hwfn);
97
98 /**
99  * @brief ecore_cxt_hw_init_common - Initailze ILT and DQ, common phase, per
100  *        path.
101  *
102  * @param p_hwfn
103  */
104 void ecore_cxt_hw_init_common(struct ecore_hwfn *p_hwfn);
105
106 /**
107  * @brief ecore_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
108  *
109  * @param p_hwfn
110  */
111 void ecore_cxt_hw_init_pf(struct ecore_hwfn *p_hwfn);
112
113 /**
114  * @brief ecore_qm_init_pf - Initailze the QM PF phase, per path
115  *
116  * @param p_hwfn
117  */
118 void ecore_qm_init_pf(struct ecore_hwfn *p_hwfn);
119
120  /**
121  * @brief Reconfigures QM pf on the fly
122  *
123  * @param p_hwfn
124  * @param p_ptt
125  *
126  * @return enum _ecore_status_t
127  */
128 enum _ecore_status_t ecore_qm_reconf(struct ecore_hwfn *p_hwfn,
129                                      struct ecore_ptt *p_ptt);
130
131 /**
132 * @brief ecore_cxt_release - Release a cid
133 *
134 * @param p_hwfn
135 * @param cid
136 */
137 void ecore_cxt_release_cid(struct ecore_hwfn *p_hwfn, u32 cid);
138
139 /**
140  * @brief ecore_cxt_free_proto_ilt - function frees ilt pages
141  *        associated with the protocol passed.
142  *
143  * @param p_hwfn
144  * @param proto
145  *
146  * @return enum _ecore_status_t
147  */
148 enum _ecore_status_t ecore_cxt_free_proto_ilt(struct ecore_hwfn *p_hwfn,
149                                               enum protocol_type proto);
150
151 #define ECORE_CTX_WORKING_MEM 0
152 #define ECORE_CTX_FL_MEM 1
153 enum _ecore_status_t ecore_cxt_get_task_ctx(struct ecore_hwfn *p_hwfn,
154                                             u32 tid,
155                                             u8 ctx_type, void **task_ctx);
156
157 #endif /* _ECORE_CID_ */