9506 Want support for QLogic QL41000/45000 series devices
[unleashed.git] / usr / src / uts / common / io / qede / 579xx / drivers / ecore / ecore_l2.h
blob60f4319930571ac62420058e35860cb24c0809d9
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1, (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1, (the "License").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
36 #ifndef __ECORE_L2_H__
37 #define __ECORE_L2_H__
40 #include "ecore.h"
41 #include "ecore_hw.h"
42 #include "ecore_spq.h"
43 #include "ecore_l2_api.h"
45 #define MAX_QUEUES_PER_QZONE (sizeof(unsigned long) * 8)
46 #define ECORE_QUEUE_CID_PF (0xff)
48 /* Almost identical to the ecore_queue_start_common_params,
49 * but here we maintain the SB index in IGU CAM.
51 struct ecore_queue_cid_params {
52 u8 vport_id;
53 u16 queue_id;
54 u8 stats_id;
57 /* Additional parameters required for initialization of the queue_cid
58 * and are relevant only for a PF initializing one for its VFs.
60 struct ecore_queue_cid_vf_params {
61 /* Should match the VF's relative index */
62 u8 vfid;
64 /* 0-based queue index. Should reflect the relative qzone the
65 * VF thinks is associated with it [in its range].
67 u8 vf_qid;
69 /* Indicates a VF is legacy, making it differ in several things:
70 * - Producers would be placed in a different place.
71 * - Makes assumptions regarding the CIDs.
73 u8 vf_legacy;
75 /* For VFs, this index arrives via TLV to diffrentiate between
76 * different queues opened on the same qzone, and is passed
77 * [where the PF would have allocated it internally for its own].
79 u8 qid_usage_idx;
82 struct ecore_queue_cid {
83 /* For stats-id, the `rel' is actually absolute as well */
84 struct ecore_queue_cid_params rel;
85 struct ecore_queue_cid_params abs;
87 /* These have no 'relative' meaning */
88 u16 sb_igu_id;
89 u8 sb_idx;
91 u32 cid;
92 u16 opaque_fid;
94 /* VFs queues are mapped differently, so we need to know the
95 * relative queue associated with them [0-based].
96 * Notice this is relevant on the *PF* queue-cid of its VF's queues,
97 * and not on the VF itself.
99 u8 vfid;
100 u8 vf_qid;
102 /* We need an additional index to diffrentiate between queues opened
103 * for same queue-zone, as VFs would have to communicate the info
104 * to the PF [otherwise PF has no way to diffrentiate].
106 u8 qid_usage_idx;
108 /* Legacy VFs might have Rx producer located elsewhere */
109 u8 vf_legacy;
110 #define ECORE_QCID_LEGACY_VF_RX_PROD (1 << 0)
111 #define ECORE_QCID_LEGACY_VF_CID (1 << 1)
113 struct ecore_hwfn *p_owner;
116 enum _ecore_status_t ecore_l2_alloc(struct ecore_hwfn *p_hwfn);
117 void ecore_l2_setup(struct ecore_hwfn *p_hwfn);
118 void ecore_l2_free(struct ecore_hwfn *p_hwfn);
120 void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn,
121 struct ecore_queue_cid *p_cid);
123 struct ecore_queue_cid *
124 ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn, u16 opaque_fid,
125 struct ecore_queue_start_common_params *p_params,
126 struct ecore_queue_cid_vf_params *p_vf_params);
128 enum _ecore_status_t
129 ecore_sp_eth_vport_start(struct ecore_hwfn *p_hwfn,
130 struct ecore_sp_vport_start_params *p_params);
133 * @brief - Starts an Rx queue, when queue_cid is already prepared
135 * @param p_hwfn
136 * @param p_cid
137 * @param bd_max_bytes
138 * @param bd_chain_phys_addr
139 * @param cqe_pbl_addr
140 * @param cqe_pbl_size
142 * @return enum _ecore_status_t
144 enum _ecore_status_t
145 ecore_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
146 struct ecore_queue_cid *p_cid,
147 u16 bd_max_bytes,
148 dma_addr_t bd_chain_phys_addr,
149 dma_addr_t cqe_pbl_addr,
150 u16 cqe_pbl_size);
153 * @brief - Starts a Tx queue, where queue_cid is already prepared
155 * @param p_hwfn
156 * @param p_cid
157 * @param pbl_addr
158 * @param pbl_size
159 * @param p_pq_params - parameters for choosing the PQ for this Tx queue
161 * @return enum _ecore_status_t
163 enum _ecore_status_t
164 ecore_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn,
165 struct ecore_queue_cid *p_cid,
166 dma_addr_t pbl_addr, u16 pbl_size,
167 u16 pq_id);
169 u8 ecore_mcast_bin_from_mac(u8 *mac);
172 * @brief - ecore_configure_rfs_ntuple_filter
174 * This ramrod should be used to add or remove arfs hw filter
176 * @params p_hwfn
177 * @params p_ptt
178 * @params p_cb Used for ECORE_SPQ_MODE_CB,where client would initialize
179 it with cookie and callback function address, if not
180 using this mode then client must pass NULL.
181 * @params p_addr p_addr is an actual packet header that needs to be
182 * filter. It has to mapped with IO to read prior to
183 * calling this, [contains 4 tuples- src ip, dest ip,
184 * src port, dest port].
185 * @params length length of p_addr header up to past the transport header.
186 * @params qid receive packet will be directed to this queue.
187 * @params vport_id
188 * @params b_is_add flag to add or remove filter.
191 enum _ecore_status_t
192 ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
193 struct ecore_ptt *p_ptt,
194 struct ecore_spq_comp_cb *p_cb,
195 dma_addr_t p_addr, u16 length,
196 u16 qid, u8 vport_id,
197 bool b_is_add);
198 #endif