2 * Copyright (c) 2017-2018 Cavium, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ECORE_VF_API_H__
32 #define __ECORE_VF_API_H__
34 #include "ecore_sp_api.h"
35 #include "ecore_mcp_api.h"
37 #ifdef CONFIG_ECORE_SRIOV
39 * @brief Read the VF bulletin and act on it if needed
42 * @param p_change - ecore fills 1 iff bulletin board has changed, 0 otherwise.
44 * @return enum _ecore_status
46 enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn,
50 * @brief Get link parameters for VF from ecore
53 * @param params - the link params structure to be filled for the VF
55 void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
56 struct ecore_mcp_link_params *params);
59 * @brief Get link state for VF from ecore
62 * @param link - the link state structure to be filled for the VF
64 void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
65 struct ecore_mcp_link_state *link);
68 * @brief Get link capabilities for VF from ecore
71 * @param p_link_caps - the link capabilities structure to be filled for the VF
73 void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
74 struct ecore_mcp_link_capabilities *p_link_caps);
77 * @brief Get number of Rx queues allocated for VF by ecore
80 * @param num_rxqs - allocated RX queues
82 void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn,
86 * @brief Get number of Rx queues allocated for VF by ecore
89 * @param num_txqs - allocated RX queues
91 void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn,
95 * @brief Get port mac address for VF
98 * @param port_mac - destination location for port mac
100 void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
104 * @brief Get number of VLAN filters allocated for VF by ecore
107 * @param num_rxqs - allocated VLAN filters
109 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
110 u8 *num_vlan_filters);
113 * @brief Get number of MAC filters allocated for VF by ecore
116 * @param num_rxqs - allocated MAC filters
118 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
119 u8 *num_mac_filters);
122 * @brief Check if VF can set a MAC address
129 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac);
132 * @brief Copy forced MAC address from bulletin board
136 * @param p_is_forced - out param which indicate in case mac
137 * exist if it forced or not.
139 * @return bool - return true if mac exist and false if
142 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
146 * @brief Check if force vlan is set and copy the forced vlan
147 * from bulletin board
153 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid);
156 * @brief Check if VF is based on PF whose driver is pre-fp-hsi version;
157 * This affects the fastpath implementation of the driver.
161 * @return bool - true iff PF is pre-fp-hsi version.
163 bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn);
167 * @brief Set firmware version information in dev_info from VFs acquire response tlv
175 void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
180 void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn,
181 u16 *p_vxlan_port, u16 *p_geneve_port);
183 static OSAL_INLINE enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn, u8 *p_change) {return ECORE_INVAL;}
184 static OSAL_INLINE void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_params *params) {}
185 static OSAL_INLINE void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_state *link) {}
186 static OSAL_INLINE void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_capabilities *p_link_caps) {}
187 static OSAL_INLINE void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn, u8 *num_rxqs) {}
188 static OSAL_INLINE void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn, u8 *num_txqs) {}
189 static OSAL_INLINE void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn, u8 *port_mac) {}
190 static OSAL_INLINE void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn, u8 *num_vlan_filters) {}
191 static OSAL_INLINE void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn, u8 *num_mac_filters) {}
192 static OSAL_INLINE bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac) {return false;}
193 static OSAL_INLINE bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac, u8 *p_is_forced) {return false;}
194 static OSAL_INLINE bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn) {return false; }
195 static OSAL_INLINE void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn, u16 *fw_major, u16 *fw_minor, u16 *fw_rev, u16 *fw_eng) {}
196 static OSAL_INLINE void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn, u16 *p_vxlan_port, u16 *p_geneve_port) { return; }