Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
  2/* QLogic qed NIC Driver
  3 * Copyright (c) 2015-2017  QLogic Corporation
  4 * Copyright (c) 2019-2020 Marvell International Ltd.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
  5 */
  6
  7#ifndef _QED_DEV_API_H
  8#define _QED_DEV_API_H
  9
 10#include <linux/types.h>
 11#include <linux/kernel.h>
 12#include <linux/slab.h>
 13#include <linux/qed/qed_chain.h>
 14#include <linux/qed/qed_if.h>
 15#include "qed_int.h"
 16
 17/**
 18 * qed_init_dp(): Initialize the debug level.
 19 *
 20 * @cdev: Qed dev pointer.
 21 * @dp_module: Module debug parameter.
 22 * @dp_level: Module debug level.
 23 *
 24 * Return: Void.
 
 
 25 */
 26void qed_init_dp(struct qed_dev *cdev,
 27		 u32 dp_module,
 28		 u8 dp_level);
 29
 30/**
 31 * qed_init_struct(): Initialize the device structure to
 32 *                    its defaults.
 33 *
 34 * @cdev: Qed dev pointer.
 35 *
 36 * Return: Void.
 37 */
 38void qed_init_struct(struct qed_dev *cdev);
 39
 40/**
 41 * qed_resc_free: Free device resources.
 42 *
 43 * @cdev: Qed dev pointer.
 44 *
 45 * Return: Void.
 46 */
 47void qed_resc_free(struct qed_dev *cdev);
 48
 49/**
 50 * qed_resc_alloc(): Alloc device resources.
 51 *
 52 * @cdev: Qed dev pointer.
 53 *
 54 * Return: Int.
 55 */
 56int qed_resc_alloc(struct qed_dev *cdev);
 57
 58/**
 59 * qed_resc_setup(): Setup device resources.
 60 *
 61 * @cdev: Qed dev pointer.
 62 *
 63 * Return: Void.
 64 */
 65void qed_resc_setup(struct qed_dev *cdev);
 66
 67enum qed_override_force_load {
 68	QED_OVERRIDE_FORCE_LOAD_NONE,
 69	QED_OVERRIDE_FORCE_LOAD_ALWAYS,
 70	QED_OVERRIDE_FORCE_LOAD_NEVER,
 71};
 72
 73struct qed_drv_load_params {
 74	/* Indicates whether the driver is running over a crash kernel.
 75	 * As part of the load request, this will be used for providing the
 76	 * driver role to the MFW.
 77	 * In case of a crash kernel over PDA - this should be set to false.
 78	 */
 79	bool is_crash_kernel;
 80
 81	/* The timeout value that the MFW should use when locking the engine for
 82	 * the driver load process.
 83	 * A value of '0' means the default value, and '255' means no timeout.
 84	 */
 85	u8 mfw_timeout_val;
 86#define QED_LOAD_REQ_LOCK_TO_DEFAULT    0
 87#define QED_LOAD_REQ_LOCK_TO_NONE       255
 88
 89	/* Avoid engine reset when first PF loads on it */
 90	bool avoid_eng_reset;
 91
 92	/* Allow overriding the default force load behavior */
 93	enum qed_override_force_load override_force_load;
 94};
 95
 96struct qed_hw_init_params {
 97	/* Tunneling parameters */
 98	struct qed_tunnel_info *p_tunn;
 99
100	bool b_hw_start;
101
102	/* Interrupt mode [msix, inta, etc.] to use */
103	enum qed_int_mode int_mode;
104
105	/* NPAR tx switching to be used for vports for tx-switching */
106	bool allow_npar_tx_switch;
107
108	/* Binary fw data pointer in binary fw file */
109	const u8 *bin_fw_data;
110
111	/* Driver load parameters */
112	struct qed_drv_load_params *p_drv_load_params;
113};
114
115/**
116 * qed_hw_init(): Init Qed hardware.
117 *
118 * @cdev: Qed dev pointer.
119 * @p_params: Pointers to params.
120 *
121 * Return: Int.
122 */
123int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params);
124
125/**
126 * qed_hw_timers_stop_all(): Stop the timers HW block.
127 *
128 * @cdev: Qed dev pointer.
129 *
130 * Return: void.
131 */
132void qed_hw_timers_stop_all(struct qed_dev *cdev);
133
134/**
135 * qed_hw_stop(): Stop Qed hardware.
136 *
137 * @cdev: Qed dev pointer.
138 *
139 * Return: int.
140 */
141int qed_hw_stop(struct qed_dev *cdev);
142
143/**
144 * qed_hw_stop_fastpath(): Should be called incase
145 *		           slowpath is still required for the device,
146 *		           but fastpath is not.
147 *
148 * @cdev: Qed dev pointer.
149 *
150 * Return: Int.
151 */
152int qed_hw_stop_fastpath(struct qed_dev *cdev);
153
154/**
155 * qed_hw_start_fastpath(): Restart fastpath traffic,
156 *		            only if hw_stop_fastpath was called.
157 *
158 * @p_hwfn: HW device data.
159 *
160 * Return: Int.
161 */
162int qed_hw_start_fastpath(struct qed_hwfn *p_hwfn);
163
 
