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)
382 #define VFPF_TPA_TUNN_IPV4_EN_FLAG (1 << 5)
383 #define VFPF_TPA_TUNN_IPV6_EN_FLAG (1 << 6)
385 u8 update_sge_tpa_flags;
386 #define VFPF_UPDATE_SGE_DEPRECATED_FLAG (1 << 0)
387 #define VFPF_UPDATE_TPA_EN_FLAG (1 << 1)
388 #define VFPF_UPDATE_TPA_PARAM_FLAG (1 << 2)
390 u8 max_buffers_per_cqe;
392 u16 deprecated_sge_buff_size;
394 u16 tpa_min_size_to_start;
395 u16 tpa_min_size_to_cont;
402 /* Primary tlv as a header for various extended tlvs for
403 * various functionalities in vport update ramrod.
405 struct vfpf_vport_update_tlv {
406 struct vfpf_first_tlv first_tlv;
409 struct vfpf_ucast_filter_tlv {
410 struct vfpf_first_tlv first_tlv;
421 struct tlv_buffer_size {
422 u8 tlv_buffer[TLV_BUFFER_SIZE];
426 struct vfpf_first_tlv first_tlv;
427 struct vfpf_acquire_tlv acquire;
428 struct vfpf_start_rxq_tlv start_rxq;
429 struct vfpf_start_txq_tlv start_txq;
430 struct vfpf_stop_rxqs_tlv stop_rxqs;
431 struct vfpf_stop_txqs_tlv stop_txqs;
432 struct vfpf_update_rxq_tlv update_rxq;
433 struct vfpf_vport_start_tlv start_vport;
434 struct vfpf_vport_update_tlv vport_update;
435 struct vfpf_ucast_filter_tlv ucast_filter;
436 struct tlv_buffer_size tlv_buf_size;
440 struct pfvf_def_resp_tlv default_resp;
441 struct pfvf_acquire_resp_tlv acquire_resp;
442 struct tlv_buffer_size tlv_buf_size;
443 struct pfvf_start_queue_resp_tlv queue_start;
446 /* This is a structure which is allocated in the VF, which the PF may update
447 * when it deems it necessary to do so. The bulletin board is sampled
448 * periodically by the VF. A copy per VF is maintained in the PF (to prevent
449 * loss of data upon multiple updates (or the need for read modify write)).
451 enum ecore_bulletin_bit {
452 /* Alert the VF that a forced MAC was set by the PF */
455 /* The VF should not access the vfpf channel */
456 VFPF_CHANNEL_INVALID = 1,
458 /* Alert the VF that a forced VLAN was set by the PF */
459 VLAN_ADDR_FORCED = 2,
461 /* Indicate that `default_only_untagged' contains actual data */
462 VFPF_BULLETIN_UNTAGGED_DEFAULT = 3,
463 VFPF_BULLETIN_UNTAGGED_DEFAULT_FORCED = 4,
465 /* Alert the VF that suggested mac was sent by the PF.
466 * MAC_ADDR will be disabled in case MAC_ADDR_FORCED is set
468 VFPF_BULLETIN_MAC_ADDR = 5
471 struct ecore_bulletin_content {
472 /* crc of structure to ensure is not in mid-update */
477 /* bitmap indicating which fields hold valid values */
480 /* used for MAC_ADDR or MAC_ADDR_FORCED */
483 /* If valid, 1 => only untagged Rx if no vlan is configured */
484 u8 default_only_untagged;
487 /* The following is a 'copy' of ecore_mcp_link_state,
488 * ecore_mcp_link_params and ecore_mcp_link_capabilities. Since it's
489 * possible the structs will increase further along the road we cannot
490 * have it here; Instead we need to have all of its fields.
493 u8 req_autoneg_pause;
499 u32 req_forced_speed;
507 u8 parallel_detection;
509 u8 partner_tx_flow_ctrl_en;
510 u8 partner_rx_flow_ctrl_en;
511 u8 partner_adv_pause;
516 u32 partner_adv_speed;
518 u32 capability_speed;
525 struct ecore_bulletin {
527 struct ecore_bulletin_content *p_virt;
532 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
534 CHANNEL_TLV_NONE, /* ends tlv sequence */
536 CHANNEL_TLV_VPORT_START,
537 CHANNEL_TLV_VPORT_UPDATE,
538 CHANNEL_TLV_VPORT_TEARDOWN,
539 CHANNEL_TLV_START_RXQ,
540 CHANNEL_TLV_START_TXQ,
541 CHANNEL_TLV_STOP_RXQS,
542 CHANNEL_TLV_STOP_TXQS,
543 CHANNEL_TLV_UPDATE_RXQ,
544 CHANNEL_TLV_INT_CLEANUP,
547 CHANNEL_TLV_LIST_END,
548 CHANNEL_TLV_UCAST_FILTER,
549 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
550 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
551 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
552 CHANNEL_TLV_VPORT_UPDATE_MCAST,
553 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
554 CHANNEL_TLV_VPORT_UPDATE_RSS,
555 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
556 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
559 /* Required for iterating over vport-update tlvs.
560 * Will break in case non-sequential vport-update tlvs.
562 CHANNEL_TLV_VPORT_UPDATE_MAX = CHANNEL_TLV_VPORT_UPDATE_SGE_TPA + 1,
564 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
566 extern const char *ecore_channel_tlvs_string[];
568 #endif /* __ECORE_VF_PF_IF_H__ */