9506 Want support for QLogic QL41000/45000 series devices
[unleashed.git] / usr / src / uts / common / io / qede / 579xx / drivers / ecore / ecore_vf.h
blob1c1285c1db9e19b2e697d64d4bccd703637f6a79
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_VF_H__
37 #define __ECORE_VF_H__
39 #include "ecore_status.h"
40 #include "ecore_vf_api.h"
41 #include "ecore_l2_api.h"
42 #include "ecore_vfpf_if.h"
44 /* Default number of CIDs [total of both Rx and Tx] to be requested
45 * by default.
47 #define ECORE_ETH_VF_DEFAULT_NUM_CIDS (32)
49 /* This data is held in the ecore_hwfn structure for VFs only. */
50 struct ecore_vf_iov {
51 union vfpf_tlvs *vf2pf_request;
52 dma_addr_t vf2pf_request_phys;
53 union pfvf_tlvs *pf2vf_reply;
54 dma_addr_t pf2vf_reply_phys;
56 /* Should be taken whenever the mailbox buffers are accessed */
57 osal_mutex_t mutex;
58 u8 *offset;
60 /* Bulletin Board */
61 struct ecore_bulletin bulletin;
62 struct ecore_bulletin_content bulletin_shadow;
64 /* we set aside a copy of the acquire response */
65 struct pfvf_acquire_resp_tlv acquire_resp;
67 /* In case PF originates prior to the fp-hsi version comparison,
68 * this has to be propagated as it affects the fastpath.
70 bool b_pre_fp_hsi;
72 /* Current day VFs are passing the SBs physical address on vport
73 * start, and as they lack an IGU mapping they need to store the
74 * addresses of previously registered SBs.
75 * Even if we were to change configuration flow, due to backward
76 * compatability [with older PFs] we'd still need to store these.
78 struct ecore_sb_info *sbs_info[PFVF_MAX_SBS_PER_VF];
82 enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
83 struct ecore_ptt *p_ptt,
84 u16 coalesce,
85 struct ecore_queue_cid *p_cid);
86 enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
87 struct ecore_ptt *p_ptt,
88 u16 coalesce,
89 struct ecore_queue_cid *p_cid);
91 #ifdef CONFIG_ECORE_SRIOV
92 /**
93 * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
94 * Coalesce value '0' will omit the configuration.
96 * @param p_hwfn
97 * @param rx_coal - coalesce value in micro second for rx queue
98 * @param tx_coal - coalesce value in micro second for tx queue
99 * @param queue_cid
102 enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
103 u16 rx_coal, u16 tx_coal,
104 struct ecore_queue_cid *p_cid);
107 * @brief hw preparation for VF
108 * sends ACQUIRE message
110 * @param p_hwfn
112 * @return enum _ecore_status_t
114 enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn);
117 * @brief VF - start the RX Queue by sending a message to the PF
119 * @param p_hwfn
120 * @param p_cid - Only relative fields are relevant
121 * @param bd_max_bytes - maximum number of bytes per bd
122 * @param bd_chain_phys_addr - physical address of bd chain
123 * @param cqe_pbl_addr - physical address of pbl
124 * @param cqe_pbl_size - pbl size
125 * @param pp_prod - pointer to the producer to be
126 * used in fasthpath
128 * @return enum _ecore_status_t
130 enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn,
131 struct ecore_queue_cid *p_cid,
132 u16 bd_max_bytes,
133 dma_addr_t bd_chain_phys_addr,
134 dma_addr_t cqe_pbl_addr,
135 u16 cqe_pbl_size,
136 void OSAL_IOMEM **pp_prod);
139 * @brief VF - start the TX queue by sending a message to the
140 * PF.
142 * @param p_hwfn
143 * @param p_cid
144 * @param bd_chain_phys_addr - physical address of tx chain
145 * @param pp_doorbell - pointer to address to which to
146 * write the doorbell too..
148 * @return enum _ecore_status_t
150 enum _ecore_status_t
151 ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn,
152 struct ecore_queue_cid *p_cid,
153 dma_addr_t pbl_addr, u16 pbl_size,
154 void OSAL_IOMEM **pp_doorbell);
157 * @brief VF - stop the RX queue by sending a message to the PF
159 * @param p_hwfn
160 * @param p_cid
161 * @param cqe_completion
163 * @return enum _ecore_status_t
165 enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn,
166 struct ecore_queue_cid *p_cid,
167 bool cqe_completion);
170 * @brief VF - stop the TX queue by sending a message to the PF
172 * @param p_hwfn
173 * @param p_cid
175 * @return enum _ecore_status_t
177 enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn,
178 struct ecore_queue_cid *p_cid);
180 /* TODO - fix all the !SRIOV prototypes */
182 #ifndef LINUX_REMOVE
184 * @brief VF - update the RX queue by sending a message to the
185 * PF
187 * @param p_hwfn
188 * @param pp_cid - list of queue-cids which we want to update
189 * @param num_rxqs
190 * @param comp_cqe_flg
191 * @param comp_event_flg
193 * @return enum _ecore_status_t
195 enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn,
196 struct ecore_queue_cid **pp_cid,
197 u8 num_rxqs,
198 u8 comp_cqe_flg,
199 u8 comp_event_flg);
200 #endif
203 * @brief VF - send a vport update command
205 * @param p_hwfn
206 * @param params
208 * @return enum _ecore_status_t
210 enum _ecore_status_t ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn,
211 struct ecore_sp_vport_update_params *p_params);
214 * @brief VF - send a close message to PF
216 * @param p_hwfn
218 * @return enum _ecore_status
220 enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn);
223 * @brief VF - free vf`s memories
225 * @param p_hwfn
227 * @return enum _ecore_status
229 enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn);
232 * @brief ecore_vf_get_igu_sb_id - Get the IGU SB ID for a given
233 * sb_id. For VFs igu sbs don't have to be contiguous
235 * @param p_hwfn
236 * @param sb_id
238 * @return INLINE u16
240 u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn,
241 u16 sb_id);
244 * @brief Stores [or removes] a configured sb_info.
246 * @param p_hwfn
247 * @param sb_id - zero-based SB index [for fastpath]
248 * @param sb_info - may be OSAL_NULL [during removal].
250 void ecore_vf_set_sb_info(struct ecore_hwfn *p_hwfn,
251 u16 sb_id, struct ecore_sb_info *p_sb);
254 * @brief ecore_vf_pf_vport_start - perform vport start for VF.
256 * @param p_hwfn
257 * @param vport_id
258 * @param mtu
259 * @param inner_vlan_removal
260 * @param tpa_mode
261 * @param max_buffers_per_cqe,
262 * @param only_untagged - default behavior regarding vlan acceptance
264 * @return enum _ecore_status
266 enum _ecore_status_t ecore_vf_pf_vport_start(
267 struct ecore_hwfn *p_hwfn,
268 u8 vport_id,
269 u16 mtu,
270 u8 inner_vlan_removal,
271 enum ecore_tpa_mode tpa_mode,
272 u8 max_buffers_per_cqe,
273 u8 only_untagged);
276 * @brief ecore_vf_pf_vport_stop - stop the VF's vport
278 * @param p_hwfn
280 * @return enum _ecore_status
282 enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn);
284 enum _ecore_status_t ecore_vf_pf_filter_ucast(
285 struct ecore_hwfn *p_hwfn,
286 struct ecore_filter_ucast *p_param);
288 void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
289 struct ecore_filter_mcast *p_filter_cmd);
292 * @brief ecore_vf_pf_int_cleanup - clean the SB of the VF
294 * @param p_hwfn
296 * @return enum _ecore_status
298 enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn);
301 * @brief - return the link params in a given bulletin board
303 * @param p_hwfn
304 * @param p_params - pointer to a struct to fill with link params
305 * @param p_bulletin
307 void __ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
308 struct ecore_mcp_link_params *p_params,
309 struct ecore_bulletin_content *p_bulletin);
312 * @brief - return the link state in a given bulletin board
314 * @param p_hwfn
315 * @param p_link - pointer to a struct to fill with link state
316 * @param p_bulletin
318 void __ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
319 struct ecore_mcp_link_state *p_link,
320 struct ecore_bulletin_content *p_bulletin);
323 * @brief - return the link capabilities in a given bulletin board
325 * @param p_hwfn
326 * @param p_link - pointer to a struct to fill with link capabilities
327 * @param p_bulletin
329 void __ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
330 struct ecore_mcp_link_capabilities *p_link_caps,
331 struct ecore_bulletin_content *p_bulletin);
332 enum _ecore_status_t
333 ecore_vf_pf_tunnel_param_update(struct ecore_hwfn *p_hwfn,
334 struct ecore_tunnel_info *p_tunn);
335 void ecore_vf_set_vf_start_tunn_update_param(struct ecore_tunnel_info *p_tun);
336 #else
337 static OSAL_INLINE enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn) {return ECORE_INVAL;}
338 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn, struct ecore_queue_cid *p_cid, u16 bd_max_bytes, dma_addr_t bd_chain_phys_addr, dma_addr_t cqe_pbl_addr, u16 cqe_pbl_size, void OSAL_IOMEM **pp_prod) {return ECORE_INVAL;}
339 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn, struct ecore_queue_cid *p_cid, dma_addr_t pbl_addr, u16 pbl_size, void OSAL_IOMEM **pp_doorbell) {return ECORE_INVAL;}
341 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn, struct ecore_queue_cid *p_cid, bool cqe_completion) {return ECORE_INVAL;}
342 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn, struct ecore_queue_cid *p_cid) {return ECORE_INVAL;}
343 #ifndef LINUX_REMOVE
344 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn, struct ecore_queue_cid **pp_cid, u8 num_rxqs, u8 comp_cqe_flg, u8 comp_event_flg) {return ECORE_INVAL;}
345 #endif
346 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn, struct ecore_sp_vport_update_params *p_params) {return ECORE_INVAL;}
347 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn) {return ECORE_INVAL;}
348 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn) {return ECORE_INVAL;}
349 static OSAL_INLINE u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn, u16 sb_id) {return 0;}
350 static OSAL_INLINE void ecore_vf_set_sb_info(struct ecore_hwfn *p_hwfn, u16 sb_id, struct ecore_sb_info *p_sb) {}
352 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_vport_start(struct ecore_hwfn *p_hwfn, u8 vport_id, u16 mtu, u8 inner_vlan_removal, enum ecore_tpa_mode tpa_mode, u8 max_buffers_per_cqe, u8 only_untagged) {return ECORE_INVAL;}
353 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn) {return ECORE_INVAL;}
354 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_filter_ucast(struct ecore_hwfn *p_hwfn, struct ecore_filter_ucast *p_param) {return ECORE_INVAL;}
355 static OSAL_INLINE void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn, struct ecore_filter_mcast *p_filter_cmd) {}
356 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn) {return ECORE_INVAL;}
357 static OSAL_INLINE void __ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_params *p_params, struct ecore_bulletin_content *p_bulletin) {}
358 static OSAL_INLINE void __ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_state *p_link, struct ecore_bulletin_content *p_bulletin) {}
359 static OSAL_INLINE void __ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_capabilities *p_link_caps, struct ecore_bulletin_content *p_bulletin) {}
360 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_tunnel_param_update(struct ecore_hwfn *p_hwfn, struct ecore_tunnel_info *p_tunn) { return ECORE_INVAL; }
361 static OSAL_INLINE void ecore_vf_set_vf_start_tunn_update_param(struct ecore_tunnel_info *p_tun) { return; }
362 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
363 u16 rx_coal, u16 tx_coal,
364 struct ecore_queue_cid *p_cid) {return ECORE_INVAL;}
365 #endif
367 #endif /* __ECORE_VF_H__ */