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_start_rxq_tlv {
256 struct vfpf_first_tlv first_tlv;
258 /* physical addresses */
260 u64 deprecated_sge_addr;
266 u16 hc_rate; /* desired interrupts per sec. */
275 struct vfpf_start_txq_tlv {
276 struct vfpf_first_tlv first_tlv;
278 /* physical addresses */
285 u32 flags; /* VFPF_QUEUE_FLG_X flags */
286 u16 hc_rate; /* desired interrupts per sec. */
292 struct vfpf_stop_rxqs_tlv {
293 struct vfpf_first_tlv first_tlv;
297 /* While the API supports multiple Rx-queues on a single TLV
298 * message, in practice older VFs always used it as one [ecore].
299 * And there are PFs [starting with the CHANNEL_TLV_QID] which
300 * would start assuming this is always a '1'. So in practice this
301 * field should be considered deprecated and *Always* set to '1'.
310 struct vfpf_stop_txqs_tlv {
311 struct vfpf_first_tlv first_tlv;
315 /* While the API supports multiple Tx-queues on a single TLV
316 * message, in practice older VFs always used it as one [ecore].
317 * And there are PFs [starting with the CHANNEL_TLV_QID] which
318 * would start assuming this is always a '1'. So in practice this
319 * field should be considered deprecated and *Always* set to '1'.
325 struct vfpf_update_rxq_tlv {
326 struct vfpf_first_tlv first_tlv;
328 u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
333 #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG (1 << 0)
334 #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG (1 << 1)
335 #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG (1 << 2)
340 /* Set Queue Filters */
341 struct vfpf_q_mac_vlan_filter {
343 #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
344 #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
345 #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
354 struct vfpf_vport_start_tlv {
355 struct vfpf_first_tlv first_tlv;
357 u64 sb_addr[PFVF_MAX_SBS_PER_VF];
364 u8 inner_vlan_removal;
367 u8 max_buffers_per_cqe;
372 /* Extended tlvs - need to add rss, mcast, accept mode tlvs */
373 struct vfpf_vport_update_activate_tlv {
374 struct channel_tlv tl;
381 struct vfpf_vport_update_tx_switch_tlv {
382 struct channel_tlv tl;
387 struct vfpf_vport_update_vlan_strip_tlv {
388 struct channel_tlv tl;
393 struct vfpf_vport_update_mcast_bin_tlv {
394 struct channel_tlv tl;
397 /* This was a mistake; There are only 256 approx bins,
398 * and in HSI they're divided into 32-bit values.
399 * As old VFs used to set-bit to the values on its side,
400 * the upper half of the array is never expected to contain any data.
403 u64 obsolete_bins[4];
406 struct vfpf_vport_update_accept_param_tlv {
407 struct channel_tlv tl;
414 struct vfpf_vport_update_accept_any_vlan_tlv {
415 struct channel_tlv tl;
416 u8 update_accept_any_vlan_flg;
422 struct vfpf_vport_update_sge_tpa_tlv {
423 struct channel_tlv tl;
426 #define VFPF_TPA_IPV4_EN_FLAG (1 << 0)
427 #define VFPF_TPA_IPV6_EN_FLAG (1 << 1)
428 #define VFPF_TPA_PKT_SPLIT_FLAG (1 << 2)
429 #define VFPF_TPA_HDR_DATA_SPLIT_FLAG (1 << 3)
430 #define VFPF_TPA_GRO_CONSIST_FLAG (1 << 4)
431 #define VFPF_TPA_TUNN_IPV4_EN_FLAG (1 << 5)
432 #define VFPF_TPA_TUNN_IPV6_EN_FLAG (1 << 6)
434 u8 update_sge_tpa_flags;
435 #define VFPF_UPDATE_SGE_DEPRECATED_FLAG (1 << 0)
436 #define VFPF_UPDATE_TPA_EN_FLAG (1 << 1)
437 #define VFPF_UPDATE_TPA_PARAM_FLAG (1 << 2)
439 u8 max_buffers_per_cqe;
441 u16 deprecated_sge_buff_size;
443 u16 tpa_min_size_to_start;
444 u16 tpa_min_size_to_cont;
451 /* Primary tlv as a header for various extended tlvs for
452 * various functionalities in vport update ramrod.
454 struct vfpf_vport_update_tlv {
455 struct vfpf_first_tlv first_tlv;
458 struct vfpf_ucast_filter_tlv {
459 struct vfpf_first_tlv first_tlv;
470 /* tunnel update param tlv */
471 struct vfpf_update_tunn_param_tlv {
472 struct vfpf_first_tlv first_tlv;
474 u8 tun_mode_update_mask;
482 u8 update_geneve_port;
483 u8 update_vxlan_port;
489 struct pfvf_update_tunn_param_tlv {
492 u16 tunn_feature_mask;
507 struct tlv_buffer_size {
508 u8 tlv_buffer[TLV_BUFFER_SIZE];
511 struct vfpf_update_coalesce {
512 struct vfpf_first_tlv first_tlv;
519 struct vfpf_read_coal_req_tlv {
520 struct vfpf_first_tlv first_tlv;
526 struct pfvf_read_coal_resp_tlv {
532 struct vfpf_bulletin_update_mac_tlv {
533 struct vfpf_first_tlv first_tlv;
538 struct vfpf_update_mtu_tlv {
539 struct vfpf_first_tlv first_tlv;
545 struct vfpf_first_tlv first_tlv;
546 struct vfpf_acquire_tlv acquire;
547 struct vfpf_start_rxq_tlv start_rxq;
548 struct vfpf_start_txq_tlv start_txq;
549 struct vfpf_stop_rxqs_tlv stop_rxqs;
550 struct vfpf_stop_txqs_tlv stop_txqs;
551 struct vfpf_update_rxq_tlv update_rxq;
552 struct vfpf_vport_start_tlv start_vport;
553 struct vfpf_vport_update_tlv vport_update;
554 struct vfpf_ucast_filter_tlv ucast_filter;
555 struct vfpf_update_tunn_param_tlv tunn_param_update;
556 struct vfpf_update_coalesce update_coalesce;
557 struct vfpf_read_coal_req_tlv read_coal_req;
558 struct vfpf_bulletin_update_mac_tlv bulletin_update_mac;
559 struct vfpf_update_mtu_tlv update_mtu;
560 struct tlv_buffer_size tlv_buf_size;
564 struct pfvf_def_resp_tlv default_resp;
565 struct pfvf_acquire_resp_tlv acquire_resp;
566 struct tlv_buffer_size tlv_buf_size;
567 struct pfvf_start_queue_resp_tlv queue_start;
568 struct pfvf_update_tunn_param_tlv tunn_param_resp;
569 struct pfvf_read_coal_resp_tlv read_coal_resp;
572 /* This is a structure which is allocated in the VF, which the PF may update
573 * when it deems it necessary to do so. The bulletin board is sampled
574 * periodically by the VF. A copy per VF is maintained in the PF (to prevent
575 * loss of data upon multiple updates (or the need for read modify write)).
577 enum ecore_bulletin_bit {
578 /* Alert the VF that a forced MAC was set by the PF */
581 /* The VF should not access the vfpf channel */
582 VFPF_CHANNEL_INVALID = 1,
584 /* Alert the VF that a forced VLAN was set by the PF */
585 VLAN_ADDR_FORCED = 2,
587 /* Indicate that `default_only_untagged' contains actual data */
588 VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
589 VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
591 /* Alert the VF that suggested mac was sent by the PF.
592 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set
594 VFPF_BULLETIN_MAC_ADDR = 5
597 struct ecore_bulletin_content {
598 /* crc of structure to ensure is not in mid-update */
603 /* bitmap indicating which fields hold valid values */
606 /* used for MAC_ADDR or MAC_ADDR_FORCED */
609 /* If valid, 1 => only untagged Rx if no vlan is configured */
610 u8 default_only_untagged;
613 /* The following is a 'copy' of ecore_mcp_link_state,
614 * ecore_mcp_link_params and ecore_mcp_link_capabilities. Since it's
615 * possible the structs will increase further along the road we cannot
616 * have it here; Instead we need to have all of its fields.
619 u8 req_autoneg_pause;
625 u32 req_forced_speed;
633 u8 parallel_detection;
635 u8 partner_tx_flow_ctrl_en;
636 u8 partner_rx_flow_ctrl_en;
638 u8 partner_adv_pause;
645 u32 partner_adv_speed;
647 u32 capability_speed;
654 struct ecore_bulletin {
656 struct ecore_bulletin_content *p_virt;
661 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
663 CHANNEL_TLV_NONE, /* ends tlv sequence */
665 CHANNEL_TLV_VPORT_START,
666 CHANNEL_TLV_VPORT_UPDATE,
667 CHANNEL_TLV_VPORT_TEARDOWN,
668 CHANNEL_TLV_START_RXQ,
669 CHANNEL_TLV_START_TXQ,
670 CHANNEL_TLV_STOP_RXQS,
671 CHANNEL_TLV_STOP_TXQS,
672 CHANNEL_TLV_UPDATE_RXQ,
673 CHANNEL_TLV_INT_CLEANUP,
676 CHANNEL_TLV_LIST_END,
677 CHANNEL_TLV_UCAST_FILTER,
678 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
679 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
680 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
681 CHANNEL_TLV_VPORT_UPDATE_MCAST,
682 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
683 CHANNEL_TLV_VPORT_UPDATE_RSS,
684 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
685 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
686 CHANNEL_TLV_UPDATE_TUNN_PARAM,
687 CHANNEL_TLV_COALESCE_UPDATE,
689 CHANNEL_TLV_COALESCE_READ,
690 CHANNEL_TLV_BULLETIN_UPDATE_MAC,
691 CHANNEL_TLV_UPDATE_MTU,
694 /* Required for iterating over vport-update tlvs.
695 * Will break in case non-sequential vport-update tlvs.
697 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
699 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
701 extern const char *qede_ecore_channel_tlvs_string[];
703 #endif /* __ECORE_VF_PF_IF_H__ */