164/**
165 * qed_hw_prepare(): Prepare Qed hardware.
166 *
167 * @cdev: Qed dev pointer.
168 * @personality: Personality to initialize.
169 *
170 * Return: Int.
171 */
172int qed_hw_prepare(struct qed_dev *cdev,
173		   int personality);
174
175/**
176 * qed_hw_remove(): Remove Qed hardware.
177 *
178 * @cdev: Qed dev pointer.
179 *
180 * Return: Void.
181 */
182void qed_hw_remove(struct qed_dev *cdev);
183
184/**
185 * qed_ptt_acquire(): Allocate a PTT window.
186 *
187 * @p_hwfn: HW device data.
188 *
189 * Return: struct qed_ptt.
190 *
191 * Should be called at the entry point to the driver (at the beginning of an
192 * exported function).
193 */
194struct qed_ptt *qed_ptt_acquire(struct qed_hwfn *p_hwfn);
195
196/**
197 * qed_ptt_acquire_context(): Allocate a PTT window honoring the context
198 *			      atomicy.
199 *
200 * @p_hwfn: HW device data.
201 * @is_atomic: Hint from the caller - if the func can sleep or not.
202 *
203 * Context: The function should not sleep in case is_atomic == true.
204 * Return: struct qed_ptt.
205 *
206 * Should be called at the entry point to the driver
207 * (at the beginning of an exported function).
208 */
209struct qed_ptt *qed_ptt_acquire_context(struct qed_hwfn *p_hwfn,
210					bool is_atomic);
211
212/**
213 * qed_ptt_release(): Release PTT Window.
214 *
215 * @p_hwfn: HW device data.
216 * @p_ptt: P_ptt.
217 *
218 * Return: Void.
219 *
220 * Should be called at the end of a flow - at the end of the function that
221 * acquired the PTT.
 
 
 
 
222 */
223void qed_ptt_release(struct qed_hwfn *p_hwfn,
224		     struct qed_ptt *p_ptt);
225void qed_reset_vport_stats(struct qed_dev *cdev);
226
227enum qed_dmae_address_type_t {
228	QED_DMAE_ADDRESS_HOST_VIRT,
229	QED_DMAE_ADDRESS_HOST_PHYS,
230	QED_DMAE_ADDRESS_GRC
231};
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233/**
234 * qed_dmae_host2grc(): Copy data from source addr to
235 *                      dmae registers using the given ptt.
236 *
237 * @p_hwfn: HW device data.
238 * @p_ptt: P_ptt.
239 * @source_addr: Source address.
240 * @grc_addr: GRC address (dmae_data_offset).
241 * @size_in_dwords: Size.
242 * @p_params: (default parameters will be used in case of NULL).
243 *
244 * Return: Int.
 
 
 
 
 
245 */
246int
247qed_dmae_host2grc(struct qed_hwfn *p_hwfn,
248		  struct qed_ptt *p_ptt,
249		  u64 source_addr,
250		  u32 grc_addr,
251		  u32 size_in_dwords,
252		  struct qed_dmae_params *p_params);
253
254 /**
255 * qed_dmae_grc2host(): Read data from dmae data offset
256 *                      to source address using the given ptt.
257 *
258 * @p_ptt: P_ptt.
259 * @grc_addr: GRC address (dmae_data_offset).
260 * @dest_addr: Destination Address.
261 * @size_in_dwords: Size.
262 * @p_params: (default parameters will be used in case of NULL).
263 *
264 * Return: Int.
 
 
 
 
265 */
266int qed_dmae_grc2host(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
267		      u32 grc_addr, dma_addr_t dest_addr, u32 size_in_dwords,
268		      struct qed_dmae_params *p_params);
269
270/**
271 * qed_dmae_host2host(): Copy data from to source address
272 *                       to a destination adrress (for SRIOV) using the given
273 *                       ptt.
274 *
275 * @p_hwfn: HW device data.
276 * @p_ptt: P_ptt.
277 * @source_addr: Source address.
278 * @dest_addr: Destination address.
279 * @size_in_dwords: size.
280 * @p_params: (default parameters will be used in case of NULL).
281 *
282 * Return: Int.
 
 
 
 
 
283 */
284int qed_dmae_host2host(struct qed_hwfn *p_hwfn,
285		       struct qed_ptt *p_ptt,
286		       dma_addr_t source_addr,
287		       dma_addr_t dest_addr,
288		       u32 size_in_dwords, struct qed_dmae_params *p_params);
289
290int qed_chain_alloc(struct qed_dev *cdev, struct qed_chain *chain,
291		    struct qed_chain_init_params *params);
292void qed_chain_free(struct qed_dev *cdev, struct qed_chain *chain);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
294/**
295 * qed_fw_l2_queue(): Get absolute L2 queue ID.
296 *
297 * @p_hwfn: HW device data.
298 * @src_id: Relative to p_hwfn.
299 * @dst_id: Absolute per engine.
 
 
 
 
 
 
 
 
300 *
301 * Return: Int.
302 */
303int qed_fw_l2_queue(struct qed_hwfn *p_hwfn,
304		    u16 src_id,
305		    u16 *dst_id);
306
307/**
308 * qed_fw_vport(): Get absolute vport ID.
309 *
310 * @p_hwfn: HW device data.
311 * @src_id: Relative to p_hwfn.
312 * @dst_id: Absolute per engine.
313 *
314 * Return: Int.
315 */
316int qed_fw_vport(struct qed_hwfn *p_hwfn,
317		 u8 src_id,
318		 u8 *dst_id);
319
320/**
321 * qed_fw_rss_eng(): Get absolute RSS engine ID.
322 *
323 * @p_hwfn: HW device data.
324 * @src_id: Relative to p_hwfn.
325 * @dst_id: Absolute per engine.
326 *
327 * Return: Int.
328 */
329int qed_fw_rss_eng(struct qed_hwfn *p_hwfn,
330		   u8 src_id,
331		   u8 *dst_id);
332
333/**
334 * qed_llh_get_num_ppfid(): Return the allocated number of LLH filter
335 *	                    banks that are allocated to the PF.
336 *
337 * @cdev: Qed dev pointer.
338 *
339 * Return: u8 Number of LLH filter banks.
340 */
341u8 qed_llh_get_num_ppfid(struct qed_dev *cdev);
342
343enum qed_eng {
344	QED_ENG0,
345	QED_ENG1,
346	QED_BOTH_ENG,
347};
348
349/**
350 * qed_llh_set_ppfid_affinity(): Set the engine affinity for the given
351 *	                         LLH filter bank.
352 *
353 * @cdev: Qed dev pointer.
354 * @ppfid: Relative within the allocated ppfids ('0' is the default one).
355 * @eng: Engine.
356 *
357 * Return: Int.
358 */
359int qed_llh_set_ppfid_affinity(struct qed_dev *cdev,
360			       u8 ppfid, enum qed_eng eng);
361
362/**
363 * qed_llh_set_roce_affinity(): Set the RoCE engine affinity.
364 *
365 * @cdev: Qed dev pointer.
366 * @eng: Engine.
367 *
368 * Return: Int.
369 */
370int qed_llh_set_roce_affinity(struct qed_dev *cdev, enum qed_eng eng);
371
372/**
373 * qed_llh_add_mac_filter(): Add a LLH MAC filter into the given filter
374 *	                     bank.
375 *
376 * @cdev: Qed dev pointer.
377 * @ppfid: Relative within the allocated ppfids ('0' is the default one).
378 * @mac_addr: MAC to add.
379 *
380 * Return: Int.
 
 
381 */
382int qed_llh_add_mac_filter(struct qed_dev *cdev,
383			   u8 ppfid, const u8 mac_addr[ETH_ALEN]);
384
385/**
386 * qed_llh_remove_mac_filter(): Remove a LLH MAC filter from the given
387 *	                        filter bank.
388 *
389 * @cdev: Qed dev pointer.
390 * @ppfid: Ppfid.
391 * @mac_addr: MAC to remove
392 *
393 * Return: Void.
394 */
395void qed_llh_remove_mac_filter(struct qed_dev *cdev,
396			       u8 ppfid, u8 mac_addr[ETH_ALEN]);
397
398enum qed_llh_prot_filter_type_t {
399	QED_LLH_FILTER_ETHERTYPE,
400	QED_LLH_FILTER_TCP_SRC_PORT,
401	QED_LLH_FILTER_TCP_DEST_PORT,
402	QED_LLH_FILTER_TCP_SRC_AND_DEST_PORT,
403	QED_LLH_FILTER_UDP_SRC_PORT,
404	QED_LLH_FILTER_UDP_DEST_PORT,
405	QED_LLH_FILTER_UDP_SRC_AND_DEST_PORT
406};
407
408/**
409 * qed_llh_add_protocol_filter(): Add a LLH protocol filter into the
410 *	                          given filter bank.
411 *
412 * @cdev: Qed dev pointer.
413 * @ppfid: Relative within the allocated ppfids ('0' is the default one).
414 * @type: Type of filters and comparing.
415 * @source_port_or_eth_type: Source port or ethertype to add.
416 * @dest_port: Destination port to add.
417 *
418 * Return: Int.
 
 
 
 
 
419 */
420int
421qed_llh_add_protocol_filter(struct qed_dev *cdev,
422			    u8 ppfid,
423			    enum qed_llh_prot_filter_type_t type,
424			    u16 source_port_or_eth_type, u16 dest_port);
425
426/**
427 * qed_llh_remove_protocol_filter(): Remove a LLH protocol filter from
428 *	                             the given filter bank.
429 *
430 * @cdev: Qed dev pointer.
431 * @ppfid: Relative within the allocated ppfids ('0' is the default one).
432 * @type: Type of filters and comparing.
433 * @source_port_or_eth_type: Source port or ethertype to add.
434 * @dest_port: Destination port to add.
435 */
436void
437qed_llh_remove_protocol_filter(struct qed_dev *cdev,
438			       u8 ppfid,
439			       enum qed_llh_prot_filter_type_t type,
440			       u16 source_port_or_eth_type, u16 dest_port);
441
442/**
443 * qed_final_cleanup(): Cleanup of previous driver remains prior to load.
444 *
445 * @p_hwfn: HW device data.
446 * @p_ptt: P_ptt.
447 * @id: For PF, engine-relative. For VF, PF-relative.
448 * @is_vf: True iff cleanup is made for a VF.
449 *
450 * Return: Int.
451 */
452int qed_final_cleanup(struct qed_hwfn *p_hwfn,
453		      struct qed_ptt *p_ptt, u16 id, bool is_vf);
454
455/**
456 * qed_get_queue_coalesce(): Retrieve coalesce value for a given queue.
457 *
458 * @p_hwfn: HW device data.
459 * @coal: Store coalesce value read from the hardware.
460 * @handle: P_handle.
461 *
462 * Return: Int.
463 **/
464int qed_get_queue_coalesce(struct qed_hwfn *p_hwfn, u16 *coal, void *handle);
465
466/**
467 * qed_set_queue_coalesce(): Configure coalesce parameters for Rx and
468 *    Tx queue. The fact that we can configure coalescing to up to 511, but on
469 *    varying accuracy [the bigger the value the less accurate] up to a mistake
470 *    of 3usec for the highest values.
471 *    While the API allows setting coalescing per-qid, all queues sharing a SB
472 *    should be in same range [i.e., either 0-0x7f, 0x80-0xff or 0x100-0x1ff]
473 *    otherwise configuration would break.
474 *
475 * @rx_coal: Rx Coalesce value in micro seconds.
476 * @tx_coal: TX Coalesce value in micro seconds.
477 * @p_handle: P_handle.
478 *
479 * Return: Int.
 
 
 
 
480 **/
481int
482qed_set_queue_coalesce(u16 rx_coal, u16 tx_coal, void *p_handle);
483
484/**
485 * qed_pglueb_set_pfid_enable(): Enable or disable PCI BUS MASTER.
486 *
487 * @p_hwfn: HW device data.
488 * @p_ptt: P_ptt.
489 * @b_enable: True/False.
490 *
491 * Return: Int.
492 */
493int qed_pglueb_set_pfid_enable(struct qed_hwfn *p_hwfn,
494			       struct qed_ptt *p_ptt, bool b_enable);
495
496/**
497 * qed_db_recovery_add(): add doorbell information to the doorbell
498 *                    recovery mechanism.
499 *
500 * @cdev: Qed dev pointer.
501 * @db_addr: Doorbell address.
502 * @db_data: Address of where db_data is stored.
503 * @db_width: Doorbell is 32b pr 64b.
504 * @db_space: Doorbell recovery addresses are user or kernel space.
505 *
506 * Return: Int.
 
 
 
 
507 */
508int qed_db_recovery_add(struct qed_dev *cdev,
509			void __iomem *db_addr,
510			void *db_data,
511			enum qed_db_rec_width db_width,
512			enum qed_db_rec_space db_space);
513
514/**
515 * qed_db_recovery_del() - remove doorbell information from the doorbell
516 * recovery mechanism. db_data serves as key (db_addr is not unique).
517 *
518 * @cdev: Qed dev pointer.
519 * @db_addr: doorbell address.
520 * @db_data: address where db_data is stored. Serves as key for the
521 *                  entry to delete.
522 *
523 * Return: Int.
524 */
525int qed_db_recovery_del(struct qed_dev *cdev,
526			void __iomem *db_addr, void *db_data);
 
