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