xref: /freebsd/sys/dev/oce/oce_hw.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
12f345d8eSLuigi Rizzo /*-
2*7282444bSPedro F. Giffuni  * SPDX-License-Identifier: BSD-3-Clause
3*7282444bSPedro F. Giffuni  *
4291a1934SXin LI  * Copyright (C) 2013 Emulex
52f345d8eSLuigi Rizzo  * All rights reserved.
62f345d8eSLuigi Rizzo  *
72f345d8eSLuigi Rizzo  * Redistribution and use in source and binary forms, with or without
82f345d8eSLuigi Rizzo  * modification, are permitted provided that the following conditions are met:
92f345d8eSLuigi Rizzo  *
102f345d8eSLuigi Rizzo  * 1. Redistributions of source code must retain the above copyright notice,
112f345d8eSLuigi Rizzo  *    this list of conditions and the following disclaimer.
122f345d8eSLuigi Rizzo  *
132f345d8eSLuigi Rizzo  * 2. Redistributions in binary form must reproduce the above copyright
142f345d8eSLuigi Rizzo  *    notice, this list of conditions and the following disclaimer in the
152f345d8eSLuigi Rizzo  *    documentation and/or other materials provided with the distribution.
162f345d8eSLuigi Rizzo  *
172f345d8eSLuigi Rizzo  * 3. Neither the name of the Emulex Corporation nor the names of its
182f345d8eSLuigi Rizzo  *    contributors may be used to endorse or promote products derived from
192f345d8eSLuigi Rizzo  *    this software without specific prior written permission.
202f345d8eSLuigi Rizzo  *
212f345d8eSLuigi Rizzo  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
222f345d8eSLuigi Rizzo  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
232f345d8eSLuigi Rizzo  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
242f345d8eSLuigi Rizzo  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
252f345d8eSLuigi Rizzo  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
262f345d8eSLuigi Rizzo  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
272f345d8eSLuigi Rizzo  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
282f345d8eSLuigi Rizzo  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
292f345d8eSLuigi Rizzo  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
302f345d8eSLuigi Rizzo  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
312f345d8eSLuigi Rizzo  * POSSIBILITY OF SUCH DAMAGE.
322f345d8eSLuigi Rizzo  *
332f345d8eSLuigi Rizzo  * Contact Information:
342f345d8eSLuigi Rizzo  * freebsd-drivers@emulex.com
352f345d8eSLuigi Rizzo  *
362f345d8eSLuigi Rizzo  * Emulex
372f345d8eSLuigi Rizzo  * 3333 Susan Street
382f345d8eSLuigi Rizzo  * Costa Mesa, CA 92626
392f345d8eSLuigi Rizzo  */
402f345d8eSLuigi Rizzo 
412f345d8eSLuigi Rizzo 
422f345d8eSLuigi Rizzo #include <sys/types.h>
432f345d8eSLuigi Rizzo 
442f345d8eSLuigi Rizzo #undef _BIG_ENDIAN /* TODO */
452f345d8eSLuigi Rizzo #pragma pack(1)
462f345d8eSLuigi Rizzo 
472f345d8eSLuigi Rizzo #define	OC_CNA_GEN2			0x2
482f345d8eSLuigi Rizzo #define	OC_CNA_GEN3			0x3
492f345d8eSLuigi Rizzo #define	DEVID_TIGERSHARK		0x700
502f345d8eSLuigi Rizzo #define	DEVID_TOMCAT			0x710
512f345d8eSLuigi Rizzo 
522f345d8eSLuigi Rizzo /* PCI CSR offsets */
532f345d8eSLuigi Rizzo #define	PCICFG_F1_CSR			0x0	/* F1 for NIC */
542f345d8eSLuigi Rizzo #define	PCICFG_SEMAPHORE		0xbc
552f345d8eSLuigi Rizzo #define	PCICFG_SOFT_RESET		0x5c
562f345d8eSLuigi Rizzo #define	PCICFG_UE_STATUS_HI_MASK	0xac
572f345d8eSLuigi Rizzo #define	PCICFG_UE_STATUS_LO_MASK	0xa8
582f345d8eSLuigi Rizzo #define	PCICFG_ONLINE0			0xb0
592f345d8eSLuigi Rizzo #define	PCICFG_ONLINE1			0xb4
602f345d8eSLuigi Rizzo #define	INTR_EN				0x20000000
612f345d8eSLuigi Rizzo #define	IMAGE_TRANSFER_SIZE		(32 * 1024)	/* 32K at a time */
622f345d8eSLuigi Rizzo 
635fbb6830SXin LI /********* UE Status and Mask Registers ***/
645fbb6830SXin LI #define PCICFG_UE_STATUS_LOW                    0xA0
655fbb6830SXin LI #define PCICFG_UE_STATUS_HIGH                   0xA4
665fbb6830SXin LI #define PCICFG_UE_STATUS_LOW_MASK               0xA8
675fbb6830SXin LI 
685fbb6830SXin LI /* Lancer SLIPORT registers */
695fbb6830SXin LI #define SLIPORT_STATUS_OFFSET           0x404
705fbb6830SXin LI #define SLIPORT_CONTROL_OFFSET          0x408
715fbb6830SXin LI #define SLIPORT_ERROR1_OFFSET           0x40C
725fbb6830SXin LI #define SLIPORT_ERROR2_OFFSET           0x410
735fbb6830SXin LI #define PHYSDEV_CONTROL_OFFSET          0x414
745fbb6830SXin LI 
755fbb6830SXin LI #define SLIPORT_STATUS_ERR_MASK         0x80000000
765fbb6830SXin LI #define SLIPORT_STATUS_DIP_MASK         0x02000000
775fbb6830SXin LI #define SLIPORT_STATUS_RN_MASK          0x01000000
785fbb6830SXin LI #define SLIPORT_STATUS_RDY_MASK         0x00800000
795fbb6830SXin LI #define SLI_PORT_CONTROL_IP_MASK        0x08000000
805fbb6830SXin LI #define PHYSDEV_CONTROL_FW_RESET_MASK   0x00000002
815fbb6830SXin LI #define PHYSDEV_CONTROL_DD_MASK         0x00000004
825fbb6830SXin LI #define PHYSDEV_CONTROL_INP_MASK        0x40000000
835fbb6830SXin LI 
845fbb6830SXin LI #define SLIPORT_ERROR_NO_RESOURCE1      0x2
855fbb6830SXin LI #define SLIPORT_ERROR_NO_RESOURCE2      0x9
862f345d8eSLuigi Rizzo /* CSR register offsets */
872f345d8eSLuigi Rizzo #define	MPU_EP_CONTROL			0
882f345d8eSLuigi Rizzo #define	MPU_EP_SEMAPHORE_BE3		0xac
892f345d8eSLuigi Rizzo #define	MPU_EP_SEMAPHORE_XE201		0x400
90291a1934SXin LI #define	MPU_EP_SEMAPHORE_SH		0x94
912f345d8eSLuigi Rizzo #define	PCICFG_INTR_CTRL		0xfc
922f345d8eSLuigi Rizzo #define	HOSTINTR_MASK			(1 << 29)
932f345d8eSLuigi Rizzo #define	HOSTINTR_PFUNC_SHIFT		26
942f345d8eSLuigi Rizzo #define	HOSTINTR_PFUNC_MASK		7
952f345d8eSLuigi Rizzo 
962f345d8eSLuigi Rizzo /* POST status reg struct */
972f345d8eSLuigi Rizzo #define	POST_STAGE_POWER_ON_RESET	0x00
982f345d8eSLuigi Rizzo #define	POST_STAGE_AWAITING_HOST_RDY	0x01
992f345d8eSLuigi Rizzo #define	POST_STAGE_HOST_RDY		0x02
1002f345d8eSLuigi Rizzo #define	POST_STAGE_CHIP_RESET		0x03
1012f345d8eSLuigi Rizzo #define	POST_STAGE_ARMFW_READY		0xc000
1022f345d8eSLuigi Rizzo #define	POST_STAGE_ARMFW_UE		0xf000
1032f345d8eSLuigi Rizzo 
1042f345d8eSLuigi Rizzo /* DOORBELL registers */
1052f345d8eSLuigi Rizzo #define	PD_RXULP_DB			0x0100
1062f345d8eSLuigi Rizzo #define	PD_TXULP_DB			0x0060
1072f345d8eSLuigi Rizzo #define	DB_RQ_ID_MASK			0x3FF
1082f345d8eSLuigi Rizzo 
1092f345d8eSLuigi Rizzo #define	PD_CQ_DB			0x0120
1102f345d8eSLuigi Rizzo #define	PD_EQ_DB			PD_CQ_DB
1112f345d8eSLuigi Rizzo #define	PD_MPU_MBOX_DB			0x0160
1122f345d8eSLuigi Rizzo #define	PD_MQ_DB			0x0140
1132f345d8eSLuigi Rizzo 
114c2625e6eSJosh Paetzel #define DB_OFFSET			0xc0
115c2625e6eSJosh Paetzel #define DB_LRO_RQ_ID_MASK		0x7FF
116c2625e6eSJosh Paetzel 
1172f345d8eSLuigi Rizzo /* EQE completion types */
1182f345d8eSLuigi Rizzo #define	EQ_MINOR_CODE_COMPLETION 	0x00
1192f345d8eSLuigi Rizzo #define	EQ_MINOR_CODE_OTHER		0x01
1202f345d8eSLuigi Rizzo #define	EQ_MAJOR_CODE_COMPLETION 	0x00
1212f345d8eSLuigi Rizzo 
1222f345d8eSLuigi Rizzo /* Link Status field values */
1232f345d8eSLuigi Rizzo #define	PHY_LINK_FAULT_NONE		0x0
1242f345d8eSLuigi Rizzo #define	PHY_LINK_FAULT_LOCAL		0x01
1252f345d8eSLuigi Rizzo #define	PHY_LINK_FAULT_REMOTE		0x02
1262f345d8eSLuigi Rizzo 
1272f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_ZERO		0x0	/* No link */
1282f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_10MBPS		0x1	/* (10 Mbps) */
1292f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_100MBPS		0x2	/* (100 Mbps) */
1302f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_1GBPS		0x3	/* (1 Gbps) */
1312f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_10GBPS		0x4	/* (10 Gbps) */
1322f345d8eSLuigi Rizzo 
1332f345d8eSLuigi Rizzo #define	PHY_LINK_DUPLEX_NONE		0x0
1342f345d8eSLuigi Rizzo #define	PHY_LINK_DUPLEX_HALF		0x1
1352f345d8eSLuigi Rizzo #define	PHY_LINK_DUPLEX_FULL		0x2
1362f345d8eSLuigi Rizzo 
1372f345d8eSLuigi Rizzo #define	NTWK_PORT_A			0x0	/* (Port A) */
1382f345d8eSLuigi Rizzo #define	NTWK_PORT_B			0x1	/* (Port B) */
1392f345d8eSLuigi Rizzo 
1402f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_ZERO			0x0	/* (No link.) */
1412f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_10MBPS		0x1	/* (10 Mbps) */
1422f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_100MBPS		0x2	/* (100 Mbps) */
1432f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_1GBPS		0x3	/* (1 Gbps) */
1442f345d8eSLuigi Rizzo #define	PHY_LINK_SPEED_10GBPS		0x4	/* (10 Gbps) */
1452f345d8eSLuigi Rizzo 
1462f345d8eSLuigi Rizzo /* Hardware Address types */
1472f345d8eSLuigi Rizzo #define	MAC_ADDRESS_TYPE_STORAGE	0x0	/* (Storage MAC Address) */
1482f345d8eSLuigi Rizzo #define	MAC_ADDRESS_TYPE_NETWORK	0x1	/* (Network MAC Address) */
1492f345d8eSLuigi Rizzo #define	MAC_ADDRESS_TYPE_PD		0x2	/* (Protection Domain MAC Addr) */
1502f345d8eSLuigi Rizzo #define	MAC_ADDRESS_TYPE_MANAGEMENT	0x3	/* (Management MAC Address) */
1512f345d8eSLuigi Rizzo #define	MAC_ADDRESS_TYPE_FCOE		0x4	/* (FCoE MAC Address) */
1522f345d8eSLuigi Rizzo 
1532f345d8eSLuigi Rizzo /* CREATE_IFACE capability and cap_en flags */
1542f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_RSS		0x4
1552f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_PROMISCUOUS	0x8
1562f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_BROADCAST	0x10
1572f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_UNTAGGED	0x20
1582f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_VLAN_PROMISCUOUS	0x80
1592f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_VLAN		0x100
1602f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_MCAST_PROMISCUOUS	0x200
1612f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_PASS_L2_ERR	0x400
1622f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_PASS_L3L4_ERR	0x800
1632f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_MULTICAST	0x1000
1642f345d8eSLuigi Rizzo #define MBX_RX_IFACE_RX_FILTER_IF_MULTICAST_HASH 0x2000
1652f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_HDS		0x4000
1662f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_DIRECTED	0x8000
1672f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_VMQ		0x10000
1682f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_NETQ		0x20000
1692f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_QGROUPS	0x40000
1702f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_LSO		0x80000
1712f345d8eSLuigi Rizzo #define MBX_RX_IFACE_FLAGS_LRO		0x100000
1722f345d8eSLuigi Rizzo 
1732f345d8eSLuigi Rizzo #define	MQ_RING_CONTEXT_SIZE_16		0x5	/* (16 entries) */
1742f345d8eSLuigi Rizzo #define	MQ_RING_CONTEXT_SIZE_32		0x6	/* (32 entries) */
1752f345d8eSLuigi Rizzo #define	MQ_RING_CONTEXT_SIZE_64		0x7	/* (64 entries) */
1762f345d8eSLuigi Rizzo #define	MQ_RING_CONTEXT_SIZE_128	0x8	/* (128 entries) */
1772f345d8eSLuigi Rizzo 
1782f345d8eSLuigi Rizzo #define	MBX_DB_READY_BIT		0x1
1792f345d8eSLuigi Rizzo #define	MBX_DB_HI_BIT			0x2
1802f345d8eSLuigi Rizzo #define	ASYNC_EVENT_CODE_LINK_STATE	0x1
1812f345d8eSLuigi Rizzo #define	ASYNC_EVENT_LINK_UP		0x1
1822f345d8eSLuigi Rizzo #define	ASYNC_EVENT_LINK_DOWN		0x0
1839bd3250aSLuigi Rizzo #define ASYNC_EVENT_GRP5		0x5
184cdaba892SXin LI #define ASYNC_EVENT_CODE_DEBUG		0x6
1859bd3250aSLuigi Rizzo #define ASYNC_EVENT_PVID_STATE		0x3
186c2625e6eSJosh Paetzel #define ASYNC_EVENT_OS2BMC		0x5
187cdaba892SXin LI #define ASYNC_EVENT_DEBUG_QNQ		0x1
188cdaba892SXin LI #define ASYNC_EVENT_CODE_SLIPORT	0x11
1899bd3250aSLuigi Rizzo #define VLAN_VID_MASK			0x0FFF
1902f345d8eSLuigi Rizzo 
1912f345d8eSLuigi Rizzo /* port link_status */
1922f345d8eSLuigi Rizzo #define	ASYNC_EVENT_LOGICAL		0x02
1932f345d8eSLuigi Rizzo 
1942f345d8eSLuigi Rizzo /* Logical Link Status */
1952f345d8eSLuigi Rizzo #define	NTWK_LOGICAL_LINK_DOWN		0
1962f345d8eSLuigi Rizzo #define	NTWK_LOGICAL_LINK_UP		1
1972f345d8eSLuigi Rizzo 
1982f345d8eSLuigi Rizzo /* Rx filter bits */
1992f345d8eSLuigi Rizzo #define	NTWK_RX_FILTER_IP_CKSUM 	0x1
2002f345d8eSLuigi Rizzo #define	NTWK_RX_FILTER_TCP_CKSUM	0x2
2012f345d8eSLuigi Rizzo #define	NTWK_RX_FILTER_UDP_CKSUM	0x4
2022f345d8eSLuigi Rizzo #define	NTWK_RX_FILTER_STRIP_CRC	0x8
2032f345d8eSLuigi Rizzo 
2042f345d8eSLuigi Rizzo /* max SGE per mbx */
2052f345d8eSLuigi Rizzo #define	MAX_MBX_SGE			19
2062f345d8eSLuigi Rizzo 
2072f345d8eSLuigi Rizzo /* Max multicast filter size*/
2082f345d8eSLuigi Rizzo #define OCE_MAX_MC_FILTER_SIZE		64
2092f345d8eSLuigi Rizzo 
2102f345d8eSLuigi Rizzo /* PCI SLI (Service Level Interface) capabilities register */
2112f345d8eSLuigi Rizzo #define OCE_INTF_REG_OFFSET		0x58
2122f345d8eSLuigi Rizzo #define OCE_INTF_VALID_SIG		6	/* register's signature */
2132f345d8eSLuigi Rizzo #define OCE_INTF_FUNC_RESET_REQD	1
2142f345d8eSLuigi Rizzo #define OCE_INTF_HINT1_NOHINT		0
2152f345d8eSLuigi Rizzo #define OCE_INTF_HINT1_SEMAINIT		1
2162f345d8eSLuigi Rizzo #define OCE_INTF_HINT1_STATCTRL		2
2172f345d8eSLuigi Rizzo #define OCE_INTF_IF_TYPE_0		0
2182f345d8eSLuigi Rizzo #define OCE_INTF_IF_TYPE_1		1
2192f345d8eSLuigi Rizzo #define OCE_INTF_IF_TYPE_2		2
2202f345d8eSLuigi Rizzo #define OCE_INTF_IF_TYPE_3		3
2212f345d8eSLuigi Rizzo #define OCE_INTF_SLI_REV3		3	/* not supported by driver */
2222f345d8eSLuigi Rizzo #define OCE_INTF_SLI_REV4		4	/* driver supports SLI-4 */
2232f345d8eSLuigi Rizzo #define OCE_INTF_PHYS_FUNC		0
2242f345d8eSLuigi Rizzo #define OCE_INTF_VIRT_FUNC		1
2252f345d8eSLuigi Rizzo #define OCE_INTF_FAMILY_BE2		0	/* not supported by driver */
2262f345d8eSLuigi Rizzo #define OCE_INTF_FAMILY_BE3		1	/* driver supports BE3 */
2272f345d8eSLuigi Rizzo #define OCE_INTF_FAMILY_A0_CHIP		0xA	/* Lancer A0 chip (supported) */
2282f345d8eSLuigi Rizzo #define OCE_INTF_FAMILY_B0_CHIP		0xB	/* Lancer B0 chip (future) */
2292f345d8eSLuigi Rizzo 
2302f345d8eSLuigi Rizzo #define	NIC_WQE_SIZE	16
2312f345d8eSLuigi Rizzo #define	NIC_UNICAST	0x00
2322f345d8eSLuigi Rizzo #define	NIC_MULTICAST	0x01
2332f345d8eSLuigi Rizzo #define	NIC_BROADCAST	0x02
2342f345d8eSLuigi Rizzo 
2352f345d8eSLuigi Rizzo #define	NIC_HDS_NO_SPLIT	0x00
2362f345d8eSLuigi Rizzo #define	NIC_HDS_SPLIT_L3PL	0x01
2372f345d8eSLuigi Rizzo #define	NIC_HDS_SPLIT_L4PL	0x02
2382f345d8eSLuigi Rizzo 
2392f345d8eSLuigi Rizzo #define	NIC_WQ_TYPE_FORWARDING		0x01
2402f345d8eSLuigi Rizzo #define	NIC_WQ_TYPE_STANDARD		0x02
2412f345d8eSLuigi Rizzo #define	NIC_WQ_TYPE_LOW_LATENCY		0x04
2422f345d8eSLuigi Rizzo 
2432f345d8eSLuigi Rizzo #define OCE_RESET_STATS		1
2442f345d8eSLuigi Rizzo #define OCE_RETAIN_STATS	0
2452f345d8eSLuigi Rizzo #define OCE_TXP_SW_SZ		48
2462f345d8eSLuigi Rizzo 
2472f345d8eSLuigi Rizzo typedef union pci_sli_intf_u {
2482f345d8eSLuigi Rizzo 	uint32_t dw0;
2492f345d8eSLuigi Rizzo 	struct {
2502f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
2512f345d8eSLuigi Rizzo 		uint32_t sli_valid:3;
2522f345d8eSLuigi Rizzo 		uint32_t sli_hint2:5;
2532f345d8eSLuigi Rizzo 		uint32_t sli_hint1:8;
2542f345d8eSLuigi Rizzo 		uint32_t sli_if_type:4;
2552f345d8eSLuigi Rizzo 		uint32_t sli_family:4;
2562f345d8eSLuigi Rizzo 		uint32_t sli_rev:4;
2572f345d8eSLuigi Rizzo 		uint32_t rsv0:3;
2582f345d8eSLuigi Rizzo 		uint32_t sli_func_type:1;
2592f345d8eSLuigi Rizzo #else
2602f345d8eSLuigi Rizzo 		uint32_t sli_func_type:1;
2612f345d8eSLuigi Rizzo 		uint32_t rsv0:3;
2622f345d8eSLuigi Rizzo 		uint32_t sli_rev:4;
2632f345d8eSLuigi Rizzo 		uint32_t sli_family:4;
2642f345d8eSLuigi Rizzo 		uint32_t sli_if_type:4;
2652f345d8eSLuigi Rizzo 		uint32_t sli_hint1:8;
2662f345d8eSLuigi Rizzo 		uint32_t sli_hint2:5;
2672f345d8eSLuigi Rizzo 		uint32_t sli_valid:3;
2682f345d8eSLuigi Rizzo #endif
2692f345d8eSLuigi Rizzo 	} bits;
2702f345d8eSLuigi Rizzo } pci_sli_intf_t;
2712f345d8eSLuigi Rizzo 
2722f345d8eSLuigi Rizzo /* physical address structure to be used in MBX */
2732f345d8eSLuigi Rizzo struct phys_addr {
2742f345d8eSLuigi Rizzo 	/* dw0 */
2752f345d8eSLuigi Rizzo 	uint32_t lo;
2762f345d8eSLuigi Rizzo 	/* dw1 */
2772f345d8eSLuigi Rizzo 	uint32_t hi;
2782f345d8eSLuigi Rizzo };
2792f345d8eSLuigi Rizzo 
2802f345d8eSLuigi Rizzo typedef union pcicfg_intr_ctl_u {
2812f345d8eSLuigi Rizzo 	uint32_t dw0;
2822f345d8eSLuigi Rizzo 	struct {
2832f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
2842f345d8eSLuigi Rizzo 		uint32_t winselect:2;
2852f345d8eSLuigi Rizzo 		uint32_t hostintr:1;
2862f345d8eSLuigi Rizzo 		uint32_t pfnum:3;
2872f345d8eSLuigi Rizzo 		uint32_t vf_cev_int_line_en:1;
2882f345d8eSLuigi Rizzo 		uint32_t winaddr:23;
2892f345d8eSLuigi Rizzo 		uint32_t membarwinen:1;
2902f345d8eSLuigi Rizzo #else
2912f345d8eSLuigi Rizzo 		uint32_t membarwinen:1;
2922f345d8eSLuigi Rizzo 		uint32_t winaddr:23;
2932f345d8eSLuigi Rizzo 		uint32_t vf_cev_int_line_en:1;
2942f345d8eSLuigi Rizzo 		uint32_t pfnum:3;
2952f345d8eSLuigi Rizzo 		uint32_t hostintr:1;
2962f345d8eSLuigi Rizzo 		uint32_t winselect:2;
2972f345d8eSLuigi Rizzo #endif
2982f345d8eSLuigi Rizzo 	} bits;
2992f345d8eSLuigi Rizzo } pcicfg_intr_ctl_t;
3002f345d8eSLuigi Rizzo 
3012f345d8eSLuigi Rizzo typedef union pcicfg_semaphore_u {
3022f345d8eSLuigi Rizzo 	uint32_t dw0;
3032f345d8eSLuigi Rizzo 	struct {
3042f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
3052f345d8eSLuigi Rizzo 		uint32_t rsvd:31;
3062f345d8eSLuigi Rizzo 		uint32_t lock:1;
3072f345d8eSLuigi Rizzo #else
3082f345d8eSLuigi Rizzo 		uint32_t lock:1;
3092f345d8eSLuigi Rizzo 		uint32_t rsvd:31;
3102f345d8eSLuigi Rizzo #endif
3112f345d8eSLuigi Rizzo 	} bits;
3122f345d8eSLuigi Rizzo } pcicfg_semaphore_t;
3132f345d8eSLuigi Rizzo 
3142f345d8eSLuigi Rizzo typedef union pcicfg_soft_reset_u {
3152f345d8eSLuigi Rizzo 	uint32_t dw0;
3162f345d8eSLuigi Rizzo 	struct {
3172f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
3182f345d8eSLuigi Rizzo 		uint32_t nec_ll_rcvdetect:8;
3192f345d8eSLuigi Rizzo 		uint32_t dbg_all_reqs_62_49:14;
3202f345d8eSLuigi Rizzo 		uint32_t scratchpad0:1;
3212f345d8eSLuigi Rizzo 		uint32_t exception_oe:1;
3222f345d8eSLuigi Rizzo 		uint32_t soft_reset:1;
3232f345d8eSLuigi Rizzo 		uint32_t rsvd0:7;
3242f345d8eSLuigi Rizzo #else
3252f345d8eSLuigi Rizzo 		uint32_t rsvd0:7;
3262f345d8eSLuigi Rizzo 		uint32_t soft_reset:1;
3272f345d8eSLuigi Rizzo 		uint32_t exception_oe:1;
3282f345d8eSLuigi Rizzo 		uint32_t scratchpad0:1;
3292f345d8eSLuigi Rizzo 		uint32_t dbg_all_reqs_62_49:14;
3302f345d8eSLuigi Rizzo 		uint32_t nec_ll_rcvdetect:8;
3312f345d8eSLuigi Rizzo #endif
3322f345d8eSLuigi Rizzo 	} bits;
3332f345d8eSLuigi Rizzo } pcicfg_soft_reset_t;
3342f345d8eSLuigi Rizzo 
3352f345d8eSLuigi Rizzo typedef union pcicfg_online1_u {
3362f345d8eSLuigi Rizzo 	uint32_t dw0;
3372f345d8eSLuigi Rizzo 	struct {
3382f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
3392f345d8eSLuigi Rizzo 		uint32_t host8_online:1;
3402f345d8eSLuigi Rizzo 		uint32_t host7_online:1;
3412f345d8eSLuigi Rizzo 		uint32_t host6_online:1;
3422f345d8eSLuigi Rizzo 		uint32_t host5_online:1;
3432f345d8eSLuigi Rizzo 		uint32_t host4_online:1;
3442f345d8eSLuigi Rizzo 		uint32_t host3_online:1;
3452f345d8eSLuigi Rizzo 		uint32_t host2_online:1;
3462f345d8eSLuigi Rizzo 		uint32_t ipc_online:1;
3472f345d8eSLuigi Rizzo 		uint32_t arm_online:1;
3482f345d8eSLuigi Rizzo 		uint32_t txp_online:1;
3492f345d8eSLuigi Rizzo 		uint32_t xaui_online:1;
3502f345d8eSLuigi Rizzo 		uint32_t rxpp_online:1;
3512f345d8eSLuigi Rizzo 		uint32_t txpb_online:1;
3522f345d8eSLuigi Rizzo 		uint32_t rr_online:1;
3532f345d8eSLuigi Rizzo 		uint32_t pmem_online:1;
3542f345d8eSLuigi Rizzo 		uint32_t pctl1_online:1;
3552f345d8eSLuigi Rizzo 		uint32_t pctl0_online:1;
3562f345d8eSLuigi Rizzo 		uint32_t pcs1online_online:1;
3572f345d8eSLuigi Rizzo 		uint32_t mpu_iram_online:1;
3582f345d8eSLuigi Rizzo 		uint32_t pcs0online_online:1;
3592f345d8eSLuigi Rizzo 		uint32_t mgmt_mac_online:1;
3602f345d8eSLuigi Rizzo 		uint32_t lpcmemhost_online:1;
3612f345d8eSLuigi Rizzo #else
3622f345d8eSLuigi Rizzo 		uint32_t lpcmemhost_online:1;
3632f345d8eSLuigi Rizzo 		uint32_t mgmt_mac_online:1;
3642f345d8eSLuigi Rizzo 		uint32_t pcs0online_online:1;
3652f345d8eSLuigi Rizzo 		uint32_t mpu_iram_online:1;
3662f345d8eSLuigi Rizzo 		uint32_t pcs1online_online:1;
3672f345d8eSLuigi Rizzo 		uint32_t pctl0_online:1;
3682f345d8eSLuigi Rizzo 		uint32_t pctl1_online:1;
3692f345d8eSLuigi Rizzo 		uint32_t pmem_online:1;
3702f345d8eSLuigi Rizzo 		uint32_t rr_online:1;
3712f345d8eSLuigi Rizzo 		uint32_t txpb_online:1;
3722f345d8eSLuigi Rizzo 		uint32_t rxpp_online:1;
3732f345d8eSLuigi Rizzo 		uint32_t xaui_online:1;
3742f345d8eSLuigi Rizzo 		uint32_t txp_online:1;
3752f345d8eSLuigi Rizzo 		uint32_t arm_online:1;
3762f345d8eSLuigi Rizzo 		uint32_t ipc_online:1;
3772f345d8eSLuigi Rizzo 		uint32_t host2_online:1;
3782f345d8eSLuigi Rizzo 		uint32_t host3_online:1;
3792f345d8eSLuigi Rizzo 		uint32_t host4_online:1;
3802f345d8eSLuigi Rizzo 		uint32_t host5_online:1;
3812f345d8eSLuigi Rizzo 		uint32_t host6_online:1;
3822f345d8eSLuigi Rizzo 		uint32_t host7_online:1;
3832f345d8eSLuigi Rizzo 		uint32_t host8_online:1;
3842f345d8eSLuigi Rizzo #endif
3852f345d8eSLuigi Rizzo 	} bits;
3862f345d8eSLuigi Rizzo } pcicfg_online1_t;
3872f345d8eSLuigi Rizzo 
3882f345d8eSLuigi Rizzo typedef union mpu_ep_semaphore_u {
3892f345d8eSLuigi Rizzo 	uint32_t dw0;
3902f345d8eSLuigi Rizzo 	struct {
3912f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
3922f345d8eSLuigi Rizzo 		uint32_t error:1;
3932f345d8eSLuigi Rizzo 		uint32_t backup_fw:1;
3942f345d8eSLuigi Rizzo 		uint32_t iscsi_no_ip:1;
3952f345d8eSLuigi Rizzo 		uint32_t iscsi_ip_conflict:1;
3962f345d8eSLuigi Rizzo 		uint32_t option_rom_installed:1;
3972f345d8eSLuigi Rizzo 		uint32_t iscsi_drv_loaded:1;
3982f345d8eSLuigi Rizzo 		uint32_t rsvd0:10;
3992f345d8eSLuigi Rizzo 		uint32_t stage:16;
4002f345d8eSLuigi Rizzo #else
4012f345d8eSLuigi Rizzo 		uint32_t stage:16;
4022f345d8eSLuigi Rizzo 		uint32_t rsvd0:10;
4032f345d8eSLuigi Rizzo 		uint32_t iscsi_drv_loaded:1;
4042f345d8eSLuigi Rizzo 		uint32_t option_rom_installed:1;
4052f345d8eSLuigi Rizzo 		uint32_t iscsi_ip_conflict:1;
4062f345d8eSLuigi Rizzo 		uint32_t iscsi_no_ip:1;
4072f345d8eSLuigi Rizzo 		uint32_t backup_fw:1;
4082f345d8eSLuigi Rizzo 		uint32_t error:1;
4092f345d8eSLuigi Rizzo #endif
4102f345d8eSLuigi Rizzo 	} bits;
4112f345d8eSLuigi Rizzo } mpu_ep_semaphore_t;
4122f345d8eSLuigi Rizzo 
4132f345d8eSLuigi Rizzo typedef union mpu_ep_control_u {
4142f345d8eSLuigi Rizzo 	uint32_t dw0;
4152f345d8eSLuigi Rizzo 	struct {
4162f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
4172f345d8eSLuigi Rizzo 		uint32_t cpu_reset:1;
4182f345d8eSLuigi Rizzo 		uint32_t rsvd1:15;
4192f345d8eSLuigi Rizzo 		uint32_t ep_ram_init_status:1;
4202f345d8eSLuigi Rizzo 		uint32_t rsvd0:12;
4212f345d8eSLuigi Rizzo 		uint32_t m2_rxpbuf:1;
4222f345d8eSLuigi Rizzo 		uint32_t m1_rxpbuf:1;
4232f345d8eSLuigi Rizzo 		uint32_t m0_rxpbuf:1;
4242f345d8eSLuigi Rizzo #else
4252f345d8eSLuigi Rizzo 		uint32_t m0_rxpbuf:1;
4262f345d8eSLuigi Rizzo 		uint32_t m1_rxpbuf:1;
4272f345d8eSLuigi Rizzo 		uint32_t m2_rxpbuf:1;
4282f345d8eSLuigi Rizzo 		uint32_t rsvd0:12;
4292f345d8eSLuigi Rizzo 		uint32_t ep_ram_init_status:1;
4302f345d8eSLuigi Rizzo 		uint32_t rsvd1:15;
4312f345d8eSLuigi Rizzo 		uint32_t cpu_reset:1;
4322f345d8eSLuigi Rizzo #endif
4332f345d8eSLuigi Rizzo 	} bits;
4342f345d8eSLuigi Rizzo } mpu_ep_control_t;
4352f345d8eSLuigi Rizzo 
4362f345d8eSLuigi Rizzo /* RX doorbell */
4372f345d8eSLuigi Rizzo typedef union pd_rxulp_db_u {
4382f345d8eSLuigi Rizzo 	uint32_t dw0;
4392f345d8eSLuigi Rizzo 	struct {
4402f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
4412f345d8eSLuigi Rizzo 		uint32_t num_posted:8;
4422f345d8eSLuigi Rizzo 		uint32_t invalidate:1;
4432f345d8eSLuigi Rizzo 		uint32_t rsvd1:13;
4442f345d8eSLuigi Rizzo 		uint32_t qid:10;
4452f345d8eSLuigi Rizzo #else
4462f345d8eSLuigi Rizzo 		uint32_t qid:10;
4472f345d8eSLuigi Rizzo 		uint32_t rsvd1:13;
4482f345d8eSLuigi Rizzo 		uint32_t invalidate:1;
4492f345d8eSLuigi Rizzo 		uint32_t num_posted:8;
4502f345d8eSLuigi Rizzo #endif
4512f345d8eSLuigi Rizzo 	} bits;
4522f345d8eSLuigi Rizzo } pd_rxulp_db_t;
4532f345d8eSLuigi Rizzo 
4542f345d8eSLuigi Rizzo /* TX doorbell */
4552f345d8eSLuigi Rizzo typedef union pd_txulp_db_u {
4562f345d8eSLuigi Rizzo 	uint32_t dw0;
4572f345d8eSLuigi Rizzo 	struct {
4582f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
4592f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
4602f345d8eSLuigi Rizzo 		uint32_t num_posted:14;
4612f345d8eSLuigi Rizzo 		uint32_t rsvd0:6;
4622f345d8eSLuigi Rizzo 		uint32_t qid:10;
4632f345d8eSLuigi Rizzo #else
4642f345d8eSLuigi Rizzo 		uint32_t qid:10;
4652f345d8eSLuigi Rizzo 		uint32_t rsvd0:6;
4662f345d8eSLuigi Rizzo 		uint32_t num_posted:14;
4672f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
4682f345d8eSLuigi Rizzo #endif
4692f345d8eSLuigi Rizzo 	} bits;
4702f345d8eSLuigi Rizzo } pd_txulp_db_t;
4712f345d8eSLuigi Rizzo 
4722f345d8eSLuigi Rizzo /* CQ doorbell */
4732f345d8eSLuigi Rizzo typedef union cq_db_u {
4742f345d8eSLuigi Rizzo 	uint32_t dw0;
4752f345d8eSLuigi Rizzo 	struct {
4762f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
4772f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
4782f345d8eSLuigi Rizzo 		uint32_t rearm:1;
4792f345d8eSLuigi Rizzo 		uint32_t num_popped:13;
4802f345d8eSLuigi Rizzo 		uint32_t rsvd0:5;
4812f345d8eSLuigi Rizzo 		uint32_t event:1;
4822f345d8eSLuigi Rizzo 		uint32_t qid:10;
4832f345d8eSLuigi Rizzo #else
4842f345d8eSLuigi Rizzo 		uint32_t qid:10;
4852f345d8eSLuigi Rizzo 		uint32_t event:1;
4862f345d8eSLuigi Rizzo 		uint32_t rsvd0:5;
4872f345d8eSLuigi Rizzo 		uint32_t num_popped:13;
4882f345d8eSLuigi Rizzo 		uint32_t rearm:1;
4892f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
4902f345d8eSLuigi Rizzo #endif
4912f345d8eSLuigi Rizzo 	} bits;
4922f345d8eSLuigi Rizzo } cq_db_t;
4932f345d8eSLuigi Rizzo 
4942f345d8eSLuigi Rizzo /* EQ doorbell */
4952f345d8eSLuigi Rizzo typedef union eq_db_u {
4962f345d8eSLuigi Rizzo 	uint32_t dw0;
4972f345d8eSLuigi Rizzo 	struct {
4982f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
4992f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
5002f345d8eSLuigi Rizzo 		uint32_t rearm:1;
5012f345d8eSLuigi Rizzo 		uint32_t num_popped:13;
5022f345d8eSLuigi Rizzo 		uint32_t rsvd0:5;
5032f345d8eSLuigi Rizzo 		uint32_t event:1;
5042f345d8eSLuigi Rizzo 		uint32_t clrint:1;
5052f345d8eSLuigi Rizzo 		uint32_t qid:9;
5062f345d8eSLuigi Rizzo #else
5072f345d8eSLuigi Rizzo 		uint32_t qid:9;
5082f345d8eSLuigi Rizzo 		uint32_t clrint:1;
5092f345d8eSLuigi Rizzo 		uint32_t event:1;
5102f345d8eSLuigi Rizzo 		uint32_t rsvd0:5;
5112f345d8eSLuigi Rizzo 		uint32_t num_popped:13;
5122f345d8eSLuigi Rizzo 		uint32_t rearm:1;
5132f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
5142f345d8eSLuigi Rizzo #endif
5152f345d8eSLuigi Rizzo 	} bits;
5162f345d8eSLuigi Rizzo } eq_db_t;
5172f345d8eSLuigi Rizzo 
5182f345d8eSLuigi Rizzo /* bootstrap mbox doorbell */
5192f345d8eSLuigi Rizzo typedef union pd_mpu_mbox_db_u {
5202f345d8eSLuigi Rizzo 	uint32_t dw0;
5212f345d8eSLuigi Rizzo 	struct {
5222f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
5232f345d8eSLuigi Rizzo 		uint32_t address:30;
5242f345d8eSLuigi Rizzo 		uint32_t hi:1;
5252f345d8eSLuigi Rizzo 		uint32_t ready:1;
5262f345d8eSLuigi Rizzo #else
5272f345d8eSLuigi Rizzo 		uint32_t ready:1;
5282f345d8eSLuigi Rizzo 		uint32_t hi:1;
5292f345d8eSLuigi Rizzo 		uint32_t address:30;
5302f345d8eSLuigi Rizzo #endif
5312f345d8eSLuigi Rizzo 	} bits;
5322f345d8eSLuigi Rizzo } pd_mpu_mbox_db_t;
5332f345d8eSLuigi Rizzo 
5342f345d8eSLuigi Rizzo /* MQ ring doorbell */
5352f345d8eSLuigi Rizzo typedef union pd_mq_db_u {
5362f345d8eSLuigi Rizzo 	uint32_t dw0;
5372f345d8eSLuigi Rizzo 	struct {
5382f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
5392f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
5402f345d8eSLuigi Rizzo 		uint32_t num_posted:14;
5412f345d8eSLuigi Rizzo 		uint32_t rsvd0:5;
5422f345d8eSLuigi Rizzo 		uint32_t mq_id:11;
5432f345d8eSLuigi Rizzo #else
5442f345d8eSLuigi Rizzo 		uint32_t mq_id:11;
5452f345d8eSLuigi Rizzo 		uint32_t rsvd0:5;
5462f345d8eSLuigi Rizzo 		uint32_t num_posted:14;
5472f345d8eSLuigi Rizzo 		uint32_t rsvd1:2;
5482f345d8eSLuigi Rizzo #endif
5492f345d8eSLuigi Rizzo 	} bits;
5502f345d8eSLuigi Rizzo } pd_mq_db_t;
5512f345d8eSLuigi Rizzo 
5522f345d8eSLuigi Rizzo /*
5532f345d8eSLuigi Rizzo  * Event Queue Entry
5542f345d8eSLuigi Rizzo  */
5552f345d8eSLuigi Rizzo struct oce_eqe {
5562f345d8eSLuigi Rizzo 	uint32_t evnt;
5572f345d8eSLuigi Rizzo };
5582f345d8eSLuigi Rizzo 
5592f345d8eSLuigi Rizzo /* MQ scatter gather entry. Array of these make an SGL */
5602f345d8eSLuigi Rizzo struct oce_mq_sge {
5612f345d8eSLuigi Rizzo 	uint32_t pa_lo;
5622f345d8eSLuigi Rizzo 	uint32_t pa_hi;
5632f345d8eSLuigi Rizzo 	uint32_t length;
5642f345d8eSLuigi Rizzo };
5652f345d8eSLuigi Rizzo 
5662f345d8eSLuigi Rizzo /*
5672f345d8eSLuigi Rizzo  * payload can contain an SGL or an embedded array of upto 59 dwords
5682f345d8eSLuigi Rizzo  */
5692f345d8eSLuigi Rizzo struct oce_mbx_payload {
5702f345d8eSLuigi Rizzo 	union {
5712f345d8eSLuigi Rizzo 		union {
5722f345d8eSLuigi Rizzo 			struct oce_mq_sge sgl[MAX_MBX_SGE];
5732f345d8eSLuigi Rizzo 			uint32_t embedded[59];
5742f345d8eSLuigi Rizzo 		} u1;
5752f345d8eSLuigi Rizzo 		uint32_t dw[59];
5762f345d8eSLuigi Rizzo 	} u0;
5772f345d8eSLuigi Rizzo };
5782f345d8eSLuigi Rizzo 
5792f345d8eSLuigi Rizzo /*
5802f345d8eSLuigi Rizzo  * MQ MBX structure
5812f345d8eSLuigi Rizzo  */
5822f345d8eSLuigi Rizzo struct oce_mbx {
5832f345d8eSLuigi Rizzo 	union {
5842f345d8eSLuigi Rizzo 		struct {
5852f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
5862f345d8eSLuigi Rizzo 			uint32_t special:8;
5872f345d8eSLuigi Rizzo 			uint32_t rsvd1:16;
5882f345d8eSLuigi Rizzo 			uint32_t sge_count:5;
5892f345d8eSLuigi Rizzo 			uint32_t rsvd0:2;
5902f345d8eSLuigi Rizzo 			uint32_t embedded:1;
5912f345d8eSLuigi Rizzo #else
5922f345d8eSLuigi Rizzo 			uint32_t embedded:1;
5932f345d8eSLuigi Rizzo 			uint32_t rsvd0:2;
5942f345d8eSLuigi Rizzo 			uint32_t sge_count:5;
5952f345d8eSLuigi Rizzo 			uint32_t rsvd1:16;
5962f345d8eSLuigi Rizzo 			uint32_t special:8;
5972f345d8eSLuigi Rizzo #endif
5982f345d8eSLuigi Rizzo 		} s;
5992f345d8eSLuigi Rizzo 		uint32_t dw0;
6002f345d8eSLuigi Rizzo 	} u0;
6012f345d8eSLuigi Rizzo 
6022f345d8eSLuigi Rizzo 	uint32_t payload_length;
6032f345d8eSLuigi Rizzo 	uint32_t tag[2];
6042f345d8eSLuigi Rizzo 	uint32_t rsvd2[1];
6052f345d8eSLuigi Rizzo 	struct oce_mbx_payload payload;
6062f345d8eSLuigi Rizzo };
6072f345d8eSLuigi Rizzo 
6082f345d8eSLuigi Rizzo /* completion queue entry for MQ */
6092f345d8eSLuigi Rizzo struct oce_mq_cqe {
6102f345d8eSLuigi Rizzo 	union {
6112f345d8eSLuigi Rizzo 		struct {
6122f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
6132f345d8eSLuigi Rizzo 			/* dw0 */
6142f345d8eSLuigi Rizzo 			uint32_t extended_status:16;
6152f345d8eSLuigi Rizzo 			uint32_t completion_status:16;
6162f345d8eSLuigi Rizzo 			/* dw1 dw2 */
6172f345d8eSLuigi Rizzo 			uint32_t mq_tag[2];
6182f345d8eSLuigi Rizzo 			/* dw3 */
6192f345d8eSLuigi Rizzo 			uint32_t valid:1;
6202f345d8eSLuigi Rizzo 			uint32_t async_event:1;
6212f345d8eSLuigi Rizzo 			uint32_t hpi_buffer_cmpl:1;
6222f345d8eSLuigi Rizzo 			uint32_t completed:1;
6232f345d8eSLuigi Rizzo 			uint32_t consumed:1;
6249bd3250aSLuigi Rizzo 			uint32_t rsvd0:3;
6259bd3250aSLuigi Rizzo 			uint32_t async_type:8;
6269bd3250aSLuigi Rizzo 			uint32_t event_type:8;
6279bd3250aSLuigi Rizzo 			uint32_t rsvd1:8;
6282f345d8eSLuigi Rizzo #else
6292f345d8eSLuigi Rizzo 			/* dw0 */
6302f345d8eSLuigi Rizzo 			uint32_t completion_status:16;
6312f345d8eSLuigi Rizzo 			uint32_t extended_status:16;
6322f345d8eSLuigi Rizzo 			/* dw1 dw2 */
6332f345d8eSLuigi Rizzo 			uint32_t mq_tag[2];
6342f345d8eSLuigi Rizzo 			/* dw3 */
6359bd3250aSLuigi Rizzo 			uint32_t rsvd1:8;
6369bd3250aSLuigi Rizzo 			uint32_t event_type:8;
6379bd3250aSLuigi Rizzo 			uint32_t async_type:8;
6389bd3250aSLuigi Rizzo 			uint32_t rsvd0:3;
6392f345d8eSLuigi Rizzo 			uint32_t consumed:1;
6402f345d8eSLuigi Rizzo 			uint32_t completed:1;
6412f345d8eSLuigi Rizzo 			uint32_t hpi_buffer_cmpl:1;
6422f345d8eSLuigi Rizzo 			uint32_t async_event:1;
6432f345d8eSLuigi Rizzo 			uint32_t valid:1;
6442f345d8eSLuigi Rizzo #endif
6452f345d8eSLuigi Rizzo 		} s;
6462f345d8eSLuigi Rizzo 		uint32_t dw[4];
6472f345d8eSLuigi Rizzo 	} u0;
6482f345d8eSLuigi Rizzo };
6492f345d8eSLuigi Rizzo 
6502f345d8eSLuigi Rizzo /* Mailbox Completion Status Codes */
6512f345d8eSLuigi Rizzo enum MBX_COMPLETION_STATUS {
6522f345d8eSLuigi Rizzo 	MBX_CQE_STATUS_SUCCESS = 0x00,
6532f345d8eSLuigi Rizzo 	MBX_CQE_STATUS_INSUFFICIENT_PRIVILEDGES = 0x01,
6542f345d8eSLuigi Rizzo 	MBX_CQE_STATUS_INVALID_PARAMETER = 0x02,
6552f345d8eSLuigi Rizzo 	MBX_CQE_STATUS_INSUFFICIENT_RESOURCES = 0x03,
6562f345d8eSLuigi Rizzo 	MBX_CQE_STATUS_QUEUE_FLUSHING = 0x04,
6572f345d8eSLuigi Rizzo 	MBX_CQE_STATUS_DMA_FAILED = 0x05
6582f345d8eSLuigi Rizzo };
6592f345d8eSLuigi Rizzo 
6602f345d8eSLuigi Rizzo struct oce_async_cqe_link_state {
6612f345d8eSLuigi Rizzo 	union {
6622f345d8eSLuigi Rizzo 		struct {
6632f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
6642f345d8eSLuigi Rizzo 			/* dw0 */
6652f345d8eSLuigi Rizzo 			uint8_t speed;
6662f345d8eSLuigi Rizzo 			uint8_t duplex;
6672f345d8eSLuigi Rizzo 			uint8_t link_status;
6682f345d8eSLuigi Rizzo 			uint8_t phy_port;
6692f345d8eSLuigi Rizzo 			/* dw1 */
6702f345d8eSLuigi Rizzo 			uint16_t qos_link_speed;
6712f345d8eSLuigi Rizzo 			uint8_t rsvd0;
6722f345d8eSLuigi Rizzo 			uint8_t fault;
6732f345d8eSLuigi Rizzo 			/* dw2 */
6742f345d8eSLuigi Rizzo 			uint32_t event_tag;
6752f345d8eSLuigi Rizzo 			/* dw3 */
6762f345d8eSLuigi Rizzo 			uint32_t valid:1;
6772f345d8eSLuigi Rizzo 			uint32_t async_event:1;
6782f345d8eSLuigi Rizzo 			uint32_t rsvd2:6;
6792f345d8eSLuigi Rizzo 			uint32_t event_type:8;
6802f345d8eSLuigi Rizzo 			uint32_t event_code:8;
6812f345d8eSLuigi Rizzo 			uint32_t rsvd1:8;
6822f345d8eSLuigi Rizzo #else
6832f345d8eSLuigi Rizzo 			/* dw0 */
6842f345d8eSLuigi Rizzo 			uint8_t phy_port;
6852f345d8eSLuigi Rizzo 			uint8_t link_status;
6862f345d8eSLuigi Rizzo 			uint8_t duplex;
6872f345d8eSLuigi Rizzo 			uint8_t speed;
6882f345d8eSLuigi Rizzo 			/* dw1 */
6892f345d8eSLuigi Rizzo 			uint8_t fault;
6902f345d8eSLuigi Rizzo 			uint8_t rsvd0;
6912f345d8eSLuigi Rizzo 			uint16_t qos_link_speed;
6922f345d8eSLuigi Rizzo 			/* dw2 */
6932f345d8eSLuigi Rizzo 			uint32_t event_tag;
6942f345d8eSLuigi Rizzo 			/* dw3 */
6952f345d8eSLuigi Rizzo 			uint32_t rsvd1:8;
6962f345d8eSLuigi Rizzo 			uint32_t event_code:8;
6972f345d8eSLuigi Rizzo 			uint32_t event_type:8;
6982f345d8eSLuigi Rizzo 			uint32_t rsvd2:6;
6992f345d8eSLuigi Rizzo 			uint32_t async_event:1;
7002f345d8eSLuigi Rizzo 			uint32_t valid:1;
7012f345d8eSLuigi Rizzo #endif
7022f345d8eSLuigi Rizzo 		} s;
7032f345d8eSLuigi Rizzo 		uint32_t dw[4];
7042f345d8eSLuigi Rizzo 	} u0;
7052f345d8eSLuigi Rizzo };
7062f345d8eSLuigi Rizzo 
707c2625e6eSJosh Paetzel /* OS2BMC async event */
708c2625e6eSJosh Paetzel struct oce_async_evt_grp5_os2bmc {
709c2625e6eSJosh Paetzel 	union {
710c2625e6eSJosh Paetzel 		struct {
711c2625e6eSJosh Paetzel 			uint32_t lrn_enable:1;
712c2625e6eSJosh Paetzel 			uint32_t lrn_disable:1;
713c2625e6eSJosh Paetzel 			uint32_t mgmt_enable:1;
714c2625e6eSJosh Paetzel 			uint32_t mgmt_disable:1;
715c2625e6eSJosh Paetzel 			uint32_t rsvd0:12;
716c2625e6eSJosh Paetzel 			uint32_t vlan_tag:16;
717c2625e6eSJosh Paetzel 			uint32_t arp_filter:1;
718c2625e6eSJosh Paetzel 			uint32_t dhcp_client_filt:1;
719c2625e6eSJosh Paetzel 			uint32_t dhcp_server_filt:1;
720c2625e6eSJosh Paetzel 			uint32_t net_bios_filt:1;
721c2625e6eSJosh Paetzel 			uint32_t rsvd1:3;
722c2625e6eSJosh Paetzel 			uint32_t bcast_filt:1;
723c2625e6eSJosh Paetzel 			uint32_t ipv6_nbr_filt:1;
724c2625e6eSJosh Paetzel 			uint32_t ipv6_ra_filt:1;
725c2625e6eSJosh Paetzel 			uint32_t ipv6_ras_filt:1;
726c2625e6eSJosh Paetzel 			uint32_t rsvd2[4];
727c2625e6eSJosh Paetzel 			uint32_t mcast_filt:1;
728c2625e6eSJosh Paetzel 			uint32_t rsvd3:16;
729c2625e6eSJosh Paetzel 			uint32_t evt_tag;
730c2625e6eSJosh Paetzel 			uint32_t dword3;
731c2625e6eSJosh Paetzel 		} s;
732c2625e6eSJosh Paetzel 		uint32_t dword[4];
733c2625e6eSJosh Paetzel 	} u;
734c2625e6eSJosh Paetzel };
7359bd3250aSLuigi Rizzo 
7369bd3250aSLuigi Rizzo /* PVID aync event */
7379bd3250aSLuigi Rizzo struct oce_async_event_grp5_pvid_state {
7389bd3250aSLuigi Rizzo 	uint8_t enabled;
7399bd3250aSLuigi Rizzo 	uint8_t rsvd0;
7409bd3250aSLuigi Rizzo 	uint16_t tag;
7419bd3250aSLuigi Rizzo 	uint32_t event_tag;
7429bd3250aSLuigi Rizzo 	uint32_t rsvd1;
7439bd3250aSLuigi Rizzo 	uint32_t code;
7449bd3250aSLuigi Rizzo };
7459bd3250aSLuigi Rizzo 
746cdaba892SXin LI /* async event indicating outer VLAN tag in QnQ */
747cdaba892SXin LI struct oce_async_event_qnq {
748cdaba892SXin LI         uint8_t valid;       /* Indicates if outer VLAN is valid */
749cdaba892SXin LI         uint8_t rsvd0;
750cdaba892SXin LI         uint16_t vlan_tag;
751cdaba892SXin LI         uint32_t event_tag;
752cdaba892SXin LI         uint8_t rsvd1[4];
753cdaba892SXin LI 	uint32_t code;
754cdaba892SXin LI } ;
755cdaba892SXin LI 
7569bd3250aSLuigi Rizzo typedef union oce_mq_ext_ctx_u {
7579bd3250aSLuigi Rizzo 	uint32_t dw[6];
7589bd3250aSLuigi Rizzo 	struct {
7599bd3250aSLuigi Rizzo 		#ifdef _BIG_ENDIAN
7609bd3250aSLuigi Rizzo 		/* dw0 */
7619bd3250aSLuigi Rizzo 		uint32_t dw4rsvd1:16;
7629bd3250aSLuigi Rizzo 		uint32_t num_pages:16;
7639bd3250aSLuigi Rizzo 		/* dw1 */
7649bd3250aSLuigi Rizzo 		uint32_t async_evt_bitmap;
7659bd3250aSLuigi Rizzo 		/* dw2 */
7669bd3250aSLuigi Rizzo 		uint32_t cq_id:10;
7679bd3250aSLuigi Rizzo 		uint32_t dw5rsvd2:2;
7689bd3250aSLuigi Rizzo 		uint32_t ring_size:4;
7699bd3250aSLuigi Rizzo 		uint32_t dw5rsvd1:16;
7709bd3250aSLuigi Rizzo 		/* dw3 */
7719bd3250aSLuigi Rizzo 		uint32_t valid:1;
7729bd3250aSLuigi Rizzo 		uint32_t dw6rsvd1:31;
7739bd3250aSLuigi Rizzo 		/* dw4 */
7749bd3250aSLuigi Rizzo 		uint32_t dw7rsvd1:21;
7759bd3250aSLuigi Rizzo 		uint32_t async_cq_id:10;
7769bd3250aSLuigi Rizzo 		uint32_t async_cq_valid:1;
7779bd3250aSLuigi Rizzo 	#else
7789bd3250aSLuigi Rizzo 		/* dw0 */
7799bd3250aSLuigi Rizzo 		uint32_t num_pages:16;
7809bd3250aSLuigi Rizzo 		uint32_t dw4rsvd1:16;
7819bd3250aSLuigi Rizzo 		/* dw1 */
7829bd3250aSLuigi Rizzo 		uint32_t async_evt_bitmap;
7839bd3250aSLuigi Rizzo 		/* dw2 */
7849bd3250aSLuigi Rizzo 		uint32_t dw5rsvd1:16;
7859bd3250aSLuigi Rizzo 		uint32_t ring_size:4;
7869bd3250aSLuigi Rizzo 		uint32_t dw5rsvd2:2;
7879bd3250aSLuigi Rizzo 		uint32_t cq_id:10;
7889bd3250aSLuigi Rizzo 		/* dw3 */
7899bd3250aSLuigi Rizzo 		uint32_t dw6rsvd1:31;
7909bd3250aSLuigi Rizzo 		uint32_t valid:1;
7919bd3250aSLuigi Rizzo 		/* dw4 */
7929bd3250aSLuigi Rizzo 		uint32_t async_cq_valid:1;
7939bd3250aSLuigi Rizzo 		uint32_t async_cq_id:10;
7949bd3250aSLuigi Rizzo 		uint32_t dw7rsvd1:21;
7959bd3250aSLuigi Rizzo 	#endif
7969bd3250aSLuigi Rizzo 		/* dw5 */
7979bd3250aSLuigi Rizzo 		uint32_t dw8rsvd1;
7989bd3250aSLuigi Rizzo 	} v0;
799cdaba892SXin LI 	        struct {
800cdaba892SXin LI 	#ifdef _BIG_ENDIAN
801cdaba892SXin LI                 /* dw0 */
802cdaba892SXin LI                 uint32_t cq_id:16;
803cdaba892SXin LI                 uint32_t num_pages:16;
804cdaba892SXin LI                 /* dw1 */
805cdaba892SXin LI                 uint32_t async_evt_bitmap;
806cdaba892SXin LI                 /* dw2 */
807cdaba892SXin LI                 uint32_t dw5rsvd2:12;
808cdaba892SXin LI                 uint32_t ring_size:4;
809cdaba892SXin LI                 uint32_t async_cq_id:16;
810cdaba892SXin LI                 /* dw3 */
811cdaba892SXin LI                 uint32_t valid:1;
812cdaba892SXin LI                 uint32_t dw6rsvd1:31;
813cdaba892SXin LI                 /* dw4 */
814cdaba892SXin LI 		uint32_t dw7rsvd1:31;
815cdaba892SXin LI                 uint32_t async_cq_valid:1;
816cdaba892SXin LI         #else
817cdaba892SXin LI                 /* dw0 */
818cdaba892SXin LI                 uint32_t num_pages:16;
819cdaba892SXin LI                 uint32_t cq_id:16;
820cdaba892SXin LI                 /* dw1 */
821cdaba892SXin LI                 uint32_t async_evt_bitmap;
822cdaba892SXin LI                 /* dw2 */
823cdaba892SXin LI                 uint32_t async_cq_id:16;
824cdaba892SXin LI                 uint32_t ring_size:4;
825cdaba892SXin LI                 uint32_t dw5rsvd2:12;
826cdaba892SXin LI                 /* dw3 */
827cdaba892SXin LI                 uint32_t dw6rsvd1:31;
828cdaba892SXin LI                 uint32_t valid:1;
829cdaba892SXin LI                 /* dw4 */
830cdaba892SXin LI                 uint32_t async_cq_valid:1;
831cdaba892SXin LI                 uint32_t dw7rsvd1:31;
832cdaba892SXin LI         #endif
833cdaba892SXin LI                 /* dw5 */
834cdaba892SXin LI                 uint32_t dw8rsvd1;
835cdaba892SXin LI         } v1;
836cdaba892SXin LI 
8379bd3250aSLuigi Rizzo } oce_mq_ext_ctx_t;
8389bd3250aSLuigi Rizzo 
8392f345d8eSLuigi Rizzo /* MQ mailbox structure */
8402f345d8eSLuigi Rizzo struct oce_bmbx {
8412f345d8eSLuigi Rizzo 	struct oce_mbx mbx;
8422f345d8eSLuigi Rizzo 	struct oce_mq_cqe cqe;
8432f345d8eSLuigi Rizzo };
8442f345d8eSLuigi Rizzo 
8452f345d8eSLuigi Rizzo /* ---[ MBXs start here ]---------------------------------------------- */
8462f345d8eSLuigi Rizzo /* MBXs sub system codes */
8472f345d8eSLuigi Rizzo enum MBX_SUBSYSTEM_CODES {
8482f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_RSVD = 0,
8492f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_COMMON = 1,
8502f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_COMMON_ISCSI = 2,
8512f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_NIC = 3,
8522f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_TOE = 4,
8532f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_PXE_UNDI = 5,
8542f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_ISCSI_INI = 6,
8552f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_ISCSI_TGT = 7,
8562f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_MILI_PTL = 8,
8572f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_MILI_TMD = 9,
8582f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_RDMA = 10,
8592f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_LOWLEVEL = 11,
8602f345d8eSLuigi Rizzo 	MBX_SUBSYSTEM_LRO = 13,
8612f345d8eSLuigi Rizzo 	IOCBMBX_SUBSYSTEM_DCBX = 15,
8622f345d8eSLuigi Rizzo 	IOCBMBX_SUBSYSTEM_DIAG = 16,
8632f345d8eSLuigi Rizzo 	IOCBMBX_SUBSYSTEM_VENDOR = 17
8642f345d8eSLuigi Rizzo };
8652f345d8eSLuigi Rizzo 
8662f345d8eSLuigi Rizzo /* common ioctl opcodes */
8672f345d8eSLuigi Rizzo enum COMMON_SUBSYSTEM_OPCODES {
8682f345d8eSLuigi Rizzo /* These opcodes are common to both networking and storage PCI functions
8692f345d8eSLuigi Rizzo  * They are used to reserve resources and configure CNA. These opcodes
8702f345d8eSLuigi Rizzo  * all use the MBX_SUBSYSTEM_COMMON subsystem code.
8712f345d8eSLuigi Rizzo  */
8722f345d8eSLuigi Rizzo 	OPCODE_COMMON_QUERY_IFACE_MAC = 1,
8732f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_IFACE_MAC = 2,
8742f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_IFACE_MULTICAST = 3,
8752f345d8eSLuigi Rizzo 	OPCODE_COMMON_CONFIG_IFACE_VLAN = 4,
8762f345d8eSLuigi Rizzo 	OPCODE_COMMON_QUERY_LINK_CONFIG = 5,
8772f345d8eSLuigi Rizzo 	OPCODE_COMMON_READ_FLASHROM = 6,
8782f345d8eSLuigi Rizzo 	OPCODE_COMMON_WRITE_FLASHROM = 7,
8792f345d8eSLuigi Rizzo 	OPCODE_COMMON_QUERY_MAX_MBX_BUFFER_SIZE = 8,
8802f345d8eSLuigi Rizzo 	OPCODE_COMMON_CREATE_CQ = 12,
8812f345d8eSLuigi Rizzo 	OPCODE_COMMON_CREATE_EQ = 13,
8822f345d8eSLuigi Rizzo 	OPCODE_COMMON_CREATE_MQ = 21,
8832f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_QOS = 27,
8842f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_QOS = 28,
8852f345d8eSLuigi Rizzo 	OPCODE_COMMON_READ_EPROM = 30,
8862f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_CNTL_ATTRIBUTES = 32,
8872f345d8eSLuigi Rizzo 	OPCODE_COMMON_NOP = 33,
8882f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_IFACE_RX_FILTER = 34,
8892f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_FW_VERSION = 35,
8902f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_FLOW_CONTROL = 36,
8912f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_FLOW_CONTROL = 37,
8922f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_FRAME_SIZE = 39,
8932f345d8eSLuigi Rizzo 	OPCODE_COMMON_MODIFY_EQ_DELAY = 41,
8942f345d8eSLuigi Rizzo 	OPCODE_COMMON_CREATE_IFACE = 50,
8952f345d8eSLuigi Rizzo 	OPCODE_COMMON_DESTROY_IFACE = 51,
8962f345d8eSLuigi Rizzo 	OPCODE_COMMON_MODIFY_MSI_MESSAGES = 52,
8972f345d8eSLuigi Rizzo 	OPCODE_COMMON_DESTROY_MQ = 53,
8982f345d8eSLuigi Rizzo 	OPCODE_COMMON_DESTROY_CQ = 54,
8992f345d8eSLuigi Rizzo 	OPCODE_COMMON_DESTROY_EQ = 55,
9002f345d8eSLuigi Rizzo 	OPCODE_COMMON_UPLOAD_TCP = 56,
9012f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_NTWK_LINK_SPEED = 57,
9022f345d8eSLuigi Rizzo 	OPCODE_COMMON_QUERY_FIRMWARE_CONFIG = 58,
9032f345d8eSLuigi Rizzo 	OPCODE_COMMON_ADD_IFACE_MAC = 59,
9042f345d8eSLuigi Rizzo 	OPCODE_COMMON_DEL_IFACE_MAC = 60,
9052f345d8eSLuigi Rizzo 	OPCODE_COMMON_FUNCTION_RESET = 61,
9062f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_PHYSICAL_LINK_CONFIG = 62,
9072f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_BOOT_CONFIG = 66,
9082f345d8eSLuigi Rizzo 	OPCPDE_COMMON_SET_BOOT_CONFIG = 67,
9092f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_BEACON_CONFIG = 69,
9102f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_BEACON_CONFIG = 70,
9112f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_PHYSICAL_LINK_CONFIG = 71,
912cdaba892SXin LI 	OPCODE_COMMON_READ_TRANSRECEIVER_DATA = 73,
9132f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_OEM_ATTRIBUTES = 76,
9142f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_PORT_NAME = 77,
9152f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_CONFIG_SIGNATURE = 78,
9162f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_CONFIG_SIGNATURE = 79,
9172f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_LOGICAL_LINK_CONFIG = 80,
9182f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_BE_CONFIGURATION_RESOURCES = 81,
9192f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_BE_CONFIGURATION_RESOURCES = 82,
9202f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_RESET_NEEDED = 84,
9212f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_SERIAL_NUMBER = 85,
9222f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_NCSI_CONFIG = 86,
9232f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_NCSI_CONFIG = 87,
9242f345d8eSLuigi Rizzo 	OPCODE_COMMON_CREATE_MQ_EXT = 90,
9252f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_FUNCTION_PRIVILEGES = 100,
9262f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_VF_PORT_TYPE = 101,
9272f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_PHY_CONFIG = 102,
9282f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_FUNCTIONAL_CAPS = 103,
9292f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_ADAPTER_ID = 110,
9302f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_UPGRADE_FEATURES = 111,
9312f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_INSTALLED_FEATURES = 112,
9322f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_AVAIL_PERSONALITIES = 113,
9332f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_CONFIG_PERSONALITIES = 114,
9342f345d8eSLuigi Rizzo 	OPCODE_COMMON_SEND_ACTIVATION = 115,
9352f345d8eSLuigi Rizzo 	OPCODE_COMMON_RESET_LICENSES = 116,
9362f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_CNTL_ADDL_ATTRIBUTES = 121,
9372f345d8eSLuigi Rizzo 	OPCODE_COMMON_QUERY_TCB = 144,
9382f345d8eSLuigi Rizzo 	OPCODE_COMMON_ADD_IFACE_QUEUE_FILTER = 145,
9392f345d8eSLuigi Rizzo 	OPCODE_COMMON_DEL_IFACE_QUEUE_FILTER = 146,
9402f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_IFACE_MAC_LIST = 147,
9412f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_IFACE_MAC_LIST = 148,
9422f345d8eSLuigi Rizzo 	OPCODE_COMMON_MODIFY_CQ = 149,
9432f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_IFACE_VLAN_LIST = 150,
9442f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_IFACE_VLAN_LIST = 151,
9452f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_HSW_CONFIG = 152,
9462f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_HSW_CONFIG = 153,
9472f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_RESOURCE_EXTENT_INFO = 154,
9482f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_ALLOCATED_RESOURCE_EXTENTS = 155,
9492f345d8eSLuigi Rizzo 	OPCODE_COMMON_ALLOC_RESOURCE_EXTENTS = 156,
9502f345d8eSLuigi Rizzo 	OPCODE_COMMON_DEALLOC_RESOURCE_EXTENTS = 157,
9512f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_DIAG_REGISTERS = 158,
9522f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_FUNCTION_CONFIG = 160,
9532f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_PROFILE_CAPACITIES = 161,
9542f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_MR_PROFILE_CAPACITIES = 162,
9552f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_MR_PROFILE_CAPACITIES = 163,
9562f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_PROFILE_CONFIG = 164,
9572f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_PROFILE_CONFIG = 165,
9582f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_PROFILE_LIST = 166,
9592f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_ACTIVE_PROFILE = 167,
9602f345d8eSLuigi Rizzo 	OPCODE_COMMON_SET_ACTIVE_PROFILE = 168,
9612f345d8eSLuigi Rizzo 	OPCODE_COMMON_GET_FUNCTION_PRIVILEGES = 170,
9622f345d8eSLuigi Rizzo 	OPCODE_COMMON_READ_OBJECT = 171,
9632f345d8eSLuigi Rizzo 	OPCODE_COMMON_WRITE_OBJECT = 172
9642f345d8eSLuigi Rizzo };
9652f345d8eSLuigi Rizzo 
9662f345d8eSLuigi Rizzo /* common ioctl header */
9672f345d8eSLuigi Rizzo #define OCE_MBX_VER_V2	0x0002		/* Version V2 mailbox command */
9682f345d8eSLuigi Rizzo #define OCE_MBX_VER_V1	0x0001		/* Version V1 mailbox command */
9692f345d8eSLuigi Rizzo #define OCE_MBX_VER_V0	0x0000		/* Version V0 mailbox command */
9702f345d8eSLuigi Rizzo struct mbx_hdr {
9712f345d8eSLuigi Rizzo 	union {
9722f345d8eSLuigi Rizzo 		uint32_t dw[4];
9732f345d8eSLuigi Rizzo 		struct {
9742f345d8eSLuigi Rizzo 		#ifdef _BIG_ENDIAN
9752f345d8eSLuigi Rizzo 			/* dw 0 */
9762f345d8eSLuigi Rizzo 			uint32_t domain:8;
9772f345d8eSLuigi Rizzo 			uint32_t port_number:8;
9782f345d8eSLuigi Rizzo 			uint32_t subsystem:8;
9792f345d8eSLuigi Rizzo 			uint32_t opcode:8;
9802f345d8eSLuigi Rizzo 			/* dw 1 */
9812f345d8eSLuigi Rizzo 			uint32_t timeout;
9822f345d8eSLuigi Rizzo 			/* dw 2 */
9832f345d8eSLuigi Rizzo 			uint32_t request_length;
9842f345d8eSLuigi Rizzo 			/* dw 3 */
9852f345d8eSLuigi Rizzo 			uint32_t rsvd0:24;
9862f345d8eSLuigi Rizzo 			uint32_t version:8;
9872f345d8eSLuigi Rizzo 		#else
9882f345d8eSLuigi Rizzo 			/* dw 0 */
9892f345d8eSLuigi Rizzo 			uint32_t opcode:8;
9902f345d8eSLuigi Rizzo 			uint32_t subsystem:8;
9912f345d8eSLuigi Rizzo 			uint32_t port_number:8;
9922f345d8eSLuigi Rizzo 			uint32_t domain:8;
9932f345d8eSLuigi Rizzo 			/* dw 1 */
9942f345d8eSLuigi Rizzo 			uint32_t timeout;
9952f345d8eSLuigi Rizzo 			/* dw 2 */
9962f345d8eSLuigi Rizzo 			uint32_t request_length;
9972f345d8eSLuigi Rizzo 			/* dw 3 */
9982f345d8eSLuigi Rizzo 			uint32_t version:8;
9992f345d8eSLuigi Rizzo 			uint32_t rsvd0:24;
10002f345d8eSLuigi Rizzo 		#endif
10012f345d8eSLuigi Rizzo 		} req;
10022f345d8eSLuigi Rizzo 		struct {
10032f345d8eSLuigi Rizzo 		#ifdef _BIG_ENDIAN
10042f345d8eSLuigi Rizzo 			/* dw 0 */
10052f345d8eSLuigi Rizzo 			uint32_t domain:8;
10062f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
10072f345d8eSLuigi Rizzo 			uint32_t subsystem:8;
10082f345d8eSLuigi Rizzo 			uint32_t opcode:8;
10092f345d8eSLuigi Rizzo 			/* dw 1 */
10102f345d8eSLuigi Rizzo 			uint32_t rsvd1:16;
10112f345d8eSLuigi Rizzo 			uint32_t additional_status:8;
10122f345d8eSLuigi Rizzo 			uint32_t status:8;
10132f345d8eSLuigi Rizzo 		#else
10142f345d8eSLuigi Rizzo 			/* dw 0 */
10152f345d8eSLuigi Rizzo 			uint32_t opcode:8;
10162f345d8eSLuigi Rizzo 			uint32_t subsystem:8;
10172f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
10182f345d8eSLuigi Rizzo 			uint32_t domain:8;
10192f345d8eSLuigi Rizzo 			/* dw 1 */
10202f345d8eSLuigi Rizzo 			uint32_t status:8;
10212f345d8eSLuigi Rizzo 			uint32_t additional_status:8;
10222f345d8eSLuigi Rizzo 			uint32_t rsvd1:16;
10232f345d8eSLuigi Rizzo 		#endif
10242f345d8eSLuigi Rizzo 			uint32_t rsp_length;
10252f345d8eSLuigi Rizzo 			uint32_t actual_rsp_length;
10262f345d8eSLuigi Rizzo 		} rsp;
10272f345d8eSLuigi Rizzo 	} u0;
10282f345d8eSLuigi Rizzo };
10292f345d8eSLuigi Rizzo #define	OCE_BMBX_RHDR_SZ 20
10302f345d8eSLuigi Rizzo #define	OCE_MBX_RRHDR_SZ sizeof (struct mbx_hdr)
10312f345d8eSLuigi Rizzo #define	OCE_MBX_ADDL_STATUS(_MHDR) ((_MHDR)->u0.rsp.additional_status)
10322f345d8eSLuigi Rizzo #define	OCE_MBX_STATUS(_MHDR) ((_MHDR)->u0.rsp.status)
10332f345d8eSLuigi Rizzo 
1034a4f734b4SXin LI /* [05] OPCODE_COMMON_QUERY_LINK_CONFIG_V1 */
10352f345d8eSLuigi Rizzo struct mbx_query_common_link_config {
10362f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
10372f345d8eSLuigi Rizzo 	union {
10382f345d8eSLuigi Rizzo 		struct {
10392f345d8eSLuigi Rizzo 			uint32_t rsvd0;
10402f345d8eSLuigi Rizzo 		} req;
10412f345d8eSLuigi Rizzo 
10422f345d8eSLuigi Rizzo 		struct {
1043a4f734b4SXin LI 		#ifdef _BIG_ENDIAN
1044a4f734b4SXin LI 			uint32_t physical_port_fault:8;
1045a4f734b4SXin LI 			uint32_t physical_port_speed:8;
1046a4f734b4SXin LI 			uint32_t link_duplex:8;
1047a4f734b4SXin LI 			uint32_t pt:2;
1048a4f734b4SXin LI 			uint32_t port_number:6;
1049a4f734b4SXin LI 
10502f345d8eSLuigi Rizzo 			uint16_t qos_link_speed;
1051a4f734b4SXin LI 			uint16_t rsvd0;
1052a4f734b4SXin LI 
1053a4f734b4SXin LI 			uint32_t rsvd1:21;
1054a4f734b4SXin LI 			uint32_t phys_fcv:1;
1055a4f734b4SXin LI 			uint32_t phys_rxf:1;
1056a4f734b4SXin LI 			uint32_t phys_txf:1;
1057a4f734b4SXin LI 			uint32_t logical_link_status:8;
1058a4f734b4SXin LI 		#else
1059a4f734b4SXin LI 			uint32_t port_number:6;
1060a4f734b4SXin LI 			uint32_t pt:2;
1061a4f734b4SXin LI 			uint32_t link_duplex:8;
1062a4f734b4SXin LI 			uint32_t physical_port_speed:8;
1063a4f734b4SXin LI 			uint32_t physical_port_fault:8;
1064a4f734b4SXin LI 
1065a4f734b4SXin LI 			uint16_t rsvd0;
1066a4f734b4SXin LI 			uint16_t qos_link_speed;
1067a4f734b4SXin LI 
1068a4f734b4SXin LI 			uint32_t logical_link_status:8;
1069a4f734b4SXin LI 			uint32_t phys_txf:1;
1070a4f734b4SXin LI 			uint32_t phys_rxf:1;
1071a4f734b4SXin LI 			uint32_t phys_fcv:1;
1072a4f734b4SXin LI 			uint32_t rsvd1:21;
1073a4f734b4SXin LI 		#endif
10742f345d8eSLuigi Rizzo 		} rsp;
10752f345d8eSLuigi Rizzo 	} params;
10762f345d8eSLuigi Rizzo };
10772f345d8eSLuigi Rizzo 
10782f345d8eSLuigi Rizzo /* [57] OPCODE_COMMON_SET_LINK_SPEED */
10792f345d8eSLuigi Rizzo struct mbx_set_common_link_speed {
10802f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
10812f345d8eSLuigi Rizzo 	union {
10822f345d8eSLuigi Rizzo 		struct {
10832f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
10842f345d8eSLuigi Rizzo 			uint8_t rsvd0;
10852f345d8eSLuigi Rizzo 			uint8_t mac_speed;
10862f345d8eSLuigi Rizzo 			uint8_t virtual_port;
10872f345d8eSLuigi Rizzo 			uint8_t physical_port;
10882f345d8eSLuigi Rizzo #else
10892f345d8eSLuigi Rizzo 			uint8_t physical_port;
10902f345d8eSLuigi Rizzo 			uint8_t virtual_port;
10912f345d8eSLuigi Rizzo 			uint8_t mac_speed;
10922f345d8eSLuigi Rizzo 			uint8_t rsvd0;
10932f345d8eSLuigi Rizzo #endif
10942f345d8eSLuigi Rizzo 		} req;
10952f345d8eSLuigi Rizzo 
10962f345d8eSLuigi Rizzo 		struct {
10972f345d8eSLuigi Rizzo 			uint32_t rsvd0;
10982f345d8eSLuigi Rizzo 		} rsp;
10992f345d8eSLuigi Rizzo 
11002f345d8eSLuigi Rizzo 		uint32_t dw;
11012f345d8eSLuigi Rizzo 	} params;
11022f345d8eSLuigi Rizzo };
11032f345d8eSLuigi Rizzo 
11042f345d8eSLuigi Rizzo struct mac_address_format {
11052f345d8eSLuigi Rizzo 	uint16_t size_of_struct;
11062f345d8eSLuigi Rizzo 	uint8_t mac_addr[6];
11072f345d8eSLuigi Rizzo };
11082f345d8eSLuigi Rizzo 
11092f345d8eSLuigi Rizzo /* [01] OPCODE_COMMON_QUERY_IFACE_MAC */
11102f345d8eSLuigi Rizzo struct mbx_query_common_iface_mac {
11112f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
11122f345d8eSLuigi Rizzo 	union {
11132f345d8eSLuigi Rizzo 		struct {
11142f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
11152f345d8eSLuigi Rizzo 			uint16_t if_id;
11162f345d8eSLuigi Rizzo 			uint8_t permanent;
11172f345d8eSLuigi Rizzo 			uint8_t type;
11182f345d8eSLuigi Rizzo #else
11192f345d8eSLuigi Rizzo 			uint8_t type;
11202f345d8eSLuigi Rizzo 			uint8_t permanent;
11212f345d8eSLuigi Rizzo 			uint16_t if_id;
11222f345d8eSLuigi Rizzo #endif
11232f345d8eSLuigi Rizzo 
11242f345d8eSLuigi Rizzo 		} req;
11252f345d8eSLuigi Rizzo 
11262f345d8eSLuigi Rizzo 		struct {
11272f345d8eSLuigi Rizzo 			struct mac_address_format mac;
11282f345d8eSLuigi Rizzo 		} rsp;
11292f345d8eSLuigi Rizzo 	} params;
11302f345d8eSLuigi Rizzo };
11312f345d8eSLuigi Rizzo 
11322f345d8eSLuigi Rizzo /* [02] OPCODE_COMMON_SET_IFACE_MAC */
11332f345d8eSLuigi Rizzo struct mbx_set_common_iface_mac {
11342f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
11352f345d8eSLuigi Rizzo 	union {
11362f345d8eSLuigi Rizzo 		struct {
11372f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
11382f345d8eSLuigi Rizzo 			/* dw 0 */
11392f345d8eSLuigi Rizzo 			uint16_t if_id;
11402f345d8eSLuigi Rizzo 			uint8_t invalidate;
11412f345d8eSLuigi Rizzo 			uint8_t type;
11422f345d8eSLuigi Rizzo #else
11432f345d8eSLuigi Rizzo 			/* dw 0 */
11442f345d8eSLuigi Rizzo 			uint8_t type;
11452f345d8eSLuigi Rizzo 			uint8_t invalidate;
11462f345d8eSLuigi Rizzo 			uint16_t if_id;
11472f345d8eSLuigi Rizzo #endif
11482f345d8eSLuigi Rizzo 			/* dw 1 */
11492f345d8eSLuigi Rizzo 			struct mac_address_format mac;
11502f345d8eSLuigi Rizzo 		} req;
11512f345d8eSLuigi Rizzo 
11522f345d8eSLuigi Rizzo 		struct {
11532f345d8eSLuigi Rizzo 			uint32_t rsvd0;
11542f345d8eSLuigi Rizzo 		} rsp;
11552f345d8eSLuigi Rizzo 
11562f345d8eSLuigi Rizzo 		uint32_t dw[2];
11572f345d8eSLuigi Rizzo 	} params;
11582f345d8eSLuigi Rizzo };
11592f345d8eSLuigi Rizzo 
11602f345d8eSLuigi Rizzo /* [03] OPCODE_COMMON_SET_IFACE_MULTICAST */
11612f345d8eSLuigi Rizzo struct mbx_set_common_iface_multicast {
11622f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
11632f345d8eSLuigi Rizzo 	union {
11642f345d8eSLuigi Rizzo 		struct {
11652f345d8eSLuigi Rizzo 			/* dw 0 */
11662f345d8eSLuigi Rizzo 			uint16_t num_mac;
11672f345d8eSLuigi Rizzo 			uint8_t promiscuous;
11682f345d8eSLuigi Rizzo 			uint8_t if_id;
11692f345d8eSLuigi Rizzo 			/* dw 1-48 */
11702f345d8eSLuigi Rizzo 			struct {
11712f345d8eSLuigi Rizzo 				uint8_t byte[6];
11722f345d8eSLuigi Rizzo 			} mac[32];
11732f345d8eSLuigi Rizzo 
11742f345d8eSLuigi Rizzo 		} req;
11752f345d8eSLuigi Rizzo 
11762f345d8eSLuigi Rizzo 		struct {
11772f345d8eSLuigi Rizzo 			uint32_t rsvd0;
11782f345d8eSLuigi Rizzo 		} rsp;
11792f345d8eSLuigi Rizzo 
11802f345d8eSLuigi Rizzo 		uint32_t dw[49];
11812f345d8eSLuigi Rizzo 	} params;
11822f345d8eSLuigi Rizzo };
11832f345d8eSLuigi Rizzo 
11842f345d8eSLuigi Rizzo struct qinq_vlan {
11852f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
11862f345d8eSLuigi Rizzo 	uint16_t inner;
11872f345d8eSLuigi Rizzo 	uint16_t outer;
11882f345d8eSLuigi Rizzo #else
11892f345d8eSLuigi Rizzo 	uint16_t outer;
11902f345d8eSLuigi Rizzo 	uint16_t inner;
11912f345d8eSLuigi Rizzo #endif
11922f345d8eSLuigi Rizzo };
11932f345d8eSLuigi Rizzo 
11942f345d8eSLuigi Rizzo struct normal_vlan {
11952f345d8eSLuigi Rizzo 	uint16_t vtag;
11962f345d8eSLuigi Rizzo };
11972f345d8eSLuigi Rizzo 
11982f345d8eSLuigi Rizzo struct ntwk_if_vlan_tag {
11992f345d8eSLuigi Rizzo 	union {
12002f345d8eSLuigi Rizzo 		struct normal_vlan normal;
12012f345d8eSLuigi Rizzo 		struct qinq_vlan qinq;
12022f345d8eSLuigi Rizzo 	} u0;
12032f345d8eSLuigi Rizzo };
12042f345d8eSLuigi Rizzo 
12052f345d8eSLuigi Rizzo /* [50] OPCODE_COMMON_CREATE_IFACE */
12062f345d8eSLuigi Rizzo struct mbx_create_common_iface {
12072f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
12082f345d8eSLuigi Rizzo 	union {
12092f345d8eSLuigi Rizzo 		struct {
12102f345d8eSLuigi Rizzo 			uint32_t version;
12112f345d8eSLuigi Rizzo 			uint32_t cap_flags;
12122f345d8eSLuigi Rizzo 			uint32_t enable_flags;
12132f345d8eSLuigi Rizzo 			uint8_t mac_addr[6];
12142f345d8eSLuigi Rizzo 			uint8_t rsvd0;
12152f345d8eSLuigi Rizzo 			uint8_t mac_invalid;
12162f345d8eSLuigi Rizzo 			struct ntwk_if_vlan_tag vlan_tag;
12172f345d8eSLuigi Rizzo 		} req;
12182f345d8eSLuigi Rizzo 
12192f345d8eSLuigi Rizzo 		struct {
12202f345d8eSLuigi Rizzo 			uint32_t if_id;
12212f345d8eSLuigi Rizzo 			uint32_t pmac_id;
12222f345d8eSLuigi Rizzo 		} rsp;
12232f345d8eSLuigi Rizzo 		uint32_t dw[4];
12242f345d8eSLuigi Rizzo 	} params;
12252f345d8eSLuigi Rizzo };
12262f345d8eSLuigi Rizzo 
12272f345d8eSLuigi Rizzo /* [51] OPCODE_COMMON_DESTROY_IFACE */
12282f345d8eSLuigi Rizzo struct mbx_destroy_common_iface {
12292f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
12302f345d8eSLuigi Rizzo 	union {
12312f345d8eSLuigi Rizzo 		struct {
12322f345d8eSLuigi Rizzo 			uint32_t if_id;
12332f345d8eSLuigi Rizzo 		} req;
12342f345d8eSLuigi Rizzo 
12352f345d8eSLuigi Rizzo 		struct {
12362f345d8eSLuigi Rizzo 			uint32_t rsvd0;
12372f345d8eSLuigi Rizzo 		} rsp;
12382f345d8eSLuigi Rizzo 
12392f345d8eSLuigi Rizzo 		uint32_t dw;
12402f345d8eSLuigi Rizzo 	} params;
12412f345d8eSLuigi Rizzo };
12422f345d8eSLuigi Rizzo 
12432f345d8eSLuigi Rizzo /* event queue context structure */
12442f345d8eSLuigi Rizzo struct oce_eq_ctx {
12452f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
12462f345d8eSLuigi Rizzo 	uint32_t dw4rsvd1:16;
12472f345d8eSLuigi Rizzo 	uint32_t num_pages:16;
12482f345d8eSLuigi Rizzo 
12492f345d8eSLuigi Rizzo 	uint32_t size:1;
12502f345d8eSLuigi Rizzo 	uint32_t dw5rsvd2:1;
12512f345d8eSLuigi Rizzo 	uint32_t valid:1;
12522f345d8eSLuigi Rizzo 	uint32_t dw5rsvd1:29;
12532f345d8eSLuigi Rizzo 
12542f345d8eSLuigi Rizzo 	uint32_t armed:1;
12552f345d8eSLuigi Rizzo 	uint32_t dw6rsvd2:2;
12562f345d8eSLuigi Rizzo 	uint32_t count:3;
12572f345d8eSLuigi Rizzo 	uint32_t dw6rsvd1:26;
12582f345d8eSLuigi Rizzo 
12592f345d8eSLuigi Rizzo 	uint32_t dw7rsvd2:9;
12602f345d8eSLuigi Rizzo 	uint32_t delay_mult:10;
12612f345d8eSLuigi Rizzo 	uint32_t dw7rsvd1:13;
12622f345d8eSLuigi Rizzo 
12632f345d8eSLuigi Rizzo 	uint32_t dw8rsvd1;
12642f345d8eSLuigi Rizzo #else
12652f345d8eSLuigi Rizzo 	uint32_t num_pages:16;
12662f345d8eSLuigi Rizzo 	uint32_t dw4rsvd1:16;
12672f345d8eSLuigi Rizzo 
12682f345d8eSLuigi Rizzo 	uint32_t dw5rsvd1:29;
12692f345d8eSLuigi Rizzo 	uint32_t valid:1;
12702f345d8eSLuigi Rizzo 	uint32_t dw5rsvd2:1;
12712f345d8eSLuigi Rizzo 	uint32_t size:1;
12722f345d8eSLuigi Rizzo 
12732f345d8eSLuigi Rizzo 	uint32_t dw6rsvd1:26;
12742f345d8eSLuigi Rizzo 	uint32_t count:3;
12752f345d8eSLuigi Rizzo 	uint32_t dw6rsvd2:2;
12762f345d8eSLuigi Rizzo 	uint32_t armed:1;
12772f345d8eSLuigi Rizzo 
12782f345d8eSLuigi Rizzo 	uint32_t dw7rsvd1:13;
12792f345d8eSLuigi Rizzo 	uint32_t delay_mult:10;
12802f345d8eSLuigi Rizzo 	uint32_t dw7rsvd2:9;
12812f345d8eSLuigi Rizzo 
12822f345d8eSLuigi Rizzo 	uint32_t dw8rsvd1;
12832f345d8eSLuigi Rizzo #endif
12842f345d8eSLuigi Rizzo };
12852f345d8eSLuigi Rizzo 
12862f345d8eSLuigi Rizzo /* [13] OPCODE_COMMON_CREATE_EQ */
12872f345d8eSLuigi Rizzo struct mbx_create_common_eq {
12882f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
12892f345d8eSLuigi Rizzo 	union {
12902f345d8eSLuigi Rizzo 		struct {
12912f345d8eSLuigi Rizzo 			struct oce_eq_ctx ctx;
12922f345d8eSLuigi Rizzo 			struct phys_addr pages[8];
12932f345d8eSLuigi Rizzo 		} req;
12942f345d8eSLuigi Rizzo 
12952f345d8eSLuigi Rizzo 		struct {
12962f345d8eSLuigi Rizzo 			uint16_t eq_id;
12972f345d8eSLuigi Rizzo 			uint16_t rsvd0;
12982f345d8eSLuigi Rizzo 		} rsp;
12992f345d8eSLuigi Rizzo 	} params;
13002f345d8eSLuigi Rizzo };
13012f345d8eSLuigi Rizzo 
13022f345d8eSLuigi Rizzo /* [55] OPCODE_COMMON_DESTROY_EQ */
13032f345d8eSLuigi Rizzo struct mbx_destroy_common_eq {
13042f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
13052f345d8eSLuigi Rizzo 	union {
13062f345d8eSLuigi Rizzo 		struct {
13072f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
13082f345d8eSLuigi Rizzo 			uint16_t rsvd0;
13092f345d8eSLuigi Rizzo 			uint16_t id;
13102f345d8eSLuigi Rizzo #else
13112f345d8eSLuigi Rizzo 			uint16_t id;
13122f345d8eSLuigi Rizzo 			uint16_t rsvd0;
13132f345d8eSLuigi Rizzo #endif
13142f345d8eSLuigi Rizzo 		} req;
13152f345d8eSLuigi Rizzo 
13162f345d8eSLuigi Rizzo 		struct {
13172f345d8eSLuigi Rizzo 			uint32_t rsvd0;
13182f345d8eSLuigi Rizzo 		} rsp;
13192f345d8eSLuigi Rizzo 	} params;
13202f345d8eSLuigi Rizzo };
13212f345d8eSLuigi Rizzo 
13222f345d8eSLuigi Rizzo /* SLI-4 CQ context - use version V0 for B3, version V2 for Lancer */
13232f345d8eSLuigi Rizzo typedef union oce_cq_ctx_u {
13242f345d8eSLuigi Rizzo 	uint32_t dw[5];
13252f345d8eSLuigi Rizzo 	struct {
13262f345d8eSLuigi Rizzo 	#ifdef _BIG_ENDIAN
13272f345d8eSLuigi Rizzo 		/* dw4 */
13282f345d8eSLuigi Rizzo 		uint32_t dw4rsvd1:16;
13292f345d8eSLuigi Rizzo 		uint32_t num_pages:16;
13302f345d8eSLuigi Rizzo 		/* dw5 */
13312f345d8eSLuigi Rizzo 		uint32_t eventable:1;
13322f345d8eSLuigi Rizzo 		uint32_t dw5rsvd3:1;
13332f345d8eSLuigi Rizzo 		uint32_t valid:1;
13342f345d8eSLuigi Rizzo 		uint32_t count:2;
13352f345d8eSLuigi Rizzo 		uint32_t dw5rsvd2:12;
13362f345d8eSLuigi Rizzo 		uint32_t nodelay:1;
13372f345d8eSLuigi Rizzo 		uint32_t coalesce_wm:2;
13382f345d8eSLuigi Rizzo 		uint32_t dw5rsvd1:12;
13392f345d8eSLuigi Rizzo 		/* dw6 */
13402f345d8eSLuigi Rizzo 		uint32_t armed:1;
13412f345d8eSLuigi Rizzo 		uint32_t dw6rsvd2:1;
13422f345d8eSLuigi Rizzo 		uint32_t eq_id:8;
13432f345d8eSLuigi Rizzo 		uint32_t dw6rsvd1:22;
13442f345d8eSLuigi Rizzo 	#else
13452f345d8eSLuigi Rizzo 		/* dw4 */
13462f345d8eSLuigi Rizzo 		uint32_t num_pages:16;
13472f345d8eSLuigi Rizzo 		uint32_t dw4rsvd1:16;
13482f345d8eSLuigi Rizzo 		/* dw5 */
13492f345d8eSLuigi Rizzo 		uint32_t dw5rsvd1:12;
13502f345d8eSLuigi Rizzo 		uint32_t coalesce_wm:2;
13512f345d8eSLuigi Rizzo 		uint32_t nodelay:1;
13522f345d8eSLuigi Rizzo 		uint32_t dw5rsvd2:12;
13532f345d8eSLuigi Rizzo 		uint32_t count:2;
13542f345d8eSLuigi Rizzo 		uint32_t valid:1;
13552f345d8eSLuigi Rizzo 		uint32_t dw5rsvd3:1;
13562f345d8eSLuigi Rizzo 		uint32_t eventable:1;
13572f345d8eSLuigi Rizzo 		/* dw6 */
13582f345d8eSLuigi Rizzo 		uint32_t dw6rsvd1:22;
13592f345d8eSLuigi Rizzo 		uint32_t eq_id:8;
13602f345d8eSLuigi Rizzo 		uint32_t dw6rsvd2:1;
13612f345d8eSLuigi Rizzo 		uint32_t armed:1;
13622f345d8eSLuigi Rizzo 	#endif
13632f345d8eSLuigi Rizzo 		/* dw7 */
13642f345d8eSLuigi Rizzo 		uint32_t dw7rsvd1;
13652f345d8eSLuigi Rizzo 		/* dw8 */
13662f345d8eSLuigi Rizzo 		uint32_t dw8rsvd1;
13672f345d8eSLuigi Rizzo 	} v0;
13682f345d8eSLuigi Rizzo 	struct {
13692f345d8eSLuigi Rizzo 	#ifdef _BIG_ENDIAN
13702f345d8eSLuigi Rizzo 		/* dw4 */
13712f345d8eSLuigi Rizzo 		uint32_t dw4rsvd1:8;
13722f345d8eSLuigi Rizzo 		uint32_t page_size:8;
13732f345d8eSLuigi Rizzo 		uint32_t num_pages:16;
13742f345d8eSLuigi Rizzo 		/* dw5 */
13752f345d8eSLuigi Rizzo 		uint32_t eventable:1;
13762f345d8eSLuigi Rizzo 		uint32_t dw5rsvd3:1;
13772f345d8eSLuigi Rizzo 		uint32_t valid:1;
13782f345d8eSLuigi Rizzo 		uint32_t count:2;
13792f345d8eSLuigi Rizzo 		uint32_t dw5rsvd2:11;
13802f345d8eSLuigi Rizzo 		uint32_t autovalid:1;
13812f345d8eSLuigi Rizzo 		uint32_t nodelay:1;
13822f345d8eSLuigi Rizzo 		uint32_t coalesce_wm:2;
13832f345d8eSLuigi Rizzo 		uint32_t dw5rsvd1:12;
13842f345d8eSLuigi Rizzo 		/* dw6 */
13852f345d8eSLuigi Rizzo 		uint32_t armed:1;
13862f345d8eSLuigi Rizzo 		uint32_t dw6rsvd1:15;
13872f345d8eSLuigi Rizzo 		uint32_t eq_id:16;
13882f345d8eSLuigi Rizzo 		/* dw7 */
13892f345d8eSLuigi Rizzo 		uint32_t dw7rsvd1:16;
13902f345d8eSLuigi Rizzo 		uint32_t cqe_count:16;
13912f345d8eSLuigi Rizzo 	#else
13922f345d8eSLuigi Rizzo 		/* dw4 */
13932f345d8eSLuigi Rizzo 		uint32_t num_pages:16;
13942f345d8eSLuigi Rizzo 		uint32_t page_size:8;
13952f345d8eSLuigi Rizzo 		uint32_t dw4rsvd1:8;
13962f345d8eSLuigi Rizzo 		/* dw5 */
13972f345d8eSLuigi Rizzo 		uint32_t dw5rsvd1:12;
13982f345d8eSLuigi Rizzo 		uint32_t coalesce_wm:2;
13992f345d8eSLuigi Rizzo 		uint32_t nodelay:1;
14002f345d8eSLuigi Rizzo 		uint32_t autovalid:1;
14012f345d8eSLuigi Rizzo 		uint32_t dw5rsvd2:11;
14022f345d8eSLuigi Rizzo 		uint32_t count:2;
14032f345d8eSLuigi Rizzo 		uint32_t valid:1;
14042f345d8eSLuigi Rizzo 		uint32_t dw5rsvd3:1;
14052f345d8eSLuigi Rizzo 		uint32_t eventable:1;
14062f345d8eSLuigi Rizzo 		/* dw6 */
1407c2625e6eSJosh Paetzel 		uint32_t eq_id:16;
14082f345d8eSLuigi Rizzo 		uint32_t dw6rsvd1:15;
14092f345d8eSLuigi Rizzo 		uint32_t armed:1;
14102f345d8eSLuigi Rizzo 		/* dw7 */
14112f345d8eSLuigi Rizzo 		uint32_t cqe_count:16;
14122f345d8eSLuigi Rizzo 		uint32_t dw7rsvd1:16;
14132f345d8eSLuigi Rizzo 	#endif
14142f345d8eSLuigi Rizzo 		/* dw8 */
14152f345d8eSLuigi Rizzo 		uint32_t dw8rsvd1;
14162f345d8eSLuigi Rizzo 	} v2;
14172f345d8eSLuigi Rizzo } oce_cq_ctx_t;
14182f345d8eSLuigi Rizzo 
14192f345d8eSLuigi Rizzo /* [12] OPCODE_COMMON_CREATE_CQ */
14202f345d8eSLuigi Rizzo struct mbx_create_common_cq {
14212f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
14222f345d8eSLuigi Rizzo 	union {
14232f345d8eSLuigi Rizzo 		struct {
14242f345d8eSLuigi Rizzo 			oce_cq_ctx_t cq_ctx;
14252f345d8eSLuigi Rizzo 			struct phys_addr pages[4];
14262f345d8eSLuigi Rizzo 		} req;
14272f345d8eSLuigi Rizzo 
14282f345d8eSLuigi Rizzo 		struct {
14292f345d8eSLuigi Rizzo 			uint16_t cq_id;
14302f345d8eSLuigi Rizzo 			uint16_t rsvd0;
14312f345d8eSLuigi Rizzo 		} rsp;
14322f345d8eSLuigi Rizzo 	} params;
14332f345d8eSLuigi Rizzo };
14342f345d8eSLuigi Rizzo 
14352f345d8eSLuigi Rizzo /* [54] OPCODE_COMMON_DESTROY_CQ */
14362f345d8eSLuigi Rizzo struct mbx_destroy_common_cq {
14372f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
14382f345d8eSLuigi Rizzo 	union {
14392f345d8eSLuigi Rizzo 		struct {
14402f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
14412f345d8eSLuigi Rizzo 			uint16_t rsvd0;
14422f345d8eSLuigi Rizzo 			uint16_t id;
14432f345d8eSLuigi Rizzo #else
14442f345d8eSLuigi Rizzo 			uint16_t id;
14452f345d8eSLuigi Rizzo 			uint16_t rsvd0;
14462f345d8eSLuigi Rizzo #endif
14472f345d8eSLuigi Rizzo 		} req;
14482f345d8eSLuigi Rizzo 
14492f345d8eSLuigi Rizzo 		struct {
14502f345d8eSLuigi Rizzo 			uint32_t rsvd0;
14512f345d8eSLuigi Rizzo 		} rsp;
14522f345d8eSLuigi Rizzo 	} params;
14532f345d8eSLuigi Rizzo };
14542f345d8eSLuigi Rizzo 
14552f345d8eSLuigi Rizzo typedef union oce_mq_ctx_u {
14562f345d8eSLuigi Rizzo 	uint32_t dw[5];
14572f345d8eSLuigi Rizzo 	struct {
14582f345d8eSLuigi Rizzo 	#ifdef _BIG_ENDIAN
14592f345d8eSLuigi Rizzo 		/* dw4 */
14602f345d8eSLuigi Rizzo 		uint32_t dw4rsvd1:16;
14612f345d8eSLuigi Rizzo 		uint32_t num_pages:16;
14622f345d8eSLuigi Rizzo 		/* dw5 */
14632f345d8eSLuigi Rizzo 		uint32_t cq_id:10;
14642f345d8eSLuigi Rizzo 		uint32_t dw5rsvd2:2;
14652f345d8eSLuigi Rizzo 		uint32_t ring_size:4;
14662f345d8eSLuigi Rizzo 		uint32_t dw5rsvd1:16;
14672f345d8eSLuigi Rizzo 		/* dw6 */
14682f345d8eSLuigi Rizzo 		uint32_t valid:1;
14692f345d8eSLuigi Rizzo 		uint32_t dw6rsvd1:31;
14702f345d8eSLuigi Rizzo 		/* dw7 */
14712f345d8eSLuigi Rizzo 		uint32_t dw7rsvd1:21;
14722f345d8eSLuigi Rizzo 		uint32_t async_cq_id:10;
14732f345d8eSLuigi Rizzo 		uint32_t async_cq_valid:1;
14742f345d8eSLuigi Rizzo 	#else
14752f345d8eSLuigi Rizzo 		/* dw4 */
14762f345d8eSLuigi Rizzo 		uint32_t num_pages:16;
14772f345d8eSLuigi Rizzo 		uint32_t dw4rsvd1:16;
14782f345d8eSLuigi Rizzo 		/* dw5 */
14792f345d8eSLuigi Rizzo 		uint32_t dw5rsvd1:16;
14802f345d8eSLuigi Rizzo 		uint32_t ring_size:4;
14812f345d8eSLuigi Rizzo 		uint32_t dw5rsvd2:2;
14822f345d8eSLuigi Rizzo 		uint32_t cq_id:10;
14832f345d8eSLuigi Rizzo 		/* dw6 */
14842f345d8eSLuigi Rizzo 		uint32_t dw6rsvd1:31;
14852f345d8eSLuigi Rizzo 		uint32_t valid:1;
14862f345d8eSLuigi Rizzo 		/* dw7 */
14872f345d8eSLuigi Rizzo 		uint32_t async_cq_valid:1;
14882f345d8eSLuigi Rizzo 		uint32_t async_cq_id:10;
14892f345d8eSLuigi Rizzo 		uint32_t dw7rsvd1:21;
14902f345d8eSLuigi Rizzo 	#endif
14912f345d8eSLuigi Rizzo 		/* dw8 */
14922f345d8eSLuigi Rizzo 		uint32_t dw8rsvd1;
14932f345d8eSLuigi Rizzo 	} v0;
14942f345d8eSLuigi Rizzo } oce_mq_ctx_t;
14952f345d8eSLuigi Rizzo 
14962f345d8eSLuigi Rizzo /**
14972f345d8eSLuigi Rizzo  * @brief [21] OPCODE_COMMON_CREATE_MQ
14982f345d8eSLuigi Rizzo  * A MQ must be at least 16 entries deep (corresponding to 1 page) and
14992f345d8eSLuigi Rizzo  * at most 128 entries deep (corresponding to 8 pages).
15002f345d8eSLuigi Rizzo  */
15012f345d8eSLuigi Rizzo struct mbx_create_common_mq {
15022f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
15032f345d8eSLuigi Rizzo 	union {
15042f345d8eSLuigi Rizzo 		struct {
15052f345d8eSLuigi Rizzo 			oce_mq_ctx_t context;
15062f345d8eSLuigi Rizzo 			struct phys_addr pages[8];
15072f345d8eSLuigi Rizzo 		} req;
15082f345d8eSLuigi Rizzo 
15092f345d8eSLuigi Rizzo 		struct {
15102f345d8eSLuigi Rizzo 			uint32_t mq_id:16;
15112f345d8eSLuigi Rizzo 			uint32_t rsvd0:16;
15122f345d8eSLuigi Rizzo 		} rsp;
15132f345d8eSLuigi Rizzo 	} params;
15142f345d8eSLuigi Rizzo };
15152f345d8eSLuigi Rizzo 
15169bd3250aSLuigi Rizzo struct mbx_create_common_mq_ex {
15179bd3250aSLuigi Rizzo 	struct mbx_hdr hdr;
15189bd3250aSLuigi Rizzo 	union {
15199bd3250aSLuigi Rizzo 		struct {
15209bd3250aSLuigi Rizzo 			oce_mq_ext_ctx_t context;
15219bd3250aSLuigi Rizzo 			struct phys_addr pages[8];
15229bd3250aSLuigi Rizzo 		} req;
15239bd3250aSLuigi Rizzo 
15249bd3250aSLuigi Rizzo 		struct {
15259bd3250aSLuigi Rizzo 			uint32_t mq_id:16;
15269bd3250aSLuigi Rizzo 			uint32_t rsvd0:16;
15279bd3250aSLuigi Rizzo 		} rsp;
15289bd3250aSLuigi Rizzo 	} params;
15299bd3250aSLuigi Rizzo };
15309bd3250aSLuigi Rizzo 
15312f345d8eSLuigi Rizzo /* [53] OPCODE_COMMON_DESTROY_MQ */
15322f345d8eSLuigi Rizzo struct mbx_destroy_common_mq {
15332f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
15342f345d8eSLuigi Rizzo 	union {
15352f345d8eSLuigi Rizzo 		struct {
15362f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
15372f345d8eSLuigi Rizzo 			uint16_t rsvd0;
15382f345d8eSLuigi Rizzo 			uint16_t id;
15392f345d8eSLuigi Rizzo #else
15402f345d8eSLuigi Rizzo 			uint16_t id;
15412f345d8eSLuigi Rizzo 			uint16_t rsvd0;
15422f345d8eSLuigi Rizzo #endif
15432f345d8eSLuigi Rizzo 		} req;
15442f345d8eSLuigi Rizzo 
15452f345d8eSLuigi Rizzo 		struct {
15462f345d8eSLuigi Rizzo 			uint32_t rsvd0;
15472f345d8eSLuigi Rizzo 		} rsp;
15482f345d8eSLuigi Rizzo 	} params;
15492f345d8eSLuigi Rizzo };
15502f345d8eSLuigi Rizzo 
15512f345d8eSLuigi Rizzo /* [35] OPCODE_COMMON_GET_ FW_VERSION */
15522f345d8eSLuigi Rizzo struct mbx_get_common_fw_version {
15532f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
15542f345d8eSLuigi Rizzo 	union {
15552f345d8eSLuigi Rizzo 		struct {
15562f345d8eSLuigi Rizzo 			uint32_t rsvd0;
15572f345d8eSLuigi Rizzo 		} req;
15582f345d8eSLuigi Rizzo 
15592f345d8eSLuigi Rizzo 		struct {
15602f345d8eSLuigi Rizzo 			uint8_t fw_ver_str[32];
15612f345d8eSLuigi Rizzo 			uint8_t fw_on_flash_ver_str[32];
15622f345d8eSLuigi Rizzo 		} rsp;
15632f345d8eSLuigi Rizzo 	} params;
15642f345d8eSLuigi Rizzo };
15652f345d8eSLuigi Rizzo 
15662f345d8eSLuigi Rizzo /* [52] OPCODE_COMMON_CEV_MODIFY_MSI_MESSAGES */
15672f345d8eSLuigi Rizzo struct mbx_common_cev_modify_msi_messages {
15682f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
15692f345d8eSLuigi Rizzo 	union {
15702f345d8eSLuigi Rizzo 		struct {
15712f345d8eSLuigi Rizzo 			uint32_t num_msi_msgs;
15722f345d8eSLuigi Rizzo 		} req;
15732f345d8eSLuigi Rizzo 
15742f345d8eSLuigi Rizzo 		struct {
15752f345d8eSLuigi Rizzo 			uint32_t rsvd0;
15762f345d8eSLuigi Rizzo 		} rsp;
15772f345d8eSLuigi Rizzo 	} params;
15782f345d8eSLuigi Rizzo };
15792f345d8eSLuigi Rizzo 
15802f345d8eSLuigi Rizzo /* [36] OPCODE_COMMON_SET_FLOW_CONTROL */
15812f345d8eSLuigi Rizzo /* [37] OPCODE_COMMON_GET_FLOW_CONTROL */
15822f345d8eSLuigi Rizzo struct mbx_common_get_set_flow_control {
15832f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
15842f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
15852f345d8eSLuigi Rizzo 	uint16_t tx_flow_control;
15862f345d8eSLuigi Rizzo 	uint16_t rx_flow_control;
15872f345d8eSLuigi Rizzo #else
15882f345d8eSLuigi Rizzo 	uint16_t rx_flow_control;
15892f345d8eSLuigi Rizzo 	uint16_t tx_flow_control;
15902f345d8eSLuigi Rizzo #endif
15912f345d8eSLuigi Rizzo };
15922f345d8eSLuigi Rizzo 
15932f345d8eSLuigi Rizzo enum e_flash_opcode {
15942f345d8eSLuigi Rizzo 	MGMT_FLASHROM_OPCODE_FLASH = 1,
15952f345d8eSLuigi Rizzo 	MGMT_FLASHROM_OPCODE_SAVE = 2
15962f345d8eSLuigi Rizzo };
15972f345d8eSLuigi Rizzo 
15982f345d8eSLuigi Rizzo /* [06]	OPCODE_READ_COMMON_FLASHROM */
15992f345d8eSLuigi Rizzo /* [07]	OPCODE_WRITE_COMMON_FLASHROM */
16002f345d8eSLuigi Rizzo 
16012f345d8eSLuigi Rizzo struct mbx_common_read_write_flashrom {
16022f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
16032f345d8eSLuigi Rizzo 	uint32_t flash_op_code;
16042f345d8eSLuigi Rizzo 	uint32_t flash_op_type;
16052f345d8eSLuigi Rizzo 	uint32_t data_buffer_size;
16062f345d8eSLuigi Rizzo 	uint32_t data_offset;
1607d8f7bfb8SXin LI 	uint8_t  data_buffer[32768];	/* + IMAGE_TRANSFER_SIZE */
1608d8f7bfb8SXin LI 	uint8_t  rsvd[4];
16092f345d8eSLuigi Rizzo };
16102f345d8eSLuigi Rizzo 
16112f345d8eSLuigi Rizzo struct oce_phy_info {
16122f345d8eSLuigi Rizzo 	uint16_t phy_type;
16132f345d8eSLuigi Rizzo 	uint16_t interface_type;
16142f345d8eSLuigi Rizzo 	uint32_t misc_params;
16152f345d8eSLuigi Rizzo 	uint16_t ext_phy_details;
16162f345d8eSLuigi Rizzo 	uint16_t rsvd;
16172f345d8eSLuigi Rizzo 	uint16_t auto_speeds_supported;
16182f345d8eSLuigi Rizzo 	uint16_t fixed_speeds_supported;
16192f345d8eSLuigi Rizzo 	uint32_t future_use[2];
16202f345d8eSLuigi Rizzo };
16212f345d8eSLuigi Rizzo 
16222f345d8eSLuigi Rizzo struct mbx_common_phy_info {
16232f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
16242f345d8eSLuigi Rizzo 	union {
16252f345d8eSLuigi Rizzo 		struct {
16262f345d8eSLuigi Rizzo 			uint32_t rsvd0[4];
16272f345d8eSLuigi Rizzo 		} req;
16282f345d8eSLuigi Rizzo 		struct {
16292f345d8eSLuigi Rizzo 			struct oce_phy_info phy_info;
16302f345d8eSLuigi Rizzo 		} rsp;
16312f345d8eSLuigi Rizzo 	} params;
16322f345d8eSLuigi Rizzo };
16332f345d8eSLuigi Rizzo 
16342f345d8eSLuigi Rizzo /*Lancer firmware*/
16352f345d8eSLuigi Rizzo 
16362f345d8eSLuigi Rizzo struct mbx_lancer_common_write_object {
16372f345d8eSLuigi Rizzo 	union {
16382f345d8eSLuigi Rizzo 		struct {
16392f345d8eSLuigi Rizzo 			struct	 mbx_hdr hdr;
16402f345d8eSLuigi Rizzo 			uint32_t write_length: 24;
16412f345d8eSLuigi Rizzo 			uint32_t rsvd: 7;
16422f345d8eSLuigi Rizzo 			uint32_t eof: 1;
16432f345d8eSLuigi Rizzo 			uint32_t write_offset;
16442f345d8eSLuigi Rizzo 			uint8_t  object_name[104];
16452f345d8eSLuigi Rizzo 			uint32_t descriptor_count;
16462f345d8eSLuigi Rizzo 			uint32_t buffer_length;
16472f345d8eSLuigi Rizzo 			uint32_t address_lower;
16482f345d8eSLuigi Rizzo 			uint32_t address_upper;
16492f345d8eSLuigi Rizzo 		} req;
16502f345d8eSLuigi Rizzo 		struct {
16512f345d8eSLuigi Rizzo 			uint8_t  opcode;
16522f345d8eSLuigi Rizzo 			uint8_t  subsystem;
16532f345d8eSLuigi Rizzo 			uint8_t  rsvd1[2];
16542f345d8eSLuigi Rizzo 			uint8_t  status;
16552f345d8eSLuigi Rizzo 			uint8_t  additional_status;
16562f345d8eSLuigi Rizzo 			uint8_t  rsvd2[2];
16572f345d8eSLuigi Rizzo 			uint32_t response_length;
16582f345d8eSLuigi Rizzo 			uint32_t actual_response_length;
16592f345d8eSLuigi Rizzo 			uint32_t actual_write_length;
16602f345d8eSLuigi Rizzo 		} rsp;
16612f345d8eSLuigi Rizzo 	} params;
16622f345d8eSLuigi Rizzo };
16632f345d8eSLuigi Rizzo 
16642f345d8eSLuigi Rizzo /**
16652f345d8eSLuigi Rizzo  * @brief MBX Common Quiery Firmaware Config
16662f345d8eSLuigi Rizzo  * This command retrieves firmware configuration parameters and adapter
16672f345d8eSLuigi Rizzo  * resources available to the driver originating the request. The firmware
16682f345d8eSLuigi Rizzo  * configuration defines supported protocols by the installed adapter firmware.
16692f345d8eSLuigi Rizzo  * This includes which ULP processors support the specified protocols and
16702f345d8eSLuigi Rizzo  * the number of TCP connections allowed for that protocol.
16712f345d8eSLuigi Rizzo  */
16722f345d8eSLuigi Rizzo struct mbx_common_query_fw_config {
16732f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
16742f345d8eSLuigi Rizzo 	union {
16752f345d8eSLuigi Rizzo 		struct {
16762f345d8eSLuigi Rizzo 			uint32_t rsvd0[30];
16772f345d8eSLuigi Rizzo 		} req;
16782f345d8eSLuigi Rizzo 
16792f345d8eSLuigi Rizzo 		struct {
16802f345d8eSLuigi Rizzo 			uint32_t config_number;
16812f345d8eSLuigi Rizzo 			uint32_t asic_revision;
16822f345d8eSLuigi Rizzo 			uint32_t port_id;	/* used for stats retrieval */
16832f345d8eSLuigi Rizzo 			uint32_t function_mode;
16842f345d8eSLuigi Rizzo 			struct {
16852f345d8eSLuigi Rizzo 				uint32_t ulp_mode;
16862f345d8eSLuigi Rizzo 				uint32_t nic_wqid_base;
16872f345d8eSLuigi Rizzo 				uint32_t nic_wq_tot;
16882f345d8eSLuigi Rizzo 				uint32_t toe_wqid_base;
16892f345d8eSLuigi Rizzo 				uint32_t toe_wq_tot;
16902f345d8eSLuigi Rizzo 				uint32_t toe_rqid_base;
16912f345d8eSLuigi Rizzo 				uint32_t toe_rqid_tot;
16922f345d8eSLuigi Rizzo 				uint32_t toe_defrqid_base;
16932f345d8eSLuigi Rizzo 				uint32_t toe_defrqid_count;
16942f345d8eSLuigi Rizzo 				uint32_t lro_rqid_base;
16952f345d8eSLuigi Rizzo 				uint32_t lro_rqid_tot;
16962f345d8eSLuigi Rizzo 				uint32_t iscsi_icd_base;
16972f345d8eSLuigi Rizzo 				uint32_t iscsi_icd_count;
16982f345d8eSLuigi Rizzo 			} ulp[2];
16992f345d8eSLuigi Rizzo 			uint32_t function_caps;
17002f345d8eSLuigi Rizzo 			uint32_t cqid_base;
17012f345d8eSLuigi Rizzo 			uint32_t cqid_tot;
17022f345d8eSLuigi Rizzo 			uint32_t eqid_base;
17032f345d8eSLuigi Rizzo 			uint32_t eqid_tot;
17042f345d8eSLuigi Rizzo 		} rsp;
17052f345d8eSLuigi Rizzo 	} params;
17062f345d8eSLuigi Rizzo };
17072f345d8eSLuigi Rizzo 
17082f345d8eSLuigi Rizzo enum CQFW_CONFIG_NUMBER {
17092f345d8eSLuigi Rizzo 	FCN_NIC_ISCSI_Initiator = 0x0,
17102f345d8eSLuigi Rizzo 	FCN_ISCSI_Target = 0x3,
17112f345d8eSLuigi Rizzo 	FCN_FCoE = 0x7,
17122f345d8eSLuigi Rizzo 	FCN_ISCSI_Initiator_Target = 0x9,
17132f345d8eSLuigi Rizzo 	FCN_NIC_RDMA_TOE = 0xA,
17142f345d8eSLuigi Rizzo 	FCN_NIC_RDMA_FCoE = 0xB,
17152f345d8eSLuigi Rizzo 	FCN_NIC_RDMA_iSCSI = 0xC,
17162f345d8eSLuigi Rizzo 	FCN_NIC_iSCSI_FCoE = 0xD
17172f345d8eSLuigi Rizzo };
17182f345d8eSLuigi Rizzo 
17192f345d8eSLuigi Rizzo /**
17202f345d8eSLuigi Rizzo  * @brief Function Capabilites
17212f345d8eSLuigi Rizzo  * This field contains the flags indicating the capabilities of
17222f345d8eSLuigi Rizzo  * the SLI Host’s PCI function.
17232f345d8eSLuigi Rizzo  */
17242f345d8eSLuigi Rizzo enum CQFW_FUNCTION_CAPABILITIES {
17252f345d8eSLuigi Rizzo 	FNC_UNCLASSIFIED_STATS = 0x1,
17262f345d8eSLuigi Rizzo 	FNC_RSS = 0x2,
17272f345d8eSLuigi Rizzo 	FNC_PROMISCUOUS = 0x4,
17282f345d8eSLuigi Rizzo 	FNC_LEGACY_MODE = 0x8,
17292f345d8eSLuigi Rizzo 	FNC_HDS = 0x4000,
17302f345d8eSLuigi Rizzo 	FNC_VMQ = 0x10000,
17312f345d8eSLuigi Rizzo 	FNC_NETQ = 0x20000,
17322f345d8eSLuigi Rizzo 	FNC_QGROUPS = 0x40000,
17332f345d8eSLuigi Rizzo 	FNC_LRO = 0x100000,
17342f345d8eSLuigi Rizzo 	FNC_VLAN_OFFLOAD = 0x800000
17352f345d8eSLuigi Rizzo };
17362f345d8eSLuigi Rizzo 
17372f345d8eSLuigi Rizzo enum CQFW_ULP_MODES_SUPPORTED {
17382f345d8eSLuigi Rizzo 	ULP_TOE_MODE = 0x1,
17392f345d8eSLuigi Rizzo 	ULP_NIC_MODE = 0x2,
17402f345d8eSLuigi Rizzo 	ULP_RDMA_MODE = 0x4,
17412f345d8eSLuigi Rizzo 	ULP_ISCSI_INI_MODE = 0x10,
17422f345d8eSLuigi Rizzo 	ULP_ISCSI_TGT_MODE = 0x20,
17432f345d8eSLuigi Rizzo 	ULP_FCOE_INI_MODE = 0x40,
17442f345d8eSLuigi Rizzo 	ULP_FCOE_TGT_MODE = 0x80,
17452f345d8eSLuigi Rizzo 	ULP_DAL_MODE = 0x100,
17462f345d8eSLuigi Rizzo 	ULP_LRO_MODE = 0x200
17472f345d8eSLuigi Rizzo };
17482f345d8eSLuigi Rizzo 
17492f345d8eSLuigi Rizzo /**
17502f345d8eSLuigi Rizzo  * @brief Function Modes Supported
17512f345d8eSLuigi Rizzo  * Valid function modes (or protocol-types) supported on the SLI-Host’s
17522f345d8eSLuigi Rizzo  * PCIe function.  This field is a logical OR of the following values:
17532f345d8eSLuigi Rizzo  */
17542f345d8eSLuigi Rizzo enum CQFW_FUNCTION_MODES_SUPPORTED {
17552f345d8eSLuigi Rizzo 	FNM_TOE_MODE = 0x1,		/* TCP offload supported */
17562f345d8eSLuigi Rizzo 	FNM_NIC_MODE = 0x2,		/* Raw Ethernet supported */
17572f345d8eSLuigi Rizzo 	FNM_RDMA_MODE = 0x4,		/* RDMA protocol supported */
17582f345d8eSLuigi Rizzo 	FNM_VM_MODE = 0x8,		/* Virtual Machines supported  */
17592f345d8eSLuigi Rizzo 	FNM_ISCSI_INI_MODE = 0x10,	/* iSCSI initiator supported */
17602f345d8eSLuigi Rizzo 	FNM_ISCSI_TGT_MODE = 0x20,	/* iSCSI target plus initiator */
17612f345d8eSLuigi Rizzo 	FNM_FCOE_INI_MODE = 0x40,	/* FCoE Initiator supported */
17622f345d8eSLuigi Rizzo 	FNM_FCOE_TGT_MODE = 0x80,	/* FCoE target supported */
17632f345d8eSLuigi Rizzo 	FNM_DAL_MODE = 0x100,		/* DAL supported */
17642f345d8eSLuigi Rizzo 	FNM_LRO_MODE = 0x200,		/* LRO supported */
17652f345d8eSLuigi Rizzo 	FNM_FLEX10_MODE = 0x400,	/* QinQ, FLEX-10 or VNIC */
17662f345d8eSLuigi Rizzo 	FNM_NCSI_MODE = 0x800,		/* NCSI supported */
17672f345d8eSLuigi Rizzo 	FNM_IPV6_MODE = 0x1000,		/* IPV6 stack enabled */
17682f345d8eSLuigi Rizzo 	FNM_BE2_COMPAT_MODE = 0x2000,	/* BE2 compatibility (BE3 disable)*/
17692f345d8eSLuigi Rizzo 	FNM_INVALID_MODE = 0x8000,	/* Invalid */
17702f345d8eSLuigi Rizzo 	FNM_BE3_COMPAT_MODE = 0x10000,	/* BE3 features */
17712f345d8eSLuigi Rizzo 	FNM_VNIC_MODE = 0x20000,	/* Set when IBM vNIC mode is set */
17722f345d8eSLuigi Rizzo 	FNM_VNTAG_MODE = 0x40000, 	/* Set when VNTAG mode is set */
17739bd3250aSLuigi Rizzo 	FNM_UMC_MODE = 0x1000000,	/* Set when UMC mode is set */
17742f345d8eSLuigi Rizzo 	FNM_UMC_DEF_EN = 0x100000,	/* Set when UMC Default is set */
17752f345d8eSLuigi Rizzo 	FNM_ONE_GB_EN = 0x200000,	/* Set when 1GB Default is set */
17762f345d8eSLuigi Rizzo 	FNM_VNIC_DEF_VALID = 0x400000,	/* Set when VNIC_DEF_EN is valid */
17772f345d8eSLuigi Rizzo 	FNM_VNIC_DEF_EN = 0x800000	/* Set when VNIC Default enabled */
17782f345d8eSLuigi Rizzo };
17792f345d8eSLuigi Rizzo 
17802f345d8eSLuigi Rizzo struct mbx_common_config_vlan {
17812f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
17822f345d8eSLuigi Rizzo 	union {
17832f345d8eSLuigi Rizzo 		struct {
17842f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
17852f345d8eSLuigi Rizzo 			uint8_t num_vlans;
17862f345d8eSLuigi Rizzo 			uint8_t untagged;
17872f345d8eSLuigi Rizzo 			uint8_t promisc;
17882f345d8eSLuigi Rizzo 			uint8_t if_id;
17892f345d8eSLuigi Rizzo #else
17902f345d8eSLuigi Rizzo 			uint8_t if_id;
17912f345d8eSLuigi Rizzo 			uint8_t promisc;
17922f345d8eSLuigi Rizzo 			uint8_t untagged;
17932f345d8eSLuigi Rizzo 			uint8_t num_vlans;
17942f345d8eSLuigi Rizzo #endif
17952f345d8eSLuigi Rizzo 			union {
17962f345d8eSLuigi Rizzo 				struct normal_vlan normal_vlans[64];
17972f345d8eSLuigi Rizzo 				struct qinq_vlan qinq_vlans[32];
17982f345d8eSLuigi Rizzo 			} tags;
17992f345d8eSLuigi Rizzo 		} req;
18002f345d8eSLuigi Rizzo 
18012f345d8eSLuigi Rizzo 		struct {
18022f345d8eSLuigi Rizzo 			uint32_t rsvd;
18032f345d8eSLuigi Rizzo 		} rsp;
18042f345d8eSLuigi Rizzo 	} params;
18052f345d8eSLuigi Rizzo };
18062f345d8eSLuigi Rizzo 
18072f345d8eSLuigi Rizzo typedef struct iface_rx_filter_ctx {
18082f345d8eSLuigi Rizzo 	uint32_t global_flags_mask;
18092f345d8eSLuigi Rizzo 	uint32_t global_flags;
18102f345d8eSLuigi Rizzo 	uint32_t iface_flags_mask;
18112f345d8eSLuigi Rizzo 	uint32_t iface_flags;
18122f345d8eSLuigi Rizzo 	uint32_t if_id;
18132f345d8eSLuigi Rizzo 	#define IFACE_RX_NUM_MCAST_MAX		64
18142f345d8eSLuigi Rizzo 	uint32_t num_mcast;
18152f345d8eSLuigi Rizzo 	struct mbx_mcast_addr {
18162f345d8eSLuigi Rizzo 		uint8_t byte[6];
18172f345d8eSLuigi Rizzo 	} mac[IFACE_RX_NUM_MCAST_MAX];
18182f345d8eSLuigi Rizzo } iface_rx_filter_ctx_t;
18192f345d8eSLuigi Rizzo 
18202f345d8eSLuigi Rizzo /* [34] OPCODE_COMMON_SET_IFACE_RX_FILTER */
18212f345d8eSLuigi Rizzo struct mbx_set_common_iface_rx_filter {
18222f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
18232f345d8eSLuigi Rizzo 	union {
18242f345d8eSLuigi Rizzo 		iface_rx_filter_ctx_t req;
18252f345d8eSLuigi Rizzo 		iface_rx_filter_ctx_t rsp;
18262f345d8eSLuigi Rizzo 	} params;
18272f345d8eSLuigi Rizzo };
18282f345d8eSLuigi Rizzo 
1829cdaba892SXin LI struct be_set_eqd {
1830cdaba892SXin LI 	uint32_t eq_id;
1831cdaba892SXin LI 	uint32_t phase;
1832cdaba892SXin LI 	uint32_t dm;
1833cdaba892SXin LI };
1834cdaba892SXin LI 
18352f345d8eSLuigi Rizzo /* [41] OPCODE_COMMON_MODIFY_EQ_DELAY */
18362f345d8eSLuigi Rizzo struct mbx_modify_common_eq_delay {
18372f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
18382f345d8eSLuigi Rizzo 	union {
18392f345d8eSLuigi Rizzo 		struct {
18402f345d8eSLuigi Rizzo 			uint32_t num_eq;
18412f345d8eSLuigi Rizzo 			struct {
18422f345d8eSLuigi Rizzo 				uint32_t eq_id;
18432f345d8eSLuigi Rizzo 				uint32_t phase;
18442f345d8eSLuigi Rizzo 				uint32_t dm;
18452f345d8eSLuigi Rizzo 			} delay[8];
18462f345d8eSLuigi Rizzo 		} req;
18472f345d8eSLuigi Rizzo 
18482f345d8eSLuigi Rizzo 		struct {
18492f345d8eSLuigi Rizzo 			uint32_t rsvd0;
18502f345d8eSLuigi Rizzo 		} rsp;
18512f345d8eSLuigi Rizzo 	} params;
18522f345d8eSLuigi Rizzo };
18532f345d8eSLuigi Rizzo 
1854cdaba892SXin LI /* [32] OPCODE_COMMON_GET_CNTL_ATTRIBUTES */
1855cdaba892SXin LI 
1856cdaba892SXin LI struct mgmt_hba_attr {
1857cdaba892SXin LI 	int8_t   flashrom_ver_str[32];
1858cdaba892SXin LI 	int8_t   manufac_name[32];
1859cdaba892SXin LI 	uint32_t supp_modes;
1860cdaba892SXin LI 	int8_t   seeprom_ver_lo;
1861cdaba892SXin LI 	int8_t   seeprom_ver_hi;
1862cdaba892SXin LI 	int8_t   rsvd0[2];
1863cdaba892SXin LI 	uint32_t ioctl_data_struct_ver;
1864cdaba892SXin LI 	uint32_t ep_fw_data_struct_ver;
1865cdaba892SXin LI 	uint8_t  ncsi_ver_str[12];
1866cdaba892SXin LI 	uint32_t def_ext_to;
1867cdaba892SXin LI 	int8_t   cntl_mod_num[32];
1868cdaba892SXin LI 	int8_t   cntl_desc[64];
1869cdaba892SXin LI 	int8_t   cntl_ser_num[32];
1870cdaba892SXin LI 	int8_t   ip_ver_str[32];
1871cdaba892SXin LI 	int8_t   fw_ver_str[32];
1872cdaba892SXin LI 	int8_t   bios_ver_str[32];
1873cdaba892SXin LI 	int8_t   redboot_ver_str[32];
1874cdaba892SXin LI 	int8_t   drv_ver_str[32];
1875cdaba892SXin LI 	int8_t   fw_on_flash_ver_str[32];
1876cdaba892SXin LI 	uint32_t funcs_supp;
1877cdaba892SXin LI 	uint16_t max_cdblen;
1878cdaba892SXin LI 	uint8_t  asic_rev;
1879cdaba892SXin LI 	uint8_t  gen_guid[16];
1880cdaba892SXin LI 	uint8_t  hba_port_count;
1881cdaba892SXin LI 	uint16_t default_link_down_timeout;
1882cdaba892SXin LI 	uint8_t  iscsi_ver_min_max;
1883cdaba892SXin LI 	uint8_t  multifunc_dev;
1884cdaba892SXin LI 	uint8_t  cache_valid;
1885cdaba892SXin LI 	uint8_t  hba_status;
1886cdaba892SXin LI 	uint8_t  max_domains_supp;
1887cdaba892SXin LI 	uint8_t  phy_port;
1888cdaba892SXin LI 	uint32_t fw_post_status;
1889cdaba892SXin LI 	uint32_t hba_mtu[8];
1890cdaba892SXin LI 	uint8_t  iSCSI_feat;
1891cdaba892SXin LI 	uint8_t  asic_gen;
1892cdaba892SXin LI 	uint8_t  future_u8[2];
1893cdaba892SXin LI 	uint32_t future_u32[3];
1894cdaba892SXin LI };
1895cdaba892SXin LI 
1896cdaba892SXin LI struct mgmt_cntl_attr {
1897cdaba892SXin LI 	struct    mgmt_hba_attr hba_attr;
1898cdaba892SXin LI 	uint16_t  pci_vendor_id;
1899cdaba892SXin LI 	uint16_t  pci_device_id;
1900cdaba892SXin LI 	uint16_t  pci_sub_vendor_id;
1901cdaba892SXin LI 	uint16_t  pci_sub_system_id;
1902cdaba892SXin LI 	uint8_t   pci_bus_num;
1903cdaba892SXin LI 	uint8_t   pci_dev_num;
1904cdaba892SXin LI 	uint8_t   pci_func_num;
1905cdaba892SXin LI 	uint8_t   interface_type;
1906cdaba892SXin LI 	uint64_t  unique_id;
1907cdaba892SXin LI 	uint8_t   netfilters;
1908cdaba892SXin LI 	uint8_t   rsvd0[3];
1909cdaba892SXin LI 	uint32_t  future_u32[4];
1910cdaba892SXin LI };
1911cdaba892SXin LI 
1912cdaba892SXin LI struct mbx_common_get_cntl_attr {
1913cdaba892SXin LI 	struct mbx_hdr hdr;
1914cdaba892SXin LI 	union {
1915cdaba892SXin LI 		struct {
1916cdaba892SXin LI 			uint32_t rsvd0;
1917cdaba892SXin LI 		} req;
1918cdaba892SXin LI 		struct {
1919cdaba892SXin LI 			struct mgmt_cntl_attr cntl_attr_info;
1920cdaba892SXin LI 		} rsp;
1921cdaba892SXin LI 	} params;
1922cdaba892SXin LI };
1923cdaba892SXin LI 
19242f345d8eSLuigi Rizzo /* [59] OPCODE_ADD_COMMON_IFACE_MAC */
19252f345d8eSLuigi Rizzo struct mbx_add_common_iface_mac {
19262f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
19272f345d8eSLuigi Rizzo 	union {
19282f345d8eSLuigi Rizzo 		struct {
19292f345d8eSLuigi Rizzo 			uint32_t if_id;
19302f345d8eSLuigi Rizzo 			uint8_t mac_address[6];
19312f345d8eSLuigi Rizzo 			uint8_t rsvd0[2];
19322f345d8eSLuigi Rizzo 		} req;
19332f345d8eSLuigi Rizzo 		struct {
19342f345d8eSLuigi Rizzo 			uint32_t pmac_id;
19352f345d8eSLuigi Rizzo 		} rsp;
19362f345d8eSLuigi Rizzo 	} params;
19372f345d8eSLuigi Rizzo };
19382f345d8eSLuigi Rizzo 
19392f345d8eSLuigi Rizzo /* [60] OPCODE_DEL_COMMON_IFACE_MAC */
19402f345d8eSLuigi Rizzo struct mbx_del_common_iface_mac {
19412f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
19422f345d8eSLuigi Rizzo 	union {
19432f345d8eSLuigi Rizzo 		struct {
19442f345d8eSLuigi Rizzo 			uint32_t if_id;
19452f345d8eSLuigi Rizzo 			uint32_t pmac_id;
19462f345d8eSLuigi Rizzo 		} req;
19472f345d8eSLuigi Rizzo 		struct {
19482f345d8eSLuigi Rizzo 			uint32_t rsvd0;
19492f345d8eSLuigi Rizzo 		} rsp;
19502f345d8eSLuigi Rizzo 	} params;
19512f345d8eSLuigi Rizzo };
19522f345d8eSLuigi Rizzo 
19532f345d8eSLuigi Rizzo /* [8] OPCODE_QUERY_COMMON_MAX_MBX_BUFFER_SIZE */
19542f345d8eSLuigi Rizzo struct mbx_query_common_max_mbx_buffer_size {
19552f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
19562f345d8eSLuigi Rizzo 	struct {
19572f345d8eSLuigi Rizzo 		uint32_t max_ioctl_bufsz;
19582f345d8eSLuigi Rizzo 	} rsp;
19592f345d8eSLuigi Rizzo };
19602f345d8eSLuigi Rizzo 
19612f345d8eSLuigi Rizzo /* [61] OPCODE_COMMON_FUNCTION_RESET */
19622f345d8eSLuigi Rizzo struct ioctl_common_function_reset {
19632f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
19642f345d8eSLuigi Rizzo };
19652f345d8eSLuigi Rizzo 
1966cdaba892SXin LI /* [73] OPCODE_COMMON_READ_TRANSRECEIVER_DATA */
1967cdaba892SXin LI struct mbx_read_common_transrecv_data {
1968cdaba892SXin LI 	struct mbx_hdr hdr;
1969cdaba892SXin LI 	union {
1970cdaba892SXin LI 		struct {
1971cdaba892SXin LI 			uint32_t    page_num;
1972cdaba892SXin LI 			uint32_t    port;
1973cdaba892SXin LI 		} req;
1974cdaba892SXin LI 		struct {
1975cdaba892SXin LI 			uint32_t    page_num;
1976cdaba892SXin LI 			uint32_t    port;
1977cdaba892SXin LI 			uint32_t    page_data[32];
1978cdaba892SXin LI 		} rsp;
1979cdaba892SXin LI 	} params;
1980cdaba892SXin LI 
1981cdaba892SXin LI };
1982cdaba892SXin LI 
19832f345d8eSLuigi Rizzo /* [80] OPCODE_COMMON_FUNCTION_LINK_CONFIG */
19842f345d8eSLuigi Rizzo struct mbx_common_func_link_cfg {
19852f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
19862f345d8eSLuigi Rizzo 	union {
19872f345d8eSLuigi Rizzo 		struct {
19882f345d8eSLuigi Rizzo 			uint32_t enable;
19892f345d8eSLuigi Rizzo 		} req;
19902f345d8eSLuigi Rizzo 		struct {
19912f345d8eSLuigi Rizzo 			uint32_t rsvd0;
19922f345d8eSLuigi Rizzo 		} rsp;
19932f345d8eSLuigi Rizzo 	} params;
19942f345d8eSLuigi Rizzo };
19952f345d8eSLuigi Rizzo 
19962f345d8eSLuigi Rizzo /* [103] OPCODE_COMMON_SET_FUNCTIONAL_CAPS */
19972f345d8eSLuigi Rizzo #define CAP_SW_TIMESTAMPS	2
19982f345d8eSLuigi Rizzo #define CAP_BE3_NATIVE_ERX_API	4
19992f345d8eSLuigi Rizzo 
20002f345d8eSLuigi Rizzo struct mbx_common_set_function_cap {
20012f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
20022f345d8eSLuigi Rizzo 	union {
20032f345d8eSLuigi Rizzo 		struct {
20042f345d8eSLuigi Rizzo 			uint32_t valid_capability_flags;
20052f345d8eSLuigi Rizzo 			uint32_t capability_flags;
20062f345d8eSLuigi Rizzo 			uint8_t  sbz[212];
20072f345d8eSLuigi Rizzo 		} req;
20082f345d8eSLuigi Rizzo 		struct {
20092f345d8eSLuigi Rizzo 			uint32_t valid_capability_flags;
20102f345d8eSLuigi Rizzo 			uint32_t capability_flags;
20112f345d8eSLuigi Rizzo 			uint8_t  sbz[212];
20122f345d8eSLuigi Rizzo 		} rsp;
20132f345d8eSLuigi Rizzo 	} params;
20142f345d8eSLuigi Rizzo };
20152f345d8eSLuigi Rizzo struct mbx_lowlevel_test_loopback_mode {
20162f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
20172f345d8eSLuigi Rizzo 	union {
20182f345d8eSLuigi Rizzo 		struct {
20192f345d8eSLuigi Rizzo 			uint32_t loopback_type;
20202f345d8eSLuigi Rizzo 			uint32_t num_pkts;
20212f345d8eSLuigi Rizzo 			uint64_t pattern;
20222f345d8eSLuigi Rizzo 			uint32_t src_port;
20232f345d8eSLuigi Rizzo 			uint32_t dest_port;
20242f345d8eSLuigi Rizzo 			uint32_t pkt_size;
20252f345d8eSLuigi Rizzo 		}req;
20262f345d8eSLuigi Rizzo 		struct {
20272f345d8eSLuigi Rizzo 			uint32_t    status;
20282f345d8eSLuigi Rizzo 			uint32_t    num_txfer;
20292f345d8eSLuigi Rizzo 			uint32_t    num_rx;
20302f345d8eSLuigi Rizzo 			uint32_t    miscomp_off;
20312f345d8eSLuigi Rizzo 			uint32_t    ticks_compl;
20322f345d8eSLuigi Rizzo 		}rsp;
20332f345d8eSLuigi Rizzo 	} params;
20342f345d8eSLuigi Rizzo };
20352f345d8eSLuigi Rizzo 
20362f345d8eSLuigi Rizzo struct mbx_lowlevel_set_loopback_mode {
20372f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
20382f345d8eSLuigi Rizzo 	union {
20392f345d8eSLuigi Rizzo 		struct {
20402f345d8eSLuigi Rizzo 			uint8_t src_port;
20412f345d8eSLuigi Rizzo 			uint8_t dest_port;
20422f345d8eSLuigi Rizzo 			uint8_t loopback_type;
20432f345d8eSLuigi Rizzo 			uint8_t loopback_state;
20442f345d8eSLuigi Rizzo 		} req;
20452f345d8eSLuigi Rizzo 		struct {
20462f345d8eSLuigi Rizzo 			uint8_t rsvd0[4];
20472f345d8eSLuigi Rizzo 		} rsp;
20482f345d8eSLuigi Rizzo 	} params;
20492f345d8eSLuigi Rizzo };
2050291a1934SXin LI #define MAX_RESC_DESC				256
2051291a1934SXin LI #define RESC_DESC_SIZE				88
2052291a1934SXin LI #define ACTIVE_PROFILE				2
2053291a1934SXin LI #define NIC_RESC_DESC_TYPE_V0			0x41
2054291a1934SXin LI #define NIC_RESC_DESC_TYPE_V1			0x51
2055291a1934SXin LI /* OPCODE_COMMON_GET_FUNCTION_CONFIG */
2056291a1934SXin LI struct mbx_common_get_func_config {
2057291a1934SXin LI 	struct mbx_hdr hdr;
2058291a1934SXin LI 	union {
2059291a1934SXin LI 		struct {
2060291a1934SXin LI 			uint8_t rsvd;
2061291a1934SXin LI 			uint8_t type;
2062291a1934SXin LI 			uint16_t rsvd1;
2063291a1934SXin LI 		} req;
2064291a1934SXin LI 		struct {
2065291a1934SXin LI 			uint32_t desc_count;
2066291a1934SXin LI 			uint8_t resources[MAX_RESC_DESC * RESC_DESC_SIZE];
2067291a1934SXin LI 		} rsp;
2068291a1934SXin LI 	} params;
2069291a1934SXin LI };
2070291a1934SXin LI 
2071291a1934SXin LI /* OPCODE_COMMON_GET_PROFILE_CONFIG */
2072291a1934SXin LI 
2073291a1934SXin LI struct mbx_common_get_profile_config {
2074291a1934SXin LI 	struct mbx_hdr hdr;
2075291a1934SXin LI 	union {
2076291a1934SXin LI 		struct {
2077291a1934SXin LI 			uint8_t rsvd;
2078291a1934SXin LI 			uint8_t type;
2079291a1934SXin LI 			uint16_t rsvd1;
2080291a1934SXin LI 		} req;
2081291a1934SXin LI 		struct {
2082291a1934SXin LI 			uint32_t desc_count;
2083291a1934SXin LI 			uint8_t resources[MAX_RESC_DESC * RESC_DESC_SIZE];
2084291a1934SXin LI 		} rsp;
2085291a1934SXin LI 	} params;
2086291a1934SXin LI };
2087291a1934SXin LI 
2088291a1934SXin LI struct oce_nic_resc_desc {
2089291a1934SXin LI 	uint8_t desc_type;
2090291a1934SXin LI 	uint8_t desc_len;
2091291a1934SXin LI 	uint8_t rsvd1;
2092291a1934SXin LI 	uint8_t flags;
2093291a1934SXin LI 	uint8_t vf_num;
2094291a1934SXin LI 	uint8_t rsvd2;
2095291a1934SXin LI 	uint8_t pf_num;
2096291a1934SXin LI 	uint8_t rsvd3;
2097291a1934SXin LI 	uint16_t unicast_mac_count;
2098291a1934SXin LI 	uint8_t rsvd4[6];
2099291a1934SXin LI 	uint16_t mcc_count;
2100291a1934SXin LI 	uint16_t vlan_count;
2101291a1934SXin LI 	uint16_t mcast_mac_count;
2102291a1934SXin LI 	uint16_t txq_count;
2103291a1934SXin LI 	uint16_t rq_count;
2104291a1934SXin LI 	uint16_t rssq_count;
2105291a1934SXin LI 	uint16_t lro_count;
2106291a1934SXin LI 	uint16_t cq_count;
2107291a1934SXin LI 	uint16_t toe_conn_count;
2108291a1934SXin LI 	uint16_t eq_count;
2109291a1934SXin LI 	uint32_t rsvd5;
2110291a1934SXin LI 	uint32_t cap_flags;
2111291a1934SXin LI 	uint8_t link_param;
2112291a1934SXin LI 	uint8_t rsvd6[3];
2113291a1934SXin LI 	uint32_t bw_min;
2114291a1934SXin LI 	uint32_t bw_max;
2115291a1934SXin LI 	uint8_t acpi_params;
2116291a1934SXin LI 	uint8_t wol_param;
2117291a1934SXin LI 	uint16_t rsvd7;
2118291a1934SXin LI 	uint32_t rsvd8[7];
2119291a1934SXin LI 
2120291a1934SXin LI };
2121291a1934SXin LI 
21222f345d8eSLuigi Rizzo struct flash_file_hdr {
21232f345d8eSLuigi Rizzo 	uint8_t  sign[52];
21242f345d8eSLuigi Rizzo 	uint8_t  ufi_version[4];
21252f345d8eSLuigi Rizzo 	uint32_t file_len;
21262f345d8eSLuigi Rizzo 	uint32_t cksum;
21272f345d8eSLuigi Rizzo 	uint32_t antidote;
21282f345d8eSLuigi Rizzo 	uint32_t num_imgs;
21292f345d8eSLuigi Rizzo 	uint8_t  build[24];
21305fbb6830SXin LI 	uint8_t  asic_type_rev;
21315fbb6830SXin LI 	uint8_t  rsvd[31];
21322f345d8eSLuigi Rizzo };
21332f345d8eSLuigi Rizzo 
21342f345d8eSLuigi Rizzo struct image_hdr {
21352f345d8eSLuigi Rizzo 	uint32_t imageid;
21362f345d8eSLuigi Rizzo 	uint32_t imageoffset;
21372f345d8eSLuigi Rizzo 	uint32_t imagelength;
21382f345d8eSLuigi Rizzo 	uint32_t image_checksum;
21392f345d8eSLuigi Rizzo 	uint8_t  image_version[32];
21402f345d8eSLuigi Rizzo };
21412f345d8eSLuigi Rizzo 
21422f345d8eSLuigi Rizzo struct flash_section_hdr {
21432f345d8eSLuigi Rizzo 	uint32_t format_rev;
21442f345d8eSLuigi Rizzo 	uint32_t cksum;
21452f345d8eSLuigi Rizzo 	uint32_t antidote;
21462f345d8eSLuigi Rizzo 	uint32_t num_images;
21472f345d8eSLuigi Rizzo 	uint8_t  id_string[128];
21482f345d8eSLuigi Rizzo 	uint32_t rsvd[4];
21492f345d8eSLuigi Rizzo };
21502f345d8eSLuigi Rizzo 
21512f345d8eSLuigi Rizzo struct flash_section_entry {
21522f345d8eSLuigi Rizzo 	uint32_t type;
21532f345d8eSLuigi Rizzo 	uint32_t offset;
21542f345d8eSLuigi Rizzo 	uint32_t pad_size;
21552f345d8eSLuigi Rizzo 	uint32_t image_size;
21562f345d8eSLuigi Rizzo 	uint32_t cksum;
21572f345d8eSLuigi Rizzo 	uint32_t entry_point;
21582f345d8eSLuigi Rizzo 	uint32_t rsvd0;
21592f345d8eSLuigi Rizzo 	uint32_t rsvd1;
21602f345d8eSLuigi Rizzo 	uint8_t  ver_data[32];
21612f345d8eSLuigi Rizzo };
21622f345d8eSLuigi Rizzo 
21632f345d8eSLuigi Rizzo struct flash_sec_info {
21642f345d8eSLuigi Rizzo 	uint8_t cookie[32];
21652f345d8eSLuigi Rizzo 	struct  flash_section_hdr fsec_hdr;
21662f345d8eSLuigi Rizzo 	struct  flash_section_entry fsec_entry[32];
21672f345d8eSLuigi Rizzo };
21682f345d8eSLuigi Rizzo 
21692f345d8eSLuigi Rizzo enum LOWLEVEL_SUBSYSTEM_OPCODES {
21702f345d8eSLuigi Rizzo /* Opcodes used for lowlevel functions common to many subystems.
21712f345d8eSLuigi Rizzo  * Some of these opcodes are used for diagnostic functions only.
21722f345d8eSLuigi Rizzo  * These opcodes use the MBX_SUBSYSTEM_LOWLEVEL subsystem code.
21732f345d8eSLuigi Rizzo  */
21742f345d8eSLuigi Rizzo 	OPCODE_LOWLEVEL_TEST_LOOPBACK = 18,
21752f345d8eSLuigi Rizzo 	OPCODE_LOWLEVEL_SET_LOOPBACK_MODE = 19,
21762f345d8eSLuigi Rizzo 	OPCODE_LOWLEVEL_GET_LOOPBACK_MODE = 20
21772f345d8eSLuigi Rizzo };
21782f345d8eSLuigi Rizzo 
21792f345d8eSLuigi Rizzo enum LLDP_SUBSYSTEM_OPCODES {
21802f345d8eSLuigi Rizzo /* Opcodes used for LLDP susbsytem for configuring the LLDP state machines. */
21812f345d8eSLuigi Rizzo 	OPCODE_LLDP_GET_CFG = 1,
21822f345d8eSLuigi Rizzo 	OPCODE_LLDP_SET_CFG = 2,
21832f345d8eSLuigi Rizzo 	OPCODE_LLDP_GET_STATS = 3
21842f345d8eSLuigi Rizzo };
21852f345d8eSLuigi Rizzo 
21862f345d8eSLuigi Rizzo enum DCBX_SUBSYSTEM_OPCODES {
21872f345d8eSLuigi Rizzo /* Opcodes used for DCBX. */
21882f345d8eSLuigi Rizzo 	OPCODE_DCBX_GET_CFG = 1,
21892f345d8eSLuigi Rizzo 	OPCODE_DCBX_SET_CFG = 2,
21902f345d8eSLuigi Rizzo 	OPCODE_DCBX_GET_MIB_INFO = 3,
21912f345d8eSLuigi Rizzo 	OPCODE_DCBX_GET_DCBX_MODE = 4,
21922f345d8eSLuigi Rizzo 	OPCODE_DCBX_SET_MODE = 5
21932f345d8eSLuigi Rizzo };
21942f345d8eSLuigi Rizzo 
21952f345d8eSLuigi Rizzo enum DMTF_SUBSYSTEM_OPCODES {
21962f345d8eSLuigi Rizzo /* Opcodes used for DCBX subsystem. */
21972f345d8eSLuigi Rizzo 	OPCODE_DMTF_EXEC_CLP_CMD = 1
21982f345d8eSLuigi Rizzo };
21992f345d8eSLuigi Rizzo 
22002f345d8eSLuigi Rizzo enum DIAG_SUBSYSTEM_OPCODES {
22012f345d8eSLuigi Rizzo /* Opcodes used for diag functions common to many subsystems. */
22022f345d8eSLuigi Rizzo 	OPCODE_DIAG_RUN_DMA_TEST = 1,
22032f345d8eSLuigi Rizzo 	OPCODE_DIAG_RUN_MDIO_TEST = 2,
22042f345d8eSLuigi Rizzo 	OPCODE_DIAG_RUN_NLB_TEST = 3,
22052f345d8eSLuigi Rizzo 	OPCODE_DIAG_RUN_ARM_TIMER_TEST = 4,
22062f345d8eSLuigi Rizzo 	OPCODE_DIAG_GET_MAC = 5
22072f345d8eSLuigi Rizzo };
22082f345d8eSLuigi Rizzo 
22092f345d8eSLuigi Rizzo enum VENDOR_SUBSYSTEM_OPCODES {
22102f345d8eSLuigi Rizzo /* Opcodes used for Vendor subsystem. */
22112f345d8eSLuigi Rizzo 	OPCODE_VENDOR_SLI = 1
22122f345d8eSLuigi Rizzo };
22132f345d8eSLuigi Rizzo 
22142f345d8eSLuigi Rizzo /* Management Status Codes */
22152f345d8eSLuigi Rizzo enum MGMT_STATUS_SUCCESS {
22162f345d8eSLuigi Rizzo 	MGMT_SUCCESS = 0,
22172f345d8eSLuigi Rizzo 	MGMT_FAILED = 1,
22182f345d8eSLuigi Rizzo 	MGMT_ILLEGAL_REQUEST = 2,
22192f345d8eSLuigi Rizzo 	MGMT_ILLEGAL_FIELD = 3,
22202f345d8eSLuigi Rizzo 	MGMT_INSUFFICIENT_BUFFER = 4,
22212f345d8eSLuigi Rizzo 	MGMT_UNAUTHORIZED_REQUEST = 5,
22222f345d8eSLuigi Rizzo 	MGMT_INVALID_ISNS_ADDRESS = 10,
22232f345d8eSLuigi Rizzo 	MGMT_INVALID_IPADDR = 11,
22242f345d8eSLuigi Rizzo 	MGMT_INVALID_GATEWAY = 12,
22252f345d8eSLuigi Rizzo 	MGMT_INVALID_SUBNETMASK = 13,
22262f345d8eSLuigi Rizzo 	MGMT_INVALID_TARGET_IPADDR = 16,
22272f345d8eSLuigi Rizzo 	MGMT_TGTTBL_FULL = 20,
22282f345d8eSLuigi Rizzo 	MGMT_FLASHROM_SAVE_FAILED = 23,
22292f345d8eSLuigi Rizzo 	MGMT_IOCTLHANDLE_ALLOC_FAILED = 27,
22302f345d8eSLuigi Rizzo 	MGMT_INVALID_SESSION = 31,
22312f345d8eSLuigi Rizzo 	MGMT_INVALID_CONNECTION = 32,
22322f345d8eSLuigi Rizzo 	MGMT_BTL_PATH_EXCEEDS_OSM_LIMIT = 33,
22332f345d8eSLuigi Rizzo 	MGMT_BTL_TGTID_EXCEEDS_OSM_LIMIT = 34,
22342f345d8eSLuigi Rizzo 	MGMT_BTL_PATH_TGTID_OCCUPIED = 35,
22352f345d8eSLuigi Rizzo 	MGMT_BTL_NO_FREE_SLOT_PATH = 36,
22362f345d8eSLuigi Rizzo 	MGMT_BTL_NO_FREE_SLOT_TGTID = 37,
22372f345d8eSLuigi Rizzo 	MGMT_POLL_IOCTL_TIMEOUT = 40,
22382f345d8eSLuigi Rizzo 	MGMT_ERROR_ACITISCSI = 41,
22392f345d8eSLuigi Rizzo 	MGMT_BUFFER_SIZE_EXCEED_OSM_OR_OS_LIMIT = 43,
22402f345d8eSLuigi Rizzo 	MGMT_REBOOT_REQUIRED = 44,
22412f345d8eSLuigi Rizzo 	MGMT_INSUFFICIENT_TIMEOUT = 45,
22422f345d8eSLuigi Rizzo 	MGMT_IPADDR_NOT_SET = 46,
22432f345d8eSLuigi Rizzo 	MGMT_IPADDR_DUP_DETECTED = 47,
22442f345d8eSLuigi Rizzo 	MGMT_CANT_REMOVE_LAST_CONNECTION = 48,
22452f345d8eSLuigi Rizzo 	MGMT_TARGET_BUSY = 49,
22462f345d8eSLuigi Rizzo 	MGMT_TGT_ERR_LISTEN_SOCKET = 50,
22472f345d8eSLuigi Rizzo 	MGMT_TGT_ERR_BIND_SOCKET = 51,
22482f345d8eSLuigi Rizzo 	MGMT_TGT_ERR_NO_SOCKET = 52,
22492f345d8eSLuigi Rizzo 	MGMT_TGT_ERR_ISNS_COMM_FAILED = 55,
22502f345d8eSLuigi Rizzo 	MGMT_CANNOT_DELETE_BOOT_TARGET = 56,
22512f345d8eSLuigi Rizzo 	MGMT_TGT_PORTAL_MODE_IN_LISTEN = 57,
22522f345d8eSLuigi Rizzo 	MGMT_FCF_IN_USE = 58 ,
22532f345d8eSLuigi Rizzo 	MGMT_NO_CQE = 59,
22542f345d8eSLuigi Rizzo 	MGMT_TARGET_NOT_FOUND = 65,
22552f345d8eSLuigi Rizzo 	MGMT_NOT_SUPPORTED = 66,
22562f345d8eSLuigi Rizzo 	MGMT_NO_FCF_RECORDS = 67,
22572f345d8eSLuigi Rizzo 	MGMT_FEATURE_NOT_SUPPORTED = 68,
22582f345d8eSLuigi Rizzo 	MGMT_VPD_FUNCTION_OUT_OF_RANGE = 69,
22592f345d8eSLuigi Rizzo 	MGMT_VPD_FUNCTION_TYPE_INCORRECT = 70,
22602f345d8eSLuigi Rizzo 	MGMT_INVALID_NON_EMBEDDED_WRB = 71,
22612f345d8eSLuigi Rizzo 	MGMT_OOR = 100,
22622f345d8eSLuigi Rizzo 	MGMT_INVALID_PD = 101,
22632f345d8eSLuigi Rizzo 	MGMT_STATUS_PD_INUSE = 102,
22642f345d8eSLuigi Rizzo 	MGMT_INVALID_CQ = 103,
22652f345d8eSLuigi Rizzo 	MGMT_INVALID_QP = 104,
22662f345d8eSLuigi Rizzo 	MGMT_INVALID_STAG = 105,
22672f345d8eSLuigi Rizzo 	MGMT_ORD_EXCEEDS = 106,
22682f345d8eSLuigi Rizzo 	MGMT_IRD_EXCEEDS = 107,
22692f345d8eSLuigi Rizzo 	MGMT_SENDQ_WQE_EXCEEDS = 108,
22702f345d8eSLuigi Rizzo 	MGMT_RECVQ_RQE_EXCEEDS = 109,
22712f345d8eSLuigi Rizzo 	MGMT_SGE_SEND_EXCEEDS = 110,
22722f345d8eSLuigi Rizzo 	MGMT_SGE_WRITE_EXCEEDS = 111,
22732f345d8eSLuigi Rizzo 	MGMT_SGE_RECV_EXCEEDS = 112,
22742f345d8eSLuigi Rizzo 	MGMT_INVALID_STATE_CHANGE = 113,
22752f345d8eSLuigi Rizzo 	MGMT_MW_BOUND = 114,
22762f345d8eSLuigi Rizzo 	MGMT_INVALID_VA = 115,
22772f345d8eSLuigi Rizzo 	MGMT_INVALID_LENGTH = 116,
22782f345d8eSLuigi Rizzo 	MGMT_INVALID_FBO = 117,
22792f345d8eSLuigi Rizzo 	MGMT_INVALID_ACC_RIGHTS = 118,
22802f345d8eSLuigi Rizzo 	MGMT_INVALID_PBE_SIZE = 119,
22812f345d8eSLuigi Rizzo 	MGMT_INVALID_PBL_ENTRY = 120,
22822f345d8eSLuigi Rizzo 	MGMT_INVALID_PBL_OFFSET = 121,
22832f345d8eSLuigi Rizzo 	MGMT_ADDR_NON_EXIST = 122,
22842f345d8eSLuigi Rizzo 	MGMT_INVALID_VLANID = 123,
22852f345d8eSLuigi Rizzo 	MGMT_INVALID_MTU = 124,
22862f345d8eSLuigi Rizzo 	MGMT_INVALID_BACKLOG = 125,
22872f345d8eSLuigi Rizzo 	MGMT_CONNECTION_INPROGRESS = 126,
22882f345d8eSLuigi Rizzo 	MGMT_INVALID_RQE_SIZE = 127,
22892f345d8eSLuigi Rizzo 	MGMT_INVALID_RQE_ENTRY = 128
22902f345d8eSLuigi Rizzo };
22912f345d8eSLuigi Rizzo 
22922f345d8eSLuigi Rizzo /* Additional Management Status Codes */
22932f345d8eSLuigi Rizzo enum MGMT_ADDI_STATUS {
22942f345d8eSLuigi Rizzo 	MGMT_ADDI_NO_STATUS = 0,
22952f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_IPTYPE = 1,
22962f345d8eSLuigi Rizzo 	MGMT_ADDI_TARGET_HANDLE_NOT_FOUND = 9,
22972f345d8eSLuigi Rizzo 	MGMT_ADDI_SESSION_HANDLE_NOT_FOUND = 10,
22982f345d8eSLuigi Rizzo 	MGMT_ADDI_CONNECTION_HANDLE_NOT_FOUND = 11,
22992f345d8eSLuigi Rizzo 	MGMT_ADDI_ACTIVE_SESSIONS_PRESENT = 16,
23002f345d8eSLuigi Rizzo 	MGMT_ADDI_SESSION_ALREADY_OPENED = 17,
23012f345d8eSLuigi Rizzo 	MGMT_ADDI_SESSION_ALREADY_CLOSED = 18,
23022f345d8eSLuigi Rizzo 	MGMT_ADDI_DEST_HOST_UNREACHABLE = 19,
23032f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_IN_PROGRESS = 20,
23042f345d8eSLuigi Rizzo 	MGMT_ADDI_TCP_CONNECT_FAILED = 21,
23052f345d8eSLuigi Rizzo 	MGMT_ADDI_INSUFFICIENT_RESOURCES = 22,
23062f345d8eSLuigi Rizzo 	MGMT_ADDI_LINK_DOWN = 23,
23072f345d8eSLuigi Rizzo 	MGMT_ADDI_DHCP_ERROR = 24,
23082f345d8eSLuigi Rizzo 	MGMT_ADDI_CONNECTION_OFFLOADED = 25,
23092f345d8eSLuigi Rizzo 	MGMT_ADDI_CONNECTION_NOT_OFFLOADED = 26,
23102f345d8eSLuigi Rizzo 	MGMT_ADDI_CONNECTION_UPLOAD_IN_PROGRESS = 27,
23112f345d8eSLuigi Rizzo 	MGMT_ADDI_REQUEST_REJECTED = 28,
23122f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_SUBSYSTEM = 29,
23132f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_OPCODE = 30,
23142f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_MAXCONNECTION_PARAM = 31,
23152f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_KEY = 32,
23162f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_DOMAIN = 35,
23172f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_INITIATOR_ERROR = 43,
23182f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_AUTHENTICATION_ERROR = 44,
23192f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_AUTHORIZATION_ERROR = 45,
23202f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_NOT_FOUND = 46,
23212f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_TARGET_REMOVED = 47,
23222f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_UNSUPPORTED_VERSION = 48,
23232f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_TOO_MANY_CONNECTIONS = 49,
23242f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_MISSING_PARAMETER = 50,
23252f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_NO_SESSION_SPANNING = 51,
23262f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_SESSION_TYPE_NOT_SUPPORTED = 52,
23272f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_SESSION_DOES_NOT_EXIST = 53,
23282f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_INVALID_DURING_LOGIN = 54,
23292f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_TARGET_ERROR = 55,
23302f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_SERVICE_UNAVAILABLE = 56,
23312f345d8eSLuigi Rizzo 	MGMT_ADDI_LOGIN_OUT_OF_RESOURCES = 57,
23322f345d8eSLuigi Rizzo 	MGMT_ADDI_SAME_CHAP_SECRET = 58,
23332f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_SECRET_LENGTH = 59,
23342f345d8eSLuigi Rizzo 	MGMT_ADDI_DUPLICATE_ENTRY = 60,
23352f345d8eSLuigi Rizzo 	MGMT_ADDI_SETTINGS_MODIFIED_REBOOT_REQD = 63,
23362f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_EXTENDED_TIMEOUT = 64,
23372f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_INTERFACE_HANDLE = 65,
23382f345d8eSLuigi Rizzo 	MGMT_ADDI_ERR_VLAN_ON_DEF_INTERFACE = 66,
23392f345d8eSLuigi Rizzo 	MGMT_ADDI_INTERFACE_DOES_NOT_EXIST = 67,
23402f345d8eSLuigi Rizzo 	MGMT_ADDI_INTERFACE_ALREADY_EXISTS = 68,
23412f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_VLAN_RANGE = 69,
23422f345d8eSLuigi Rizzo 	MGMT_ADDI_ERR_SET_VLAN = 70,
23432f345d8eSLuigi Rizzo 	MGMT_ADDI_ERR_DEL_VLAN = 71,
23442f345d8eSLuigi Rizzo 	MGMT_ADDI_CANNOT_DEL_DEF_INTERFACE = 72,
23452f345d8eSLuigi Rizzo 	MGMT_ADDI_DHCP_REQ_ALREADY_PENDING = 73,
23462f345d8eSLuigi Rizzo 	MGMT_ADDI_TOO_MANY_INTERFACES = 74,
23472f345d8eSLuigi Rizzo 	MGMT_ADDI_INVALID_REQUEST = 75
23482f345d8eSLuigi Rizzo };
23492f345d8eSLuigi Rizzo 
23502f345d8eSLuigi Rizzo enum NIC_SUBSYSTEM_OPCODES {
23512f345d8eSLuigi Rizzo /**
23522f345d8eSLuigi Rizzo  * @brief NIC Subsystem Opcodes (see Network SLI-4 manual >= Rev4, v21-2)
23532f345d8eSLuigi Rizzo  * These opcodes are used for configuring the Ethernet interfaces.
23542f345d8eSLuigi Rizzo  * These opcodes all use the MBX_SUBSYSTEM_NIC subsystem code.
23552f345d8eSLuigi Rizzo  */
23562f345d8eSLuigi Rizzo 	NIC_CONFIG_RSS = 1,
23572f345d8eSLuigi Rizzo 	NIC_CONFIG_ACPI = 2,
23582f345d8eSLuigi Rizzo 	NIC_CONFIG_PROMISCUOUS = 3,
23592f345d8eSLuigi Rizzo 	NIC_GET_STATS = 4,
23602f345d8eSLuigi Rizzo 	NIC_CREATE_WQ = 7,
23612f345d8eSLuigi Rizzo 	NIC_CREATE_RQ = 8,
23622f345d8eSLuigi Rizzo 	NIC_DELETE_WQ = 9,
23632f345d8eSLuigi Rizzo 	NIC_DELETE_RQ = 10,
23642f345d8eSLuigi Rizzo 	NIC_CONFIG_ACPI_WOL_MAGIC = 12,
23652f345d8eSLuigi Rizzo 	NIC_GET_NETWORK_STATS = 13,
23662f345d8eSLuigi Rizzo 	NIC_CREATE_HDS_RQ = 16,
23672f345d8eSLuigi Rizzo 	NIC_DELETE_HDS_RQ = 17,
23682f345d8eSLuigi Rizzo 	NIC_GET_PPORT_STATS = 18,
23692f345d8eSLuigi Rizzo 	NIC_GET_VPORT_STATS = 19,
23702f345d8eSLuigi Rizzo 	NIC_GET_QUEUE_STATS = 20
23712f345d8eSLuigi Rizzo };
23722f345d8eSLuigi Rizzo 
23732f345d8eSLuigi Rizzo /* Hash option flags for RSS enable */
23742f345d8eSLuigi Rizzo enum RSS_ENABLE_FLAGS {
23752f345d8eSLuigi Rizzo 	RSS_ENABLE_NONE 	= 0x0,	/* (No RSS) */
23762f345d8eSLuigi Rizzo 	RSS_ENABLE_IPV4 	= 0x1,	/* (IPV4 HASH enabled ) */
23772f345d8eSLuigi Rizzo 	RSS_ENABLE_TCP_IPV4 	= 0x2,	/* (TCP IPV4 Hash enabled) */
23782f345d8eSLuigi Rizzo 	RSS_ENABLE_IPV6 	= 0x4,	/* (IPV6 HASH enabled) */
2379cdaba892SXin LI 	RSS_ENABLE_TCP_IPV6 	= 0x8,	/* (TCP IPV6 HASH */
2380cdaba892SXin LI 	RSS_ENABLE_UDP_IPV4	= 0x10, /* UDP IPV4 HASH */
2381cdaba892SXin LI 	RSS_ENABLE_UDP_IPV6	= 0x20  /* UDP IPV6 HASH */
23822f345d8eSLuigi Rizzo };
23832f345d8eSLuigi Rizzo #define RSS_ENABLE (RSS_ENABLE_IPV4 | RSS_ENABLE_TCP_IPV4)
23842f345d8eSLuigi Rizzo #define RSS_DISABLE RSS_ENABLE_NONE
23852f345d8eSLuigi Rizzo 
23862f345d8eSLuigi Rizzo /* NIC header WQE */
23872f345d8eSLuigi Rizzo struct oce_nic_hdr_wqe {
23882f345d8eSLuigi Rizzo 	union {
23892f345d8eSLuigi Rizzo 		struct {
23902f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
23912f345d8eSLuigi Rizzo 			/* dw0 */
23922f345d8eSLuigi Rizzo 			uint32_t rsvd0;
23932f345d8eSLuigi Rizzo 
23942f345d8eSLuigi Rizzo 			/* dw1 */
23952f345d8eSLuigi Rizzo 			uint32_t last_seg_udp_len:14;
23962f345d8eSLuigi Rizzo 			uint32_t rsvd1:18;
23972f345d8eSLuigi Rizzo 
23982f345d8eSLuigi Rizzo 			/* dw2 */
23992f345d8eSLuigi Rizzo 			uint32_t lso_mss:14;
24002f345d8eSLuigi Rizzo 			uint32_t num_wqe:5;
24012f345d8eSLuigi Rizzo 			uint32_t rsvd4:2;
24022f345d8eSLuigi Rizzo 			uint32_t vlan:1;
24032f345d8eSLuigi Rizzo 			uint32_t lso:1;
24042f345d8eSLuigi Rizzo 			uint32_t tcpcs:1;
24052f345d8eSLuigi Rizzo 			uint32_t udpcs:1;
24062f345d8eSLuigi Rizzo 			uint32_t ipcs:1;
2407c2625e6eSJosh Paetzel 			uint32_t mgmt:1;
2408c2625e6eSJosh Paetzel 			uint32_t lso6:1;
24092f345d8eSLuigi Rizzo 			uint32_t forward:1;
24102f345d8eSLuigi Rizzo 			uint32_t crc:1;
24112f345d8eSLuigi Rizzo 			uint32_t event:1;
24122f345d8eSLuigi Rizzo 			uint32_t complete:1;
24132f345d8eSLuigi Rizzo 
24142f345d8eSLuigi Rizzo 			/* dw3 */
24152f345d8eSLuigi Rizzo 			uint32_t vlan_tag:16;
24162f345d8eSLuigi Rizzo 			uint32_t total_length:16;
24172f345d8eSLuigi Rizzo #else
24182f345d8eSLuigi Rizzo 			/* dw0 */
24192f345d8eSLuigi Rizzo 			uint32_t rsvd0;
24202f345d8eSLuigi Rizzo 
24212f345d8eSLuigi Rizzo 			/* dw1 */
24222f345d8eSLuigi Rizzo 			uint32_t rsvd1:18;
24232f345d8eSLuigi Rizzo 			uint32_t last_seg_udp_len:14;
24242f345d8eSLuigi Rizzo 
24252f345d8eSLuigi Rizzo 			/* dw2 */
24262f345d8eSLuigi Rizzo 			uint32_t complete:1;
24272f345d8eSLuigi Rizzo 			uint32_t event:1;
24282f345d8eSLuigi Rizzo 			uint32_t crc:1;
24292f345d8eSLuigi Rizzo 			uint32_t forward:1;
2430c2625e6eSJosh Paetzel 			uint32_t lso6:1;
2431c2625e6eSJosh Paetzel 			uint32_t mgmt:1;
24322f345d8eSLuigi Rizzo 			uint32_t ipcs:1;
24332f345d8eSLuigi Rizzo 			uint32_t udpcs:1;
24342f345d8eSLuigi Rizzo 			uint32_t tcpcs:1;
24352f345d8eSLuigi Rizzo 			uint32_t lso:1;
24362f345d8eSLuigi Rizzo 			uint32_t vlan:1;
24372f345d8eSLuigi Rizzo 			uint32_t rsvd4:2;
24382f345d8eSLuigi Rizzo 			uint32_t num_wqe:5;
24392f345d8eSLuigi Rizzo 			uint32_t lso_mss:14;
24402f345d8eSLuigi Rizzo 
24412f345d8eSLuigi Rizzo 			/* dw3 */
24422f345d8eSLuigi Rizzo 			uint32_t total_length:16;
24432f345d8eSLuigi Rizzo 			uint32_t vlan_tag:16;
24442f345d8eSLuigi Rizzo #endif
24452f345d8eSLuigi Rizzo 		} s;
24462f345d8eSLuigi Rizzo 		uint32_t dw[4];
24472f345d8eSLuigi Rizzo 	} u0;
24482f345d8eSLuigi Rizzo };
24492f345d8eSLuigi Rizzo 
24502f345d8eSLuigi Rizzo /* NIC fragment WQE */
24512f345d8eSLuigi Rizzo struct oce_nic_frag_wqe {
24522f345d8eSLuigi Rizzo 	union {
24532f345d8eSLuigi Rizzo 		struct {
24542f345d8eSLuigi Rizzo 			/* dw0 */
24552f345d8eSLuigi Rizzo 			uint32_t frag_pa_hi;
24562f345d8eSLuigi Rizzo 			/* dw1 */
24572f345d8eSLuigi Rizzo 			uint32_t frag_pa_lo;
24582f345d8eSLuigi Rizzo 			/* dw2 */
24592f345d8eSLuigi Rizzo 			uint32_t rsvd0;
24602f345d8eSLuigi Rizzo 			uint32_t frag_len;
24612f345d8eSLuigi Rizzo 		} s;
24622f345d8eSLuigi Rizzo 		uint32_t dw[4];
24632f345d8eSLuigi Rizzo 	} u0;
24642f345d8eSLuigi Rizzo };
24652f345d8eSLuigi Rizzo 
24662f345d8eSLuigi Rizzo /* Ethernet Tx Completion Descriptor */
24672f345d8eSLuigi Rizzo struct oce_nic_tx_cqe {
24682f345d8eSLuigi Rizzo 	union {
24692f345d8eSLuigi Rizzo 		struct {
24702f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
24712f345d8eSLuigi Rizzo 			/* dw 0 */
24722f345d8eSLuigi Rizzo 			uint32_t status:4;
24732f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
24742f345d8eSLuigi Rizzo 			uint32_t port:2;
24752f345d8eSLuigi Rizzo 			uint32_t ct:2;
24762f345d8eSLuigi Rizzo 			uint32_t wqe_index:16;
24772f345d8eSLuigi Rizzo 
24782f345d8eSLuigi Rizzo 			/* dw 1 */
24792f345d8eSLuigi Rizzo 			uint32_t rsvd1:5;
24802f345d8eSLuigi Rizzo 			uint32_t cast_enc:2;
24812f345d8eSLuigi Rizzo 			uint32_t lso:1;
24822f345d8eSLuigi Rizzo 			uint32_t nwh_bytes:8;
24832f345d8eSLuigi Rizzo 			uint32_t user_bytes:16;
24842f345d8eSLuigi Rizzo 
24852f345d8eSLuigi Rizzo 			/* dw 2 */
24862f345d8eSLuigi Rizzo 			uint32_t rsvd2;
24872f345d8eSLuigi Rizzo 
24882f345d8eSLuigi Rizzo 			/* dw 3 */
24892f345d8eSLuigi Rizzo 			uint32_t valid:1;
24902f345d8eSLuigi Rizzo 			uint32_t rsvd3:4;
24912f345d8eSLuigi Rizzo 			uint32_t wq_id:11;
24922f345d8eSLuigi Rizzo 			uint32_t num_pkts:16;
24932f345d8eSLuigi Rizzo #else
24942f345d8eSLuigi Rizzo 			/* dw 0 */
24952f345d8eSLuigi Rizzo 			uint32_t wqe_index:16;
24962f345d8eSLuigi Rizzo 			uint32_t ct:2;
24972f345d8eSLuigi Rizzo 			uint32_t port:2;
24982f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
24992f345d8eSLuigi Rizzo 			uint32_t status:4;
25002f345d8eSLuigi Rizzo 
25012f345d8eSLuigi Rizzo 			/* dw 1 */
25022f345d8eSLuigi Rizzo 			uint32_t user_bytes:16;
25032f345d8eSLuigi Rizzo 			uint32_t nwh_bytes:8;
25042f345d8eSLuigi Rizzo 			uint32_t lso:1;
25052f345d8eSLuigi Rizzo 			uint32_t cast_enc:2;
25062f345d8eSLuigi Rizzo 			uint32_t rsvd1:5;
25072f345d8eSLuigi Rizzo 			/* dw 2 */
25082f345d8eSLuigi Rizzo 			uint32_t rsvd2;
25092f345d8eSLuigi Rizzo 
25102f345d8eSLuigi Rizzo 			/* dw 3 */
25112f345d8eSLuigi Rizzo 			uint32_t num_pkts:16;
25122f345d8eSLuigi Rizzo 			uint32_t wq_id:11;
25132f345d8eSLuigi Rizzo 			uint32_t rsvd3:4;
25142f345d8eSLuigi Rizzo 			uint32_t valid:1;
25152f345d8eSLuigi Rizzo #endif
25162f345d8eSLuigi Rizzo 		} s;
25172f345d8eSLuigi Rizzo 		uint32_t dw[4];
25182f345d8eSLuigi Rizzo 	} u0;
25192f345d8eSLuigi Rizzo };
25202f345d8eSLuigi Rizzo #define	WQ_CQE_VALID(_cqe)  (_cqe->u0.dw[3])
25212f345d8eSLuigi Rizzo #define	WQ_CQE_INVALIDATE(_cqe)  (_cqe->u0.dw[3] = 0)
25222f345d8eSLuigi Rizzo 
25232f345d8eSLuigi Rizzo /* Receive Queue Entry (RQE) */
25242f345d8eSLuigi Rizzo struct oce_nic_rqe {
25252f345d8eSLuigi Rizzo 	union {
25262f345d8eSLuigi Rizzo 		struct {
25272f345d8eSLuigi Rizzo 			uint32_t frag_pa_hi;
25282f345d8eSLuigi Rizzo 			uint32_t frag_pa_lo;
25292f345d8eSLuigi Rizzo 		} s;
25302f345d8eSLuigi Rizzo 		uint32_t dw[2];
25312f345d8eSLuigi Rizzo 	} u0;
25322f345d8eSLuigi Rizzo };
25332f345d8eSLuigi Rizzo 
25342f345d8eSLuigi Rizzo /* NIC Receive CQE */
25352f345d8eSLuigi Rizzo struct oce_nic_rx_cqe {
25362f345d8eSLuigi Rizzo 	union {
25372f345d8eSLuigi Rizzo 		struct {
25382f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
25392f345d8eSLuigi Rizzo 			/* dw 0 */
25402f345d8eSLuigi Rizzo 			uint32_t ip_options:1;
25412f345d8eSLuigi Rizzo 			uint32_t port:1;
25422f345d8eSLuigi Rizzo 			uint32_t pkt_size:14;
25432f345d8eSLuigi Rizzo 			uint32_t vlan_tag:16;
25442f345d8eSLuigi Rizzo 
25452f345d8eSLuigi Rizzo 			/* dw 1 */
25462f345d8eSLuigi Rizzo 			uint32_t num_fragments:3;
25472f345d8eSLuigi Rizzo 			uint32_t switched:1;
25482f345d8eSLuigi Rizzo 			uint32_t ct:2;
25492f345d8eSLuigi Rizzo 			uint32_t frag_index:10;
25502f345d8eSLuigi Rizzo 			uint32_t rsvd0:1;
25512f345d8eSLuigi Rizzo 			uint32_t vlan_tag_present:1;
25522f345d8eSLuigi Rizzo 			uint32_t mac_dst:6;
25532f345d8eSLuigi Rizzo 			uint32_t ip_ver:1;
25542f345d8eSLuigi Rizzo 			uint32_t l4_cksum_pass:1;
25552f345d8eSLuigi Rizzo 			uint32_t ip_cksum_pass:1;
25562f345d8eSLuigi Rizzo 			uint32_t udpframe:1;
25572f345d8eSLuigi Rizzo 			uint32_t tcpframe:1;
25582f345d8eSLuigi Rizzo 			uint32_t ipframe:1;
25592f345d8eSLuigi Rizzo 			uint32_t rss_hp:1;
25602f345d8eSLuigi Rizzo 			uint32_t error:1;
25612f345d8eSLuigi Rizzo 
25622f345d8eSLuigi Rizzo 			/* dw 2 */
25632f345d8eSLuigi Rizzo 			uint32_t valid:1;
25642f345d8eSLuigi Rizzo 			uint32_t hds_type:2;
25652f345d8eSLuigi Rizzo 			uint32_t lro_pkt:1;
25662f345d8eSLuigi Rizzo 			uint32_t rsvd4:1;
25672f345d8eSLuigi Rizzo 			uint32_t hds_hdr_size:12;
25682f345d8eSLuigi Rizzo 			uint32_t hds_hdr_frag_index:10;
25692f345d8eSLuigi Rizzo 			uint32_t rss_bank:1;
25702f345d8eSLuigi Rizzo 			uint32_t qnq:1;
25712f345d8eSLuigi Rizzo 			uint32_t pkt_type:2;
25722f345d8eSLuigi Rizzo 			uint32_t rss_flush:1;
25732f345d8eSLuigi Rizzo 
25742f345d8eSLuigi Rizzo 			/* dw 3 */
25752f345d8eSLuigi Rizzo 			uint32_t rss_hash_value;
25762f345d8eSLuigi Rizzo #else
25772f345d8eSLuigi Rizzo 			/* dw 0 */
25782f345d8eSLuigi Rizzo 			uint32_t vlan_tag:16;
25792f345d8eSLuigi Rizzo 			uint32_t pkt_size:14;
25802f345d8eSLuigi Rizzo 			uint32_t port:1;
25812f345d8eSLuigi Rizzo 			uint32_t ip_options:1;
25822f345d8eSLuigi Rizzo 			/* dw 1 */
25832f345d8eSLuigi Rizzo 			uint32_t error:1;
25842f345d8eSLuigi Rizzo 			uint32_t rss_hp:1;
25852f345d8eSLuigi Rizzo 			uint32_t ipframe:1;
25862f345d8eSLuigi Rizzo 			uint32_t tcpframe:1;
25872f345d8eSLuigi Rizzo 			uint32_t udpframe:1;
25882f345d8eSLuigi Rizzo 			uint32_t ip_cksum_pass:1;
25892f345d8eSLuigi Rizzo 			uint32_t l4_cksum_pass:1;
25902f345d8eSLuigi Rizzo 			uint32_t ip_ver:1;
25912f345d8eSLuigi Rizzo 			uint32_t mac_dst:6;
25922f345d8eSLuigi Rizzo 			uint32_t vlan_tag_present:1;
25932f345d8eSLuigi Rizzo 			uint32_t rsvd0:1;
25942f345d8eSLuigi Rizzo 			uint32_t frag_index:10;
25952f345d8eSLuigi Rizzo 			uint32_t ct:2;
25962f345d8eSLuigi Rizzo 			uint32_t switched:1;
25972f345d8eSLuigi Rizzo 			uint32_t num_fragments:3;
25982f345d8eSLuigi Rizzo 
25992f345d8eSLuigi Rizzo 			/* dw 2 */
26002f345d8eSLuigi Rizzo 			uint32_t rss_flush:1;
26012f345d8eSLuigi Rizzo 			uint32_t pkt_type:2;
26022f345d8eSLuigi Rizzo 			uint32_t qnq:1;
26032f345d8eSLuigi Rizzo 			uint32_t rss_bank:1;
26042f345d8eSLuigi Rizzo 			uint32_t hds_hdr_frag_index:10;
26052f345d8eSLuigi Rizzo 			uint32_t hds_hdr_size:12;
26062f345d8eSLuigi Rizzo 			uint32_t rsvd4:1;
26072f345d8eSLuigi Rizzo 			uint32_t lro_pkt:1;
26082f345d8eSLuigi Rizzo 			uint32_t hds_type:2;
26092f345d8eSLuigi Rizzo 			uint32_t valid:1;
26102f345d8eSLuigi Rizzo 			/* dw 3 */
26112f345d8eSLuigi Rizzo 			uint32_t rss_hash_value;
26122f345d8eSLuigi Rizzo #endif
26132f345d8eSLuigi Rizzo 		} s;
26142f345d8eSLuigi Rizzo 		uint32_t dw[4];
26152f345d8eSLuigi Rizzo 	} u0;
26162f345d8eSLuigi Rizzo };
26172f345d8eSLuigi Rizzo /* NIC Receive CQE_v1 */
26182f345d8eSLuigi Rizzo struct oce_nic_rx_cqe_v1 {
26192f345d8eSLuigi Rizzo 	union {
26202f345d8eSLuigi Rizzo 		struct {
26212f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
26222f345d8eSLuigi Rizzo 			/* dw 0 */
26232f345d8eSLuigi Rizzo 			uint32_t ip_options:1;
26242f345d8eSLuigi Rizzo 			uint32_t vlan_tag_present:1;
26252f345d8eSLuigi Rizzo 			uint32_t pkt_size:14;
26262f345d8eSLuigi Rizzo 			uint32_t vlan_tag:16;
26272f345d8eSLuigi Rizzo 
26282f345d8eSLuigi Rizzo 			/* dw 1 */
26292f345d8eSLuigi Rizzo 			uint32_t num_fragments:3;
26302f345d8eSLuigi Rizzo 			uint32_t switched:1;
26312f345d8eSLuigi Rizzo 			uint32_t ct:2;
26322f345d8eSLuigi Rizzo 			uint32_t frag_index:10;
26332f345d8eSLuigi Rizzo 			uint32_t rsvd0:1;
26342f345d8eSLuigi Rizzo 			uint32_t mac_dst:7;
26352f345d8eSLuigi Rizzo 			uint32_t ip_ver:1;
26362f345d8eSLuigi Rizzo 			uint32_t l4_cksum_pass:1;
26372f345d8eSLuigi Rizzo 			uint32_t ip_cksum_pass:1;
26382f345d8eSLuigi Rizzo 			uint32_t udpframe:1;
26392f345d8eSLuigi Rizzo 			uint32_t tcpframe:1;
26402f345d8eSLuigi Rizzo 			uint32_t ipframe:1;
26412f345d8eSLuigi Rizzo 			uint32_t rss_hp:1;
26422f345d8eSLuigi Rizzo 			uint32_t error:1;
26432f345d8eSLuigi Rizzo 
26442f345d8eSLuigi Rizzo 			/* dw 2 */
26452f345d8eSLuigi Rizzo 			uint32_t valid:1;
26462f345d8eSLuigi Rizzo 			uint32_t rsvd4:13;
26472f345d8eSLuigi Rizzo 			uint32_t hds_hdr_size:
26482f345d8eSLuigi Rizzo 			uint32_t hds_hdr_frag_index:8;
26492f345d8eSLuigi Rizzo 			uint32_t vlantag:1;
26502f345d8eSLuigi Rizzo 			uint32_t port:2;
26512f345d8eSLuigi Rizzo 			uint32_t rss_bank:1;
26522f345d8eSLuigi Rizzo 			uint32_t qnq:1;
26532f345d8eSLuigi Rizzo 			uint32_t pkt_type:2;
26542f345d8eSLuigi Rizzo 			uint32_t rss_flush:1;
26552f345d8eSLuigi Rizzo 
26562f345d8eSLuigi Rizzo 			/* dw 3 */
26572f345d8eSLuigi Rizzo 			uint32_t rss_hash_value;
26582f345d8eSLuigi Rizzo 	#else
26592f345d8eSLuigi Rizzo 			/* dw 0 */
26602f345d8eSLuigi Rizzo 			uint32_t vlan_tag:16;
26612f345d8eSLuigi Rizzo 			uint32_t pkt_size:14;
26622f345d8eSLuigi Rizzo 			uint32_t vlan_tag_present:1;
26632f345d8eSLuigi Rizzo 			uint32_t ip_options:1;
26642f345d8eSLuigi Rizzo 			/* dw 1 */
26652f345d8eSLuigi Rizzo 			uint32_t error:1;
26662f345d8eSLuigi Rizzo 			uint32_t rss_hp:1;
26672f345d8eSLuigi Rizzo 			uint32_t ipframe:1;
26682f345d8eSLuigi Rizzo 			uint32_t tcpframe:1;
26692f345d8eSLuigi Rizzo 			uint32_t udpframe:1;
26702f345d8eSLuigi Rizzo 			uint32_t ip_cksum_pass:1;
26712f345d8eSLuigi Rizzo 			uint32_t l4_cksum_pass:1;
26722f345d8eSLuigi Rizzo 			uint32_t ip_ver:1;
26732f345d8eSLuigi Rizzo 			uint32_t mac_dst:7;
26742f345d8eSLuigi Rizzo 			uint32_t rsvd0:1;
26752f345d8eSLuigi Rizzo 			uint32_t frag_index:10;
26762f345d8eSLuigi Rizzo 			uint32_t ct:2;
26772f345d8eSLuigi Rizzo 			uint32_t switched:1;
26782f345d8eSLuigi Rizzo 			uint32_t num_fragments:3;
26792f345d8eSLuigi Rizzo 
26802f345d8eSLuigi Rizzo 			/* dw 2 */
26812f345d8eSLuigi Rizzo 			uint32_t rss_flush:1;
26822f345d8eSLuigi Rizzo 			uint32_t pkt_type:2;
26832f345d8eSLuigi Rizzo 			uint32_t qnq:1;
26842f345d8eSLuigi Rizzo 			uint32_t rss_bank:1;
26852f345d8eSLuigi Rizzo 			uint32_t port:2;
26862f345d8eSLuigi Rizzo 			uint32_t vlantag:1;
26872f345d8eSLuigi Rizzo 			uint32_t hds_hdr_frag_index:8;
26882f345d8eSLuigi Rizzo 			uint32_t hds_hdr_size:2;
26892f345d8eSLuigi Rizzo 			uint32_t rsvd4:13;
26902f345d8eSLuigi Rizzo 			uint32_t valid:1;
26912f345d8eSLuigi Rizzo 			/* dw 3 */
26922f345d8eSLuigi Rizzo 			uint32_t rss_hash_value;
26932f345d8eSLuigi Rizzo #endif
26942f345d8eSLuigi Rizzo 		} s;
26952f345d8eSLuigi Rizzo 		uint32_t dw[4];
26962f345d8eSLuigi Rizzo 	} u0;
26972f345d8eSLuigi Rizzo };
26982f345d8eSLuigi Rizzo 
26992f345d8eSLuigi Rizzo #define	RQ_CQE_VALID_MASK  0x80
27002f345d8eSLuigi Rizzo #define	RQ_CQE_VALID(_cqe) (_cqe->u0.dw[2])
27012f345d8eSLuigi Rizzo #define	RQ_CQE_INVALIDATE(_cqe) (_cqe->u0.dw[2] = 0)
27022f345d8eSLuigi Rizzo 
27032f345d8eSLuigi Rizzo struct mbx_config_nic_promiscuous {
27042f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
27052f345d8eSLuigi Rizzo 	union {
27062f345d8eSLuigi Rizzo 		struct {
27072f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
27082f345d8eSLuigi Rizzo 			uint16_t rsvd0;
27092f345d8eSLuigi Rizzo 			uint8_t port1_promisc;
27102f345d8eSLuigi Rizzo 			uint8_t port0_promisc;
27112f345d8eSLuigi Rizzo #else
27122f345d8eSLuigi Rizzo 			uint8_t port0_promisc;
27132f345d8eSLuigi Rizzo 			uint8_t port1_promisc;
27142f345d8eSLuigi Rizzo 			uint16_t rsvd0;
27152f345d8eSLuigi Rizzo #endif
27162f345d8eSLuigi Rizzo 		} req;
27172f345d8eSLuigi Rizzo 
27182f345d8eSLuigi Rizzo 		struct {
27192f345d8eSLuigi Rizzo 			uint32_t rsvd0;
27202f345d8eSLuigi Rizzo 		} rsp;
27212f345d8eSLuigi Rizzo 	} params;
27222f345d8eSLuigi Rizzo };
27232f345d8eSLuigi Rizzo 
27242f345d8eSLuigi Rizzo typedef	union oce_wq_ctx_u {
27252f345d8eSLuigi Rizzo 		uint32_t dw[17];
27262f345d8eSLuigi Rizzo 		struct {
27272f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
27282f345d8eSLuigi Rizzo 			/* dw4 */
27292f345d8eSLuigi Rizzo 			uint32_t dw4rsvd2:8;
27302f345d8eSLuigi Rizzo 			uint32_t nic_wq_type:8;
27312f345d8eSLuigi Rizzo 			uint32_t dw4rsvd1:8;
27322f345d8eSLuigi Rizzo 			uint32_t num_pages:8;
27332f345d8eSLuigi Rizzo 			/* dw5 */
27342f345d8eSLuigi Rizzo 			uint32_t dw5rsvd2:12;
27352f345d8eSLuigi Rizzo 			uint32_t wq_size:4;
27362f345d8eSLuigi Rizzo 			uint32_t dw5rsvd1:16;
27372f345d8eSLuigi Rizzo 			/* dw6 */
27382f345d8eSLuigi Rizzo 			uint32_t valid:1;
27392f345d8eSLuigi Rizzo 			uint32_t dw6rsvd1:31;
27402f345d8eSLuigi Rizzo 			/* dw7 */
27412f345d8eSLuigi Rizzo 			uint32_t dw7rsvd1:16;
27422f345d8eSLuigi Rizzo 			uint32_t cq_id:16;
27432f345d8eSLuigi Rizzo #else
27442f345d8eSLuigi Rizzo 			/* dw4 */
27452f345d8eSLuigi Rizzo 			uint32_t num_pages:8;
27462f345d8eSLuigi Rizzo #if 0
27472f345d8eSLuigi Rizzo 			uint32_t dw4rsvd1:8;
27482f345d8eSLuigi Rizzo #else
27492f345d8eSLuigi Rizzo /* PSP: this workaround is not documented: fill 0x01 for ulp_mask */
27502f345d8eSLuigi Rizzo 			uint32_t ulp_mask:8;
27512f345d8eSLuigi Rizzo #endif
27522f345d8eSLuigi Rizzo 			uint32_t nic_wq_type:8;
27532f345d8eSLuigi Rizzo 			uint32_t dw4rsvd2:8;
27542f345d8eSLuigi Rizzo 			/* dw5 */
27552f345d8eSLuigi Rizzo 			uint32_t dw5rsvd1:16;
27562f345d8eSLuigi Rizzo 			uint32_t wq_size:4;
27572f345d8eSLuigi Rizzo 			uint32_t dw5rsvd2:12;
27582f345d8eSLuigi Rizzo 			/* dw6 */
27592f345d8eSLuigi Rizzo 			uint32_t dw6rsvd1:31;
27602f345d8eSLuigi Rizzo 			uint32_t valid:1;
27612f345d8eSLuigi Rizzo 			/* dw7 */
27622f345d8eSLuigi Rizzo 			uint32_t cq_id:16;
27632f345d8eSLuigi Rizzo 			uint32_t dw7rsvd1:16;
27642f345d8eSLuigi Rizzo #endif
27652f345d8eSLuigi Rizzo 			/* dw8 - dw20 */
27662f345d8eSLuigi Rizzo 			uint32_t dw8_20rsvd1[13];
27672f345d8eSLuigi Rizzo 		} v0;
27682f345d8eSLuigi Rizzo 		struct {
27692f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
27702f345d8eSLuigi Rizzo 			/* dw4 */
27712f345d8eSLuigi Rizzo 			uint32_t dw4rsvd2:8;
27722f345d8eSLuigi Rizzo 			uint32_t nic_wq_type:8;
27732f345d8eSLuigi Rizzo 			uint32_t dw4rsvd1:8;
27742f345d8eSLuigi Rizzo 			uint32_t num_pages:8;
27752f345d8eSLuigi Rizzo 			/* dw5 */
27762f345d8eSLuigi Rizzo 			uint32_t dw5rsvd2:12;
27772f345d8eSLuigi Rizzo 			uint32_t wq_size:4;
27782f345d8eSLuigi Rizzo 			uint32_t iface_id:16;
27792f345d8eSLuigi Rizzo 			/* dw6 */
27802f345d8eSLuigi Rizzo 			uint32_t valid:1;
27812f345d8eSLuigi Rizzo 			uint32_t dw6rsvd1:31;
27822f345d8eSLuigi Rizzo 			/* dw7 */
27832f345d8eSLuigi Rizzo 			uint32_t dw7rsvd1:16;
27842f345d8eSLuigi Rizzo 			uint32_t cq_id:16;
27852f345d8eSLuigi Rizzo #else
27862f345d8eSLuigi Rizzo 			/* dw4 */
27872f345d8eSLuigi Rizzo 			uint32_t num_pages:8;
27882f345d8eSLuigi Rizzo 			uint32_t dw4rsvd1:8;
27892f345d8eSLuigi Rizzo 			uint32_t nic_wq_type:8;
27902f345d8eSLuigi Rizzo 			uint32_t dw4rsvd2:8;
27912f345d8eSLuigi Rizzo 			/* dw5 */
27922f345d8eSLuigi Rizzo 			uint32_t iface_id:16;
27932f345d8eSLuigi Rizzo 			uint32_t wq_size:4;
27942f345d8eSLuigi Rizzo 			uint32_t dw5rsvd2:12;
27952f345d8eSLuigi Rizzo 			/* dw6 */
27962f345d8eSLuigi Rizzo 			uint32_t dw6rsvd1:31;
27972f345d8eSLuigi Rizzo 			uint32_t valid:1;
27982f345d8eSLuigi Rizzo 			/* dw7 */
27992f345d8eSLuigi Rizzo 			uint32_t cq_id:16;
28002f345d8eSLuigi Rizzo 			uint32_t dw7rsvd1:16;
28012f345d8eSLuigi Rizzo #endif
28022f345d8eSLuigi Rizzo 			/* dw8 - dw20 */
28032f345d8eSLuigi Rizzo 			uint32_t dw8_20rsvd1[13];
28042f345d8eSLuigi Rizzo 		} v1;
28052f345d8eSLuigi Rizzo } oce_wq_ctx_t;
28062f345d8eSLuigi Rizzo 
28072f345d8eSLuigi Rizzo /**
28082f345d8eSLuigi Rizzo  * @brief [07] NIC_CREATE_WQ
28092f345d8eSLuigi Rizzo  * @note
28102f345d8eSLuigi Rizzo  * Lancer requires an InterfaceID to be specified with every WQ. This
28112f345d8eSLuigi Rizzo  * is the basis for NIC IOV where the Interface maps to a vPort and maps
28122f345d8eSLuigi Rizzo  * to both Tx and Rx sides.
28132f345d8eSLuigi Rizzo  */
28142f345d8eSLuigi Rizzo #define OCE_WQ_TYPE_FORWARDING	0x1	/* wq forwards pkts to TOE */
28152f345d8eSLuigi Rizzo #define OCE_WQ_TYPE_STANDARD	0x2	/* wq sends network pkts */
28162f345d8eSLuigi Rizzo struct mbx_create_nic_wq {
28172f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
28182f345d8eSLuigi Rizzo 	union {
28192f345d8eSLuigi Rizzo 		struct {
28202f345d8eSLuigi Rizzo 			uint8_t num_pages;
28212f345d8eSLuigi Rizzo 			uint8_t ulp_num;
28222f345d8eSLuigi Rizzo 			uint16_t nic_wq_type;
28232f345d8eSLuigi Rizzo 			uint16_t if_id;
28242f345d8eSLuigi Rizzo 			uint8_t wq_size;
28252f345d8eSLuigi Rizzo 			uint8_t rsvd1;
28262f345d8eSLuigi Rizzo 			uint32_t rsvd2;
28272f345d8eSLuigi Rizzo 			uint16_t cq_id;
28282f345d8eSLuigi Rizzo 			uint16_t rsvd3;
28292f345d8eSLuigi Rizzo 			uint32_t rsvd4[13];
28302f345d8eSLuigi Rizzo 			struct phys_addr pages[8];
28312f345d8eSLuigi Rizzo 
28322f345d8eSLuigi Rizzo 		} req;
28332f345d8eSLuigi Rizzo 
28342f345d8eSLuigi Rizzo 		struct {
28352f345d8eSLuigi Rizzo 			uint16_t wq_id;
28362f345d8eSLuigi Rizzo 			uint16_t rid;
28372f345d8eSLuigi Rizzo 			uint32_t db_offset;
28382f345d8eSLuigi Rizzo 			uint8_t tc_id;
28392f345d8eSLuigi Rizzo 			uint8_t rsvd0[3];
28402f345d8eSLuigi Rizzo 		} rsp;
28412f345d8eSLuigi Rizzo 	} params;
28422f345d8eSLuigi Rizzo };
28432f345d8eSLuigi Rizzo 
28442f345d8eSLuigi Rizzo /* [09] NIC_DELETE_WQ */
28452f345d8eSLuigi Rizzo struct mbx_delete_nic_wq {
28462f345d8eSLuigi Rizzo 	/* dw0 - dw3 */
28472f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
28482f345d8eSLuigi Rizzo 	union {
28492f345d8eSLuigi Rizzo 		struct {
28502f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
28512f345d8eSLuigi Rizzo 			/* dw4 */
28522f345d8eSLuigi Rizzo 			uint16_t rsvd0;
28532f345d8eSLuigi Rizzo 			uint16_t wq_id;
28542f345d8eSLuigi Rizzo #else
28552f345d8eSLuigi Rizzo 			/* dw4 */
28562f345d8eSLuigi Rizzo 			uint16_t wq_id;
28572f345d8eSLuigi Rizzo 			uint16_t rsvd0;
28582f345d8eSLuigi Rizzo #endif
28592f345d8eSLuigi Rizzo 		} req;
28602f345d8eSLuigi Rizzo 		struct {
28612f345d8eSLuigi Rizzo 			uint32_t rsvd0;
28622f345d8eSLuigi Rizzo 		} rsp;
28632f345d8eSLuigi Rizzo 	} params;
28642f345d8eSLuigi Rizzo };
28652f345d8eSLuigi Rizzo 
28662f345d8eSLuigi Rizzo struct mbx_create_nic_rq {
28672f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
28682f345d8eSLuigi Rizzo 	union {
28692f345d8eSLuigi Rizzo 		struct {
28702f345d8eSLuigi Rizzo 			uint16_t cq_id;
28712f345d8eSLuigi Rizzo 			uint8_t frag_size;
28722f345d8eSLuigi Rizzo 			uint8_t num_pages;
28732f345d8eSLuigi Rizzo 			struct phys_addr pages[2];
28742f345d8eSLuigi Rizzo 			uint32_t if_id;
28752f345d8eSLuigi Rizzo 			uint16_t max_frame_size;
28762f345d8eSLuigi Rizzo 			uint16_t page_size;
28772f345d8eSLuigi Rizzo 			uint32_t is_rss_queue;
28782f345d8eSLuigi Rizzo 		} req;
28792f345d8eSLuigi Rizzo 
28802f345d8eSLuigi Rizzo 		struct {
28812f345d8eSLuigi Rizzo 			uint16_t rq_id;
28822f345d8eSLuigi Rizzo 			uint8_t rss_cpuid;
28832f345d8eSLuigi Rizzo 			uint8_t rsvd0;
28842f345d8eSLuigi Rizzo 		} rsp;
28852f345d8eSLuigi Rizzo 
28862f345d8eSLuigi Rizzo 	} params;
28872f345d8eSLuigi Rizzo };
28882f345d8eSLuigi Rizzo 
28892f345d8eSLuigi Rizzo /* [10] NIC_DELETE_RQ */
28902f345d8eSLuigi Rizzo struct mbx_delete_nic_rq {
28912f345d8eSLuigi Rizzo 	/* dw0 - dw3 */
28922f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
28932f345d8eSLuigi Rizzo 	union {
28942f345d8eSLuigi Rizzo 		struct {
28952f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
28962f345d8eSLuigi Rizzo 			/* dw4 */
28972f345d8eSLuigi Rizzo 			uint16_t bypass_flush;
28982f345d8eSLuigi Rizzo 			uint16_t rq_id;
28992f345d8eSLuigi Rizzo #else
29002f345d8eSLuigi Rizzo 			/* dw4 */
29012f345d8eSLuigi Rizzo 			uint16_t rq_id;
29022f345d8eSLuigi Rizzo 			uint16_t bypass_flush;
29032f345d8eSLuigi Rizzo #endif
29042f345d8eSLuigi Rizzo 		} req;
29052f345d8eSLuigi Rizzo 
29062f345d8eSLuigi Rizzo 		struct {
29072f345d8eSLuigi Rizzo 			/* dw4 */
29082f345d8eSLuigi Rizzo 			uint32_t rsvd0;
29092f345d8eSLuigi Rizzo 		} rsp;
29102f345d8eSLuigi Rizzo 	} params;
29112f345d8eSLuigi Rizzo };
29122f345d8eSLuigi Rizzo 
29132f345d8eSLuigi Rizzo struct oce_port_rxf_stats_v0 {
29142f345d8eSLuigi Rizzo 	uint32_t rx_bytes_lsd;			/* dword 0*/
29152f345d8eSLuigi Rizzo 	uint32_t rx_bytes_msd;			/* dword 1*/
29162f345d8eSLuigi Rizzo 	uint32_t rx_total_frames;		/* dword 2*/
29172f345d8eSLuigi Rizzo 	uint32_t rx_unicast_frames;		/* dword 3*/
29182f345d8eSLuigi Rizzo 	uint32_t rx_multicast_frames;		/* dword 4*/
29192f345d8eSLuigi Rizzo 	uint32_t rx_broadcast_frames;		/* dword 5*/
29202f345d8eSLuigi Rizzo 	uint32_t rx_crc_errors;			/* dword 6*/
29212f345d8eSLuigi Rizzo 	uint32_t rx_alignment_symbol_errors;	/* dword 7*/
29222f345d8eSLuigi Rizzo 	uint32_t rx_pause_frames;		/* dword 8*/
29232f345d8eSLuigi Rizzo 	uint32_t rx_control_frames;		/* dword 9*/
29242f345d8eSLuigi Rizzo 	uint32_t rx_in_range_errors;		/* dword 10*/
29252f345d8eSLuigi Rizzo 	uint32_t rx_out_range_errors;		/* dword 11*/
29262f345d8eSLuigi Rizzo 	uint32_t rx_frame_too_long;		/* dword 12*/
29272f345d8eSLuigi Rizzo 	uint32_t rx_address_match_errors;	/* dword 13*/
29282f345d8eSLuigi Rizzo 	uint32_t rx_vlan_mismatch;		/* dword 14*/
29292f345d8eSLuigi Rizzo 	uint32_t rx_dropped_too_small;		/* dword 15*/
29302f345d8eSLuigi Rizzo 	uint32_t rx_dropped_too_short;		/* dword 16*/
29312f345d8eSLuigi Rizzo 	uint32_t rx_dropped_header_too_small;	/* dword 17*/
29322f345d8eSLuigi Rizzo 	uint32_t rx_dropped_tcp_length;		/* dword 18*/
29332f345d8eSLuigi Rizzo 	uint32_t rx_dropped_runt;		/* dword 19*/
29342f345d8eSLuigi Rizzo 	uint32_t rx_64_byte_packets;		/* dword 20*/
29352f345d8eSLuigi Rizzo 	uint32_t rx_65_127_byte_packets;	/* dword 21*/
29362f345d8eSLuigi Rizzo 	uint32_t rx_128_256_byte_packets;	/* dword 22*/
29372f345d8eSLuigi Rizzo 	uint32_t rx_256_511_byte_packets;	/* dword 23*/
29382f345d8eSLuigi Rizzo 	uint32_t rx_512_1023_byte_packets;	/* dword 24*/
29392f345d8eSLuigi Rizzo 	uint32_t rx_1024_1518_byte_packets;	/* dword 25*/
29402f345d8eSLuigi Rizzo 	uint32_t rx_1519_2047_byte_packets;	/* dword 26*/
29412f345d8eSLuigi Rizzo 	uint32_t rx_2048_4095_byte_packets;	/* dword 27*/
29422f345d8eSLuigi Rizzo 	uint32_t rx_4096_8191_byte_packets;	/* dword 28*/
29432f345d8eSLuigi Rizzo 	uint32_t rx_8192_9216_byte_packets;	/* dword 29*/
29442f345d8eSLuigi Rizzo 	uint32_t rx_ip_checksum_errs;		/* dword 30*/
29452f345d8eSLuigi Rizzo 	uint32_t rx_tcp_checksum_errs;		/* dword 31*/
29462f345d8eSLuigi Rizzo 	uint32_t rx_udp_checksum_errs;		/* dword 32*/
29472f345d8eSLuigi Rizzo 	uint32_t rx_non_rss_packets;		/* dword 33*/
29482f345d8eSLuigi Rizzo 	uint32_t rx_ipv4_packets;		/* dword 34*/
29492f345d8eSLuigi Rizzo 	uint32_t rx_ipv6_packets;		/* dword 35*/
29502f345d8eSLuigi Rizzo 	uint32_t rx_ipv4_bytes_lsd;		/* dword 36*/
29512f345d8eSLuigi Rizzo 	uint32_t rx_ipv4_bytes_msd;		/* dword 37*/
29522f345d8eSLuigi Rizzo 	uint32_t rx_ipv6_bytes_lsd;		/* dword 38*/
29532f345d8eSLuigi Rizzo 	uint32_t rx_ipv6_bytes_msd;		/* dword 39*/
29542f345d8eSLuigi Rizzo 	uint32_t rx_chute1_packets;		/* dword 40*/
29552f345d8eSLuigi Rizzo 	uint32_t rx_chute2_packets;		/* dword 41*/
29562f345d8eSLuigi Rizzo 	uint32_t rx_chute3_packets;		/* dword 42*/
29572f345d8eSLuigi Rizzo 	uint32_t rx_management_packets;		/* dword 43*/
29582f345d8eSLuigi Rizzo 	uint32_t rx_switched_unicast_packets;	/* dword 44*/
29592f345d8eSLuigi Rizzo 	uint32_t rx_switched_multicast_packets;	/* dword 45*/
29602f345d8eSLuigi Rizzo 	uint32_t rx_switched_broadcast_packets;	/* dword 46*/
29612f345d8eSLuigi Rizzo 	uint32_t tx_bytes_lsd;			/* dword 47*/
29622f345d8eSLuigi Rizzo 	uint32_t tx_bytes_msd;			/* dword 48*/
29632f345d8eSLuigi Rizzo 	uint32_t tx_unicastframes;		/* dword 49*/
29642f345d8eSLuigi Rizzo 	uint32_t tx_multicastframes;		/* dword 50*/
29652f345d8eSLuigi Rizzo 	uint32_t tx_broadcastframes;		/* dword 51*/
29662f345d8eSLuigi Rizzo 	uint32_t tx_pauseframes;		/* dword 52*/
29672f345d8eSLuigi Rizzo 	uint32_t tx_controlframes;		/* dword 53*/
29682f345d8eSLuigi Rizzo 	uint32_t tx_64_byte_packets;		/* dword 54*/
29692f345d8eSLuigi Rizzo 	uint32_t tx_65_127_byte_packets;	/* dword 55*/
29702f345d8eSLuigi Rizzo 	uint32_t tx_128_256_byte_packets;	/* dword 56*/
29712f345d8eSLuigi Rizzo 	uint32_t tx_256_511_byte_packets;	/* dword 57*/
29722f345d8eSLuigi Rizzo 	uint32_t tx_512_1023_byte_packets;	/* dword 58*/
29732f345d8eSLuigi Rizzo 	uint32_t tx_1024_1518_byte_packets;	/* dword 59*/
29742f345d8eSLuigi Rizzo 	uint32_t tx_1519_2047_byte_packets;	/* dword 60*/
29752f345d8eSLuigi Rizzo 	uint32_t tx_2048_4095_byte_packets;	/* dword 61*/
29762f345d8eSLuigi Rizzo 	uint32_t tx_4096_8191_byte_packets;	/* dword 62*/
29772f345d8eSLuigi Rizzo 	uint32_t tx_8192_9216_byte_packets;	/* dword 63*/
29782f345d8eSLuigi Rizzo 	uint32_t rxpp_fifo_overflow_drop;	/* dword 64*/
29792f345d8eSLuigi Rizzo 	uint32_t rx_input_fifo_overflow_drop;	/* dword 65*/
29802f345d8eSLuigi Rizzo };
29812f345d8eSLuigi Rizzo 
29822f345d8eSLuigi Rizzo struct oce_rxf_stats_v0 {
29832f345d8eSLuigi Rizzo 	struct oce_port_rxf_stats_v0 port[2];
29842f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_pbuf;		/* dword 132*/
29852f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_txpb;		/* dword 133*/
29862f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_erx_descr;		/* dword 134*/
29872f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_tpre_descr;	/* dword 135*/
29882f345d8eSLuigi Rizzo 	uint32_t management_rx_port_packets;	/* dword 136*/
29892f345d8eSLuigi Rizzo 	uint32_t management_rx_port_bytes;	/* dword 137*/
29902f345d8eSLuigi Rizzo 	uint32_t management_rx_port_pause_frames;/* dword 138*/
29912f345d8eSLuigi Rizzo 	uint32_t management_rx_port_errors;	/* dword 139*/
29922f345d8eSLuigi Rizzo 	uint32_t management_tx_port_packets;	/* dword 140*/
29932f345d8eSLuigi Rizzo 	uint32_t management_tx_port_bytes;	/* dword 141*/
29942f345d8eSLuigi Rizzo 	uint32_t management_tx_port_pause;	/* dword 142*/
29952f345d8eSLuigi Rizzo 	uint32_t management_rx_port_rxfifo_overflow; /* dword 143*/
29962f345d8eSLuigi Rizzo 	uint32_t rx_drops_too_many_frags;	/* dword 144*/
29972f345d8eSLuigi Rizzo 	uint32_t rx_drops_invalid_ring;		/* dword 145*/
29982f345d8eSLuigi Rizzo 	uint32_t forwarded_packets;		/* dword 146*/
29992f345d8eSLuigi Rizzo 	uint32_t rx_drops_mtu;			/* dword 147*/
30002f345d8eSLuigi Rizzo 	uint32_t rsvd0[7];
30012f345d8eSLuigi Rizzo 	uint32_t port0_jabber_events;
30022f345d8eSLuigi Rizzo 	uint32_t port1_jabber_events;
30032f345d8eSLuigi Rizzo 	uint32_t rsvd1[6];
30042f345d8eSLuigi Rizzo };
30052f345d8eSLuigi Rizzo 
3006c2625e6eSJosh Paetzel struct oce_port_rxf_stats_v2 {
3007c2625e6eSJosh Paetzel         uint32_t rsvd0[10];
3008c2625e6eSJosh Paetzel         uint32_t roce_bytes_received_lsd;
3009c2625e6eSJosh Paetzel         uint32_t roce_bytes_received_msd;
3010c2625e6eSJosh Paetzel         uint32_t rsvd1[5];
3011c2625e6eSJosh Paetzel         uint32_t roce_frames_received;
3012c2625e6eSJosh Paetzel         uint32_t rx_crc_errors;
3013c2625e6eSJosh Paetzel         uint32_t rx_alignment_symbol_errors;
3014c2625e6eSJosh Paetzel         uint32_t rx_pause_frames;
3015c2625e6eSJosh Paetzel         uint32_t rx_priority_pause_frames;
3016c2625e6eSJosh Paetzel         uint32_t rx_control_frames;
3017c2625e6eSJosh Paetzel         uint32_t rx_in_range_errors;
3018c2625e6eSJosh Paetzel         uint32_t rx_out_range_errors;
3019c2625e6eSJosh Paetzel         uint32_t rx_frame_too_long;
3020c2625e6eSJosh Paetzel         uint32_t rx_address_match_errors;
3021c2625e6eSJosh Paetzel         uint32_t rx_dropped_too_small;
3022c2625e6eSJosh Paetzel         uint32_t rx_dropped_too_short;
3023c2625e6eSJosh Paetzel         uint32_t rx_dropped_header_too_small;
3024c2625e6eSJosh Paetzel         uint32_t rx_dropped_tcp_length;
3025c2625e6eSJosh Paetzel         uint32_t rx_dropped_runt;
3026c2625e6eSJosh Paetzel         uint32_t rsvd2[10];
3027c2625e6eSJosh Paetzel         uint32_t rx_ip_checksum_errs;
3028c2625e6eSJosh Paetzel         uint32_t rx_tcp_checksum_errs;
3029c2625e6eSJosh Paetzel         uint32_t rx_udp_checksum_errs;
3030c2625e6eSJosh Paetzel         uint32_t rsvd3[7];
3031c2625e6eSJosh Paetzel         uint32_t rx_switched_unicast_packets;
3032c2625e6eSJosh Paetzel         uint32_t rx_switched_multicast_packets;
3033c2625e6eSJosh Paetzel         uint32_t rx_switched_broadcast_packets;
3034c2625e6eSJosh Paetzel         uint32_t rsvd4[3];
3035c2625e6eSJosh Paetzel         uint32_t tx_pauseframes;
3036c2625e6eSJosh Paetzel         uint32_t tx_priority_pauseframes;
3037c2625e6eSJosh Paetzel         uint32_t tx_controlframes;
3038c2625e6eSJosh Paetzel         uint32_t rsvd5[10];
3039c2625e6eSJosh Paetzel         uint32_t rxpp_fifo_overflow_drop;
3040c2625e6eSJosh Paetzel         uint32_t rx_input_fifo_overflow_drop;
3041c2625e6eSJosh Paetzel         uint32_t pmem_fifo_overflow_drop;
3042c2625e6eSJosh Paetzel         uint32_t jabber_events;
3043c2625e6eSJosh Paetzel         uint32_t rsvd6[3];
3044c2625e6eSJosh Paetzel         uint32_t rx_drops_payload_size;
3045c2625e6eSJosh Paetzel         uint32_t rx_drops_clipped_header;
3046c2625e6eSJosh Paetzel         uint32_t rx_drops_crc;
3047c2625e6eSJosh Paetzel         uint32_t roce_drops_payload_len;
3048c2625e6eSJosh Paetzel         uint32_t roce_drops_crc;
3049c2625e6eSJosh Paetzel         uint32_t rsvd7[19];
3050c2625e6eSJosh Paetzel };
3051c2625e6eSJosh Paetzel 
30522f345d8eSLuigi Rizzo struct oce_port_rxf_stats_v1 {
30532f345d8eSLuigi Rizzo 	uint32_t rsvd0[12];
30542f345d8eSLuigi Rizzo 	uint32_t rx_crc_errors;
30552f345d8eSLuigi Rizzo 	uint32_t rx_alignment_symbol_errors;
30562f345d8eSLuigi Rizzo 	uint32_t rx_pause_frames;
30572f345d8eSLuigi Rizzo 	uint32_t rx_priority_pause_frames;
30582f345d8eSLuigi Rizzo 	uint32_t rx_control_frames;
30592f345d8eSLuigi Rizzo 	uint32_t rx_in_range_errors;
30602f345d8eSLuigi Rizzo 	uint32_t rx_out_range_errors;
30612f345d8eSLuigi Rizzo 	uint32_t rx_frame_too_long;
30622f345d8eSLuigi Rizzo 	uint32_t rx_address_match_errors;
30632f345d8eSLuigi Rizzo 	uint32_t rx_dropped_too_small;
30642f345d8eSLuigi Rizzo 	uint32_t rx_dropped_too_short;
30652f345d8eSLuigi Rizzo 	uint32_t rx_dropped_header_too_small;
30662f345d8eSLuigi Rizzo 	uint32_t rx_dropped_tcp_length;
30672f345d8eSLuigi Rizzo 	uint32_t rx_dropped_runt;
30682f345d8eSLuigi Rizzo 	uint32_t rsvd1[10];
30692f345d8eSLuigi Rizzo 	uint32_t rx_ip_checksum_errs;
30702f345d8eSLuigi Rizzo 	uint32_t rx_tcp_checksum_errs;
30712f345d8eSLuigi Rizzo 	uint32_t rx_udp_checksum_errs;
30722f345d8eSLuigi Rizzo 	uint32_t rsvd2[7];
30732f345d8eSLuigi Rizzo 	uint32_t rx_switched_unicast_packets;
30742f345d8eSLuigi Rizzo 	uint32_t rx_switched_multicast_packets;
30752f345d8eSLuigi Rizzo 	uint32_t rx_switched_broadcast_packets;
30762f345d8eSLuigi Rizzo 	uint32_t rsvd3[3];
30772f345d8eSLuigi Rizzo 	uint32_t tx_pauseframes;
30782f345d8eSLuigi Rizzo 	uint32_t tx_priority_pauseframes;
30792f345d8eSLuigi Rizzo 	uint32_t tx_controlframes;
30802f345d8eSLuigi Rizzo 	uint32_t rsvd4[10];
30812f345d8eSLuigi Rizzo 	uint32_t rxpp_fifo_overflow_drop;
30822f345d8eSLuigi Rizzo 	uint32_t rx_input_fifo_overflow_drop;
30832f345d8eSLuigi Rizzo 	uint32_t pmem_fifo_overflow_drop;
30842f345d8eSLuigi Rizzo 	uint32_t jabber_events;
30852f345d8eSLuigi Rizzo 	uint32_t rsvd5[3];
30862f345d8eSLuigi Rizzo };
30872f345d8eSLuigi Rizzo 
3088c2625e6eSJosh Paetzel struct oce_rxf_stats_v2 {
3089c2625e6eSJosh Paetzel         struct oce_port_rxf_stats_v2 port[4];
3090c2625e6eSJosh Paetzel         uint32_t rsvd0[2];
3091c2625e6eSJosh Paetzel         uint32_t rx_drops_no_pbuf;
3092c2625e6eSJosh Paetzel         uint32_t rx_drops_no_txpb;
3093c2625e6eSJosh Paetzel         uint32_t rx_drops_no_erx_descr;
3094c2625e6eSJosh Paetzel         uint32_t rx_drops_no_tpre_descr;
3095c2625e6eSJosh Paetzel         uint32_t rsvd1[6];
3096c2625e6eSJosh Paetzel         uint32_t rx_drops_too_many_frags;
3097c2625e6eSJosh Paetzel         uint32_t rx_drops_invalid_ring;
3098c2625e6eSJosh Paetzel         uint32_t forwarded_packets;
3099c2625e6eSJosh Paetzel         uint32_t rx_drops_mtu;
3100c2625e6eSJosh Paetzel         uint32_t rsvd2[35];
3101c2625e6eSJosh Paetzel };
31022f345d8eSLuigi Rizzo 
31032f345d8eSLuigi Rizzo struct oce_rxf_stats_v1 {
31042f345d8eSLuigi Rizzo 	struct oce_port_rxf_stats_v1 port[4];
31052f345d8eSLuigi Rizzo 	uint32_t rsvd0[2];
31062f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_pbuf;
31072f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_txpb;
31082f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_erx_descr;
31092f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_tpre_descr;
31102f345d8eSLuigi Rizzo 	uint32_t rsvd1[6];
31112f345d8eSLuigi Rizzo 	uint32_t rx_drops_too_many_frags;
31122f345d8eSLuigi Rizzo 	uint32_t rx_drops_invalid_ring;
31132f345d8eSLuigi Rizzo 	uint32_t forwarded_packets;
31142f345d8eSLuigi Rizzo 	uint32_t rx_drops_mtu;
31152f345d8eSLuigi Rizzo 	uint32_t rsvd2[14];
31162f345d8eSLuigi Rizzo };
31172f345d8eSLuigi Rizzo 
3118c2625e6eSJosh Paetzel struct oce_erx_stats_v2 {
3119c2625e6eSJosh Paetzel         uint32_t rx_drops_no_fragments[136];
3120c2625e6eSJosh Paetzel         uint32_t rsvd[3];
3121c2625e6eSJosh Paetzel };
3122c2625e6eSJosh Paetzel 
31232f345d8eSLuigi Rizzo struct oce_erx_stats_v1 {
31242f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_fragments[68];
31252f345d8eSLuigi Rizzo 	uint32_t rsvd[4];
31262f345d8eSLuigi Rizzo };
31272f345d8eSLuigi Rizzo 
31282f345d8eSLuigi Rizzo struct oce_erx_stats_v0 {
31292f345d8eSLuigi Rizzo 	uint32_t rx_drops_no_fragments[44];
31302f345d8eSLuigi Rizzo 	uint32_t rsvd[4];
31312f345d8eSLuigi Rizzo };
31322f345d8eSLuigi Rizzo 
31332f345d8eSLuigi Rizzo struct oce_pmem_stats {
31342f345d8eSLuigi Rizzo 	uint32_t eth_red_drops;
31352f345d8eSLuigi Rizzo 	uint32_t rsvd[5];
31362f345d8eSLuigi Rizzo };
31372f345d8eSLuigi Rizzo 
3138c2625e6eSJosh Paetzel struct oce_hw_stats_v2 {
3139c2625e6eSJosh Paetzel         struct oce_rxf_stats_v2 rxf;
3140c2625e6eSJosh Paetzel         uint32_t rsvd0[OCE_TXP_SW_SZ];
3141c2625e6eSJosh Paetzel         struct oce_erx_stats_v2 erx;
3142c2625e6eSJosh Paetzel         struct oce_pmem_stats pmem;
3143c2625e6eSJosh Paetzel         uint32_t rsvd1[18];
3144c2625e6eSJosh Paetzel };
3145c2625e6eSJosh Paetzel 
31462f345d8eSLuigi Rizzo struct oce_hw_stats_v1 {
31472f345d8eSLuigi Rizzo 	struct oce_rxf_stats_v1 rxf;
31482f345d8eSLuigi Rizzo 	uint32_t rsvd0[OCE_TXP_SW_SZ];
31492f345d8eSLuigi Rizzo 	struct oce_erx_stats_v1 erx;
31502f345d8eSLuigi Rizzo 	struct oce_pmem_stats pmem;
31512f345d8eSLuigi Rizzo 	uint32_t rsvd1[18];
31522f345d8eSLuigi Rizzo };
31532f345d8eSLuigi Rizzo 
31542f345d8eSLuigi Rizzo struct oce_hw_stats_v0 {
31552f345d8eSLuigi Rizzo 	struct oce_rxf_stats_v0 rxf;
31562f345d8eSLuigi Rizzo 	uint32_t rsvd[48];
31572f345d8eSLuigi Rizzo 	struct oce_erx_stats_v0 erx;
31582f345d8eSLuigi Rizzo 	struct oce_pmem_stats pmem;
31592f345d8eSLuigi Rizzo };
31602f345d8eSLuigi Rizzo 
3161c2625e6eSJosh Paetzel #define MBX_GET_NIC_STATS(version)				\
3162c2625e6eSJosh Paetzel 	struct mbx_get_nic_stats_v##version { 			\
3163c2625e6eSJosh Paetzel 	struct mbx_hdr hdr; 					\
3164c2625e6eSJosh Paetzel 	union { 						\
3165c2625e6eSJosh Paetzel 		struct { 					\
3166c2625e6eSJosh Paetzel 			uint32_t rsvd0; 			\
3167c2625e6eSJosh Paetzel 		} req; 						\
3168c2625e6eSJosh Paetzel 		union { 					\
3169c2625e6eSJosh Paetzel 			struct oce_hw_stats_v##version stats; 	\
3170c2625e6eSJosh Paetzel 		} rsp; 						\
3171c2625e6eSJosh Paetzel 	} params; 						\
3172c2625e6eSJosh Paetzel }
31732f345d8eSLuigi Rizzo 
3174c2625e6eSJosh Paetzel MBX_GET_NIC_STATS(0);
3175c2625e6eSJosh Paetzel MBX_GET_NIC_STATS(1);
3176c2625e6eSJosh Paetzel MBX_GET_NIC_STATS(2);
31772f345d8eSLuigi Rizzo 
31782f345d8eSLuigi Rizzo /* [18(0x12)] NIC_GET_PPORT_STATS */
31792f345d8eSLuigi Rizzo struct pport_stats {
31802f345d8eSLuigi Rizzo 	uint64_t tx_pkts;
31812f345d8eSLuigi Rizzo 	uint64_t tx_unicast_pkts;
31822f345d8eSLuigi Rizzo 	uint64_t tx_multicast_pkts;
31832f345d8eSLuigi Rizzo 	uint64_t tx_broadcast_pkts;
31842f345d8eSLuigi Rizzo 	uint64_t tx_bytes;
31852f345d8eSLuigi Rizzo 	uint64_t tx_unicast_bytes;
31862f345d8eSLuigi Rizzo 	uint64_t tx_multicast_bytes;
31872f345d8eSLuigi Rizzo 	uint64_t tx_broadcast_bytes;
31882f345d8eSLuigi Rizzo 	uint64_t tx_discards;
31892f345d8eSLuigi Rizzo 	uint64_t tx_errors;
31902f345d8eSLuigi Rizzo 	uint64_t tx_pause_frames;
31912f345d8eSLuigi Rizzo 	uint64_t tx_pause_on_frames;
31922f345d8eSLuigi Rizzo 	uint64_t tx_pause_off_frames;
31932f345d8eSLuigi Rizzo 	uint64_t tx_internal_mac_errors;
31942f345d8eSLuigi Rizzo 	uint64_t tx_control_frames;
31952f345d8eSLuigi Rizzo 	uint64_t tx_pkts_64_bytes;
31962f345d8eSLuigi Rizzo 	uint64_t tx_pkts_65_to_127_bytes;
31972f345d8eSLuigi Rizzo 	uint64_t tx_pkts_128_to_255_bytes;
31982f345d8eSLuigi Rizzo 	uint64_t tx_pkts_256_to_511_bytes;
31992f345d8eSLuigi Rizzo 	uint64_t tx_pkts_512_to_1023_bytes;
32002f345d8eSLuigi Rizzo 	uint64_t tx_pkts_1024_to_1518_bytes;
32012f345d8eSLuigi Rizzo 	uint64_t tx_pkts_1519_to_2047_bytes;
32022f345d8eSLuigi Rizzo 	uint64_t tx_pkts_2048_to_4095_bytes;
32032f345d8eSLuigi Rizzo 	uint64_t tx_pkts_4096_to_8191_bytes;
32042f345d8eSLuigi Rizzo 	uint64_t tx_pkts_8192_to_9216_bytes;
32052f345d8eSLuigi Rizzo 	uint64_t tx_lso_pkts;
32062f345d8eSLuigi Rizzo 	uint64_t rx_pkts;
32072f345d8eSLuigi Rizzo 	uint64_t rx_unicast_pkts;
32082f345d8eSLuigi Rizzo 	uint64_t rx_multicast_pkts;
32092f345d8eSLuigi Rizzo 	uint64_t rx_broadcast_pkts;
32102f345d8eSLuigi Rizzo 	uint64_t rx_bytes;
32112f345d8eSLuigi Rizzo 	uint64_t rx_unicast_bytes;
32122f345d8eSLuigi Rizzo 	uint64_t rx_multicast_bytes;
32132f345d8eSLuigi Rizzo 	uint64_t rx_broadcast_bytes;
32142f345d8eSLuigi Rizzo 	uint32_t rx_unknown_protos;
32152f345d8eSLuigi Rizzo 	uint32_t reserved_word69;
32162f345d8eSLuigi Rizzo 	uint64_t rx_discards;
32172f345d8eSLuigi Rizzo 	uint64_t rx_errors;
32182f345d8eSLuigi Rizzo 	uint64_t rx_crc_errors;
32192f345d8eSLuigi Rizzo 	uint64_t rx_alignment_errors;
32202f345d8eSLuigi Rizzo 	uint64_t rx_symbol_errors;
32212f345d8eSLuigi Rizzo 	uint64_t rx_pause_frames;
32222f345d8eSLuigi Rizzo 	uint64_t rx_pause_on_frames;
32232f345d8eSLuigi Rizzo 	uint64_t rx_pause_off_frames;
32242f345d8eSLuigi Rizzo 	uint64_t rx_frames_too_long;
32252f345d8eSLuigi Rizzo 	uint64_t rx_internal_mac_errors;
32262f345d8eSLuigi Rizzo 	uint32_t rx_undersize_pkts;
32272f345d8eSLuigi Rizzo 	uint32_t rx_oversize_pkts;
32282f345d8eSLuigi Rizzo 	uint32_t rx_fragment_pkts;
32292f345d8eSLuigi Rizzo 	uint32_t rx_jabbers;
32302f345d8eSLuigi Rizzo 	uint64_t rx_control_frames;
32312f345d8eSLuigi Rizzo 	uint64_t rx_control_frames_unknown_opcode;
32322f345d8eSLuigi Rizzo 	uint32_t rx_in_range_errors;
32332f345d8eSLuigi Rizzo 	uint32_t rx_out_of_range_errors;
32342f345d8eSLuigi Rizzo 	uint32_t rx_address_match_errors;
32352f345d8eSLuigi Rizzo 	uint32_t rx_vlan_mismatch_errors;
32362f345d8eSLuigi Rizzo 	uint32_t rx_dropped_too_small;
32372f345d8eSLuigi Rizzo 	uint32_t rx_dropped_too_short;
32382f345d8eSLuigi Rizzo 	uint32_t rx_dropped_header_too_small;
32392f345d8eSLuigi Rizzo 	uint32_t rx_dropped_invalid_tcp_length;
32402f345d8eSLuigi Rizzo 	uint32_t rx_dropped_runt;
32412f345d8eSLuigi Rizzo 	uint32_t rx_ip_checksum_errors;
32422f345d8eSLuigi Rizzo 	uint32_t rx_tcp_checksum_errors;
32432f345d8eSLuigi Rizzo 	uint32_t rx_udp_checksum_errors;
32442f345d8eSLuigi Rizzo 	uint32_t rx_non_rss_pkts;
32452f345d8eSLuigi Rizzo 	uint64_t reserved_word111;
32462f345d8eSLuigi Rizzo 	uint64_t rx_ipv4_pkts;
32472f345d8eSLuigi Rizzo 	uint64_t rx_ipv6_pkts;
32482f345d8eSLuigi Rizzo 	uint64_t rx_ipv4_bytes;
32492f345d8eSLuigi Rizzo 	uint64_t rx_ipv6_bytes;
32502f345d8eSLuigi Rizzo 	uint64_t rx_nic_pkts;
32512f345d8eSLuigi Rizzo 	uint64_t rx_tcp_pkts;
32522f345d8eSLuigi Rizzo 	uint64_t rx_iscsi_pkts;
32532f345d8eSLuigi Rizzo 	uint64_t rx_management_pkts;
32542f345d8eSLuigi Rizzo 	uint64_t rx_switched_unicast_pkts;
32552f345d8eSLuigi Rizzo 	uint64_t rx_switched_multicast_pkts;
32562f345d8eSLuigi Rizzo 	uint64_t rx_switched_broadcast_pkts;
32572f345d8eSLuigi Rizzo 	uint64_t num_forwards;
32582f345d8eSLuigi Rizzo 	uint32_t rx_fifo_overflow;
32592f345d8eSLuigi Rizzo 	uint32_t rx_input_fifo_overflow;
32602f345d8eSLuigi Rizzo 	uint64_t rx_drops_too_many_frags;
32612f345d8eSLuigi Rizzo 	uint32_t rx_drops_invalid_queue;
32622f345d8eSLuigi Rizzo 	uint32_t reserved_word141;
32632f345d8eSLuigi Rizzo 	uint64_t rx_drops_mtu;
32642f345d8eSLuigi Rizzo 	uint64_t rx_pkts_64_bytes;
32652f345d8eSLuigi Rizzo 	uint64_t rx_pkts_65_to_127_bytes;
32662f345d8eSLuigi Rizzo 	uint64_t rx_pkts_128_to_255_bytes;
32672f345d8eSLuigi Rizzo 	uint64_t rx_pkts_256_to_511_bytes;
32682f345d8eSLuigi Rizzo 	uint64_t rx_pkts_512_to_1023_bytes;
32692f345d8eSLuigi Rizzo 	uint64_t rx_pkts_1024_to_1518_bytes;
32702f345d8eSLuigi Rizzo 	uint64_t rx_pkts_1519_to_2047_bytes;
32712f345d8eSLuigi Rizzo 	uint64_t rx_pkts_2048_to_4095_bytes;
32722f345d8eSLuigi Rizzo 	uint64_t rx_pkts_4096_to_8191_bytes;
32732f345d8eSLuigi Rizzo 	uint64_t rx_pkts_8192_to_9216_bytes;
32742f345d8eSLuigi Rizzo };
32752f345d8eSLuigi Rizzo 
32762f345d8eSLuigi Rizzo struct mbx_get_pport_stats {
32772f345d8eSLuigi Rizzo 	/* dw0 - dw3 */
32782f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
32792f345d8eSLuigi Rizzo 	union {
32802f345d8eSLuigi Rizzo 		struct {
32812f345d8eSLuigi Rizzo 			/* dw4 */
32822f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
32832f345d8eSLuigi Rizzo 			uint32_t reset_stats:8;
32842f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
32852f345d8eSLuigi Rizzo 			uint32_t port_number:16;
32862f345d8eSLuigi Rizzo #else
32872f345d8eSLuigi Rizzo 			uint32_t port_number:16;
32882f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
32892f345d8eSLuigi Rizzo 			uint32_t reset_stats:8;
32902f345d8eSLuigi Rizzo #endif
32912f345d8eSLuigi Rizzo 		} req;
32922f345d8eSLuigi Rizzo 
32932f345d8eSLuigi Rizzo 		union {
32942f345d8eSLuigi Rizzo 			struct pport_stats pps;
32952f345d8eSLuigi Rizzo 			uint32_t pport_stats[164 - 4 + 1];
32962f345d8eSLuigi Rizzo 		} rsp;
32972f345d8eSLuigi Rizzo 	} params;
32982f345d8eSLuigi Rizzo };
32992f345d8eSLuigi Rizzo 
33002f345d8eSLuigi Rizzo /* [19(0x13)] NIC_GET_VPORT_STATS */
33012f345d8eSLuigi Rizzo struct vport_stats {
33022f345d8eSLuigi Rizzo 	uint64_t tx_pkts;
33032f345d8eSLuigi Rizzo 	uint64_t tx_unicast_pkts;
33042f345d8eSLuigi Rizzo 	uint64_t tx_multicast_pkts;
33052f345d8eSLuigi Rizzo 	uint64_t tx_broadcast_pkts;
33062f345d8eSLuigi Rizzo 	uint64_t tx_bytes;
33072f345d8eSLuigi Rizzo 	uint64_t tx_unicast_bytes;
33082f345d8eSLuigi Rizzo 	uint64_t tx_multicast_bytes;
33092f345d8eSLuigi Rizzo 	uint64_t tx_broadcast_bytes;
33102f345d8eSLuigi Rizzo 	uint64_t tx_discards;
33112f345d8eSLuigi Rizzo 	uint64_t tx_errors;
33122f345d8eSLuigi Rizzo 	uint64_t tx_pkts_64_bytes;
33132f345d8eSLuigi Rizzo 	uint64_t tx_pkts_65_to_127_bytes;
33142f345d8eSLuigi Rizzo 	uint64_t tx_pkts_128_to_255_bytes;
33152f345d8eSLuigi Rizzo 	uint64_t tx_pkts_256_to_511_bytes;
33162f345d8eSLuigi Rizzo 	uint64_t tx_pkts_512_to_1023_bytes;
33172f345d8eSLuigi Rizzo 	uint64_t tx_pkts_1024_to_1518_bytes;
33182f345d8eSLuigi Rizzo 	uint64_t tx_pkts_1519_to_9699_bytes;
33192f345d8eSLuigi Rizzo 	uint64_t tx_pkts_over_9699_bytes;
33202f345d8eSLuigi Rizzo 	uint64_t rx_pkts;
33212f345d8eSLuigi Rizzo 	uint64_t rx_unicast_pkts;
33222f345d8eSLuigi Rizzo 	uint64_t rx_multicast_pkts;
33232f345d8eSLuigi Rizzo 	uint64_t rx_broadcast_pkts;
33242f345d8eSLuigi Rizzo 	uint64_t rx_bytes;
33252f345d8eSLuigi Rizzo 	uint64_t rx_unicast_bytes;
33262f345d8eSLuigi Rizzo 	uint64_t rx_multicast_bytes;
33272f345d8eSLuigi Rizzo 	uint64_t rx_broadcast_bytes;
33282f345d8eSLuigi Rizzo 	uint64_t rx_discards;
33292f345d8eSLuigi Rizzo 	uint64_t rx_errors;
33302f345d8eSLuigi Rizzo 	uint64_t rx_pkts_64_bytes;
33312f345d8eSLuigi Rizzo 	uint64_t rx_pkts_65_to_127_bytes;
33322f345d8eSLuigi Rizzo 	uint64_t rx_pkts_128_to_255_bytes;
33332f345d8eSLuigi Rizzo 	uint64_t rx_pkts_256_to_511_bytes;
33342f345d8eSLuigi Rizzo 	uint64_t rx_pkts_512_to_1023_bytes;
33352f345d8eSLuigi Rizzo 	uint64_t rx_pkts_1024_to_1518_bytes;
33362f345d8eSLuigi Rizzo 	uint64_t rx_pkts_1519_to_9699_bytes;
33372f345d8eSLuigi Rizzo 	uint64_t rx_pkts_gt_9699_bytes;
33382f345d8eSLuigi Rizzo };
33392f345d8eSLuigi Rizzo struct mbx_get_vport_stats {
33402f345d8eSLuigi Rizzo 	/* dw0 - dw3 */
33412f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
33422f345d8eSLuigi Rizzo 	union {
33432f345d8eSLuigi Rizzo 		struct {
33442f345d8eSLuigi Rizzo 			/* dw4 */
33452f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
33462f345d8eSLuigi Rizzo 			uint32_t reset_stats:8;
33472f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
33482f345d8eSLuigi Rizzo 			uint32_t vport_number:16;
33492f345d8eSLuigi Rizzo #else
33502f345d8eSLuigi Rizzo 			uint32_t vport_number:16;
33512f345d8eSLuigi Rizzo 			uint32_t rsvd0:8;
33522f345d8eSLuigi Rizzo 			uint32_t reset_stats:8;
33532f345d8eSLuigi Rizzo #endif
33542f345d8eSLuigi Rizzo 		} req;
33552f345d8eSLuigi Rizzo 
33562f345d8eSLuigi Rizzo 		union {
33572f345d8eSLuigi Rizzo 			struct vport_stats vps;
33582f345d8eSLuigi Rizzo 			uint32_t vport_stats[75 - 4 + 1];
33592f345d8eSLuigi Rizzo 		} rsp;
33602f345d8eSLuigi Rizzo 	} params;
33612f345d8eSLuigi Rizzo };
33622f345d8eSLuigi Rizzo 
33632f345d8eSLuigi Rizzo /**
33642f345d8eSLuigi Rizzo  * @brief	[20(0x14)] NIC_GET_QUEUE_STATS
33652f345d8eSLuigi Rizzo  * The significant difference between vPort and Queue statistics is
33662f345d8eSLuigi Rizzo  * the packet byte counters.
33672f345d8eSLuigi Rizzo  */
33682f345d8eSLuigi Rizzo struct queue_stats {
33692f345d8eSLuigi Rizzo 	uint64_t packets;
33702f345d8eSLuigi Rizzo 	uint64_t bytes;
33712f345d8eSLuigi Rizzo 	uint64_t errors;
33722f345d8eSLuigi Rizzo 	uint64_t drops;
33732f345d8eSLuigi Rizzo 	uint64_t buffer_errors;		/* rsvd when tx */
33742f345d8eSLuigi Rizzo };
33752f345d8eSLuigi Rizzo 
33762f345d8eSLuigi Rizzo #define QUEUE_TYPE_WQ		0
33772f345d8eSLuigi Rizzo #define QUEUE_TYPE_RQ		1
33782f345d8eSLuigi Rizzo #define QUEUE_TYPE_HDS_RQ	1	/* same as RQ */
33792f345d8eSLuigi Rizzo 
33802f345d8eSLuigi Rizzo struct mbx_get_queue_stats {
33812f345d8eSLuigi Rizzo 	/* dw0 - dw3 */
33822f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
33832f345d8eSLuigi Rizzo 	union {
33842f345d8eSLuigi Rizzo 		struct {
33852f345d8eSLuigi Rizzo 			/* dw4 */
33862f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
33872f345d8eSLuigi Rizzo 			uint32_t reset_stats:8;
33882f345d8eSLuigi Rizzo 			uint32_t queue_type:8;
33892f345d8eSLuigi Rizzo 			uint32_t queue_id:16;
33902f345d8eSLuigi Rizzo #else
33912f345d8eSLuigi Rizzo 			uint32_t queue_id:16;
33922f345d8eSLuigi Rizzo 			uint32_t queue_type:8;
33932f345d8eSLuigi Rizzo 			uint32_t reset_stats:8;
33942f345d8eSLuigi Rizzo #endif
33952f345d8eSLuigi Rizzo 		} req;
33962f345d8eSLuigi Rizzo 
33972f345d8eSLuigi Rizzo 		union {
33982f345d8eSLuigi Rizzo 			struct queue_stats qs;
33992f345d8eSLuigi Rizzo 			uint32_t queue_stats[13 - 4 + 1];
34002f345d8eSLuigi Rizzo 		} rsp;
34012f345d8eSLuigi Rizzo 	} params;
34022f345d8eSLuigi Rizzo };
34032f345d8eSLuigi Rizzo 
34042f345d8eSLuigi Rizzo /* [01] NIC_CONFIG_RSS */
34052f345d8eSLuigi Rizzo #define OCE_HASH_TBL_SZ	10
34062f345d8eSLuigi Rizzo #define OCE_CPU_TBL_SZ	128
34072f345d8eSLuigi Rizzo #define OCE_FLUSH	1	/* RSS flush completion per CQ port */
34082f345d8eSLuigi Rizzo struct mbx_config_nic_rss {
34092f345d8eSLuigi Rizzo 	struct mbx_hdr hdr;
34102f345d8eSLuigi Rizzo 	union {
34112f345d8eSLuigi Rizzo 		struct {
34122f345d8eSLuigi Rizzo #ifdef _BIG_ENDIAN
34132f345d8eSLuigi Rizzo 			uint32_t if_id;
34142f345d8eSLuigi Rizzo 			uint16_t cpu_tbl_sz_log2;
34152f345d8eSLuigi Rizzo 			uint16_t enable_rss;
34162f345d8eSLuigi Rizzo 			uint32_t hash[OCE_HASH_TBL_SZ];
34172f345d8eSLuigi Rizzo 			uint8_t cputable[OCE_CPU_TBL_SZ];
34182f345d8eSLuigi Rizzo 			uint8_t rsvd[3];
34192f345d8eSLuigi Rizzo 			uint8_t flush;
34202f345d8eSLuigi Rizzo #else
34212f345d8eSLuigi Rizzo 			uint32_t if_id;
34222f345d8eSLuigi Rizzo 			uint16_t enable_rss;
34232f345d8eSLuigi Rizzo 			uint16_t cpu_tbl_sz_log2;
34242f345d8eSLuigi Rizzo 			uint32_t hash[OCE_HASH_TBL_SZ];
34252f345d8eSLuigi Rizzo 			uint8_t cputable[OCE_CPU_TBL_SZ];
34262f345d8eSLuigi Rizzo 			uint8_t flush;
34272f345d8eSLuigi Rizzo 			uint8_t rsvd[3];
34282f345d8eSLuigi Rizzo #endif
34292f345d8eSLuigi Rizzo 		} req;
34302f345d8eSLuigi Rizzo 		struct {
34312f345d8eSLuigi Rizzo 			uint8_t rsvd[3];
34322f345d8eSLuigi Rizzo 			uint8_t rss_bank;
34332f345d8eSLuigi Rizzo 		} rsp;
34342f345d8eSLuigi Rizzo 	} params;
34352f345d8eSLuigi Rizzo };
34362f345d8eSLuigi Rizzo 
34372f345d8eSLuigi Rizzo #pragma pack()
34382f345d8eSLuigi Rizzo 
34392f345d8eSLuigi Rizzo typedef uint32_t oce_stat_t;		/* statistic counter */
34402f345d8eSLuigi Rizzo 
34412f345d8eSLuigi Rizzo enum OCE_RXF_PORT_STATS {
34422f345d8eSLuigi Rizzo 	RXF_RX_BYTES_LSD,
34432f345d8eSLuigi Rizzo 	RXF_RX_BYTES_MSD,
34442f345d8eSLuigi Rizzo 	RXF_RX_TOTAL_FRAMES,
34452f345d8eSLuigi Rizzo 	RXF_RX_UNICAST_FRAMES,
34462f345d8eSLuigi Rizzo 	RXF_RX_MULTICAST_FRAMES,
34472f345d8eSLuigi Rizzo 	RXF_RX_BROADCAST_FRAMES,
34482f345d8eSLuigi Rizzo 	RXF_RX_CRC_ERRORS,
34492f345d8eSLuigi Rizzo 	RXF_RX_ALIGNMENT_SYMBOL_ERRORS,
34502f345d8eSLuigi Rizzo 	RXF_RX_PAUSE_FRAMES,
34512f345d8eSLuigi Rizzo 	RXF_RX_CONTROL_FRAMES,
34522f345d8eSLuigi Rizzo 	RXF_RX_IN_RANGE_ERRORS,
34532f345d8eSLuigi Rizzo 	RXF_RX_OUT_RANGE_ERRORS,
34542f345d8eSLuigi Rizzo 	RXF_RX_FRAME_TOO_LONG,
34552f345d8eSLuigi Rizzo 	RXF_RX_ADDRESS_MATCH_ERRORS,
34562f345d8eSLuigi Rizzo 	RXF_RX_VLAN_MISMATCH,
34572f345d8eSLuigi Rizzo 	RXF_RX_DROPPED_TOO_SMALL,
34582f345d8eSLuigi Rizzo 	RXF_RX_DROPPED_TOO_SHORT,
34592f345d8eSLuigi Rizzo 	RXF_RX_DROPPED_HEADER_TOO_SMALL,
34602f345d8eSLuigi Rizzo 	RXF_RX_DROPPED_TCP_LENGTH,
34612f345d8eSLuigi Rizzo 	RXF_RX_DROPPED_RUNT,
34622f345d8eSLuigi Rizzo 	RXF_RX_64_BYTE_PACKETS,
34632f345d8eSLuigi Rizzo 	RXF_RX_65_127_BYTE_PACKETS,
34642f345d8eSLuigi Rizzo 	RXF_RX_128_256_BYTE_PACKETS,
34652f345d8eSLuigi Rizzo 	RXF_RX_256_511_BYTE_PACKETS,
34662f345d8eSLuigi Rizzo 	RXF_RX_512_1023_BYTE_PACKETS,
34672f345d8eSLuigi Rizzo 	RXF_RX_1024_1518_BYTE_PACKETS,
34682f345d8eSLuigi Rizzo 	RXF_RX_1519_2047_BYTE_PACKETS,
34692f345d8eSLuigi Rizzo 	RXF_RX_2048_4095_BYTE_PACKETS,
34702f345d8eSLuigi Rizzo 	RXF_RX_4096_8191_BYTE_PACKETS,
34712f345d8eSLuigi Rizzo 	RXF_RX_8192_9216_BYTE_PACKETS,
34722f345d8eSLuigi Rizzo 	RXF_RX_IP_CHECKSUM_ERRS,
34732f345d8eSLuigi Rizzo 	RXF_RX_TCP_CHECKSUM_ERRS,
34742f345d8eSLuigi Rizzo 	RXF_RX_UDP_CHECKSUM_ERRS,
34752f345d8eSLuigi Rizzo 	RXF_RX_NON_RSS_PACKETS,
34762f345d8eSLuigi Rizzo 	RXF_RX_IPV4_PACKETS,
34772f345d8eSLuigi Rizzo 	RXF_RX_IPV6_PACKETS,
34782f345d8eSLuigi Rizzo 	RXF_RX_IPV4_BYTES_LSD,
34792f345d8eSLuigi Rizzo 	RXF_RX_IPV4_BYTES_MSD,
34802f345d8eSLuigi Rizzo 	RXF_RX_IPV6_BYTES_LSD,
34812f345d8eSLuigi Rizzo 	RXF_RX_IPV6_BYTES_MSD,
34822f345d8eSLuigi Rizzo 	RXF_RX_CHUTE1_PACKETS,
34832f345d8eSLuigi Rizzo 	RXF_RX_CHUTE2_PACKETS,
34842f345d8eSLuigi Rizzo 	RXF_RX_CHUTE3_PACKETS,
34852f345d8eSLuigi Rizzo 	RXF_RX_MANAGEMENT_PACKETS,
34862f345d8eSLuigi Rizzo 	RXF_RX_SWITCHED_UNICAST_PACKETS,
34872f345d8eSLuigi Rizzo 	RXF_RX_SWITCHED_MULTICAST_PACKETS,
34882f345d8eSLuigi Rizzo 	RXF_RX_SWITCHED_BROADCAST_PACKETS,
34892f345d8eSLuigi Rizzo 	RXF_TX_BYTES_LSD,
34902f345d8eSLuigi Rizzo 	RXF_TX_BYTES_MSD,
34912f345d8eSLuigi Rizzo 	RXF_TX_UNICAST_FRAMES,
34922f345d8eSLuigi Rizzo 	RXF_TX_MULTICAST_FRAMES,
34932f345d8eSLuigi Rizzo 	RXF_TX_BROADCAST_FRAMES,
34942f345d8eSLuigi Rizzo 	RXF_TX_PAUSE_FRAMES,
34952f345d8eSLuigi Rizzo 	RXF_TX_CONTROL_FRAMES,
34962f345d8eSLuigi Rizzo 	RXF_TX_64_BYTE_PACKETS,
34972f345d8eSLuigi Rizzo 	RXF_TX_65_127_BYTE_PACKETS,
34982f345d8eSLuigi Rizzo 	RXF_TX_128_256_BYTE_PACKETS,
34992f345d8eSLuigi Rizzo 	RXF_TX_256_511_BYTE_PACKETS,
35002f345d8eSLuigi Rizzo 	RXF_TX_512_1023_BYTE_PACKETS,
35012f345d8eSLuigi Rizzo 	RXF_TX_1024_1518_BYTE_PACKETS,
35022f345d8eSLuigi Rizzo 	RXF_TX_1519_2047_BYTE_PACKETS,
35032f345d8eSLuigi Rizzo 	RXF_TX_2048_4095_BYTE_PACKETS,
35042f345d8eSLuigi Rizzo 	RXF_TX_4096_8191_BYTE_PACKETS,
35052f345d8eSLuigi Rizzo 	RXF_TX_8192_9216_BYTE_PACKETS,
35062f345d8eSLuigi Rizzo 	RXF_RX_FIFO_OVERFLOW,
35072f345d8eSLuigi Rizzo 	RXF_RX_INPUT_FIFO_OVERFLOW,
35082f345d8eSLuigi Rizzo 	RXF_PORT_STATS_N_WORDS
35092f345d8eSLuigi Rizzo };
35102f345d8eSLuigi Rizzo 
35112f345d8eSLuigi Rizzo enum OCE_RXF_ADDL_STATS {
35122f345d8eSLuigi Rizzo 	RXF_RX_DROPS_NO_PBUF,
35132f345d8eSLuigi Rizzo 	RXF_RX_DROPS_NO_TXPB,
35142f345d8eSLuigi Rizzo 	RXF_RX_DROPS_NO_ERX_DESCR,
35152f345d8eSLuigi Rizzo 	RXF_RX_DROPS_NO_TPRE_DESCR,
35162f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_RX_PORT_PACKETS,
35172f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_RX_PORT_BYTES,
35182f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_RX_PORT_PAUSE_FRAMES,
35192f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_RX_PORT_ERRORS,
35202f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_TX_PORT_PACKETS,
35212f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_TX_PORT_BYTES,
35222f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_TX_PORT_PAUSE,
35232f345d8eSLuigi Rizzo 	RXF_MANAGEMENT_RX_PORT_RXFIFO_OVERFLOW,
35242f345d8eSLuigi Rizzo 	RXF_RX_DROPS_TOO_MANY_FRAGS,
35252f345d8eSLuigi Rizzo 	RXF_RX_DROPS_INVALID_RING,
35262f345d8eSLuigi Rizzo 	RXF_FORWARDED_PACKETS,
35272f345d8eSLuigi Rizzo 	RXF_RX_DROPS_MTU,
35282f345d8eSLuigi Rizzo 	RXF_ADDL_STATS_N_WORDS
35292f345d8eSLuigi Rizzo };
35302f345d8eSLuigi Rizzo 
35312f345d8eSLuigi Rizzo enum OCE_TX_CHUTE_PORT_STATS {
35322f345d8eSLuigi Rizzo 	CTPT_XMT_IPV4_PKTS,
35332f345d8eSLuigi Rizzo 	CTPT_XMT_IPV4_LSD,
35342f345d8eSLuigi Rizzo 	CTPT_XMT_IPV4_MSD,
35352f345d8eSLuigi Rizzo 	CTPT_XMT_IPV6_PKTS,
35362f345d8eSLuigi Rizzo 	CTPT_XMT_IPV6_LSD,
35372f345d8eSLuigi Rizzo 	CTPT_XMT_IPV6_MSD,
35382f345d8eSLuigi Rizzo 	CTPT_REXMT_IPV4_PKTs,
35392f345d8eSLuigi Rizzo 	CTPT_REXMT_IPV4_LSD,
35402f345d8eSLuigi Rizzo 	CTPT_REXMT_IPV4_MSD,
35412f345d8eSLuigi Rizzo 	CTPT_REXMT_IPV6_PKTs,
35422f345d8eSLuigi Rizzo 	CTPT_REXMT_IPV6_LSD,
35432f345d8eSLuigi Rizzo 	CTPT_REXMT_IPV6_MSD,
35442f345d8eSLuigi Rizzo 	CTPT_N_WORDS,
35452f345d8eSLuigi Rizzo };
35462f345d8eSLuigi Rizzo 
35472f345d8eSLuigi Rizzo enum OCE_RX_ERR_STATS {
35482f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_0,
35492f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_1,
35502f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_2,
35512f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_3,
35522f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_4,
35532f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_5,
35542f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_6,
35552f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_7,
35562f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_8,
35572f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_9,
35582f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_10,
35592f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_11,
35602f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_12,
35612f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_13,
35622f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_14,
35632f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_15,
35642f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_16,
35652f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_17,
35662f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_18,
35672f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_19,
35682f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_20,
35692f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_21,
35702f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_22,
35712f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_23,
35722f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_24,
35732f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_25,
35742f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_26,
35752f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_27,
35762f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_28,
35772f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_29,
35782f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_30,
35792f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_31,
35802f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_32,
35812f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_33,
35822f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_34,
35832f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_35,
35842f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_36,
35852f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_37,
35862f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_38,
35872f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_39,
35882f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_40,
35892f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_41,
35902f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_42,
35912f345d8eSLuigi Rizzo 	RX_DROPS_NO_FRAGMENTS_43,
35922f345d8eSLuigi Rizzo 	RX_DEBUG_WDMA_SENT_HOLD,
35932f345d8eSLuigi Rizzo 	RX_DEBUG_WDMA_PBFREE_SENT_HOLD,
35942f345d8eSLuigi Rizzo 	RX_DEBUG_WDMA_0B_PBFREE_SENT_HOLD,
35952f345d8eSLuigi Rizzo 	RX_DEBUG_PMEM_PBUF_DEALLOC,
35962f345d8eSLuigi Rizzo 	RX_ERRORS_N_WORDS
35972f345d8eSLuigi Rizzo };
35982f345d8eSLuigi Rizzo 
35992f345d8eSLuigi Rizzo enum OCE_PMEM_ERR_STATS {
36002f345d8eSLuigi Rizzo 	PMEM_ETH_RED_DROPS,
36012f345d8eSLuigi Rizzo 	PMEM_LRO_RED_DROPS,
36022f345d8eSLuigi Rizzo 	PMEM_ULP0_RED_DROPS,
36032f345d8eSLuigi Rizzo 	PMEM_ULP1_RED_DROPS,
36042f345d8eSLuigi Rizzo 	PMEM_GLOBAL_RED_DROPS,
36052f345d8eSLuigi Rizzo 	PMEM_ERRORS_N_WORDS
36062f345d8eSLuigi Rizzo };
36072f345d8eSLuigi Rizzo 
36082f345d8eSLuigi Rizzo /**
36092f345d8eSLuigi Rizzo  * @brief Statistics for a given Physical Port
36102f345d8eSLuigi Rizzo  * These satisfy all the required BE2 statistics and also the
36112f345d8eSLuigi Rizzo  * following MIB objects:
36122f345d8eSLuigi Rizzo  *
36132f345d8eSLuigi Rizzo  * RFC 2863 - The Interfaces Group MIB
36142f345d8eSLuigi Rizzo  * RFC 2819 - Remote Network Monitoring Management Information Base (RMON)
36152f345d8eSLuigi Rizzo  * RFC 3635 - Managed Objects for the Ethernet-like Interface Types
36162f345d8eSLuigi Rizzo  * RFC 4502 - Remote Network Monitoring Mgmt Information Base Ver-2 (RMON2)
36172f345d8eSLuigi Rizzo  *
36182f345d8eSLuigi Rizzo  */
36192f345d8eSLuigi Rizzo enum OCE_PPORT_STATS {
36202f345d8eSLuigi Rizzo 	PPORT_TX_PKTS = 0,
36212f345d8eSLuigi Rizzo 	PPORT_TX_UNICAST_PKTS = 2,
36222f345d8eSLuigi Rizzo 	PPORT_TX_MULTICAST_PKTS = 4,
36232f345d8eSLuigi Rizzo 	PPORT_TX_BROADCAST_PKTS = 6,
36242f345d8eSLuigi Rizzo 	PPORT_TX_BYTES = 8,
36252f345d8eSLuigi Rizzo 	PPORT_TX_UNICAST_BYTES = 10,
36262f345d8eSLuigi Rizzo 	PPORT_TX_MULTICAST_BYTES = 12,
36272f345d8eSLuigi Rizzo 	PPORT_TX_BROADCAST_BYTES = 14,
36282f345d8eSLuigi Rizzo 	PPORT_TX_DISCARDS = 16,
36292f345d8eSLuigi Rizzo 	PPORT_TX_ERRORS = 18,
36302f345d8eSLuigi Rizzo 	PPORT_TX_PAUSE_FRAMES = 20,
36312f345d8eSLuigi Rizzo 	PPORT_TX_PAUSE_ON_FRAMES = 22,
36322f345d8eSLuigi Rizzo 	PPORT_TX_PAUSE_OFF_FRAMES = 24,
36332f345d8eSLuigi Rizzo 	PPORT_TX_INTERNAL_MAC_ERRORS = 26,
36342f345d8eSLuigi Rizzo 	PPORT_TX_CONTROL_FRAMES = 28,
36352f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_64_BYTES = 30,
36362f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_65_TO_127_BYTES = 32,
36372f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_128_TO_255_BYTES = 34,
36382f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_256_TO_511_BYTES = 36,
36392f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_512_TO_1023_BYTES = 38,
36402f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_1024_TO_1518_BYTES = 40,
36412f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_1519_TO_2047_BYTES = 42,
36422f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_2048_TO_4095_BYTES = 44,
36432f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_4096_TO_8191_BYTES = 46,
36442f345d8eSLuigi Rizzo 	PPORT_TX_PKTS_8192_TO_9216_BYTES = 48,
36452f345d8eSLuigi Rizzo 	PPORT_TX_LSO_PKTS = 50,
36462f345d8eSLuigi Rizzo 	PPORT_RX_PKTS = 52,
36472f345d8eSLuigi Rizzo 	PPORT_RX_UNICAST_PKTS = 54,
36482f345d8eSLuigi Rizzo 	PPORT_RX_MULTICAST_PKTS = 56,
36492f345d8eSLuigi Rizzo 	PPORT_RX_BROADCAST_PKTS = 58,
36502f345d8eSLuigi Rizzo 	PPORT_RX_BYTES = 60,
36512f345d8eSLuigi Rizzo 	PPORT_RX_UNICAST_BYTES = 62,
36522f345d8eSLuigi Rizzo 	PPORT_RX_MULTICAST_BYTES = 64,
36532f345d8eSLuigi Rizzo 	PPORT_RX_BROADCAST_BYTES = 66,
36542f345d8eSLuigi Rizzo 	PPORT_RX_UNKNOWN_PROTOS = 68,
36552f345d8eSLuigi Rizzo 	PPORT_RESERVED_WORD69 = 69,
36562f345d8eSLuigi Rizzo 	PPORT_RX_DISCARDS = 70,
36572f345d8eSLuigi Rizzo 	PPORT_RX_ERRORS = 72,
36582f345d8eSLuigi Rizzo 	PPORT_RX_CRC_ERRORS = 74,
36592f345d8eSLuigi Rizzo 	PPORT_RX_ALIGNMENT_ERRORS = 76,
36602f345d8eSLuigi Rizzo 	PPORT_RX_SYMBOL_ERRORS = 78,
36612f345d8eSLuigi Rizzo 	PPORT_RX_PAUSE_FRAMES = 80,
36622f345d8eSLuigi Rizzo 	PPORT_RX_PAUSE_ON_FRAMES = 82,
36632f345d8eSLuigi Rizzo 	PPORT_RX_PAUSE_OFF_FRAMES = 84,
36642f345d8eSLuigi Rizzo 	PPORT_RX_FRAMES_TOO_LONG = 86,
36652f345d8eSLuigi Rizzo 	PPORT_RX_INTERNAL_MAC_ERRORS = 88,
36662f345d8eSLuigi Rizzo 	PPORT_RX_UNDERSIZE_PKTS = 90,
36672f345d8eSLuigi Rizzo 	PPORT_RX_OVERSIZE_PKTS = 91,
36682f345d8eSLuigi Rizzo 	PPORT_RX_FRAGMENT_PKTS = 92,
36692f345d8eSLuigi Rizzo 	PPORT_RX_JABBERS = 93,
36702f345d8eSLuigi Rizzo 	PPORT_RX_CONTROL_FRAMES = 94,
36712f345d8eSLuigi Rizzo 	PPORT_RX_CONTROL_FRAMES_UNK_OPCODE = 96,
36722f345d8eSLuigi Rizzo 	PPORT_RX_IN_RANGE_ERRORS = 98,
36732f345d8eSLuigi Rizzo 	PPORT_RX_OUT_OF_RANGE_ERRORS = 99,
36742f345d8eSLuigi Rizzo 	PPORT_RX_ADDRESS_MATCH_ERRORS = 100,
36752f345d8eSLuigi Rizzo 	PPORT_RX_VLAN_MISMATCH_ERRORS = 101,
36762f345d8eSLuigi Rizzo 	PPORT_RX_DROPPED_TOO_SMALL = 102,
36772f345d8eSLuigi Rizzo 	PPORT_RX_DROPPED_TOO_SHORT = 103,
36782f345d8eSLuigi Rizzo 	PPORT_RX_DROPPED_HEADER_TOO_SMALL = 104,
36792f345d8eSLuigi Rizzo 	PPORT_RX_DROPPED_INVALID_TCP_LENGTH = 105,
36802f345d8eSLuigi Rizzo 	PPORT_RX_DROPPED_RUNT = 106,
36812f345d8eSLuigi Rizzo 	PPORT_RX_IP_CHECKSUM_ERRORS = 107,
36822f345d8eSLuigi Rizzo 	PPORT_RX_TCP_CHECKSUM_ERRORS = 108,
36832f345d8eSLuigi Rizzo 	PPORT_RX_UDP_CHECKSUM_ERRORS = 109,
36842f345d8eSLuigi Rizzo 	PPORT_RX_NON_RSS_PKTS = 110,
36852f345d8eSLuigi Rizzo 	PPORT_RESERVED_WORD111 = 111,
36862f345d8eSLuigi Rizzo 	PPORT_RX_IPV4_PKTS = 112,
36872f345d8eSLuigi Rizzo 	PPORT_RX_IPV6_PKTS = 114,
36882f345d8eSLuigi Rizzo 	PPORT_RX_IPV4_BYTES = 116,
36892f345d8eSLuigi Rizzo 	PPORT_RX_IPV6_BYTES = 118,
36902f345d8eSLuigi Rizzo 	PPORT_RX_NIC_PKTS = 120,
36912f345d8eSLuigi Rizzo 	PPORT_RX_TCP_PKTS = 122,
36922f345d8eSLuigi Rizzo 	PPORT_RX_ISCSI_PKTS = 124,
36932f345d8eSLuigi Rizzo 	PPORT_RX_MANAGEMENT_PKTS = 126,
36942f345d8eSLuigi Rizzo 	PPORT_RX_SWITCHED_UNICAST_PKTS = 128,
36952f345d8eSLuigi Rizzo 	PPORT_RX_SWITCHED_MULTICAST_PKTS = 130,
36962f345d8eSLuigi Rizzo 	PPORT_RX_SWITCHED_BROADCAST_PKTS = 132,
36972f345d8eSLuigi Rizzo 	PPORT_NUM_FORWARDS = 134,
36982f345d8eSLuigi Rizzo 	PPORT_RX_FIFO_OVERFLOW = 136,
36992f345d8eSLuigi Rizzo 	PPORT_RX_INPUT_FIFO_OVERFLOW = 137,
37002f345d8eSLuigi Rizzo 	PPORT_RX_DROPS_TOO_MANY_FRAGS = 138,
37012f345d8eSLuigi Rizzo 	PPORT_RX_DROPS_INVALID_QUEUE = 140,
37022f345d8eSLuigi Rizzo 	PPORT_RESERVED_WORD141 = 141,
37032f345d8eSLuigi Rizzo 	PPORT_RX_DROPS_MTU = 142,
37042f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_64_BYTES = 144,
37052f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_65_TO_127_BYTES = 146,
37062f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_128_TO_255_BYTES = 148,
37072f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_256_TO_511_BYTES = 150,
37082f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_512_TO_1023_BYTES = 152,
37092f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_1024_TO_1518_BYTES = 154,
37102f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_1519_TO_2047_BYTES = 156,
37112f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_2048_TO_4095_BYTES = 158,
37122f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_4096_TO_8191_BYTES = 160,
37132f345d8eSLuigi Rizzo 	PPORT_RX_PKTS_8192_TO_9216_BYTES = 162,
37142f345d8eSLuigi Rizzo 	PPORT_N_WORDS = 164
37152f345d8eSLuigi Rizzo };
37162f345d8eSLuigi Rizzo 
37172f345d8eSLuigi Rizzo /**
37182f345d8eSLuigi Rizzo  * @brief Statistics for a given Virtual Port (vPort)
37192f345d8eSLuigi Rizzo  * The following describes the vPort statistics satisfying
37202f345d8eSLuigi Rizzo  * requirements of Linux/VMWare netdev statistics and
37212f345d8eSLuigi Rizzo  * Microsoft Windows Statistics along with other Operating Systems.
37222f345d8eSLuigi Rizzo  */
37232f345d8eSLuigi Rizzo enum OCE_VPORT_STATS {
37242f345d8eSLuigi Rizzo 	VPORT_TX_PKTS = 0,
37252f345d8eSLuigi Rizzo 	VPORT_TX_UNICAST_PKTS = 2,
37262f345d8eSLuigi Rizzo 	VPORT_TX_MULTICAST_PKTS = 4,
37272f345d8eSLuigi Rizzo 	VPORT_TX_BROADCAST_PKTS = 6,
37282f345d8eSLuigi Rizzo 	VPORT_TX_BYTES = 8,
37292f345d8eSLuigi Rizzo 	VPORT_TX_UNICAST_BYTES = 10,
37302f345d8eSLuigi Rizzo 	VPORT_TX_MULTICAST_BYTES = 12,
37312f345d8eSLuigi Rizzo 	VPORT_TX_BROADCAST_BYTES = 14,
37322f345d8eSLuigi Rizzo 	VPORT_TX_DISCARDS = 16,
37332f345d8eSLuigi Rizzo 	VPORT_TX_ERRORS = 18,
37342f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_64_BYTES = 20,
37352f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_65_TO_127_BYTES = 22,
37362f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_128_TO_255_BYTES = 24,
37372f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_256_TO_511_BYTES = 26,
37382f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_512_TO_1023_BYTEs = 28,
37392f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_1024_TO_1518_BYTEs = 30,
37402f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_1519_TO_9699_BYTEs = 32,
37412f345d8eSLuigi Rizzo 	VPORT_TX_PKTS_OVER_9699_BYTES = 34,
37422f345d8eSLuigi Rizzo 	VPORT_RX_PKTS = 36,
37432f345d8eSLuigi Rizzo 	VPORT_RX_UNICAST_PKTS = 38,
37442f345d8eSLuigi Rizzo 	VPORT_RX_MULTICAST_PKTS = 40,
37452f345d8eSLuigi Rizzo 	VPORT_RX_BROADCAST_PKTS = 42,
37462f345d8eSLuigi Rizzo 	VPORT_RX_BYTES = 44,
37472f345d8eSLuigi Rizzo 	VPORT_RX_UNICAST_BYTES = 46,
37482f345d8eSLuigi Rizzo 	VPORT_RX_MULTICAST_BYTES = 48,
37492f345d8eSLuigi Rizzo 	VPORT_RX_BROADCAST_BYTES = 50,
37502f345d8eSLuigi Rizzo 	VPORT_RX_DISCARDS = 52,
37512f345d8eSLuigi Rizzo 	VPORT_RX_ERRORS = 54,
37522f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_64_BYTES = 56,
37532f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_65_TO_127_BYTES = 58,
37542f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_128_TO_255_BYTES = 60,
37552f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_256_TO_511_BYTES = 62,
37562f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_512_TO_1023_BYTEs = 64,
37572f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_1024_TO_1518_BYTEs = 66,
37582f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_1519_TO_9699_BYTEs = 68,
37592f345d8eSLuigi Rizzo 	VPORT_RX_PKTS_OVER_9699_BYTES = 70,
37602f345d8eSLuigi Rizzo 	VPORT_N_WORDS = 72
37612f345d8eSLuigi Rizzo };
37622f345d8eSLuigi Rizzo 
37632f345d8eSLuigi Rizzo /**
37642f345d8eSLuigi Rizzo  * @brief Statistics for a given queue (NIC WQ, RQ, or HDS RQ)
37652f345d8eSLuigi Rizzo  * This set satisfies requirements of VMQare NetQueue and Microsoft VMQ
37662f345d8eSLuigi Rizzo  */
37672f345d8eSLuigi Rizzo enum OCE_QUEUE_TX_STATS {
37682f345d8eSLuigi Rizzo 	QUEUE_TX_PKTS = 0,
37692f345d8eSLuigi Rizzo 	QUEUE_TX_BYTES = 2,
37702f345d8eSLuigi Rizzo 	QUEUE_TX_ERRORS = 4,
37712f345d8eSLuigi Rizzo 	QUEUE_TX_DROPS = 6,
37722f345d8eSLuigi Rizzo 	QUEUE_TX_N_WORDS = 8
37732f345d8eSLuigi Rizzo };
37742f345d8eSLuigi Rizzo 
37752f345d8eSLuigi Rizzo enum OCE_QUEUE_RX_STATS {
37762f345d8eSLuigi Rizzo 	QUEUE_RX_PKTS = 0,
37772f345d8eSLuigi Rizzo 	QUEUE_RX_BYTES = 2,
37782f345d8eSLuigi Rizzo 	QUEUE_RX_ERRORS = 4,
37792f345d8eSLuigi Rizzo 	QUEUE_RX_DROPS = 6,
37802f345d8eSLuigi Rizzo 	QUEUE_RX_BUFFER_ERRORS = 8,
37812f345d8eSLuigi Rizzo 	QUEUE_RX_N_WORDS = 10
37822f345d8eSLuigi Rizzo };
3783c2625e6eSJosh Paetzel 
3784c2625e6eSJosh Paetzel /* HW LRO structures */
3785c2625e6eSJosh Paetzel struct mbx_nic_query_lro_capabilities {
3786c2625e6eSJosh Paetzel         struct mbx_hdr hdr;
3787c2625e6eSJosh Paetzel         union {
3788c2625e6eSJosh Paetzel                 struct {
3789c2625e6eSJosh Paetzel                         uint32_t rsvd[6];
3790c2625e6eSJosh Paetzel                 } req;
3791c2625e6eSJosh Paetzel                 struct {
3792c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
3793c2625e6eSJosh Paetzel                         uint32_t lro_flags;
3794c2625e6eSJosh Paetzel                         uint16_t lro_rq_cnt;
3795c2625e6eSJosh Paetzel                         uint16_t plro_max_offload;
3796c2625e6eSJosh Paetzel                         uint32_t rsvd[4];
3797c2625e6eSJosh Paetzel #else
3798c2625e6eSJosh Paetzel                         uint32_t lro_flags;
3799c2625e6eSJosh Paetzel                         uint16_t plro_max_offload;
3800c2625e6eSJosh Paetzel                         uint16_t lro_rq_cnt;
3801c2625e6eSJosh Paetzel                         uint32_t rsvd[4];
3802c2625e6eSJosh Paetzel #endif
3803c2625e6eSJosh Paetzel                 } rsp;
3804c2625e6eSJosh Paetzel         } params;
3805c2625e6eSJosh Paetzel };
3806c2625e6eSJosh Paetzel 
3807c2625e6eSJosh Paetzel struct mbx_nic_set_iface_lro_config {
3808c2625e6eSJosh Paetzel         struct mbx_hdr hdr;
3809c2625e6eSJosh Paetzel         union {
3810c2625e6eSJosh Paetzel                 struct {
3811c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
3812c2625e6eSJosh Paetzel                         uint32_t lro_flags;
3813c2625e6eSJosh Paetzel                         uint32_t iface_id;
3814c2625e6eSJosh Paetzel                         uint32_t max_clsc_byte_cnt;
3815c2625e6eSJosh Paetzel                         uint32_t max_clsc_seg_cnt;
3816c2625e6eSJosh Paetzel                         uint32_t max_clsc_usec_delay;
3817c2625e6eSJosh Paetzel                         uint32_t min_clsc_frame_byte_cnt;
3818c2625e6eSJosh Paetzel                         uint32_t rsvd[2];
3819c2625e6eSJosh Paetzel #else
3820c2625e6eSJosh Paetzel                         uint32_t lro_flags;
3821c2625e6eSJosh Paetzel                         uint32_t iface_id;
3822c2625e6eSJosh Paetzel                         uint32_t max_clsc_byte_cnt;
3823c2625e6eSJosh Paetzel                         uint32_t max_clsc_seg_cnt;
3824c2625e6eSJosh Paetzel                         uint32_t max_clsc_usec_delay;
3825c2625e6eSJosh Paetzel                         uint32_t min_clsc_frame_byte_cnt;
3826c2625e6eSJosh Paetzel                         uint32_t rsvd[2];
3827c2625e6eSJosh Paetzel #endif
3828c2625e6eSJosh Paetzel                 } req;
3829c2625e6eSJosh Paetzel                 struct {
3830c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
3831c2625e6eSJosh Paetzel                         uint32_t lro_flags;
3832c2625e6eSJosh Paetzel                         uint32_t rsvd[7];
3833c2625e6eSJosh Paetzel #else
3834c2625e6eSJosh Paetzel                         uint32_t lro_flags;
3835c2625e6eSJosh Paetzel                         uint32_t rsvd[7];
3836c2625e6eSJosh Paetzel #endif
3837c2625e6eSJosh Paetzel                 } rsp;
3838c2625e6eSJosh Paetzel         } params;
3839c2625e6eSJosh Paetzel };
3840c2625e6eSJosh Paetzel 
3841c2625e6eSJosh Paetzel struct mbx_create_nic_rq_v2 {
3842c2625e6eSJosh Paetzel         struct mbx_hdr hdr;
3843c2625e6eSJosh Paetzel         union {
3844c2625e6eSJosh Paetzel                 struct {
3845c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
3846c2625e6eSJosh Paetzel                         uint8_t  num_pages;
3847c2625e6eSJosh Paetzel                         uint8_t  frag_size;
3848c2625e6eSJosh Paetzel                         uint16_t cq_id;
3849c2625e6eSJosh Paetzel 
3850c2625e6eSJosh Paetzel                         uint32_t if_id;
3851c2625e6eSJosh Paetzel 
3852c2625e6eSJosh Paetzel                         uint16_t page_size;
3853c2625e6eSJosh Paetzel                         uint16_t max_frame_size;
3854c2625e6eSJosh Paetzel 
3855c2625e6eSJosh Paetzel                         uint16_t rsvd;
3856c2625e6eSJosh Paetzel                         uint16_t pd_id;
3857c2625e6eSJosh Paetzel 
3858c2625e6eSJosh Paetzel                         uint16_t rsvd1;
3859c2625e6eSJosh Paetzel                         uint16_t rq_flags;
3860c2625e6eSJosh Paetzel 
3861c2625e6eSJosh Paetzel                         uint16_t hds_fixed_offset;
3862c2625e6eSJosh Paetzel                         uint8_t hds_start;
3863c2625e6eSJosh Paetzel                         uint8_t hds_frag;
3864c2625e6eSJosh Paetzel 
3865c2625e6eSJosh Paetzel                         uint16_t hds_backfill_size;
3866c2625e6eSJosh Paetzel                         uint16_t hds_frag_size;
3867c2625e6eSJosh Paetzel 
3868c2625e6eSJosh Paetzel                         uint32_t rbq_id;
3869c2625e6eSJosh Paetzel 
3870c2625e6eSJosh Paetzel                         uint32_t rsvd2[8];
3871c2625e6eSJosh Paetzel 
3872c2625e6eSJosh Paetzel                         struct phys_addr pages[2];
3873c2625e6eSJosh Paetzel #else
3874c2625e6eSJosh Paetzel                         uint16_t cq_id;
3875c2625e6eSJosh Paetzel                         uint8_t  frag_size;
3876c2625e6eSJosh Paetzel                         uint8_t  num_pages;
3877c2625e6eSJosh Paetzel 
3878c2625e6eSJosh Paetzel                         uint32_t if_id;
3879c2625e6eSJosh Paetzel 
3880c2625e6eSJosh Paetzel                         uint16_t max_frame_size;
3881c2625e6eSJosh Paetzel                         uint16_t page_size;
3882c2625e6eSJosh Paetzel 
3883c2625e6eSJosh Paetzel                         uint16_t pd_id;
3884c2625e6eSJosh Paetzel                         uint16_t rsvd;
3885c2625e6eSJosh Paetzel 
3886c2625e6eSJosh Paetzel                         uint16_t rq_flags;
3887c2625e6eSJosh Paetzel                         uint16_t rsvd1;
3888c2625e6eSJosh Paetzel 
3889c2625e6eSJosh Paetzel                         uint8_t hds_frag;
3890c2625e6eSJosh Paetzel                         uint8_t hds_start;
3891c2625e6eSJosh Paetzel                         uint16_t hds_fixed_offset;
3892c2625e6eSJosh Paetzel 
3893c2625e6eSJosh Paetzel                         uint16_t hds_frag_size;
3894c2625e6eSJosh Paetzel                         uint16_t hds_backfill_size;
3895c2625e6eSJosh Paetzel 
3896c2625e6eSJosh Paetzel                         uint32_t rbq_id;
3897c2625e6eSJosh Paetzel 
3898c2625e6eSJosh Paetzel                         uint32_t rsvd2[8];
3899c2625e6eSJosh Paetzel 
3900c2625e6eSJosh Paetzel                         struct phys_addr pages[2];
3901c2625e6eSJosh Paetzel #endif
3902c2625e6eSJosh Paetzel                 } req;
3903c2625e6eSJosh Paetzel                 struct {
3904c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
3905c2625e6eSJosh Paetzel                         uint8_t rsvd0;
3906c2625e6eSJosh Paetzel                         uint8_t rss_cpuid;
3907c2625e6eSJosh Paetzel                         uint16_t rq_id;
3908c2625e6eSJosh Paetzel 
3909c2625e6eSJosh Paetzel                         uint8_t db_format;
3910c2625e6eSJosh Paetzel                         uint8_t db_reg_set;
3911c2625e6eSJosh Paetzel                         uint16_t rsvd1;
3912c2625e6eSJosh Paetzel 
3913c2625e6eSJosh Paetzel                         uint32_t db_offset;
3914c2625e6eSJosh Paetzel 
3915c2625e6eSJosh Paetzel                         uint32_t rsvd2;
3916c2625e6eSJosh Paetzel 
3917c2625e6eSJosh Paetzel                         uint16_t rsvd3;
3918c2625e6eSJosh Paetzel                         uint16_t rq_flags;
3919c2625e6eSJosh Paetzel 
3920c2625e6eSJosh Paetzel #else
3921c2625e6eSJosh Paetzel                         uint16_t rq_id;
3922c2625e6eSJosh Paetzel                         uint8_t rss_cpuid;
3923c2625e6eSJosh Paetzel                         uint8_t rsvd0;
3924c2625e6eSJosh Paetzel 
3925c2625e6eSJosh Paetzel                         uint16_t rsvd1;
3926c2625e6eSJosh Paetzel                         uint8_t db_reg_set;
3927c2625e6eSJosh Paetzel                         uint8_t db_format;
3928c2625e6eSJosh Paetzel 
3929c2625e6eSJosh Paetzel                         uint32_t db_offset;
3930c2625e6eSJosh Paetzel 
3931c2625e6eSJosh Paetzel                         uint32_t rsvd2;
3932c2625e6eSJosh Paetzel 
3933c2625e6eSJosh Paetzel                         uint16_t rq_flags;
3934c2625e6eSJosh Paetzel                         uint16_t rsvd3;
3935c2625e6eSJosh Paetzel #endif
3936c2625e6eSJosh Paetzel                 } rsp;
3937c2625e6eSJosh Paetzel 
3938c2625e6eSJosh Paetzel         } params;
3939c2625e6eSJosh Paetzel };
3940c2625e6eSJosh Paetzel 
3941c2625e6eSJosh Paetzel struct mbx_delete_nic_rq_v1 {
3942c2625e6eSJosh Paetzel         struct mbx_hdr hdr;
3943c2625e6eSJosh Paetzel         union {
3944c2625e6eSJosh Paetzel                 struct {
3945c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
3946c2625e6eSJosh Paetzel                         uint16_t bypass_flush;
3947c2625e6eSJosh Paetzel                         uint16_t rq_id;
3948c2625e6eSJosh Paetzel                         uint16_t rsvd;
3949c2625e6eSJosh Paetzel                         uint16_t rq_flags;
3950c2625e6eSJosh Paetzel #else
3951c2625e6eSJosh Paetzel                         uint16_t rq_id;
3952c2625e6eSJosh Paetzel                         uint16_t bypass_flush;
3953c2625e6eSJosh Paetzel                         uint16_t rq_flags;
3954c2625e6eSJosh Paetzel                         uint16_t rsvd;
3955c2625e6eSJosh Paetzel #endif
3956c2625e6eSJosh Paetzel                 } req;
3957c2625e6eSJosh Paetzel                 struct {
3958c2625e6eSJosh Paetzel                         uint32_t rsvd[2];
3959c2625e6eSJosh Paetzel                 } rsp;
3960c2625e6eSJosh Paetzel         } params;
3961c2625e6eSJosh Paetzel };
3962c2625e6eSJosh Paetzel 
3963c2625e6eSJosh Paetzel struct nic_hwlro_singleton_cqe {
3964c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
3965c2625e6eSJosh Paetzel         /* dw 0 */
3966c2625e6eSJosh Paetzel         uint32_t ip_opt:1;
3967c2625e6eSJosh Paetzel         uint32_t vtp:1;
3968c2625e6eSJosh Paetzel         uint32_t pkt_size:14;
3969c2625e6eSJosh Paetzel         uint32_t vlan_tag:16;
3970c2625e6eSJosh Paetzel 
3971c2625e6eSJosh Paetzel         /* dw 1 */
3972c2625e6eSJosh Paetzel         uint32_t num_frags:3;
3973c2625e6eSJosh Paetzel         uint32_t rsvd1:3;
3974c2625e6eSJosh Paetzel         uint32_t frag_index:10;
3975c2625e6eSJosh Paetzel         uint32_t rsvd:8;
3976c2625e6eSJosh Paetzel         uint32_t ipv6_frame:1;
3977c2625e6eSJosh Paetzel         uint32_t l4_cksum_pass:1;
3978c2625e6eSJosh Paetzel         uint32_t ip_cksum_pass:1;
3979c2625e6eSJosh Paetzel         uint32_t udpframe:1;
3980c2625e6eSJosh Paetzel         uint32_t tcpframe:1;
3981c2625e6eSJosh Paetzel         uint32_t ipframe:1;
3982c2625e6eSJosh Paetzel         uint32_t rss_hp:1;
3983c2625e6eSJosh Paetzel         uint32_t error:1;
3984c2625e6eSJosh Paetzel 
3985c2625e6eSJosh Paetzel         /* dw 2 */
3986c2625e6eSJosh Paetzel         uint32_t valid:1;
3987c2625e6eSJosh Paetzel         uint32_t cqe_type:2;
3988c2625e6eSJosh Paetzel         uint32_t debug:7;
3989c2625e6eSJosh Paetzel         uint32_t rsvd4:6;
3990c2625e6eSJosh Paetzel         uint32_t data_offset:8;
3991c2625e6eSJosh Paetzel         uint32_t rsvd3:3;
3992c2625e6eSJosh Paetzel         uint32_t rss_bank:1;
3993c2625e6eSJosh Paetzel         uint32_t qnq:1;
3994c2625e6eSJosh Paetzel         uint32_t rsvd2:3;
3995c2625e6eSJosh Paetzel 
3996c2625e6eSJosh Paetzel 	/* dw 3 */
3997c2625e6eSJosh Paetzel         uint32_t rss_hash_value;
3998c2625e6eSJosh Paetzel #else
3999c2625e6eSJosh Paetzel         /* dw 0 */
4000c2625e6eSJosh Paetzel         uint32_t vlan_tag:16;
4001c2625e6eSJosh Paetzel         uint32_t pkt_size:14;
4002c2625e6eSJosh Paetzel         uint32_t vtp:1;
4003c2625e6eSJosh Paetzel         uint32_t ip_opt:1;
4004c2625e6eSJosh Paetzel 
4005c2625e6eSJosh Paetzel         /* dw 1 */
4006c2625e6eSJosh Paetzel         uint32_t error:1;
4007c2625e6eSJosh Paetzel         uint32_t rss_hp:1;
4008c2625e6eSJosh Paetzel         uint32_t ipframe:1;
4009c2625e6eSJosh Paetzel         uint32_t tcpframe:1;
4010c2625e6eSJosh Paetzel         uint32_t udpframe:1;
4011c2625e6eSJosh Paetzel         uint32_t ip_cksum_pass:1;
4012c2625e6eSJosh Paetzel         uint32_t l4_cksum_pass:1;
4013c2625e6eSJosh Paetzel         uint32_t ipv6_frame:1;
4014c2625e6eSJosh Paetzel         uint32_t rsvd:8;
4015c2625e6eSJosh Paetzel         uint32_t frag_index:10;
4016c2625e6eSJosh Paetzel         uint32_t rsvd1:3;
4017c2625e6eSJosh Paetzel         uint32_t num_frags:3;
4018c2625e6eSJosh Paetzel 
4019c2625e6eSJosh Paetzel         /* dw 2 */
4020c2625e6eSJosh Paetzel         uint32_t rsvd2:3;
4021c2625e6eSJosh Paetzel         uint32_t qnq:1;
4022c2625e6eSJosh Paetzel         uint32_t rss_bank:1;
4023c2625e6eSJosh Paetzel         uint32_t rsvd3:3;
4024c2625e6eSJosh Paetzel         uint32_t data_offset:8;
4025c2625e6eSJosh Paetzel         uint32_t rsvd4:6;
4026c2625e6eSJosh Paetzel         uint32_t debug:7;
4027c2625e6eSJosh Paetzel         uint32_t cqe_type:2;
4028c2625e6eSJosh Paetzel         uint32_t valid:1;
4029c2625e6eSJosh Paetzel 
4030c2625e6eSJosh Paetzel        /* dw 3 */
4031c2625e6eSJosh Paetzel         uint32_t rss_hash_value;
4032c2625e6eSJosh Paetzel #endif
4033c2625e6eSJosh Paetzel };
4034c2625e6eSJosh Paetzel 
4035c2625e6eSJosh Paetzel struct nic_hwlro_cqe_part1 {
4036c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
4037c2625e6eSJosh Paetzel         /* dw 0 */
4038c2625e6eSJosh Paetzel         uint32_t tcp_timestamp_val;
4039c2625e6eSJosh Paetzel 
4040c2625e6eSJosh Paetzel         /* dw 1 */
4041c2625e6eSJosh Paetzel         uint32_t tcp_timestamp_ecr;
4042c2625e6eSJosh Paetzel 
4043c2625e6eSJosh Paetzel         /* dw 2 */
4044c2625e6eSJosh Paetzel         uint32_t valid:1;
4045c2625e6eSJosh Paetzel         uint32_t cqe_type:2;
4046c2625e6eSJosh Paetzel         uint32_t rsvd3:7;
4047c2625e6eSJosh Paetzel         uint32_t rss_policy:4;
4048c2625e6eSJosh Paetzel         uint32_t rsvd2:2;
4049c2625e6eSJosh Paetzel         uint32_t data_offset:8;
4050c2625e6eSJosh Paetzel         uint32_t rsvd1:1;
4051c2625e6eSJosh Paetzel         uint32_t lro_desc:1;
4052c2625e6eSJosh Paetzel         uint32_t lro_timer_pop:1;
4053c2625e6eSJosh Paetzel         uint32_t rss_bank:1;
4054c2625e6eSJosh Paetzel         uint32_t qnq:1;
4055c2625e6eSJosh Paetzel         uint32_t rsvd:2;
4056c2625e6eSJosh Paetzel         uint32_t rss_flush:1;
4057c2625e6eSJosh Paetzel 
4058c2625e6eSJosh Paetzel 	/* dw 3 */
4059c2625e6eSJosh Paetzel         uint32_t rss_hash_value;
4060c2625e6eSJosh Paetzel #else
4061c2625e6eSJosh Paetzel         /* dw 0 */
4062c2625e6eSJosh Paetzel         uint32_t tcp_timestamp_val;
4063c2625e6eSJosh Paetzel 
4064c2625e6eSJosh Paetzel         /* dw 1 */
4065c2625e6eSJosh Paetzel         uint32_t tcp_timestamp_ecr;
4066c2625e6eSJosh Paetzel 
4067c2625e6eSJosh Paetzel         /* dw 2 */
4068c2625e6eSJosh Paetzel         uint32_t rss_flush:1;
4069c2625e6eSJosh Paetzel         uint32_t rsvd:2;
4070c2625e6eSJosh Paetzel         uint32_t qnq:1;
4071c2625e6eSJosh Paetzel         uint32_t rss_bank:1;
4072c2625e6eSJosh Paetzel         uint32_t lro_timer_pop:1;
4073c2625e6eSJosh Paetzel         uint32_t lro_desc:1;
4074c2625e6eSJosh Paetzel         uint32_t rsvd1:1;
4075c2625e6eSJosh Paetzel         uint32_t data_offset:8;
4076c2625e6eSJosh Paetzel         uint32_t rsvd2:2;
4077c2625e6eSJosh Paetzel         uint32_t rss_policy:4;
4078c2625e6eSJosh Paetzel         uint32_t rsvd3:7;
4079c2625e6eSJosh Paetzel         uint32_t cqe_type:2;
4080c2625e6eSJosh Paetzel         uint32_t valid:1;
4081c2625e6eSJosh Paetzel 
4082c2625e6eSJosh Paetzel         /* dw 3 */
4083c2625e6eSJosh Paetzel         uint32_t rss_hash_value;
4084c2625e6eSJosh Paetzel #endif
4085c2625e6eSJosh Paetzel };
4086c2625e6eSJosh Paetzel 
4087c2625e6eSJosh Paetzel struct nic_hwlro_cqe_part2 {
4088c2625e6eSJosh Paetzel #ifdef _BIG_ENDIAN
4089c2625e6eSJosh Paetzel         /* dw 0 */
4090c2625e6eSJosh Paetzel         uint32_t ip_opt:1;
4091c2625e6eSJosh Paetzel         uint32_t vtp:1;
4092c2625e6eSJosh Paetzel         uint32_t pkt_size:14;
4093c2625e6eSJosh Paetzel         uint32_t vlan_tag:16;
4094c2625e6eSJosh Paetzel 
4095c2625e6eSJosh Paetzel         /* dw 1 */
4096c2625e6eSJosh Paetzel         uint32_t tcp_window:16;
4097c2625e6eSJosh Paetzel         uint32_t coalesced_size:16;
4098c2625e6eSJosh Paetzel 
4099c2625e6eSJosh Paetzel 	/* dw 2 */
4100c2625e6eSJosh Paetzel         uint32_t valid:1;
4101c2625e6eSJosh Paetzel         uint32_t cqe_type:2;
4102c2625e6eSJosh Paetzel         uint32_t rsvd:2;
4103c2625e6eSJosh Paetzel         uint32_t push:1;
4104c2625e6eSJosh Paetzel         uint32_t ts_opt:1;
4105c2625e6eSJosh Paetzel         uint32_t threshold:1;
4106c2625e6eSJosh Paetzel         uint32_t seg_cnt:8;
4107c2625e6eSJosh Paetzel         uint32_t frame_lifespan:8;
4108c2625e6eSJosh Paetzel         uint32_t ipv6_frame:1;
4109c2625e6eSJosh Paetzel         uint32_t l4_cksum_pass:1;
4110c2625e6eSJosh Paetzel         uint32_t ip_cksum_pass:1;
4111c2625e6eSJosh Paetzel         uint32_t udpframe:1;
4112c2625e6eSJosh Paetzel         uint32_t tcpframe:1;
4113c2625e6eSJosh Paetzel         uint32_t ipframe:1;
4114c2625e6eSJosh Paetzel         uint32_t rss_hp:1;
4115c2625e6eSJosh Paetzel         uint32_t error:1;
4116c2625e6eSJosh Paetzel 
4117c2625e6eSJosh Paetzel 	/* dw 3 */
4118c2625e6eSJosh Paetzel         uint32_t tcp_ack_num;
4119c2625e6eSJosh Paetzel #else
4120c2625e6eSJosh Paetzel         /* dw 0 */
4121c2625e6eSJosh Paetzel         uint32_t vlan_tag:16;
4122c2625e6eSJosh Paetzel         uint32_t pkt_size:14;
4123c2625e6eSJosh Paetzel         uint32_t vtp:1;
4124c2625e6eSJosh Paetzel         uint32_t ip_opt:1;
4125c2625e6eSJosh Paetzel 
4126c2625e6eSJosh Paetzel         /* dw 1 */
4127c2625e6eSJosh Paetzel         uint32_t coalesced_size:16;
4128c2625e6eSJosh Paetzel         uint32_t tcp_window:16;
4129c2625e6eSJosh Paetzel 
4130c2625e6eSJosh Paetzel         /* dw 2 */
4131c2625e6eSJosh Paetzel         uint32_t error:1;
4132c2625e6eSJosh Paetzel         uint32_t rss_hp:1;
4133c2625e6eSJosh Paetzel         uint32_t ipframe:1;
4134c2625e6eSJosh Paetzel         uint32_t tcpframe:1;
4135c2625e6eSJosh Paetzel         uint32_t udpframe:1;
4136c2625e6eSJosh Paetzel         uint32_t ip_cksum_pass:1;
4137c2625e6eSJosh Paetzel         uint32_t l4_cksum_pass:1;
4138c2625e6eSJosh Paetzel         uint32_t ipv6_frame:1;
4139c2625e6eSJosh Paetzel         uint32_t frame_lifespan:8;
4140c2625e6eSJosh Paetzel         uint32_t seg_cnt:8;
4141c2625e6eSJosh Paetzel         uint32_t threshold:1;
4142c2625e6eSJosh Paetzel         uint32_t ts_opt:1;
4143c2625e6eSJosh Paetzel         uint32_t push:1;
4144c2625e6eSJosh Paetzel         uint32_t rsvd:2;
4145c2625e6eSJosh Paetzel         uint32_t cqe_type:2;
4146c2625e6eSJosh Paetzel         uint32_t valid:1;
4147c2625e6eSJosh Paetzel 
4148c2625e6eSJosh Paetzel         /* dw 3 */
4149c2625e6eSJosh Paetzel         uint32_t tcp_ack_num;
4150c2625e6eSJosh Paetzel #endif
4151c2625e6eSJosh Paetzel };
4152