net/qede/base: make L2 queues handle based
[dpdk.git] / drivers / net / qede / base / ecore_l2.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_L2_H__
10 #define __ECORE_L2_H__
11
12
13 #include "ecore.h"
14 #include "ecore_hw.h"
15 #include "ecore_spq.h"
16 #include "ecore_l2_api.h"
17
18 struct ecore_queue_cid {
19         /* 'Relative' is a relative term ;-). Usually the indices [not counting
20          * SBs] would be PF-relative, but there are some cases where that isn't
21          * the case - specifically for a PF configuring its VF indices it's
22          * possible some fields [E.g., stats-id] in 'rel' would already be abs.
23          */
24         struct ecore_queue_start_common_params rel;
25         struct ecore_queue_start_common_params abs;
26         u32 cid;
27         u16 opaque_fid;
28
29         /* VFs queues are mapped differently, so we need to know the
30          * relative queue associated with them [0-based].
31          * Notice this is relevant on the *PF* queue-cid of its VF's queues,
32          * and not on the VF itself.
33          */
34         bool is_vf;
35         u8 vf_qid;
36
37         /* Legacy VFs might have Rx producer located elsewhere */
38         bool b_legacy_vf;
39 };
40
41 void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn,
42                                  struct ecore_queue_cid *p_cid);
43
44 struct ecore_queue_cid *
45 _ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn,
46                         u16 opaque_fid, u32 cid, u8 vf_qid,
47                         struct ecore_queue_start_common_params *p_params);
48
49 enum _ecore_status_t
50 ecore_sp_eth_vport_start(struct ecore_hwfn *p_hwfn,
51                          struct ecore_sp_vport_start_params *p_params);
52
53 /**
54  * @brief - Starts an Rx queue, when queue_cid is already prepared
55  *
56  * @param p_hwfn
57  * @param p_cid
58  * @param bd_max_bytes
59  * @param bd_chain_phys_addr
60  * @param cqe_pbl_addr
61  * @param cqe_pbl_size
62  *
63  * @return enum _ecore_status_t
64  */
65 enum _ecore_status_t
66 ecore_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
67                            struct ecore_queue_cid *p_cid,
68                            u16 bd_max_bytes,
69                            dma_addr_t bd_chain_phys_addr,
70                            dma_addr_t cqe_pbl_addr,
71                            u16 cqe_pbl_size);
72
73 /**
74  * @brief - Starts a Tx queue, where queue_cid is already prepared
75  *
76  * @param p_hwfn
77  * @param p_cid
78  * @param pbl_addr
79  * @param pbl_size
80  * @param p_pq_params - parameters for choosing the PQ for this Tx queue
81  *
82  * @return enum _ecore_status_t
83  */
84 enum _ecore_status_t
85 ecore_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn,
86                            struct ecore_queue_cid *p_cid,
87                            dma_addr_t pbl_addr, u16 pbl_size,
88                            u16 pq_id);
89
90 u8 ecore_mcast_bin_from_mac(u8 *mac);
91
92 #endif