9506 Want support for QLogic QL41000/45000 series devices
[unleashed.git] / usr / src / uts / common / io / qede / 579xx / drivers / ecore / ecore_vfpf_if.h
blob6f77187919e518f24811a311a94672fbd46fcbe2
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, v.1, (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2014-2017 Cavium, Inc.
24 * The contents of this file are subject to the terms of the Common Development
25 * and Distribution License, v.1, (the "License").
27 * You may not use this file except in compliance with the License.
29 * You can obtain a copy of the License at available
30 * at http://opensource.org/licenses/CDDL-1.0
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
36 #ifndef __ECORE_VF_PF_IF_H__
37 #define __ECORE_VF_PF_IF_H__
39 #define T_ETH_INDIRECTION_TABLE_SIZE 128 /* @@@ TBD MichalK this should be HSI? */
40 #define T_ETH_RSS_KEY_SIZE 10 /* @@@ TBD this should be HSI? */
41 #ifndef LINUX_REMOVE
42 #define ETH_ALEN 6 /* @@@ TBD MichalK - should this be defined here?*/
43 #endif
45 /***********************************************
47 * Common definitions for all HVs
49 **/
50 struct vf_pf_resc_request {
51 u8 num_rxqs;
52 u8 num_txqs;
53 u8 num_sbs;
54 u8 num_mac_filters;
55 u8 num_vlan_filters;
56 u8 num_mc_filters; /* No limit so superfluous */
57 u8 num_cids;
58 u8 padding;
61 struct hw_sb_info {
62 u16 hw_sb_id; /* aka absolute igu id, used to ack the sb */
63 u8 sb_qid; /* used to update DHC for sb */
64 u8 padding[5];
67 /***********************************************
69 * HW VF-PF channel definitions
71 * A.K.A VF-PF mailbox
73 **/
74 #define TLV_BUFFER_SIZE 1024
76 /* vf pf channel tlvs */
77 /* general tlv header (used for both vf->pf request and pf->vf response) */
78 struct channel_tlv {
79 u16 type;
80 u16 length;
83 /* header of first vf->pf tlv carries the offset used to calculate reponse
84 * buffer address
86 struct vfpf_first_tlv {
87 struct channel_tlv tl;
88 u32 padding;
89 u64 reply_address;
92 /* header of pf->vf tlvs, carries the status of handling the request */
93 struct pfvf_tlv {
94 struct channel_tlv tl;
95 u8 status;
96 u8 padding[3];
99 /* response tlv used for most tlvs */
100 struct pfvf_def_resp_tlv {
101 struct pfvf_tlv hdr;
104 /* used to terminate and pad a tlv list */
105 struct channel_list_end_tlv {
106 struct channel_tlv tl;
107 u8 padding[4];
110 /* Acquire */
111 struct vfpf_acquire_tlv {
112 struct vfpf_first_tlv first_tlv;
114 struct vf_pf_vfdev_info {
115 #ifndef LINUX_REMOVE
116 /* First bit was used on 8.7.x and 8.8.x versions, which had different
117 * FWs used but with the same faspath HSI. As this was prior to the
118 * fastpath versioning, wanted to have ability to override fw matching
119 * and allow them to interact.
121 #endif
122 #define VFPF_ACQUIRE_CAP_PRE_FP_HSI (1 << 0) /* VF pre-FP hsi version */
123 #define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */
125 /* A requirement for supporting multi-Tx queues on a single queue-zone,
126 * VF would pass qids as additional information whenever passing queue
127 * references.
128 * TODO - due to the CID limitations in Bar0, VFs currently don't pass
129 * this, and use the legacy CID scheme.
131 #define VFPF_ACQUIRE_CAP_QUEUE_QIDS (1 << 2)
132 u64 capabilities;
133 u8 fw_major;
134 u8 fw_minor;
135 u8 fw_revision;
136 u8 fw_engineering;
137 u32 driver_version;
138 u16 opaque_fid; /* ME register value */
139 u8 os_type; /* VFPF_ACQUIRE_OS_* value */
140 u8 eth_fp_hsi_major;
141 u8 eth_fp_hsi_minor;
142 u8 padding[3];
143 } vfdev_info;
145 struct vf_pf_resc_request resc_request;
147 u64 bulletin_addr;
148 u32 bulletin_size;
149 u32 padding;
152 /* receive side scaling tlv */
153 struct vfpf_vport_update_rss_tlv {
154 struct channel_tlv tl;
156 u8 update_rss_flags;
157 #define VFPF_UPDATE_RSS_CONFIG_FLAG (1 << 0)
158 #define VFPF_UPDATE_RSS_CAPS_FLAG (1 << 1)
159 #define VFPF_UPDATE_RSS_IND_TABLE_FLAG (1 << 2)
160 #define VFPF_UPDATE_RSS_KEY_FLAG (1 << 3)
162 u8 rss_enable;
163 u8 rss_caps;
164 u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
165 u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
166 u32 rss_key[T_ETH_RSS_KEY_SIZE];
169 struct pfvf_storm_stats {
170 u32 address;
171 u32 len;
174 struct pfvf_stats_info {
175 struct pfvf_storm_stats mstats;
176 struct pfvf_storm_stats pstats;
177 struct pfvf_storm_stats tstats;
178 struct pfvf_storm_stats ustats;
181 /* acquire response tlv - carries the allocated resources */
182 struct pfvf_acquire_resp_tlv {
183 struct pfvf_tlv hdr;
185 struct pf_vf_pfdev_info {
186 u32 chip_num;
187 u32 mfw_ver;
189 u16 fw_major;
190 u16 fw_minor;
191 u16 fw_rev;
192 u16 fw_eng;
194 u64 capabilities;
195 #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED (1 << 0)
196 #define PFVF_ACQUIRE_CAP_100G (1 << 1) /* If set, 100g PF */
197 /* There are old PF versions where the PF might mistakenly override the sanity
198 * mechanism [version-based] and allow a VF that can't be supported to pass
199 * the acquisition phase.
200 * To overcome this, PFs now indicate that they're past that point and the new
201 * VFs would fail probe on the older PFs that fail to do so.
203 #ifndef LINUX_REMOVE
204 /* Said bug was in quest/serpens; Can't be certain no official release included
205 * the bug since the fix arrived very late in the programs.
207 #endif
208 #define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE (1 << 2)
210 /* PF expects queues to be received with additional qids */
211 #define PFVF_ACQUIRE_CAP_QUEUE_QIDS (1 << 3)
213 u16 db_size;
214 u8 indices_per_sb;
215 u8 os_type;
217 /* These should match the PF's ecore_dev values */
218 u16 chip_rev;
219 u8 dev_type;
221 u8 padding;
223 struct pfvf_stats_info stats_info;
225 u8 port_mac[ETH_ALEN];
227 /* It's possible PF had to configure an older fastpath HSI
228 * [in case VF is newer than PF]. This is communicated back
229 * to the VF. It can also be used in case of error due to
230 * non-matching versions to shed light in VF about failure.
232 u8 major_fp_hsi;
233 u8 minor_fp_hsi;
234 } pfdev_info;
236 struct pf_vf_resc {
237 /* in case of status NO_RESOURCE in message hdr, pf will fill
238 * this struct with suggested amount of resources for next
239 * acquire request
241 #define PFVF_MAX_QUEUES_PER_VF 16
242 #define PFVF_MAX_SBS_PER_VF 16
243 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
244 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
245 u8 cid[PFVF_MAX_QUEUES_PER_VF];
247 u8 num_rxqs;
248 u8 num_txqs;
249 u8 num_sbs;
250 u8 num_mac_filters;
251 u8 num_vlan_filters;
252 u8 num_mc_filters;
253 u8 num_cids;
254 u8 padding;
255 } resc;
257 u32 bulletin_size;
258 u32 padding;
261 struct pfvf_start_queue_resp_tlv {
262 struct pfvf_tlv hdr;
263 u32 offset; /* offset to consumer/producer of queue */
264 u8 padding[4];
267 /* Extended queue information - additional index for reference inside qzone.
268 * If commmunicated between VF/PF, each TLV relating to queues should be
269 * extended by one such [or have a future base TLV that already contains info].
271 struct vfpf_qid_tlv {
272 struct channel_tlv tl;
273 u8 qid;
274 u8 padding[3];
277 /* Setup Queue */
278 struct vfpf_start_rxq_tlv {
279 struct vfpf_first_tlv first_tlv;
281 /* physical addresses */
282 u64 rxq_addr;
283 u64 deprecated_sge_addr;
284 u64 cqe_pbl_addr;
286 u16 cqe_pbl_size;
287 u16 hw_sb;
288 u16 rx_qid;
289 u16 hc_rate; /* desired interrupts per sec. */
291 u16 bd_max_bytes;
292 u16 stat_id;
293 u8 sb_index;
294 u8 padding[3];
298 struct vfpf_start_txq_tlv {
299 struct vfpf_first_tlv first_tlv;
301 /* physical addresses */
302 u64 pbl_addr;
303 u16 pbl_size;
304 u16 stat_id;
305 u16 tx_qid;
306 u16 hw_sb;
308 u32 flags; /* VFPF_QUEUE_FLG_X flags */
309 u16 hc_rate; /* desired interrupts per sec. */
310 u8 sb_index;
311 u8 padding[3];
314 /* Stop RX Queue */
315 struct vfpf_stop_rxqs_tlv {
316 struct vfpf_first_tlv first_tlv;
318 u16 rx_qid;
320 /* While the API supports multiple Rx-queues on a single TLV
321 * message, in practice older VFs always used it as one [ecore].
322 * And there are PFs [starting with the CHANNEL_TLV_QID] which
323 * would start assuming this is always a '1'. So in practice this
324 * field should be considered deprecated and *Always* set to '1'.
326 u8 num_rxqs;
328 u8 cqe_completion;
329 u8 padding[4];
332 /* Stop TX Queues */
333 struct vfpf_stop_txqs_tlv {
334 struct vfpf_first_tlv first_tlv;
336 u16 tx_qid;
338 /* While the API supports multiple Tx-queues on a single TLV
339 * message, in practice older VFs always used it as one [ecore].
340 * And there are PFs [starting with the CHANNEL_TLV_QID] which
341 * would start assuming this is always a '1'. So in practice this
342 * field should be considered deprecated and *Always* set to '1'.
344 u8 num_txqs;
345 u8 padding[5];
348 struct vfpf_update_rxq_tlv {
349 struct vfpf_first_tlv first_tlv;
351 u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
353 u16 rx_qid;
354 u8 num_rxqs;
355 u8 flags;
356 #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG (1 << 0)
357 #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG (1 << 1)
358 #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG (1 << 2)
360 u8 padding[4];
363 /* Set Queue Filters */
364 struct vfpf_q_mac_vlan_filter {
365 u32 flags;
366 #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
367 #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
368 #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
370 u8 mac[ETH_ALEN];
371 u16 vlan_tag;
373 u8 padding[4];
376 /* Start a vport */
377 struct vfpf_vport_start_tlv {
378 struct vfpf_first_tlv first_tlv;
380 u64 sb_addr[PFVF_MAX_SBS_PER_VF];
382 u32 tpa_mode;
383 u16 dep1;
384 u16 mtu;
386 u8 vport_id;
387 u8 inner_vlan_removal;
389 u8 only_untagged;
390 u8 max_buffers_per_cqe;
392 u8 padding[4];
395 /* Extended tlvs - need to add rss, mcast, accept mode tlvs */
396 struct vfpf_vport_update_activate_tlv {
397 struct channel_tlv tl;
398 u8 update_rx;
399 u8 update_tx;
400 u8 active_rx;
401 u8 active_tx;
404 struct vfpf_vport_update_tx_switch_tlv {
405 struct channel_tlv tl;
406 u8 tx_switching;
407 u8 padding[3];
410 struct vfpf_vport_update_vlan_strip_tlv {
411 struct channel_tlv tl;
412 u8 remove_vlan;
413 u8 padding[3];
416 struct vfpf_vport_update_mcast_bin_tlv {
417 struct channel_tlv tl;
418 u8 padding[4];
420 u64 bins[8];
423 struct vfpf_vport_update_accept_param_tlv {
424 struct channel_tlv tl;
425 u8 update_rx_mode;
426 u8 update_tx_mode;
427 u8 rx_accept_filter;
428 u8 tx_accept_filter;
431 struct vfpf_vport_update_accept_any_vlan_tlv {
432 struct channel_tlv tl;
433 u8 update_accept_any_vlan_flg;
434 u8 accept_any_vlan;
436 u8 padding[2];
439 struct vfpf_vport_update_sge_tpa_tlv {
440 struct channel_tlv tl;
442 u16 sge_tpa_flags;
443 #define VFPF_TPA_IPV4_EN_FLAG (1 << 0)
444 #define VFPF_TPA_IPV6_EN_FLAG (1 << 1)
445 #define VFPF_TPA_PKT_SPLIT_FLAG (1 << 2)
446 #define VFPF_TPA_HDR_DATA_SPLIT_FLAG (1 << 3)
447 #define VFPF_TPA_GRO_CONSIST_FLAG (1 << 4)
449 u8 update_sge_tpa_flags;
450 #define VFPF_UPDATE_SGE_DEPRECATED_FLAG (1 << 0)
451 #define VFPF_UPDATE_TPA_EN_FLAG (1 << 1)
452 #define VFPF_UPDATE_TPA_PARAM_FLAG (1 << 2)
454 u8 max_buffers_per_cqe;
456 u16 deprecated_sge_buff_size;
457 u16 tpa_max_size;
458 u16 tpa_min_size_to_start;
459 u16 tpa_min_size_to_cont;
461 u8 tpa_max_aggs_num;
462 u8 padding[7];
466 /* Primary tlv as a header for various extended tlvs for
467 * various functionalities in vport update ramrod.
469 struct vfpf_vport_update_tlv {
470 struct vfpf_first_tlv first_tlv;
473 struct vfpf_ucast_filter_tlv {
474 struct vfpf_first_tlv first_tlv;
476 u8 opcode;
477 u8 type;
479 u8 mac[ETH_ALEN];
481 u16 vlan;
482 u16 padding[3];
485 /* tunnel update param tlv */
486 struct vfpf_update_tunn_param_tlv {
487 struct vfpf_first_tlv first_tlv;
489 u8 tun_mode_update_mask;
490 u8 tunn_mode;
491 u8 update_tun_cls;
492 u8 vxlan_clss;
493 u8 l2gre_clss;
494 u8 ipgre_clss;
495 u8 l2geneve_clss;
496 u8 ipgeneve_clss;
497 u8 update_geneve_port;
498 u8 update_vxlan_port;
499 u16 geneve_port;
500 u16 vxlan_port;
501 u8 padding[2];
504 struct pfvf_update_tunn_param_tlv {
505 struct pfvf_tlv hdr;
507 u16 tunn_feature_mask;
508 u8 vxlan_mode;
509 u8 l2geneve_mode;
510 u8 ipgeneve_mode;
511 u8 l2gre_mode;
512 u8 ipgre_mode;
513 u8 vxlan_clss;
514 u8 l2gre_clss;
515 u8 ipgre_clss;
516 u8 l2geneve_clss;
517 u8 ipgeneve_clss;
518 u16 vxlan_udp_port;
519 u16 geneve_udp_port;
522 struct tlv_buffer_size {
523 u8 tlv_buffer[TLV_BUFFER_SIZE];
526 struct vfpf_update_coalesce {
527 struct vfpf_first_tlv first_tlv;
528 u16 rx_coal;
529 u16 tx_coal;
530 u16 qid;
531 u8 padding[2];
534 union vfpf_tlvs {
535 struct vfpf_first_tlv first_tlv;
536 struct vfpf_acquire_tlv acquire;
537 struct vfpf_start_rxq_tlv start_rxq;
538 struct vfpf_start_txq_tlv start_txq;
539 struct vfpf_stop_rxqs_tlv stop_rxqs;
540 struct vfpf_stop_txqs_tlv stop_txqs;
541 struct vfpf_update_rxq_tlv update_rxq;
542 struct vfpf_vport_start_tlv start_vport;
543 struct vfpf_vport_update_tlv vport_update;
544 struct vfpf_ucast_filter_tlv ucast_filter;
545 struct vfpf_update_tunn_param_tlv tunn_param_update;
546 struct vfpf_update_coalesce update_coalesce;
547 struct tlv_buffer_size tlv_buf_size;
550 union pfvf_tlvs {
551 struct pfvf_def_resp_tlv default_resp;
552 struct pfvf_acquire_resp_tlv acquire_resp;
553 struct tlv_buffer_size tlv_buf_size;
554 struct pfvf_start_queue_resp_tlv queue_start;
555 struct pfvf_update_tunn_param_tlv tunn_param_resp;
558 /* This is a structure which is allocated in the VF, which the PF may update
559 * when it deems it necessary to do so. The bulletin board is sampled
560 * periodically by the VF. A copy per VF is maintained in the PF (to prevent
561 * loss of data upon multiple updates (or the need for read modify write)).
563 enum ecore_bulletin_bit {
564 /* Alert the VF that a forced MAC was set by the PF */
565 MAC_ADDR_FORCED = 0,
567 /* The VF should not access the vfpf channel */
568 VFPF_CHANNEL_INVALID = 1,
570 /* Alert the VF that a forced VLAN was set by the PF */
571 VLAN_ADDR_FORCED = 2,
573 /* Indicate that `default_only_untagged' contains actual data */
574 VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
575 VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
577 /* Alert the VF that suggested mac was sent by the PF.
578 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set
580 VFPF_BULLETIN_MAC_ADDR = 5
583 struct ecore_bulletin_content {
584 /* crc of structure to ensure is not in mid-update */
585 u32 crc;
587 u32 version;
589 /* bitmap indicating which fields hold valid values */
590 u64 valid_bitmap;
592 /* used for MAC_ADDR or MAC_ADDR_FORCED */
593 u8 mac[ETH_ALEN];
595 /* If valid, 1 => only untagged Rx if no vlan is configured */
596 u8 default_only_untagged;
597 u8 padding;
599 /* The following is a 'copy' of ecore_mcp_link_state,
600 * ecore_mcp_link_params and ecore_mcp_link_capabilities. Since it's
601 * possible the structs will increase further along the road we cannot
602 * have it here; Instead we need to have all of its fields.
604 u8 req_autoneg;
605 u8 req_autoneg_pause;
606 u8 req_forced_rx;
607 u8 req_forced_tx;
608 u8 padding2[4];
610 u32 req_adv_speed;
611 u32 req_forced_speed;
612 u32 req_loopback;
613 u32 padding3;
615 u8 link_up;
616 u8 full_duplex;
617 u8 autoneg;
618 u8 autoneg_complete;
619 u8 parallel_detection;
620 u8 pfc_enabled;
621 u8 partner_tx_flow_ctrl_en;
622 u8 partner_rx_flow_ctrl_en;
624 u8 partner_adv_pause;
625 u8 sfp_tx_fault;
626 u16 vxlan_udp_port;
627 u16 geneve_udp_port;
628 u8 padding4[2];
630 u32 speed;
631 u32 partner_adv_speed;
633 u32 capability_speed;
635 /* Forced vlan */
636 u16 pvid;
637 u16 padding5;
640 struct ecore_bulletin {
641 dma_addr_t phys;
642 struct ecore_bulletin_content *p_virt;
643 u32 size;
646 enum {
647 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
649 CHANNEL_TLV_NONE, /* ends tlv sequence */
650 CHANNEL_TLV_ACQUIRE,
651 CHANNEL_TLV_VPORT_START,
652 CHANNEL_TLV_VPORT_UPDATE,
653 CHANNEL_TLV_VPORT_TEARDOWN,
654 CHANNEL_TLV_START_RXQ,
655 CHANNEL_TLV_START_TXQ,
656 CHANNEL_TLV_STOP_RXQS,
657 CHANNEL_TLV_STOP_TXQS,
658 CHANNEL_TLV_UPDATE_RXQ,
659 CHANNEL_TLV_INT_CLEANUP,
660 CHANNEL_TLV_CLOSE,
661 CHANNEL_TLV_RELEASE,
662 CHANNEL_TLV_LIST_END,
663 CHANNEL_TLV_UCAST_FILTER,
664 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
665 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
666 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
667 CHANNEL_TLV_VPORT_UPDATE_MCAST,
668 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
669 CHANNEL_TLV_VPORT_UPDATE_RSS,
670 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
671 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
672 CHANNEL_TLV_UPDATE_TUNN_PARAM,
673 CHANNEL_TLV_COALESCE_UPDATE,
674 CHANNEL_TLV_QID,
675 CHANNEL_TLV_MAX,
677 /* Required for iterating over vport-update tlvs.
678 * Will break in case non-sequential vport-update tlvs.
680 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
682 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
684 extern const char *ecore_channel_tlvs_string[];
686 #endif /* __ECORE_VF_PF_IF_H__ */