2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
9 #ifndef __ECORE_VF_PF_IF_H__
10 #define __ECORE_VF_PF_IF_H__
12 /* @@@ TBD MichalK this should be HSI? */
13 #define T_ETH_INDIRECTION_TABLE_SIZE 128
14 #define T_ETH_RSS_KEY_SIZE 10 /* @@@ TBD this should be HSI? */
16 /***********************************************
18 * Common definitions for all HVs
21 struct vf_pf_resc_request {
27 u8 num_mc_filters; /* No limit so superfluous */
32 u16 hw_sb_id; /* aka absolute igu id, used to ack the sb */
33 u8 sb_qid; /* used to update DHC for sb */
37 /***********************************************
39 * HW VF-PF channel definitions
44 #define TLV_BUFFER_SIZE 1024
46 /* vf pf channel tlvs */
47 /* general tlv header (used for both vf->pf request and pf->vf response) */
53 /* header of first vf->pf tlv carries the offset used to calculate response
56 struct vfpf_first_tlv {
57 struct channel_tlv tl;
62 /* header of pf->vf tlvs, carries the status of handling the request */
64 struct channel_tlv tl;
69 /* response tlv used for most tlvs */
70 struct pfvf_def_resp_tlv {
74 /* used to terminate and pad a tlv list */
75 struct channel_list_end_tlv {
76 struct channel_tlv tl;
81 struct vfpf_acquire_tlv {
82 struct vfpf_first_tlv first_tlv;
84 struct vf_pf_vfdev_info {
86 /* First bit was used on 8.7.x and 8.8.x versions, which had different
87 * FWs used but with the same faspath HSI. As this was prior to the
88 * fastpath versioning, wanted to have ability to override fw matching
89 * and allow them to interact.
92 /* VF pre-FP hsi version */
93 #define VFPF_ACQUIRE_CAP_PRE_FP_HSI (1 << 0)
94 #define VFPF_ACQUIRE_CAP_100G (1 << 1) /* VF can support 100g */
101 u16 opaque_fid; /* ME register value */
102 u8 os_type; /* VFPF_ACQUIRE_OS_* value */
108 struct vf_pf_resc_request resc_request;
115 /* receive side scaling tlv */
116 struct vfpf_vport_update_rss_tlv {
117 struct channel_tlv tl;
120 #define VFPF_UPDATE_RSS_CONFIG_FLAG (1 << 0)
121 #define VFPF_UPDATE_RSS_CAPS_FLAG (1 << 1)
122 #define VFPF_UPDATE_RSS_IND_TABLE_FLAG (1 << 2)
123 #define VFPF_UPDATE_RSS_KEY_FLAG (1 << 3)
127 u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
128 u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
129 u32 rss_key[T_ETH_RSS_KEY_SIZE];
132 struct pfvf_storm_stats {
137 struct pfvf_stats_info {
138 struct pfvf_storm_stats mstats;
139 struct pfvf_storm_stats pstats;
140 struct pfvf_storm_stats tstats;
141 struct pfvf_storm_stats ustats;
144 /* acquire response tlv - carries the allocated resources */
145 struct pfvf_acquire_resp_tlv {
148 struct pf_vf_pfdev_info {
158 #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED (1 << 0)
159 #define PFVF_ACQUIRE_CAP_100G (1 << 1) /* If set, 100g PF */
160 /* There are old PF versions where the PF might mistakenly override the sanity
161 * mechanism [version-based] and allow a VF that can't be supported to pass
162 * the acquisition phase.
163 * To overcome this, PFs now indicate that they're past that point and the new
164 * VFs would fail probe on the older PFs that fail to do so.
167 /* Said bug was in quest/serpens; Can't be certain no official release included
168 * the bug since the fix arrived very late in the programs.
171 #define PFVF_ACQUIRE_CAP_POST_FW_OVERRIDE (1 << 2)
177 /* These should match the PF's ecore_dev values */
183 struct pfvf_stats_info stats_info;
185 u8 port_mac[ETH_ALEN];
187 /* It's possible PF had to configure an older fastpath HSI
188 * [in case VF is newer than PF]. This is communicated back
189 * to the VF. It can also be used in case of error due to
190 * non-matching versions to shed light in VF about failure.
197 /* in case of status NO_RESOURCE in message hdr, pf will fill
198 * this struct with suggested amount of resources for next
201 #define PFVF_MAX_QUEUES_PER_VF 16
202 #define PFVF_MAX_SBS_PER_VF 16
203 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
204 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
205 u8 cid[PFVF_MAX_QUEUES_PER_VF];
220 struct pfvf_start_queue_resp_tlv {
222 u32 offset; /* offset to consumer/producer of queue */
227 struct vfpf_start_rxq_tlv {
228 struct vfpf_first_tlv first_tlv;
230 /* physical addresses */
232 u64 deprecated_sge_addr;
238 u16 hc_rate; /* desired interrupts per sec. */
247 struct vfpf_start_txq_tlv {
248 struct vfpf_first_tlv first_tlv;
250 /* physical addresses */
257 u32 flags; /* VFPF_QUEUE_FLG_X flags */
258 u16 hc_rate; /* desired interrupts per sec. */
264 struct vfpf_stop_rxqs_tlv {
265 struct vfpf_first_tlv first_tlv;
274 struct vfpf_stop_txqs_tlv {
275 struct vfpf_first_tlv first_tlv;
282 struct vfpf_update_rxq_tlv {
283 struct vfpf_first_tlv first_tlv;
285 u64 deprecated_sge_addr[PFVF_MAX_QUEUES_PER_VF];
290 #define VFPF_RXQ_UPD_INIT_SGE_DEPRECATE_FLAG (1 << 0)
291 #define VFPF_RXQ_UPD_COMPLETE_CQE_FLAG (1 << 1)
292 #define VFPF_RXQ_UPD_COMPLETE_EVENT_FLAG (1 << 2)
297 /* Set Queue Filters */
298 struct vfpf_q_mac_vlan_filter {
300 #define VFPF_Q_FILTER_DEST_MAC_VALID 0x01
301 #define VFPF_Q_FILTER_VLAN_TAG_VALID 0x02
302 #define VFPF_Q_FILTER_SET_MAC 0x100 /* set/clear */
311 struct vfpf_vport_start_tlv {
312 struct vfpf_first_tlv first_tlv;
314 u64 sb_addr[PFVF_MAX_SBS_PER_VF];
321 u8 inner_vlan_removal;
324 u8 max_buffers_per_cqe;
329 /* Extended tlvs - need to add rss, mcast, accept mode tlvs */
330 struct vfpf_vport_update_activate_tlv {
331 struct channel_tlv tl;
338 struct vfpf_vport_update_tx_switch_tlv {
339 struct channel_tlv tl;
344 struct vfpf_vport_update_vlan_strip_tlv {
345 struct channel_tlv tl;
350 struct vfpf_vport_update_mcast_bin_tlv {
351 struct channel_tlv tl;
357 struct vfpf_vport_update_accept_param_tlv {
358 struct channel_tlv tl;
365 struct vfpf_vport_update_accept_any_vlan_tlv {
366 struct channel_tlv tl;
367 u8 update_accept_any_vlan_flg;
373 struct vfpf_vport_update_sge_tpa_tlv {
374 struct channel_tlv tl;
377 #define VFPF_TPA_IPV4_EN_FLAG (1 << 0)
378 #define VFPF_TPA_IPV6_EN_FLAG (1 << 1)
379 #define VFPF_TPA_PKT_SPLIT_FLAG (1 << 2)
380 #define VFPF_TPA_HDR_DATA_SPLIT_FLAG (1 << 3)
381 #define VFPF_TPA_GRO_CONSIST_FLAG (1 << 4)
383 u8 update_sge_tpa_flags;
384 #define VFPF_UPDATE_SGE_DEPRECATED_FLAG (1 << 0)
385 #define VFPF_UPDATE_TPA_EN_FLAG (1 << 1)
386 #define VFPF_UPDATE_TPA_PARAM_FLAG (1 << 2)
388 u8 max_buffers_per_cqe;
390 u16 deprecated_sge_buff_size;
392 u16 tpa_min_size_to_start;
393 u16 tpa_min_size_to_cont;
400 /* Primary tlv as a header for various extended tlvs for
401 * various functionalities in vport update ramrod.
403 struct vfpf_vport_update_tlv {
404 struct vfpf_first_tlv first_tlv;
407 struct vfpf_ucast_filter_tlv {
408 struct vfpf_first_tlv first_tlv;
419 /* tunnel update param tlv */
420 struct vfpf_update_tunn_param_tlv {
421 struct vfpf_first_tlv first_tlv;
423 u8 tun_mode_update_mask;
431 u8 update_geneve_port;
432 u8 update_vxlan_port;
438 struct pfvf_update_tunn_param_tlv {
441 u16 tunn_feature_mask;
456 struct tlv_buffer_size {
457 u8 tlv_buffer[TLV_BUFFER_SIZE];
461 struct vfpf_first_tlv first_tlv;
462 struct vfpf_acquire_tlv acquire;
463 struct vfpf_start_rxq_tlv start_rxq;
464 struct vfpf_start_txq_tlv start_txq;
465 struct vfpf_stop_rxqs_tlv stop_rxqs;
466 struct vfpf_stop_txqs_tlv stop_txqs;
467 struct vfpf_update_rxq_tlv update_rxq;
468 struct vfpf_vport_start_tlv start_vport;
469 struct vfpf_vport_update_tlv vport_update;
470 struct vfpf_ucast_filter_tlv ucast_filter;
471 struct vfpf_update_tunn_param_tlv tunn_param_update;
472 struct tlv_buffer_size tlv_buf_size;
476 struct pfvf_def_resp_tlv default_resp;
477 struct pfvf_acquire_resp_tlv acquire_resp;
478 struct tlv_buffer_size tlv_buf_size;
479 struct pfvf_start_queue_resp_tlv queue_start;
480 struct pfvf_update_tunn_param_tlv tunn_param_resp;
483 /* This is a structure which is allocated in the VF, which the PF may update
484 * when it deems it necessary to do so. The bulletin board is sampled
485 * periodically by the VF. A copy per VF is maintained in the PF (to prevent
486 * loss of data upon multiple updates (or the need for read modify write)).
488 enum ecore_bulletin_bit {
489 /* Alert the VF that a forced MAC was set by the PF */
492 /* The VF should not access the vfpf channel */
493 VFPF_CHANNEL_INVALID = 1,
495 /* Alert the VF that a forced VLAN was set by the PF */
496 VLAN_ADDR_FORCED = 2,
498 /* Indicate that `default_only_untagged' contains actual data */
499 VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
500 VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
502 /* Alert the VF that suggested mac was sent by the PF.
503 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set
505 VFPF_BULLETIN_MAC_ADDR = 5
508 struct ecore_bulletin_content {
509 /* crc of structure to ensure is not in mid-update */
514 /* bitmap indicating which fields hold valid values */
517 /* used for MAC_ADDR or MAC_ADDR_FORCED */
520 /* If valid, 1 => only untagged Rx if no vlan is configured */
521 u8 default_only_untagged;
524 /* The following is a 'copy' of ecore_mcp_link_state,
525 * ecore_mcp_link_params and ecore_mcp_link_capabilities. Since it's
526 * possible the structs will increase further along the road we cannot
527 * have it here; Instead we need to have all of its fields.
530 u8 req_autoneg_pause;
536 u32 req_forced_speed;
544 u8 parallel_detection;
546 u8 partner_tx_flow_ctrl_en;
547 u8 partner_rx_flow_ctrl_en;
548 u8 partner_adv_pause;
553 u32 partner_adv_speed;
555 u32 capability_speed;
562 struct ecore_bulletin {
564 struct ecore_bulletin_content *p_virt;
569 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
571 CHANNEL_TLV_NONE, /* ends tlv sequence */
573 CHANNEL_TLV_VPORT_START,
574 CHANNEL_TLV_VPORT_UPDATE,
575 CHANNEL_TLV_VPORT_TEARDOWN,
576 CHANNEL_TLV_START_RXQ,
577 CHANNEL_TLV_START_TXQ,
578 CHANNEL_TLV_STOP_RXQS,
579 CHANNEL_TLV_STOP_TXQS,
580 CHANNEL_TLV_UPDATE_RXQ,
581 CHANNEL_TLV_INT_CLEANUP,
584 CHANNEL_TLV_LIST_END,
585 CHANNEL_TLV_UCAST_FILTER,
586 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
587 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
588 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
589 CHANNEL_TLV_VPORT_UPDATE_MCAST,
590 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
591 CHANNEL_TLV_VPORT_UPDATE_RSS,
592 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
593 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
594 CHANNEL_TLV_UPDATE_TUNN_PARAM,
597 /* Required for iterating over vport-update tlvs.
598 * Will break in case non-sequential vport-update tlvs.
600 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
602 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
604 extern const char *ecore_channel_tlvs_string[];
606 #endif /* __ECORE_VF_PF_IF_H__ */