527
528const char *qed_hw_get_resc_name(enum qed_resources res_id);
529#endif
v5.4
 
  1/* QLogic qed NIC Driver
  2 * Copyright (c) 2015-2017  QLogic Corporation
  3 *
  4 * This software is available to you under a choice of one of two
  5 * licenses.  You may choose to be licensed under the terms of the GNU
  6 * General Public License (GPL) Version 2, available from the file
  7 * COPYING in the main directory of this source tree, or the
  8 * OpenIB.org BSD license below:
  9 *
 10 *     Redistribution and use in source and binary forms, with or
 11 *     without modification, are permitted provided that the following
 12 *     conditions are met:
 13 *
 14 *      - Redistributions of source code must retain the above
 15 *        copyright notice, this list of conditions and the following
 16 *        disclaimer.
 17 *
 18 *      - Redistributions in binary form must reproduce the above
 19 *        copyright notice, this list of conditions and the following
 20 *        disclaimer in the documentation and /or other materials
 21 *        provided with the distribution.
 22 *
 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 30 * SOFTWARE.
 31 */
 32
 33#ifndef _QED_DEV_API_H
 34#define _QED_DEV_API_H
 35
 36#include <linux/types.h>
 37#include <linux/kernel.h>
 38#include <linux/slab.h>
 39#include <linux/qed/qed_chain.h>
 40#include <linux/qed/qed_if.h>
 41#include "qed_int.h"
 42
 43/**
 44 * @brief qed_init_dp - initialize the debug level
 
 
 
 
 45 *
 46 * @param cdev
 47 * @param dp_module
 48 * @param dp_level
 49 */
 50void qed_init_dp(struct qed_dev *cdev,
 51		 u32 dp_module,
 52		 u8 dp_level);
 53
 54/**
 55 * @brief qed_init_struct - initialize the device structure to
 56 *        its defaults
 
 
 57 *
 58 * @param cdev
 59 */
 60void qed_init_struct(struct qed_dev *cdev);
 61
 62/**
 63 * @brief qed_resc_free -
 64 *
 65 * @param cdev
 
 
 66 */
 67void qed_resc_free(struct qed_dev *cdev);
 68
 69/**
 70 * @brief qed_resc_alloc -
 71 *
 72 * @param cdev
 73 *
 74 * @return int
 75 */
 76int qed_resc_alloc(struct qed_dev *cdev);
 77
 78/**
 79 * @brief qed_resc_setup -
 
 
 80 *
 81 * @param cdev
 82 */
 83void qed_resc_setup(struct qed_dev *cdev);
 84
 85enum qed_override_force_load {
 86	QED_OVERRIDE_FORCE_LOAD_NONE,
 87	QED_OVERRIDE_FORCE_LOAD_ALWAYS,
 88	QED_OVERRIDE_FORCE_LOAD_NEVER,
 89};
 90
 91struct qed_drv_load_params {
 92	/* Indicates whether the driver is running over a crash kernel.
 93	 * As part of the load request, this will be used for providing the
 94	 * driver role to the MFW.
 95	 * In case of a crash kernel over PDA - this should be set to false.
 96	 */
 97	bool is_crash_kernel;
 98
 99	/* The timeout value that the MFW should use when locking the engine for
100	 * the driver load process.
101	 * A value of '0' means the default value, and '255' means no timeout.
102	 */
103	u8 mfw_timeout_val;
104#define QED_LOAD_REQ_LOCK_TO_DEFAULT    0
105#define QED_LOAD_REQ_LOCK_TO_NONE       255
106
107	/* Avoid engine reset when first PF loads on it */
108	bool avoid_eng_reset;
109
110	/* Allow overriding the default force load behavior */
111	enum qed_override_force_load override_force_load;
112};
113
114struct qed_hw_init_params {
115	/* Tunneling parameters */
116	struct qed_tunnel_info *p_tunn;
117
118	bool b_hw_start;
119
120	/* Interrupt mode [msix, inta, etc.] to use */
121	enum qed_int_mode int_mode;
122
123	/* NPAR tx switching to be used for vports for tx-switching */
124	bool allow_npar_tx_switch;
125
126	/* Binary fw data pointer in binary fw file */
127	const u8 *bin_fw_data;
128
129	/* Driver load parameters */
130	struct qed_drv_load_params *p_drv_load_params;
131};
132
133/**
134 * @brief qed_hw_init -
135 *
136 * @param cdev
137 * @param p_params
138 *
139 * @return int
140 */
141int qed_hw_init(struct qed_dev *cdev, struct qed_hw_init_params *p_params);
142
143/**
144 * @brief qed_hw_timers_stop_all - stop the timers HW block
145 *
146 * @param cdev
147 *
148 * @return void
149 */
150void qed_hw_timers_stop_all(struct qed_dev *cdev);
151
152/**
153 * @brief qed_hw_stop -
154 *
155 * @param cdev
156 *
157 * @return int
158 */
159int qed_hw_stop(struct qed_dev *cdev);
160
161/**
162 * @brief qed_hw_stop_fastpath -should be called incase
163 *		slowpath is still required for the device,
164 *		but fastpath is not.
165 *
166 * @param cdev
167 *
168 * @return int
169 */
170int qed_hw_stop_fastpath(struct qed_dev *cdev);
171
172/**
173 * @brief qed_hw_start_fastpath -restart fastpath traffic,
174 *		only if hw_stop_fastpath was called
175 *
176 * @param p_hwfn
177 *
178 * @return int
179 */
180int qed_hw_start_fastpath(struct qed_hwfn *p_hwfn);
181
182
183/**
184 * @brief qed_hw_prepare -
185 *
186 * @param cdev
187 * @param personality - personality to initialize
188 *
189 * @return int
190 */
191int qed_hw_prepare(struct qed_dev *cdev,
192		   int personality);
193
194/**
195 * @brief qed_hw_remove -
 
 
196 *
197 * @param cdev
198 */
199void qed_hw_remove(struct qed_dev *cdev);
200
201/**
202 * @brief qed_ptt_acquire - Allocate a PTT window
 
 
 
 
203 *
204 * Should be called at the entry point to the driver (at the beginning of an
205 * exported function)
 
 
 
 
 
 
206 *
207 * @param p_hwfn
 
208 *
209 * @return struct qed_ptt
 
 
 
 
210 */
211struct qed_ptt *qed_ptt_acquire(struct qed_hwfn *p_hwfn);
 
