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