2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
10 #define __ECORE_L2_H__
15 #include "ecore_spq.h"
16 #include "ecore_l2_api.h"
18 #define MAX_QUEUES_PER_QZONE (sizeof(unsigned long) * 8)
19 #define ECORE_QUEUE_CID_PF (0xff)
21 /* Almost identical to the ecore_queue_start_common_params,
22 * but here we maintain the SB index in IGU CAM.
24 struct ecore_queue_cid_params {
30 /* Additional parameters required for initialization of the queue_cid
31 * and are relevant only for a PF initializing one for its VFs.
33 struct ecore_queue_cid_vf_params {
34 /* Should match the VF's relative index */
37 /* 0-based queue index. Should reflect the relative qzone the
38 * VF thinks is associated with it [in its range].
42 /* Indicates a VF is legacy, making it differ in several things:
43 * - Producers would be placed in a different place.
44 * - Makes assumptions regarding the CIDs.
48 /* For VFs, this index arrives via TLV to diffrentiate between
49 * different queues opened on the same qzone, and is passed
50 * [where the PF would have allocated it internally for its own].
55 struct ecore_queue_cid {
56 /* For stats-id, the `rel' is actually absolute as well */
57 struct ecore_queue_cid_params rel;
58 struct ecore_queue_cid_params abs;
60 /* These have no 'relative' meaning */
67 /* VFs queues are mapped differently, so we need to know the
68 * relative queue associated with them [0-based].
69 * Notice this is relevant on the *PF* queue-cid of its VF's queues,
70 * and not on the VF itself.
75 /* We need an additional index to diffrentiate between queues opened
76 * for same queue-zone, as VFs would have to communicate the info
77 * to the PF [otherwise PF has no way to diffrentiate].
81 /* Legacy VFs might have Rx producer located elsewhere */
83 #define ECORE_QCID_LEGACY_VF_RX_PROD (1 << 0)
84 #define ECORE_QCID_LEGACY_VF_CID (1 << 1)
86 struct ecore_hwfn *p_owner;
89 enum _ecore_status_t ecore_l2_alloc(struct ecore_hwfn *p_hwfn);
90 void ecore_l2_setup(struct ecore_hwfn *p_hwfn);
91 void ecore_l2_free(struct ecore_hwfn *p_hwfn);
93 void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn,
94 struct ecore_queue_cid *p_cid);
96 struct ecore_queue_cid *
97 ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn, u16 opaque_fid,
98 struct ecore_queue_start_common_params *p_params,
99 struct ecore_queue_cid_vf_params *p_vf_params);
102 ecore_sp_eth_vport_start(struct ecore_hwfn *p_hwfn,
103 struct ecore_sp_vport_start_params *p_params);
106 * @brief - Starts an Rx queue, when queue_cid is already prepared
110 * @param bd_max_bytes
111 * @param bd_chain_phys_addr
112 * @param cqe_pbl_addr
113 * @param cqe_pbl_size
115 * @return enum _ecore_status_t
118 ecore_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
119 struct ecore_queue_cid *p_cid,
121 dma_addr_t bd_chain_phys_addr,
122 dma_addr_t cqe_pbl_addr,
126 * @brief - Starts a Tx queue, where queue_cid is already prepared
132 * @param p_pq_params - parameters for choosing the PQ for this Tx queue
134 * @return enum _ecore_status_t
137 ecore_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn,
138 struct ecore_queue_cid *p_cid,
139 dma_addr_t pbl_addr, u16 pbl_size,
142 u8 ecore_mcast_bin_from_mac(u8 *mac);