212
213/**
214 * @brief qed_ptt_release - Release PTT Window
 
 
 
 
 
215 *
216 * Should be called at the end of a flow - at the end of the function that
217 * acquired the PTT.
218 *
219 *
220 * @param p_hwfn
221 * @param p_ptt
222 */
223void qed_ptt_release(struct qed_hwfn *p_hwfn,
224		     struct qed_ptt *p_ptt);
225void qed_reset_vport_stats(struct qed_dev *cdev);
226
227enum qed_dmae_address_type_t {
228	QED_DMAE_ADDRESS_HOST_VIRT,
229	QED_DMAE_ADDRESS_HOST_PHYS,
230	QED_DMAE_ADDRESS_GRC
231};
232
233/* value of flags If QED_DMAE_FLAG_RW_REPL_SRC flag is set and the
234 * source is a block of length DMAE_MAX_RW_SIZE and the
235 * destination is larger, the source block will be duplicated as
236 * many times as required to fill the destination block. This is
237 * used mostly to write a zeroed buffer to destination address
238 * using DMA
239 */
240#define QED_DMAE_FLAG_RW_REPL_SRC	0x00000001
241#define QED_DMAE_FLAG_VF_SRC		0x00000002
242#define QED_DMAE_FLAG_VF_DST		0x00000004
243#define QED_DMAE_FLAG_COMPLETION_DST	0x00000008
244#define QED_DMAE_FLAG_PORT		0x00000010
245#define QED_DMAE_FLAG_PF_SRC		0x00000020
246#define QED_DMAE_FLAG_PF_DST		0x00000040
247
248struct qed_dmae_params {
249	u32 flags; /* consists of QED_DMAE_FLAG_* values */
250	u8 src_vfid;
251	u8 dst_vfid;
252	u8 port_id;
253	u8 src_pfid;
254	u8 dst_pfid;
255};
256
257/**
258 * @brief qed_dmae_host2grc - copy data from source addr to
259 * dmae registers using the given ptt
 
 
 
 
 
 
 
260 *
261 * @param p_hwfn
262 * @param p_ptt
263 * @param source_addr
264 * @param grc_addr (dmae_data_offset)
265 * @param size_in_dwords
266 * @param p_params (default parameters will be used in case of NULL)
267 */
268int
269qed_dmae_host2grc(struct qed_hwfn *p_hwfn,
270		  struct qed_ptt *p_ptt,
271		  u64 source_addr,
272		  u32 grc_addr,
273		  u32 size_in_dwords,
274		  struct qed_dmae_params *p_params);
275
276 /**
277 * @brief qed_dmae_grc2host - Read data from dmae data offset
278 * to source address using the given ptt
 
 
 
 
 
 
279 *
280 * @param p_ptt
281 * @param grc_addr (dmae_data_offset)
282 * @param dest_addr
283 * @param size_in_dwords
284 * @param p_params (default parameters will be used in case of NULL)
285 */
286int qed_dmae_grc2host(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt,
287		      u32 grc_addr, dma_addr_t dest_addr, u32 size_in_dwords,
288		      struct qed_dmae_params *p_params);
289
290/**
291 * @brief qed_dmae_host2host - copy data from to source address
292 * to a destination adress (for SRIOV) using the given ptt
 
 
 
 
 
 
 
 
293 *
294 * @param p_hwfn
295 * @param p_ptt
296 * @param source_addr
297 * @param dest_addr
298 * @param size_in_dwords
299 * @param p_params (default parameters will be used in case of NULL)
300 */
301int qed_dmae_host2host(struct qed_hwfn *p_hwfn,
302		       struct qed_ptt *p_ptt,
303		       dma_addr_t source_addr,
304		       dma_addr_t dest_addr,
305		       u32 size_in_dwords, struct qed_dmae_params *p_params);
306
307/**
308 * @brief qed_chain_alloc - Allocate and initialize a chain
309 *
310 * @param p_hwfn
311 * @param intended_use
312 * @param mode
313 * @param num_elems
314 * @param elem_size
315 * @param p_chain
316 * @param ext_pbl - a possible external PBL
317 *
318 * @return int
319 */
320int
321qed_chain_alloc(struct qed_dev *cdev,
322		enum qed_chain_use_mode intended_use,
323		enum qed_chain_mode mode,
324		enum qed_chain_cnt_type cnt_type,
325		u32 num_elems,
326		size_t elem_size,
327		struct qed_chain *p_chain, struct qed_chain_ext_pbl *ext_pbl);
328
329/**
330 * @brief qed_chain_free - Free chain DMA memory
331 *
332 * @param p_hwfn
333 * @param p_chain
334 */
335void qed_chain_free(struct qed_dev *cdev, struct qed_chain *p_chain);
336
337/**
338 * @@brief qed_fw_l2_queue - Get absolute L2 queue ID
339 *
340 *  @param p_hwfn
341 *  @param src_id - relative to p_hwfn
342 *  @param dst_id - absolute per engine
343 *
344 *  @return int
345 */
346int qed_fw_l2_queue(struct qed_hwfn *p_hwfn,
347		    u16 src_id,
348		    u16 *dst_id);
349
350/**
351 * @@brief qed_fw_vport - Get absolute vport ID
352 *
353 *  @param p_hwfn
354 *  @param src_id - relative to p_hwfn
355 *  @param dst_id - absolute per engine
356 *
357 *  @return int
358 */
359int qed_fw_vport(struct qed_hwfn *p_hwfn,
360		 u8 src_id,
361		 u8 *dst_id);
362
363/**
364 * @@brief qed_fw_rss_eng - Get absolute RSS engine ID
365 *
366 *  @param p_hwfn
367 *  @param src_id - relative to p_hwfn
368 *  @param dst_id - absolute per engine
369 *
370 *  @return int
371 */
372int qed_fw_rss_eng(struct qed_hwfn *p_hwfn,
373		   u8 src_id,
374		   u8 *dst_id);
375
376/**
377 * @brief qed_llh_get_num_ppfid - Return the allocated number of LLH filter
378 *	banks that are allocated to the PF.
379 *
380 * @param cdev
381 *
382 * @return u8 - Number of LLH filter banks
383 */
384u8 qed_llh_get_num_ppfid(struct qed_dev *cdev);
385
386enum qed_eng {
387	QED_ENG0,
388	QED_ENG1,
389	QED_BOTH_ENG,
390};
391
392/**
393 * @brief qed_llh_set_ppfid_affinity - Set the engine affinity for the given
394 *	LLH filter bank.
395 *
396 * @param cdev
397 * @param ppfid - relative within the allocated ppfids ('0' is the default one).
398 * @param eng
399 *
400 * @return int
401 */
402int qed_llh_set_ppfid_affinity(struct qed_dev *cdev,
403			       u8 ppfid, enum qed_eng eng);
404
405/**
406 * @brief qed_llh_set_roce_affinity - Set the RoCE engine affinity
407 *
408 * @param cdev
409 * @param eng
410 *
411 * @return int
412 */
413int qed_llh_set_roce_affinity(struct qed_dev *cdev, enum qed_eng eng);
414
415/**
416 * @brief qed_llh_add_mac_filter - Add a LLH MAC filter into the given filter
417 *	bank.
 
 
 
 
418 *
419 * @param cdev
420 * @param ppfid - relative within the allocated ppfids ('0' is the default one).
421 * @param mac_addr - MAC to add
422 */
423int qed_llh_add_mac_filter(struct qed_dev *cdev,
424			   u8 ppfid, u8 mac_addr[ETH_ALEN]);
425
426/**
427 * @brief qed_llh_remove_mac_filter - Remove a LLH MAC filter from the given
428 *	filter bank.
429 *
430 * @param p_ptt
431 * @param p_filter - MAC to remove
 
 
 
432 */
433void qed_llh_remove_mac_filter(struct qed_dev *cdev,
434			       u8 ppfid, u8 mac_addr[ETH_ALEN]);
435
436enum qed_llh_prot_filter_type_t {
437	QED_LLH_FILTER_ETHERTYPE,
438	QED_LLH_FILTER_TCP_SRC_PORT,
439	QED_LLH_FILTER_TCP_DEST_PORT,
440	QED_LLH_FILTER_TCP_SRC_AND_DEST_PORT,
441	QED_LLH_FILTER_UDP_SRC_PORT,
442	QED_LLH_FILTER_UDP_DEST_PORT,
443	QED_LLH_FILTER_UDP_SRC_AND_DEST_PORT
444};
445
446/**
447 * @brief qed_llh_add_protocol_filter - Add a LLH protocol filter into the
448 *	given filter bank.
 
 
 
 
 
 
449 *
450 * @param cdev
451 * @param ppfid - relative within the allocated ppfids ('0' is the default one).
452 * @param type - type of filters and comparing
453 * @param source_port_or_eth_type - source port or ethertype to add
454 * @param dest_port - destination port to add
455 * @param type - type of filters and comparing
456 */
457int
458qed_llh_add_protocol_filter(struct qed_dev *cdev,
459			    u8 ppfid,
460			    enum qed_llh_prot_filter_type_t type,
461			    u16 source_port_or_eth_type, u16 dest_port);
462
463/**
464 * @brief qed_llh_remove_protocol_filter - Remove a LLH protocol filter from
465 *	the given filter bank.
466 *
467 * @param cdev
468 * @param ppfid - relative within the allocated ppfids ('0' is the default one).
469 * @param type - type of filters and comparing
470 * @param source_port_or_eth_type - source port or ethertype to add
471 * @param dest_port - destination port to add
472 */
473void
474qed_llh_remove_protocol_filter(struct qed_dev *cdev,
475			       u8 ppfid,
476			       enum qed_llh_prot_filter_type_t type,
477			       u16 source_port_or_eth_type, u16 dest_port);
478
479/**
480 * *@brief Cleanup of previous driver remains prior to load
481 *
482 * @param p_hwfn
483 * @param p_ptt
484 * @param id - For PF, engine-relative. For VF, PF-relative.
485 * @param is_vf - true iff cleanup is made for a VF.
486 *
487 * @return int
488 */
489int qed_final_cleanup(struct qed_hwfn *p_hwfn,
490		      struct qed_ptt *p_ptt, u16 id, bool is_vf);
491
492/**
493 * @brief qed_get_queue_coalesce - Retrieve coalesce value for a given queue.
494 *
495 * @param p_hwfn
496 * @param p_coal - store coalesce value read from the hardware.
497 * @param p_handle
498 *
499 * @return int
500 **/
501int qed_get_queue_coalesce(struct qed_hwfn *p_hwfn, u16 *coal, void *handle);
502
503/**
504 * @brief qed_set_queue_coalesce - Configure coalesce parameters for Rx and
505 *    Tx queue. The fact that we can configure coalescing to up to 511, but on
506 *    varying accuracy [the bigger the value the less accurate] up to a mistake
507 *    of 3usec for the highest values.
508 *    While the API allows setting coalescing per-qid, all queues sharing a SB
509 *    should be in same range [i.e., either 0-0x7f, 0x80-0xff or 0x100-0x1ff]
510 *    otherwise configuration would break.
511 *
 
 
 
512 *
513 * @param rx_coal - Rx Coalesce value in micro seconds.
514 * @param tx_coal - TX Coalesce value in micro seconds.
515 * @param p_handle
516 *
517 * @return int
518 **/
519int
520qed_set_queue_coalesce(u16 rx_coal, u16 tx_coal, void *p_handle);
521
522/**
523 * @brief qed_pglueb_set_pfid_enable - Enable or disable PCI BUS MASTER
524 *
525 * @param p_hwfn
526 * @param p_ptt
527 * @param b_enable - true/false
528 *
529 * @return int
530 */
531int qed_pglueb_set_pfid_enable(struct qed_hwfn *p_hwfn,
532			       struct qed_ptt *p_ptt, bool b_enable);
533
534/**
535 * @brief db_recovery_add - add doorbell information to the doorbell
536 * recovery mechanism.
 
 
 
 
 
 
537 *
538 * @param cdev
539 * @param db_addr - doorbell address
540 * @param db_data - address of where db_data is stored
541 * @param db_width - doorbell is 32b pr 64b
542 * @param db_space - doorbell recovery addresses are user or kernel space
543 */
544int qed_db_recovery_add(struct qed_dev *cdev,
545			void __iomem *db_addr,
546			void *db_data,
547			enum qed_db_rec_width db_width,
548			enum qed_db_rec_space db_space);
549
550/**
551 * @brief db_recovery_del - remove doorbell information from the doorbell
552 * recovery mechanism. db_data serves as key (db_addr is not unique).
553 *
554 * @param cdev
555 * @param db_addr - doorbell address
556 * @param db_data - address where db_data is stored. Serves as key for the
557 *                  entry to delete.
 
 
558 */
559int qed_db_recovery_del(struct qed_dev *cdev,
560			void __iomem *db_addr, void *db_data);
561
562
563const char *qed_hw_get_resc_name(enum qed_resources res_id);
564#endif