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 paramters 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 number of available connections [both Rx and Tx] for VF
98 * @param num_cids - allocated number of connections
100 void ecore_vf_get_num_cids(struct ecore_hwfn *p_hwfn, u8 *num_cids);
103 * @brief Get port mac address for VF
106 * @param port_mac - destination location for port mac
108 void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
112 * @brief Get number of VLAN filters allocated for VF by ecore
115 * @param num_rxqs - allocated VLAN filters
117 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
118 u8 *num_vlan_filters);
121 * @brief Get number of MAC filters allocated for VF by ecore
124 * @param num_rxqs - allocated MAC filters
126 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
127 u8 *num_mac_filters);
130 * @brief Check if VF can set a MAC address
137 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac);
141 * @brief Copy forced MAC address from bulletin board
145 * @param p_is_forced - out param which indicate in case mac
146 * exist if it forced or not.
148 * @return bool - return true if mac exist and false if
151 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
155 * @brief Check if force vlan is set and copy the forced vlan
156 * from bulletin board
162 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid);
165 * @brief Check if VF is based on PF whose driver is pre-fp-hsi version;
166 * This affects the fastpath implementation of the driver.
170 * @return bool - true iff PF is pre-fp-hsi version.
172 bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn);
177 * @brief Set firmware version information in dev_info from VFs acquire response tlv
185 void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
190 void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn,
191 u16 *p_vxlan_port, u16 *p_geneve_port);
193 #ifdef CONFIG_ECORE_SW_CHANNEL
195 * @brief set the VF to use a SW/HW channel when communicating with PF.
196 * NOTICE: today the likely first place to call this from VF
197 * would be OSAL_VF_FILL_ACQUIRE_RESC_REQ(); Might want to consider
198 * something a bit more appropriate.
201 * @param b_is_hw - true iff VF is to use a HW-channel
203 void ecore_vf_set_hw_channel(struct ecore_hwfn *p_hwfn, bool b_is_hw);
206 static OSAL_INLINE enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u8 OSAL_UNUSED *p_change) {return ECORE_INVAL;}
207 static OSAL_INLINE void ecore_vf_get_link_params(struct ecore_hwfn OSAL_UNUSED *p_hwfn, struct ecore_mcp_link_params OSAL_UNUSED *params) {}
208 static OSAL_INLINE void ecore_vf_get_link_state(struct ecore_hwfn OSAL_UNUSED *p_hwfn, struct ecore_mcp_link_state OSAL_UNUSED *link) {}
209 static OSAL_INLINE void ecore_vf_get_link_caps(struct ecore_hwfn OSAL_UNUSED *p_hwfn, struct ecore_mcp_link_capabilities OSAL_UNUSED *p_link_caps) {}
210 static OSAL_INLINE void ecore_vf_get_num_rxqs(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u8 OSAL_UNUSED *num_rxqs) {}
211 static OSAL_INLINE void ecore_vf_get_num_txqs(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u8 OSAL_UNUSED *num_txqs) {}
213 static OSAL_INLINE void
214 ecore_vf_get_num_cids(struct ecore_hwfn OSAL_UNUSED *p_hwfn,
215 u8 OSAL_UNUSED *num_cids)
219 static OSAL_INLINE void ecore_vf_get_port_mac(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u8 OSAL_UNUSED *port_mac) {}
220 static OSAL_INLINE void ecore_vf_get_num_vlan_filters(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u8 OSAL_UNUSED *num_vlan_filters) {}
221 static OSAL_INLINE void ecore_vf_get_num_mac_filters(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u8 OSAL_UNUSED *num_mac_filters) {}
222 static OSAL_INLINE bool ecore_vf_check_mac(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u8 OSAL_UNUSED *mac) {return false;}
224 static OSAL_INLINE bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn OSAL_UNUSED *hwfn, u8 OSAL_UNUSED *dst_mac, u8 OSAL_UNUSED *p_is_forced) {return false;}
225 static OSAL_INLINE bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn OSAL_UNUSED *p_hwfn) {return false; }
227 static OSAL_INLINE void ecore_vf_get_fw_version(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u16 OSAL_UNUSED *fw_major, u16 OSAL_UNUSED *fw_minor, u16 OSAL_UNUSED *fw_rev, u16 OSAL_UNUSED *fw_eng) {}
228 static OSAL_INLINE void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn OSAL_UNUSED *p_hwfn, u16 OSAL_UNUSED *p_vxlan_port, u16 OSAL_UNUSED *p_geneve_port) { return; }
230 #ifdef CONFIG_ECORE_SW_CHANNEL
231 static OSAL_INLINE void
232 ecore_vf_set_hw_channel(struct ecore_hwfn OSAL_UNUSED *p_hwfn,
233 bool OSAL_UNUSED b_is_hw) {}