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];
55 * @brief VF - Get coalesce per VF's relative queue.
58 * @param p_coal - coalesce value in micro second for VF queues.
59 * @param p_cid - queue cid
62 enum _ecore_status_t ecore_vf_pf_get_coalesce(struct ecore_hwfn *p_hwfn,
64 struct ecore_queue_cid *p_cid);
66 * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
67 * Coalesce value '0' will omit the configuration.
70 * @param rx_coal - coalesce value in micro second for rx queue
71 * @param tx_coal - coalesce value in micro second for tx queue
72 * @param p_cid - queue cid
75 enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
76 u16 rx_coal, u16 tx_coal,
77 struct ecore_queue_cid *p_cid);
79 #ifdef CONFIG_ECORE_SRIOV
81 * @brief hw preparation for VF
82 * sends ACQUIRE message
86 * @return enum _ecore_status_t
88 enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn);
91 * @brief VF - start the RX Queue by sending a message to the PF
94 * @param p_cid - Only relative fields are relevant
95 * @param bd_max_bytes - maximum number of bytes per bd
96 * @param bd_chain_phys_addr - physical address of bd chain
97 * @param cqe_pbl_addr - physical address of pbl
98 * @param cqe_pbl_size - pbl size
99 * @param pp_prod - pointer to the producer to be
102 * @return enum _ecore_status_t
104 enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn,
105 struct ecore_queue_cid *p_cid,
107 dma_addr_t bd_chain_phys_addr,
108 dma_addr_t cqe_pbl_addr,
110 void OSAL_IOMEM **pp_prod);
113 * @brief VF - start the TX queue by sending a message to the
118 * @param bd_chain_phys_addr - physical address of tx chain
119 * @param pp_doorbell - pointer to address to which to
120 * write the doorbell too..
122 * @return enum _ecore_status_t
125 ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn,
126 struct ecore_queue_cid *p_cid,
127 dma_addr_t pbl_addr, u16 pbl_size,
128 void OSAL_IOMEM **pp_doorbell);
131 * @brief VF - stop the RX queue by sending a message to the PF
135 * @param cqe_completion
137 * @return enum _ecore_status_t
139 enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn,
140 struct ecore_queue_cid *p_cid,
141 bool cqe_completion);
144 * @brief VF - stop the TX queue by sending a message to the PF
149 * @return enum _ecore_status_t
151 enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn,
152 struct ecore_queue_cid *p_cid);
154 /* TODO - fix all the !SRIOV prototypes */
158 * @brief VF - update the RX queue by sending a message to the
162 * @param pp_cid - list of queue-cids which we want to update
164 * @param comp_cqe_flg
165 * @param comp_event_flg
167 * @return enum _ecore_status_t
169 enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn,
170 struct ecore_queue_cid **pp_cid,
177 * @brief VF - send a vport update command
182 * @return enum _ecore_status_t
185 ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn,
186 struct ecore_sp_vport_update_params *p_params);
189 * @brief VF - send a close message to PF
193 * @return enum _ecore_status
195 enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn);
198 * @brief VF - free vf`s memories
202 * @return enum _ecore_status
204 enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn);
207 * @brief ecore_vf_get_igu_sb_id - Get the IGU SB ID for a given
208 * sb_id. For VFs igu sbs don't have to be contiguous
215 u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn,
219 * @brief Stores [or removes] a configured sb_info.
222 * @param sb_id - zero-based SB index [for fastpath]
223 * @param sb_info - may be OSAL_NULL [during removal].
225 void ecore_vf_set_sb_info(struct ecore_hwfn *p_hwfn,
226 u16 sb_id, struct ecore_sb_info *p_sb);
229 * @brief ecore_vf_pf_vport_start - perform vport start for VF.
234 * @param inner_vlan_removal
236 * @param max_buffers_per_cqe,
237 * @param only_untagged - default behavior regarding vlan acceptance
239 * @return enum _ecore_status
241 enum _ecore_status_t ecore_vf_pf_vport_start(
242 struct ecore_hwfn *p_hwfn,
245 u8 inner_vlan_removal,
246 enum ecore_tpa_mode tpa_mode,
247 u8 max_buffers_per_cqe,
251 * @brief ecore_vf_pf_vport_stop - stop the VF's vport
255 * @return enum _ecore_status
257 enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn);
259 enum _ecore_status_t ecore_vf_pf_filter_ucast(
260 struct ecore_hwfn *p_hwfn,
261 struct ecore_filter_ucast *p_param);
263 void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
264 struct ecore_filter_mcast *p_filter_cmd);
267 * @brief ecore_vf_pf_int_cleanup - clean the SB of the VF
271 * @return enum _ecore_status
273 enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn);
276 * @brief - return the link params in a given bulletin board
278 * @param p_params - pointer to a struct to fill with link params
281 void __ecore_vf_get_link_params(struct ecore_mcp_link_params *p_params,
282 struct ecore_bulletin_content *p_bulletin);
285 * @brief - return the link state in a given bulletin board
287 * @param p_link - pointer to a struct to fill with link state
290 void __ecore_vf_get_link_state(struct ecore_mcp_link_state *p_link,
291 struct ecore_bulletin_content *p_bulletin);
294 * @brief - return the link capabilities in a given bulletin board
296 * @param p_link - pointer to a struct to fill with link capabilities
299 void __ecore_vf_get_link_caps(struct ecore_mcp_link_capabilities *p_link_caps,
300 struct ecore_bulletin_content *p_bulletin);
303 ecore_vf_pf_tunnel_param_update(struct ecore_hwfn *p_hwfn,
304 struct ecore_tunnel_info *p_tunn);
306 void ecore_vf_set_vf_start_tunn_update_param(struct ecore_tunnel_info *p_tun);
308 #endif /* __ECORE_VF_H__ */