1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
13 #include "ecore_spq.h"
14 #include "ecore_l2_api.h"
16 #define MAX_QUEUES_PER_QZONE (sizeof(unsigned long) * 8)
17 #define ECORE_QUEUE_CID_PF (0xff)
19 /* Almost identical to the ecore_queue_start_common_params,
20 * but here we maintain the SB index in IGU CAM.
22 struct ecore_queue_cid_params {
28 /* Additional parameters required for initialization of the queue_cid
29 * and are relevant only for a PF initializing one for its VFs.
31 struct ecore_queue_cid_vf_params {
32 /* Should match the VF's relative index */
35 /* 0-based queue index. Should reflect the relative qzone the
36 * VF thinks is associated with it [in its range].
40 /* Indicates a VF is legacy, making it differ in several things:
41 * - Producers would be placed in a different place.
42 * - Makes assumptions regarding the CIDs.
46 /* For VFs, this index arrives via TLV to diffrentiate between
47 * different queues opened on the same qzone, and is passed
48 * [where the PF would have allocated it internally for its own].
53 struct ecore_queue_cid {
54 /* For stats-id, the `rel' is actually absolute as well */
55 struct ecore_queue_cid_params rel;
56 struct ecore_queue_cid_params abs;
58 /* 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,
100 struct ecore_queue_cid_vf_params *p_vf_params);
103 ecore_sp_eth_vport_start(struct ecore_hwfn *p_hwfn,
104 struct ecore_sp_vport_start_params *p_params);
107 * @brief - Starts an Rx queue, when queue_cid is already prepared
111 * @param bd_max_bytes
112 * @param bd_chain_phys_addr
113 * @param cqe_pbl_addr
114 * @param cqe_pbl_size
116 * @return enum _ecore_status_t
119 ecore_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
120 struct ecore_queue_cid *p_cid,
122 dma_addr_t bd_chain_phys_addr,
123 dma_addr_t cqe_pbl_addr,
127 * @brief - Starts a Tx queue, where queue_cid is already prepared
133 * @param p_pq_params - parameters for choosing the PQ for this Tx queue
135 * @return enum _ecore_status_t
138 ecore_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn,
139 struct ecore_queue_cid *p_cid,
140 dma_addr_t pbl_addr, u16 pbl_size,
143 u8 ecore_mcast_bin_from_mac(u8 *mac);
145 enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
146 struct ecore_ptt *p_ptt,
148 struct ecore_queue_cid *p_cid);
150 enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
151 struct ecore_ptt *p_ptt,
153 struct ecore_queue_cid *p_cid);
155 enum _ecore_status_t ecore_get_rxq_coalesce(struct ecore_hwfn *p_hwfn,
156 struct ecore_ptt *p_ptt,
157 struct ecore_queue_cid *p_cid,
160 enum _ecore_status_t ecore_get_txq_coalesce(struct ecore_hwfn *p_hwfn,
161 struct ecore_ptt *p_ptt,
162 struct ecore_queue_cid *p_cid,