qed: Add slowpath L2 support
[deliverable/linux.git] / drivers / net / ethernet / qlogic / qed / qed_dev_api.h
CommitLineData
fe56b9e6
YM
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_DEV_API_H
10#define _QED_DEV_API_H
11
12#include <linux/types.h>
13#include <linux/kernel.h>
14#include <linux/slab.h>
15#include <linux/qed/qed_chain.h>
16#include <linux/qed/qed_if.h>
17#include "qed_int.h"
18
19/**
20 * @brief qed_init_dp - initialize the debug level
21 *
22 * @param cdev
23 * @param dp_module
24 * @param dp_level
25 */
26void qed_init_dp(struct qed_dev *cdev,
27 u32 dp_module,
28 u8 dp_level);
29
30/**
31 * @brief qed_init_struct - initialize the device structure to
32 * its defaults
33 *
34 * @param cdev
35 */
36void qed_init_struct(struct qed_dev *cdev);
37
38/**
39 * @brief qed_resc_free -
40 *
41 * @param cdev
42 */
43void qed_resc_free(struct qed_dev *cdev);
44
45/**
46 * @brief qed_resc_alloc -
47 *
48 * @param cdev
49 *
50 * @return int
51 */
52int qed_resc_alloc(struct qed_dev *cdev);
53
54/**
55 * @brief qed_resc_setup -
56 *
57 * @param cdev
58 */
59void qed_resc_setup(struct qed_dev *cdev);
60
61/**
62 * @brief qed_hw_init -
63 *
64 * @param cdev
65 * @param b_hw_start
66 * @param int_mode - interrupt mode [msix, inta, etc.] to use.
67 * @param allow_npar_tx_switch - npar tx switching to be used
68 * for vports configured for tx-switching.
69 * @param bin_fw_data - binary fw data pointer in binary fw file.
70 * Pass NULL if not using binary fw file.
71 *
72 * @return int
73 */
74int qed_hw_init(struct qed_dev *cdev,
75 bool b_hw_start,
76 enum qed_int_mode int_mode,
77 bool allow_npar_tx_switch,
78 const u8 *bin_fw_data);
79
80/**
81 * @brief qed_hw_stop -
82 *
83 * @param cdev
84 *
85 * @return int
86 */
87int qed_hw_stop(struct qed_dev *cdev);
88
cee4d264
MC
89/**
90 * @brief qed_hw_stop_fastpath -should be called incase
91 * slowpath is still required for the device,
92 * but fastpath is not.
93 *
94 * @param cdev
95 *
96 */
97void qed_hw_stop_fastpath(struct qed_dev *cdev);
98
99/**
100 * @brief qed_hw_start_fastpath -restart fastpath traffic,
101 * only if hw_stop_fastpath was called
102 *
103 * @param cdev
104 *
105 */
106void qed_hw_start_fastpath(struct qed_hwfn *p_hwfn);
107
fe56b9e6
YM
108/**
109 * @brief qed_hw_reset -
110 *
111 * @param cdev
112 *
113 * @return int
114 */
115int qed_hw_reset(struct qed_dev *cdev);
116
117/**
118 * @brief qed_hw_prepare -
119 *
120 * @param cdev
121 * @param personality - personality to initialize
122 *
123 * @return int
124 */
125int qed_hw_prepare(struct qed_dev *cdev,
126 int personality);
127
128/**
129 * @brief qed_hw_remove -
130 *
131 * @param cdev
132 */
133void qed_hw_remove(struct qed_dev *cdev);
134
135/**
136 * @brief qed_ptt_acquire - Allocate a PTT window
137 *
138 * Should be called at the entry point to the driver (at the beginning of an
139 * exported function)
140 *
141 * @param p_hwfn
142 *
143 * @return struct qed_ptt
144 */
145struct qed_ptt *qed_ptt_acquire(struct qed_hwfn *p_hwfn);
146
147/**
148 * @brief qed_ptt_release - Release PTT Window
149 *
150 * Should be called at the end of a flow - at the end of the function that
151 * acquired the PTT.
152 *
153 *
154 * @param p_hwfn
155 * @param p_ptt
156 */
157void qed_ptt_release(struct qed_hwfn *p_hwfn,
158 struct qed_ptt *p_ptt);
159
160enum qed_dmae_address_type_t {
161 QED_DMAE_ADDRESS_HOST_VIRT,
162 QED_DMAE_ADDRESS_HOST_PHYS,
163 QED_DMAE_ADDRESS_GRC
164};
165
166/* value of flags If QED_DMAE_FLAG_RW_REPL_SRC flag is set and the
167 * source is a block of length DMAE_MAX_RW_SIZE and the
168 * destination is larger, the source block will be duplicated as
169 * many times as required to fill the destination block. This is
170 * used mostly to write a zeroed buffer to destination address
171 * using DMA
172 */
173#define QED_DMAE_FLAG_RW_REPL_SRC 0x00000001
174#define QED_DMAE_FLAG_COMPLETION_DST 0x00000008
175
176struct qed_dmae_params {
177 u32 flags; /* consists of QED_DMAE_FLAG_* values */
178};
179
180/**
181 * @brief qed_dmae_host2grc - copy data from source addr to
182 * dmae registers using the given ptt
183 *
184 * @param p_hwfn
185 * @param p_ptt
186 * @param source_addr
187 * @param grc_addr (dmae_data_offset)
188 * @param size_in_dwords
189 * @param flags (one of the flags defined above)
190 */
191int
192qed_dmae_host2grc(struct qed_hwfn *p_hwfn,
193 struct qed_ptt *p_ptt,
194 u64 source_addr,
195 u32 grc_addr,
196 u32 size_in_dwords,
197 u32 flags);
198
199/**
200 * @brief qed_chain_alloc - Allocate and initialize a chain
201 *
202 * @param p_hwfn
203 * @param intended_use
204 * @param mode
205 * @param num_elems
206 * @param elem_size
207 * @param p_chain
208 *
209 * @return int
210 */
211int
212qed_chain_alloc(struct qed_dev *cdev,
213 enum qed_chain_use_mode intended_use,
214 enum qed_chain_mode mode,
215 u16 num_elems,
216 size_t elem_size,
217 struct qed_chain *p_chain);
218
219/**
220 * @brief qed_chain_free - Free chain DMA memory
221 *
222 * @param p_hwfn
223 * @param p_chain
224 */
225void qed_chain_free(struct qed_dev *cdev,
226 struct qed_chain *p_chain);
227
cee4d264
MC
228/**
229 * @@brief qed_fw_l2_queue - Get absolute L2 queue ID
230 *
231 * @param p_hwfn
232 * @param src_id - relative to p_hwfn
233 * @param dst_id - absolute per engine
234 *
235 * @return int
236 */
237int qed_fw_l2_queue(struct qed_hwfn *p_hwfn,
238 u16 src_id,
239 u16 *dst_id);
240
241/**
242 * @@brief qed_fw_vport - Get absolute vport ID
243 *
244 * @param p_hwfn
245 * @param src_id - relative to p_hwfn
246 * @param dst_id - absolute per engine
247 *
248 * @return int
249 */
250int qed_fw_vport(struct qed_hwfn *p_hwfn,
251 u8 src_id,
252 u8 *dst_id);
253
254/**
255 * @@brief qed_fw_rss_eng - Get absolute RSS engine ID
256 *
257 * @param p_hwfn
258 * @param src_id - relative to p_hwfn
259 * @param dst_id - absolute per engine
260 *
261 * @return int
262 */
263int qed_fw_rss_eng(struct qed_hwfn *p_hwfn,
264 u8 src_id,
265 u8 *dst_id);
266
fe56b9e6
YM
267/**
268 * *@brief Cleanup of previous driver remains prior to load
269 *
270 * @param p_hwfn
271 * @param p_ptt
272 * @param id - For PF, engine-relative. For VF, PF-relative.
273 *
274 * @return int
275 */
276int qed_final_cleanup(struct qed_hwfn *p_hwfn,
277 struct qed_ptt *p_ptt,
278 u16 id);
279
280#endif
This page took 0.033929 seconds and 5 git commands to generate.