xref: /openbmc/linux/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.h (revision e5451c8f8330e03ad3cfa16048b4daf961af434f)
14ad79e13SYuval Mintz /* bnx2x_vfpf.h: Qlogic Everest network driver.
21ab4434cSAriel Elior  *
3247fa82bSYuval Mintz  * Copyright (c) 2011-2013 Broadcom Corporation
44ad79e13SYuval Mintz  * Copyright (c) 2014 QLogic Corporation
54ad79e13SYuval Mintz  * All rights reserved
61ab4434cSAriel Elior  *
74ad79e13SYuval Mintz  * Unless you and Qlogic execute a separate written software license
81ab4434cSAriel Elior  * agreement governing use of this software, this software is licensed to you
94ad79e13SYuval Mintz  * under the terms of the GNU General Public License version 2 (the “GPL”),
104ad79e13SYuval Mintz  * available at http://www.gnu.org/licenses/gpl-2.0.html, with the following
114ad79e13SYuval Mintz  * added to such license:
121ab4434cSAriel Elior  *
134ad79e13SYuval Mintz  * As a special exception, the copyright holders of this software give you
144ad79e13SYuval Mintz  * permission to link this software with independent modules, and to copy and
154ad79e13SYuval Mintz  * distribute the resulting executable under terms of your choice, provided that
164ad79e13SYuval Mintz  * you also meet, for each linked independent module, the terms and conditions
174ad79e13SYuval Mintz  * of the license of that module.  An independent module is a module which is
184ad79e13SYuval Mintz  * not derived from this software.  The special exception does not apply to any
194ad79e13SYuval Mintz  * modifications of the software.
201ab4434cSAriel Elior  *
2108f6dd89SAriel Elior  * Maintained by: Ariel Elior <ariel.elior@qlogic.com>
2208f6dd89SAriel Elior  * Written by: Ariel Elior <ariel.elior@qlogic.com>
231ab4434cSAriel Elior  */
241ab4434cSAriel Elior #ifndef VF_PF_IF_H
251ab4434cSAriel Elior #define VF_PF_IF_H
261ab4434cSAriel Elior 
276411280aSAriel Elior #ifdef CONFIG_BNX2X_SRIOV
286411280aSAriel Elior 
29be1f1ffaSAriel Elior /* Common definitions for all HVs */
30be1f1ffaSAriel Elior struct vf_pf_resc_request {
31be1f1ffaSAriel Elior 	u8  num_rxqs;
32be1f1ffaSAriel Elior 	u8  num_txqs;
33be1f1ffaSAriel Elior 	u8  num_sbs;
34be1f1ffaSAriel Elior 	u8  num_mac_filters;
35be1f1ffaSAriel Elior 	u8  num_vlan_filters;
36be1f1ffaSAriel Elior 	u8  num_mc_filters; /* No limit  so superfluous */
37be1f1ffaSAriel Elior };
38be1f1ffaSAriel Elior 
39be1f1ffaSAriel Elior struct hw_sb_info {
40be1f1ffaSAriel Elior 	u8 hw_sb_id;	/* aka absolute igu id, used to ack the sb */
41be1f1ffaSAriel Elior 	u8 sb_qid;	/* used to update DHC for sb */
42be1f1ffaSAriel Elior };
43be1f1ffaSAriel Elior 
441ab4434cSAriel Elior /* HW VF-PF channel definitions
451ab4434cSAriel Elior  * A.K.A VF-PF mailbox
461ab4434cSAriel Elior  */
471ab4434cSAriel Elior #define TLV_BUFFER_SIZE			1024
48abc5a021SAriel Elior #define PF_VF_BULLETIN_SIZE		512
491ab4434cSAriel Elior 
508d9ac297SAriel Elior #define VFPF_QUEUE_FLG_TPA		0x0001
518d9ac297SAriel Elior #define VFPF_QUEUE_FLG_TPA_IPV6		0x0002
528d9ac297SAriel Elior #define VFPF_QUEUE_FLG_TPA_GRO		0x0004
538d9ac297SAriel Elior #define VFPF_QUEUE_FLG_CACHE_ALIGN	0x0008
548d9ac297SAriel Elior #define VFPF_QUEUE_FLG_STATS		0x0010
558d9ac297SAriel Elior #define VFPF_QUEUE_FLG_OV		0x0020
568d9ac297SAriel Elior #define VFPF_QUEUE_FLG_VLAN		0x0040
578d9ac297SAriel Elior #define VFPF_QUEUE_FLG_COS		0x0080
588d9ac297SAriel Elior #define VFPF_QUEUE_FLG_HC		0x0100
598d9ac297SAriel Elior #define VFPF_QUEUE_FLG_DHC		0x0200
60b9871bcfSAriel Elior #define VFPF_QUEUE_FLG_LEADING_RSS	0x0400
618d9ac297SAriel Elior 
628d9ac297SAriel Elior #define VFPF_QUEUE_DROP_IP_CS_ERR	(1 << 0)
638d9ac297SAriel Elior #define VFPF_QUEUE_DROP_TCP_CS_ERR	(1 << 1)
648d9ac297SAriel Elior #define VFPF_QUEUE_DROP_TTL0		(1 << 2)
658d9ac297SAriel Elior #define VFPF_QUEUE_DROP_UDP_CS_ERR	(1 << 3)
668d9ac297SAriel Elior 
67381ac16bSAriel Elior #define VFPF_RX_MASK_ACCEPT_NONE		0x00000000
68381ac16bSAriel Elior #define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST	0x00000001
69381ac16bSAriel Elior #define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST	0x00000002
70381ac16bSAriel Elior #define VFPF_RX_MASK_ACCEPT_ALL_UNICAST		0x00000004
71381ac16bSAriel Elior #define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST	0x00000008
72381ac16bSAriel Elior #define VFPF_RX_MASK_ACCEPT_BROADCAST		0x00000010
73*05cc5a39SYuval Mintz #define VFPF_RX_MASK_ACCEPT_ANY_VLAN		0x00000020
74*05cc5a39SYuval Mintz 
75abc5a021SAriel Elior #define BULLETIN_CONTENT_SIZE		(sizeof(struct pf_vf_bulletin_content))
766495d15aSDmitry Kravkov #define BULLETIN_CONTENT_LEGACY_SIZE	(32)
77abc5a021SAriel Elior #define BULLETIN_ATTEMPTS	5 /* crc failures before throwing towel */
78abc5a021SAriel Elior #define BULLETIN_CRC_SEED	0
79381ac16bSAriel Elior 
80be1f1ffaSAriel Elior enum {
81be1f1ffaSAriel Elior 	PFVF_STATUS_WAITING = 0,
82be1f1ffaSAriel Elior 	PFVF_STATUS_SUCCESS,
83be1f1ffaSAriel Elior 	PFVF_STATUS_FAILURE,
84be1f1ffaSAriel Elior 	PFVF_STATUS_NOT_SUPPORTED,
85be1f1ffaSAriel Elior 	PFVF_STATUS_NO_RESOURCE
86be1f1ffaSAriel Elior };
87be1f1ffaSAriel Elior 
88be1f1ffaSAriel Elior /* vf pf channel tlvs */
89be1f1ffaSAriel Elior /* general tlv header (used for both vf->pf request and pf->vf response) */
90be1f1ffaSAriel Elior struct channel_tlv {
91be1f1ffaSAriel Elior 	u16 type;
92be1f1ffaSAriel Elior 	u16 length;
93be1f1ffaSAriel Elior };
94be1f1ffaSAriel Elior 
95be1f1ffaSAriel Elior /* header of first vf->pf tlv carries the offset used to calculate response
96be1f1ffaSAriel Elior  * buffer address
97be1f1ffaSAriel Elior  */
98be1f1ffaSAriel Elior struct vfpf_first_tlv {
99be1f1ffaSAriel Elior 	struct channel_tlv tl;
100be1f1ffaSAriel Elior 	u32 resp_msg_offset;
101be1f1ffaSAriel Elior };
102be1f1ffaSAriel Elior 
103be1f1ffaSAriel Elior /* header of pf->vf tlvs, carries the status of handling the request */
104be1f1ffaSAriel Elior struct pfvf_tlv {
105be1f1ffaSAriel Elior 	struct channel_tlv tl;
106be1f1ffaSAriel Elior 	u8 status;
107be1f1ffaSAriel Elior 	u8 padding[3];
108be1f1ffaSAriel Elior };
109be1f1ffaSAriel Elior 
1104513f925SAriel Elior /* response tlv used for most tlvs */
1114513f925SAriel Elior struct pfvf_general_resp_tlv {
1124513f925SAriel Elior 	struct pfvf_tlv hdr;
1134513f925SAriel Elior };
1144513f925SAriel Elior 
115be1f1ffaSAriel Elior /* used to terminate and pad a tlv list */
116be1f1ffaSAriel Elior struct channel_list_end_tlv {
117be1f1ffaSAriel Elior 	struct channel_tlv tl;
118be1f1ffaSAriel Elior 	u8 padding[4];
119be1f1ffaSAriel Elior };
120be1f1ffaSAriel Elior 
121be1f1ffaSAriel Elior /* Acquire */
122be1f1ffaSAriel Elior struct vfpf_acquire_tlv {
123be1f1ffaSAriel Elior 	struct vfpf_first_tlv first_tlv;
124be1f1ffaSAriel Elior 
125be1f1ffaSAriel Elior 	struct vf_pf_vfdev_info {
126be1f1ffaSAriel Elior 		/* the following fields are for debug purposes */
127be1f1ffaSAriel Elior 		u8  vf_id;		/* ME register value */
128be1f1ffaSAriel Elior 		u8  vf_os;		/* e.g. Linux, W2K8 */
129ebf457f9SYuval Mintz #define VF_OS_SUBVERSION_MASK	(0x1f)
130ebf457f9SYuval Mintz #define VF_OS_MASK		(0xe0)
131ebf457f9SYuval Mintz #define VF_OS_SHIFT		(5)
132ebf457f9SYuval Mintz #define VF_OS_UNDEFINED		(0 << VF_OS_SHIFT)
133ebf457f9SYuval Mintz #define VF_OS_WINDOWS		(1 << VF_OS_SHIFT)
134ebf457f9SYuval Mintz 
13502dc4025SYuval Mintz 		u8 fp_hsi_ver;
1366495d15aSDmitry Kravkov 		u8 caps;
1376495d15aSDmitry Kravkov #define VF_CAP_SUPPORT_EXT_BULLETIN	(1 << 0)
138*05cc5a39SYuval Mintz #define VF_CAP_SUPPORT_VLAN_FILTER	(1 << 1)
139be1f1ffaSAriel Elior 	} vfdev_info;
140be1f1ffaSAriel Elior 
141be1f1ffaSAriel Elior 	struct vf_pf_resc_request resc_request;
142be1f1ffaSAriel Elior 
143be1f1ffaSAriel Elior 	aligned_u64 bulletin_addr;
144be1f1ffaSAriel Elior };
145be1f1ffaSAriel Elior 
1469b176b6bSAriel Elior /* simple operation request on queue */
1479b176b6bSAriel Elior struct vfpf_q_op_tlv {
1489b176b6bSAriel Elior 	struct vfpf_first_tlv	first_tlv;
1499b176b6bSAriel Elior 	u8 vf_qid;
1509b176b6bSAriel Elior 	u8 padding[3];
1519b176b6bSAriel Elior };
1529b176b6bSAriel Elior 
153b9871bcfSAriel Elior /* receive side scaling tlv */
154b9871bcfSAriel Elior struct vfpf_rss_tlv {
155b9871bcfSAriel Elior 	struct vfpf_first_tlv	first_tlv;
156b9871bcfSAriel Elior 	u32			rss_flags;
157b9871bcfSAriel Elior #define VFPF_RSS_MODE_DISABLED	(1 << 0)
158b9871bcfSAriel Elior #define VFPF_RSS_MODE_REGULAR	(1 << 1)
159b9871bcfSAriel Elior #define VFPF_RSS_SET_SRCH	(1 << 2)
160b9871bcfSAriel Elior #define VFPF_RSS_IPV4		(1 << 3)
161b9871bcfSAriel Elior #define VFPF_RSS_IPV4_TCP	(1 << 4)
162b9871bcfSAriel Elior #define VFPF_RSS_IPV4_UDP	(1 << 5)
163b9871bcfSAriel Elior #define VFPF_RSS_IPV6		(1 << 6)
164b9871bcfSAriel Elior #define VFPF_RSS_IPV6_TCP	(1 << 7)
165b9871bcfSAriel Elior #define VFPF_RSS_IPV6_UDP	(1 << 8)
166b9871bcfSAriel Elior 	u8			rss_result_mask;
167b9871bcfSAriel Elior 	u8			ind_table_size;
168b9871bcfSAriel Elior 	u8			rss_key_size;
169b9871bcfSAriel Elior 	u8			padding;
170b9871bcfSAriel Elior 	u8			ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
171b9871bcfSAriel Elior 	u32			rss_key[T_ETH_RSS_KEY];	/* hash values */
172b9871bcfSAriel Elior };
173b9871bcfSAriel Elior 
174be1f1ffaSAriel Elior /* acquire response tlv - carries the allocated resources */
175be1f1ffaSAriel Elior struct pfvf_acquire_resp_tlv {
176be1f1ffaSAriel Elior 	struct pfvf_tlv hdr;
177be1f1ffaSAriel Elior 	struct pf_vf_pfdev_info {
178be1f1ffaSAriel Elior 		u32 chip_num;
179be1f1ffaSAriel Elior 		u32 pf_cap;
180be1f1ffaSAriel Elior #define PFVF_CAP_RSS          0x00000001
181be1f1ffaSAriel Elior #define PFVF_CAP_DHC          0x00000002
182be1f1ffaSAriel Elior #define PFVF_CAP_TPA          0x00000004
18314a94ebdSMichal Kalderon #define PFVF_CAP_TPA_UPDATE   0x00000008
184*05cc5a39SYuval Mintz #define PFVF_CAP_VLAN_FILTER  0x00000010
185*05cc5a39SYuval Mintz 
186be1f1ffaSAriel Elior 		char fw_ver[32];
187be1f1ffaSAriel Elior 		u16 db_size;
188be1f1ffaSAriel Elior 		u8  indices_per_sb;
189be1f1ffaSAriel Elior 		u8  padding;
190be1f1ffaSAriel Elior 	} pfdev_info;
191be1f1ffaSAriel Elior 	struct pf_vf_resc {
192be1f1ffaSAriel Elior 		/* in case of status NO_RESOURCE in message hdr, pf will fill
193be1f1ffaSAriel Elior 		 * this struct with suggested amount of resources for next
194be1f1ffaSAriel Elior 		 * acquire request
195be1f1ffaSAriel Elior 		 */
196be1f1ffaSAriel Elior #define PFVF_MAX_QUEUES_PER_VF         16
197be1f1ffaSAriel Elior #define PFVF_MAX_SBS_PER_VF            16
198be1f1ffaSAriel Elior 		struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
199be1f1ffaSAriel Elior 		u8	hw_qid[PFVF_MAX_QUEUES_PER_VF];
200be1f1ffaSAriel Elior 		u8	num_rxqs;
201be1f1ffaSAriel Elior 		u8	num_txqs;
202be1f1ffaSAriel Elior 		u8	num_sbs;
203be1f1ffaSAriel Elior 		u8	num_mac_filters;
204be1f1ffaSAriel Elior 		u8	num_vlan_filters;
205be1f1ffaSAriel Elior 		u8	num_mc_filters;
206be1f1ffaSAriel Elior 		u8	permanent_mac_addr[ETH_ALEN];
207be1f1ffaSAriel Elior 		u8	current_mac_addr[ETH_ALEN];
208be1f1ffaSAriel Elior 		u8	padding[2];
209be1f1ffaSAriel Elior 	} resc;
210be1f1ffaSAriel Elior };
211be1f1ffaSAriel Elior 
2123d7d562cSYuval Mintz struct vfpf_port_phys_id_resp_tlv {
2133d7d562cSYuval Mintz 	struct channel_tlv tl;
2143d7d562cSYuval Mintz 	u8 id[ETH_ALEN];
2153d7d562cSYuval Mintz 	u8 padding[2];
2163d7d562cSYuval Mintz };
2173d7d562cSYuval Mintz 
21802dc4025SYuval Mintz struct vfpf_fp_hsi_resp_tlv {
21902dc4025SYuval Mintz 	struct channel_tlv tl;
22002dc4025SYuval Mintz 	u8 is_supported;
22102dc4025SYuval Mintz 	u8 padding[3];
22202dc4025SYuval Mintz };
22302dc4025SYuval Mintz 
224b9871bcfSAriel Elior #define VFPF_INIT_FLG_STATS_COALESCE	(1 << 0) /* when set the VFs queues
225b9871bcfSAriel Elior 						  * stats will be coalesced on
226b9871bcfSAriel Elior 						  * the leading RSS queue
227b9871bcfSAriel Elior 						  */
228b9871bcfSAriel Elior 
2298d9ac297SAriel Elior /* Init VF */
2308d9ac297SAriel Elior struct vfpf_init_tlv {
2318d9ac297SAriel Elior 	struct vfpf_first_tlv first_tlv;
2328d9ac297SAriel Elior 	aligned_u64 sb_addr[PFVF_MAX_SBS_PER_VF]; /* vf_sb based */
2338d9ac297SAriel Elior 	aligned_u64 spq_addr;
2348d9ac297SAriel Elior 	aligned_u64 stats_addr;
235b9871bcfSAriel Elior 	u16 stats_stride;
236b9871bcfSAriel Elior 	u32 flags;
237b9871bcfSAriel Elior 	u32 padding[2];
2388d9ac297SAriel Elior };
2398d9ac297SAriel Elior 
2408d9ac297SAriel Elior /* Setup Queue */
2418d9ac297SAriel Elior struct vfpf_setup_q_tlv {
2428d9ac297SAriel Elior 	struct vfpf_first_tlv first_tlv;
2438d9ac297SAriel Elior 
2448d9ac297SAriel Elior 	struct vf_pf_rxq_params {
2458d9ac297SAriel Elior 		/* physical addresses */
2468d9ac297SAriel Elior 		aligned_u64 rcq_addr;
2478d9ac297SAriel Elior 		aligned_u64 rcq_np_addr;
2488d9ac297SAriel Elior 		aligned_u64 rxq_addr;
2498d9ac297SAriel Elior 		aligned_u64 sge_addr;
2508d9ac297SAriel Elior 
2518d9ac297SAriel Elior 		/* sb + hc info */
2528d9ac297SAriel Elior 		u8  vf_sb;		/* index in hw_sbs[] */
2538d9ac297SAriel Elior 		u8  sb_index;		/* Index in the SB */
2548d9ac297SAriel Elior 		u16 hc_rate;		/* desired interrupts per sec. */
2558d9ac297SAriel Elior 					/* valid iff VFPF_QUEUE_FLG_HC */
2568d9ac297SAriel Elior 		/* rx buffer info */
2578d9ac297SAriel Elior 		u16 mtu;
2588d9ac297SAriel Elior 		u16 buf_sz;
2598d9ac297SAriel Elior 		u16 flags;		/* VFPF_QUEUE_FLG_X flags */
2608d9ac297SAriel Elior 		u16 stat_id;		/* valid iff VFPF_QUEUE_FLG_STATS */
2618d9ac297SAriel Elior 
2628d9ac297SAriel Elior 		/* valid iff VFPF_QUEUE_FLG_TPA */
2638d9ac297SAriel Elior 		u16 sge_buf_sz;
2648d9ac297SAriel Elior 		u16 tpa_agg_sz;
2658d9ac297SAriel Elior 		u8 max_sge_pkt;
2668d9ac297SAriel Elior 
2678d9ac297SAriel Elior 		u8 drop_flags;		/* VFPF_QUEUE_DROP_X, for Linux VMs
2688d9ac297SAriel Elior 					 * all the flags are turned off
2698d9ac297SAriel Elior 					 */
2708d9ac297SAriel Elior 
2718d9ac297SAriel Elior 		u8 cache_line_log;	/* VFPF_QUEUE_FLG_CACHE_ALIGN */
2728d9ac297SAriel Elior 		u8 padding;
2738d9ac297SAriel Elior 	} rxq;
2748d9ac297SAriel Elior 
2758d9ac297SAriel Elior 	struct vf_pf_txq_params {
2768d9ac297SAriel Elior 		/* physical addresses */
2778d9ac297SAriel Elior 		aligned_u64 txq_addr;
2788d9ac297SAriel Elior 
2798d9ac297SAriel Elior 		/* sb + hc info */
2808d9ac297SAriel Elior 		u8  vf_sb;		/* index in hw_sbs[] */
2818d9ac297SAriel Elior 		u8  sb_index;		/* Index in the SB */
2828d9ac297SAriel Elior 		u16 hc_rate;		/* desired interrupts per sec. */
2838d9ac297SAriel Elior 					/* valid iff VFPF_QUEUE_FLG_HC */
2848d9ac297SAriel Elior 		u32 flags;		/* VFPF_QUEUE_FLG_X flags */
2858d9ac297SAriel Elior 		u16 stat_id;		/* valid iff VFPF_QUEUE_FLG_STATS */
2868d9ac297SAriel Elior 		u8  traffic_type;	/* see in setup_context() */
2878d9ac297SAriel Elior 		u8  padding;
2888d9ac297SAriel Elior 	} txq;
2898d9ac297SAriel Elior 
2908d9ac297SAriel Elior 	u8 vf_qid;			/* index in hw_qid[] */
2918d9ac297SAriel Elior 	u8 param_valid;
2928d9ac297SAriel Elior #define VFPF_RXQ_VALID		0x01
2938d9ac297SAriel Elior #define VFPF_TXQ_VALID		0x02
2948d9ac297SAriel Elior 	u8 padding[2];
2958d9ac297SAriel Elior };
2968d9ac297SAriel Elior 
2978d9ac297SAriel Elior /* Set Queue Filters */
2988d9ac297SAriel Elior struct vfpf_q_mac_vlan_filter {
2998d9ac297SAriel Elior 	u32 flags;
3008d9ac297SAriel Elior #define VFPF_Q_FILTER_DEST_MAC_VALID	0x01
3018d9ac297SAriel Elior #define VFPF_Q_FILTER_VLAN_TAG_VALID	0x02
302*05cc5a39SYuval Mintz #define VFPF_Q_FILTER_SET		0x100	/* set/clear */
3038d9ac297SAriel Elior 	u8  mac[ETH_ALEN];
3048d9ac297SAriel Elior 	u16 vlan_tag;
3058d9ac297SAriel Elior };
3068d9ac297SAriel Elior 
3078d9ac297SAriel Elior /* configure queue filters */
3088d9ac297SAriel Elior struct vfpf_set_q_filters_tlv {
3098d9ac297SAriel Elior 	struct vfpf_first_tlv first_tlv;
3108d9ac297SAriel Elior 
3118d9ac297SAriel Elior 	u32 flags;
3128d9ac297SAriel Elior #define VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED	0x01
3138d9ac297SAriel Elior #define VFPF_SET_Q_FILTERS_MULTICAST_CHANGED	0x02
3148d9ac297SAriel Elior #define VFPF_SET_Q_FILTERS_RX_MASK_CHANGED	0x04
3158d9ac297SAriel Elior 
3168d9ac297SAriel Elior 	u8 vf_qid;			/* index in hw_qid[] */
3178d9ac297SAriel Elior 	u8 n_mac_vlan_filters;
3188d9ac297SAriel Elior 	u8 n_multicast;
3198d9ac297SAriel Elior 	u8 padding;
3208d9ac297SAriel Elior 
3218d9ac297SAriel Elior #define PFVF_MAX_MAC_FILTERS                   16
3228d9ac297SAriel Elior #define PFVF_MAX_VLAN_FILTERS                  16
3238d9ac297SAriel Elior #define PFVF_MAX_FILTERS               (PFVF_MAX_MAC_FILTERS +\
3248d9ac297SAriel Elior 					 PFVF_MAX_VLAN_FILTERS)
3258d9ac297SAriel Elior 	struct vfpf_q_mac_vlan_filter filters[PFVF_MAX_FILTERS];
3268d9ac297SAriel Elior 
3278d9ac297SAriel Elior #define PFVF_MAX_MULTICAST_PER_VF              32
3288d9ac297SAriel Elior 	u8  multicast[PFVF_MAX_MULTICAST_PER_VF][ETH_ALEN];
3298d9ac297SAriel Elior 
3308d9ac297SAriel Elior 	u32 rx_mask;	/* see mask constants at the top of the file */
3318d9ac297SAriel Elior };
3328d9ac297SAriel Elior 
33314a94ebdSMichal Kalderon struct vfpf_tpa_tlv {
33414a94ebdSMichal Kalderon 	struct vfpf_first_tlv	first_tlv;
33514a94ebdSMichal Kalderon 
33614a94ebdSMichal Kalderon 	struct vf_pf_tpa_client_info {
33714a94ebdSMichal Kalderon 		aligned_u64 sge_addr[PFVF_MAX_QUEUES_PER_VF];
33814a94ebdSMichal Kalderon 		u8 update_ipv4;
33914a94ebdSMichal Kalderon 		u8 update_ipv6;
34014a94ebdSMichal Kalderon 		u8 max_tpa_queues;
34114a94ebdSMichal Kalderon 		u8 max_sges_for_packet;
34214a94ebdSMichal Kalderon 		u8 complete_on_both_clients;
34314a94ebdSMichal Kalderon 		u8 dont_verify_thr;
34414a94ebdSMichal Kalderon 		u8 tpa_mode;
34514a94ebdSMichal Kalderon 		u16 sge_buff_size;
34614a94ebdSMichal Kalderon 		u16 max_agg_size;
34714a94ebdSMichal Kalderon 		u16 sge_pause_thr_low;
34814a94ebdSMichal Kalderon 		u16 sge_pause_thr_high;
34914a94ebdSMichal Kalderon 	} tpa_client_info;
35014a94ebdSMichal Kalderon };
35114a94ebdSMichal Kalderon 
3529b176b6bSAriel Elior /* close VF (disable VF) */
3539b176b6bSAriel Elior struct vfpf_close_tlv {
3549b176b6bSAriel Elior 	struct vfpf_first_tlv   first_tlv;
3559b176b6bSAriel Elior 	u16			vf_id;  /* for debug */
3569b176b6bSAriel Elior 	u8 padding[2];
3579b176b6bSAriel Elior };
3589b176b6bSAriel Elior 
3594513f925SAriel Elior /* release the VF's acquired resources */
3604513f925SAriel Elior struct vfpf_release_tlv {
3614513f925SAriel Elior 	struct vfpf_first_tlv	first_tlv;
3624513f925SAriel Elior 	u16			vf_id;
3634513f925SAriel Elior 	u8 padding[2];
3644513f925SAriel Elior };
3654513f925SAriel Elior 
3661ab4434cSAriel Elior struct tlv_buffer_size {
3671ab4434cSAriel Elior 	u8 tlv_buffer[TLV_BUFFER_SIZE];
3681ab4434cSAriel Elior };
3691ab4434cSAriel Elior 
3701ab4434cSAriel Elior union vfpf_tlvs {
371be1f1ffaSAriel Elior 	struct vfpf_first_tlv		first_tlv;
372be1f1ffaSAriel Elior 	struct vfpf_acquire_tlv		acquire;
3738d9ac297SAriel Elior 	struct vfpf_init_tlv		init;
3749b176b6bSAriel Elior 	struct vfpf_close_tlv		close;
3759b176b6bSAriel Elior 	struct vfpf_q_op_tlv		q_op;
3768d9ac297SAriel Elior 	struct vfpf_setup_q_tlv		setup_q;
3778d9ac297SAriel Elior 	struct vfpf_set_q_filters_tlv	set_q_filters;
3784513f925SAriel Elior 	struct vfpf_release_tlv		release;
379b9871bcfSAriel Elior 	struct vfpf_rss_tlv		update_rss;
38014a94ebdSMichal Kalderon 	struct vfpf_tpa_tlv		update_tpa;
381be1f1ffaSAriel Elior 	struct channel_list_end_tlv	list_end;
3821ab4434cSAriel Elior 	struct tlv_buffer_size		tlv_buf_size;
3831ab4434cSAriel Elior };
3841ab4434cSAriel Elior 
3851ab4434cSAriel Elior union pfvf_tlvs {
3864513f925SAriel Elior 	struct pfvf_general_resp_tlv	general_resp;
387be1f1ffaSAriel Elior 	struct pfvf_acquire_resp_tlv	acquire_resp;
388be1f1ffaSAriel Elior 	struct channel_list_end_tlv	list_end;
3891ab4434cSAriel Elior 	struct tlv_buffer_size		tlv_buf_size;
3901ab4434cSAriel Elior };
391be1f1ffaSAriel Elior 
392abc5a021SAriel Elior /* This is a structure which is allocated in the VF, which the PF may update
393abc5a021SAriel Elior  * when it deems it necessary to do so. The bulletin board is sampled
394abc5a021SAriel Elior  * periodically by the VF. A copy per VF is maintained in the PF (to prevent
395abc5a021SAriel Elior  * loss of data upon multiple updates (or the need for read modify write)).
396abc5a021SAriel Elior  */
397abc5a021SAriel Elior struct pf_vf_bulletin_size {
398abc5a021SAriel Elior 	u8 size[PF_VF_BULLETIN_SIZE];
399abc5a021SAriel Elior };
400abc5a021SAriel Elior 
401abc5a021SAriel Elior struct pf_vf_bulletin_content {
402abc5a021SAriel Elior 	u32 crc;			/* crc of structure to ensure is not in
403abc5a021SAriel Elior 					 * mid-update
404abc5a021SAriel Elior 					 */
4054c133c39SAriel Elior 	u16 version;
4064c133c39SAriel Elior 	u16 length;
407abc5a021SAriel Elior 
408abc5a021SAriel Elior 	aligned_u64 valid_bitmap;	/* bitmap indicating which fields
409abc5a021SAriel Elior 					 * hold valid values
410abc5a021SAriel Elior 					 */
411abc5a021SAriel Elior 
412abc5a021SAriel Elior #define MAC_ADDR_VALID		0	/* alert the vf that a new mac address
413abc5a021SAriel Elior 					 * is available for it
414abc5a021SAriel Elior 					 */
4153ec9f9caSAriel Elior #define VLAN_VALID		1	/* when set, the vf should not access
4163ec9f9caSAriel Elior 					 * the vfpf channel
4173ec9f9caSAriel Elior 					 */
41878c3bcc5SAriel Elior #define CHANNEL_DOWN		2	/* vfpf channel is disabled. VFs are not
41978c3bcc5SAriel Elior 					 * to attempt to send messages on the
42078c3bcc5SAriel Elior 					 * channel after this bit is set
42178c3bcc5SAriel Elior 					 */
4226495d15aSDmitry Kravkov #define LINK_VALID		3	/* alert the VF thet a new link status
4236495d15aSDmitry Kravkov 					 * update is available for it
4246495d15aSDmitry Kravkov 					 */
425abc5a021SAriel Elior 	u8 mac[ETH_ALEN];
4263ec9f9caSAriel Elior 	u8 mac_padding[2];
4273ec9f9caSAriel Elior 
4283ec9f9caSAriel Elior 	u16 vlan;
4293ec9f9caSAriel Elior 	u8 vlan_padding[6];
4306495d15aSDmitry Kravkov 
4316495d15aSDmitry Kravkov 	u16 link_speed;			 /* Effective line speed */
4326495d15aSDmitry Kravkov 	u8 link_speed_padding[6];
4336495d15aSDmitry Kravkov 	u32 link_flags;			 /* VFPF_LINK_REPORT_XXX flags */
4346495d15aSDmitry Kravkov #define VFPF_LINK_REPORT_LINK_DOWN	 (1 << 0)
4356495d15aSDmitry Kravkov #define VFPF_LINK_REPORT_FULL_DUPLEX	 (1 << 1)
4366495d15aSDmitry Kravkov #define VFPF_LINK_REPORT_RX_FC_ON	 (1 << 2)
4376495d15aSDmitry Kravkov #define VFPF_LINK_REPORT_TX_FC_ON	 (1 << 3)
4386495d15aSDmitry Kravkov 	u8 link_flags_padding[4];
439abc5a021SAriel Elior };
440abc5a021SAriel Elior 
441abc5a021SAriel Elior union pf_vf_bulletin {
442abc5a021SAriel Elior 	struct pf_vf_bulletin_content content;
443abc5a021SAriel Elior 	struct pf_vf_bulletin_size size;
444abc5a021SAriel Elior };
445abc5a021SAriel Elior 
446be1f1ffaSAriel Elior #define MAX_TLVS_IN_LIST 50
447be1f1ffaSAriel Elior 
448be1f1ffaSAriel Elior enum channel_tlvs {
449be1f1ffaSAriel Elior 	CHANNEL_TLV_NONE,
450be1f1ffaSAriel Elior 	CHANNEL_TLV_ACQUIRE,
4518d9ac297SAriel Elior 	CHANNEL_TLV_INIT,
4528d9ac297SAriel Elior 	CHANNEL_TLV_SETUP_Q,
4538d9ac297SAriel Elior 	CHANNEL_TLV_SET_Q_FILTERS,
454b9871bcfSAriel Elior 	CHANNEL_TLV_ACTIVATE_Q,
455b9871bcfSAriel Elior 	CHANNEL_TLV_DEACTIVATE_Q,
4569b176b6bSAriel Elior 	CHANNEL_TLV_TEARDOWN_Q,
4579b176b6bSAriel Elior 	CHANNEL_TLV_CLOSE,
4584513f925SAriel Elior 	CHANNEL_TLV_RELEASE,
459b9871bcfSAriel Elior 	CHANNEL_TLV_UPDATE_RSS_DEPRECATED,
460f1929b01SAriel Elior 	CHANNEL_TLV_PF_RELEASE_VF,
461be1f1ffaSAriel Elior 	CHANNEL_TLV_LIST_END,
462d16132ceSAriel Elior 	CHANNEL_TLV_FLR,
463abc5a021SAriel Elior 	CHANNEL_TLV_PF_SET_MAC,
4643ec9f9caSAriel Elior 	CHANNEL_TLV_PF_SET_VLAN,
465b9871bcfSAriel Elior 	CHANNEL_TLV_UPDATE_RSS,
4663d7d562cSYuval Mintz 	CHANNEL_TLV_PHYS_PORT_ID,
46714a94ebdSMichal Kalderon 	CHANNEL_TLV_UPDATE_TPA,
46802dc4025SYuval Mintz 	CHANNEL_TLV_FP_HSI_SUPPORT,
469be1f1ffaSAriel Elior 	CHANNEL_TLV_MAX
470be1f1ffaSAriel Elior };
471be1f1ffaSAriel Elior 
4726411280aSAriel Elior #endif /* CONFIG_BNX2X_SRIOV */
4731ab4434cSAriel Elior #endif /* VF_PF_IF_H */
474