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 enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
56 struct ecore_ptt *p_ptt,
58 struct ecore_queue_cid *p_cid);
59 enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
60 struct ecore_ptt *p_ptt,
62 struct ecore_queue_cid *p_cid);
64 * @brief VF - Set Rx/Tx coalesce per VF's relative queue.
65 * Coalesce value '0' will omit the configuration.
68 * @param rx_coal - coalesce value in micro second for rx queue
69 * @param tx_coal - coalesce value in micro second for tx queue
73 enum _ecore_status_t ecore_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
74 u16 rx_coal, u16 tx_coal,
75 struct ecore_queue_cid *p_cid);
77 #ifdef CONFIG_ECORE_SRIOV
79 * @brief hw preparation for VF
80 * sends ACQUIRE message
84 * @return enum _ecore_status_t
86 enum _ecore_status_t ecore_vf_hw_prepare(struct ecore_hwfn *p_hwfn);
89 * @brief VF - start the RX Queue by sending a message to the PF
92 * @param p_cid - Only relative fields are relevant
93 * @param bd_max_bytes - maximum number of bytes per bd
94 * @param bd_chain_phys_addr - physical address of bd chain
95 * @param cqe_pbl_addr - physical address of pbl
96 * @param cqe_pbl_size - pbl size
97 * @param pp_prod - pointer to the producer to be
100 * @return enum _ecore_status_t
102 enum _ecore_status_t ecore_vf_pf_rxq_start(struct ecore_hwfn *p_hwfn,
103 struct ecore_queue_cid *p_cid,
105 dma_addr_t bd_chain_phys_addr,
106 dma_addr_t cqe_pbl_addr,
108 void OSAL_IOMEM **pp_prod);
111 * @brief VF - start the TX queue by sending a message to the
116 * @param bd_chain_phys_addr - physical address of tx chain
117 * @param pp_doorbell - pointer to address to which to
118 * write the doorbell too..
120 * @return enum _ecore_status_t
123 ecore_vf_pf_txq_start(struct ecore_hwfn *p_hwfn,
124 struct ecore_queue_cid *p_cid,
125 dma_addr_t pbl_addr, u16 pbl_size,
126 void OSAL_IOMEM **pp_doorbell);
129 * @brief VF - stop the RX queue by sending a message to the PF
133 * @param cqe_completion
135 * @return enum _ecore_status_t
137 enum _ecore_status_t ecore_vf_pf_rxq_stop(struct ecore_hwfn *p_hwfn,
138 struct ecore_queue_cid *p_cid,
139 bool cqe_completion);
142 * @brief VF - stop the TX queue by sending a message to the PF
147 * @return enum _ecore_status_t
149 enum _ecore_status_t ecore_vf_pf_txq_stop(struct ecore_hwfn *p_hwfn,
150 struct ecore_queue_cid *p_cid);
152 /* TODO - fix all the !SRIOV prototypes */
156 * @brief VF - update the RX queue by sending a message to the
160 * @param pp_cid - list of queue-cids which we want to update
162 * @param comp_cqe_flg
163 * @param comp_event_flg
165 * @return enum _ecore_status_t
167 enum _ecore_status_t ecore_vf_pf_rxqs_update(struct ecore_hwfn *p_hwfn,
168 struct ecore_queue_cid **pp_cid,
175 * @brief VF - send a vport update command
180 * @return enum _ecore_status_t
183 ecore_vf_pf_vport_update(struct ecore_hwfn *p_hwfn,
184 struct ecore_sp_vport_update_params *p_params);
187 * @brief VF - send a close message to PF
191 * @return enum _ecore_status
193 enum _ecore_status_t ecore_vf_pf_reset(struct ecore_hwfn *p_hwfn);
196 * @brief VF - free vf`s memories
200 * @return enum _ecore_status
202 enum _ecore_status_t ecore_vf_pf_release(struct ecore_hwfn *p_hwfn);
205 * @brief ecore_vf_get_igu_sb_id - Get the IGU SB ID for a given
206 * sb_id. For VFs igu sbs don't have to be contiguous
213 u16 ecore_vf_get_igu_sb_id(struct ecore_hwfn *p_hwfn,
217 * @brief Stores [or removes] a configured sb_info.
220 * @param sb_id - zero-based SB index [for fastpath]
221 * @param sb_info - may be OSAL_NULL [during removal].
223 void ecore_vf_set_sb_info(struct ecore_hwfn *p_hwfn,
224 u16 sb_id, struct ecore_sb_info *p_sb);
227 * @brief ecore_vf_pf_vport_start - perform vport start for VF.
232 * @param inner_vlan_removal
234 * @param max_buffers_per_cqe,
235 * @param only_untagged - default behavior regarding vlan acceptance
237 * @return enum _ecore_status
239 enum _ecore_status_t ecore_vf_pf_vport_start(
240 struct ecore_hwfn *p_hwfn,
243 u8 inner_vlan_removal,
244 enum ecore_tpa_mode tpa_mode,
245 u8 max_buffers_per_cqe,
249 * @brief ecore_vf_pf_vport_stop - stop the VF's vport
253 * @return enum _ecore_status
255 enum _ecore_status_t ecore_vf_pf_vport_stop(struct ecore_hwfn *p_hwfn);
257 enum _ecore_status_t ecore_vf_pf_filter_ucast(
258 struct ecore_hwfn *p_hwfn,
259 struct ecore_filter_ucast *p_param);
261 void ecore_vf_pf_filter_mcast(struct ecore_hwfn *p_hwfn,
262 struct ecore_filter_mcast *p_filter_cmd);
265 * @brief ecore_vf_pf_int_cleanup - clean the SB of the VF
269 * @return enum _ecore_status
271 enum _ecore_status_t ecore_vf_pf_int_cleanup(struct ecore_hwfn *p_hwfn);
274 * @brief - return the link params in a given bulletin board
276 * @param p_params - pointer to a struct to fill with link params
279 void __ecore_vf_get_link_params(struct ecore_mcp_link_params *p_params,
280 struct ecore_bulletin_content *p_bulletin);
283 * @brief - return the link state in a given bulletin board
285 * @param p_link - pointer to a struct to fill with link state
288 void __ecore_vf_get_link_state(struct ecore_mcp_link_state *p_link,
289 struct ecore_bulletin_content *p_bulletin);
292 * @brief - return the link capabilities in a given bulletin board
294 * @param p_link - pointer to a struct to fill with link capabilities
297 void __ecore_vf_get_link_caps(struct ecore_mcp_link_capabilities *p_link_caps,
298 struct ecore_bulletin_content *p_bulletin);
301 ecore_vf_pf_tunnel_param_update(struct ecore_hwfn *p_hwfn,
302 struct ecore_tunnel_info *p_tunn);
304 void ecore_vf_set_vf_start_tunn_update_param(struct ecore_tunnel_info *p_tun);
306 #endif /* __ECORE_VF_H__ */