1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2016 - 2018 Cavium Inc.
7 #ifndef __ECORE_VF_PF_IF_H__
8 #define __ECORE_VF_PF_IF_H__
10 /* @@@ TBD MichalK this should be HSI? */
11 #define T_ETH_INDIRECTION_TABLE_SIZE 128
12 #define T_ETH_RSS_KEY_SIZE 10 /* @@@ TBD this should be HSI? */
14 /***********************************************
16 * Common definitions for all HVs
19 struct vf_pf_resc_request {
25 u8 num_mc_filters; /* No limit so superfluous */
31 u16 hw_sb_id; /* aka absolute igu id, used to ack the sb */
32 u8 sb_qid; /* used to update DHC for sb */
36 /***********************************************
38 * HW VF-PF channel definitions
43 #define TLV_BUFFER_SIZE 1024
45 /* vf pf channel tlvs */
46 /* general tlv header (used for both vf->pf request and pf->vf response) */
52 /* header of first vf->pf tlv carries the offset used to calculate response
55 struct vfpf_first_tlv {
56 struct channel_tlv tl;
61 /* header of pf->vf tlvs, carries the status of handling the request */
63 struct channel_tlv tl;
68 /* response tlv used for most tlvs */
69 struct pfvf_def_resp_tlv {
73 /* used to terminate and pad a tlv list */
74 struct channel_list_end_tlv {
75 struct channel_tlv tl;
80 struct vfpf_acquire_tlv {
81 struct vfpf_first_tlv first_tlv;
83 struct vf_pf_vfdev_info {
85 /* First bit was used on 8.7.x and 8.8.x versions, which had different
86 * FWs used but with the same faspath HSI. As this was prior to the
87 * fastpath versioning, wanted to have ability to override fw matching
88 * and allow them to interact.
91 /* VF pre-FP hsi version */
92 #define VFPF_ACQUIRE_CAP_PRE_FP_HSI (1 << 0)
93 #define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */
95 /* A requirement for supporting multi-Tx queues on a single queue-zone,
96 * VF would pass qids as additional information whenever passing queue
98 * TODO - due to the CID limitations in Bar0, VFs currently don't pass
99 * this, and use the legacy CID scheme.
101 #define VFPF_ACQUIRE_CAP_QUEUE_QIDS (1 << 2)
103 /* The VF is using the physical bar. While this is mostly internal
104 * to the VF, might affect the number of CIDs supported assuming
107 #define VFPF_ACQUIRE_CAP_PHYSICAL_BAR (1 << 3)
114 u16 opaque_fid; /* ME register value */
115 u8 os_type; /* VFPF_ACQUIRE_OS_* value */
121 struct vf_pf_resc_request resc_request;
128 /* receive side scaling tlv */
129 struct vfpf_vport_update_rss_tlv {
130 struct channel_tlv tl;
133 #define VFPF_UPDATE_RSS_CONFIG_FLAG (1 << 0)
134 #define VFPF_UPDATE_RSS_CAPS_FLAG (1 << 1)
135 #define VFPF_UPDATE_RSS_IND_TABLE_FLAG (1 << 2)
136 #define VFPF_UPDATE_RSS_KEY_FLAG (1 << 3)
140 u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
141 u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
142 u32 rss_key[T_ETH_RSS_KEY_SIZE];
145 struct pfvf_storm_stats {
150 struct pfvf_stats_info {
151 struct pfvf_storm_stats mstats;
152 struct pfvf_storm_stats pstats;
153 struct pfvf_storm_stats tstats;
154 struct pfvf_storm_stats ustats;
157 /* acquire response tlv - carries the allocated resources */
158 struct pfvf_acquire_resp_tlv {
161 struct pf_vf_pfdev_info {
171 #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED (1 << 0)
172 #define PFVF_ACQUIRE_CAP_100G (1 << 1) /* If set, 100g PF */
173 /* There are old PF versions where the PF might mistakenly override the sanity
174 * mechanism [version-based] and allow a VF that can't be supported to pass
175 * the acquisition phase.
176 * To overcome this, PFs now indicate that they're past that point and the new
177 * VFs would fail probe on the older PFs that fail to do so.
180 /* Said bug was in quest/serpens; Can't be certain no official release included
181 * the bug since the fix arrived very late in the programs.
184 #define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE (1 << 2)
186 /* PF expects queues to be received with additional qids */
187 #define PFVF_ACQUIRE_CAP_QUEUE_QIDS (1 << 3)
193 /* These should match the PF's ecore_dev values */
197 /* Doorbell bar size configured in HW: log(size) or 0 */
200 struct pfvf_stats_info stats_info;
202 u8 port_mac[ETH_ALEN];
204 /* It's possible PF had to configure an older fastpath HSI
205 * [in case VF is newer than PF]. This is communicated back
206 * to the VF. It can also be used in case of error due to
207 * non-matching versions to shed light in VF about failure.
214 /* in case of status NO_RESOURCE in message hdr, pf will fill
215 * this struct with suggested amount of resources for next
218 #define PFVF_MAX_QUEUES_PER_VF 16
219 #define PFVF_MAX_SBS_PER_VF 16
220 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
221 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
222 u8 cid[PFVF_MAX_QUEUES_PER_VF];
238 struct pfvf_start_queue_resp_tlv {
240 u32 offset; /* offset to consumer/producer of queue */
244 /* Extended queue information - additional index for reference inside qzone.
245 * If commmunicated between VF/PF, each TLV relating to queues should be
246 * extended by one such [or have a future base TLV that already contains info].
248 struct vfpf_qid_tlv {
249 struct channel_tlv tl;
255 struct vfpf_soft_flr_tlv {
256 struct vfpf_first_tlv first_tlv;
262 struct vfpf_start_rxq_tlv {
263 struct vfpf_first_tlv first_tlv;
265 /* physical addresses */
267 u64 deprecated_sge_addr;
273 u16 hc_rate; /* desired interrupts per sec. */
282 struct vfpf_start_txq_tlv {
283 struct vfpf_first_tlv first_tlv;
285 /* physical addresses */
292 u32 flags; /* VFPF_QUEUE_FLG_X flags */
293 u16 hc_rate; /* desired interrupts per sec. */
299 struct vfpf_stop_rxqs_tlv {
300 struct vfpf_first_tlv first_tlv;
304 /* While the API supports multiple Rx-queues on a single TLV
305 * message, in practice older VFs always used it as one [ecore].
306 * And there are PFs [starting with the CHANNEL_TLV_QID] which
307 * would start assuming this is always a '1'. So in practice this
308 * field should be considered deprecated and *Always* set to '1'.
317 struct vfpf_stop_txqs_tlv {
318 struct vfpf_first_tlv first_tlv;
322 /* While the API supports multiple Tx-queues on a single TLV
323 * message, in practice older VFs always used it as one [ecore].
324 * And there are PFs [starting with the CHANNEL_TLV_QID] which
325 * would start assuming this is always a '1'. So in practice this
326 * field should be considered deprecated and *Always* set to '1'.
332 struct vfpf_update_rxq_tlv {
333 struct vfpf_first_tlv first_tlv;
335 u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
340 #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG (1 << 0)
341 #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG (1 << 1)
342 #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG (1 << 2)
347 /* Set Queue Filters */
348 struct vfpf_q_mac_vlan_filter {
350 #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
351 #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
352 #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
361 struct vfpf_vport_start_tlv {
362 struct vfpf_first_tlv first_tlv;
364 u64 sb_addr[PFVF_MAX_SBS_PER_VF];
371 u8 inner_vlan_removal;
374 u8 max_buffers_per_cqe;
379 /* Extended tlvs - need to add rss, mcast, accept mode tlvs */
380 struct vfpf_vport_update_activate_tlv {
381 struct channel_tlv tl;
388 struct vfpf_vport_update_tx_switch_tlv {
389 struct channel_tlv tl;
394 struct vfpf_vport_update_vlan_strip_tlv {
395 struct channel_tlv tl;
400 struct vfpf_vport_update_mcast_bin_tlv {
401 struct channel_tlv tl;
404 /* This was a mistake; There are only 256 approx bins,
405 * and in HSI they're divided into 32-bit values.
406 * As old VFs used to set-bit to the values on its side,
407 * the upper half of the array is never expected to contain any data.
410 u64 obsolete_bins[4];
413 struct vfpf_vport_update_accept_param_tlv {
414 struct channel_tlv tl;
421 struct vfpf_vport_update_accept_any_vlan_tlv {
422 struct channel_tlv tl;
423 u8 update_accept_any_vlan_flg;
429 struct vfpf_vport_update_sge_tpa_tlv {
430 struct channel_tlv tl;
433 #define VFPF_TPA_IPV4_EN_FLAG (1 << 0)
434 #define VFPF_TPA_IPV6_EN_FLAG (1 << 1)
435 #define VFPF_TPA_PKT_SPLIT_FLAG (1 << 2)
436 #define VFPF_TPA_HDR_DATA_SPLIT_FLAG (1 << 3)
437 #define VFPF_TPA_GRO_CONSIST_FLAG (1 << 4)
438 #define VFPF_TPA_TUNN_IPV4_EN_FLAG (1 << 5)
439 #define VFPF_TPA_TUNN_IPV6_EN_FLAG (1 << 6)
441 u8 update_sge_tpa_flags;
442 #define VFPF_UPDATE_SGE_DEPRECATED_FLAG (1 << 0)
443 #define VFPF_UPDATE_TPA_EN_FLAG (1 << 1)
444 #define VFPF_UPDATE_TPA_PARAM_FLAG (1 << 2)
446 u8 max_buffers_per_cqe;
448 u16 deprecated_sge_buff_size;
450 u16 tpa_min_size_to_start;
451 u16 tpa_min_size_to_cont;
458 /* Primary tlv as a header for various extended tlvs for
459 * various functionalities in vport update ramrod.
461 struct vfpf_vport_update_tlv {
462 struct vfpf_first_tlv first_tlv;
465 struct vfpf_ucast_filter_tlv {
466 struct vfpf_first_tlv first_tlv;
477 /* tunnel update param tlv */
478 struct vfpf_update_tunn_param_tlv {
479 struct vfpf_first_tlv first_tlv;
481 u8 tun_mode_update_mask;
489 u8 update_geneve_port;
490 u8 update_vxlan_port;
496 struct pfvf_update_tunn_param_tlv {
499 u16 tunn_feature_mask;
514 struct tlv_buffer_size {
515 u8 tlv_buffer[TLV_BUFFER_SIZE];
518 struct vfpf_update_coalesce {
519 struct vfpf_first_tlv first_tlv;
526 struct vfpf_read_coal_req_tlv {
527 struct vfpf_first_tlv first_tlv;
533 struct pfvf_read_coal_resp_tlv {
539 struct vfpf_bulletin_update_mac_tlv {
540 struct vfpf_first_tlv first_tlv;
545 struct vfpf_update_mtu_tlv {
546 struct vfpf_first_tlv first_tlv;
552 struct vfpf_first_tlv first_tlv;
553 struct vfpf_acquire_tlv acquire;
554 struct vfpf_start_rxq_tlv start_rxq;
555 struct vfpf_start_txq_tlv start_txq;
556 struct vfpf_stop_rxqs_tlv stop_rxqs;
557 struct vfpf_stop_txqs_tlv stop_txqs;
558 struct vfpf_update_rxq_tlv update_rxq;
559 struct vfpf_vport_start_tlv start_vport;
560 struct vfpf_vport_update_tlv vport_update;
561 struct vfpf_ucast_filter_tlv ucast_filter;
562 struct vfpf_update_tunn_param_tlv tunn_param_update;
563 struct vfpf_update_coalesce update_coalesce;
564 struct vfpf_read_coal_req_tlv read_coal_req;
565 struct vfpf_bulletin_update_mac_tlv bulletin_update_mac;
566 struct vfpf_update_mtu_tlv update_mtu;
567 struct vfpf_soft_flr_tlv soft_flr;
568 struct tlv_buffer_size tlv_buf_size;
572 struct pfvf_def_resp_tlv default_resp;
573 struct pfvf_acquire_resp_tlv acquire_resp;
574 struct tlv_buffer_size tlv_buf_size;
575 struct pfvf_start_queue_resp_tlv queue_start;
576 struct pfvf_update_tunn_param_tlv tunn_param_resp;
577 struct pfvf_read_coal_resp_tlv read_coal_resp;
580 /* This is a structure which is allocated in the VF, which the PF may update
581 * when it deems it necessary to do so. The bulletin board is sampled
582 * periodically by the VF. A copy per VF is maintained in the PF (to prevent
583 * loss of data upon multiple updates (or the need for read modify write)).
585 enum ecore_bulletin_bit {
586 /* Alert the VF that a forced MAC was set by the PF */
589 /* The VF should not access the vfpf channel */
590 VFPF_CHANNEL_INVALID = 1,
592 /* Alert the VF that a forced VLAN was set by the PF */
593 VLAN_ADDR_FORCED = 2,
595 /* Indicate that `default_only_untagged' contains actual data */
596 VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
597 VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
599 /* Alert the VF that suggested mac was sent by the PF.
600 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set
602 VFPF_BULLETIN_MAC_ADDR = 5
605 struct ecore_bulletin_content {
606 /* crc of structure to ensure is not in mid-update */
611 /* bitmap indicating which fields hold valid values */
614 /* used for MAC_ADDR or MAC_ADDR_FORCED */
617 /* If valid, 1 => only untagged Rx if no vlan is configured */
618 u8 default_only_untagged;
621 /* The following is a 'copy' of ecore_mcp_link_state,
622 * ecore_mcp_link_params and ecore_mcp_link_capabilities. Since it's
623 * possible the structs will increase further along the road we cannot
624 * have it here; Instead we need to have all of its fields.
627 u8 req_autoneg_pause;
633 u32 req_forced_speed;
641 u8 parallel_detection;
643 u8 partner_tx_flow_ctrl_en;
644 u8 partner_rx_flow_ctrl_en;
646 u8 partner_adv_pause;
653 u32 partner_adv_speed;
655 u32 capability_speed;
662 struct ecore_bulletin {
664 struct ecore_bulletin_content *p_virt;
669 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
671 CHANNEL_TLV_NONE, /* ends tlv sequence */
673 CHANNEL_TLV_VPORT_START,
674 CHANNEL_TLV_VPORT_UPDATE,
675 CHANNEL_TLV_VPORT_TEARDOWN,
676 CHANNEL_TLV_START_RXQ,
677 CHANNEL_TLV_START_TXQ,
678 CHANNEL_TLV_STOP_RXQS,
679 CHANNEL_TLV_STOP_TXQS,
680 CHANNEL_TLV_UPDATE_RXQ,
681 CHANNEL_TLV_INT_CLEANUP,
684 CHANNEL_TLV_LIST_END,
685 CHANNEL_TLV_UCAST_FILTER,
686 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
687 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
688 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
689 CHANNEL_TLV_VPORT_UPDATE_MCAST,
690 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
691 CHANNEL_TLV_VPORT_UPDATE_RSS,
692 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
693 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
694 CHANNEL_TLV_UPDATE_TUNN_PARAM,
695 CHANNEL_TLV_COALESCE_UPDATE,
697 CHANNEL_TLV_COALESCE_READ,
698 CHANNEL_TLV_BULLETIN_UPDATE_MAC,
699 CHANNEL_TLV_UPDATE_MTU,
700 CHANNEL_TLV_RDMA_ACQUIRE,
701 CHANNEL_TLV_RDMA_START,
702 CHANNEL_TLV_RDMA_STOP,
703 CHANNEL_TLV_RDMA_ADD_USER,
704 CHANNEL_TLV_RDMA_REMOVE_USER,
705 CHANNEL_TLV_RDMA_QUERY_COUNTERS,
706 CHANNEL_TLV_RDMA_ALLOC_TID,
707 CHANNEL_TLV_RDMA_REGISTER_TID,
708 CHANNEL_TLV_RDMA_DEREGISTER_TID,
709 CHANNEL_TLV_RDMA_FREE_TID,
710 CHANNEL_TLV_RDMA_CREATE_CQ,
711 CHANNEL_TLV_RDMA_RESIZE_CQ,
712 CHANNEL_TLV_RDMA_DESTROY_CQ,
713 CHANNEL_TLV_RDMA_CREATE_QP,
714 CHANNEL_TLV_RDMA_MODIFY_QP,
715 CHANNEL_TLV_RDMA_QUERY_QP,
716 CHANNEL_TLV_RDMA_DESTROY_QP,
717 CHANNEL_TLV_RDMA_QUERY_PORT,
718 CHANNEL_TLV_RDMA_QUERY_DEVICE,
719 CHANNEL_TLV_RDMA_IWARP_CONNECT,
720 CHANNEL_TLV_RDMA_IWARP_ACCEPT,
721 CHANNEL_TLV_RDMA_IWARP_CREATE_LISTEN,
722 CHANNEL_TLV_RDMA_IWARP_DESTROY_LISTEN,
723 CHANNEL_TLV_RDMA_IWARP_PAUSE_LISTEN,
724 CHANNEL_TLV_RDMA_IWARP_REJECT,
725 CHANNEL_TLV_RDMA_IWARP_SEND_RTR,
726 CHANNEL_TLV_ESTABLISH_LL2_CONN,
727 CHANNEL_TLV_TERMINATE_LL2_CONN,
728 CHANNEL_TLV_ASYNC_EVENT,
729 CHANNEL_TLV_RDMA_CREATE_SRQ,
730 CHANNEL_TLV_RDMA_MODIFY_SRQ,
731 CHANNEL_TLV_RDMA_DESTROY_SRQ,
732 CHANNEL_TLV_SOFT_FLR,
735 /* Required for iterating over vport-update tlvs.
736 * Will break in case non-sequential vport-update tlvs.
738 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
740 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
742 extern const char *qede_ecore_channel_tlvs_string[];
744 #endif /* __ECORE_VF_PF_IF_H__ */