Linux-libre 4.9.174-gnu
[librecmc/linux-libre.git] / drivers / net / ethernet / qlogic / qed / qed_vf.h
1 /* QLogic qed NIC Driver
2  * Copyright (c) 2015 QLogic Corporation
3  *
4  * This software is available under the terms of the GNU General Public License
5  * (GPL) Version 2, available from the file COPYING in the main directory of
6  * this source tree.
7  */
8
9 #ifndef _QED_VF_H
10 #define _QED_VF_H
11
12 #include "qed_l2.h"
13 #include "qed_mcp.h"
14
15 #define T_ETH_INDIRECTION_TABLE_SIZE 128
16 #define T_ETH_RSS_KEY_SIZE 10
17
18 struct vf_pf_resc_request {
19         u8 num_rxqs;
20         u8 num_txqs;
21         u8 num_sbs;
22         u8 num_mac_filters;
23         u8 num_vlan_filters;
24         u8 num_mc_filters;
25         u16 padding;
26 };
27
28 struct hw_sb_info {
29         u16 hw_sb_id;
30         u8 sb_qid;
31         u8 padding[5];
32 };
33
34 #define TLV_BUFFER_SIZE                 1024
35
36 enum {
37         PFVF_STATUS_WAITING,
38         PFVF_STATUS_SUCCESS,
39         PFVF_STATUS_FAILURE,
40         PFVF_STATUS_NOT_SUPPORTED,
41         PFVF_STATUS_NO_RESOURCE,
42         PFVF_STATUS_FORCED,
43 };
44
45 /* vf pf channel tlvs */
46 /* general tlv header (used for both vf->pf request and pf->vf response) */
47 struct channel_tlv {
48         u16 type;
49         u16 length;
50 };
51
52 /* header of first vf->pf tlv carries the offset used to calculate reponse
53  * buffer address
54  */
55 struct vfpf_first_tlv {
56         struct channel_tlv tl;
57         u32 padding;
58         u64 reply_address;
59 };
60
61 /* header of pf->vf tlvs, carries the status of handling the request */
62 struct pfvf_tlv {
63         struct channel_tlv tl;
64         u8 status;
65         u8 padding[3];
66 };
67
68 /* response tlv used for most tlvs */
69 struct pfvf_def_resp_tlv {
70         struct pfvf_tlv hdr;
71 };
72
73 /* used to terminate and pad a tlv list */
74 struct channel_list_end_tlv {
75         struct channel_tlv tl;
76         u8 padding[4];
77 };
78
79 #define VFPF_ACQUIRE_OS_LINUX (0)
80 #define VFPF_ACQUIRE_OS_WINDOWS (1)
81 #define VFPF_ACQUIRE_OS_ESX (2)
82 #define VFPF_ACQUIRE_OS_SOLARIS (3)
83 #define VFPF_ACQUIRE_OS_LINUX_USERSPACE (4)
84
85 struct vfpf_acquire_tlv {
86         struct vfpf_first_tlv first_tlv;
87
88         struct vf_pf_vfdev_info {
89 #define VFPF_ACQUIRE_CAP_PRE_FP_HSI     (1 << 0) /* VF pre-FP hsi version */
90 #define VFPF_ACQUIRE_CAP_100G           (1 << 1) /* VF can support 100g */
91                 u64 capabilities;
92                 u8 fw_major;
93                 u8 fw_minor;
94                 u8 fw_revision;
95                 u8 fw_engineering;
96                 u32 driver_version;
97                 u16 opaque_fid; /* ME register value */
98                 u8 os_type;     /* VFPF_ACQUIRE_OS_* value */
99                 u8 eth_fp_hsi_major;
100                 u8 eth_fp_hsi_minor;
101                 u8 padding[3];
102         } vfdev_info;
103
104         struct vf_pf_resc_request resc_request;
105
106         u64 bulletin_addr;
107         u32 bulletin_size;
108         u32 padding;
109 };
110
111 /* receive side scaling tlv */
112 struct vfpf_vport_update_rss_tlv {
113         struct channel_tlv tl;
114
115         u8 update_rss_flags;
116 #define VFPF_UPDATE_RSS_CONFIG_FLAG       BIT(0)
117 #define VFPF_UPDATE_RSS_CAPS_FLAG         BIT(1)
118 #define VFPF_UPDATE_RSS_IND_TABLE_FLAG    BIT(2)
119 #define VFPF_UPDATE_RSS_KEY_FLAG          BIT(3)
120
121         u8 rss_enable;
122         u8 rss_caps;
123         u8 rss_table_size_log;  /* The table size is 2 ^ rss_table_size_log */
124         u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
125         u32 rss_key[T_ETH_RSS_KEY_SIZE];
126 };
127
128 struct pfvf_storm_stats {
129         u32 address;
130         u32 len;
131 };
132
133 struct pfvf_stats_info {
134         struct pfvf_storm_stats mstats;
135         struct pfvf_storm_stats pstats;
136         struct pfvf_storm_stats tstats;
137         struct pfvf_storm_stats ustats;
138 };
139
140 struct pfvf_acquire_resp_tlv {
141         struct pfvf_tlv hdr;
142
143         struct pf_vf_pfdev_info {
144                 u32 chip_num;
145                 u32 mfw_ver;
146
147                 u16 fw_major;
148                 u16 fw_minor;
149                 u16 fw_rev;
150                 u16 fw_eng;
151
152                 u64 capabilities;
153 #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED       BIT(0)
154 #define PFVF_ACQUIRE_CAP_100G                   BIT(1)  /* If set, 100g PF */
155 /* There are old PF versions where the PF might mistakenly override the sanity
156  * mechanism [version-based] and allow a VF that can't be supported to pass
157  * the acquisition phase.
158  * To overcome this, PFs now indicate that they're past that point and the new
159  * VFs would fail probe on the older PFs that fail to do so.
160  */
161 #define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE       BIT(2)
162
163                 u16 db_size;
164                 u8 indices_per_sb;
165                 u8 os_type;
166
167                 /* These should match the PF's qed_dev values */
168                 u16 chip_rev;
169                 u8 dev_type;
170
171                 u8 padding;
172
173                 struct pfvf_stats_info stats_info;
174
175                 u8 port_mac[ETH_ALEN];
176
177                 /* It's possible PF had to configure an older fastpath HSI
178                  * [in case VF is newer than PF]. This is communicated back
179                  * to the VF. It can also be used in case of error due to
180                  * non-matching versions to shed light in VF about failure.
181                  */
182                 u8 major_fp_hsi;
183                 u8 minor_fp_hsi;
184         } pfdev_info;
185
186         struct pf_vf_resc {
187 #define PFVF_MAX_QUEUES_PER_VF          16
188 #define PFVF_MAX_SBS_PER_VF             16
189                 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
190                 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
191                 u8 cid[PFVF_MAX_QUEUES_PER_VF];
192
193                 u8 num_rxqs;
194                 u8 num_txqs;
195                 u8 num_sbs;
196                 u8 num_mac_filters;
197                 u8 num_vlan_filters;
198                 u8 num_mc_filters;
199                 u8 padding[2];
200         } resc;
201
202         u32 bulletin_size;
203         u32 padding;
204 };
205
206 struct pfvf_start_queue_resp_tlv {
207         struct pfvf_tlv hdr;
208         u32 offset;             /* offset to consumer/producer of queue */
209         u8 padding[4];
210 };
211
212 /* Setup Queue */
213 struct vfpf_start_rxq_tlv {
214         struct vfpf_first_tlv first_tlv;
215
216         /* physical addresses */
217         u64 rxq_addr;
218         u64 deprecated_sge_addr;
219         u64 cqe_pbl_addr;
220
221         u16 cqe_pbl_size;
222         u16 hw_sb;
223         u16 rx_qid;
224         u16 hc_rate;            /* desired interrupts per sec. */
225
226         u16 bd_max_bytes;
227         u16 stat_id;
228         u8 sb_index;
229         u8 padding[3];
230 };
231
232 struct vfpf_start_txq_tlv {
233         struct vfpf_first_tlv first_tlv;
234
235         /* physical addresses */
236         u64 pbl_addr;
237         u16 pbl_size;
238         u16 stat_id;
239         u16 tx_qid;
240         u16 hw_sb;
241
242         u32 flags;              /* VFPF_QUEUE_FLG_X flags */
243         u16 hc_rate;            /* desired interrupts per sec. */
244         u8 sb_index;
245         u8 padding[3];
246 };
247
248 /* Stop RX Queue */
249 struct vfpf_stop_rxqs_tlv {
250         struct vfpf_first_tlv first_tlv;
251
252         u16 rx_qid;
253         u8 num_rxqs;
254         u8 cqe_completion;
255         u8 padding[4];
256 };
257
258 /* Stop TX Queues */
259 struct vfpf_stop_txqs_tlv {
260         struct vfpf_first_tlv first_tlv;
261
262         u16 tx_qid;
263         u8 num_txqs;
264         u8 padding[5];
265 };
266
267 struct vfpf_update_rxq_tlv {
268         struct vfpf_first_tlv first_tlv;
269
270         u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
271
272         u16 rx_qid;
273         u8 num_rxqs;
274         u8 flags;
275 #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG    BIT(0)
276 #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG          BIT(1)
277 #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG        BIT(2)
278
279         u8 padding[4];
280 };
281
282 /* Set Queue Filters */
283 struct vfpf_q_mac_vlan_filter {
284         u32 flags;
285 #define VFPF_Q_FILTER_DEST_MAC_VALID    0x01
286 #define VFPF_Q_FILTER_VLAN_TAG_VALID    0x02
287 #define VFPF_Q_FILTER_SET_MAC           0x100   /* set/clear */
288
289         u8 mac[ETH_ALEN];
290         u16 vlan_tag;
291
292         u8 padding[4];
293 };
294
295 /* Start a vport */
296 struct vfpf_vport_start_tlv {
297         struct vfpf_first_tlv first_tlv;
298
299         u64 sb_addr[PFVF_MAX_SBS_PER_VF];
300
301         u32 tpa_mode;
302         u16 dep1;
303         u16 mtu;
304
305         u8 vport_id;
306         u8 inner_vlan_removal;
307
308         u8 only_untagged;
309         u8 max_buffers_per_cqe;
310
311         u8 padding[4];
312 };
313
314 /* Extended tlvs - need to add rss, mcast, accept mode tlvs */
315 struct vfpf_vport_update_activate_tlv {
316         struct channel_tlv tl;
317         u8 update_rx;
318         u8 update_tx;
319         u8 active_rx;
320         u8 active_tx;
321 };
322
323 struct vfpf_vport_update_tx_switch_tlv {
324         struct channel_tlv tl;
325         u8 tx_switching;
326         u8 padding[3];
327 };
328
329 struct vfpf_vport_update_vlan_strip_tlv {
330         struct channel_tlv tl;
331         u8 remove_vlan;
332         u8 padding[3];
333 };
334
335 struct vfpf_vport_update_mcast_bin_tlv {
336         struct channel_tlv tl;
337         u8 padding[4];
338
339         /* There are only 256 approx bins, and in HSI they're divided into
340          * 32-bit values. As old VFs used to set-bit to the values on its side,
341          * the upper half of the array is never expected to contain any data.
342          */
343         u64 bins[4];
344         u64 obsolete_bins[4];
345 };
346
347 struct vfpf_vport_update_accept_param_tlv {
348         struct channel_tlv tl;
349         u8 update_rx_mode;
350         u8 update_tx_mode;
351         u8 rx_accept_filter;
352         u8 tx_accept_filter;
353 };
354
355 struct vfpf_vport_update_accept_any_vlan_tlv {
356         struct channel_tlv tl;
357         u8 update_accept_any_vlan_flg;
358         u8 accept_any_vlan;
359
360         u8 padding[2];
361 };
362
363 struct vfpf_vport_update_sge_tpa_tlv {
364         struct channel_tlv tl;
365
366         u16 sge_tpa_flags;
367 #define VFPF_TPA_IPV4_EN_FLAG           BIT(0)
368 #define VFPF_TPA_IPV6_EN_FLAG           BIT(1)
369 #define VFPF_TPA_PKT_SPLIT_FLAG         BIT(2)
370 #define VFPF_TPA_HDR_DATA_SPLIT_FLAG    BIT(3)
371 #define VFPF_TPA_GRO_CONSIST_FLAG       BIT(4)
372
373         u8 update_sge_tpa_flags;
374 #define VFPF_UPDATE_SGE_DEPRECATED_FLAG BIT(0)
375 #define VFPF_UPDATE_TPA_EN_FLAG         BIT(1)
376 #define VFPF_UPDATE_TPA_PARAM_FLAG      BIT(2)
377
378         u8 max_buffers_per_cqe;
379
380         u16 deprecated_sge_buff_size;
381         u16 tpa_max_size;
382         u16 tpa_min_size_to_start;
383         u16 tpa_min_size_to_cont;
384
385         u8 tpa_max_aggs_num;
386         u8 padding[7];
387 };
388
389 /* Primary tlv as a header for various extended tlvs for
390  * various functionalities in vport update ramrod.
391  */
392 struct vfpf_vport_update_tlv {
393         struct vfpf_first_tlv first_tlv;
394 };
395
396 struct vfpf_ucast_filter_tlv {
397         struct vfpf_first_tlv first_tlv;
398
399         u8 opcode;
400         u8 type;
401
402         u8 mac[ETH_ALEN];
403
404         u16 vlan;
405         u16 padding[3];
406 };
407
408 struct tlv_buffer_size {
409         u8 tlv_buffer[TLV_BUFFER_SIZE];
410 };
411
412 union vfpf_tlvs {
413         struct vfpf_first_tlv first_tlv;
414         struct vfpf_acquire_tlv acquire;
415         struct vfpf_start_rxq_tlv start_rxq;
416         struct vfpf_start_txq_tlv start_txq;
417         struct vfpf_stop_rxqs_tlv stop_rxqs;
418         struct vfpf_stop_txqs_tlv stop_txqs;
419         struct vfpf_update_rxq_tlv update_rxq;
420         struct vfpf_vport_start_tlv start_vport;
421         struct vfpf_vport_update_tlv vport_update;
422         struct vfpf_ucast_filter_tlv ucast_filter;
423         struct channel_list_end_tlv list_end;
424         struct tlv_buffer_size tlv_buf_size;
425 };
426
427 union pfvf_tlvs {
428         struct pfvf_def_resp_tlv default_resp;
429         struct pfvf_acquire_resp_tlv acquire_resp;
430         struct tlv_buffer_size tlv_buf_size;
431         struct pfvf_start_queue_resp_tlv queue_start;
432 };
433
434 enum qed_bulletin_bit {
435         /* Alert the VF that a forced MAC was set by the PF */
436         MAC_ADDR_FORCED = 0,
437         /* Alert the VF that a forced VLAN was set by the PF */
438         VLAN_ADDR_FORCED = 2,
439
440         /* Indicate that `default_only_untagged' contains actual data */
441         VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
442         VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
443
444         /* Alert the VF that suggested mac was sent by the PF.
445          * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set.
446          */
447         VFPF_BULLETIN_MAC_ADDR = 5
448 };
449
450 struct qed_bulletin_content {
451         /* crc of structure to ensure is not in mid-update */
452         u32 crc;
453
454         u32 version;
455
456         /* bitmap indicating which fields hold valid values */
457         u64 valid_bitmap;
458
459         /* used for MAC_ADDR or MAC_ADDR_FORCED */
460         u8 mac[ETH_ALEN];
461
462         /* If valid, 1 => only untagged Rx if no vlan is configured */
463         u8 default_only_untagged;
464         u8 padding;
465
466         /* The following is a 'copy' of qed_mcp_link_state,
467          * qed_mcp_link_params and qed_mcp_link_capabilities. Since it's
468          * possible the structs will increase further along the road we cannot
469          * have it here; Instead we need to have all of its fields.
470          */
471         u8 req_autoneg;
472         u8 req_autoneg_pause;
473         u8 req_forced_rx;
474         u8 req_forced_tx;
475         u8 padding2[4];
476
477         u32 req_adv_speed;
478         u32 req_forced_speed;
479         u32 req_loopback;
480         u32 padding3;
481
482         u8 link_up;
483         u8 full_duplex;
484         u8 autoneg;
485         u8 autoneg_complete;
486         u8 parallel_detection;
487         u8 pfc_enabled;
488         u8 partner_tx_flow_ctrl_en;
489         u8 partner_rx_flow_ctrl_en;
490         u8 partner_adv_pause;
491         u8 sfp_tx_fault;
492         u8 padding4[6];
493
494         u32 speed;
495         u32 partner_adv_speed;
496
497         u32 capability_speed;
498
499         /* Forced vlan */
500         u16 pvid;
501         u16 padding5;
502 };
503
504 struct qed_bulletin {
505         dma_addr_t phys;
506         struct qed_bulletin_content *p_virt;
507         u32 size;
508 };
509
510 enum {
511         CHANNEL_TLV_NONE,       /* ends tlv sequence */
512         CHANNEL_TLV_ACQUIRE,
513         CHANNEL_TLV_VPORT_START,
514         CHANNEL_TLV_VPORT_UPDATE,
515         CHANNEL_TLV_VPORT_TEARDOWN,
516         CHANNEL_TLV_START_RXQ,
517         CHANNEL_TLV_START_TXQ,
518         CHANNEL_TLV_STOP_RXQS,
519         CHANNEL_TLV_STOP_TXQS,
520         CHANNEL_TLV_UPDATE_RXQ,
521         CHANNEL_TLV_INT_CLEANUP,
522         CHANNEL_TLV_CLOSE,
523         CHANNEL_TLV_RELEASE,
524         CHANNEL_TLV_LIST_END,
525         CHANNEL_TLV_UCAST_FILTER,
526         CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
527         CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
528         CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
529         CHANNEL_TLV_VPORT_UPDATE_MCAST,
530         CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
531         CHANNEL_TLV_VPORT_UPDATE_RSS,
532         CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
533         CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
534         CHANNEL_TLV_MAX,
535
536         /* Required for iterating over vport-update tlvs.
537          * Will break in case non-sequential vport-update tlvs.
538          */
539         CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
540 };
541
542 /* This data is held in the qed_hwfn structure for VFs only. */
543 struct qed_vf_iov {
544         union vfpf_tlvs *vf2pf_request;
545         dma_addr_t vf2pf_request_phys;
546         union pfvf_tlvs *pf2vf_reply;
547         dma_addr_t pf2vf_reply_phys;
548
549         /* Should be taken whenever the mailbox buffers are accessed */
550         struct mutex mutex;
551         u8 *offset;
552
553         /* Bulletin Board */
554         struct qed_bulletin bulletin;
555         struct qed_bulletin_content bulletin_shadow;
556
557         /* we set aside a copy of the acquire response */
558         struct pfvf_acquire_resp_tlv acquire_resp;
559
560         /* In case PF originates prior to the fp-hsi version comparison,
561          * this has to be propagated as it affects the fastpath.
562          */
563         bool b_pre_fp_hsi;
564 };
565
566 #ifdef CONFIG_QED_SRIOV
567 /**
568  * @brief Read the VF bulletin and act on it if needed
569  *
570  * @param p_hwfn
571  * @param p_change - qed fills 1 iff bulletin board has changed, 0 otherwise.
572  *
573  * @return enum _qed_status
574  */
575 int qed_vf_read_bulletin(struct qed_hwfn *p_hwfn, u8 *p_change);
576
577 /**
578  * @brief Get link paramters for VF from qed
579  *
580  * @param p_hwfn
581  * @param params - the link params structure to be filled for the VF
582  */
583 void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
584                             struct qed_mcp_link_params *params);
585
586 /**
587  * @brief Get link state for VF from qed
588  *
589  * @param p_hwfn
590  * @param link - the link state structure to be filled for the VF
591  */
592 void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
593                            struct qed_mcp_link_state *link);
594
595 /**
596  * @brief Get link capabilities for VF from qed
597  *
598  * @param p_hwfn
599  * @param p_link_caps - the link capabilities structure to be filled for the VF
600  */
601 void qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
602                           struct qed_mcp_link_capabilities *p_link_caps);
603
604 /**
605  * @brief Get number of Rx queues allocated for VF by qed
606  *
607  *  @param p_hwfn
608  *  @param num_rxqs - allocated RX queues
609  */
610 void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs);
611
612 /**
613  * @brief Get port mac address for VF
614  *
615  * @param p_hwfn
616  * @param port_mac - destination location for port mac
617  */
618 void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac);
619
620 /**
621  * @brief Get number of VLAN filters allocated for VF by qed
622  *
623  *  @param p_hwfn
624  *  @param num_rxqs - allocated VLAN filters
625  */
626 void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
627                                  u8 *num_vlan_filters);
628
629 /**
630  * @brief Check if VF can set a MAC address
631  *
632  * @param p_hwfn
633  * @param mac
634  *
635  * @return bool
636  */
637 bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac);
638
639 /**
640  * @brief Set firmware version information in dev_info from VFs acquire response tlv
641  *
642  * @param p_hwfn
643  * @param fw_major
644  * @param fw_minor
645  * @param fw_rev
646  * @param fw_eng
647  */
648 void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
649                            u16 *fw_major, u16 *fw_minor,
650                            u16 *fw_rev, u16 *fw_eng);
651
652 /**
653  * @brief hw preparation for VF
654  *      sends ACQUIRE message
655  *
656  * @param p_hwfn
657  *
658  * @return int
659  */
660 int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn);
661
662 /**
663  * @brief VF - start the RX Queue by sending a message to the PF
664  * @param p_hwfn
665  * @param cid                   - zero based within the VF
666  * @param rx_queue_id           - zero based within the VF
667  * @param sb                    - VF status block for this queue
668  * @param sb_index              - Index within the status block
669  * @param bd_max_bytes          - maximum number of bytes per bd
670  * @param bd_chain_phys_addr    - physical address of bd chain
671  * @param cqe_pbl_addr          - physical address of pbl
672  * @param cqe_pbl_size          - pbl size
673  * @param pp_prod               - pointer to the producer to be
674  *                                used in fastpath
675  *
676  * @return int
677  */
678 int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
679                         u8 rx_queue_id,
680                         u16 sb,
681                         u8 sb_index,
682                         u16 bd_max_bytes,
683                         dma_addr_t bd_chain_phys_addr,
684                         dma_addr_t cqe_pbl_addr,
685                         u16 cqe_pbl_size, void __iomem **pp_prod);
686
687 /**
688  * @brief VF - start the TX queue by sending a message to the
689  *        PF.
690  *
691  * @param p_hwfn
692  * @param tx_queue_id           - zero based within the VF
693  * @param sb                    - status block for this queue
694  * @param sb_index              - index within the status block
695  * @param bd_chain_phys_addr    - physical address of tx chain
696  * @param pp_doorbell           - pointer to address to which to
697  *                      write the doorbell too..
698  *
699  * @return int
700  */
701 int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
702                         u16 tx_queue_id,
703                         u16 sb,
704                         u8 sb_index,
705                         dma_addr_t pbl_addr,
706                         u16 pbl_size, void __iomem **pp_doorbell);
707
708 /**
709  * @brief VF - stop the RX queue by sending a message to the PF
710  *
711  * @param p_hwfn
712  * @param rx_qid
713  * @param cqe_completion
714  *
715  * @return int
716  */
717 int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
718                        u16 rx_qid, bool cqe_completion);
719
720 /**
721  * @brief VF - stop the TX queue by sending a message to the PF
722  *
723  * @param p_hwfn
724  * @param tx_qid
725  *
726  * @return int
727  */
728 int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, u16 tx_qid);
729
730 /**
731  * @brief VF - send a vport update command
732  *
733  * @param p_hwfn
734  * @param params
735  *
736  * @return int
737  */
738 int qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
739                            struct qed_sp_vport_update_params *p_params);
740
741 /**
742  *
743  * @brief VF - send a close message to PF
744  *
745  * @param p_hwfn
746  *
747  * @return enum _qed_status
748  */
749 int qed_vf_pf_reset(struct qed_hwfn *p_hwfn);
750
751 /**
752  * @brief VF - free vf`s memories
753  *
754  * @param p_hwfn
755  *
756  * @return enum _qed_status
757  */
758 int qed_vf_pf_release(struct qed_hwfn *p_hwfn);
759
760 /**
761  * @brief qed_vf_get_igu_sb_id - Get the IGU SB ID for a given
762  *        sb_id. For VFs igu sbs don't have to be contiguous
763  *
764  * @param p_hwfn
765  * @param sb_id
766  *
767  * @return INLINE u16
768  */
769 u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id);
770
771 /**
772  * @brief qed_vf_pf_vport_start - perform vport start for VF.
773  *
774  * @param p_hwfn
775  * @param vport_id
776  * @param mtu
777  * @param inner_vlan_removal
778  * @param tpa_mode
779  * @param max_buffers_per_cqe,
780  * @param only_untagged - default behavior regarding vlan acceptance
781  *
782  * @return enum _qed_status
783  */
784 int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
785                           u8 vport_id,
786                           u16 mtu,
787                           u8 inner_vlan_removal,
788                           enum qed_tpa_mode tpa_mode,
789                           u8 max_buffers_per_cqe, u8 only_untagged);
790
791 /**
792  * @brief qed_vf_pf_vport_stop - stop the VF's vport
793  *
794  * @param p_hwfn
795  *
796  * @return enum _qed_status
797  */
798 int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn);
799
800 int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
801                            struct qed_filter_ucast *p_param);
802
803 void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
804                             struct qed_filter_mcast *p_filter_cmd);
805
806 /**
807  * @brief qed_vf_pf_int_cleanup - clean the SB of the VF
808  *
809  * @param p_hwfn
810  *
811  * @return enum _qed_status
812  */
813 int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn);
814
815 /**
816  * @brief - return the link params in a given bulletin board
817  *
818  * @param p_hwfn
819  * @param p_params - pointer to a struct to fill with link params
820  * @param p_bulletin
821  */
822 void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
823                               struct qed_mcp_link_params *p_params,
824                               struct qed_bulletin_content *p_bulletin);
825
826 /**
827  * @brief - return the link state in a given bulletin board
828  *
829  * @param p_hwfn
830  * @param p_link - pointer to a struct to fill with link state
831  * @param p_bulletin
832  */
833 void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
834                              struct qed_mcp_link_state *p_link,
835                              struct qed_bulletin_content *p_bulletin);
836
837 /**
838  * @brief - return the link capabilities in a given bulletin board
839  *
840  * @param p_hwfn
841  * @param p_link - pointer to a struct to fill with link capabilities
842  * @param p_bulletin
843  */
844 void __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
845                             struct qed_mcp_link_capabilities *p_link_caps,
846                             struct qed_bulletin_content *p_bulletin);
847
848 void qed_iov_vf_task(struct work_struct *work);
849 #else
850 static inline void qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
851                                           struct qed_mcp_link_params *params)
852 {
853 }
854
855 static inline void qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
856                                          struct qed_mcp_link_state *link)
857 {
858 }
859
860 static inline void
861 qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
862                      struct qed_mcp_link_capabilities *p_link_caps)
863 {
864 }
865
866 static inline void qed_vf_get_num_rxqs(struct qed_hwfn *p_hwfn, u8 *num_rxqs)
867 {
868 }
869
870 static inline void qed_vf_get_port_mac(struct qed_hwfn *p_hwfn, u8 *port_mac)
871 {
872 }
873
874 static inline void qed_vf_get_num_vlan_filters(struct qed_hwfn *p_hwfn,
875                                                u8 *num_vlan_filters)
876 {
877 }
878
879 static inline bool qed_vf_check_mac(struct qed_hwfn *p_hwfn, u8 *mac)
880 {
881         return false;
882 }
883
884 static inline void qed_vf_get_fw_version(struct qed_hwfn *p_hwfn,
885                                          u16 *fw_major, u16 *fw_minor,
886                                          u16 *fw_rev, u16 *fw_eng)
887 {
888 }
889
890 static inline int qed_vf_hw_prepare(struct qed_hwfn *p_hwfn)
891 {
892         return -EINVAL;
893 }
894
895 static inline int qed_vf_pf_rxq_start(struct qed_hwfn *p_hwfn,
896                                       u8 rx_queue_id,
897                                       u16 sb,
898                                       u8 sb_index,
899                                       u16 bd_max_bytes,
900                                       dma_addr_t bd_chain_phys_adr,
901                                       dma_addr_t cqe_pbl_addr,
902                                       u16 cqe_pbl_size, void __iomem **pp_prod)
903 {
904         return -EINVAL;
905 }
906
907 static inline int qed_vf_pf_txq_start(struct qed_hwfn *p_hwfn,
908                                       u16 tx_queue_id,
909                                       u16 sb,
910                                       u8 sb_index,
911                                       dma_addr_t pbl_addr,
912                                       u16 pbl_size, void __iomem **pp_doorbell)
913 {
914         return -EINVAL;
915 }
916
917 static inline int qed_vf_pf_rxq_stop(struct qed_hwfn *p_hwfn,
918                                      u16 rx_qid, bool cqe_completion)
919 {
920         return -EINVAL;
921 }
922
923 static inline int qed_vf_pf_txq_stop(struct qed_hwfn *p_hwfn, u16 tx_qid)
924 {
925         return -EINVAL;
926 }
927
928 static inline int
929 qed_vf_pf_vport_update(struct qed_hwfn *p_hwfn,
930                        struct qed_sp_vport_update_params *p_params)
931 {
932         return -EINVAL;
933 }
934
935 static inline int qed_vf_pf_reset(struct qed_hwfn *p_hwfn)
936 {
937         return -EINVAL;
938 }
939
940 static inline int qed_vf_pf_release(struct qed_hwfn *p_hwfn)
941 {
942         return -EINVAL;
943 }
944
945 static inline u16 qed_vf_get_igu_sb_id(struct qed_hwfn *p_hwfn, u16 sb_id)
946 {
947         return 0;
948 }
949
950 static inline int qed_vf_pf_vport_start(struct qed_hwfn *p_hwfn,
951                                         u8 vport_id,
952                                         u16 mtu,
953                                         u8 inner_vlan_removal,
954                                         enum qed_tpa_mode tpa_mode,
955                                         u8 max_buffers_per_cqe,
956                                         u8 only_untagged)
957 {
958         return -EINVAL;
959 }
960
961 static inline int qed_vf_pf_vport_stop(struct qed_hwfn *p_hwfn)
962 {
963         return -EINVAL;
964 }
965
966 static inline int qed_vf_pf_filter_ucast(struct qed_hwfn *p_hwfn,
967                                          struct qed_filter_ucast *p_param)
968 {
969         return -EINVAL;
970 }
971
972 static inline void qed_vf_pf_filter_mcast(struct qed_hwfn *p_hwfn,
973                                           struct qed_filter_mcast *p_filter_cmd)
974 {
975 }
976
977 static inline int qed_vf_pf_int_cleanup(struct qed_hwfn *p_hwfn)
978 {
979         return -EINVAL;
980 }
981
982 static inline void __qed_vf_get_link_params(struct qed_hwfn *p_hwfn,
983                                             struct qed_mcp_link_params
984                                             *p_params,
985                                             struct qed_bulletin_content
986                                             *p_bulletin)
987 {
988 }
989
990 static inline void __qed_vf_get_link_state(struct qed_hwfn *p_hwfn,
991                                            struct qed_mcp_link_state *p_link,
992                                            struct qed_bulletin_content
993                                            *p_bulletin)
994 {
995 }
996
997 static inline void
998 __qed_vf_get_link_caps(struct qed_hwfn *p_hwfn,
999                        struct qed_mcp_link_capabilities *p_link_caps,
1000                        struct qed_bulletin_content *p_bulletin)
1001 {
1002 }
1003
1004 static inline void qed_iov_vf_task(struct work_struct *work)
1005 {
1006 }
1007 #endif
1008
1009 #endif