net/qede/base: move code bits
[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         struct ecore_hwfn *p_owner;
41 };
42
43 void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn,
44                                  struct ecore_queue_cid *p_cid);
45
46 struct ecore_queue_cid *
47 _ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn,
48                         u16 opaque_fid, u32 cid, u8 vf_qid,
49                         struct ecore_queue_start_common_params *p_params);
50
51 enum _ecore_status_t
52 ecore_sp_eth_vport_start(struct ecore_hwfn *p_hwfn,
53                          struct ecore_sp_vport_start_params *p_params);
54
55 /**
56  * @brief - Starts an Rx queue, when queue_cid is already prepared
57  *
58  * @param p_hwfn
59  * @param p_cid
60  * @param bd_max_bytes
61  * @param bd_chain_phys_addr
62  * @param cqe_pbl_addr
63  * @param cqe_pbl_size
64  *
65  * @return enum _ecore_status_t
66  */
67 enum _ecore_status_t
68 ecore_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
69                            struct ecore_queue_cid *p_cid,
70                            u16 bd_max_bytes,
71                            dma_addr_t bd_chain_phys_addr,
72                            dma_addr_t cqe_pbl_addr,
73                            u16 cqe_pbl_size);
74
75 /**
76  * @brief - Starts a Tx queue, where queue_cid is already prepared
77  *
78  * @param p_hwfn
79  * @param p_cid
80  * @param pbl_addr
81  * @param pbl_size
82  * @param p_pq_params - parameters for choosing the PQ for this Tx queue
83  *
84  * @return enum _ecore_status_t
85  */
86 enum _ecore_status_t
87 ecore_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn,
88                            struct ecore_queue_cid *p_cid,
89                            dma_addr_t pbl_addr, u16 pbl_size,
90                            u16 pq_id);
91
92 u8 ecore_mcast_bin_from_mac(u8 *mac);
93
94 #endif