18c2ecf20Sopenharmony_ci/* bnx2x_vfpf.h: Qlogic Everest network driver.
28c2ecf20Sopenharmony_ci *
38c2ecf20Sopenharmony_ci * Copyright (c) 2011-2013 Broadcom Corporation
48c2ecf20Sopenharmony_ci * Copyright (c) 2014 QLogic Corporation
58c2ecf20Sopenharmony_ci * All rights reserved
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Unless you and Qlogic execute a separate written software license
88c2ecf20Sopenharmony_ci * agreement governing use of this software, this software is licensed to you
98c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License version 2 (the “GPL”),
108c2ecf20Sopenharmony_ci * available at http://www.gnu.org/licenses/gpl-2.0.html, with the following
118c2ecf20Sopenharmony_ci * added to such license:
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci * As a special exception, the copyright holders of this software give you
148c2ecf20Sopenharmony_ci * permission to link this software with independent modules, and to copy and
158c2ecf20Sopenharmony_ci * distribute the resulting executable under terms of your choice, provided that
168c2ecf20Sopenharmony_ci * you also meet, for each linked independent module, the terms and conditions
178c2ecf20Sopenharmony_ci * of the license of that module.  An independent module is a module which is
188c2ecf20Sopenharmony_ci * not derived from this software.  The special exception does not apply to any
198c2ecf20Sopenharmony_ci * modifications of the software.
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci * Maintained by: Ariel Elior <ariel.elior@qlogic.com>
228c2ecf20Sopenharmony_ci * Written by: Ariel Elior <ariel.elior@qlogic.com>
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci#ifndef VF_PF_IF_H
258c2ecf20Sopenharmony_ci#define VF_PF_IF_H
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#ifdef CONFIG_BNX2X_SRIOV
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* Common definitions for all HVs */
308c2ecf20Sopenharmony_cistruct vf_pf_resc_request {
318c2ecf20Sopenharmony_ci	u8  num_rxqs;
328c2ecf20Sopenharmony_ci	u8  num_txqs;
338c2ecf20Sopenharmony_ci	u8  num_sbs;
348c2ecf20Sopenharmony_ci	u8  num_mac_filters;
358c2ecf20Sopenharmony_ci	u8  num_vlan_filters;
368c2ecf20Sopenharmony_ci	u8  num_mc_filters; /* No limit  so superfluous */
378c2ecf20Sopenharmony_ci};
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_cistruct hw_sb_info {
408c2ecf20Sopenharmony_ci	u8 hw_sb_id;	/* aka absolute igu id, used to ack the sb */
418c2ecf20Sopenharmony_ci	u8 sb_qid;	/* used to update DHC for sb */
428c2ecf20Sopenharmony_ci};
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* HW VF-PF channel definitions
458c2ecf20Sopenharmony_ci * A.K.A VF-PF mailbox
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_ci#define TLV_BUFFER_SIZE			1024
488c2ecf20Sopenharmony_ci#define PF_VF_BULLETIN_SIZE		512
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_TPA		0x0001
518c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_TPA_IPV6		0x0002
528c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_TPA_GRO		0x0004
538c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_CACHE_ALIGN	0x0008
548c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_STATS		0x0010
558c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_OV		0x0020
568c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_VLAN		0x0040
578c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_COS		0x0080
588c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_HC		0x0100
598c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_DHC		0x0200
608c2ecf20Sopenharmony_ci#define VFPF_QUEUE_FLG_LEADING_RSS	0x0400
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci#define VFPF_QUEUE_DROP_IP_CS_ERR	(1 << 0)
638c2ecf20Sopenharmony_ci#define VFPF_QUEUE_DROP_TCP_CS_ERR	(1 << 1)
648c2ecf20Sopenharmony_ci#define VFPF_QUEUE_DROP_TTL0		(1 << 2)
658c2ecf20Sopenharmony_ci#define VFPF_QUEUE_DROP_UDP_CS_ERR	(1 << 3)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci#define VFPF_RX_MASK_ACCEPT_NONE		0x00000000
688c2ecf20Sopenharmony_ci#define VFPF_RX_MASK_ACCEPT_MATCHED_UNICAST	0x00000001
698c2ecf20Sopenharmony_ci#define VFPF_RX_MASK_ACCEPT_MATCHED_MULTICAST	0x00000002
708c2ecf20Sopenharmony_ci#define VFPF_RX_MASK_ACCEPT_ALL_UNICAST		0x00000004
718c2ecf20Sopenharmony_ci#define VFPF_RX_MASK_ACCEPT_ALL_MULTICAST	0x00000008
728c2ecf20Sopenharmony_ci#define VFPF_RX_MASK_ACCEPT_BROADCAST		0x00000010
738c2ecf20Sopenharmony_ci#define VFPF_RX_MASK_ACCEPT_ANY_VLAN		0x00000020
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define BULLETIN_CONTENT_SIZE		(sizeof(struct pf_vf_bulletin_content))
768c2ecf20Sopenharmony_ci#define BULLETIN_CONTENT_LEGACY_SIZE	(32)
778c2ecf20Sopenharmony_ci#define BULLETIN_ATTEMPTS	5 /* crc failures before throwing towel */
788c2ecf20Sopenharmony_ci#define BULLETIN_CRC_SEED	0
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cienum {
818c2ecf20Sopenharmony_ci	PFVF_STATUS_WAITING = 0,
828c2ecf20Sopenharmony_ci	PFVF_STATUS_SUCCESS,
838c2ecf20Sopenharmony_ci	PFVF_STATUS_FAILURE,
848c2ecf20Sopenharmony_ci	PFVF_STATUS_NOT_SUPPORTED,
858c2ecf20Sopenharmony_ci	PFVF_STATUS_NO_RESOURCE
868c2ecf20Sopenharmony_ci};
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci/* vf pf channel tlvs */
898c2ecf20Sopenharmony_ci/* general tlv header (used for both vf->pf request and pf->vf response) */
908c2ecf20Sopenharmony_cistruct channel_tlv {
918c2ecf20Sopenharmony_ci	u16 type;
928c2ecf20Sopenharmony_ci	u16 length;
938c2ecf20Sopenharmony_ci};
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/* header of first vf->pf tlv carries the offset used to calculate response
968c2ecf20Sopenharmony_ci * buffer address
978c2ecf20Sopenharmony_ci */
988c2ecf20Sopenharmony_cistruct vfpf_first_tlv {
998c2ecf20Sopenharmony_ci	struct channel_tlv tl;
1008c2ecf20Sopenharmony_ci	u32 resp_msg_offset;
1018c2ecf20Sopenharmony_ci};
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci/* header of pf->vf tlvs, carries the status of handling the request */
1048c2ecf20Sopenharmony_cistruct pfvf_tlv {
1058c2ecf20Sopenharmony_ci	struct channel_tlv tl;
1068c2ecf20Sopenharmony_ci	u8 status;
1078c2ecf20Sopenharmony_ci	u8 padding[3];
1088c2ecf20Sopenharmony_ci};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* response tlv used for most tlvs */
1118c2ecf20Sopenharmony_cistruct pfvf_general_resp_tlv {
1128c2ecf20Sopenharmony_ci	struct pfvf_tlv hdr;
1138c2ecf20Sopenharmony_ci};
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/* used to terminate and pad a tlv list */
1168c2ecf20Sopenharmony_cistruct channel_list_end_tlv {
1178c2ecf20Sopenharmony_ci	struct channel_tlv tl;
1188c2ecf20Sopenharmony_ci	u8 padding[4];
1198c2ecf20Sopenharmony_ci};
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci/* Acquire */
1228c2ecf20Sopenharmony_cistruct vfpf_acquire_tlv {
1238c2ecf20Sopenharmony_ci	struct vfpf_first_tlv first_tlv;
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ci	struct vf_pf_vfdev_info {
1268c2ecf20Sopenharmony_ci		/* the following fields are for debug purposes */
1278c2ecf20Sopenharmony_ci		u8  vf_id;		/* ME register value */
1288c2ecf20Sopenharmony_ci		u8  vf_os;		/* e.g. Linux, W2K8 */
1298c2ecf20Sopenharmony_ci#define VF_OS_SUBVERSION_MASK	(0x1f)
1308c2ecf20Sopenharmony_ci#define VF_OS_MASK		(0xe0)
1318c2ecf20Sopenharmony_ci#define VF_OS_SHIFT		(5)
1328c2ecf20Sopenharmony_ci#define VF_OS_UNDEFINED		(0 << VF_OS_SHIFT)
1338c2ecf20Sopenharmony_ci#define VF_OS_WINDOWS		(1 << VF_OS_SHIFT)
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci		u8 fp_hsi_ver;
1368c2ecf20Sopenharmony_ci		u8 caps;
1378c2ecf20Sopenharmony_ci#define VF_CAP_SUPPORT_EXT_BULLETIN	(1 << 0)
1388c2ecf20Sopenharmony_ci#define VF_CAP_SUPPORT_VLAN_FILTER	(1 << 1)
1398c2ecf20Sopenharmony_ci	} vfdev_info;
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci	struct vf_pf_resc_request resc_request;
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci	aligned_u64 bulletin_addr;
1448c2ecf20Sopenharmony_ci};
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/* simple operation request on queue */
1478c2ecf20Sopenharmony_cistruct vfpf_q_op_tlv {
1488c2ecf20Sopenharmony_ci	struct vfpf_first_tlv	first_tlv;
1498c2ecf20Sopenharmony_ci	u8 vf_qid;
1508c2ecf20Sopenharmony_ci	u8 padding[3];
1518c2ecf20Sopenharmony_ci};
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/* receive side scaling tlv */
1548c2ecf20Sopenharmony_cistruct vfpf_rss_tlv {
1558c2ecf20Sopenharmony_ci	struct vfpf_first_tlv	first_tlv;
1568c2ecf20Sopenharmony_ci	u32			rss_flags;
1578c2ecf20Sopenharmony_ci#define VFPF_RSS_MODE_DISABLED	(1 << 0)
1588c2ecf20Sopenharmony_ci#define VFPF_RSS_MODE_REGULAR	(1 << 1)
1598c2ecf20Sopenharmony_ci#define VFPF_RSS_SET_SRCH	(1 << 2)
1608c2ecf20Sopenharmony_ci#define VFPF_RSS_IPV4		(1 << 3)
1618c2ecf20Sopenharmony_ci#define VFPF_RSS_IPV4_TCP	(1 << 4)
1628c2ecf20Sopenharmony_ci#define VFPF_RSS_IPV4_UDP	(1 << 5)
1638c2ecf20Sopenharmony_ci#define VFPF_RSS_IPV6		(1 << 6)
1648c2ecf20Sopenharmony_ci#define VFPF_RSS_IPV6_TCP	(1 << 7)
1658c2ecf20Sopenharmony_ci#define VFPF_RSS_IPV6_UDP	(1 << 8)
1668c2ecf20Sopenharmony_ci	u8			rss_result_mask;
1678c2ecf20Sopenharmony_ci	u8			ind_table_size;
1688c2ecf20Sopenharmony_ci	u8			rss_key_size;
1698c2ecf20Sopenharmony_ci	u8			padding;
1708c2ecf20Sopenharmony_ci	u8			ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
1718c2ecf20Sopenharmony_ci	u32			rss_key[T_ETH_RSS_KEY];	/* hash values */
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/* acquire response tlv - carries the allocated resources */
1758c2ecf20Sopenharmony_cistruct pfvf_acquire_resp_tlv {
1768c2ecf20Sopenharmony_ci	struct pfvf_tlv hdr;
1778c2ecf20Sopenharmony_ci	struct pf_vf_pfdev_info {
1788c2ecf20Sopenharmony_ci		u32 chip_num;
1798c2ecf20Sopenharmony_ci		u32 pf_cap;
1808c2ecf20Sopenharmony_ci#define PFVF_CAP_RSS          0x00000001
1818c2ecf20Sopenharmony_ci#define PFVF_CAP_DHC          0x00000002
1828c2ecf20Sopenharmony_ci#define PFVF_CAP_TPA          0x00000004
1838c2ecf20Sopenharmony_ci#define PFVF_CAP_TPA_UPDATE   0x00000008
1848c2ecf20Sopenharmony_ci#define PFVF_CAP_VLAN_FILTER  0x00000010
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci		char fw_ver[32];
1878c2ecf20Sopenharmony_ci		u16 db_size;
1888c2ecf20Sopenharmony_ci		u8  indices_per_sb;
1898c2ecf20Sopenharmony_ci		u8  padding;
1908c2ecf20Sopenharmony_ci	} pfdev_info;
1918c2ecf20Sopenharmony_ci	struct pf_vf_resc {
1928c2ecf20Sopenharmony_ci		/* in case of status NO_RESOURCE in message hdr, pf will fill
1938c2ecf20Sopenharmony_ci		 * this struct with suggested amount of resources for next
1948c2ecf20Sopenharmony_ci		 * acquire request
1958c2ecf20Sopenharmony_ci		 */
1968c2ecf20Sopenharmony_ci#define PFVF_MAX_QUEUES_PER_VF         16
1978c2ecf20Sopenharmony_ci#define PFVF_MAX_SBS_PER_VF            16
1988c2ecf20Sopenharmony_ci		struct hw_sb_info hw_sbs[PFVF_MAX_SBS_PER_VF];
1998c2ecf20Sopenharmony_ci		u8	hw_qid[PFVF_MAX_QUEUES_PER_VF];
2008c2ecf20Sopenharmony_ci		u8	num_rxqs;
2018c2ecf20Sopenharmony_ci		u8	num_txqs;
2028c2ecf20Sopenharmony_ci		u8	num_sbs;
2038c2ecf20Sopenharmony_ci		u8	num_mac_filters;
2048c2ecf20Sopenharmony_ci		u8	num_vlan_filters;
2058c2ecf20Sopenharmony_ci		u8	num_mc_filters;
2068c2ecf20Sopenharmony_ci		u8	permanent_mac_addr[ETH_ALEN];
2078c2ecf20Sopenharmony_ci		u8	current_mac_addr[ETH_ALEN];
2088c2ecf20Sopenharmony_ci		u8	padding[2];
2098c2ecf20Sopenharmony_ci	} resc;
2108c2ecf20Sopenharmony_ci};
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_cistruct vfpf_port_phys_id_resp_tlv {
2138c2ecf20Sopenharmony_ci	struct channel_tlv tl;
2148c2ecf20Sopenharmony_ci	u8 id[ETH_ALEN];
2158c2ecf20Sopenharmony_ci	u8 padding[2];
2168c2ecf20Sopenharmony_ci};
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_cistruct vfpf_fp_hsi_resp_tlv {
2198c2ecf20Sopenharmony_ci	struct channel_tlv tl;
2208c2ecf20Sopenharmony_ci	u8 is_supported;
2218c2ecf20Sopenharmony_ci	u8 padding[3];
2228c2ecf20Sopenharmony_ci};
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#define VFPF_INIT_FLG_STATS_COALESCE	(1 << 0) /* when set the VFs queues
2258c2ecf20Sopenharmony_ci						  * stats will be coalesced on
2268c2ecf20Sopenharmony_ci						  * the leading RSS queue
2278c2ecf20Sopenharmony_ci						  */
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci/* Init VF */
2308c2ecf20Sopenharmony_cistruct vfpf_init_tlv {
2318c2ecf20Sopenharmony_ci	struct vfpf_first_tlv first_tlv;
2328c2ecf20Sopenharmony_ci	aligned_u64 sb_addr[PFVF_MAX_SBS_PER_VF]; /* vf_sb based */
2338c2ecf20Sopenharmony_ci	aligned_u64 spq_addr;
2348c2ecf20Sopenharmony_ci	aligned_u64 stats_addr;
2358c2ecf20Sopenharmony_ci	u16 stats_stride;
2368c2ecf20Sopenharmony_ci	u32 flags;
2378c2ecf20Sopenharmony_ci	u32 padding[2];
2388c2ecf20Sopenharmony_ci};
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci/* Setup Queue */
2418c2ecf20Sopenharmony_cistruct vfpf_setup_q_tlv {
2428c2ecf20Sopenharmony_ci	struct vfpf_first_tlv first_tlv;
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci	struct vf_pf_rxq_params {
2458c2ecf20Sopenharmony_ci		/* physical addresses */
2468c2ecf20Sopenharmony_ci		aligned_u64 rcq_addr;
2478c2ecf20Sopenharmony_ci		aligned_u64 rcq_np_addr;
2488c2ecf20Sopenharmony_ci		aligned_u64 rxq_addr;
2498c2ecf20Sopenharmony_ci		aligned_u64 sge_addr;
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci		/* sb + hc info */
2528c2ecf20Sopenharmony_ci		u8  vf_sb;		/* index in hw_sbs[] */
2538c2ecf20Sopenharmony_ci		u8  sb_index;		/* Index in the SB */
2548c2ecf20Sopenharmony_ci		u16 hc_rate;		/* desired interrupts per sec. */
2558c2ecf20Sopenharmony_ci					/* valid iff VFPF_QUEUE_FLG_HC */
2568c2ecf20Sopenharmony_ci		/* rx buffer info */
2578c2ecf20Sopenharmony_ci		u16 mtu;
2588c2ecf20Sopenharmony_ci		u16 buf_sz;
2598c2ecf20Sopenharmony_ci		u16 flags;		/* VFPF_QUEUE_FLG_X flags */
2608c2ecf20Sopenharmony_ci		u16 stat_id;		/* valid iff VFPF_QUEUE_FLG_STATS */
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci		/* valid iff VFPF_QUEUE_FLG_TPA */
2638c2ecf20Sopenharmony_ci		u16 sge_buf_sz;
2648c2ecf20Sopenharmony_ci		u16 tpa_agg_sz;
2658c2ecf20Sopenharmony_ci		u8 max_sge_pkt;
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci		u8 drop_flags;		/* VFPF_QUEUE_DROP_X, for Linux VMs
2688c2ecf20Sopenharmony_ci					 * all the flags are turned off
2698c2ecf20Sopenharmony_ci					 */
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci		u8 cache_line_log;	/* VFPF_QUEUE_FLG_CACHE_ALIGN */
2728c2ecf20Sopenharmony_ci		u8 padding;
2738c2ecf20Sopenharmony_ci	} rxq;
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci	struct vf_pf_txq_params {
2768c2ecf20Sopenharmony_ci		/* physical addresses */
2778c2ecf20Sopenharmony_ci		aligned_u64 txq_addr;
2788c2ecf20Sopenharmony_ci
2798c2ecf20Sopenharmony_ci		/* sb + hc info */
2808c2ecf20Sopenharmony_ci		u8  vf_sb;		/* index in hw_sbs[] */
2818c2ecf20Sopenharmony_ci		u8  sb_index;		/* Index in the SB */
2828c2ecf20Sopenharmony_ci		u16 hc_rate;		/* desired interrupts per sec. */
2838c2ecf20Sopenharmony_ci					/* valid iff VFPF_QUEUE_FLG_HC */
2848c2ecf20Sopenharmony_ci		u32 flags;		/* VFPF_QUEUE_FLG_X flags */
2858c2ecf20Sopenharmony_ci		u16 stat_id;		/* valid iff VFPF_QUEUE_FLG_STATS */
2868c2ecf20Sopenharmony_ci		u8  traffic_type;	/* see in setup_context() */
2878c2ecf20Sopenharmony_ci		u8  padding;
2888c2ecf20Sopenharmony_ci	} txq;
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_ci	u8 vf_qid;			/* index in hw_qid[] */
2918c2ecf20Sopenharmony_ci	u8 param_valid;
2928c2ecf20Sopenharmony_ci#define VFPF_RXQ_VALID		0x01
2938c2ecf20Sopenharmony_ci#define VFPF_TXQ_VALID		0x02
2948c2ecf20Sopenharmony_ci	u8 padding[2];
2958c2ecf20Sopenharmony_ci};
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci/* Set Queue Filters */
2988c2ecf20Sopenharmony_cistruct vfpf_q_mac_vlan_filter {
2998c2ecf20Sopenharmony_ci	u32 flags;
3008c2ecf20Sopenharmony_ci#define VFPF_Q_FILTER_DEST_MAC_VALID	0x01
3018c2ecf20Sopenharmony_ci#define VFPF_Q_FILTER_VLAN_TAG_VALID	0x02
3028c2ecf20Sopenharmony_ci#define VFPF_Q_FILTER_SET		0x100	/* set/clear */
3038c2ecf20Sopenharmony_ci	u8  mac[ETH_ALEN];
3048c2ecf20Sopenharmony_ci	u16 vlan_tag;
3058c2ecf20Sopenharmony_ci};
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci/* configure queue filters */
3088c2ecf20Sopenharmony_cistruct vfpf_set_q_filters_tlv {
3098c2ecf20Sopenharmony_ci	struct vfpf_first_tlv first_tlv;
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	u32 flags;
3128c2ecf20Sopenharmony_ci#define VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED	0x01
3138c2ecf20Sopenharmony_ci#define VFPF_SET_Q_FILTERS_MULTICAST_CHANGED	0x02
3148c2ecf20Sopenharmony_ci#define VFPF_SET_Q_FILTERS_RX_MASK_CHANGED	0x04
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	u8 vf_qid;			/* index in hw_qid[] */
3178c2ecf20Sopenharmony_ci	u8 n_mac_vlan_filters;
3188c2ecf20Sopenharmony_ci	u8 n_multicast;
3198c2ecf20Sopenharmony_ci	u8 padding;
3208c2ecf20Sopenharmony_ci
3218c2ecf20Sopenharmony_ci#define PFVF_MAX_MAC_FILTERS                   16
3228c2ecf20Sopenharmony_ci#define PFVF_MAX_VLAN_FILTERS                  16
3238c2ecf20Sopenharmony_ci#define PFVF_MAX_FILTERS               (PFVF_MAX_MAC_FILTERS +\
3248c2ecf20Sopenharmony_ci					 PFVF_MAX_VLAN_FILTERS)
3258c2ecf20Sopenharmony_ci	struct vfpf_q_mac_vlan_filter filters[PFVF_MAX_FILTERS];
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci#define PFVF_MAX_MULTICAST_PER_VF              32
3288c2ecf20Sopenharmony_ci	u8  multicast[PFVF_MAX_MULTICAST_PER_VF][ETH_ALEN];
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci	u32 rx_mask;	/* see mask constants at the top of the file */
3318c2ecf20Sopenharmony_ci};
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_cistruct vfpf_tpa_tlv {
3348c2ecf20Sopenharmony_ci	struct vfpf_first_tlv	first_tlv;
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci	struct vf_pf_tpa_client_info {
3378c2ecf20Sopenharmony_ci		aligned_u64 sge_addr[PFVF_MAX_QUEUES_PER_VF];
3388c2ecf20Sopenharmony_ci		u8 update_ipv4;
3398c2ecf20Sopenharmony_ci		u8 update_ipv6;
3408c2ecf20Sopenharmony_ci		u8 max_tpa_queues;
3418c2ecf20Sopenharmony_ci		u8 max_sges_for_packet;
3428c2ecf20Sopenharmony_ci		u8 complete_on_both_clients;
3438c2ecf20Sopenharmony_ci		u8 dont_verify_thr;
3448c2ecf20Sopenharmony_ci		u8 tpa_mode;
3458c2ecf20Sopenharmony_ci		u16 sge_buff_size;
3468c2ecf20Sopenharmony_ci		u16 max_agg_size;
3478c2ecf20Sopenharmony_ci		u16 sge_pause_thr_low;
3488c2ecf20Sopenharmony_ci		u16 sge_pause_thr_high;
3498c2ecf20Sopenharmony_ci	} tpa_client_info;
3508c2ecf20Sopenharmony_ci};
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_ci/* close VF (disable VF) */
3538c2ecf20Sopenharmony_cistruct vfpf_close_tlv {
3548c2ecf20Sopenharmony_ci	struct vfpf_first_tlv   first_tlv;
3558c2ecf20Sopenharmony_ci	u16			vf_id;  /* for debug */
3568c2ecf20Sopenharmony_ci	u8 padding[2];
3578c2ecf20Sopenharmony_ci};
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_ci/* release the VF's acquired resources */
3608c2ecf20Sopenharmony_cistruct vfpf_release_tlv {
3618c2ecf20Sopenharmony_ci	struct vfpf_first_tlv	first_tlv;
3628c2ecf20Sopenharmony_ci	u16			vf_id;
3638c2ecf20Sopenharmony_ci	u8 padding[2];
3648c2ecf20Sopenharmony_ci};
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_cistruct tlv_buffer_size {
3678c2ecf20Sopenharmony_ci	u8 tlv_buffer[TLV_BUFFER_SIZE];
3688c2ecf20Sopenharmony_ci};
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ciunion vfpf_tlvs {
3718c2ecf20Sopenharmony_ci	struct vfpf_first_tlv		first_tlv;
3728c2ecf20Sopenharmony_ci	struct vfpf_acquire_tlv		acquire;
3738c2ecf20Sopenharmony_ci	struct vfpf_init_tlv		init;
3748c2ecf20Sopenharmony_ci	struct vfpf_close_tlv		close;
3758c2ecf20Sopenharmony_ci	struct vfpf_q_op_tlv		q_op;
3768c2ecf20Sopenharmony_ci	struct vfpf_setup_q_tlv		setup_q;
3778c2ecf20Sopenharmony_ci	struct vfpf_set_q_filters_tlv	set_q_filters;
3788c2ecf20Sopenharmony_ci	struct vfpf_release_tlv		release;
3798c2ecf20Sopenharmony_ci	struct vfpf_rss_tlv		update_rss;
3808c2ecf20Sopenharmony_ci	struct vfpf_tpa_tlv		update_tpa;
3818c2ecf20Sopenharmony_ci	struct channel_list_end_tlv	list_end;
3828c2ecf20Sopenharmony_ci	struct tlv_buffer_size		tlv_buf_size;
3838c2ecf20Sopenharmony_ci};
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ciunion pfvf_tlvs {
3868c2ecf20Sopenharmony_ci	struct pfvf_general_resp_tlv	general_resp;
3878c2ecf20Sopenharmony_ci	struct pfvf_acquire_resp_tlv	acquire_resp;
3888c2ecf20Sopenharmony_ci	struct channel_list_end_tlv	list_end;
3898c2ecf20Sopenharmony_ci	struct tlv_buffer_size		tlv_buf_size;
3908c2ecf20Sopenharmony_ci};
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_ci/* This is a structure which is allocated in the VF, which the PF may update
3938c2ecf20Sopenharmony_ci * when it deems it necessary to do so. The bulletin board is sampled
3948c2ecf20Sopenharmony_ci * periodically by the VF. A copy per VF is maintained in the PF (to prevent
3958c2ecf20Sopenharmony_ci * loss of data upon multiple updates (or the need for read modify write)).
3968c2ecf20Sopenharmony_ci */
3978c2ecf20Sopenharmony_cistruct pf_vf_bulletin_size {
3988c2ecf20Sopenharmony_ci	u8 size[PF_VF_BULLETIN_SIZE];
3998c2ecf20Sopenharmony_ci};
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_cistruct pf_vf_bulletin_content {
4028c2ecf20Sopenharmony_ci	u32 crc;			/* crc of structure to ensure is not in
4038c2ecf20Sopenharmony_ci					 * mid-update
4048c2ecf20Sopenharmony_ci					 */
4058c2ecf20Sopenharmony_ci	u16 version;
4068c2ecf20Sopenharmony_ci	u16 length;
4078c2ecf20Sopenharmony_ci
4088c2ecf20Sopenharmony_ci	aligned_u64 valid_bitmap;	/* bitmap indicating which fields
4098c2ecf20Sopenharmony_ci					 * hold valid values
4108c2ecf20Sopenharmony_ci					 */
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_ci#define MAC_ADDR_VALID		0	/* alert the vf that a new mac address
4138c2ecf20Sopenharmony_ci					 * is available for it
4148c2ecf20Sopenharmony_ci					 */
4158c2ecf20Sopenharmony_ci#define VLAN_VALID		1	/* when set, the vf should not access
4168c2ecf20Sopenharmony_ci					 * the vfpf channel
4178c2ecf20Sopenharmony_ci					 */
4188c2ecf20Sopenharmony_ci#define CHANNEL_DOWN		2	/* vfpf channel is disabled. VFs are not
4198c2ecf20Sopenharmony_ci					 * to attempt to send messages on the
4208c2ecf20Sopenharmony_ci					 * channel after this bit is set
4218c2ecf20Sopenharmony_ci					 */
4228c2ecf20Sopenharmony_ci#define LINK_VALID		3	/* alert the VF thet a new link status
4238c2ecf20Sopenharmony_ci					 * update is available for it
4248c2ecf20Sopenharmony_ci					 */
4258c2ecf20Sopenharmony_ci	u8 mac[ETH_ALEN];
4268c2ecf20Sopenharmony_ci	u8 mac_padding[2];
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ci	u16 vlan;
4298c2ecf20Sopenharmony_ci	u8 vlan_padding[6];
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci	u16 link_speed;			 /* Effective line speed */
4328c2ecf20Sopenharmony_ci	u8 link_speed_padding[6];
4338c2ecf20Sopenharmony_ci	u32 link_flags;			 /* VFPF_LINK_REPORT_XXX flags */
4348c2ecf20Sopenharmony_ci#define VFPF_LINK_REPORT_LINK_DOWN	 (1 << 0)
4358c2ecf20Sopenharmony_ci#define VFPF_LINK_REPORT_FULL_DUPLEX	 (1 << 1)
4368c2ecf20Sopenharmony_ci#define VFPF_LINK_REPORT_RX_FC_ON	 (1 << 2)
4378c2ecf20Sopenharmony_ci#define VFPF_LINK_REPORT_TX_FC_ON	 (1 << 3)
4388c2ecf20Sopenharmony_ci	u8 link_flags_padding[4];
4398c2ecf20Sopenharmony_ci};
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ciunion pf_vf_bulletin {
4428c2ecf20Sopenharmony_ci	struct pf_vf_bulletin_content content;
4438c2ecf20Sopenharmony_ci	struct pf_vf_bulletin_size size;
4448c2ecf20Sopenharmony_ci};
4458c2ecf20Sopenharmony_ci
4468c2ecf20Sopenharmony_ci#define MAX_TLVS_IN_LIST 50
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_cienum channel_tlvs {
4498c2ecf20Sopenharmony_ci	CHANNEL_TLV_NONE,
4508c2ecf20Sopenharmony_ci	CHANNEL_TLV_ACQUIRE,
4518c2ecf20Sopenharmony_ci	CHANNEL_TLV_INIT,
4528c2ecf20Sopenharmony_ci	CHANNEL_TLV_SETUP_Q,
4538c2ecf20Sopenharmony_ci	CHANNEL_TLV_SET_Q_FILTERS,
4548c2ecf20Sopenharmony_ci	CHANNEL_TLV_ACTIVATE_Q,
4558c2ecf20Sopenharmony_ci	CHANNEL_TLV_DEACTIVATE_Q,
4568c2ecf20Sopenharmony_ci	CHANNEL_TLV_TEARDOWN_Q,
4578c2ecf20Sopenharmony_ci	CHANNEL_TLV_CLOSE,
4588c2ecf20Sopenharmony_ci	CHANNEL_TLV_RELEASE,
4598c2ecf20Sopenharmony_ci	CHANNEL_TLV_UPDATE_RSS_DEPRECATED,
4608c2ecf20Sopenharmony_ci	CHANNEL_TLV_PF_RELEASE_VF,
4618c2ecf20Sopenharmony_ci	CHANNEL_TLV_LIST_END,
4628c2ecf20Sopenharmony_ci	CHANNEL_TLV_FLR,
4638c2ecf20Sopenharmony_ci	CHANNEL_TLV_PF_SET_MAC,
4648c2ecf20Sopenharmony_ci	CHANNEL_TLV_PF_SET_VLAN,
4658c2ecf20Sopenharmony_ci	CHANNEL_TLV_UPDATE_RSS,
4668c2ecf20Sopenharmony_ci	CHANNEL_TLV_PHYS_PORT_ID,
4678c2ecf20Sopenharmony_ci	CHANNEL_TLV_UPDATE_TPA,
4688c2ecf20Sopenharmony_ci	CHANNEL_TLV_FP_HSI_SUPPORT,
4698c2ecf20Sopenharmony_ci	CHANNEL_TLV_MAX
4708c2ecf20Sopenharmony_ci};
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci#endif /* CONFIG_BNX2X_SRIOV */
4738c2ecf20Sopenharmony_ci#endif /* VF_PF_IF_H */
474