bnx2x_vfpf.h revision 4c133c39ae1bc541b3db5903a680da738a0c57e3
11ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior/* bnx2x_vfpf.h: Broadcom Everest network driver.
21ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior *
3247fa82be1301e4f89eaa5dc10be62a9cc84e8c5Yuval Mintz * Copyright (c) 2011-2013 Broadcom Corporation
41ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior *
51ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * Unless you and Broadcom execute a separate written software license
61ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * agreement governing use of this software, this software is licensed to you
71ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * under the terms of the GNU General Public License version 2, available
81ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL").
91ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior *
101ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * Notwithstanding the above, under no circumstances may you combine this
111ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * software in any way with any other Broadcom software provided under a
121ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * license other than the GPL, without Broadcom's express prior written
131ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * consent.
141ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior *
151ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * Maintained by: Eilon Greenstein <eilong@broadcom.com>
161ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * Written by: Ariel Elior <ariele@broadcom.com>
171ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior */
181ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior#ifndef VF_PF_IF_H
191ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior#define VF_PF_IF_H
201ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior
216411280ac94db94a09770807d3871d2661803604Ariel Elior#ifdef CONFIG_BNX2X_SRIOV
226411280ac94db94a09770807d3871d2661803604Ariel Elior
23be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* Common definitions for all HVs */
24be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct vf_pf_resc_request {
25be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8  num_rxqs;
26be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8  num_txqs;
27be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8  num_sbs;
28be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8  num_mac_filters;
29be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8  num_vlan_filters;
30be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8  num_mc_filters; /* No limit  so superfluous */
31be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
32be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
33be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct hw_sb_info {
34be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8 hw_sb_id;	/* aka absolute igu id, used to ack the sb */
35be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8 sb_qid;	/* used to update DHC for sb */
36be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
37be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
381ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior/* HW VF-PF channel definitions
391ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior * A.K.A VF-PF mailbox
401ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior */
411ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior#define TLV_BUFFER_SIZE			1024
42abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior#define PF_VF_BULLETIN_SIZE		512
431ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior
448d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_TPA		0x0001
458d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_TPA_IPV6		0x0002
468d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_TPA_GRO		0x0004
478d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_CACHE_ALIGN	0x0008
488d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_STATS		0x0010
498d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_OV		0x0020
508d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_VLAN		0x0040
518d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_COS		0x0080
528d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_HC		0x0100
538d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_FLG_DHC		0x0200
548d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
558d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_DROP_IP_CS_ERR	(1 << 0)
568d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_DROP_TCP_CS_ERR	(1 << 1)
578d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_DROP_TTL0		(1 << 2)
588d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_QUEUE_DROP_UDP_CS_ERR	(1 << 3)
598d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
60381ac16b10ae9369ebbbd74bb52b970818f68022Ariel Elior#define VFPF_RX_MASK_ACCEPT_NONE		0x00000000
61381ac16b10ae9369ebbbd74bb52b970818f68022Ariel Elior#define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST	0x00000001
62381ac16b10ae9369ebbbd74bb52b970818f68022Ariel Elior#define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST	0x00000002
63381ac16b10ae9369ebbbd74bb52b970818f68022Ariel Elior#define VFPF_RX_MASK_ACCEPT_ALL_UNICAST		0x00000004
64381ac16b10ae9369ebbbd74bb52b970818f68022Ariel Elior#define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST	0x00000008
65381ac16b10ae9369ebbbd74bb52b970818f68022Ariel Elior#define VFPF_RX_MASK_ACCEPT_BROADCAST		0x00000010
66abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior#define BULLETIN_CONTENT_SIZE		(sizeof(struct pf_vf_bulletin_content))
67abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior#define BULLETIN_ATTEMPTS	5 /* crc failures before throwing towel */
68abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior#define BULLETIN_CRC_SEED	0
69381ac16b10ae9369ebbbd74bb52b970818f68022Ariel Elior
70be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorenum {
71be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	PFVF_STATUS_WAITING = 0,
72be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	PFVF_STATUS_SUCCESS,
73be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	PFVF_STATUS_FAILURE,
74be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	PFVF_STATUS_NOT_SUPPORTED,
75be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	PFVF_STATUS_NO_RESOURCE
76be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
77be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
78be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* vf pf channel tlvs */
79be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* general tlv header (used for both vf->pf request and pf->vf response) */
80be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct channel_tlv {
81be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u16 type;
82be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u16 length;
83be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
84be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
85be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* header of first vf->pf tlv carries the offset used to calculate response
86be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior * buffer address
87be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior */
88be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct vfpf_first_tlv {
89be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct channel_tlv tl;
90be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u32 resp_msg_offset;
91be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
92be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
93be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* header of pf->vf tlvs, carries the status of handling the request */
94be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct pfvf_tlv {
95be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct channel_tlv tl;
96be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8 status;
97be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8 padding[3];
98be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
99be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
1004513f92576856c552212fb9608aca56b88022454Ariel Elior/* response tlv used for most tlvs */
1014513f92576856c552212fb9608aca56b88022454Ariel Eliorstruct pfvf_general_resp_tlv {
1024513f92576856c552212fb9608aca56b88022454Ariel Elior	struct pfvf_tlv hdr;
1034513f92576856c552212fb9608aca56b88022454Ariel Elior};
1044513f92576856c552212fb9608aca56b88022454Ariel Elior
105be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* used to terminate and pad a tlv list */
106be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct channel_list_end_tlv {
107be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct channel_tlv tl;
108be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	u8 padding[4];
109be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
110be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
111be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* Acquire */
112be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct vfpf_acquire_tlv {
113be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct vfpf_first_tlv first_tlv;
114be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
115be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct vf_pf_vfdev_info {
116be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		/* the following fields are for debug purposes */
117be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8  vf_id;		/* ME register value */
118be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8  vf_os;		/* e.g. Linux, W2K8 */
119be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8 padding[2];
120be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	} vfdev_info;
121be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
122be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct vf_pf_resc_request resc_request;
123be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
124be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	aligned_u64 bulletin_addr;
125be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
126be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
1279b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior/* simple operation request on queue */
1289b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Eliorstruct vfpf_q_op_tlv {
1299b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	struct vfpf_first_tlv	first_tlv;
1309b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	u8 vf_qid;
1319b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	u8 padding[3];
1329b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior};
1339b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior
134be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior/* acquire response tlv - carries the allocated resources */
135be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorstruct pfvf_acquire_resp_tlv {
136be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct pfvf_tlv hdr;
137be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct pf_vf_pfdev_info {
138be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u32 chip_num;
139be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u32 pf_cap;
140be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior#define PFVF_CAP_RSS		0x00000001
141be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior#define PFVF_CAP_DHC		0x00000002
142be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior#define PFVF_CAP_TPA		0x00000004
143be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		char fw_ver[32];
144be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u16 db_size;
145be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8  indices_per_sb;
146be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8  padding;
147be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	} pfdev_info;
148be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct pf_vf_resc {
149be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		/* in case of status NO_RESOURCE in message hdr, pf will fill
150be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		 * this struct with suggested amount of resources for next
151be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		 * acquire request
152be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		 */
153be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior#define PFVF_MAX_QUEUES_PER_VF         16
154be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior#define PFVF_MAX_SBS_PER_VF            16
155be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
156be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	hw_qid[PFVF_MAX_QUEUES_PER_VF];
157be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	num_rxqs;
158be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	num_txqs;
159be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	num_sbs;
160be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	num_mac_filters;
161be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	num_vlan_filters;
162be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	num_mc_filters;
163be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	permanent_mac_addr[ETH_ALEN];
164be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	current_mac_addr[ETH_ALEN];
165be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior		u8	padding[2];
166be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	} resc;
167be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
168be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
1698d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior/* Init VF */
1708d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Eliorstruct vfpf_init_tlv {
1718d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vfpf_first_tlv first_tlv;
1728d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	aligned_u64 sb_addr[PFVF_MAX_SBS_PER_VF]; /* vf_sb based */
1738d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	aligned_u64 spq_addr;
1748d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	aligned_u64 stats_addr;
1758d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior};
1768d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
1778d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior/* Setup Queue */
1788d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Eliorstruct vfpf_setup_q_tlv {
1798d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vfpf_first_tlv first_tlv;
1808d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
1818d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vf_pf_rxq_params {
1828d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		/* physical addresses */
1838d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		aligned_u64 rcq_addr;
1848d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		aligned_u64 rcq_np_addr;
1858d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		aligned_u64 rxq_addr;
1868d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		aligned_u64 sge_addr;
1878d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
1888d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		/* sb + hc info */
1898d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8  vf_sb;		/* index in hw_sbs[] */
1908d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8  sb_index;		/* Index in the SB */
1918d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 hc_rate;		/* desired interrupts per sec. */
1928d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior					/* valid iff VFPF_QUEUE_FLG_HC */
1938d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		/* rx buffer info */
1948d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 mtu;
1958d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 buf_sz;
1968d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 flags;		/* VFPF_QUEUE_FLG_X flags */
1978d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 stat_id;		/* valid iff VFPF_QUEUE_FLG_STATS */
1988d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
1998d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		/* valid iff VFPF_QUEUE_FLG_TPA */
2008d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 sge_buf_sz;
2018d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 tpa_agg_sz;
2028d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8 max_sge_pkt;
2038d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2048d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8 drop_flags;		/* VFPF_QUEUE_DROP_X, for Linux VMs
2058d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior					 * all the flags are turned off
2068d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior					 */
2078d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2088d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8 cache_line_log;	/* VFPF_QUEUE_FLG_CACHE_ALIGN */
2098d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8 padding;
2108d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	} rxq;
2118d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2128d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vf_pf_txq_params {
2138d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		/* physical addresses */
2148d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		aligned_u64 txq_addr;
2158d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2168d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		/* sb + hc info */
2178d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8  vf_sb;		/* index in hw_sbs[] */
2188d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8  sb_index;		/* Index in the SB */
2198d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 hc_rate;		/* desired interrupts per sec. */
2208d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior					/* valid iff VFPF_QUEUE_FLG_HC */
2218d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u32 flags;		/* VFPF_QUEUE_FLG_X flags */
2228d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u16 stat_id;		/* valid iff VFPF_QUEUE_FLG_STATS */
2238d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8  traffic_type;	/* see in setup_context() */
2248d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior		u8  padding;
2258d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	} txq;
2268d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2278d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8 vf_qid;			/* index in hw_qid[] */
2288d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8 param_valid;
2298d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_RXQ_VALID		0x01
2308d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_TXQ_VALID		0x02
2318d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8 padding[2];
2328d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior};
2338d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2348d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior/* Set Queue Filters */
2358d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Eliorstruct vfpf_q_mac_vlan_filter {
2368d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u32 flags;
2378d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_Q_FILTER_DEST_MAC_VALID	0x01
2388d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_Q_FILTER_VLAN_TAG_VALID	0x02
2398d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_Q_FILTER_SET_MAC		0x100	/* set/clear */
2408d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8  mac[ETH_ALEN];
2418d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u16 vlan_tag;
2428d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior};
2438d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2448d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior/* configure queue filters */
2458d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Eliorstruct vfpf_set_q_filters_tlv {
2468d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vfpf_first_tlv first_tlv;
2478d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2488d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u32 flags;
2498d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED	0x01
2508d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_SET_Q_FILTERS_MULTICAST_CHANGED	0x02
2518d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define VFPF_SET_Q_FILTERS_RX_MASK_CHANGED	0x04
2528d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2538d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8 vf_qid;			/* index in hw_qid[] */
2548d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8 n_mac_vlan_filters;
2558d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8 n_multicast;
2568d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8 padding;
2578d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2588d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define PFVF_MAX_MAC_FILTERS                   16
2598d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define PFVF_MAX_VLAN_FILTERS                  16
2608d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define PFVF_MAX_FILTERS               (PFVF_MAX_MAC_FILTERS +\
2618d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior					 PFVF_MAX_VLAN_FILTERS)
2628d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vfpf_q_mac_vlan_filter filters[PFVF_MAX_FILTERS];
2638d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2648d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior#define PFVF_MAX_MULTICAST_PER_VF              32
2658d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u8  multicast[PFVF_MAX_MULTICAST_PER_VF][ETH_ALEN];
2668d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2678d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	u32 rx_mask;	/* see mask constants at the top of the file */
2688d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior};
2698d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior
2709b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior/* close VF (disable VF) */
2719b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Eliorstruct vfpf_close_tlv {
2729b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	struct vfpf_first_tlv   first_tlv;
2739b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	u16			vf_id;  /* for debug */
2749b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	u8 padding[2];
2759b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior};
2769b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior
2774513f92576856c552212fb9608aca56b88022454Ariel Elior/* release the VF's acquired resources */
2784513f92576856c552212fb9608aca56b88022454Ariel Eliorstruct vfpf_release_tlv {
2794513f92576856c552212fb9608aca56b88022454Ariel Elior	struct vfpf_first_tlv	first_tlv;
2804513f92576856c552212fb9608aca56b88022454Ariel Elior	u16			vf_id;
2814513f92576856c552212fb9608aca56b88022454Ariel Elior	u8 padding[2];
2824513f92576856c552212fb9608aca56b88022454Ariel Elior};
2834513f92576856c552212fb9608aca56b88022454Ariel Elior
2841ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Eliorstruct tlv_buffer_size {
2851ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior	u8 tlv_buffer[TLV_BUFFER_SIZE];
2861ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior};
2871ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior
2881ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Eliorunion vfpf_tlvs {
289be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct vfpf_first_tlv		first_tlv;
290be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct vfpf_acquire_tlv		acquire;
2918d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vfpf_init_tlv		init;
2929b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	struct vfpf_close_tlv		close;
2939b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	struct vfpf_q_op_tlv		q_op;
2948d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vfpf_setup_q_tlv		setup_q;
2958d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	struct vfpf_set_q_filters_tlv	set_q_filters;
2964513f92576856c552212fb9608aca56b88022454Ariel Elior	struct vfpf_release_tlv         release;
297be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct channel_list_end_tlv     list_end;
2981ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior	struct tlv_buffer_size		tlv_buf_size;
2991ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior};
3001ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior
3011ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Eliorunion pfvf_tlvs {
3024513f92576856c552212fb9608aca56b88022454Ariel Elior	struct pfvf_general_resp_tlv    general_resp;
303be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct pfvf_acquire_resp_tlv	acquire_resp;
304be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	struct channel_list_end_tlv	list_end;
3051ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior	struct tlv_buffer_size		tlv_buf_size;
3061ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior};
307be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
308abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior/* This is a structure which is allocated in the VF, which the PF may update
309abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior * when it deems it necessary to do so. The bulletin board is sampled
310abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior * periodically by the VF. A copy per VF is maintained in the PF (to prevent
311abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior * loss of data upon multiple updates (or the need for read modify write)).
312abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior */
313abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Eliorstruct pf_vf_bulletin_size {
314abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	u8 size[PF_VF_BULLETIN_SIZE];
315abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior};
316abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior
317abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Eliorstruct pf_vf_bulletin_content {
318abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	u32 crc;			/* crc of structure to ensure is not in
319abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior					 * mid-update
320abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior					 */
3214c133c39ae1bc541b3db5903a680da738a0c57e3Ariel Elior	u16 version;
3224c133c39ae1bc541b3db5903a680da738a0c57e3Ariel Elior	u16 length;
323abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior
324abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	aligned_u64 valid_bitmap;	/* bitmap indicating which fields
325abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior					 * hold valid values
326abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior					 */
327abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior
328abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior#define MAC_ADDR_VALID		0	/* alert the vf that a new mac address
329abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior					 * is available for it
330abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior					 */
331abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior
332abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	u8 mac[ETH_ALEN];
333abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	u8 padding[2];
334abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior};
335abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior
336abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Eliorunion pf_vf_bulletin {
337abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	struct pf_vf_bulletin_content content;
338abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	struct pf_vf_bulletin_size size;
339abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior};
340abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior
341be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior#define MAX_TLVS_IN_LIST 50
342be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
343be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Eliorenum channel_tlvs {
344be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	CHANNEL_TLV_NONE,
345be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	CHANNEL_TLV_ACQUIRE,
3468d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	CHANNEL_TLV_INIT,
3478d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	CHANNEL_TLV_SETUP_Q,
3488d9ac297d18dbe05b6e7cb4378da51e67143b452Ariel Elior	CHANNEL_TLV_SET_Q_FILTERS,
3499b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	CHANNEL_TLV_TEARDOWN_Q,
3509b176b6b63ed07472c26b6833a0ac23b373e6bf8Ariel Elior	CHANNEL_TLV_CLOSE,
3514513f92576856c552212fb9608aca56b88022454Ariel Elior	CHANNEL_TLV_RELEASE,
352f1929b016c2161c364e45c21788aaae938ae557cAriel Elior	CHANNEL_TLV_PF_RELEASE_VF,
353be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	CHANNEL_TLV_LIST_END,
354d16132cef8a72ff7563aff95f03bf505779fe3e6Ariel Elior	CHANNEL_TLV_FLR,
355abc5a021ba645cd162205209bd5664a0d4b866a6Ariel Elior	CHANNEL_TLV_PF_SET_MAC,
356be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior	CHANNEL_TLV_MAX
357be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior};
358be1f1ffaf9acf06f556a00e2d1548c70af2b6deaAriel Elior
3596411280ac94db94a09770807d3871d2661803604Ariel Elior#endif /* CONFIG_BNX2X_SRIOV */
3601ab4434c64f8d4786e4a26299e0ebb138a0a6415Ariel Elior#endif /* VF_PF_IF_H */
361