1*14b24e2bSVaishali Kulkarni /*
2*14b24e2bSVaishali Kulkarni * CDDL HEADER START
3*14b24e2bSVaishali Kulkarni *
4*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the
5*14b24e2bSVaishali Kulkarni * Common Development and Distribution License, v.1,  (the "License").
6*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
7*14b24e2bSVaishali Kulkarni *
8*14b24e2bSVaishali Kulkarni * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*14b24e2bSVaishali Kulkarni * or http://opensource.org/licenses/CDDL-1.0.
10*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions
11*14b24e2bSVaishali Kulkarni * and limitations under the License.
12*14b24e2bSVaishali Kulkarni *
13*14b24e2bSVaishali Kulkarni * When distributing Covered Code, include this CDDL HEADER in each
14*14b24e2bSVaishali Kulkarni * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*14b24e2bSVaishali Kulkarni * If applicable, add the following below this CDDL HEADER, with the
16*14b24e2bSVaishali Kulkarni * fields enclosed by brackets "[]" replaced with your own identifying
17*14b24e2bSVaishali Kulkarni * information: Portions Copyright [yyyy] [name of copyright owner]
18*14b24e2bSVaishali Kulkarni *
19*14b24e2bSVaishali Kulkarni * CDDL HEADER END
20*14b24e2bSVaishali Kulkarni */
21*14b24e2bSVaishali Kulkarni 
22*14b24e2bSVaishali Kulkarni /*
23*14b24e2bSVaishali Kulkarni * Copyright 2014-2017 Cavium, Inc.
24*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the Common Development
25*14b24e2bSVaishali Kulkarni * and Distribution License, v.1,  (the "License").
26*14b24e2bSVaishali Kulkarni 
27*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
28*14b24e2bSVaishali Kulkarni 
29*14b24e2bSVaishali Kulkarni * You can obtain a copy of the License at available
30*14b24e2bSVaishali Kulkarni * at http://opensource.org/licenses/CDDL-1.0
31*14b24e2bSVaishali Kulkarni 
32*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions and
33*14b24e2bSVaishali Kulkarni * limitations under the License.
34*14b24e2bSVaishali Kulkarni */
35*14b24e2bSVaishali Kulkarni 
36*14b24e2bSVaishali Kulkarni #ifndef __ECORE_VF_API_H__
37*14b24e2bSVaishali Kulkarni #define __ECORE_VF_API_H__
38*14b24e2bSVaishali Kulkarni 
39*14b24e2bSVaishali Kulkarni #include "ecore_sp_api.h"
40*14b24e2bSVaishali Kulkarni #include "ecore_mcp_api.h"
41*14b24e2bSVaishali Kulkarni 
42*14b24e2bSVaishali Kulkarni #ifdef CONFIG_ECORE_SRIOV
43*14b24e2bSVaishali Kulkarni /**
44*14b24e2bSVaishali Kulkarni  * @brief Read the VF bulletin and act on it if needed
45*14b24e2bSVaishali Kulkarni  *
46*14b24e2bSVaishali Kulkarni  * @param p_hwfn
47*14b24e2bSVaishali Kulkarni  * @param p_change - ecore fills 1 iff bulletin board has changed, 0 otherwise.
48*14b24e2bSVaishali Kulkarni  *
49*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status
50*14b24e2bSVaishali Kulkarni  */
51*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn,
52*14b24e2bSVaishali Kulkarni 					    u8 *p_change);
53*14b24e2bSVaishali Kulkarni 
54*14b24e2bSVaishali Kulkarni /**
55*14b24e2bSVaishali Kulkarni  * @brief Get link paramters for VF from ecore
56*14b24e2bSVaishali Kulkarni  *
57*14b24e2bSVaishali Kulkarni  * @param p_hwfn
58*14b24e2bSVaishali Kulkarni  * @param params - the link params structure to be filled for the VF
59*14b24e2bSVaishali Kulkarni  */
60*14b24e2bSVaishali Kulkarni void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn,
61*14b24e2bSVaishali Kulkarni 			      struct ecore_mcp_link_params *params);
62*14b24e2bSVaishali Kulkarni 
63*14b24e2bSVaishali Kulkarni /**
64*14b24e2bSVaishali Kulkarni  * @brief Get link state for VF from ecore
65*14b24e2bSVaishali Kulkarni  *
66*14b24e2bSVaishali Kulkarni  * @param p_hwfn
67*14b24e2bSVaishali Kulkarni  * @param link - the link state structure to be filled for the VF
68*14b24e2bSVaishali Kulkarni  */
69*14b24e2bSVaishali Kulkarni void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn,
70*14b24e2bSVaishali Kulkarni 			     struct ecore_mcp_link_state *link);
71*14b24e2bSVaishali Kulkarni 
72*14b24e2bSVaishali Kulkarni /**
73*14b24e2bSVaishali Kulkarni  * @brief Get link capabilities for VF from ecore
74*14b24e2bSVaishali Kulkarni  *
75*14b24e2bSVaishali Kulkarni  * @param p_hwfn
76*14b24e2bSVaishali Kulkarni  * @param p_link_caps - the link capabilities structure to be filled for the VF
77*14b24e2bSVaishali Kulkarni  */
78*14b24e2bSVaishali Kulkarni void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn,
79*14b24e2bSVaishali Kulkarni 			    struct ecore_mcp_link_capabilities *p_link_caps);
80*14b24e2bSVaishali Kulkarni 
81*14b24e2bSVaishali Kulkarni /**
82*14b24e2bSVaishali Kulkarni  * @brief Get number of Rx queues allocated for VF by ecore
83*14b24e2bSVaishali Kulkarni  *
84*14b24e2bSVaishali Kulkarni  *  @param p_hwfn
85*14b24e2bSVaishali Kulkarni  *  @param num_rxqs - allocated RX queues
86*14b24e2bSVaishali Kulkarni  */
87*14b24e2bSVaishali Kulkarni void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn,
88*14b24e2bSVaishali Kulkarni 			   u8 *num_rxqs);
89*14b24e2bSVaishali Kulkarni 
90*14b24e2bSVaishali Kulkarni /**
91*14b24e2bSVaishali Kulkarni  * @brief Get number of Rx queues allocated for VF by ecore
92*14b24e2bSVaishali Kulkarni  *
93*14b24e2bSVaishali Kulkarni  *  @param p_hwfn
94*14b24e2bSVaishali Kulkarni  *  @param num_txqs - allocated RX queues
95*14b24e2bSVaishali Kulkarni  */
96*14b24e2bSVaishali Kulkarni void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn,
97*14b24e2bSVaishali Kulkarni 			   u8 *num_txqs);
98*14b24e2bSVaishali Kulkarni 
99*14b24e2bSVaishali Kulkarni /**
100*14b24e2bSVaishali Kulkarni  * @brief Get port mac address for VF
101*14b24e2bSVaishali Kulkarni  *
102*14b24e2bSVaishali Kulkarni  * @param p_hwfn
103*14b24e2bSVaishali Kulkarni  * @param port_mac - destination location for port mac
104*14b24e2bSVaishali Kulkarni  */
105*14b24e2bSVaishali Kulkarni void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn,
106*14b24e2bSVaishali Kulkarni 			   u8 *port_mac);
107*14b24e2bSVaishali Kulkarni 
108*14b24e2bSVaishali Kulkarni /**
109*14b24e2bSVaishali Kulkarni  * @brief Get number of VLAN filters allocated for VF by ecore
110*14b24e2bSVaishali Kulkarni  *
111*14b24e2bSVaishali Kulkarni  *  @param p_hwfn
112*14b24e2bSVaishali Kulkarni  *  @param num_rxqs - allocated VLAN filters
113*14b24e2bSVaishali Kulkarni  */
114*14b24e2bSVaishali Kulkarni void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
115*14b24e2bSVaishali Kulkarni 				   u8 *num_vlan_filters);
116*14b24e2bSVaishali Kulkarni 
117*14b24e2bSVaishali Kulkarni /**
118*14b24e2bSVaishali Kulkarni  * @brief Get number of MAC filters allocated for VF by ecore
119*14b24e2bSVaishali Kulkarni  *
120*14b24e2bSVaishali Kulkarni  *  @param p_hwfn
121*14b24e2bSVaishali Kulkarni  *  @param num_rxqs - allocated MAC filters
122*14b24e2bSVaishali Kulkarni  */
123*14b24e2bSVaishali Kulkarni void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
124*14b24e2bSVaishali Kulkarni 				  u8 *num_mac_filters);
125*14b24e2bSVaishali Kulkarni 
126*14b24e2bSVaishali Kulkarni /**
127*14b24e2bSVaishali Kulkarni  * @brief Check if VF can set a MAC address
128*14b24e2bSVaishali Kulkarni  *
129*14b24e2bSVaishali Kulkarni  * @param p_hwfn
130*14b24e2bSVaishali Kulkarni  * @param mac
131*14b24e2bSVaishali Kulkarni  *
132*14b24e2bSVaishali Kulkarni  * @return bool
133*14b24e2bSVaishali Kulkarni  */
134*14b24e2bSVaishali Kulkarni bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac);
135*14b24e2bSVaishali Kulkarni 
136*14b24e2bSVaishali Kulkarni #ifndef LINUX_REMOVE
137*14b24e2bSVaishali Kulkarni /**
138*14b24e2bSVaishali Kulkarni  * @brief Copy forced MAC address from bulletin board
139*14b24e2bSVaishali Kulkarni  *
140*14b24e2bSVaishali Kulkarni  * @param hwfn
141*14b24e2bSVaishali Kulkarni  * @param dst_mac
142*14b24e2bSVaishali Kulkarni  * @param p_is_forced - out param which indicate in case mac
143*14b24e2bSVaishali Kulkarni  *      	        exist if it forced or not.
144*14b24e2bSVaishali Kulkarni  *
145*14b24e2bSVaishali Kulkarni  * @return bool       - return true if mac exist and false if
146*14b24e2bSVaishali Kulkarni  *                      not.
147*14b24e2bSVaishali Kulkarni  */
148*14b24e2bSVaishali Kulkarni bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac,
149*14b24e2bSVaishali Kulkarni 				      u8 *p_is_forced);
150*14b24e2bSVaishali Kulkarni 
151*14b24e2bSVaishali Kulkarni /**
152*14b24e2bSVaishali Kulkarni  * @brief Check if force vlan is set and copy the forced vlan
153*14b24e2bSVaishali Kulkarni  *        from bulletin board
154*14b24e2bSVaishali Kulkarni  *
155*14b24e2bSVaishali Kulkarni  * @param hwfn
156*14b24e2bSVaishali Kulkarni  * @param dst_pvid
157*14b24e2bSVaishali Kulkarni  * @return bool
158*14b24e2bSVaishali Kulkarni  */
159*14b24e2bSVaishali Kulkarni bool ecore_vf_bulletin_get_forced_vlan(struct ecore_hwfn *hwfn, u16 *dst_pvid);
160*14b24e2bSVaishali Kulkarni 
161*14b24e2bSVaishali Kulkarni /**
162*14b24e2bSVaishali Kulkarni  * @brief Check if VF is based on PF whose driver is pre-fp-hsi version;
163*14b24e2bSVaishali Kulkarni  *        This affects the fastpath implementation of the driver.
164*14b24e2bSVaishali Kulkarni  *
165*14b24e2bSVaishali Kulkarni  * @param p_hwfn
166*14b24e2bSVaishali Kulkarni  *
167*14b24e2bSVaishali Kulkarni  * @return bool - true iff PF is pre-fp-hsi version.
168*14b24e2bSVaishali Kulkarni  */
169*14b24e2bSVaishali Kulkarni bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn);
170*14b24e2bSVaishali Kulkarni 
171*14b24e2bSVaishali Kulkarni #endif
172*14b24e2bSVaishali Kulkarni 
173*14b24e2bSVaishali Kulkarni /**
174*14b24e2bSVaishali Kulkarni  * @brief Set firmware version information in dev_info from VFs acquire response tlv
175*14b24e2bSVaishali Kulkarni  *
176*14b24e2bSVaishali Kulkarni  * @param p_hwfn
177*14b24e2bSVaishali Kulkarni  * @param fw_major
178*14b24e2bSVaishali Kulkarni  * @param fw_minor
179*14b24e2bSVaishali Kulkarni  * @param fw_rev
180*14b24e2bSVaishali Kulkarni  * @param fw_eng
181*14b24e2bSVaishali Kulkarni  */
182*14b24e2bSVaishali Kulkarni void ecore_vf_get_fw_version(struct ecore_hwfn *p_hwfn,
183*14b24e2bSVaishali Kulkarni 			     u16 *fw_major,
184*14b24e2bSVaishali Kulkarni 			     u16 *fw_minor,
185*14b24e2bSVaishali Kulkarni 			     u16 *fw_rev,
186*14b24e2bSVaishali Kulkarni 			     u16 *fw_eng);
187*14b24e2bSVaishali Kulkarni void ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn *p_hwfn,
188*14b24e2bSVaishali Kulkarni 				     u16 *p_vxlan_port, u16 *p_geneve_port);
189*14b24e2bSVaishali Kulkarni #else
ecore_vf_read_bulletin(struct ecore_hwfn * p_hwfn,u8 * p_change)190*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_vf_read_bulletin(struct ecore_hwfn *p_hwfn, u8 *p_change) {return ECORE_INVAL;}
ecore_vf_get_link_params(struct ecore_hwfn * p_hwfn,struct ecore_mcp_link_params * params)191*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_link_params(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_params *params) {}
ecore_vf_get_link_state(struct ecore_hwfn * p_hwfn,struct ecore_mcp_link_state * link)192*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_link_state(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_state *link) {}
ecore_vf_get_link_caps(struct ecore_hwfn * p_hwfn,struct ecore_mcp_link_capabilities * p_link_caps)193*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_link_caps(struct ecore_hwfn *p_hwfn, struct ecore_mcp_link_capabilities *p_link_caps) {}
ecore_vf_get_num_rxqs(struct ecore_hwfn * p_hwfn,u8 * num_rxqs)194*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_num_rxqs(struct ecore_hwfn *p_hwfn, u8 *num_rxqs) {}
ecore_vf_get_num_txqs(struct ecore_hwfn * p_hwfn,u8 * num_txqs)195*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_num_txqs(struct ecore_hwfn *p_hwfn, u8 *num_txqs) {}
ecore_vf_get_port_mac(struct ecore_hwfn * p_hwfn,u8 * port_mac)196*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_port_mac(struct ecore_hwfn *p_hwfn, u8 *port_mac) {}
ecore_vf_get_num_vlan_filters(struct ecore_hwfn * p_hwfn,u8 * num_vlan_filters)197*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn, u8 *num_vlan_filters) {}
ecore_vf_get_num_mac_filters(struct ecore_hwfn * p_hwfn,u8 * num_mac_filters)198*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn, u8 *num_mac_filters) {}
ecore_vf_check_mac(struct ecore_hwfn * p_hwfn,u8 * mac)199*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac) {return false;}
200*14b24e2bSVaishali Kulkarni #ifndef LINUX_REMOVE
ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn * hwfn,u8 * dst_mac,u8 * p_is_forced)201*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_vf_bulletin_get_forced_mac(struct ecore_hwfn *hwfn, u8 *dst_mac, u8 *p_is_forced) {return false;}
ecore_vf_get_pre_fp_hsi(struct ecore_hwfn * p_hwfn)202*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_vf_get_pre_fp_hsi(struct ecore_hwfn *p_hwfn) {return false; }
203*14b24e2bSVaishali Kulkarni #endif
ecore_vf_get_fw_version(struct ecore_hwfn * p_hwfn,u16 * fw_major,u16 * fw_minor,u16 * fw_rev,u16 * fw_eng)204*14b24e2bSVaishali Kulkarni 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) {}
ecore_vf_bulletin_get_udp_ports(struct ecore_hwfn * p_hwfn,u16 * p_vxlan_port,u16 * p_geneve_port)205*14b24e2bSVaishali Kulkarni 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*14b24e2bSVaishali Kulkarni #endif
207*14b24e2bSVaishali Kulkarni #endif