9506 Want support for QLogic QL41000/45000 series devices
[unleashed.git] / usr / src / uts / common / io / qede / 579xx / drivers / ecore / ecore_vf_api.h
blob4122cafe9dd1f76da1958b38769d1eda179e0f85
1 /*
2 * CDDL HEADER START
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]
19 * CDDL HEADER END
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
43 /**
44 * @brief Read the VF bulletin and act on it if needed
46 * @param p_hwfn
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,
52 u8 *p_change);
54 /**
55 * @brief Get link paramters for VF from ecore
57 * @param p_hwfn
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);
63 /**
64 * @brief Get link state for VF from ecore
66 * @param p_hwfn
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);
72 /**
73 * @brief Get link capabilities for VF from ecore
75 * @param p_hwfn
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);
81 /**
82 * @brief Get number of Rx queues allocated for VF by ecore
84 * @param p_hwfn
85 * @param num_rxqs - allocated RX queues
87 void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn,
88 u8 *num_rxqs);
90 /**
91 * @brief Get number of Rx queues allocated for VF by ecore
93 * @param p_hwfn
94 * @param num_txqs - allocated RX queues
96 void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn,
97 u8 *num_txqs);
99 /**
100 * @brief Get port mac address for VF
102 * @param p_hwfn
103 * @param port_mac - destination location for port mac
105 void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
106 u8 *port_mac);
109 * @brief Get number of VLAN filters allocated for VF by ecore
111 * @param p_hwfn
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
120 * @param p_hwfn
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
129 * @param p_hwfn
130 * @param mac
132 * @return bool
134 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac);
136 #ifndef LINUX_REMOVE
138 * @brief Copy forced MAC address from bulletin board
140 * @param hwfn
141 * @param dst_mac
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
146 * not.
148 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
149 u8 *p_is_forced);
152 * @brief Check if force vlan is set and copy the forced vlan
153 * from bulletin board
155 * @param hwfn
156 * @param dst_pvid
157 * @return bool
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.
165 * @param p_hwfn
167 * @return bool - true iff PF is pre-fp-hsi version.
169 bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn);
171 #endif
174 * @brief Set firmware version information in dev_info from VFs acquire response tlv
176 * @param p_hwfn
177 * @param fw_major
178 * @param fw_minor
179 * @param fw_rev
180 * @param fw_eng
182 void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
183 u16 *fw_major,
184 u16 *fw_minor,
185 u16 *fw_rev,
186 u16 *fw_eng);
187 void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn,
188 u16 *p_vxlan_port, u16 *p_geneve_port);
189 #else
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;}
200 #ifndef LINUX_REMOVE
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; }
203 #endif
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; }
206 #endif
207 #endif