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