1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
7 #ifndef __ECORE_VF_API_H__
8 #define __ECORE_VF_API_H__
10 #include "ecore_sp_api.h"
11 #include "ecore_mcp_api.h"
13 #ifdef CONFIG_ECORE_SRIOV
15 #define ECORE_VF_ACQUIRE_THRESH 3
18 * @brief Read the VF bulletin and act on it if needed
21 * @param p_change - ecore fills 1 iff bulletin board has changed, 0 otherwise.
23 * @return enum _ecore_status
25 enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn,
29 * @brief Get link parameters for VF from ecore
32 * @param params - the link params structure to be filled for the VF
34 void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
35 struct ecore_mcp_link_params *params);
38 * @brief Get link state for VF from ecore
41 * @param link - the link state structure to be filled for the VF
43 void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
44 struct ecore_mcp_link_state *link);
47 * @brief Get link capabilities for VF from ecore
50 * @param p_link_caps - the link capabilities structure to be filled for the VF
52 void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
53 struct ecore_mcp_link_capabilities *p_link_caps);
56 * @brief Get number of Rx queues allocated for VF by ecore
59 * @param num_rxqs - allocated RX queues
61 void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn,
65 * @brief Get number of Rx queues allocated for VF by ecore
68 * @param num_txqs - allocated RX queues
70 void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn,
74 * @brief Get port mac address for VF
77 * @param port_mac - destination location for port mac
79 void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
83 * @brief Get number of VLAN filters allocated for VF by ecore
86 * @param num_rxqs - allocated VLAN filters
88 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
89 u8 *num_vlan_filters);
91 void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
95 * @brief Get number of MAC filters allocated for VF by ecore
98 * @param num_rxqs - allocated MAC filters
100 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
101 u32 *num_mac_filters);
104 * @brief Check if VF can set a MAC address
111 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac);
115 * @brief Copy forced MAC address from bulletin board
119 * @param p_is_forced - out param which indicate in case mac
120 * exist if it forced or not.
122 * @return bool - return true if mac exist and false if
125 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
129 * @brief Check if force vlan is set and copy the forced vlan
130 * from bulletin board
136 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid);
139 * @brief Check if VF is based on PF whose driver is pre-fp-hsi version;
140 * This affects the fastpath implementation of the driver.
144 * @return bool - true iff PF is pre-fp-hsi version.
146 bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn);
151 * @brief Set firmware version information in dev_info from VFs acquire
160 void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
165 void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn,
166 u16 *p_vxlan_port, u16 *p_geneve_port);
168 #ifdef CONFIG_ECORE_SW_CHANNEL
170 * @brief set the VF to use a SW/HW channel when communicating with PF.
171 * NOTICE: today the likely first place to call this from VF
172 * would be OSAL_VF_FILL_ACQUIRE_RESC_REQ(); Might want to consider
173 * something a bit more appropriate.
176 * @param b_is_hw - true iff VF is to use a HW-channel
178 void ecore_vf_set_hw_channel(struct ecore_hwfn *p_hwfn, bool b_is_hw);