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 /* Default number of CIDs [total of both Rx and Tx] to be requested
20 #define ECORE_ETH_VF_DEFAULT_NUM_CIDS (32)
22 /* This data is held in the ecore_hwfn structure for VFs only. */
24 union vfpf_tlvs *vf2pf_request;
25 dma_addr_t vf2pf_request_phys;
26 union pfvf_tlvs *pf2vf_reply;
27 dma_addr_t pf2vf_reply_phys;
29 /* Should be taken whenever the mailbox buffers are accessed */
34 struct ecore_bulletin bulletin;
35 struct ecore_bulletin_content bulletin_shadow;
37 /* we set aside a copy of the acquire response */
38 struct pfvf_acquire_resp_tlv acquire_resp;
40 /* In case PF originates prior to the fp-hsi version comparison,
41 * this has to be propagated as it affects the fastpath.
45 /* Current day VFs are passing the SBs physical address on vport
46 * start, and as they lack an IGU mapping they need to store the
47 * addresses of previously registered SBs.
48 * Even if we were to change configuration flow, due to backward
49 * compatibility [with older PFs] we'd still need to store these.
51 struct ecore_sb_info *sbs_info[PFVF_MAX_SBS_PER_VF];
53 #ifdef CONFIG_ECORE_SW_CHANNEL
54 /* Would be set if the VF is to try communicating with it PF
60 /* Determines whether VF utilizes doorbells via limited register
61 * bar or via the doorbell bar.
67 * @brief VF - Get coalesce per VF's relative queue.
70 * @param p_coal - coalesce value in micro second for VF queues.
71 * @param p_cid - queue cid
74 enum _ecore_status_t ecore_vf_pf_get_coalesce(struct ecore_hwfn *p_hwfn,
76 struct ecore_queue_cid *p_cid);
78 * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
79 * Coalesce value '0' will omit the configuration.
82 * @param rx_coal - coalesce value in micro second for rx queue
83 * @param tx_coal - coalesce value in micro second for tx queue
84 * @param p_cid - queue cid
87 enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
88 u16 rx_coal, u16 tx_coal,
89 struct ecore_queue_cid *p_cid);
91 #ifdef CONFIG_ECORE_SRIOV
93 * @brief hw preparation for VF
94 * sends ACQUIRE message
98 * @return enum _ecore_status_t
100 enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn);
103 * @brief VF - start the RX Queue by sending a message to the PF
106 * @param p_cid - Only relative fields are relevant
107 * @param bd_max_bytes - maximum number of bytes per bd
108 * @param bd_chain_phys_addr - physical address of bd chain
109 * @param cqe_pbl_addr - physical address of pbl
110 * @param cqe_pbl_size - pbl size
111 * @param pp_prod - pointer to the producer to be
114 * @return enum _ecore_status_t
116 enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn,
117 struct ecore_queue_cid *p_cid,
119 dma_addr_t bd_chain_phys_addr,
120 dma_addr_t cqe_pbl_addr,
122 void OSAL_IOMEM **pp_prod);
125 * @brief VF - start the TX queue by sending a message to the
130 * @param bd_chain_phys_addr - physical address of tx chain
131 * @param pp_doorbell - pointer to address to which to
132 * write the doorbell too..
134 * @return enum _ecore_status_t
137 ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn,
138 struct ecore_queue_cid *p_cid,
139 dma_addr_t pbl_addr, u16 pbl_size,
140 void OSAL_IOMEM **pp_doorbell);
143 * @brief VF - stop the RX queue by sending a message to the PF
147 * @param cqe_completion
149 * @return enum _ecore_status_t
151 enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn,
152 struct ecore_queue_cid *p_cid,
153 bool cqe_completion);
156 * @brief VF - stop the TX queue by sending a message to the PF
161 * @return enum _ecore_status_t
163 enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn,
164 struct ecore_queue_cid *p_cid);
166 /* TODO - fix all the !SRIOV prototypes */
170 * @brief VF - update the RX queue by sending a message to the
174 * @param pp_cid - list of queue-cids which we want to update
176 * @param comp_cqe_flg
177 * @param comp_event_flg
179 * @return enum _ecore_status_t
181 enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn,
182 struct ecore_queue_cid **pp_cid,
189 * @brief VF - send a vport update command
194 * @return enum _ecore_status_t
197 ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn,
198 struct ecore_sp_vport_update_params *p_params);
201 * @brief VF - send a close message to PF
205 * @return enum _ecore_status
207 enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn);
210 * @brief VF - free vf`s memories
214 * @return enum _ecore_status
216 enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn);
219 * @brief ecore_vf_get_igu_sb_id - Get the IGU SB ID for a given
220 * sb_id. For VFs igu sbs don't have to be contiguous
227 u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn,
231 * @brief Stores [or removes] a configured sb_info.
234 * @param sb_id - zero-based SB index [for fastpath]
235 * @param sb_info - may be OSAL_NULL [during removal].
237 void ecore_vf_set_sb_info(struct ecore_hwfn *p_hwfn,
238 u16 sb_id, struct ecore_sb_info *p_sb);
241 * @brief ecore_vf_pf_vport_start - perform vport start for VF.
246 * @param inner_vlan_removal
248 * @param max_buffers_per_cqe,
249 * @param only_untagged - default behavior regarding vlan acceptance
251 * @return enum _ecore_status
253 enum _ecore_status_t ecore_vf_pf_vport_start(
254 struct ecore_hwfn *p_hwfn,
257 u8 inner_vlan_removal,
258 enum ecore_tpa_mode tpa_mode,
259 u8 max_buffers_per_cqe,
263 * @brief ecore_vf_pf_vport_stop - stop the VF's vport
267 * @return enum _ecore_status
269 enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn);
271 enum _ecore_status_t ecore_vf_pf_filter_ucast(
272 struct ecore_hwfn *p_hwfn,
273 struct ecore_filter_ucast *p_param);
275 void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
276 struct ecore_filter_mcast *p_filter_cmd);
279 * @brief ecore_vf_pf_int_cleanup - clean the SB of the VF
283 * @return enum _ecore_status
285 enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn);
288 * @brief - return the link params in a given bulletin board
290 * @param p_params - pointer to a struct to fill with link params
293 void __ecore_vf_get_link_params(struct ecore_mcp_link_params *p_params,
294 struct ecore_bulletin_content *p_bulletin);
297 * @brief - return the link state in a given bulletin board
299 * @param p_link - pointer to a struct to fill with link state
302 void __ecore_vf_get_link_state(struct ecore_mcp_link_state *p_link,
303 struct ecore_bulletin_content *p_bulletin);
306 * @brief - return the link capabilities in a given bulletin board
308 * @param p_link - pointer to a struct to fill with link capabilities
311 void __ecore_vf_get_link_caps(struct ecore_mcp_link_capabilities *p_link_caps,
312 struct ecore_bulletin_content *p_bulletin);
315 ecore_vf_pf_tunnel_param_update(struct ecore_hwfn *p_hwfn,
316 struct ecore_tunnel_info *p_tunn);
318 void ecore_vf_set_vf_start_tunn_update_param(struct ecore_tunnel_info *p_tun);
320 u32 ecore_vf_hw_bar_size(struct ecore_hwfn *p_hwfn,
323 #endif /* __ECORE_VF_H__ */