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.
47 enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
48 struct ecore_ptt *p_ptt,
50 struct ecore_queue_cid *p_cid);
51 enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
52 struct ecore_ptt *p_ptt,
54 struct ecore_queue_cid *p_cid);
56 * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
57 * Coalesce value '0' will omit the configuration.
60 * @param rx_coal - coalesce value in micro second for rx queue
61 * @param tx_coal - coalesce value in micro second for tx queue
65 enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
66 u16 rx_coal, u16 tx_coal,
67 struct ecore_queue_cid *p_cid);
69 #ifdef CONFIG_ECORE_SRIOV
71 * @brief hw preparation for VF
72 * sends ACQUIRE message
76 * @return enum _ecore_status_t
78 enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn);
81 * @brief VF - start the RX Queue by sending a message to the PF
84 * @param p_cid - Only relative fields are relevant
85 * @param bd_max_bytes - maximum number of bytes per bd
86 * @param bd_chain_phys_addr - physical address of bd chain
87 * @param cqe_pbl_addr - physical address of pbl
88 * @param cqe_pbl_size - pbl size
89 * @param pp_prod - pointer to the producer to be
92 * @return enum _ecore_status_t
94 enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn,
95 struct ecore_queue_cid *p_cid,
97 dma_addr_t bd_chain_phys_addr,
98 dma_addr_t cqe_pbl_addr,
100 void OSAL_IOMEM **pp_prod);
103 * @brief VF - start the TX queue by sending a message to the
108 * @param bd_chain_phys_addr - physical address of tx chain
109 * @param pp_doorbell - pointer to address to which to
110 * write the doorbell too..
112 * @return enum _ecore_status_t
115 ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn,
116 struct ecore_queue_cid *p_cid,
117 dma_addr_t pbl_addr, u16 pbl_size,
118 void OSAL_IOMEM **pp_doorbell);
121 * @brief VF - stop the RX queue by sending a message to the PF
125 * @param cqe_completion
127 * @return enum _ecore_status_t
129 enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn,
130 struct ecore_queue_cid *p_cid,
131 bool cqe_completion);
134 * @brief VF - stop the TX queue by sending a message to the PF
139 * @return enum _ecore_status_t
141 enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn,
142 struct ecore_queue_cid *p_cid);
144 /* TODO - fix all the !SRIOV prototypes */
148 * @brief VF - update the RX queue by sending a message to the
152 * @param pp_cid - list of queue-cids which we want to update
154 * @param comp_cqe_flg
155 * @param comp_event_flg
157 * @return enum _ecore_status_t
159 enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn,
160 struct ecore_queue_cid **pp_cid,
167 * @brief VF - send a vport update command
172 * @return enum _ecore_status_t
175 ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn,
176 struct ecore_sp_vport_update_params *p_params);
179 * @brief VF - send a close message to PF
183 * @return enum _ecore_status
185 enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn);
188 * @brief VF - free vf`s memories
192 * @return enum _ecore_status
194 enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn);
197 * @brief ecore_vf_get_igu_sb_id - Get the IGU SB ID for a given
198 * sb_id. For VFs igu sbs don't have to be contiguous
205 u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn,
210 * @brief ecore_vf_pf_vport_start - perform vport start for VF.
215 * @param inner_vlan_removal
217 * @param max_buffers_per_cqe,
218 * @param only_untagged - default behavior regarding vlan acceptance
220 * @return enum _ecore_status
222 enum _ecore_status_t ecore_vf_pf_vport_start(
223 struct ecore_hwfn *p_hwfn,
226 u8 inner_vlan_removal,
227 enum ecore_tpa_mode tpa_mode,
228 u8 max_buffers_per_cqe,
232 * @brief ecore_vf_pf_vport_stop - stop the VF's vport
236 * @return enum _ecore_status
238 enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn);
240 enum _ecore_status_t ecore_vf_pf_filter_ucast(
241 struct ecore_hwfn *p_hwfn,
242 struct ecore_filter_ucast *p_param);
244 void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
245 struct ecore_filter_mcast *p_filter_cmd);
248 * @brief ecore_vf_pf_int_cleanup - clean the SB of the VF
252 * @return enum _ecore_status
254 enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn);
257 * @brief - return the link params in a given bulletin board
260 * @param p_params - pointer to a struct to fill with link params
263 void __ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
264 struct ecore_mcp_link_params *p_params,
265 struct ecore_bulletin_content *p_bulletin);
268 * @brief - return the link state in a given bulletin board
271 * @param p_link - pointer to a struct to fill with link state
274 void __ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
275 struct ecore_mcp_link_state *p_link,
276 struct ecore_bulletin_content *p_bulletin);
279 * @brief - return the link capabilities in a given bulletin board
282 * @param p_link - pointer to a struct to fill with link capabilities
285 void __ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
286 struct ecore_mcp_link_capabilities *p_link_caps,
287 struct ecore_bulletin_content *p_bulletin);
290 ecore_vf_pf_tunnel_param_update(struct ecore_hwfn *p_hwfn,
291 struct ecore_tunnel_info *p_tunn);
293 void ecore_vf_set_vf_start_tunn_update_param(struct ecore_tunnel_info *p_tun);
295 #endif /* __ECORE_VF_H__ */