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 #define T_ETH_INDIRECTION_TABLE_SIZE 128
13 #define T_ETH_RSS_KEY_SIZE 10
15 #define aligned_u64 u64
18 /***********************************************
20 * Common definitions for all HVs
23 struct vf_pf_resc_request {
29 u8 num_mc_filters; /* No limit so superfluous */
34 u16 hw_sb_id; /* aka absolute igu id, used to ack the sb */
35 u8 sb_qid; /* used to update DHC for sb */
39 /***********************************************
41 * HW VF-PF channel definitions
46 #define TLV_BUFFER_SIZE 1024
47 #define TLV_ALIGN sizeof(u64)
48 #define PF_VF_BULLETIN_SIZE 512
50 #define VFPF_RX_MASK_ACCEPT_NONE 0x00000000
51 #define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST 0x00000001
52 #define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST 0x00000002
53 #define VFPF_RX_MASK_ACCEPT_ALL_UNICAST 0x00000004
54 #define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST 0x00000008
55 #define VFPF_RX_MASK_ACCEPT_BROADCAST 0x00000010
56 /* TODO: #define VFPF_RX_MASK_ACCEPT_ANY_VLAN 0x00000020 */
58 #define BULLETIN_CONTENT_SIZE (sizeof(struct pf_vf_bulletin_content))
59 #define BULLETIN_ATTEMPTS 5 /* crc failures before throwing towel */
60 #define BULLETIN_CRC_SEED 0
63 PFVF_STATUS_WAITING = 0,
66 PFVF_STATUS_NOT_SUPPORTED,
67 PFVF_STATUS_NO_RESOURCE,
71 /* vf pf channel tlvs */
72 /* general tlv header (used for both vf->pf request and pf->vf response) */
78 /* header of first vf->pf tlv carries the offset used to calculate response
81 struct vfpf_first_tlv {
82 struct channel_tlv tl;
84 aligned_u64 reply_address;
87 /* header of pf->vf tlvs, carries the status of handling the request */
89 struct channel_tlv tl;
94 /* response tlv used for most tlvs */
95 struct pfvf_def_resp_tlv {
99 /* used to terminate and pad a tlv list */
100 struct channel_list_end_tlv {
101 struct channel_tlv tl;
106 struct vfpf_acquire_tlv {
107 struct vfpf_first_tlv first_tlv;
109 struct vf_pf_vfdev_info {
110 #define VFPF_ACQUIRE_CAP_OVERRIDE_FW_VER (1 << 0)
111 aligned_u64 capabilties;
117 u16 opaque_fid; /* ME register value */
118 u8 os_type; /* VFPF_ACQUIRE_OS_* value */
122 struct vf_pf_resc_request resc_request;
124 aligned_u64 bulletin_addr;
129 /* receive side scaling tlv */
130 struct vfpf_vport_update_rss_tlv {
131 struct channel_tlv tl;
134 #define VFPF_UPDATE_RSS_CONFIG_FLAG (1 << 0)
135 #define VFPF_UPDATE_RSS_CAPS_FLAG (1 << 1)
136 #define VFPF_UPDATE_RSS_IND_TABLE_FLAG (1 << 2)
137 #define VFPF_UPDATE_RSS_KEY_FLAG (1 << 3)
141 u8 rss_table_size_log; /* The table size is 2 ^ rss_table_size_log */
142 u16 rss_ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
143 u32 rss_key[T_ETH_RSS_KEY_SIZE];
146 struct pfvf_storm_stats {
151 struct pfvf_stats_info {
152 struct pfvf_storm_stats mstats;
153 struct pfvf_storm_stats pstats;
154 struct pfvf_storm_stats tstats;
155 struct pfvf_storm_stats ustats;
158 /* acquire response tlv - carries the allocated resources */
159 struct pfvf_acquire_resp_tlv {
162 struct pf_vf_pfdev_info {
171 aligned_u64 capabilities;
172 #define PFVF_ACQUIRE_CAP_DEFAULT_UNTAGGED (1 << 0)
178 /* Thesee should match the PF's ecore_dev values */
184 struct pfvf_stats_info stats_info;
186 u8 port_mac[ETH_ALEN];
191 /* in case of status NO_RESOURCE in message hdr, pf will fill
192 * this struct with suggested amount of resources for next
195 #define PFVF_MAX_QUEUES_PER_VF 16
196 #define PFVF_MAX_SBS_PER_VF 16
197 struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
198 u8 hw_qid[PFVF_MAX_QUEUES_PER_VF];
199 u8 cid[PFVF_MAX_QUEUES_PER_VF];
215 struct vfpf_init_tlv {
216 struct vfpf_first_tlv first_tlv;
217 aligned_u64 stats_addr;
227 struct vfpf_start_rxq_tlv {
228 struct vfpf_first_tlv first_tlv;
230 /* physical addresses */
231 aligned_u64 rxq_addr;
232 aligned_u64 deprecated_sge_addr;
233 aligned_u64 cqe_pbl_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 */
251 aligned_u64 pbl_addr;
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 aligned_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 aligned_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 struct tlv_buffer_size {
420 u8 tlv_buffer[TLV_BUFFER_SIZE];
424 struct vfpf_first_tlv first_tlv;
425 struct vfpf_acquire_tlv acquire;
426 struct vfpf_init_tlv init;
427 struct vfpf_start_rxq_tlv start_rxq;
428 struct vfpf_start_txq_tlv start_txq;
429 struct vfpf_stop_rxqs_tlv stop_rxqs;
430 struct vfpf_stop_txqs_tlv stop_txqs;
431 struct vfpf_update_rxq_tlv update_rxq;
432 struct vfpf_vport_start_tlv start_vport;
433 struct vfpf_vport_update_tlv vport_update;
434 struct vfpf_ucast_filter_tlv ucast_filter;
435 struct channel_list_end_tlv list_end;
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 channel_list_end_tlv list_end;
443 struct tlv_buffer_size tlv_buf_size;
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 u32 crc; /* crc of structure to ensure is not in
477 aligned_u64 valid_bitmap; /* bitmap indicating wich fields
481 u8 mac[ETH_ALEN]; /* used for MAC_ADDR or MAC_ADDR_FORCED */
483 u8 default_only_untagged; /* If valid, 1 => only untagged Rx
484 * if no vlan filter is configured.
488 /* The following is a 'copy' of ecore_mcp_link_state,
489 * ecore_mcp_link_params and ecore_mcp_link_capabilities. Since it's
490 * possible the structs will increase further along the road we cannot
491 * have it here; Instead we need to have all of its fields.
494 u8 req_autoneg_pause;
500 u32 req_forced_speed;
508 u8 parallel_detection;
510 u8 partner_tx_flow_ctrl_en;
511 u8 partner_rx_flow_ctrl_en;
512 u8 partner_adv_pause;
517 u32 partner_adv_speed;
519 u32 capability_speed;
526 struct ecore_bulletin {
528 struct ecore_bulletin_content *p_virt;
534 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
536 CHANNEL_TLV_NONE, /* ends tlv sequence */
538 CHANNEL_TLV_VPORT_START,
539 CHANNEL_TLV_VPORT_UPDATE,
540 CHANNEL_TLV_VPORT_TEARDOWN,
541 CHANNEL_TLV_START_RXQ,
542 CHANNEL_TLV_START_TXQ,
543 CHANNEL_TLV_STOP_RXQS,
544 CHANNEL_TLV_STOP_TXQS,
545 CHANNEL_TLV_UPDATE_RXQ,
546 CHANNEL_TLV_INT_CLEANUP,
549 CHANNEL_TLV_LIST_END,
550 CHANNEL_TLV_UCAST_FILTER,
551 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
552 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
553 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
554 CHANNEL_TLV_VPORT_UPDATE_MCAST,
555 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
556 CHANNEL_TLV_VPORT_UPDATE_RSS,
557 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
558 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA,
560 /*!!!!! Make sure to update STRINGS structure accordingly !!!!!*/
562 extern const char *ecore_channel_tlvs_string[];
565 print_enum(channel_tlvs, CHANNEL_TLV_NONE, /* ends tlv sequence */
567 CHANNEL_TLV_VPORT_START,
568 CHANNEL_TLV_VPORT_UPDATE,
569 CHANNEL_TLV_VPORT_TEARDOWN,
570 CHANNEL_TLV_SETUP_RXQ,
571 CHANNEL_TLV_SETUP_TXQ,
572 CHANNEL_TLV_STOP_RXQS,
573 CHANNEL_TLV_STOP_TXQS,
574 CHANNEL_TLV_UPDATE_RXQ,
575 CHANNEL_TLV_INT_CLEANUP,
578 CHANNEL_TLV_LIST_END,
579 CHANNEL_TLV_UCAST_FILTER,
580 CHANNEL_TLV_VPORT_UPDATE_ACTIVATE,
581 CHANNEL_TLV_VPORT_UPDATE_TX_SWITCH,
582 CHANNEL_TLV_VPORT_UPDATE_VLAN_STRIP,
583 CHANNEL_TLV_VPORT_UPDATE_MCAST,
584 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_PARAM,
585 CHANNEL_TLV_VPORT_UPDATE_RSS,
586 CHANNEL_TLV_VPORT_UPDATE_ACCEPT_ANY_VLAN,
587 CHANNEL_TLV_VPORT_UPDATE_SGE_TPA, CHANNEL_TLV_MAX);
590 #endif /* __ECORE_VF_PF_IF_H__ */