xref: /illumos-gate/usr/src/uts/common/io/qede/579xx/drivers/ecore/ecore_vf_api.h (revision 14b24e2b79293068c8e016a69ef1d872fb5e2fd5)
1 /*
2 * CDDL HEADER START
3 *
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.
7 *
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.
12 *
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]
18 *
19 * CDDL HEADER END
20 */
21 
22 /*
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").
26 
27 * You may not use this file except in compliance with the License.
28 
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
31 
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
34 */
35 
36 #ifndef __ECORE_VF_API_H__
37 #define __ECORE_VF_API_H__
38 
39 #include "ecore_sp_api.h"
40 #include "ecore_mcp_api.h"
41 
42 #ifdef CONFIG_ECORE_SRIOV
43 /**
44  * @brief Read the VF bulletin and act on it if needed
45  *
46  * @param p_hwfn
47  * @param p_change - ecore fills 1 iff bulletin board has changed, 0 otherwise.
48  *
49  * @return enum _ecore_status
50  */
51 enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn,
52 					    u8 *p_change);
53 
54 /**
55  * @brief Get link paramters for VF from ecore
56  *
57  * @param p_hwfn
58  * @param params - the link params structure to be filled for the VF
59  */
60 void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
61 			      struct ecore_mcp_link_params *params);
62 
63 /**
64  * @brief Get link state for VF from ecore
65  *
66  * @param p_hwfn
67  * @param link - the link state structure to be filled for the VF
68  */
69 void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
70 			     struct ecore_mcp_link_state *link);
71 
72 /**
73  * @brief Get link capabilities for VF from ecore
74  *
75  * @param p_hwfn
76  * @param p_link_caps - the link capabilities structure to be filled for the VF
77  */
78 void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
79 			    struct ecore_mcp_link_capabilities *p_link_caps);
80 
81 /**
82  * @brief Get number of Rx queues allocated for VF by ecore
83  *
84  *  @param p_hwfn
85  *  @param num_rxqs - allocated RX queues
86  */
87 void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn,
88 			   u8 *num_rxqs);
89 
90 /**
91  * @brief Get number of Rx queues allocated for VF by ecore
92  *
93  *  @param p_hwfn
94  *  @param num_txqs - allocated RX queues
95  */
96 void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn,
97 			   u8 *num_txqs);
98 
99 /**
100  * @brief Get port mac address for VF
101  *
102  * @param p_hwfn
103  * @param port_mac - destination location for port mac
104  */
105 void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
106 			   u8 *port_mac);
107 
108 /**
109  * @brief Get number of VLAN filters allocated for VF by ecore
110  *
111  *  @param p_hwfn
112  *  @param num_rxqs - allocated VLAN filters
113  */
114 void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
115 				   u8 *num_vlan_filters);
116 
117 /**
118  * @brief Get number of MAC filters allocated for VF by ecore
119  *
120  *  @param p_hwfn
121  *  @param num_rxqs - allocated MAC filters
122  */
123 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
124 				  u8 *num_mac_filters);
125 
126 /**
127  * @brief Check if VF can set a MAC address
128  *
129  * @param p_hwfn
130  * @param mac
131  *
132  * @return bool
133  */
134 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac);
135 
136 #ifndef LINUX_REMOVE
137 /**
138  * @brief Copy forced MAC address from bulletin board
139  *
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.
144  *
145  * @return bool       - return true if mac exist and false if
146  *                      not.
147  */
148 bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
149 				      u8 *p_is_forced);
150 
151 /**
152  * @brief Check if force vlan is set and copy the forced vlan
153  *        from bulletin board
154  *
155  * @param hwfn
156  * @param dst_pvid
157  * @return bool
158  */
159 bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid);
160 
161 /**
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.
164  *
165  * @param p_hwfn
166  *
167  * @return bool - true iff PF is pre-fp-hsi version.
168  */
169 bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn);
170 
171 #endif
172 
173 /**
174  * @brief Set firmware version information in dev_info from VFs acquire response tlv
175  *
176  * @param p_hwfn
177  * @param fw_major
178  * @param fw_minor
179  * @param fw_rev
180  * @param fw_eng
181  */
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
208