2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
10 #define __ECORE_VF_H__
12 #include "ecore_status.h"
13 #include "ecore_vf_api.h"
14 #include "ecore_l2_api.h"
15 #include "ecore_vfpf_if.h"
17 #ifdef CONFIG_ECORE_SRIOV
20 * @brief hw preparation for VF
21 * sends ACQUIRE message
25 * @return enum _ecore_status_t
27 enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_dev *p_dev);
31 * @brief VF init in hw (equivalent to hw_init in PF)
32 * mark interrupts as enabled
36 * @return enum _ecore_status_t
38 enum _ecore_status_t ecore_vf_pf_init(struct ecore_hwfn *p_hwfn);
42 * @brief VF - start the RX Queue by sending a message to the PF
45 * @param cid - zero based within the VF
46 * @param rx_queue_id - zero based within the VF
47 * @param sb - VF status block for this queue
48 * @param sb_index - Index within the status block
49 * @param bd_max_bytes - maximum number of bytes per bd
50 * @param bd_chain_phys_addr - physical address of bd chain
51 * @param cqe_pbl_addr - physical address of pbl
52 * @param cqe_pbl_size - pbl size
53 * @param pp_prod - pointer to the producer to be
56 * @return enum _ecore_status_t
58 enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn,
63 dma_addr_t bd_chain_phys_addr,
64 dma_addr_t cqe_pbl_addr,
66 void OSAL_IOMEM * *pp_prod);
70 * @brief VF - start the TX queue by sending a message to the
74 * @param tx_queue_id - zero based within the VF
75 * @param sb - status block for this queue
76 * @param sb_index - index within the status block
77 * @param bd_chain_phys_addr - physical address of tx chain
78 * @param pp_doorbell - pointer to address to which to
79 * write the doorbell too..
81 * @return enum _ecore_status_t
83 enum _ecore_status_t ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn,
89 void OSAL_IOMEM * *pp_doorbell);
93 * @brief VF - stop the RX queue by sending a message to the PF
97 * @param cqe_completion
99 * @return enum _ecore_status_t
101 enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn,
102 u16 rx_qid, bool cqe_completion);
106 * @brief VF - stop the TX queue by sending a message to the PF
111 * @return enum _ecore_status_t
113 enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn,
117 * @brief VF - update the RX queue by sending a message to the
123 * @param init_sge_ring
124 * @param comp_cqe_flg
125 * @param comp_event_flg
127 * @return enum _ecore_status_t
129 enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn,
137 * @brief VF - send a vport update command
142 * @return enum _ecore_status_t
145 ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn,
146 struct ecore_sp_vport_update_params *p_params);
150 * @brief VF - send a close message to PF
154 * @return enum _ecore_status
156 enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn);
160 * @brief VF - free vf`s memories
164 * @return enum _ecore_status
166 enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn);
170 * @brief ecore_vf_get_igu_sb_id - Get the IGU SB ID for a given
171 * sb_id. For VFs igu sbs don't have to be contiguous
178 u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn, u16 sb_id);
181 * @brief ecore_vf_pf_vport_start - perform vport start for VF.
186 * @param inner_vlan_removal
188 * @param max_buffers_per_cqe,
189 * @param only_untagged - default behavior regarding vlan acceptance
191 * @return enum _ecore_status
193 enum _ecore_status_t ecore_vf_pf_vport_start(struct ecore_hwfn *p_hwfn,
196 u8 inner_vlan_removal,
197 enum ecore_tpa_mode tpa_mode,
198 u8 max_buffers_per_cqe,
202 * @brief ecore_vf_pf_vport_stop - stop the VF's vport
206 * @return enum _ecore_status
208 enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn);
210 enum _ecore_status_t ecore_vf_pf_filter_ucast(struct ecore_hwfn *p_hwfn,
211 struct ecore_filter_ucast
214 void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
215 struct ecore_filter_mcast *p_filter_cmd);
218 * @brief ecore_vf_pf_int_cleanup - clean the SB of the VF
222 * @return enum _ecore_status
224 enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn);
227 * @brief - return the link params in a given bulletin board
230 * @param p_params - pointer to a struct to fill with link params
233 void __ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
234 struct ecore_mcp_link_params *p_params,
235 struct ecore_bulletin_content *p_bulletin);
238 * @brief - return the link state in a given bulletin board
241 * @param p_link - pointer to a struct to fill with link state
244 void __ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
245 struct ecore_mcp_link_state *p_link,
246 struct ecore_bulletin_content *p_bulletin);
249 * @brief - return the link capabilities in a given bulletin board
252 * @param p_link - pointer to a struct to fill with link capabilities
255 void __ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
256 struct ecore_mcp_link_capabilities *p_link_caps,
257 struct ecore_bulletin_content *p_bulletin);
260 static OSAL_INLINE enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_dev
266 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_init(struct ecore_hwfn
272 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn
289 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_txq_start(struct ecore_hwfn
303 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn
312 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn
319 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_rxqs_update(struct
331 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_vport_update(
332 struct ecore_hwfn *p_hwfn,
333 struct ecore_sp_vport_update_params *p_params)
338 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn
344 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn
350 static OSAL_INLINE u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn,
356 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_vport_start(
357 struct ecore_hwfn *p_hwfn, u8 vport_id, u16 mtu,
358 u8 inner_vlan_removal, enum ecore_tpa_mode tpa_mode,
359 u8 max_buffers_per_cqe, u8 only_untagged)
364 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_vport_stop(
365 struct ecore_hwfn *p_hwfn)
370 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_filter_ucast(
371 struct ecore_hwfn *p_hwfn, struct ecore_filter_ucast *p_param)
376 static OSAL_INLINE void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
377 struct ecore_filter_mcast
382 static OSAL_INLINE enum _ecore_status_t ecore_vf_pf_int_cleanup(struct
389 static OSAL_INLINE void __ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
390 struct ecore_mcp_link_params
392 struct ecore_bulletin_content
397 static OSAL_INLINE void __ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
398 struct ecore_mcp_link_state
400 struct ecore_bulletin_content
405 static OSAL_INLINE void __ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
407 ecore_mcp_link_capabilities
409 struct ecore_bulletin_content
415 #endif /* __ECORE_VF_H__ */