4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1, (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1, (the "License").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
36 #ifndef __ECORE_VF_API_H__
37 #define __ECORE_VF_API_H__
39 #include "ecore_sp_api.h"
40 #include "ecore_mcp_api.h"
42 #ifdef CONFIG_ECORE_SRIOV
44 * @brief Read the VF bulletin and act on it if needed
47 * @param p_change - ecore fills 1 iff bulletin board has changed, 0 otherwise.
49 * @return enum _ecore_status
51 enum _ecore_status_t
ecore_vf_read_bulletin(struct ecore_hwfn
*p_hwfn
,
55 * @brief Get link paramters for VF from ecore
58 * @param params - the link params structure to be filled for the VF
60 void ecore_vf_get_link_params(struct ecore_hwfn
*p_hwfn
,
61 struct ecore_mcp_link_params
*params
);
64 * @brief Get link state for VF from ecore
67 * @param link - the link state structure to be filled for the VF
69 void ecore_vf_get_link_state(struct ecore_hwfn
*p_hwfn
,
70 struct ecore_mcp_link_state
*link
);
73 * @brief Get link capabilities for VF from ecore
76 * @param p_link_caps - the link capabilities structure to be filled for the VF
78 void ecore_vf_get_link_caps(struct ecore_hwfn
*p_hwfn
,
79 struct ecore_mcp_link_capabilities
*p_link_caps
);
82 * @brief Get number of Rx queues allocated for VF by ecore
85 * @param num_rxqs - allocated RX queues
87 void ecore_vf_get_num_rxqs(struct ecore_hwfn
*p_hwfn
,
91 * @brief Get number of Rx queues allocated for VF by ecore
94 * @param num_txqs - allocated RX queues
96 void ecore_vf_get_num_txqs(struct ecore_hwfn
*p_hwfn
,
100 * @brief Get port mac address for VF
103 * @param port_mac - destination location for port mac
105 void ecore_vf_get_port_mac(struct ecore_hwfn
*p_hwfn
,
109 * @brief Get number of VLAN filters allocated for VF by ecore
112 * @param num_rxqs - allocated VLAN filters
114 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn
*p_hwfn
,
115 u8
*num_vlan_filters
);
118 * @brief Get number of MAC filters allocated for VF by ecore
121 * @param num_rxqs - allocated MAC filters
123 void ecore_vf_get_num_mac_filters(struct ecore_hwfn
*p_hwfn
,
124 u8
*num_mac_filters
);
127 * @brief Check if VF can set a MAC address
134 bool ecore_vf_check_mac(struct ecore_hwfn
*p_hwfn
, u8
*mac
);
138 * @brief Copy forced MAC address from bulletin board
142 * @param p_is_forced - out param which indicate in case mac
143 * exist if it forced or not.
145 * @return bool - return true if mac exist and false if
148 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn
*hwfn
, u8
*dst_mac
,
152 * @brief Check if force vlan is set and copy the forced vlan
153 * from bulletin board
159 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn
*hwfn
, u16
*dst_pvid
);
162 * @brief Check if VF is based on PF whose driver is pre-fp-hsi version;
163 * This affects the fastpath implementation of the driver.
167 * @return bool - true iff PF is pre-fp-hsi version.
169 bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn
*p_hwfn
);
174 * @brief Set firmware version information in dev_info from VFs acquire response tlv
182 void ecore_vf_get_fw_version(struct ecore_hwfn
*p_hwfn
,
187 void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn
*p_hwfn
,
188 u16
*p_vxlan_port
, u16
*p_geneve_port
);
190 static OSAL_INLINE
enum _ecore_status_t
ecore_vf_read_bulletin(struct ecore_hwfn
*p_hwfn
, u8
*p_change
) {return ECORE_INVAL
;}
191 static OSAL_INLINE
void ecore_vf_get_link_params(struct ecore_hwfn
*p_hwfn
, struct ecore_mcp_link_params
*params
) {}
192 static OSAL_INLINE
void ecore_vf_get_link_state(struct ecore_hwfn
*p_hwfn
, struct ecore_mcp_link_state
*link
) {}
193 static OSAL_INLINE
void ecore_vf_get_link_caps(struct ecore_hwfn
*p_hwfn
, struct ecore_mcp_link_capabilities
*p_link_caps
) {}
194 static OSAL_INLINE
void ecore_vf_get_num_rxqs(struct ecore_hwfn
*p_hwfn
, u8
*num_rxqs
) {}
195 static OSAL_INLINE
void ecore_vf_get_num_txqs(struct ecore_hwfn
*p_hwfn
, u8
*num_txqs
) {}
196 static OSAL_INLINE
void ecore_vf_get_port_mac(struct ecore_hwfn
*p_hwfn
, u8
*port_mac
) {}
197 static OSAL_INLINE
void ecore_vf_get_num_vlan_filters(struct ecore_hwfn
*p_hwfn
, u8
*num_vlan_filters
) {}
198 static OSAL_INLINE
void ecore_vf_get_num_mac_filters(struct ecore_hwfn
*p_hwfn
, u8
*num_mac_filters
) {}
199 static OSAL_INLINE
bool ecore_vf_check_mac(struct ecore_hwfn
*p_hwfn
, u8
*mac
) {return false;}
201 static OSAL_INLINE
bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn
*hwfn
, u8
*dst_mac
, u8
*p_is_forced
) {return false;}
202 static OSAL_INLINE
bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn
*p_hwfn
) {return false; }
204 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
) {}
205 static OSAL_INLINE
void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn
*p_hwfn
, u16
*p_vxlan_port
, u16
*p_geneve_port
) { return; }