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