Merge tag 'armsoc-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[sfrench/cifs-2.6.git] / drivers / net / ethernet / qlogic / qed / qed_cxt.h
1 /* QLogic qed NIC Driver
2  * Copyright (c) 2015 QLogic Corporation
3  *
4  * This software is available under the terms of the GNU General Public License
5  * (GPL) Version 2, available from the file COPYING in the main directory of
6  * this source tree.
7  */
8
9 #ifndef _QED_CXT_H
10 #define _QED_CXT_H
11
12 #include <linux/types.h>
13 #include <linux/slab.h>
14 #include <linux/qed/qed_if.h>
15 #include "qed_hsi.h"
16 #include "qed.h"
17
18 struct qed_cxt_info {
19         void                    *p_cxt;
20         u32                     iid;
21         enum protocol_type      type;
22 };
23
24 /**
25  * @brief qed_cxt_acquire - Acquire a new cid of a specific protocol type
26  *
27  * @param p_hwfn
28  * @param type
29  * @param p_cid
30  *
31  * @return int
32  */
33 int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn,
34                         enum protocol_type type,
35                         u32 *p_cid);
36
37 /**
38  * @brief qedo_cid_get_cxt_info - Returns the context info for a specific cid
39  *
40  *
41  * @param p_hwfn
42  * @param p_info in/out
43  *
44  * @return int
45  */
46 int qed_cxt_get_cid_info(struct qed_hwfn *p_hwfn,
47                          struct qed_cxt_info *p_info);
48
49 enum qed_cxt_elem_type {
50         QED_ELEM_CXT,
51         QED_ELEM_TASK
52 };
53
54 u32 qed_cxt_get_proto_cid_count(struct qed_hwfn *p_hwfn,
55                                 enum protocol_type type, u32 *vf_cid);
56
57 /**
58  * @brief qed_cxt_set_pf_params - Set the PF params for cxt init
59  *
60  * @param p_hwfn
61  *
62  * @return int
63  */
64 int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn);
65
66 /**
67  * @brief qed_cxt_cfg_ilt_compute - compute ILT init parameters
68  *
69  * @param p_hwfn
70  *
71  * @return int
72  */
73 int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn);
74
75 /**
76  * @brief qed_cxt_mngr_alloc - Allocate and init the context manager struct
77  *
78  * @param p_hwfn
79  *
80  * @return int
81  */
82 int qed_cxt_mngr_alloc(struct qed_hwfn *p_hwfn);
83
84 /**
85  * @brief qed_cxt_mngr_free
86  *
87  * @param p_hwfn
88  */
89 void qed_cxt_mngr_free(struct qed_hwfn *p_hwfn);
90
91 /**
92  * @brief qed_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map
93  *
94  * @param p_hwfn
95  *
96  * @return int
97  */
98 int qed_cxt_tables_alloc(struct qed_hwfn *p_hwfn);
99
100 /**
101  * @brief qed_cxt_mngr_setup - Reset the acquired CIDs
102  *
103  * @param p_hwfn
104  */
105 void qed_cxt_mngr_setup(struct qed_hwfn *p_hwfn);
106
107 /**
108  * @brief qed_cxt_hw_init_common - Initailze ILT and DQ, common phase, per path.
109  *
110  *
111  *
112  * @param p_hwfn
113  */
114 void qed_cxt_hw_init_common(struct qed_hwfn *p_hwfn);
115
116 /**
117  * @brief qed_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
118  *
119  *
120  *
121  * @param p_hwfn
122  */
123 void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn);
124
125 /**
126  * @brief qed_qm_init_pf - Initailze the QM PF phase, per path
127  *
128  * @param p_hwfn
129  */
130
131 void qed_qm_init_pf(struct qed_hwfn *p_hwfn);
132
133 /**
134  * @brief Reconfigures QM pf on the fly
135  *
136  * @param p_hwfn
137  * @param p_ptt
138  *
139  * @return int
140  */
141 int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
142
143 /**
144  * @brief qed_cxt_release - Release a cid
145  *
146  * @param p_hwfn
147  * @param cid
148  */
149 void qed_cxt_release_cid(struct qed_hwfn *p_hwfn,
150                          u32 cid);
151
152 #endif