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_SRIOV_API_H__
37*14b24e2bSVaishali Kulkarni #define __ECORE_SRIOV_API_H__
38*14b24e2bSVaishali Kulkarni 
39*14b24e2bSVaishali Kulkarni #include "common_hsi.h"
40*14b24e2bSVaishali Kulkarni #include "ecore_status.h"
41*14b24e2bSVaishali Kulkarni 
42*14b24e2bSVaishali Kulkarni #define ECORE_ETH_VF_NUM_MAC_FILTERS 1
43*14b24e2bSVaishali Kulkarni #define ECORE_ETH_VF_NUM_VLAN_FILTERS 2
44*14b24e2bSVaishali Kulkarni #define ECORE_VF_ARRAY_LENGTH (3)
45*14b24e2bSVaishali Kulkarni 
46*14b24e2bSVaishali Kulkarni #define IS_VF(p_dev)		((p_dev)->b_is_vf)
47*14b24e2bSVaishali Kulkarni #define IS_PF(p_dev)		(!((p_dev)->b_is_vf))
48*14b24e2bSVaishali Kulkarni #ifdef CONFIG_ECORE_SRIOV
49*14b24e2bSVaishali Kulkarni #define IS_PF_SRIOV(p_hwfn)	(!!((p_hwfn)->p_dev->p_iov_info))
50*14b24e2bSVaishali Kulkarni #else
51*14b24e2bSVaishali Kulkarni #define IS_PF_SRIOV(p_hwfn)	(0)
52*14b24e2bSVaishali Kulkarni #endif
53*14b24e2bSVaishali Kulkarni #define IS_PF_SRIOV_ALLOC(p_hwfn)	(!!((p_hwfn)->pf_iov_info))
54*14b24e2bSVaishali Kulkarni #define IS_PF_PDA(p_hwfn)	0 /* @@TBD Michalk */
55*14b24e2bSVaishali Kulkarni 
56*14b24e2bSVaishali Kulkarni /* @@@ TBD MichalK - what should this number be*/
57*14b24e2bSVaishali Kulkarni #define ECORE_MAX_VF_CHAINS_PER_PF 16
58*14b24e2bSVaishali Kulkarni 
59*14b24e2bSVaishali Kulkarni /* vport update extended feature tlvs flags */
60*14b24e2bSVaishali Kulkarni enum ecore_iov_vport_update_flag {
61*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_ACTIVATE		= 0,
62*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_VLAN_STRIP		= 1,
63*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_TX_SWITCH		= 2,
64*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_MCAST		= 3,
65*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_ACCEPT_PARAM	= 4,
66*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_RSS			= 5,
67*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_ACCEPT_ANY_VLAN	= 6,
68*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_SGE_TPA		= 7,
69*14b24e2bSVaishali Kulkarni 	ECORE_IOV_VP_UPDATE_MAX			= 8,
70*14b24e2bSVaishali Kulkarni };
71*14b24e2bSVaishali Kulkarni 
72*14b24e2bSVaishali Kulkarni /*PF to VF STATUS is part of vfpf-channel API
73*14b24e2bSVaishali Kulkarni and must be forward compatible */
74*14b24e2bSVaishali Kulkarni enum ecore_iov_pf_to_vf_status {
75*14b24e2bSVaishali Kulkarni         PFVF_STATUS_WAITING = 0,
76*14b24e2bSVaishali Kulkarni         PFVF_STATUS_SUCCESS,
77*14b24e2bSVaishali Kulkarni         PFVF_STATUS_FAILURE,
78*14b24e2bSVaishali Kulkarni         PFVF_STATUS_NOT_SUPPORTED,
79*14b24e2bSVaishali Kulkarni         PFVF_STATUS_NO_RESOURCE,
80*14b24e2bSVaishali Kulkarni         PFVF_STATUS_FORCED,
81*14b24e2bSVaishali Kulkarni 	PFVF_STATUS_MALICIOUS,
82*14b24e2bSVaishali Kulkarni };
83*14b24e2bSVaishali Kulkarni 
84*14b24e2bSVaishali Kulkarni struct ecore_mcp_link_params;
85*14b24e2bSVaishali Kulkarni struct ecore_mcp_link_state;
86*14b24e2bSVaishali Kulkarni struct ecore_mcp_link_capabilities;
87*14b24e2bSVaishali Kulkarni 
88*14b24e2bSVaishali Kulkarni /* These defines are used by the hw-channel; should never change order */
89*14b24e2bSVaishali Kulkarni #define VFPF_ACQUIRE_OS_LINUX (0)
90*14b24e2bSVaishali Kulkarni #define VFPF_ACQUIRE_OS_WINDOWS (1)
91*14b24e2bSVaishali Kulkarni #define VFPF_ACQUIRE_OS_ESX (2)
92*14b24e2bSVaishali Kulkarni #define VFPF_ACQUIRE_OS_SOLARIS (3)
93*14b24e2bSVaishali Kulkarni #define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4)
94*14b24e2bSVaishali Kulkarni 
95*14b24e2bSVaishali Kulkarni struct ecore_vf_acquire_sw_info {
96*14b24e2bSVaishali Kulkarni 	u32 driver_version;
97*14b24e2bSVaishali Kulkarni 	u8 os_type;
98*14b24e2bSVaishali Kulkarni };
99*14b24e2bSVaishali Kulkarni 
100*14b24e2bSVaishali Kulkarni struct ecore_public_vf_info {
101*14b24e2bSVaishali Kulkarni 	/* These copies will later be reflected in the bulletin board,
102*14b24e2bSVaishali Kulkarni 	 * but this copy should be newer.
103*14b24e2bSVaishali Kulkarni 	 */
104*14b24e2bSVaishali Kulkarni 	u8 forced_mac[ETH_ALEN];
105*14b24e2bSVaishali Kulkarni 	u16 forced_vlan;
106*14b24e2bSVaishali Kulkarni };
107*14b24e2bSVaishali Kulkarni 
108*14b24e2bSVaishali Kulkarni struct ecore_iov_vf_init_params {
109*14b24e2bSVaishali Kulkarni 	u16 rel_vf_id;
110*14b24e2bSVaishali Kulkarni 
111*14b24e2bSVaishali Kulkarni 	/* Number of requested Queues; Currently, don't support different
112*14b24e2bSVaishali Kulkarni 	 * number of Rx/Tx queues.
113*14b24e2bSVaishali Kulkarni 	 */
114*14b24e2bSVaishali Kulkarni 	/* TODO - remove this limitation */
115*14b24e2bSVaishali Kulkarni 	u16 num_queues;
116*14b24e2bSVaishali Kulkarni 
117*14b24e2bSVaishali Kulkarni 	/* Allow the client to choose which qzones to use for Rx/Tx,
118*14b24e2bSVaishali Kulkarni 	 * and which queue_base to use for Tx queues on a per-queue basis.
119*14b24e2bSVaishali Kulkarni 	 * Notice values should be relative to the PF resources.
120*14b24e2bSVaishali Kulkarni 	 */
121*14b24e2bSVaishali Kulkarni 	u16 req_rx_queue[ECORE_MAX_VF_CHAINS_PER_PF];
122*14b24e2bSVaishali Kulkarni 	u16 req_tx_queue[ECORE_MAX_VF_CHAINS_PER_PF];
123*14b24e2bSVaishali Kulkarni 
124*14b24e2bSVaishali Kulkarni 	u8 vport_id;
125*14b24e2bSVaishali Kulkarni 
126*14b24e2bSVaishali Kulkarni 	/* Should be set in case RSS is going to be used for VF */
127*14b24e2bSVaishali Kulkarni 	u8 rss_eng_id;
128*14b24e2bSVaishali Kulkarni };
129*14b24e2bSVaishali Kulkarni 
130*14b24e2bSVaishali Kulkarni #ifdef CONFIG_ECORE_SW_CHANNEL
131*14b24e2bSVaishali Kulkarni /* This is SW channel related only... */
132*14b24e2bSVaishali Kulkarni enum mbx_state {
133*14b24e2bSVaishali Kulkarni 	VF_PF_UNKNOWN_STATE			= 0,
134*14b24e2bSVaishali Kulkarni 	VF_PF_WAIT_FOR_START_REQUEST		= 1,
135*14b24e2bSVaishali Kulkarni 	VF_PF_WAIT_FOR_NEXT_CHUNK_OF_REQUEST	= 2,
136*14b24e2bSVaishali Kulkarni 	VF_PF_REQUEST_IN_PROCESSING		= 3,
137*14b24e2bSVaishali Kulkarni 	VF_PF_RESPONSE_READY			= 4,
138*14b24e2bSVaishali Kulkarni };
139*14b24e2bSVaishali Kulkarni 
140*14b24e2bSVaishali Kulkarni struct ecore_iov_sw_mbx {
141*14b24e2bSVaishali Kulkarni 	enum mbx_state		mbx_state;
142*14b24e2bSVaishali Kulkarni 
143*14b24e2bSVaishali Kulkarni 	u32			request_size;
144*14b24e2bSVaishali Kulkarni 	u32			request_offset;
145*14b24e2bSVaishali Kulkarni 
146*14b24e2bSVaishali Kulkarni 	u32			response_size;
147*14b24e2bSVaishali Kulkarni 	u32			response_offset;
148*14b24e2bSVaishali Kulkarni };
149*14b24e2bSVaishali Kulkarni 
150*14b24e2bSVaishali Kulkarni /**
151*14b24e2bSVaishali Kulkarni  * @brief Get the vf sw mailbox params
152*14b24e2bSVaishali Kulkarni  *
153*14b24e2bSVaishali Kulkarni  * @param p_hwfn
154*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
155*14b24e2bSVaishali Kulkarni  *
156*14b24e2bSVaishali Kulkarni  * @return struct ecore_iov_sw_mbx*
157*14b24e2bSVaishali Kulkarni  */
158*14b24e2bSVaishali Kulkarni struct ecore_iov_sw_mbx*
159*14b24e2bSVaishali Kulkarni ecore_iov_get_vf_sw_mbx(struct ecore_hwfn *p_hwfn,
160*14b24e2bSVaishali Kulkarni 			u16 rel_vf_id);
161*14b24e2bSVaishali Kulkarni #endif
162*14b24e2bSVaishali Kulkarni 
163*14b24e2bSVaishali Kulkarni /* This struct is part of ecore_dev and contains data relevant to all hwfns;
164*14b24e2bSVaishali Kulkarni  * Initialized only if SR-IOV cpabability is exposed in PCIe config space.
165*14b24e2bSVaishali Kulkarni  */
166*14b24e2bSVaishali Kulkarni struct ecore_hw_sriov_info {
167*14b24e2bSVaishali Kulkarni 	/* standard SRIOV capability fields, mostly for debugging */
168*14b24e2bSVaishali Kulkarni 	int	pos;		/* capability position */
169*14b24e2bSVaishali Kulkarni 	int	nres;		/* number of resources */
170*14b24e2bSVaishali Kulkarni 	u32	cap;		/* SR-IOV Capabilities */
171*14b24e2bSVaishali Kulkarni 	u16	ctrl;		/* SR-IOV Control */
172*14b24e2bSVaishali Kulkarni 	u16	total_vfs;	/* total VFs associated with the PF */
173*14b24e2bSVaishali Kulkarni 	u16	num_vfs;        /* number of vfs that have been started */
174*14b24e2bSVaishali Kulkarni 	u16	initial_vfs;    /* initial VFs associated with the PF */
175*14b24e2bSVaishali Kulkarni 	u16	nr_virtfn;	/* number of VFs available */
176*14b24e2bSVaishali Kulkarni 	u16	offset;		/* first VF Routing ID offset */
177*14b24e2bSVaishali Kulkarni 	u16	stride;		/* following VF stride */
178*14b24e2bSVaishali Kulkarni 	u16	vf_device_id;	/* VF device id */
179*14b24e2bSVaishali Kulkarni 	u32	pgsz;		/* page size for BAR alignment */
180*14b24e2bSVaishali Kulkarni 	u8	link;		/* Function Dependency Link */
181*14b24e2bSVaishali Kulkarni 
182*14b24e2bSVaishali Kulkarni 	u32	first_vf_in_pf;
183*14b24e2bSVaishali Kulkarni };
184*14b24e2bSVaishali Kulkarni 
185*14b24e2bSVaishali Kulkarni #ifdef CONFIG_ECORE_SRIOV
186*14b24e2bSVaishali Kulkarni #ifndef LINUX_REMOVE
187*14b24e2bSVaishali Kulkarni /**
188*14b24e2bSVaishali Kulkarni  * @brief mark/clear all VFs before/after an incoming PCIe sriov
189*14b24e2bSVaishali Kulkarni  *        disable.
190*14b24e2bSVaishali Kulkarni  *
191*14b24e2bSVaishali Kulkarni  * @param p_dev
192*14b24e2bSVaishali Kulkarni  * @param to_disable
193*14b24e2bSVaishali Kulkarni  */
194*14b24e2bSVaishali Kulkarni void ecore_iov_set_vfs_to_disable(struct ecore_dev *p_dev,
195*14b24e2bSVaishali Kulkarni 				  u8 to_disable);
196*14b24e2bSVaishali Kulkarni 
197*14b24e2bSVaishali Kulkarni /**
198*14b24e2bSVaishali Kulkarni  * @brief mark/clear chosen VF before/after an incoming PCIe
199*14b24e2bSVaishali Kulkarni  *        sriov disable.
200*14b24e2bSVaishali Kulkarni  *
201*14b24e2bSVaishali Kulkarni  * @param p_dev
202*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
203*14b24e2bSVaishali Kulkarni  * @param to_disable
204*14b24e2bSVaishali Kulkarni  */
205*14b24e2bSVaishali Kulkarni void ecore_iov_set_vf_to_disable(struct ecore_dev *p_dev,
206*14b24e2bSVaishali Kulkarni 				 u16 rel_vf_id,
207*14b24e2bSVaishali Kulkarni 				 u8 to_disable);
208*14b24e2bSVaishali Kulkarni 
209*14b24e2bSVaishali Kulkarni /**
210*14b24e2bSVaishali Kulkarni  * @brief ecore_iov_init_hw_for_vf - initialize the HW for
211*14b24e2bSVaishali Kulkarni  *        enabling access of a VF. Also includes preparing the
212*14b24e2bSVaishali Kulkarni  *        IGU for VF access. This needs to be called AFTER hw is
213*14b24e2bSVaishali Kulkarni  *        initialized and BEFORE VF is loaded inside the VM.
214*14b24e2bSVaishali Kulkarni  *
215*14b24e2bSVaishali Kulkarni  * @param p_hwfn
216*14b24e2bSVaishali Kulkarni  * @param p_ptt
217*14b24e2bSVaishali Kulkarni  * @param p_params
218*14b24e2bSVaishali Kulkarni  *
219*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
220*14b24e2bSVaishali Kulkarni  */
221*14b24e2bSVaishali Kulkarni enum _ecore_status_t
222*14b24e2bSVaishali Kulkarni ecore_iov_init_hw_for_vf(struct ecore_hwfn *p_hwfn,
223*14b24e2bSVaishali Kulkarni 			 struct ecore_ptt *p_ptt,
224*14b24e2bSVaishali Kulkarni 			 struct ecore_iov_vf_init_params *p_params);
225*14b24e2bSVaishali Kulkarni 
226*14b24e2bSVaishali Kulkarni /**
227*14b24e2bSVaishali Kulkarni  * @brief ecore_iov_process_mbx_req - process a request received
228*14b24e2bSVaishali Kulkarni  *        from the VF
229*14b24e2bSVaishali Kulkarni  *
230*14b24e2bSVaishali Kulkarni  * @param p_hwfn
231*14b24e2bSVaishali Kulkarni  * @param p_ptt
232*14b24e2bSVaishali Kulkarni  * @param vfid
233*14b24e2bSVaishali Kulkarni  */
234*14b24e2bSVaishali Kulkarni void ecore_iov_process_mbx_req(struct ecore_hwfn *p_hwfn,
235*14b24e2bSVaishali Kulkarni 			       struct ecore_ptt *p_ptt,
236*14b24e2bSVaishali Kulkarni 			       int vfid);
237*14b24e2bSVaishali Kulkarni 
238*14b24e2bSVaishali Kulkarni /**
239*14b24e2bSVaishali Kulkarni  * @brief ecore_iov_release_hw_for_vf - called once upper layer
240*14b24e2bSVaishali Kulkarni  *        knows VF is done with - can release any resources
241*14b24e2bSVaishali Kulkarni  *        allocated for VF at this point. this must be done once
242*14b24e2bSVaishali Kulkarni  *        we know VF is no longer loaded in VM.
243*14b24e2bSVaishali Kulkarni  *
244*14b24e2bSVaishali Kulkarni  * @param p_hwfn
245*14b24e2bSVaishali Kulkarni  * @param p_ptt
246*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
247*14b24e2bSVaishali Kulkarni  *
248*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
249*14b24e2bSVaishali Kulkarni  */
250*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_release_hw_for_vf(struct ecore_hwfn *p_hwfn,
251*14b24e2bSVaishali Kulkarni 						 struct ecore_ptt *p_ptt,
252*14b24e2bSVaishali Kulkarni 						 u16 rel_vf_id);
253*14b24e2bSVaishali Kulkarni 
254*14b24e2bSVaishali Kulkarni /**
255*14b24e2bSVaishali Kulkarni  * @brief ecore_iov_set_vf_ctx - set a context for a given VF
256*14b24e2bSVaishali Kulkarni  *
257*14b24e2bSVaishali Kulkarni  * @param p_hwfn
258*14b24e2bSVaishali Kulkarni  * @param vf_id
259*14b24e2bSVaishali Kulkarni  * @param ctx
260*14b24e2bSVaishali Kulkarni  *
261*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
262*14b24e2bSVaishali Kulkarni  */
263*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_set_vf_ctx(struct ecore_hwfn *p_hwfn,
264*14b24e2bSVaishali Kulkarni 					  u16 vf_id,
265*14b24e2bSVaishali Kulkarni 					  void *ctx);
266*14b24e2bSVaishali Kulkarni 
267*14b24e2bSVaishali Kulkarni /**
268*14b24e2bSVaishali Kulkarni  * @brief FLR cleanup for all VFs
269*14b24e2bSVaishali Kulkarni  *
270*14b24e2bSVaishali Kulkarni  * @param p_hwfn
271*14b24e2bSVaishali Kulkarni  * @param p_ptt
272*14b24e2bSVaishali Kulkarni  *
273*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
274*14b24e2bSVaishali Kulkarni  */
275*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_vf_flr_cleanup(struct ecore_hwfn *p_hwfn,
276*14b24e2bSVaishali Kulkarni 					      struct ecore_ptt *p_ptt);
277*14b24e2bSVaishali Kulkarni 
278*14b24e2bSVaishali Kulkarni /**
279*14b24e2bSVaishali Kulkarni  * @brief FLR cleanup for single VF
280*14b24e2bSVaishali Kulkarni  *
281*14b24e2bSVaishali Kulkarni  * @param p_hwfn
282*14b24e2bSVaishali Kulkarni  * @param p_ptt
283*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
284*14b24e2bSVaishali Kulkarni  *
285*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
286*14b24e2bSVaishali Kulkarni  */
287*14b24e2bSVaishali Kulkarni enum _ecore_status_t
288*14b24e2bSVaishali Kulkarni ecore_iov_single_vf_flr_cleanup(struct ecore_hwfn *p_hwfn,
289*14b24e2bSVaishali Kulkarni 				struct ecore_ptt *p_ptt,
290*14b24e2bSVaishali Kulkarni 				u16 rel_vf_id);
291*14b24e2bSVaishali Kulkarni 
292*14b24e2bSVaishali Kulkarni /**
293*14b24e2bSVaishali Kulkarni  * @brief Update the bulletin with link information. Notice this does NOT
294*14b24e2bSVaishali Kulkarni  *        send a bulletin update, only updates the PF's bulletin.
295*14b24e2bSVaishali Kulkarni  *
296*14b24e2bSVaishali Kulkarni  * @param p_hwfn
297*14b24e2bSVaishali Kulkarni  * @param p_vf
298*14b24e2bSVaishali Kulkarni  * @param params - the link params to use for the VF link configuration
299*14b24e2bSVaishali Kulkarni  * @param link - the link output to use for the VF link configuration
300*14b24e2bSVaishali Kulkarni  * @param p_caps - the link default capabilities.
301*14b24e2bSVaishali Kulkarni  */
302*14b24e2bSVaishali Kulkarni void ecore_iov_set_link(struct ecore_hwfn *p_hwfn,
303*14b24e2bSVaishali Kulkarni 			u16 vfid,
304*14b24e2bSVaishali Kulkarni 			struct ecore_mcp_link_params *params,
305*14b24e2bSVaishali Kulkarni 			struct ecore_mcp_link_state *link,
306*14b24e2bSVaishali Kulkarni 			struct ecore_mcp_link_capabilities *p_caps);
307*14b24e2bSVaishali Kulkarni 
308*14b24e2bSVaishali Kulkarni /**
309*14b24e2bSVaishali Kulkarni  * @brief Returns link information as perceived by VF.
310*14b24e2bSVaishali Kulkarni  *
311*14b24e2bSVaishali Kulkarni  * @param p_hwfn
312*14b24e2bSVaishali Kulkarni  * @param p_vf
313*14b24e2bSVaishali Kulkarni  * @param p_params - the link params visible to vf.
314*14b24e2bSVaishali Kulkarni  * @param p_link - the link state visible to vf.
315*14b24e2bSVaishali Kulkarni  * @param p_caps - the link default capabilities visible to vf.
316*14b24e2bSVaishali Kulkarni  */
317*14b24e2bSVaishali Kulkarni void ecore_iov_get_link(struct ecore_hwfn *p_hwfn,
318*14b24e2bSVaishali Kulkarni 			u16 vfid,
319*14b24e2bSVaishali Kulkarni 			struct ecore_mcp_link_params *params,
320*14b24e2bSVaishali Kulkarni 			struct ecore_mcp_link_state *link,
321*14b24e2bSVaishali Kulkarni 			struct ecore_mcp_link_capabilities *p_caps);
322*14b24e2bSVaishali Kulkarni 
323*14b24e2bSVaishali Kulkarni /**
324*14b24e2bSVaishali Kulkarni  * @brief return if the VF is pending FLR
325*14b24e2bSVaishali Kulkarni  *
326*14b24e2bSVaishali Kulkarni  * @param p_hwfn
327*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
328*14b24e2bSVaishali Kulkarni  *
329*14b24e2bSVaishali Kulkarni  * @return bool
330*14b24e2bSVaishali Kulkarni  */
331*14b24e2bSVaishali Kulkarni bool ecore_iov_is_vf_pending_flr(struct ecore_hwfn *p_hwfn,
332*14b24e2bSVaishali Kulkarni 				 u16 rel_vf_id);
333*14b24e2bSVaishali Kulkarni 
334*14b24e2bSVaishali Kulkarni /**
335*14b24e2bSVaishali Kulkarni  * @brief Check if given VF ID @vfid is valid
336*14b24e2bSVaishali Kulkarni  *        w.r.t. @b_enabled_only value
337*14b24e2bSVaishali Kulkarni  *        if b_enabled_only = true - only enabled VF id is valid
338*14b24e2bSVaishali Kulkarni  *        else any VF id less than max_vfs is valid
339*14b24e2bSVaishali Kulkarni  *
340*14b24e2bSVaishali Kulkarni  * @param p_hwfn
341*14b24e2bSVaishali Kulkarni  * @param rel_vf_id - Relative VF ID
342*14b24e2bSVaishali Kulkarni  * @param b_enabled_only - consider only enabled VF
343*14b24e2bSVaishali Kulkarni  * @param b_non_malicious - true iff we want to validate vf isn't malicious.
344*14b24e2bSVaishali Kulkarni  *
345*14b24e2bSVaishali Kulkarni  * @return bool - true for valid VF ID
346*14b24e2bSVaishali Kulkarni  */
347*14b24e2bSVaishali Kulkarni bool ecore_iov_is_valid_vfid(struct ecore_hwfn *p_hwfn,
348*14b24e2bSVaishali Kulkarni 			     int rel_vf_id,
349*14b24e2bSVaishali Kulkarni 			     bool b_enabled_only, bool b_non_malicious);
350*14b24e2bSVaishali Kulkarni 
351*14b24e2bSVaishali Kulkarni /**
352*14b24e2bSVaishali Kulkarni  * @brief Get VF's public info structure
353*14b24e2bSVaishali Kulkarni  *
354*14b24e2bSVaishali Kulkarni  * @param p_hwfn
355*14b24e2bSVaishali Kulkarni  * @param vfid - Relative VF ID
356*14b24e2bSVaishali Kulkarni  * @param b_enabled_only - false if want to access even if vf is disabled
357*14b24e2bSVaishali Kulkarni  *
358*14b24e2bSVaishali Kulkarni  * @return struct ecore_public_vf_info *
359*14b24e2bSVaishali Kulkarni  */
360*14b24e2bSVaishali Kulkarni struct ecore_public_vf_info*
361*14b24e2bSVaishali Kulkarni ecore_iov_get_public_vf_info(struct ecore_hwfn *p_hwfn,
362*14b24e2bSVaishali Kulkarni 			     u16 vfid, bool b_enabled_only);
363*14b24e2bSVaishali Kulkarni 
364*14b24e2bSVaishali Kulkarni /**
365*14b24e2bSVaishali Kulkarni  * @brief fills a bitmask of all VFs which have pending unhandled
366*14b24e2bSVaishali Kulkarni  *        messages.
367*14b24e2bSVaishali Kulkarni  *
368*14b24e2bSVaishali Kulkarni  * @param p_hwfn
369*14b24e2bSVaishali Kulkarni  */
370*14b24e2bSVaishali Kulkarni void ecore_iov_pf_get_pending_events(struct ecore_hwfn *p_hwfn,
371*14b24e2bSVaishali Kulkarni 				     u64 *events);
372*14b24e2bSVaishali Kulkarni 
373*14b24e2bSVaishali Kulkarni /**
374*14b24e2bSVaishali Kulkarni  * @brief Copy VF's message to PF's buffer
375*14b24e2bSVaishali Kulkarni  *
376*14b24e2bSVaishali Kulkarni  * @param p_hwfn
377*14b24e2bSVaishali Kulkarni  * @param ptt
378*14b24e2bSVaishali Kulkarni  * @param vfid
379*14b24e2bSVaishali Kulkarni  *
380*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
381*14b24e2bSVaishali Kulkarni  */
382*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_copy_vf_msg(struct ecore_hwfn *p_hwfn,
383*14b24e2bSVaishali Kulkarni 					   struct ecore_ptt *ptt,
384*14b24e2bSVaishali Kulkarni 					   int vfid);
385*14b24e2bSVaishali Kulkarni /**
386*14b24e2bSVaishali Kulkarni  * @brief Set forced MAC address in PFs copy of bulletin board
387*14b24e2bSVaishali Kulkarni  *        and configures FW/HW to support the configuration.
388*14b24e2bSVaishali Kulkarni  *
389*14b24e2bSVaishali Kulkarni  * @param p_hwfn
390*14b24e2bSVaishali Kulkarni  * @param mac
391*14b24e2bSVaishali Kulkarni  * @param vfid
392*14b24e2bSVaishali Kulkarni  */
393*14b24e2bSVaishali Kulkarni void ecore_iov_bulletin_set_forced_mac(struct ecore_hwfn *p_hwfn,
394*14b24e2bSVaishali Kulkarni 				       u8 *mac, int vfid);
395*14b24e2bSVaishali Kulkarni 
396*14b24e2bSVaishali Kulkarni /**
397*14b24e2bSVaishali Kulkarni  * @brief Set MAC address in PFs copy of bulletin board without
398*14b24e2bSVaishali Kulkarni  *        configuring FW/HW.
399*14b24e2bSVaishali Kulkarni  *
400*14b24e2bSVaishali Kulkarni  * @param p_hwfn
401*14b24e2bSVaishali Kulkarni  * @param mac
402*14b24e2bSVaishali Kulkarni  * @param vfid
403*14b24e2bSVaishali Kulkarni  */
404*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_bulletin_set_mac(struct ecore_hwfn *p_hwfn,
405*14b24e2bSVaishali Kulkarni 						u8 *mac, int vfid);
406*14b24e2bSVaishali Kulkarni 
407*14b24e2bSVaishali Kulkarni /**
408*14b24e2bSVaishali Kulkarni  * @brief Set default behaviour of VF in case no vlans are configured for it
409*14b24e2bSVaishali Kulkarni  *        whether to accept only untagged traffic or all.
410*14b24e2bSVaishali Kulkarni  *        Must be called prior to the VF vport-start.
411*14b24e2bSVaishali Kulkarni  *
412*14b24e2bSVaishali Kulkarni  * @param p_hwfn
413*14b24e2bSVaishali Kulkarni  * @param b_untagged_only
414*14b24e2bSVaishali Kulkarni  * @param vfid
415*14b24e2bSVaishali Kulkarni  *
416*14b24e2bSVaishali Kulkarni  * @return ECORE_SUCCESS if configuration would stick.
417*14b24e2bSVaishali Kulkarni  */
418*14b24e2bSVaishali Kulkarni enum _ecore_status_t
419*14b24e2bSVaishali Kulkarni ecore_iov_bulletin_set_forced_untagged_default(struct ecore_hwfn *p_hwfn,
420*14b24e2bSVaishali Kulkarni 					       bool b_untagged_only,
421*14b24e2bSVaishali Kulkarni 					       int vfid);
422*14b24e2bSVaishali Kulkarni 
423*14b24e2bSVaishali Kulkarni /**
424*14b24e2bSVaishali Kulkarni  * @brief Get VFs opaque fid.
425*14b24e2bSVaishali Kulkarni  *
426*14b24e2bSVaishali Kulkarni  * @param p_hwfn
427*14b24e2bSVaishali Kulkarni  * @param vfid
428*14b24e2bSVaishali Kulkarni  * @param opaque_fid
429*14b24e2bSVaishali Kulkarni  */
430*14b24e2bSVaishali Kulkarni void ecore_iov_get_vfs_opaque_fid(struct ecore_hwfn *p_hwfn, int vfid,
431*14b24e2bSVaishali Kulkarni 				  u16 *opaque_fid);
432*14b24e2bSVaishali Kulkarni 
433*14b24e2bSVaishali Kulkarni /**
434*14b24e2bSVaishali Kulkarni  * @brief Set forced VLAN [pvid] in PFs copy of bulletin board
435*14b24e2bSVaishali Kulkarni  *        and configures FW/HW to support the configuration.
436*14b24e2bSVaishali Kulkarni  *        Setting of pvid 0 would clear the feature.
437*14b24e2bSVaishali Kulkarni  * @param p_hwfn
438*14b24e2bSVaishali Kulkarni  * @param pvid
439*14b24e2bSVaishali Kulkarni  * @param vfid
440*14b24e2bSVaishali Kulkarni  */
441*14b24e2bSVaishali Kulkarni void ecore_iov_bulletin_set_forced_vlan(struct ecore_hwfn *p_hwfn,
442*14b24e2bSVaishali Kulkarni 					u16 pvid, int vfid);
443*14b24e2bSVaishali Kulkarni 
444*14b24e2bSVaishali Kulkarni /**
445*14b24e2bSVaishali Kulkarni  * @brief Check if VF has VPORT instance. This can be used
446*14b24e2bSVaishali Kulkarni  *	  to check if VPORT is active.
447*14b24e2bSVaishali Kulkarni  *
448*14b24e2bSVaishali Kulkarni  * @param p_hwfn
449*14b24e2bSVaishali Kulkarni  */
450*14b24e2bSVaishali Kulkarni bool ecore_iov_vf_has_vport_instance(struct ecore_hwfn *p_hwfn, int vfid);
451*14b24e2bSVaishali Kulkarni 
452*14b24e2bSVaishali Kulkarni /**
453*14b24e2bSVaishali Kulkarni  * @brief PF posts the bulletin to the VF
454*14b24e2bSVaishali Kulkarni  *
455*14b24e2bSVaishali Kulkarni  * @param p_hwfn
456*14b24e2bSVaishali Kulkarni  * @param p_vf
457*14b24e2bSVaishali Kulkarni  * @param p_ptt
458*14b24e2bSVaishali Kulkarni  *
459*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
460*14b24e2bSVaishali Kulkarni  */
461*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_post_vf_bulletin(struct ecore_hwfn *p_hwfn,
462*14b24e2bSVaishali Kulkarni 						int vfid,
463*14b24e2bSVaishali Kulkarni 						struct ecore_ptt *p_ptt);
464*14b24e2bSVaishali Kulkarni 
465*14b24e2bSVaishali Kulkarni /**
466*14b24e2bSVaishali Kulkarni  * @brief Check if given VF (@vfid) is marked as stopped
467*14b24e2bSVaishali Kulkarni  *
468*14b24e2bSVaishali Kulkarni  * @param p_hwfn
469*14b24e2bSVaishali Kulkarni  * @param vfid
470*14b24e2bSVaishali Kulkarni  *
471*14b24e2bSVaishali Kulkarni  * @return bool : true if stopped
472*14b24e2bSVaishali Kulkarni  */
473*14b24e2bSVaishali Kulkarni bool ecore_iov_is_vf_stopped(struct ecore_hwfn *p_hwfn, int vfid);
474*14b24e2bSVaishali Kulkarni 
475*14b24e2bSVaishali Kulkarni /**
476*14b24e2bSVaishali Kulkarni  * @brief Configure VF anti spoofing
477*14b24e2bSVaishali Kulkarni  *
478*14b24e2bSVaishali Kulkarni  * @param p_hwfn
479*14b24e2bSVaishali Kulkarni  * @param vfid
480*14b24e2bSVaishali Kulkarni  * @param val - spoofchk value - true/false
481*14b24e2bSVaishali Kulkarni  *
482*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
483*14b24e2bSVaishali Kulkarni  */
484*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_spoofchk_set(struct ecore_hwfn *p_hwfn,
485*14b24e2bSVaishali Kulkarni 					    int vfid, bool val);
486*14b24e2bSVaishali Kulkarni 
487*14b24e2bSVaishali Kulkarni /**
488*14b24e2bSVaishali Kulkarni  * @brief Get VF's configured spoof value.
489*14b24e2bSVaishali Kulkarni  *
490*14b24e2bSVaishali Kulkarni  * @param p_hwfn
491*14b24e2bSVaishali Kulkarni  * @param vfid
492*14b24e2bSVaishali Kulkarni  *
493*14b24e2bSVaishali Kulkarni  * @return bool - spoofchk value - true/false
494*14b24e2bSVaishali Kulkarni  */
495*14b24e2bSVaishali Kulkarni bool ecore_iov_spoofchk_get(struct ecore_hwfn *p_hwfn, int vfid);
496*14b24e2bSVaishali Kulkarni 
497*14b24e2bSVaishali Kulkarni /**
498*14b24e2bSVaishali Kulkarni  * @brief Check for SRIOV sanity by PF.
499*14b24e2bSVaishali Kulkarni  *
500*14b24e2bSVaishali Kulkarni  * @param p_hwfn
501*14b24e2bSVaishali Kulkarni  * @param vfid
502*14b24e2bSVaishali Kulkarni  *
503*14b24e2bSVaishali Kulkarni  * @return bool - true if sanity checks passes, else false
504*14b24e2bSVaishali Kulkarni  */
505*14b24e2bSVaishali Kulkarni bool ecore_iov_pf_sanity_check(struct ecore_hwfn *p_hwfn, int vfid);
506*14b24e2bSVaishali Kulkarni 
507*14b24e2bSVaishali Kulkarni /**
508*14b24e2bSVaishali Kulkarni  * @brief Get the num of VF chains.
509*14b24e2bSVaishali Kulkarni  *
510*14b24e2bSVaishali Kulkarni  * @param p_hwfn
511*14b24e2bSVaishali Kulkarni  *
512*14b24e2bSVaishali Kulkarni  * @return u8
513*14b24e2bSVaishali Kulkarni  */
514*14b24e2bSVaishali Kulkarni u8 ecore_iov_vf_chains_per_pf(struct ecore_hwfn *p_hwfn);
515*14b24e2bSVaishali Kulkarni 
516*14b24e2bSVaishali Kulkarni /**
517*14b24e2bSVaishali Kulkarni  * @brief Get vf request mailbox params
518*14b24e2bSVaishali Kulkarni  *
519*14b24e2bSVaishali Kulkarni  * @param p_hwfn
520*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
521*14b24e2bSVaishali Kulkarni  * @param pp_req_virt_addr
522*14b24e2bSVaishali Kulkarni  * @param p_req_virt_size
523*14b24e2bSVaishali Kulkarni  */
524*14b24e2bSVaishali Kulkarni void ecore_iov_get_vf_req_virt_mbx_params(struct ecore_hwfn *p_hwfn,
525*14b24e2bSVaishali Kulkarni 					  u16 rel_vf_id,
526*14b24e2bSVaishali Kulkarni 					  void **pp_req_virt_addr,
527*14b24e2bSVaishali Kulkarni 					  u16 *p_req_virt_size);
528*14b24e2bSVaishali Kulkarni 
529*14b24e2bSVaishali Kulkarni /**
530*14b24e2bSVaishali Kulkarni  * @brief Get vf mailbox params
531*14b24e2bSVaishali Kulkarni  *
532*14b24e2bSVaishali Kulkarni  * @param p_hwfn
533*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
534*14b24e2bSVaishali Kulkarni  * @param pp_reply_virt_addr
535*14b24e2bSVaishali Kulkarni  * @param p_reply_virt_size
536*14b24e2bSVaishali Kulkarni  */
537*14b24e2bSVaishali Kulkarni void ecore_iov_get_vf_reply_virt_mbx_params(struct ecore_hwfn *p_hwfn,
538*14b24e2bSVaishali Kulkarni 					    u16	rel_vf_id,
539*14b24e2bSVaishali Kulkarni 					    void **pp_reply_virt_addr,
540*14b24e2bSVaishali Kulkarni 					    u16	*p_reply_virt_size);
541*14b24e2bSVaishali Kulkarni 
542*14b24e2bSVaishali Kulkarni /**
543*14b24e2bSVaishali Kulkarni  * @brief Validate if the given length is a valid vfpf message
544*14b24e2bSVaishali Kulkarni  *        length
545*14b24e2bSVaishali Kulkarni  *
546*14b24e2bSVaishali Kulkarni  * @param length
547*14b24e2bSVaishali Kulkarni  *
548*14b24e2bSVaishali Kulkarni  * @return bool
549*14b24e2bSVaishali Kulkarni  */
550*14b24e2bSVaishali Kulkarni bool ecore_iov_is_valid_vfpf_msg_length(u32 length);
551*14b24e2bSVaishali Kulkarni 
552*14b24e2bSVaishali Kulkarni /**
553*14b24e2bSVaishali Kulkarni  * @brief Return the max pfvf message length
554*14b24e2bSVaishali Kulkarni  *
555*14b24e2bSVaishali Kulkarni  * @return u32
556*14b24e2bSVaishali Kulkarni  */
557*14b24e2bSVaishali Kulkarni u32 ecore_iov_pfvf_msg_length(void);
558*14b24e2bSVaishali Kulkarni 
559*14b24e2bSVaishali Kulkarni /**
560*14b24e2bSVaishali Kulkarni  * @brief Returns forced MAC address if one is configured
561*14b24e2bSVaishali Kulkarni  *
562*14b24e2bSVaishali Kulkarni  * @parm p_hwfn
563*14b24e2bSVaishali Kulkarni  * @parm rel_vf_id
564*14b24e2bSVaishali Kulkarni  *
565*14b24e2bSVaishali Kulkarni  * @return OSAL_NULL if mac isn't forced; Otherwise, returns MAC.
566*14b24e2bSVaishali Kulkarni  */
567*14b24e2bSVaishali Kulkarni u8 *ecore_iov_bulletin_get_forced_mac(struct ecore_hwfn *p_hwfn,
568*14b24e2bSVaishali Kulkarni 				      u16 rel_vf_id);
569*14b24e2bSVaishali Kulkarni 
570*14b24e2bSVaishali Kulkarni /**
571*14b24e2bSVaishali Kulkarni  * @brief Returns pvid if one is configured
572*14b24e2bSVaishali Kulkarni  *
573*14b24e2bSVaishali Kulkarni  * @parm p_hwfn
574*14b24e2bSVaishali Kulkarni  * @parm rel_vf_id
575*14b24e2bSVaishali Kulkarni  *
576*14b24e2bSVaishali Kulkarni  * @return 0 if no pvid is configured, otherwise the pvid.
577*14b24e2bSVaishali Kulkarni  */
578*14b24e2bSVaishali Kulkarni u16 ecore_iov_bulletin_get_forced_vlan(struct ecore_hwfn *p_hwfn,
579*14b24e2bSVaishali Kulkarni 				       u16 rel_vf_id);
580*14b24e2bSVaishali Kulkarni /**
581*14b24e2bSVaishali Kulkarni  * @brief Configure VFs tx rate
582*14b24e2bSVaishali Kulkarni  *
583*14b24e2bSVaishali Kulkarni  * @param p_hwfn
584*14b24e2bSVaishali Kulkarni  * @param p_ptt
585*14b24e2bSVaishali Kulkarni  * @param vfid
586*14b24e2bSVaishali Kulkarni  * @param val - tx rate value in Mb/sec.
587*14b24e2bSVaishali Kulkarni  *
588*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
589*14b24e2bSVaishali Kulkarni  */
590*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_configure_tx_rate(struct ecore_hwfn *p_hwfn,
591*14b24e2bSVaishali Kulkarni 						 struct ecore_ptt *p_ptt,
592*14b24e2bSVaishali Kulkarni 						 int vfid, int val);
593*14b24e2bSVaishali Kulkarni 
594*14b24e2bSVaishali Kulkarni /**
595*14b24e2bSVaishali Kulkarni  * @brief - Retrieves the statistics associated with a VF
596*14b24e2bSVaishali Kulkarni  *
597*14b24e2bSVaishali Kulkarni  * @param p_hwfn
598*14b24e2bSVaishali Kulkarni  * @param p_ptt
599*14b24e2bSVaishali Kulkarni  * @param vfid
600*14b24e2bSVaishali Kulkarni  * @param p_stats - this will be filled with the VF statistics
601*14b24e2bSVaishali Kulkarni  *
602*14b24e2bSVaishali Kulkarni  * @return ECORE_SUCCESS iff statistics were retrieved. Error otherwise.
603*14b24e2bSVaishali Kulkarni  */
604*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_get_vf_stats(struct ecore_hwfn *p_hwfn,
605*14b24e2bSVaishali Kulkarni 					    struct ecore_ptt *p_ptt,
606*14b24e2bSVaishali Kulkarni 					    int vfid,
607*14b24e2bSVaishali Kulkarni 					    struct ecore_eth_stats *p_stats);
608*14b24e2bSVaishali Kulkarni 
609*14b24e2bSVaishali Kulkarni /**
610*14b24e2bSVaishali Kulkarni  * @brief - Retrieves num of rxqs chains
611*14b24e2bSVaishali Kulkarni  *
612*14b24e2bSVaishali Kulkarni  * @param p_hwfn
613*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
614*14b24e2bSVaishali Kulkarni  *
615*14b24e2bSVaishali Kulkarni  * @return num of rxqs chains.
616*14b24e2bSVaishali Kulkarni  */
617*14b24e2bSVaishali Kulkarni u8 ecore_iov_get_vf_num_rxqs(struct ecore_hwfn *p_hwfn,
618*14b24e2bSVaishali Kulkarni 			     u16 rel_vf_id);
619*14b24e2bSVaishali Kulkarni 
620*14b24e2bSVaishali Kulkarni /**
621*14b24e2bSVaishali Kulkarni  * @brief - Retrieves num of active rxqs chains
622*14b24e2bSVaishali Kulkarni  *
623*14b24e2bSVaishali Kulkarni  * @param p_hwfn
624*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
625*14b24e2bSVaishali Kulkarni  *
626*14b24e2bSVaishali Kulkarni  * @return
627*14b24e2bSVaishali Kulkarni  */
628*14b24e2bSVaishali Kulkarni u8 ecore_iov_get_vf_num_active_rxqs(struct ecore_hwfn *p_hwfn,
629*14b24e2bSVaishali Kulkarni 				    u16 rel_vf_id);
630*14b24e2bSVaishali Kulkarni 
631*14b24e2bSVaishali Kulkarni /**
632*14b24e2bSVaishali Kulkarni  * @brief - Retrieves ctx pointer
633*14b24e2bSVaishali Kulkarni  *
634*14b24e2bSVaishali Kulkarni  * @param p_hwfn
635*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
636*14b24e2bSVaishali Kulkarni  *
637*14b24e2bSVaishali Kulkarni  * @return
638*14b24e2bSVaishali Kulkarni  */
639*14b24e2bSVaishali Kulkarni void *ecore_iov_get_vf_ctx(struct ecore_hwfn *p_hwfn,
640*14b24e2bSVaishali Kulkarni 			   u16 rel_vf_id);
641*14b24e2bSVaishali Kulkarni 
642*14b24e2bSVaishali Kulkarni /**
643*14b24e2bSVaishali Kulkarni  * @brief - Retrieves VF`s num sbs
644*14b24e2bSVaishali Kulkarni  *
645*14b24e2bSVaishali Kulkarni  * @param p_hwfn
646*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
647*14b24e2bSVaishali Kulkarni  *
648*14b24e2bSVaishali Kulkarni  * @return
649*14b24e2bSVaishali Kulkarni  */
650*14b24e2bSVaishali Kulkarni u8 ecore_iov_get_vf_num_sbs(struct ecore_hwfn *p_hwfn,
651*14b24e2bSVaishali Kulkarni 			    u16 rel_vf_id);
652*14b24e2bSVaishali Kulkarni 
653*14b24e2bSVaishali Kulkarni /**
654*14b24e2bSVaishali Kulkarni  * @brief - Returm true if VF is waiting for acquire
655*14b24e2bSVaishali Kulkarni  *
656*14b24e2bSVaishali Kulkarni  * @param p_hwfn
657*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
658*14b24e2bSVaishali Kulkarni  *
659*14b24e2bSVaishali Kulkarni  * @return
660*14b24e2bSVaishali Kulkarni  */
661*14b24e2bSVaishali Kulkarni bool ecore_iov_is_vf_wait_for_acquire(struct ecore_hwfn *p_hwfn,
662*14b24e2bSVaishali Kulkarni 				      u16 rel_vf_id);
663*14b24e2bSVaishali Kulkarni 
664*14b24e2bSVaishali Kulkarni /**
665*14b24e2bSVaishali Kulkarni  * @brief - Returm true if VF is acquired but not initialized
666*14b24e2bSVaishali Kulkarni  *
667*14b24e2bSVaishali Kulkarni  * @param p_hwfn
668*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
669*14b24e2bSVaishali Kulkarni  *
670*14b24e2bSVaishali Kulkarni  * @return
671*14b24e2bSVaishali Kulkarni  */
672*14b24e2bSVaishali Kulkarni bool ecore_iov_is_vf_acquired_not_initialized(struct ecore_hwfn *p_hwfn,
673*14b24e2bSVaishali Kulkarni 					      u16 rel_vf_id);
674*14b24e2bSVaishali Kulkarni 
675*14b24e2bSVaishali Kulkarni /**
676*14b24e2bSVaishali Kulkarni  * @brief - Returm true if VF is acquired and initialized
677*14b24e2bSVaishali Kulkarni  *
678*14b24e2bSVaishali Kulkarni  * @param p_hwfn
679*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
680*14b24e2bSVaishali Kulkarni  *
681*14b24e2bSVaishali Kulkarni  * @return
682*14b24e2bSVaishali Kulkarni  */
683*14b24e2bSVaishali Kulkarni bool ecore_iov_is_vf_initialized(struct ecore_hwfn *p_hwfn,
684*14b24e2bSVaishali Kulkarni 				 u16 rel_vf_id);
685*14b24e2bSVaishali Kulkarni 
686*14b24e2bSVaishali Kulkarni /**
687*14b24e2bSVaishali Kulkarni  * @brief - Returm true if VF has started in FW
688*14b24e2bSVaishali Kulkarni  *
689*14b24e2bSVaishali Kulkarni  * @param p_hwfn
690*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
691*14b24e2bSVaishali Kulkarni  *
692*14b24e2bSVaishali Kulkarni  * @return
693*14b24e2bSVaishali Kulkarni  */
694*14b24e2bSVaishali Kulkarni bool ecore_iov_is_vf_started(struct ecore_hwfn *p_hwfn,
695*14b24e2bSVaishali Kulkarni 			     u16 rel_vf_id);
696*14b24e2bSVaishali Kulkarni 
697*14b24e2bSVaishali Kulkarni /**
698*14b24e2bSVaishali Kulkarni  * @brief - Get VF's vport min rate configured.
699*14b24e2bSVaishali Kulkarni  * @param p_hwfn
700*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
701*14b24e2bSVaishali Kulkarni  *
702*14b24e2bSVaishali Kulkarni  * @return - rate in Mbps
703*14b24e2bSVaishali Kulkarni  */
704*14b24e2bSVaishali Kulkarni int ecore_iov_get_vf_min_rate(struct ecore_hwfn *p_hwfn, int vfid);
705*14b24e2bSVaishali Kulkarni 
706*14b24e2bSVaishali Kulkarni /**
707*14b24e2bSVaishali Kulkarni  * @brief - Configure min rate for VF's vport.
708*14b24e2bSVaishali Kulkarni  * @param p_dev
709*14b24e2bSVaishali Kulkarni  * @param vfid
710*14b24e2bSVaishali Kulkarni  * @param - rate in Mbps
711*14b24e2bSVaishali Kulkarni  *
712*14b24e2bSVaishali Kulkarni  * @return
713*14b24e2bSVaishali Kulkarni  */
714*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_iov_configure_min_tx_rate(struct ecore_dev *p_dev,
715*14b24e2bSVaishali Kulkarni 						     int vfid, u32 rate);
716*14b24e2bSVaishali Kulkarni 
717*14b24e2bSVaishali Kulkarni #endif
718*14b24e2bSVaishali Kulkarni 
719*14b24e2bSVaishali Kulkarni /**
720*14b24e2bSVaishali Kulkarni  * @brief ecore_pf_configure_vf_queue_coalesce - PF configure coalesce parameters
721*14b24e2bSVaishali Kulkarni  *    of VFs for Rx and Tx queue.
722*14b24e2bSVaishali Kulkarni  *    While the API allows setting coalescing per-qid, all queues sharing a SB
723*14b24e2bSVaishali Kulkarni  *    should be in same range [i.e., either 0-0x7f, 0x80-0xff or 0x100-0x1ff]
724*14b24e2bSVaishali Kulkarni  *    otherwise configuration would break.
725*14b24e2bSVaishali Kulkarni  *
726*14b24e2bSVaishali Kulkarni  * @param p_hwfn
727*14b24e2bSVaishali Kulkarni  * @param rx_coal - Rx Coalesce value in micro seconds.
728*14b24e2bSVaishali Kulkarni  * @param tx_coal - TX Coalesce value in micro seconds.
729*14b24e2bSVaishali Kulkarni  * @param vf_id
730*14b24e2bSVaishali Kulkarni  * @param qid
731*14b24e2bSVaishali Kulkarni  *
732*14b24e2bSVaishali Kulkarni  * @return int
733*14b24e2bSVaishali Kulkarni  **/
734*14b24e2bSVaishali Kulkarni enum _ecore_status_t
735*14b24e2bSVaishali Kulkarni ecore_iov_pf_configure_vf_queue_coalesce(struct ecore_hwfn *p_hwfn,
736*14b24e2bSVaishali Kulkarni 					 u16 rx_coal, u16 tx_coal,
737*14b24e2bSVaishali Kulkarni 					 u16 vf_id, u16 qid);
738*14b24e2bSVaishali Kulkarni 
739*14b24e2bSVaishali Kulkarni /**
740*14b24e2bSVaishali Kulkarni  * @brief - Given a VF index, return index of next [including that] active VF.
741*14b24e2bSVaishali Kulkarni  *
742*14b24e2bSVaishali Kulkarni  * @param p_hwfn
743*14b24e2bSVaishali Kulkarni  * @param rel_vf_id
744*14b24e2bSVaishali Kulkarni  *
745*14b24e2bSVaishali Kulkarni  * @return E4_MAX_NUM_VFS in case no further active VFs, otherwise index.
746*14b24e2bSVaishali Kulkarni  */
747*14b24e2bSVaishali Kulkarni u16 ecore_iov_get_next_active_vf(struct ecore_hwfn *p_hwfn, u16 rel_vf_id);
748*14b24e2bSVaishali Kulkarni void ecore_iov_bulletin_set_udp_ports(struct ecore_hwfn *p_hwfn, int vfid,
749*14b24e2bSVaishali Kulkarni 				      u16 vxlan_port, u16 geneve_port);
750*14b24e2bSVaishali Kulkarni #else
751*14b24e2bSVaishali Kulkarni #ifndef LINUX_REMOVE
ecore_iov_set_vfs_to_disable(struct ecore_dev * p_dev,u8 to_disable)752*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_set_vfs_to_disable(struct ecore_dev *p_dev, u8 to_disable) {}
ecore_iov_set_vf_to_disable(struct ecore_dev * p_dev,u16 rel_vf_id,u8 to_disable)753*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_set_vf_to_disable(struct ecore_dev *p_dev, u16 rel_vf_id, u8 to_disable) {}
ecore_iov_init_hw_for_vf(struct ecore_hwfn * p_hwfn,struct ecore_ptt * p_ptt,struct ecore_iov_vf_init_params * p_params)754*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_init_hw_for_vf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, struct ecore_iov_vf_init_params *p_params) {return ECORE_INVAL;}
ecore_iov_process_mbx_req(struct ecore_hwfn * p_hwfn,struct ecore_ptt * p_ptt,int vfid)755*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_process_mbx_req(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, int vfid) {}
ecore_iov_release_hw_for_vf(struct ecore_hwfn * p_hwfn,struct ecore_ptt * p_ptt,u16 rel_vf_id)756*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_release_hw_for_vf(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u16 rel_vf_id) {return ECORE_SUCCESS;}
ecore_iov_set_vf_ctx(struct ecore_hwfn * p_hwfn,u16 vf_id,void * ctx)757*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_set_vf_ctx(struct ecore_hwfn *p_hwfn, u16 vf_id, void *ctx) {return ECORE_INVAL;}
ecore_iov_vf_flr_cleanup(struct ecore_hwfn * p_hwfn,struct ecore_ptt * p_ptt)758*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_vf_flr_cleanup(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt) {return ECORE_INVAL;}
ecore_iov_single_vf_flr_cleanup(struct ecore_hwfn * p_hwfn,struct ecore_ptt * p_ptt,u16 rel_vf_id)759*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_single_vf_flr_cleanup(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt, u16 rel_vf_id) {return ECORE_INVAL;}
ecore_iov_set_link(struct ecore_hwfn * p_hwfn,u16 vfid,struct ecore_mcp_link_params * params,struct ecore_mcp_link_state * link,struct ecore_mcp_link_capabilities * p_caps)760*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_set_link(struct ecore_hwfn *p_hwfn, u16 vfid, struct ecore_mcp_link_params *params, struct ecore_mcp_link_state *link, struct ecore_mcp_link_capabilities *p_caps) {}
ecore_iov_get_link(struct ecore_hwfn * p_hwfn,u16 vfid,struct ecore_mcp_link_params * params,struct ecore_mcp_link_state * link,struct ecore_mcp_link_capabilities * p_caps)761*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_get_link(struct ecore_hwfn *p_hwfn, u16 vfid, struct ecore_mcp_link_params *params, struct ecore_mcp_link_state *link, struct ecore_mcp_link_capabilities *p_caps) {}
ecore_iov_is_vf_pending_flr(struct ecore_hwfn * p_hwfn,u16 rel_vf_id)762*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_iov_is_vf_pending_flr(struct ecore_hwfn *p_hwfn, u16 rel_vf_id) {return false;}
ecore_iov_is_valid_vfid(struct ecore_hwfn * p_hwfn,int rel_vf_id,bool b_enabled_only)763*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_iov_is_valid_vfid(struct ecore_hwfn *p_hwfn, int rel_vf_id, bool b_enabled_only) {return false;}
ecore_iov_get_public_vf_info(struct ecore_hwfn * p_hwfn,u16 vfid,bool b_enabled_only)764*14b24e2bSVaishali Kulkarni static OSAL_INLINE struct ecore_public_vf_info* ecore_iov_get_public_vf_info(struct ecore_hwfn *p_hwfn, u16 vfid, bool b_enabled_only) {return OSAL_NULL;}
ecore_iov_pf_add_pending_events(struct ecore_hwfn * p_hwfn,u8 vfid)765*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_pf_add_pending_events(struct ecore_hwfn *p_hwfn, u8 vfid) {}
ecore_iov_pf_get_and_clear_pending_events(struct ecore_hwfn * p_hwfn,u64 * events)766*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_pf_get_and_clear_pending_events(struct ecore_hwfn *p_hwfn, u64 *events) {}
ecore_iov_copy_vf_msg(struct ecore_hwfn * p_hwfn,struct ecore_ptt * ptt,int vfid)767*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_copy_vf_msg(struct ecore_hwfn *p_hwfn, struct ecore_ptt *ptt, int vfid) {return ECORE_INVAL;}
ecore_iov_bulletin_set_forced_mac(struct ecore_hwfn * p_hwfn,u8 * mac,int vfid)768*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_bulletin_set_forced_mac(struct ecore_hwfn *p_hwfn, u8 *mac, int vfid) {}
ecore_iov_bulletin_set_mac(struct ecore_hwfn * p_hwfn,u8 * mac,int vfid)769*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_bulletin_set_mac(struct ecore_hwfn *p_hwfn, u8 *mac, int vfid) {return ECORE_INVAL;}
ecore_iov_bulletin_set_forced_untagged_default(struct ecore_hwfn * p_hwfn,bool b_untagged_only,int vfid)770*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_bulletin_set_forced_untagged_default(struct ecore_hwfn *p_hwfn, bool b_untagged_only, int vfid) {return ECORE_INVAL;}
ecore_iov_get_vfs_opaque_fid(struct ecore_hwfn * p_hwfn,int vfid,u16 * opaque_fid)771*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_get_vfs_opaque_fid(struct ecore_hwfn *p_hwfn, int vfid, u16 *opaque_fid) {}
ecore_iov_bulletin_set_forced_vlan(struct ecore_hwfn p_hwfn,u16 pvid,int vfid)772*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_bulletin_set_forced_vlan(struct ecore_hwfn p_hwfn, u16 pvid, int vfid) {}
773*14b24e2bSVaishali Kulkarni 
ecore_iov_vf_has_vport_instance(struct ecore_hwfn * p_hwfn,int vfid)774*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_iov_vf_has_vport_instance(struct ecore_hwfn *p_hwfn, int vfid) {return false;}
ecore_iov_post_vf_bulletin(struct ecore_hwfn * p_hwfn,int vfid,struct ecore_ptt * p_ptt)775*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_post_vf_bulletin(struct ecore_hwfn *p_hwfn, int vfid, struct ecore_ptt *p_ptt) {return ECORE_INVAL;}
ecore_iov_is_vf_stopped(struct ecore_hwfn * p_hwfn,int vfid)776*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_iov_is_vf_stopped(struct ecore_hwfn *p_hwfn, int vfid) {return false;}
ecore_iov_spoofchk_set(struct ecore_hwfn * p_hwfn,int vfid,bool val)777*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t ecore_iov_spoofchk_set(struct ecore_hwfn *p_hwfn, int vfid, bool val) {return ECORE_INVAL;}
ecore_iov_spoofchk_get(struct ecore_hwfn * p_hwfn,int vfid)778*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_iov_spoofchk_get(struct ecore_hwfn *p_hwfn, int vfid) {return false;}
ecore_iov_pf_sanity_check(struct ecore_hwfn * p_hwfn,int vfid)779*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_iov_pf_sanity_check(struct ecore_hwfn *p_hwfn, int vfid) {return false;}
ecore_iov_vf_chains_per_pf(struct ecore_hwfn * p_hwfn)780*14b24e2bSVaishali Kulkarni static OSAL_INLINE u8 ecore_iov_vf_chains_per_pf(struct ecore_hwfn *p_hwfn) {return 0;}
ecore_iov_get_vf_req_virt_mbx_params(struct ecore_hwfn * p_hwfn,u16 rel_vf_id,void ** pp_req_virt_addr,u16 * p_req_virt_size)781*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_get_vf_req_virt_mbx_params(struct ecore_hwfn *p_hwfn, u16 rel_vf_id, void **pp_req_virt_addr, u16 *p_req_virt_size) {}
ecore_iov_get_vf_reply_virt_mbx_params(struct ecore_hwfn * p_hwfn,u16 rel_vf_id,void ** pp_reply_virt_addr,u16 * p_reply_virt_size)782*14b24e2bSVaishali Kulkarni static OSAL_INLINE void ecore_iov_get_vf_reply_virt_mbx_params(struct ecore_hwfn *p_hwfn, u16 rel_vf_id, void **pp_reply_virt_addr, u16 *p_reply_virt_size) {}
ecore_iov_is_valid_vfpf_msg_length(u32 length)783*14b24e2bSVaishali Kulkarni static OSAL_INLINE bool ecore_iov_is_valid_vfpf_msg_length(u32 length) {return false;}
ecore_iov_pfvf_msg_length(void)784*14b24e2bSVaishali Kulkarni static OSAL_INLINE u32 ecore_iov_pfvf_msg_length(void) {return 0;}
ecore_iov_bulletin_get_forced_mac(struct ecore_hwfn * p_hwfn,u16 rel_vf_id)785*14b24e2bSVaishali Kulkarni static OSAL_INLINE u8 *ecore_iov_bulletin_get_forced_mac(struct ecore_hwfn *p_hwfn, u16 rel_vf_id) {return OSAL_NULL;}
ecore_iov_bulletin_get_forced_vlan(struct ecore_hwfn * p_hwfn,u16 rel_vf_id)786*14b24e2bSVaishali Kulkarni static OSAL_INLINE u16 ecore_iov_bulletin_get_forced_vlan(struct ecore_hwfn *p_hwfn, u16 rel_vf_id) {return 0;}
ecore_iov_configure_tx_rate(struct ecore_hwfn * p_hwfn,struct ecore_ptt * p_ptt,int vfid,int val)787*14b24e2bSVaishali Kulkarni static OSAL_INLINE enum _ecore_status_t