18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) OR BSD-2-Clause */
28c2ecf20Sopenharmony_ci/* Copyright (c) 2017-2020 Pensando Systems, Inc.  All rights reserved. */
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci#ifndef _IONIC_IF_H_
58c2ecf20Sopenharmony_ci#define _IONIC_IF_H_
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define IONIC_DEV_INFO_SIGNATURE		0x44455649      /* 'DEVI' */
88c2ecf20Sopenharmony_ci#define IONIC_DEV_INFO_VERSION			1
98c2ecf20Sopenharmony_ci#define IONIC_IFNAMSIZ				16
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/**
128c2ecf20Sopenharmony_ci * enum ionic_cmd_opcode - Device commands
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_cienum ionic_cmd_opcode {
158c2ecf20Sopenharmony_ci	IONIC_CMD_NOP				= 0,
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci	/* Device commands */
188c2ecf20Sopenharmony_ci	IONIC_CMD_IDENTIFY			= 1,
198c2ecf20Sopenharmony_ci	IONIC_CMD_INIT				= 2,
208c2ecf20Sopenharmony_ci	IONIC_CMD_RESET				= 3,
218c2ecf20Sopenharmony_ci	IONIC_CMD_GETATTR			= 4,
228c2ecf20Sopenharmony_ci	IONIC_CMD_SETATTR			= 5,
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci	/* Port commands */
258c2ecf20Sopenharmony_ci	IONIC_CMD_PORT_IDENTIFY			= 10,
268c2ecf20Sopenharmony_ci	IONIC_CMD_PORT_INIT			= 11,
278c2ecf20Sopenharmony_ci	IONIC_CMD_PORT_RESET			= 12,
288c2ecf20Sopenharmony_ci	IONIC_CMD_PORT_GETATTR			= 13,
298c2ecf20Sopenharmony_ci	IONIC_CMD_PORT_SETATTR			= 14,
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci	/* LIF commands */
328c2ecf20Sopenharmony_ci	IONIC_CMD_LIF_IDENTIFY			= 20,
338c2ecf20Sopenharmony_ci	IONIC_CMD_LIF_INIT			= 21,
348c2ecf20Sopenharmony_ci	IONIC_CMD_LIF_RESET			= 22,
358c2ecf20Sopenharmony_ci	IONIC_CMD_LIF_GETATTR			= 23,
368c2ecf20Sopenharmony_ci	IONIC_CMD_LIF_SETATTR			= 24,
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci	IONIC_CMD_RX_MODE_SET			= 30,
398c2ecf20Sopenharmony_ci	IONIC_CMD_RX_FILTER_ADD			= 31,
408c2ecf20Sopenharmony_ci	IONIC_CMD_RX_FILTER_DEL			= 32,
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci	/* Queue commands */
438c2ecf20Sopenharmony_ci	IONIC_CMD_Q_IDENTIFY			= 39,
448c2ecf20Sopenharmony_ci	IONIC_CMD_Q_INIT			= 40,
458c2ecf20Sopenharmony_ci	IONIC_CMD_Q_CONTROL			= 41,
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci	/* RDMA commands */
488c2ecf20Sopenharmony_ci	IONIC_CMD_RDMA_RESET_LIF		= 50,
498c2ecf20Sopenharmony_ci	IONIC_CMD_RDMA_CREATE_EQ		= 51,
508c2ecf20Sopenharmony_ci	IONIC_CMD_RDMA_CREATE_CQ		= 52,
518c2ecf20Sopenharmony_ci	IONIC_CMD_RDMA_CREATE_ADMINQ		= 53,
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci	/* SR/IOV commands */
548c2ecf20Sopenharmony_ci	IONIC_CMD_VF_GETATTR			= 60,
558c2ecf20Sopenharmony_ci	IONIC_CMD_VF_SETATTR			= 61,
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci	/* QoS commands */
588c2ecf20Sopenharmony_ci	IONIC_CMD_QOS_CLASS_IDENTIFY		= 240,
598c2ecf20Sopenharmony_ci	IONIC_CMD_QOS_CLASS_INIT		= 241,
608c2ecf20Sopenharmony_ci	IONIC_CMD_QOS_CLASS_RESET		= 242,
618c2ecf20Sopenharmony_ci	IONIC_CMD_QOS_CLASS_UPDATE		= 243,
628c2ecf20Sopenharmony_ci	IONIC_CMD_QOS_CLEAR_STATS		= 244,
638c2ecf20Sopenharmony_ci	IONIC_CMD_QOS_RESET			= 245,
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci	/* Firmware commands */
668c2ecf20Sopenharmony_ci	IONIC_CMD_FW_DOWNLOAD                   = 252,
678c2ecf20Sopenharmony_ci	IONIC_CMD_FW_CONTROL                    = 253,
688c2ecf20Sopenharmony_ci	IONIC_CMD_FW_DOWNLOAD_V1		= 254,
698c2ecf20Sopenharmony_ci	IONIC_CMD_FW_CONTROL_V1		        = 255,
708c2ecf20Sopenharmony_ci};
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci/**
738c2ecf20Sopenharmony_ci * enum ionic_status_code - Device command return codes
748c2ecf20Sopenharmony_ci */
758c2ecf20Sopenharmony_cienum ionic_status_code {
768c2ecf20Sopenharmony_ci	IONIC_RC_SUCCESS	= 0,	/* Success */
778c2ecf20Sopenharmony_ci	IONIC_RC_EVERSION	= 1,	/* Incorrect version for request */
788c2ecf20Sopenharmony_ci	IONIC_RC_EOPCODE	= 2,	/* Invalid cmd opcode */
798c2ecf20Sopenharmony_ci	IONIC_RC_EIO		= 3,	/* I/O error */
808c2ecf20Sopenharmony_ci	IONIC_RC_EPERM		= 4,	/* Permission denied */
818c2ecf20Sopenharmony_ci	IONIC_RC_EQID		= 5,	/* Bad qid */
828c2ecf20Sopenharmony_ci	IONIC_RC_EQTYPE		= 6,	/* Bad qtype */
838c2ecf20Sopenharmony_ci	IONIC_RC_ENOENT		= 7,	/* No such element */
848c2ecf20Sopenharmony_ci	IONIC_RC_EINTR		= 8,	/* operation interrupted */
858c2ecf20Sopenharmony_ci	IONIC_RC_EAGAIN		= 9,	/* Try again */
868c2ecf20Sopenharmony_ci	IONIC_RC_ENOMEM		= 10,	/* Out of memory */
878c2ecf20Sopenharmony_ci	IONIC_RC_EFAULT		= 11,	/* Bad address */
888c2ecf20Sopenharmony_ci	IONIC_RC_EBUSY		= 12,	/* Device or resource busy */
898c2ecf20Sopenharmony_ci	IONIC_RC_EEXIST		= 13,	/* object already exists */
908c2ecf20Sopenharmony_ci	IONIC_RC_EINVAL		= 14,	/* Invalid argument */
918c2ecf20Sopenharmony_ci	IONIC_RC_ENOSPC		= 15,	/* No space left or alloc failure */
928c2ecf20Sopenharmony_ci	IONIC_RC_ERANGE		= 16,	/* Parameter out of range */
938c2ecf20Sopenharmony_ci	IONIC_RC_BAD_ADDR	= 17,	/* Descriptor contains a bad ptr */
948c2ecf20Sopenharmony_ci	IONIC_RC_DEV_CMD	= 18,	/* Device cmd attempted on AdminQ */
958c2ecf20Sopenharmony_ci	IONIC_RC_ENOSUPP	= 19,	/* Operation not supported */
968c2ecf20Sopenharmony_ci	IONIC_RC_ERROR		= 29,	/* Generic error */
978c2ecf20Sopenharmony_ci	IONIC_RC_ERDMA		= 30,	/* Generic RDMA error */
988c2ecf20Sopenharmony_ci	IONIC_RC_EVFID		= 31,	/* VF ID does not exist */
998c2ecf20Sopenharmony_ci	IONIC_RC_EBAD_FW	= 32,	/* FW file is invalid or corrupted */
1008c2ecf20Sopenharmony_ci};
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_cienum ionic_notifyq_opcode {
1038c2ecf20Sopenharmony_ci	IONIC_EVENT_LINK_CHANGE		= 1,
1048c2ecf20Sopenharmony_ci	IONIC_EVENT_RESET		= 2,
1058c2ecf20Sopenharmony_ci	IONIC_EVENT_HEARTBEAT		= 3,
1068c2ecf20Sopenharmony_ci	IONIC_EVENT_LOG			= 4,
1078c2ecf20Sopenharmony_ci	IONIC_EVENT_XCVR		= 5,
1088c2ecf20Sopenharmony_ci};
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/**
1118c2ecf20Sopenharmony_ci * struct ionic_admin_cmd - General admin command format
1128c2ecf20Sopenharmony_ci * @opcode:     Opcode for the command
1138c2ecf20Sopenharmony_ci * @lif_index:  LIF index
1148c2ecf20Sopenharmony_ci * @cmd_data:   Opcode-specific command bytes
1158c2ecf20Sopenharmony_ci */
1168c2ecf20Sopenharmony_cistruct ionic_admin_cmd {
1178c2ecf20Sopenharmony_ci	u8     opcode;
1188c2ecf20Sopenharmony_ci	u8     rsvd;
1198c2ecf20Sopenharmony_ci	__le16 lif_index;
1208c2ecf20Sopenharmony_ci	u8     cmd_data[60];
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/**
1248c2ecf20Sopenharmony_ci * struct ionic_admin_comp - General admin command completion format
1258c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
1268c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
1278c2ecf20Sopenharmony_ci * @cmd_data:   Command-specific bytes
1288c2ecf20Sopenharmony_ci * @color:      Color bit (Always 0 for commands issued to the
1298c2ecf20Sopenharmony_ci *              Device Cmd Registers)
1308c2ecf20Sopenharmony_ci */
1318c2ecf20Sopenharmony_cistruct ionic_admin_comp {
1328c2ecf20Sopenharmony_ci	u8     status;
1338c2ecf20Sopenharmony_ci	u8     rsvd;
1348c2ecf20Sopenharmony_ci	__le16 comp_index;
1358c2ecf20Sopenharmony_ci	u8     cmd_data[11];
1368c2ecf20Sopenharmony_ci	u8     color;
1378c2ecf20Sopenharmony_ci#define IONIC_COMP_COLOR_MASK  0x80
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_cistatic inline u8 color_match(u8 color, u8 done_color)
1418c2ecf20Sopenharmony_ci{
1428c2ecf20Sopenharmony_ci	return (!!(color & IONIC_COMP_COLOR_MASK)) == done_color;
1438c2ecf20Sopenharmony_ci}
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci/**
1468c2ecf20Sopenharmony_ci * struct ionic_nop_cmd - NOP command
1478c2ecf20Sopenharmony_ci * @opcode: opcode
1488c2ecf20Sopenharmony_ci */
1498c2ecf20Sopenharmony_cistruct ionic_nop_cmd {
1508c2ecf20Sopenharmony_ci	u8 opcode;
1518c2ecf20Sopenharmony_ci	u8 rsvd[63];
1528c2ecf20Sopenharmony_ci};
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci/**
1558c2ecf20Sopenharmony_ci * struct ionic_nop_comp - NOP command completion
1568c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
1578c2ecf20Sopenharmony_ci */
1588c2ecf20Sopenharmony_cistruct ionic_nop_comp {
1598c2ecf20Sopenharmony_ci	u8 status;
1608c2ecf20Sopenharmony_ci	u8 rsvd[15];
1618c2ecf20Sopenharmony_ci};
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci/**
1648c2ecf20Sopenharmony_ci * struct ionic_dev_init_cmd - Device init command
1658c2ecf20Sopenharmony_ci * @opcode:    opcode
1668c2ecf20Sopenharmony_ci * @type:      Device type
1678c2ecf20Sopenharmony_ci */
1688c2ecf20Sopenharmony_cistruct ionic_dev_init_cmd {
1698c2ecf20Sopenharmony_ci	u8     opcode;
1708c2ecf20Sopenharmony_ci	u8     type;
1718c2ecf20Sopenharmony_ci	u8     rsvd[62];
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/**
1758c2ecf20Sopenharmony_ci * struct ionic_dev_init_comp - Device init command completion
1768c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
1778c2ecf20Sopenharmony_ci */
1788c2ecf20Sopenharmony_cistruct ionic_dev_init_comp {
1798c2ecf20Sopenharmony_ci	u8 status;
1808c2ecf20Sopenharmony_ci	u8 rsvd[15];
1818c2ecf20Sopenharmony_ci};
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/**
1848c2ecf20Sopenharmony_ci * struct ionic_dev_reset_cmd - Device reset command
1858c2ecf20Sopenharmony_ci * @opcode: opcode
1868c2ecf20Sopenharmony_ci */
1878c2ecf20Sopenharmony_cistruct ionic_dev_reset_cmd {
1888c2ecf20Sopenharmony_ci	u8 opcode;
1898c2ecf20Sopenharmony_ci	u8 rsvd[63];
1908c2ecf20Sopenharmony_ci};
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci/**
1938c2ecf20Sopenharmony_ci * struct ionic_dev_reset_comp - Reset command completion
1948c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
1958c2ecf20Sopenharmony_ci */
1968c2ecf20Sopenharmony_cistruct ionic_dev_reset_comp {
1978c2ecf20Sopenharmony_ci	u8 status;
1988c2ecf20Sopenharmony_ci	u8 rsvd[15];
1998c2ecf20Sopenharmony_ci};
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci#define IONIC_IDENTITY_VERSION_1	1
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci/**
2048c2ecf20Sopenharmony_ci * struct ionic_dev_identify_cmd - Driver/device identify command
2058c2ecf20Sopenharmony_ci * @opcode:  opcode
2068c2ecf20Sopenharmony_ci * @ver:     Highest version of identify supported by driver
2078c2ecf20Sopenharmony_ci */
2088c2ecf20Sopenharmony_cistruct ionic_dev_identify_cmd {
2098c2ecf20Sopenharmony_ci	u8 opcode;
2108c2ecf20Sopenharmony_ci	u8 ver;
2118c2ecf20Sopenharmony_ci	u8 rsvd[62];
2128c2ecf20Sopenharmony_ci};
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci/**
2158c2ecf20Sopenharmony_ci * struct ionic_dev_identify_comp - Driver/device identify command completion
2168c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
2178c2ecf20Sopenharmony_ci * @ver:    Version of identify returned by device
2188c2ecf20Sopenharmony_ci */
2198c2ecf20Sopenharmony_cistruct ionic_dev_identify_comp {
2208c2ecf20Sopenharmony_ci	u8 status;
2218c2ecf20Sopenharmony_ci	u8 ver;
2228c2ecf20Sopenharmony_ci	u8 rsvd[14];
2238c2ecf20Sopenharmony_ci};
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_cienum ionic_os_type {
2268c2ecf20Sopenharmony_ci	IONIC_OS_TYPE_LINUX   = 1,
2278c2ecf20Sopenharmony_ci	IONIC_OS_TYPE_WIN     = 2,
2288c2ecf20Sopenharmony_ci	IONIC_OS_TYPE_DPDK    = 3,
2298c2ecf20Sopenharmony_ci	IONIC_OS_TYPE_FREEBSD = 4,
2308c2ecf20Sopenharmony_ci	IONIC_OS_TYPE_IPXE    = 5,
2318c2ecf20Sopenharmony_ci	IONIC_OS_TYPE_ESXI    = 6,
2328c2ecf20Sopenharmony_ci};
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/**
2358c2ecf20Sopenharmony_ci * union ionic_drv_identity - driver identity information
2368c2ecf20Sopenharmony_ci * @os_type:          OS type (see enum ionic_os_type)
2378c2ecf20Sopenharmony_ci * @os_dist:          OS distribution, numeric format
2388c2ecf20Sopenharmony_ci * @os_dist_str:      OS distribution, string format
2398c2ecf20Sopenharmony_ci * @kernel_ver:       Kernel version, numeric format
2408c2ecf20Sopenharmony_ci * @kernel_ver_str:   Kernel version, string format
2418c2ecf20Sopenharmony_ci * @driver_ver_str:   Driver version, string format
2428c2ecf20Sopenharmony_ci */
2438c2ecf20Sopenharmony_ciunion ionic_drv_identity {
2448c2ecf20Sopenharmony_ci	struct {
2458c2ecf20Sopenharmony_ci		__le32 os_type;
2468c2ecf20Sopenharmony_ci		__le32 os_dist;
2478c2ecf20Sopenharmony_ci		char   os_dist_str[128];
2488c2ecf20Sopenharmony_ci		__le32 kernel_ver;
2498c2ecf20Sopenharmony_ci		char   kernel_ver_str[32];
2508c2ecf20Sopenharmony_ci		char   driver_ver_str[32];
2518c2ecf20Sopenharmony_ci	};
2528c2ecf20Sopenharmony_ci	__le32 words[478];
2538c2ecf20Sopenharmony_ci};
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_ci/**
2568c2ecf20Sopenharmony_ci * union ionic_dev_identity - device identity information
2578c2ecf20Sopenharmony_ci * @version:          Version of device identify
2588c2ecf20Sopenharmony_ci * @type:             Identify type (0 for now)
2598c2ecf20Sopenharmony_ci * @nports:           Number of ports provisioned
2608c2ecf20Sopenharmony_ci * @nlifs:            Number of LIFs provisioned
2618c2ecf20Sopenharmony_ci * @nintrs:           Number of interrupts provisioned
2628c2ecf20Sopenharmony_ci * @ndbpgs_per_lif:   Number of doorbell pages per LIF
2638c2ecf20Sopenharmony_ci * @intr_coal_mult:   Interrupt coalescing multiplication factor
2648c2ecf20Sopenharmony_ci *                    Scale user-supplied interrupt coalescing
2658c2ecf20Sopenharmony_ci *                    value in usecs to device units using:
2668c2ecf20Sopenharmony_ci *                    device units = usecs * mult / div
2678c2ecf20Sopenharmony_ci * @intr_coal_div:    Interrupt coalescing division factor
2688c2ecf20Sopenharmony_ci *                    Scale user-supplied interrupt coalescing
2698c2ecf20Sopenharmony_ci *                    value in usecs to device units using:
2708c2ecf20Sopenharmony_ci *                    device units = usecs * mult / div
2718c2ecf20Sopenharmony_ci * @eq_count:         Number of shared event queues
2728c2ecf20Sopenharmony_ci */
2738c2ecf20Sopenharmony_ciunion ionic_dev_identity {
2748c2ecf20Sopenharmony_ci	struct {
2758c2ecf20Sopenharmony_ci		u8     version;
2768c2ecf20Sopenharmony_ci		u8     type;
2778c2ecf20Sopenharmony_ci		u8     rsvd[2];
2788c2ecf20Sopenharmony_ci		u8     nports;
2798c2ecf20Sopenharmony_ci		u8     rsvd2[3];
2808c2ecf20Sopenharmony_ci		__le32 nlifs;
2818c2ecf20Sopenharmony_ci		__le32 nintrs;
2828c2ecf20Sopenharmony_ci		__le32 ndbpgs_per_lif;
2838c2ecf20Sopenharmony_ci		__le32 intr_coal_mult;
2848c2ecf20Sopenharmony_ci		__le32 intr_coal_div;
2858c2ecf20Sopenharmony_ci		__le32 eq_count;
2868c2ecf20Sopenharmony_ci	};
2878c2ecf20Sopenharmony_ci	__le32 words[478];
2888c2ecf20Sopenharmony_ci};
2898c2ecf20Sopenharmony_ci
2908c2ecf20Sopenharmony_cienum ionic_lif_type {
2918c2ecf20Sopenharmony_ci	IONIC_LIF_TYPE_CLASSIC = 0,
2928c2ecf20Sopenharmony_ci	IONIC_LIF_TYPE_MACVLAN = 1,
2938c2ecf20Sopenharmony_ci	IONIC_LIF_TYPE_NETQUEUE = 2,
2948c2ecf20Sopenharmony_ci};
2958c2ecf20Sopenharmony_ci
2968c2ecf20Sopenharmony_ci/**
2978c2ecf20Sopenharmony_ci * struct ionic_lif_identify_cmd - LIF identify command
2988c2ecf20Sopenharmony_ci * @opcode:  opcode
2998c2ecf20Sopenharmony_ci * @type:    LIF type (enum ionic_lif_type)
3008c2ecf20Sopenharmony_ci * @ver:     Version of identify returned by device
3018c2ecf20Sopenharmony_ci */
3028c2ecf20Sopenharmony_cistruct ionic_lif_identify_cmd {
3038c2ecf20Sopenharmony_ci	u8 opcode;
3048c2ecf20Sopenharmony_ci	u8 type;
3058c2ecf20Sopenharmony_ci	u8 ver;
3068c2ecf20Sopenharmony_ci	u8 rsvd[61];
3078c2ecf20Sopenharmony_ci};
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci/**
3108c2ecf20Sopenharmony_ci * struct ionic_lif_identify_comp - LIF identify command completion
3118c2ecf20Sopenharmony_ci * @status:  Status of the command (enum ionic_status_code)
3128c2ecf20Sopenharmony_ci * @ver:     Version of identify returned by device
3138c2ecf20Sopenharmony_ci */
3148c2ecf20Sopenharmony_cistruct ionic_lif_identify_comp {
3158c2ecf20Sopenharmony_ci	u8 status;
3168c2ecf20Sopenharmony_ci	u8 ver;
3178c2ecf20Sopenharmony_ci	u8 rsvd2[14];
3188c2ecf20Sopenharmony_ci};
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_ci/**
3218c2ecf20Sopenharmony_ci * enum ionic_lif_capability - LIF capabilities
3228c2ecf20Sopenharmony_ci * @IONIC_LIF_CAP_ETH:     LIF supports Ethernet
3238c2ecf20Sopenharmony_ci * @IONIC_LIF_CAP_RDMA:    LIF support RDMA
3248c2ecf20Sopenharmony_ci */
3258c2ecf20Sopenharmony_cienum ionic_lif_capability {
3268c2ecf20Sopenharmony_ci	IONIC_LIF_CAP_ETH        = BIT(0),
3278c2ecf20Sopenharmony_ci	IONIC_LIF_CAP_RDMA       = BIT(1),
3288c2ecf20Sopenharmony_ci};
3298c2ecf20Sopenharmony_ci
3308c2ecf20Sopenharmony_ci/**
3318c2ecf20Sopenharmony_ci * enum ionic_logical_qtype - Logical Queue Types
3328c2ecf20Sopenharmony_ci * @IONIC_QTYPE_ADMINQ:    Administrative Queue
3338c2ecf20Sopenharmony_ci * @IONIC_QTYPE_NOTIFYQ:   Notify Queue
3348c2ecf20Sopenharmony_ci * @IONIC_QTYPE_RXQ:       Receive Queue
3358c2ecf20Sopenharmony_ci * @IONIC_QTYPE_TXQ:       Transmit Queue
3368c2ecf20Sopenharmony_ci * @IONIC_QTYPE_EQ:        Event Queue
3378c2ecf20Sopenharmony_ci * @IONIC_QTYPE_MAX:       Max queue type supported
3388c2ecf20Sopenharmony_ci */
3398c2ecf20Sopenharmony_cienum ionic_logical_qtype {
3408c2ecf20Sopenharmony_ci	IONIC_QTYPE_ADMINQ  = 0,
3418c2ecf20Sopenharmony_ci	IONIC_QTYPE_NOTIFYQ = 1,
3428c2ecf20Sopenharmony_ci	IONIC_QTYPE_RXQ     = 2,
3438c2ecf20Sopenharmony_ci	IONIC_QTYPE_TXQ     = 3,
3448c2ecf20Sopenharmony_ci	IONIC_QTYPE_EQ      = 4,
3458c2ecf20Sopenharmony_ci	IONIC_QTYPE_MAX     = 16,
3468c2ecf20Sopenharmony_ci};
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ci/**
3498c2ecf20Sopenharmony_ci * struct ionic_lif_logical_qtype - Descriptor of logical to HW queue type
3508c2ecf20Sopenharmony_ci * @qtype:          Hardware Queue Type
3518c2ecf20Sopenharmony_ci * @qid_count:      Number of Queue IDs of the logical type
3528c2ecf20Sopenharmony_ci * @qid_base:       Minimum Queue ID of the logical type
3538c2ecf20Sopenharmony_ci */
3548c2ecf20Sopenharmony_cistruct ionic_lif_logical_qtype {
3558c2ecf20Sopenharmony_ci	u8     qtype;
3568c2ecf20Sopenharmony_ci	u8     rsvd[3];
3578c2ecf20Sopenharmony_ci	__le32 qid_count;
3588c2ecf20Sopenharmony_ci	__le32 qid_base;
3598c2ecf20Sopenharmony_ci};
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci/**
3628c2ecf20Sopenharmony_ci * enum ionic_lif_state - LIF state
3638c2ecf20Sopenharmony_ci * @IONIC_LIF_DISABLE:     LIF disabled
3648c2ecf20Sopenharmony_ci * @IONIC_LIF_ENABLE:      LIF enabled
3658c2ecf20Sopenharmony_ci * @IONIC_LIF_QUIESCE:     LIF Quiesced
3668c2ecf20Sopenharmony_ci */
3678c2ecf20Sopenharmony_cienum ionic_lif_state {
3688c2ecf20Sopenharmony_ci	IONIC_LIF_QUIESCE	= 0,
3698c2ecf20Sopenharmony_ci	IONIC_LIF_ENABLE	= 1,
3708c2ecf20Sopenharmony_ci	IONIC_LIF_DISABLE	= 2,
3718c2ecf20Sopenharmony_ci};
3728c2ecf20Sopenharmony_ci
3738c2ecf20Sopenharmony_ci/**
3748c2ecf20Sopenharmony_ci * union ionic_lif_config - LIF configuration
3758c2ecf20Sopenharmony_ci * @state:          LIF state (enum ionic_lif_state)
3768c2ecf20Sopenharmony_ci * @name:           LIF name
3778c2ecf20Sopenharmony_ci * @mtu:            MTU
3788c2ecf20Sopenharmony_ci * @mac:            Station MAC address
3798c2ecf20Sopenharmony_ci * @vlan:           Default Vlan ID
3808c2ecf20Sopenharmony_ci * @features:       Features (enum ionic_eth_hw_features)
3818c2ecf20Sopenharmony_ci * @queue_count:    Queue counts per queue-type
3828c2ecf20Sopenharmony_ci */
3838c2ecf20Sopenharmony_ciunion ionic_lif_config {
3848c2ecf20Sopenharmony_ci	struct {
3858c2ecf20Sopenharmony_ci		u8     state;
3868c2ecf20Sopenharmony_ci		u8     rsvd[3];
3878c2ecf20Sopenharmony_ci		char   name[IONIC_IFNAMSIZ];
3888c2ecf20Sopenharmony_ci		__le32 mtu;
3898c2ecf20Sopenharmony_ci		u8     mac[6];
3908c2ecf20Sopenharmony_ci		__le16 vlan;
3918c2ecf20Sopenharmony_ci		__le64 features;
3928c2ecf20Sopenharmony_ci		__le32 queue_count[IONIC_QTYPE_MAX];
3938c2ecf20Sopenharmony_ci	} __packed;
3948c2ecf20Sopenharmony_ci	__le32 words[64];
3958c2ecf20Sopenharmony_ci};
3968c2ecf20Sopenharmony_ci
3978c2ecf20Sopenharmony_ci/**
3988c2ecf20Sopenharmony_ci * struct ionic_lif_identity - LIF identity information (type-specific)
3998c2ecf20Sopenharmony_ci *
4008c2ecf20Sopenharmony_ci * @capabilities:        LIF capabilities
4018c2ecf20Sopenharmony_ci *
4028c2ecf20Sopenharmony_ci * @eth:                    Ethernet identify structure
4038c2ecf20Sopenharmony_ci *     @version:            Ethernet identify structure version
4048c2ecf20Sopenharmony_ci *     @max_ucast_filters:  Number of perfect unicast addresses supported
4058c2ecf20Sopenharmony_ci *     @max_mcast_filters:  Number of perfect multicast addresses supported
4068c2ecf20Sopenharmony_ci *     @min_frame_size:     Minimum size of frames to be sent
4078c2ecf20Sopenharmony_ci *     @max_frame_size:     Maximim size of frames to be sent
4088c2ecf20Sopenharmony_ci *     @config:             LIF config struct with features, mtu, mac, q counts
4098c2ecf20Sopenharmony_ci *
4108c2ecf20Sopenharmony_ci * @rdma:                RDMA identify structure
4118c2ecf20Sopenharmony_ci *     @version:         RDMA version of opcodes and queue descriptors
4128c2ecf20Sopenharmony_ci *     @qp_opcodes:      Number of RDMA queue pair opcodes supported
4138c2ecf20Sopenharmony_ci *     @admin_opcodes:   Number of RDMA admin opcodes supported
4148c2ecf20Sopenharmony_ci *     @npts_per_lif:    Page table size per LIF
4158c2ecf20Sopenharmony_ci *     @nmrs_per_lif:    Number of memory regions per LIF
4168c2ecf20Sopenharmony_ci *     @nahs_per_lif:    Number of address handles per LIF
4178c2ecf20Sopenharmony_ci *     @max_stride:      Max work request stride
4188c2ecf20Sopenharmony_ci *     @cl_stride:       Cache line stride
4198c2ecf20Sopenharmony_ci *     @pte_stride:      Page table entry stride
4208c2ecf20Sopenharmony_ci *     @rrq_stride:      Remote RQ work request stride
4218c2ecf20Sopenharmony_ci *     @rsq_stride:      Remote SQ work request stride
4228c2ecf20Sopenharmony_ci *     @dcqcn_profiles:  Number of DCQCN profiles
4238c2ecf20Sopenharmony_ci *     @aq_qtype:        RDMA Admin Qtype
4248c2ecf20Sopenharmony_ci *     @sq_qtype:        RDMA Send Qtype
4258c2ecf20Sopenharmony_ci *     @rq_qtype:        RDMA Receive Qtype
4268c2ecf20Sopenharmony_ci *     @cq_qtype:        RDMA Completion Qtype
4278c2ecf20Sopenharmony_ci *     @eq_qtype:        RDMA Event Qtype
4288c2ecf20Sopenharmony_ci */
4298c2ecf20Sopenharmony_ciunion ionic_lif_identity {
4308c2ecf20Sopenharmony_ci	struct {
4318c2ecf20Sopenharmony_ci		__le64 capabilities;
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ci		struct {
4348c2ecf20Sopenharmony_ci			u8 version;
4358c2ecf20Sopenharmony_ci			u8 rsvd[3];
4368c2ecf20Sopenharmony_ci			__le32 max_ucast_filters;
4378c2ecf20Sopenharmony_ci			__le32 max_mcast_filters;
4388c2ecf20Sopenharmony_ci			__le16 rss_ind_tbl_sz;
4398c2ecf20Sopenharmony_ci			__le32 min_frame_size;
4408c2ecf20Sopenharmony_ci			__le32 max_frame_size;
4418c2ecf20Sopenharmony_ci			u8 rsvd2[106];
4428c2ecf20Sopenharmony_ci			union ionic_lif_config config;
4438c2ecf20Sopenharmony_ci		} __packed eth;
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci		struct {
4468c2ecf20Sopenharmony_ci			u8 version;
4478c2ecf20Sopenharmony_ci			u8 qp_opcodes;
4488c2ecf20Sopenharmony_ci			u8 admin_opcodes;
4498c2ecf20Sopenharmony_ci			u8 rsvd;
4508c2ecf20Sopenharmony_ci			__le32 npts_per_lif;
4518c2ecf20Sopenharmony_ci			__le32 nmrs_per_lif;
4528c2ecf20Sopenharmony_ci			__le32 nahs_per_lif;
4538c2ecf20Sopenharmony_ci			u8 max_stride;
4548c2ecf20Sopenharmony_ci			u8 cl_stride;
4558c2ecf20Sopenharmony_ci			u8 pte_stride;
4568c2ecf20Sopenharmony_ci			u8 rrq_stride;
4578c2ecf20Sopenharmony_ci			u8 rsq_stride;
4588c2ecf20Sopenharmony_ci			u8 dcqcn_profiles;
4598c2ecf20Sopenharmony_ci			u8 rsvd_dimensions[10];
4608c2ecf20Sopenharmony_ci			struct ionic_lif_logical_qtype aq_qtype;
4618c2ecf20Sopenharmony_ci			struct ionic_lif_logical_qtype sq_qtype;
4628c2ecf20Sopenharmony_ci			struct ionic_lif_logical_qtype rq_qtype;
4638c2ecf20Sopenharmony_ci			struct ionic_lif_logical_qtype cq_qtype;
4648c2ecf20Sopenharmony_ci			struct ionic_lif_logical_qtype eq_qtype;
4658c2ecf20Sopenharmony_ci		} __packed rdma;
4668c2ecf20Sopenharmony_ci	} __packed;
4678c2ecf20Sopenharmony_ci	__le32 words[478];
4688c2ecf20Sopenharmony_ci};
4698c2ecf20Sopenharmony_ci
4708c2ecf20Sopenharmony_ci/**
4718c2ecf20Sopenharmony_ci * struct ionic_lif_init_cmd - LIF init command
4728c2ecf20Sopenharmony_ci * @opcode:       Opcode
4738c2ecf20Sopenharmony_ci * @type:         LIF type (enum ionic_lif_type)
4748c2ecf20Sopenharmony_ci * @index:        LIF index
4758c2ecf20Sopenharmony_ci * @info_pa:      Destination address for LIF info (struct ionic_lif_info)
4768c2ecf20Sopenharmony_ci */
4778c2ecf20Sopenharmony_cistruct ionic_lif_init_cmd {
4788c2ecf20Sopenharmony_ci	u8     opcode;
4798c2ecf20Sopenharmony_ci	u8     type;
4808c2ecf20Sopenharmony_ci	__le16 index;
4818c2ecf20Sopenharmony_ci	__le32 rsvd;
4828c2ecf20Sopenharmony_ci	__le64 info_pa;
4838c2ecf20Sopenharmony_ci	u8     rsvd2[48];
4848c2ecf20Sopenharmony_ci};
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci/**
4878c2ecf20Sopenharmony_ci * struct ionic_lif_init_comp - LIF init command completion
4888c2ecf20Sopenharmony_ci * @status:	Status of the command (enum ionic_status_code)
4898c2ecf20Sopenharmony_ci * @hw_index:	Hardware index of the initialized LIF
4908c2ecf20Sopenharmony_ci */
4918c2ecf20Sopenharmony_cistruct ionic_lif_init_comp {
4928c2ecf20Sopenharmony_ci	u8 status;
4938c2ecf20Sopenharmony_ci	u8 rsvd;
4948c2ecf20Sopenharmony_ci	__le16 hw_index;
4958c2ecf20Sopenharmony_ci	u8 rsvd2[12];
4968c2ecf20Sopenharmony_ci};
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci/**
4998c2ecf20Sopenharmony_ci * struct ionic_q_identify_cmd - queue identify command
5008c2ecf20Sopenharmony_ci * @opcode:     opcode
5018c2ecf20Sopenharmony_ci * @lif_type:   LIF type (enum ionic_lif_type)
5028c2ecf20Sopenharmony_ci * @type:       Logical queue type (enum ionic_logical_qtype)
5038c2ecf20Sopenharmony_ci * @ver:        Highest queue type version that the driver supports
5048c2ecf20Sopenharmony_ci */
5058c2ecf20Sopenharmony_cistruct ionic_q_identify_cmd {
5068c2ecf20Sopenharmony_ci	u8     opcode;
5078c2ecf20Sopenharmony_ci	u8     rsvd;
5088c2ecf20Sopenharmony_ci	__le16 lif_type;
5098c2ecf20Sopenharmony_ci	u8     type;
5108c2ecf20Sopenharmony_ci	u8     ver;
5118c2ecf20Sopenharmony_ci	u8     rsvd2[58];
5128c2ecf20Sopenharmony_ci};
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci/**
5158c2ecf20Sopenharmony_ci * struct ionic_q_identify_comp - queue identify command completion
5168c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
5178c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
5188c2ecf20Sopenharmony_ci * @ver:        Queue type version that can be used with FW
5198c2ecf20Sopenharmony_ci */
5208c2ecf20Sopenharmony_cistruct ionic_q_identify_comp {
5218c2ecf20Sopenharmony_ci	u8     status;
5228c2ecf20Sopenharmony_ci	u8     rsvd;
5238c2ecf20Sopenharmony_ci	__le16 comp_index;
5248c2ecf20Sopenharmony_ci	u8     ver;
5258c2ecf20Sopenharmony_ci	u8     rsvd2[11];
5268c2ecf20Sopenharmony_ci};
5278c2ecf20Sopenharmony_ci
5288c2ecf20Sopenharmony_ci/**
5298c2ecf20Sopenharmony_ci * union ionic_q_identity - queue identity information
5308c2ecf20Sopenharmony_ci *     @version:        Queue type version that can be used with FW
5318c2ecf20Sopenharmony_ci *     @supported:      Bitfield of queue versions, first bit = ver 0
5328c2ecf20Sopenharmony_ci *     @features:       Queue features
5338c2ecf20Sopenharmony_ci *     @desc_sz:        Descriptor size
5348c2ecf20Sopenharmony_ci *     @comp_sz:        Completion descriptor size
5358c2ecf20Sopenharmony_ci *     @sg_desc_sz:     Scatter/Gather descriptor size
5368c2ecf20Sopenharmony_ci *     @max_sg_elems:   Maximum number of Scatter/Gather elements
5378c2ecf20Sopenharmony_ci *     @sg_desc_stride: Number of Scatter/Gather elements per descriptor
5388c2ecf20Sopenharmony_ci */
5398c2ecf20Sopenharmony_ciunion ionic_q_identity {
5408c2ecf20Sopenharmony_ci	struct {
5418c2ecf20Sopenharmony_ci		u8      version;
5428c2ecf20Sopenharmony_ci		u8      supported;
5438c2ecf20Sopenharmony_ci		u8      rsvd[6];
5448c2ecf20Sopenharmony_ci#define IONIC_QIDENT_F_CQ	0x01	/* queue has completion ring */
5458c2ecf20Sopenharmony_ci#define IONIC_QIDENT_F_SG	0x02	/* queue has scatter/gather ring */
5468c2ecf20Sopenharmony_ci#define IONIC_QIDENT_F_EQ	0x04	/* queue can use event queue */
5478c2ecf20Sopenharmony_ci#define IONIC_QIDENT_F_CMB	0x08	/* queue is in cmb bar */
5488c2ecf20Sopenharmony_ci		__le64  features;
5498c2ecf20Sopenharmony_ci		__le16  desc_sz;
5508c2ecf20Sopenharmony_ci		__le16  comp_sz;
5518c2ecf20Sopenharmony_ci		__le16  sg_desc_sz;
5528c2ecf20Sopenharmony_ci		__le16  max_sg_elems;
5538c2ecf20Sopenharmony_ci		__le16  sg_desc_stride;
5548c2ecf20Sopenharmony_ci	};
5558c2ecf20Sopenharmony_ci	__le32 words[478];
5568c2ecf20Sopenharmony_ci};
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci/**
5598c2ecf20Sopenharmony_ci * struct ionic_q_init_cmd - Queue init command
5608c2ecf20Sopenharmony_ci * @opcode:       opcode
5618c2ecf20Sopenharmony_ci * @type:         Logical queue type
5628c2ecf20Sopenharmony_ci * @ver:          Queue type version
5638c2ecf20Sopenharmony_ci * @lif_index:    LIF index
5648c2ecf20Sopenharmony_ci * @index:        (LIF, qtype) relative admin queue index
5658c2ecf20Sopenharmony_ci * @intr_index:   Interrupt control register index, or Event queue index
5668c2ecf20Sopenharmony_ci * @pid:          Process ID
5678c2ecf20Sopenharmony_ci * @flags:
5688c2ecf20Sopenharmony_ci *    IRQ:        Interrupt requested on completion
5698c2ecf20Sopenharmony_ci *    ENA:        Enable the queue.  If ENA=0 the queue is initialized
5708c2ecf20Sopenharmony_ci *                but remains disabled, to be later enabled with the
5718c2ecf20Sopenharmony_ci *                Queue Enable command.  If ENA=1, then queue is
5728c2ecf20Sopenharmony_ci *                initialized and then enabled.
5738c2ecf20Sopenharmony_ci *    SG:         Enable Scatter-Gather on the queue.
5748c2ecf20Sopenharmony_ci *                in number of descs.  The actual ring size is
5758c2ecf20Sopenharmony_ci *                (1 << ring_size).  For example, to
5768c2ecf20Sopenharmony_ci *                select a ring size of 64 descriptors write
5778c2ecf20Sopenharmony_ci *                ring_size = 6.  The minimum ring_size value is 2
5788c2ecf20Sopenharmony_ci *                for a ring size of 4 descriptors.  The maximum
5798c2ecf20Sopenharmony_ci *                ring_size value is 16 for a ring size of 64k
5808c2ecf20Sopenharmony_ci *                descriptors.  Values of ring_size <2 and >16 are
5818c2ecf20Sopenharmony_ci *                reserved.
5828c2ecf20Sopenharmony_ci *    EQ:         Enable the Event Queue
5838c2ecf20Sopenharmony_ci * @cos:          Class of service for this queue
5848c2ecf20Sopenharmony_ci * @ring_size:    Queue ring size, encoded as a log2(size)
5858c2ecf20Sopenharmony_ci * @ring_base:    Queue ring base address
5868c2ecf20Sopenharmony_ci * @cq_ring_base: Completion queue ring base address
5878c2ecf20Sopenharmony_ci * @sg_ring_base: Scatter/Gather ring base address
5888c2ecf20Sopenharmony_ci */
5898c2ecf20Sopenharmony_cistruct ionic_q_init_cmd {
5908c2ecf20Sopenharmony_ci	u8     opcode;
5918c2ecf20Sopenharmony_ci	u8     rsvd;
5928c2ecf20Sopenharmony_ci	__le16 lif_index;
5938c2ecf20Sopenharmony_ci	u8     type;
5948c2ecf20Sopenharmony_ci	u8     ver;
5958c2ecf20Sopenharmony_ci	u8     rsvd1[2];
5968c2ecf20Sopenharmony_ci	__le32 index;
5978c2ecf20Sopenharmony_ci	__le16 pid;
5988c2ecf20Sopenharmony_ci	__le16 intr_index;
5998c2ecf20Sopenharmony_ci	__le16 flags;
6008c2ecf20Sopenharmony_ci#define IONIC_QINIT_F_IRQ	0x01	/* Request interrupt on completion */
6018c2ecf20Sopenharmony_ci#define IONIC_QINIT_F_ENA	0x02	/* Enable the queue */
6028c2ecf20Sopenharmony_ci#define IONIC_QINIT_F_SG	0x04	/* Enable scatter/gather on the queue */
6038c2ecf20Sopenharmony_ci#define IONIC_QINIT_F_EQ	0x08	/* Enable event queue */
6048c2ecf20Sopenharmony_ci#define IONIC_QINIT_F_CMB	0x10	/* Enable cmb-based queue */
6058c2ecf20Sopenharmony_ci#define IONIC_QINIT_F_DEBUG	0x80	/* Enable queue debugging */
6068c2ecf20Sopenharmony_ci	u8     cos;
6078c2ecf20Sopenharmony_ci	u8     ring_size;
6088c2ecf20Sopenharmony_ci	__le64 ring_base;
6098c2ecf20Sopenharmony_ci	__le64 cq_ring_base;
6108c2ecf20Sopenharmony_ci	__le64 sg_ring_base;
6118c2ecf20Sopenharmony_ci	u8     rsvd2[20];
6128c2ecf20Sopenharmony_ci} __packed;
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_ci/**
6158c2ecf20Sopenharmony_ci * struct ionic_q_init_comp - Queue init command completion
6168c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
6178c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
6188c2ecf20Sopenharmony_ci * @hw_index:   Hardware Queue ID
6198c2ecf20Sopenharmony_ci * @hw_type:    Hardware Queue type
6208c2ecf20Sopenharmony_ci * @color:      Color
6218c2ecf20Sopenharmony_ci */
6228c2ecf20Sopenharmony_cistruct ionic_q_init_comp {
6238c2ecf20Sopenharmony_ci	u8     status;
6248c2ecf20Sopenharmony_ci	u8     rsvd;
6258c2ecf20Sopenharmony_ci	__le16 comp_index;
6268c2ecf20Sopenharmony_ci	__le32 hw_index;
6278c2ecf20Sopenharmony_ci	u8     hw_type;
6288c2ecf20Sopenharmony_ci	u8     rsvd2[6];
6298c2ecf20Sopenharmony_ci	u8     color;
6308c2ecf20Sopenharmony_ci};
6318c2ecf20Sopenharmony_ci
6328c2ecf20Sopenharmony_ci/* the device's internal addressing uses up to 52 bits */
6338c2ecf20Sopenharmony_ci#define IONIC_ADDR_LEN		52
6348c2ecf20Sopenharmony_ci#define IONIC_ADDR_MASK		(BIT_ULL(IONIC_ADDR_LEN) - 1)
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_cienum ionic_txq_desc_opcode {
6378c2ecf20Sopenharmony_ci	IONIC_TXQ_DESC_OPCODE_CSUM_NONE = 0,
6388c2ecf20Sopenharmony_ci	IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL = 1,
6398c2ecf20Sopenharmony_ci	IONIC_TXQ_DESC_OPCODE_CSUM_HW = 2,
6408c2ecf20Sopenharmony_ci	IONIC_TXQ_DESC_OPCODE_TSO = 3,
6418c2ecf20Sopenharmony_ci};
6428c2ecf20Sopenharmony_ci
6438c2ecf20Sopenharmony_ci/**
6448c2ecf20Sopenharmony_ci * struct ionic_txq_desc - Ethernet Tx queue descriptor format
6458c2ecf20Sopenharmony_ci * @cmd:          Tx operation, see IONIC_TXQ_DESC_OPCODE_*:
6468c2ecf20Sopenharmony_ci *
6478c2ecf20Sopenharmony_ci *                   IONIC_TXQ_DESC_OPCODE_CSUM_NONE:
6488c2ecf20Sopenharmony_ci *                      Non-offload send.  No segmentation,
6498c2ecf20Sopenharmony_ci *                      fragmentation or checksum calc/insertion is
6508c2ecf20Sopenharmony_ci *                      performed by device; packet is prepared
6518c2ecf20Sopenharmony_ci *                      to send by software stack and requires
6528c2ecf20Sopenharmony_ci *                      no further manipulation from device.
6538c2ecf20Sopenharmony_ci *
6548c2ecf20Sopenharmony_ci *                   IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL:
6558c2ecf20Sopenharmony_ci *                      Offload 16-bit L4 checksum
6568c2ecf20Sopenharmony_ci *                      calculation/insertion.  The device will
6578c2ecf20Sopenharmony_ci *                      calculate the L4 checksum value and
6588c2ecf20Sopenharmony_ci *                      insert the result in the packet's L4
6598c2ecf20Sopenharmony_ci *                      header checksum field.  The L4 checksum
6608c2ecf20Sopenharmony_ci *                      is calculated starting at @csum_start bytes
6618c2ecf20Sopenharmony_ci *                      into the packet to the end of the packet.
6628c2ecf20Sopenharmony_ci *                      The checksum insertion position is given
6638c2ecf20Sopenharmony_ci *                      in @csum_offset, which is the offset from
6648c2ecf20Sopenharmony_ci *                      @csum_start to the checksum field in the L4
6658c2ecf20Sopenharmony_ci *                      header.  This feature is only applicable to
6668c2ecf20Sopenharmony_ci *                      protocols such as TCP, UDP and ICMP where a
6678c2ecf20Sopenharmony_ci *                      standard (i.e. the 'IP-style' checksum)
6688c2ecf20Sopenharmony_ci *                      one's complement 16-bit checksum is used,
6698c2ecf20Sopenharmony_ci *                      using an IP pseudo-header to seed the
6708c2ecf20Sopenharmony_ci *                      calculation.  Software will preload the L4
6718c2ecf20Sopenharmony_ci *                      checksum field with the IP pseudo-header
6728c2ecf20Sopenharmony_ci *                      checksum.
6738c2ecf20Sopenharmony_ci *
6748c2ecf20Sopenharmony_ci *                      For tunnel encapsulation, @csum_start and
6758c2ecf20Sopenharmony_ci *                      @csum_offset refer to the inner L4
6768c2ecf20Sopenharmony_ci *                      header.  Supported tunnels encapsulations
6778c2ecf20Sopenharmony_ci *                      are: IPIP, GRE, and UDP.  If the @encap
6788c2ecf20Sopenharmony_ci *                      is clear, no further processing by the
6798c2ecf20Sopenharmony_ci *                      device is required; software will
6808c2ecf20Sopenharmony_ci *                      calculate the outer header checksums.  If
6818c2ecf20Sopenharmony_ci *                      the @encap is set, the device will
6828c2ecf20Sopenharmony_ci *                      offload the outer header checksums using
6838c2ecf20Sopenharmony_ci *                      LCO (local checksum offload) (see
6848c2ecf20Sopenharmony_ci *                      Documentation/networking/checksum-offloads.rst
6858c2ecf20Sopenharmony_ci *                      for more info).
6868c2ecf20Sopenharmony_ci *
6878c2ecf20Sopenharmony_ci *                   IONIC_TXQ_DESC_OPCODE_CSUM_HW:
6888c2ecf20Sopenharmony_ci *                      Offload 16-bit checksum computation to hardware.
6898c2ecf20Sopenharmony_ci *                      If @csum_l3 is set then the packet's L3 checksum is
6908c2ecf20Sopenharmony_ci *                      updated. Similarly, if @csum_l4 is set the the L4
6918c2ecf20Sopenharmony_ci *                      checksum is updated. If @encap is set then encap header
6928c2ecf20Sopenharmony_ci *                      checksums are also updated.
6938c2ecf20Sopenharmony_ci *
6948c2ecf20Sopenharmony_ci *                   IONIC_TXQ_DESC_OPCODE_TSO:
6958c2ecf20Sopenharmony_ci *                      Device preforms TCP segmentation offload
6968c2ecf20Sopenharmony_ci *                      (TSO).  @hdr_len is the number of bytes
6978c2ecf20Sopenharmony_ci *                      to the end of TCP header (the offset to
6988c2ecf20Sopenharmony_ci *                      the TCP payload).  @mss is the desired
6998c2ecf20Sopenharmony_ci *                      MSS, the TCP payload length for each
7008c2ecf20Sopenharmony_ci *                      segment.  The device will calculate/
7018c2ecf20Sopenharmony_ci *                      insert IP (IPv4 only) and TCP checksums
7028c2ecf20Sopenharmony_ci *                      for each segment.  In the first data
7038c2ecf20Sopenharmony_ci *                      buffer containing the header template,
7048c2ecf20Sopenharmony_ci *                      the driver will set IPv4 checksum to 0
7058c2ecf20Sopenharmony_ci *                      and preload TCP checksum with the IP
7068c2ecf20Sopenharmony_ci *                      pseudo header calculated with IP length = 0.
7078c2ecf20Sopenharmony_ci *
7088c2ecf20Sopenharmony_ci *                      Supported tunnel encapsulations are IPIP,
7098c2ecf20Sopenharmony_ci *                      layer-3 GRE, and UDP. @hdr_len includes
7108c2ecf20Sopenharmony_ci *                      both outer and inner headers.  The driver
7118c2ecf20Sopenharmony_ci *                      will set IPv4 checksum to zero and
7128c2ecf20Sopenharmony_ci *                      preload TCP checksum with IP pseudo
7138c2ecf20Sopenharmony_ci *                      header on the inner header.
7148c2ecf20Sopenharmony_ci *
7158c2ecf20Sopenharmony_ci *                      TCP ECN offload is supported.  The device
7168c2ecf20Sopenharmony_ci *                      will set CWR flag in the first segment if
7178c2ecf20Sopenharmony_ci *                      CWR is set in the template header, and
7188c2ecf20Sopenharmony_ci *                      clear CWR in remaining segments.
7198c2ecf20Sopenharmony_ci * @flags:
7208c2ecf20Sopenharmony_ci *                vlan:
7218c2ecf20Sopenharmony_ci *                    Insert an L2 VLAN header using @vlan_tci
7228c2ecf20Sopenharmony_ci *                encap:
7238c2ecf20Sopenharmony_ci *                    Calculate encap header checksum
7248c2ecf20Sopenharmony_ci *                csum_l3:
7258c2ecf20Sopenharmony_ci *                    Compute L3 header checksum
7268c2ecf20Sopenharmony_ci *                csum_l4:
7278c2ecf20Sopenharmony_ci *                    Compute L4 header checksum
7288c2ecf20Sopenharmony_ci *                tso_sot:
7298c2ecf20Sopenharmony_ci *                    TSO start
7308c2ecf20Sopenharmony_ci *                tso_eot:
7318c2ecf20Sopenharmony_ci *                    TSO end
7328c2ecf20Sopenharmony_ci * @num_sg_elems: Number of scatter-gather elements in SG
7338c2ecf20Sopenharmony_ci *                descriptor
7348c2ecf20Sopenharmony_ci * @addr:         First data buffer's DMA address
7358c2ecf20Sopenharmony_ci *                (Subsequent data buffers are on txq_sg_desc)
7368c2ecf20Sopenharmony_ci * @len:          First data buffer's length, in bytes
7378c2ecf20Sopenharmony_ci * @vlan_tci:     VLAN tag to insert in the packet (if requested
7388c2ecf20Sopenharmony_ci *                by @V-bit).  Includes .1p and .1q tags
7398c2ecf20Sopenharmony_ci * @hdr_len:      Length of packet headers, including
7408c2ecf20Sopenharmony_ci *                encapsulating outer header, if applicable
7418c2ecf20Sopenharmony_ci *                Valid for opcodes IONIC_TXQ_DESC_OPCODE_CALC_CSUM and
7428c2ecf20Sopenharmony_ci *                IONIC_TXQ_DESC_OPCODE_TSO.  Should be set to zero for
7438c2ecf20Sopenharmony_ci *                all other modes.  For
7448c2ecf20Sopenharmony_ci *                IONIC_TXQ_DESC_OPCODE_CALC_CSUM, @hdr_len is length
7458c2ecf20Sopenharmony_ci *                of headers up to inner-most L4 header.  For
7468c2ecf20Sopenharmony_ci *                IONIC_TXQ_DESC_OPCODE_TSO, @hdr_len is up to
7478c2ecf20Sopenharmony_ci *                inner-most L4 payload, so inclusive of
7488c2ecf20Sopenharmony_ci *                inner-most L4 header.
7498c2ecf20Sopenharmony_ci * @mss:          Desired MSS value for TSO; only applicable for
7508c2ecf20Sopenharmony_ci *                IONIC_TXQ_DESC_OPCODE_TSO
7518c2ecf20Sopenharmony_ci * @csum_start:   Offset from packet to first byte checked in L4 checksum
7528c2ecf20Sopenharmony_ci * @csum_offset:  Offset from csum_start to L4 checksum field
7538c2ecf20Sopenharmony_ci */
7548c2ecf20Sopenharmony_cistruct ionic_txq_desc {
7558c2ecf20Sopenharmony_ci	__le64  cmd;
7568c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_OPCODE_MASK		0xf
7578c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_OPCODE_SHIFT		4
7588c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAGS_MASK		0xf
7598c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAGS_SHIFT		0
7608c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_NSGE_MASK		0xf
7618c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_NSGE_SHIFT		8
7628c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_ADDR_MASK		(BIT_ULL(IONIC_ADDR_LEN) - 1)
7638c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_ADDR_SHIFT		12
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci/* common flags */
7668c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAG_VLAN		0x1
7678c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAG_ENCAP		0x2
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_ci/* flags for csum_hw opcode */
7708c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAG_CSUM_L3		0x4
7718c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAG_CSUM_L4		0x8
7728c2ecf20Sopenharmony_ci
7738c2ecf20Sopenharmony_ci/* flags for tso opcode */
7748c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAG_TSO_SOT		0x4
7758c2ecf20Sopenharmony_ci#define IONIC_TXQ_DESC_FLAG_TSO_EOT		0x8
7768c2ecf20Sopenharmony_ci
7778c2ecf20Sopenharmony_ci	__le16  len;
7788c2ecf20Sopenharmony_ci	union {
7798c2ecf20Sopenharmony_ci		__le16  vlan_tci;
7808c2ecf20Sopenharmony_ci		__le16  hword0;
7818c2ecf20Sopenharmony_ci	};
7828c2ecf20Sopenharmony_ci	union {
7838c2ecf20Sopenharmony_ci		__le16  csum_start;
7848c2ecf20Sopenharmony_ci		__le16  hdr_len;
7858c2ecf20Sopenharmony_ci		__le16  hword1;
7868c2ecf20Sopenharmony_ci	};
7878c2ecf20Sopenharmony_ci	union {
7888c2ecf20Sopenharmony_ci		__le16  csum_offset;
7898c2ecf20Sopenharmony_ci		__le16  mss;
7908c2ecf20Sopenharmony_ci		__le16  hword2;
7918c2ecf20Sopenharmony_ci	};
7928c2ecf20Sopenharmony_ci};
7938c2ecf20Sopenharmony_ci
7948c2ecf20Sopenharmony_cistatic inline u64 encode_txq_desc_cmd(u8 opcode, u8 flags,
7958c2ecf20Sopenharmony_ci				      u8 nsge, u64 addr)
7968c2ecf20Sopenharmony_ci{
7978c2ecf20Sopenharmony_ci	u64 cmd;
7988c2ecf20Sopenharmony_ci
7998c2ecf20Sopenharmony_ci	cmd = (opcode & IONIC_TXQ_DESC_OPCODE_MASK) << IONIC_TXQ_DESC_OPCODE_SHIFT;
8008c2ecf20Sopenharmony_ci	cmd |= (flags & IONIC_TXQ_DESC_FLAGS_MASK) << IONIC_TXQ_DESC_FLAGS_SHIFT;
8018c2ecf20Sopenharmony_ci	cmd |= (nsge & IONIC_TXQ_DESC_NSGE_MASK) << IONIC_TXQ_DESC_NSGE_SHIFT;
8028c2ecf20Sopenharmony_ci	cmd |= (addr & IONIC_TXQ_DESC_ADDR_MASK) << IONIC_TXQ_DESC_ADDR_SHIFT;
8038c2ecf20Sopenharmony_ci
8048c2ecf20Sopenharmony_ci	return cmd;
8058c2ecf20Sopenharmony_ci};
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_cistatic inline void decode_txq_desc_cmd(u64 cmd, u8 *opcode, u8 *flags,
8088c2ecf20Sopenharmony_ci				       u8 *nsge, u64 *addr)
8098c2ecf20Sopenharmony_ci{
8108c2ecf20Sopenharmony_ci	*opcode = (cmd >> IONIC_TXQ_DESC_OPCODE_SHIFT) & IONIC_TXQ_DESC_OPCODE_MASK;
8118c2ecf20Sopenharmony_ci	*flags = (cmd >> IONIC_TXQ_DESC_FLAGS_SHIFT) & IONIC_TXQ_DESC_FLAGS_MASK;
8128c2ecf20Sopenharmony_ci	*nsge = (cmd >> IONIC_TXQ_DESC_NSGE_SHIFT) & IONIC_TXQ_DESC_NSGE_MASK;
8138c2ecf20Sopenharmony_ci	*addr = (cmd >> IONIC_TXQ_DESC_ADDR_SHIFT) & IONIC_TXQ_DESC_ADDR_MASK;
8148c2ecf20Sopenharmony_ci};
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_ci/**
8178c2ecf20Sopenharmony_ci * struct ionic_txq_sg_elem - Transmit scatter-gather (SG) descriptor element
8188c2ecf20Sopenharmony_ci * @addr:      DMA address of SG element data buffer
8198c2ecf20Sopenharmony_ci * @len:       Length of SG element data buffer, in bytes
8208c2ecf20Sopenharmony_ci */
8218c2ecf20Sopenharmony_cistruct ionic_txq_sg_elem {
8228c2ecf20Sopenharmony_ci	__le64 addr;
8238c2ecf20Sopenharmony_ci	__le16 len;
8248c2ecf20Sopenharmony_ci	__le16 rsvd[3];
8258c2ecf20Sopenharmony_ci};
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci/**
8288c2ecf20Sopenharmony_ci * struct ionic_txq_sg_desc - Transmit scatter-gather (SG) list
8298c2ecf20Sopenharmony_ci * @elems:     Scatter-gather elements
8308c2ecf20Sopenharmony_ci */
8318c2ecf20Sopenharmony_cistruct ionic_txq_sg_desc {
8328c2ecf20Sopenharmony_ci#define IONIC_TX_MAX_SG_ELEMS		8
8338c2ecf20Sopenharmony_ci#define IONIC_TX_SG_DESC_STRIDE		8
8348c2ecf20Sopenharmony_ci	struct ionic_txq_sg_elem elems[IONIC_TX_MAX_SG_ELEMS];
8358c2ecf20Sopenharmony_ci};
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_cistruct ionic_txq_sg_desc_v1 {
8388c2ecf20Sopenharmony_ci#define IONIC_TX_MAX_SG_ELEMS_V1		15
8398c2ecf20Sopenharmony_ci#define IONIC_TX_SG_DESC_STRIDE_V1		16
8408c2ecf20Sopenharmony_ci	struct ionic_txq_sg_elem elems[IONIC_TX_SG_DESC_STRIDE_V1];
8418c2ecf20Sopenharmony_ci};
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_ci/**
8448c2ecf20Sopenharmony_ci * struct ionic_txq_comp - Ethernet transmit queue completion descriptor
8458c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
8468c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
8478c2ecf20Sopenharmony_ci * @color:      Color bit
8488c2ecf20Sopenharmony_ci */
8498c2ecf20Sopenharmony_cistruct ionic_txq_comp {
8508c2ecf20Sopenharmony_ci	u8     status;
8518c2ecf20Sopenharmony_ci	u8     rsvd;
8528c2ecf20Sopenharmony_ci	__le16 comp_index;
8538c2ecf20Sopenharmony_ci	u8     rsvd2[11];
8548c2ecf20Sopenharmony_ci	u8     color;
8558c2ecf20Sopenharmony_ci};
8568c2ecf20Sopenharmony_ci
8578c2ecf20Sopenharmony_cienum ionic_rxq_desc_opcode {
8588c2ecf20Sopenharmony_ci	IONIC_RXQ_DESC_OPCODE_SIMPLE = 0,
8598c2ecf20Sopenharmony_ci	IONIC_RXQ_DESC_OPCODE_SG = 1,
8608c2ecf20Sopenharmony_ci};
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_ci/**
8638c2ecf20Sopenharmony_ci * struct ionic_rxq_desc - Ethernet Rx queue descriptor format
8648c2ecf20Sopenharmony_ci * @opcode:       Rx operation, see IONIC_RXQ_DESC_OPCODE_*:
8658c2ecf20Sopenharmony_ci *
8668c2ecf20Sopenharmony_ci *                   IONIC_RXQ_DESC_OPCODE_SIMPLE:
8678c2ecf20Sopenharmony_ci *                      Receive full packet into data buffer
8688c2ecf20Sopenharmony_ci *                      starting at @addr.  Results of
8698c2ecf20Sopenharmony_ci *                      receive, including actual bytes received,
8708c2ecf20Sopenharmony_ci *                      are recorded in Rx completion descriptor.
8718c2ecf20Sopenharmony_ci *
8728c2ecf20Sopenharmony_ci * @len:          Data buffer's length, in bytes
8738c2ecf20Sopenharmony_ci * @addr:         Data buffer's DMA address
8748c2ecf20Sopenharmony_ci */
8758c2ecf20Sopenharmony_cistruct ionic_rxq_desc {
8768c2ecf20Sopenharmony_ci	u8     opcode;
8778c2ecf20Sopenharmony_ci	u8     rsvd[5];
8788c2ecf20Sopenharmony_ci	__le16 len;
8798c2ecf20Sopenharmony_ci	__le64 addr;
8808c2ecf20Sopenharmony_ci};
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_ci/**
8838c2ecf20Sopenharmony_ci * struct ionic_rxq_sg_elem - Receive scatter-gather (SG) descriptor element
8848c2ecf20Sopenharmony_ci * @addr:      DMA address of SG element data buffer
8858c2ecf20Sopenharmony_ci * @len:       Length of SG element data buffer, in bytes
8868c2ecf20Sopenharmony_ci */
8878c2ecf20Sopenharmony_cistruct ionic_rxq_sg_elem {
8888c2ecf20Sopenharmony_ci	__le64 addr;
8898c2ecf20Sopenharmony_ci	__le16 len;
8908c2ecf20Sopenharmony_ci	__le16 rsvd[3];
8918c2ecf20Sopenharmony_ci};
8928c2ecf20Sopenharmony_ci
8938c2ecf20Sopenharmony_ci/**
8948c2ecf20Sopenharmony_ci * struct ionic_rxq_sg_desc - Receive scatter-gather (SG) list
8958c2ecf20Sopenharmony_ci * @elems:     Scatter-gather elements
8968c2ecf20Sopenharmony_ci */
8978c2ecf20Sopenharmony_cistruct ionic_rxq_sg_desc {
8988c2ecf20Sopenharmony_ci#define IONIC_RX_MAX_SG_ELEMS		8
8998c2ecf20Sopenharmony_ci#define IONIC_RX_SG_DESC_STRIDE		8
9008c2ecf20Sopenharmony_ci	struct ionic_rxq_sg_elem elems[IONIC_RX_SG_DESC_STRIDE];
9018c2ecf20Sopenharmony_ci};
9028c2ecf20Sopenharmony_ci
9038c2ecf20Sopenharmony_ci/**
9048c2ecf20Sopenharmony_ci * struct ionic_rxq_comp - Ethernet receive queue completion descriptor
9058c2ecf20Sopenharmony_ci * @status:       Status of the command (enum ionic_status_code)
9068c2ecf20Sopenharmony_ci * @num_sg_elems: Number of SG elements used by this descriptor
9078c2ecf20Sopenharmony_ci * @comp_index:   Index in the descriptor ring for which this is the completion
9088c2ecf20Sopenharmony_ci * @rss_hash:     32-bit RSS hash
9098c2ecf20Sopenharmony_ci * @csum:         16-bit sum of the packet's L2 payload
9108c2ecf20Sopenharmony_ci *                If the packet's L2 payload is odd length, an extra
9118c2ecf20Sopenharmony_ci *                zero-value byte is included in the @csum calculation but
9128c2ecf20Sopenharmony_ci *                not included in @len.
9138c2ecf20Sopenharmony_ci * @vlan_tci:     VLAN tag stripped from the packet.  Valid if @VLAN is
9148c2ecf20Sopenharmony_ci *                set.  Includes .1p and .1q tags.
9158c2ecf20Sopenharmony_ci * @len:          Received packet length, in bytes.  Excludes FCS.
9168c2ecf20Sopenharmony_ci * @csum_calc     L2 payload checksum is computed or not
9178c2ecf20Sopenharmony_ci * @csum_flags:   See IONIC_RXQ_COMP_CSUM_F_*:
9188c2ecf20Sopenharmony_ci *
9198c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_TCP_OK:
9208c2ecf20Sopenharmony_ci *                    The TCP checksum calculated by the device
9218c2ecf20Sopenharmony_ci *                    matched the checksum in the receive packet's
9228c2ecf20Sopenharmony_ci *                    TCP header.
9238c2ecf20Sopenharmony_ci *
9248c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_TCP_BAD:
9258c2ecf20Sopenharmony_ci *                    The TCP checksum calculated by the device did
9268c2ecf20Sopenharmony_ci *                    not match the checksum in the receive packet's
9278c2ecf20Sopenharmony_ci *                    TCP header.
9288c2ecf20Sopenharmony_ci *
9298c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_UDP_OK:
9308c2ecf20Sopenharmony_ci *                    The UDP checksum calculated by the device
9318c2ecf20Sopenharmony_ci *                    matched the checksum in the receive packet's
9328c2ecf20Sopenharmony_ci *                    UDP header
9338c2ecf20Sopenharmony_ci *
9348c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_UDP_BAD:
9358c2ecf20Sopenharmony_ci *                    The UDP checksum calculated by the device did
9368c2ecf20Sopenharmony_ci *                    not match the checksum in the receive packet's
9378c2ecf20Sopenharmony_ci *                    UDP header.
9388c2ecf20Sopenharmony_ci *
9398c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_IP_OK:
9408c2ecf20Sopenharmony_ci *                    The IPv4 checksum calculated by the device
9418c2ecf20Sopenharmony_ci *                    matched the checksum in the receive packet's
9428c2ecf20Sopenharmony_ci *                    first IPv4 header.  If the receive packet
9438c2ecf20Sopenharmony_ci *                    contains both a tunnel IPv4 header and a
9448c2ecf20Sopenharmony_ci *                    transport IPv4 header, the device validates the
9458c2ecf20Sopenharmony_ci *                    checksum for the both IPv4 headers.
9468c2ecf20Sopenharmony_ci *
9478c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_IP_BAD:
9488c2ecf20Sopenharmony_ci *                    The IPv4 checksum calculated by the device did
9498c2ecf20Sopenharmony_ci *                    not match the checksum in the receive packet's
9508c2ecf20Sopenharmony_ci *                    first IPv4 header. If the receive packet
9518c2ecf20Sopenharmony_ci *                    contains both a tunnel IPv4 header and a
9528c2ecf20Sopenharmony_ci *                    transport IPv4 header, the device validates the
9538c2ecf20Sopenharmony_ci *                    checksum for both IP headers.
9548c2ecf20Sopenharmony_ci *
9558c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_VLAN:
9568c2ecf20Sopenharmony_ci *                    The VLAN header was stripped and placed in @vlan_tci.
9578c2ecf20Sopenharmony_ci *
9588c2ecf20Sopenharmony_ci *                  IONIC_RXQ_COMP_CSUM_F_CALC:
9598c2ecf20Sopenharmony_ci *                    The checksum was calculated by the device.
9608c2ecf20Sopenharmony_ci *
9618c2ecf20Sopenharmony_ci * @pkt_type_color: Packet type and color bit; see IONIC_RXQ_COMP_PKT_TYPE_MASK
9628c2ecf20Sopenharmony_ci */
9638c2ecf20Sopenharmony_cistruct ionic_rxq_comp {
9648c2ecf20Sopenharmony_ci	u8     status;
9658c2ecf20Sopenharmony_ci	u8     num_sg_elems;
9668c2ecf20Sopenharmony_ci	__le16 comp_index;
9678c2ecf20Sopenharmony_ci	__le32 rss_hash;
9688c2ecf20Sopenharmony_ci	__le16 csum;
9698c2ecf20Sopenharmony_ci	__le16 vlan_tci;
9708c2ecf20Sopenharmony_ci	__le16 len;
9718c2ecf20Sopenharmony_ci	u8     csum_flags;
9728c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_TCP_OK	0x01
9738c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_TCP_BAD	0x02
9748c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_UDP_OK	0x04
9758c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_UDP_BAD	0x08
9768c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_IP_OK	0x10
9778c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_IP_BAD	0x20
9788c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_VLAN	0x40
9798c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_CSUM_F_CALC	0x80
9808c2ecf20Sopenharmony_ci	u8     pkt_type_color;
9818c2ecf20Sopenharmony_ci#define IONIC_RXQ_COMP_PKT_TYPE_MASK	0x7f
9828c2ecf20Sopenharmony_ci};
9838c2ecf20Sopenharmony_ci
9848c2ecf20Sopenharmony_cienum ionic_pkt_type {
9858c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_NON_IP     = 0x000,
9868c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_IPV4       = 0x001,
9878c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_IPV4_TCP   = 0x003,
9888c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_IPV4_UDP   = 0x005,
9898c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_IPV6       = 0x008,
9908c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_IPV6_TCP   = 0x018,
9918c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_IPV6_UDP   = 0x028,
9928c2ecf20Sopenharmony_ci	/* below types are only used if encap offloads are enabled on lif */
9938c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_ENCAP_NON_IP	= 0x40,
9948c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_ENCAP_IPV4	= 0x41,
9958c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_ENCAP_IPV4_TCP	= 0x43,
9968c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_ENCAP_IPV4_UDP	= 0x45,
9978c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_ENCAP_IPV6	= 0x48,
9988c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_ENCAP_IPV6_TCP	= 0x58,
9998c2ecf20Sopenharmony_ci	IONIC_PKT_TYPE_ENCAP_IPV6_UDP	= 0x68,
10008c2ecf20Sopenharmony_ci};
10018c2ecf20Sopenharmony_ci
10028c2ecf20Sopenharmony_cienum ionic_eth_hw_features {
10038c2ecf20Sopenharmony_ci	IONIC_ETH_HW_VLAN_TX_TAG	= BIT(0),
10048c2ecf20Sopenharmony_ci	IONIC_ETH_HW_VLAN_RX_STRIP	= BIT(1),
10058c2ecf20Sopenharmony_ci	IONIC_ETH_HW_VLAN_RX_FILTER	= BIT(2),
10068c2ecf20Sopenharmony_ci	IONIC_ETH_HW_RX_HASH		= BIT(3),
10078c2ecf20Sopenharmony_ci	IONIC_ETH_HW_RX_CSUM		= BIT(4),
10088c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TX_SG		= BIT(5),
10098c2ecf20Sopenharmony_ci	IONIC_ETH_HW_RX_SG		= BIT(6),
10108c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TX_CSUM		= BIT(7),
10118c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO		= BIT(8),
10128c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_IPV6		= BIT(9),
10138c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_ECN		= BIT(10),
10148c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_GRE		= BIT(11),
10158c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_GRE_CSUM	= BIT(12),
10168c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_IPXIP4		= BIT(13),
10178c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_IPXIP6		= BIT(14),
10188c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_UDP		= BIT(15),
10198c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_UDP_CSUM	= BIT(16),
10208c2ecf20Sopenharmony_ci	IONIC_ETH_HW_RX_CSUM_GENEVE	= BIT(17),
10218c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TX_CSUM_GENEVE	= BIT(18),
10228c2ecf20Sopenharmony_ci	IONIC_ETH_HW_TSO_GENEVE		= BIT(19)
10238c2ecf20Sopenharmony_ci};
10248c2ecf20Sopenharmony_ci
10258c2ecf20Sopenharmony_ci/**
10268c2ecf20Sopenharmony_ci * struct ionic_q_control_cmd - Queue control command
10278c2ecf20Sopenharmony_ci * @opcode:     opcode
10288c2ecf20Sopenharmony_ci * @type:       Queue type
10298c2ecf20Sopenharmony_ci * @lif_index:  LIF index
10308c2ecf20Sopenharmony_ci * @index:      Queue index
10318c2ecf20Sopenharmony_ci * @oper:       Operation (enum ionic_q_control_oper)
10328c2ecf20Sopenharmony_ci */
10338c2ecf20Sopenharmony_cistruct ionic_q_control_cmd {
10348c2ecf20Sopenharmony_ci	u8     opcode;
10358c2ecf20Sopenharmony_ci	u8     type;
10368c2ecf20Sopenharmony_ci	__le16 lif_index;
10378c2ecf20Sopenharmony_ci	__le32 index;
10388c2ecf20Sopenharmony_ci	u8     oper;
10398c2ecf20Sopenharmony_ci	u8     rsvd[55];
10408c2ecf20Sopenharmony_ci};
10418c2ecf20Sopenharmony_ci
10428c2ecf20Sopenharmony_citypedef struct ionic_admin_comp ionic_q_control_comp;
10438c2ecf20Sopenharmony_ci
10448c2ecf20Sopenharmony_cienum q_control_oper {
10458c2ecf20Sopenharmony_ci	IONIC_Q_DISABLE		= 0,
10468c2ecf20Sopenharmony_ci	IONIC_Q_ENABLE		= 1,
10478c2ecf20Sopenharmony_ci	IONIC_Q_HANG_RESET	= 2,
10488c2ecf20Sopenharmony_ci};
10498c2ecf20Sopenharmony_ci
10508c2ecf20Sopenharmony_ci/**
10518c2ecf20Sopenharmony_ci * enum ionic_phy_type - Physical connection type
10528c2ecf20Sopenharmony_ci * @IONIC_PHY_TYPE_NONE:    No PHY installed
10538c2ecf20Sopenharmony_ci * @IONIC_PHY_TYPE_COPPER:  Copper PHY
10548c2ecf20Sopenharmony_ci * @IONIC_PHY_TYPE_FIBER:   Fiber PHY
10558c2ecf20Sopenharmony_ci */
10568c2ecf20Sopenharmony_cienum ionic_phy_type {
10578c2ecf20Sopenharmony_ci	IONIC_PHY_TYPE_NONE	= 0,
10588c2ecf20Sopenharmony_ci	IONIC_PHY_TYPE_COPPER	= 1,
10598c2ecf20Sopenharmony_ci	IONIC_PHY_TYPE_FIBER	= 2,
10608c2ecf20Sopenharmony_ci};
10618c2ecf20Sopenharmony_ci
10628c2ecf20Sopenharmony_ci/**
10638c2ecf20Sopenharmony_ci * enum ionic_xcvr_state - Transceiver status
10648c2ecf20Sopenharmony_ci * @IONIC_XCVR_STATE_REMOVED:        Transceiver removed
10658c2ecf20Sopenharmony_ci * @IONIC_XCVR_STATE_INSERTED:       Transceiver inserted
10668c2ecf20Sopenharmony_ci * @IONIC_XCVR_STATE_PENDING:        Transceiver pending
10678c2ecf20Sopenharmony_ci * @IONIC_XCVR_STATE_SPROM_READ:     Transceiver data read
10688c2ecf20Sopenharmony_ci * @IONIC_XCVR_STATE_SPROM_READ_ERR: Transceiver data read error
10698c2ecf20Sopenharmony_ci */
10708c2ecf20Sopenharmony_cienum ionic_xcvr_state {
10718c2ecf20Sopenharmony_ci	IONIC_XCVR_STATE_REMOVED	 = 0,
10728c2ecf20Sopenharmony_ci	IONIC_XCVR_STATE_INSERTED	 = 1,
10738c2ecf20Sopenharmony_ci	IONIC_XCVR_STATE_PENDING	 = 2,
10748c2ecf20Sopenharmony_ci	IONIC_XCVR_STATE_SPROM_READ	 = 3,
10758c2ecf20Sopenharmony_ci	IONIC_XCVR_STATE_SPROM_READ_ERR	 = 4,
10768c2ecf20Sopenharmony_ci};
10778c2ecf20Sopenharmony_ci
10788c2ecf20Sopenharmony_ci/**
10798c2ecf20Sopenharmony_ci * enum ionic_xcvr_pid - Supported link modes
10808c2ecf20Sopenharmony_ci */
10818c2ecf20Sopenharmony_cienum ionic_xcvr_pid {
10828c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_UNKNOWN           = 0,
10838c2ecf20Sopenharmony_ci
10848c2ecf20Sopenharmony_ci	/* CU */
10858c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_CR4     = 1,
10868c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_40GBASE_CR4  = 2,
10878c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_CR_S  = 3,
10888c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_CR_L  = 4,
10898c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_CR_N  = 5,
10908c2ecf20Sopenharmony_ci
10918c2ecf20Sopenharmony_ci	/* Fiber */
10928c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_AOC    = 50,
10938c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_ACC    = 51,
10948c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_SR4    = 52,
10958c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_LR4    = 53,
10968c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_ER4    = 54,
10978c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_40GBASE_ER4 = 55,
10988c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_40GBASE_SR4 = 56,
10998c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_40GBASE_LR4 = 57,
11008c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_40GBASE_AOC = 58,
11018c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_SR   = 59,
11028c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_LR   = 60,
11038c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_ER   = 61,
11048c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_AOC  = 62,
11058c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_10GBASE_SR   = 63,
11068c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_10GBASE_LR   = 64,
11078c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_10GBASE_LRM  = 65,
11088c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_10GBASE_ER   = 66,
11098c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_10GBASE_AOC  = 67,
11108c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_10GBASE_CU   = 68,
11118c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_CWDM4  = 69,
11128c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_QSFP_100G_PSM4   = 70,
11138c2ecf20Sopenharmony_ci	IONIC_XCVR_PID_SFP_25GBASE_ACC  = 71,
11148c2ecf20Sopenharmony_ci};
11158c2ecf20Sopenharmony_ci
11168c2ecf20Sopenharmony_ci/**
11178c2ecf20Sopenharmony_ci * enum ionic_port_type - Port types
11188c2ecf20Sopenharmony_ci * @IONIC_PORT_TYPE_NONE:           Port type not configured
11198c2ecf20Sopenharmony_ci * @IONIC_PORT_TYPE_ETH:            Port carries ethernet traffic (inband)
11208c2ecf20Sopenharmony_ci * @IONIC_PORT_TYPE_MGMT:           Port carries mgmt traffic (out-of-band)
11218c2ecf20Sopenharmony_ci */
11228c2ecf20Sopenharmony_cienum ionic_port_type {
11238c2ecf20Sopenharmony_ci	IONIC_PORT_TYPE_NONE = 0,
11248c2ecf20Sopenharmony_ci	IONIC_PORT_TYPE_ETH  = 1,
11258c2ecf20Sopenharmony_ci	IONIC_PORT_TYPE_MGMT = 2,
11268c2ecf20Sopenharmony_ci};
11278c2ecf20Sopenharmony_ci
11288c2ecf20Sopenharmony_ci/**
11298c2ecf20Sopenharmony_ci * enum ionic_port_admin_state - Port config state
11308c2ecf20Sopenharmony_ci * @IONIC_PORT_ADMIN_STATE_NONE:    Port admin state not configured
11318c2ecf20Sopenharmony_ci * @IONIC_PORT_ADMIN_STATE_DOWN:    Port admin disabled
11328c2ecf20Sopenharmony_ci * @IONIC_PORT_ADMIN_STATE_UP:      Port admin enabled
11338c2ecf20Sopenharmony_ci */
11348c2ecf20Sopenharmony_cienum ionic_port_admin_state {
11358c2ecf20Sopenharmony_ci	IONIC_PORT_ADMIN_STATE_NONE = 0,
11368c2ecf20Sopenharmony_ci	IONIC_PORT_ADMIN_STATE_DOWN = 1,
11378c2ecf20Sopenharmony_ci	IONIC_PORT_ADMIN_STATE_UP   = 2,
11388c2ecf20Sopenharmony_ci};
11398c2ecf20Sopenharmony_ci
11408c2ecf20Sopenharmony_ci/**
11418c2ecf20Sopenharmony_ci * enum ionic_port_oper_status - Port operational status
11428c2ecf20Sopenharmony_ci * @IONIC_PORT_OPER_STATUS_NONE:    Port disabled
11438c2ecf20Sopenharmony_ci * @IONIC_PORT_OPER_STATUS_UP:      Port link status up
11448c2ecf20Sopenharmony_ci * @IONIC_PORT_OPER_STATUS_DOWN:    Port link status down
11458c2ecf20Sopenharmony_ci */
11468c2ecf20Sopenharmony_cienum ionic_port_oper_status {
11478c2ecf20Sopenharmony_ci	IONIC_PORT_OPER_STATUS_NONE  = 0,
11488c2ecf20Sopenharmony_ci	IONIC_PORT_OPER_STATUS_UP    = 1,
11498c2ecf20Sopenharmony_ci	IONIC_PORT_OPER_STATUS_DOWN  = 2,
11508c2ecf20Sopenharmony_ci};
11518c2ecf20Sopenharmony_ci
11528c2ecf20Sopenharmony_ci/**
11538c2ecf20Sopenharmony_ci * enum ionic_port_fec_type - Ethernet Forward error correction (FEC) modes
11548c2ecf20Sopenharmony_ci * @IONIC_PORT_FEC_TYPE_NONE:       FEC Disabled
11558c2ecf20Sopenharmony_ci * @IONIC_PORT_FEC_TYPE_FC:         FireCode FEC
11568c2ecf20Sopenharmony_ci * @IONIC_PORT_FEC_TYPE_RS:         ReedSolomon FEC
11578c2ecf20Sopenharmony_ci */
11588c2ecf20Sopenharmony_cienum ionic_port_fec_type {
11598c2ecf20Sopenharmony_ci	IONIC_PORT_FEC_TYPE_NONE = 0,
11608c2ecf20Sopenharmony_ci	IONIC_PORT_FEC_TYPE_FC   = 1,
11618c2ecf20Sopenharmony_ci	IONIC_PORT_FEC_TYPE_RS   = 2,
11628c2ecf20Sopenharmony_ci};
11638c2ecf20Sopenharmony_ci
11648c2ecf20Sopenharmony_ci/**
11658c2ecf20Sopenharmony_ci * enum ionic_port_pause_type - Ethernet pause (flow control) modes
11668c2ecf20Sopenharmony_ci * @IONIC_PORT_PAUSE_TYPE_NONE:     Disable Pause
11678c2ecf20Sopenharmony_ci * @IONIC_PORT_PAUSE_TYPE_LINK:     Link level pause
11688c2ecf20Sopenharmony_ci * @IONIC_PORT_PAUSE_TYPE_PFC:      Priority-Flow Control
11698c2ecf20Sopenharmony_ci */
11708c2ecf20Sopenharmony_cienum ionic_port_pause_type {
11718c2ecf20Sopenharmony_ci	IONIC_PORT_PAUSE_TYPE_NONE = 0,
11728c2ecf20Sopenharmony_ci	IONIC_PORT_PAUSE_TYPE_LINK = 1,
11738c2ecf20Sopenharmony_ci	IONIC_PORT_PAUSE_TYPE_PFC  = 2,
11748c2ecf20Sopenharmony_ci};
11758c2ecf20Sopenharmony_ci
11768c2ecf20Sopenharmony_ci/**
11778c2ecf20Sopenharmony_ci * enum ionic_port_loopback_mode - Loopback modes
11788c2ecf20Sopenharmony_ci * @IONIC_PORT_LOOPBACK_MODE_NONE:  Disable loopback
11798c2ecf20Sopenharmony_ci * @IONIC_PORT_LOOPBACK_MODE_MAC:   MAC loopback
11808c2ecf20Sopenharmony_ci * @IONIC_PORT_LOOPBACK_MODE_PHY:   PHY/SerDes loopback
11818c2ecf20Sopenharmony_ci */
11828c2ecf20Sopenharmony_cienum ionic_port_loopback_mode {
11838c2ecf20Sopenharmony_ci	IONIC_PORT_LOOPBACK_MODE_NONE = 0,
11848c2ecf20Sopenharmony_ci	IONIC_PORT_LOOPBACK_MODE_MAC  = 1,
11858c2ecf20Sopenharmony_ci	IONIC_PORT_LOOPBACK_MODE_PHY  = 2,
11868c2ecf20Sopenharmony_ci};
11878c2ecf20Sopenharmony_ci
11888c2ecf20Sopenharmony_ci/**
11898c2ecf20Sopenharmony_ci * struct ionic_xcvr_status - Transceiver Status information
11908c2ecf20Sopenharmony_ci * @state:    Transceiver status (enum ionic_xcvr_state)
11918c2ecf20Sopenharmony_ci * @phy:      Physical connection type (enum ionic_phy_type)
11928c2ecf20Sopenharmony_ci * @pid:      Transceiver link mode (enum ionic_xcvr_pid)
11938c2ecf20Sopenharmony_ci * @sprom:    Transceiver sprom contents
11948c2ecf20Sopenharmony_ci */
11958c2ecf20Sopenharmony_cistruct ionic_xcvr_status {
11968c2ecf20Sopenharmony_ci	u8     state;
11978c2ecf20Sopenharmony_ci	u8     phy;
11988c2ecf20Sopenharmony_ci	__le16 pid;
11998c2ecf20Sopenharmony_ci	u8     sprom[256];
12008c2ecf20Sopenharmony_ci};
12018c2ecf20Sopenharmony_ci
12028c2ecf20Sopenharmony_ci/**
12038c2ecf20Sopenharmony_ci * union ionic_port_config - Port configuration
12048c2ecf20Sopenharmony_ci * @speed:              port speed (in Mbps)
12058c2ecf20Sopenharmony_ci * @mtu:                mtu
12068c2ecf20Sopenharmony_ci * @state:              port admin state (enum ionic_port_admin_state)
12078c2ecf20Sopenharmony_ci * @an_enable:          autoneg enable
12088c2ecf20Sopenharmony_ci * @fec_type:           fec type (enum ionic_port_fec_type)
12098c2ecf20Sopenharmony_ci * @pause_type:         pause type (enum ionic_port_pause_type)
12108c2ecf20Sopenharmony_ci * @loopback_mode:      loopback mode (enum ionic_port_loopback_mode)
12118c2ecf20Sopenharmony_ci */
12128c2ecf20Sopenharmony_ciunion ionic_port_config {
12138c2ecf20Sopenharmony_ci	struct {
12148c2ecf20Sopenharmony_ci#define IONIC_SPEED_100G	100000	/* 100G in Mbps */
12158c2ecf20Sopenharmony_ci#define IONIC_SPEED_50G		50000	/* 50G in Mbps */
12168c2ecf20Sopenharmony_ci#define IONIC_SPEED_40G		40000	/* 40G in Mbps */
12178c2ecf20Sopenharmony_ci#define IONIC_SPEED_25G		25000	/* 25G in Mbps */
12188c2ecf20Sopenharmony_ci#define IONIC_SPEED_10G		10000	/* 10G in Mbps */
12198c2ecf20Sopenharmony_ci#define IONIC_SPEED_1G		1000	/* 1G in Mbps */
12208c2ecf20Sopenharmony_ci		__le32 speed;
12218c2ecf20Sopenharmony_ci		__le32 mtu;
12228c2ecf20Sopenharmony_ci		u8     state;
12238c2ecf20Sopenharmony_ci		u8     an_enable;
12248c2ecf20Sopenharmony_ci		u8     fec_type;
12258c2ecf20Sopenharmony_ci#define IONIC_PAUSE_TYPE_MASK		0x0f
12268c2ecf20Sopenharmony_ci#define IONIC_PAUSE_FLAGS_MASK		0xf0
12278c2ecf20Sopenharmony_ci#define IONIC_PAUSE_F_TX		0x10
12288c2ecf20Sopenharmony_ci#define IONIC_PAUSE_F_RX		0x20
12298c2ecf20Sopenharmony_ci		u8     pause_type;
12308c2ecf20Sopenharmony_ci		u8     loopback_mode;
12318c2ecf20Sopenharmony_ci	};
12328c2ecf20Sopenharmony_ci	__le32 words[64];
12338c2ecf20Sopenharmony_ci};
12348c2ecf20Sopenharmony_ci
12358c2ecf20Sopenharmony_ci/**
12368c2ecf20Sopenharmony_ci * struct ionic_port_status - Port Status information
12378c2ecf20Sopenharmony_ci * @status:             link status (enum ionic_port_oper_status)
12388c2ecf20Sopenharmony_ci * @id:                 port id
12398c2ecf20Sopenharmony_ci * @speed:              link speed (in Mbps)
12408c2ecf20Sopenharmony_ci * @link_down_count:    number of times link went from from up to down
12418c2ecf20Sopenharmony_ci * @fec_type:           fec type (enum ionic_port_fec_type)
12428c2ecf20Sopenharmony_ci * @xcvr:               tranceiver status
12438c2ecf20Sopenharmony_ci */
12448c2ecf20Sopenharmony_cistruct ionic_port_status {
12458c2ecf20Sopenharmony_ci	__le32 id;
12468c2ecf20Sopenharmony_ci	__le32 speed;
12478c2ecf20Sopenharmony_ci	u8     status;
12488c2ecf20Sopenharmony_ci	__le16 link_down_count;
12498c2ecf20Sopenharmony_ci	u8     fec_type;
12508c2ecf20Sopenharmony_ci	u8     rsvd[48];
12518c2ecf20Sopenharmony_ci	struct ionic_xcvr_status  xcvr;
12528c2ecf20Sopenharmony_ci} __packed;
12538c2ecf20Sopenharmony_ci
12548c2ecf20Sopenharmony_ci/**
12558c2ecf20Sopenharmony_ci * struct ionic_port_identify_cmd - Port identify command
12568c2ecf20Sopenharmony_ci * @opcode:     opcode
12578c2ecf20Sopenharmony_ci * @index:      port index
12588c2ecf20Sopenharmony_ci * @ver:        Highest version of identify supported by driver
12598c2ecf20Sopenharmony_ci */
12608c2ecf20Sopenharmony_cistruct ionic_port_identify_cmd {
12618c2ecf20Sopenharmony_ci	u8 opcode;
12628c2ecf20Sopenharmony_ci	u8 index;
12638c2ecf20Sopenharmony_ci	u8 ver;
12648c2ecf20Sopenharmony_ci	u8 rsvd[61];
12658c2ecf20Sopenharmony_ci};
12668c2ecf20Sopenharmony_ci
12678c2ecf20Sopenharmony_ci/**
12688c2ecf20Sopenharmony_ci * struct ionic_port_identify_comp - Port identify command completion
12698c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
12708c2ecf20Sopenharmony_ci * @ver:    Version of identify returned by device
12718c2ecf20Sopenharmony_ci */
12728c2ecf20Sopenharmony_cistruct ionic_port_identify_comp {
12738c2ecf20Sopenharmony_ci	u8 status;
12748c2ecf20Sopenharmony_ci	u8 ver;
12758c2ecf20Sopenharmony_ci	u8 rsvd[14];
12768c2ecf20Sopenharmony_ci};
12778c2ecf20Sopenharmony_ci
12788c2ecf20Sopenharmony_ci/**
12798c2ecf20Sopenharmony_ci * struct ionic_port_init_cmd - Port initialization command
12808c2ecf20Sopenharmony_ci * @opcode:     opcode
12818c2ecf20Sopenharmony_ci * @index:      port index
12828c2ecf20Sopenharmony_ci * @info_pa:    destination address for port info (struct ionic_port_info)
12838c2ecf20Sopenharmony_ci */
12848c2ecf20Sopenharmony_cistruct ionic_port_init_cmd {
12858c2ecf20Sopenharmony_ci	u8     opcode;
12868c2ecf20Sopenharmony_ci	u8     index;
12878c2ecf20Sopenharmony_ci	u8     rsvd[6];
12888c2ecf20Sopenharmony_ci	__le64 info_pa;
12898c2ecf20Sopenharmony_ci	u8     rsvd2[48];
12908c2ecf20Sopenharmony_ci};
12918c2ecf20Sopenharmony_ci
12928c2ecf20Sopenharmony_ci/**
12938c2ecf20Sopenharmony_ci * struct ionic_port_init_comp - Port initialization command completion
12948c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
12958c2ecf20Sopenharmony_ci */
12968c2ecf20Sopenharmony_cistruct ionic_port_init_comp {
12978c2ecf20Sopenharmony_ci	u8 status;
12988c2ecf20Sopenharmony_ci	u8 rsvd[15];
12998c2ecf20Sopenharmony_ci};
13008c2ecf20Sopenharmony_ci
13018c2ecf20Sopenharmony_ci/**
13028c2ecf20Sopenharmony_ci * struct ionic_port_reset_cmd - Port reset command
13038c2ecf20Sopenharmony_ci * @opcode:     opcode
13048c2ecf20Sopenharmony_ci * @index:      port index
13058c2ecf20Sopenharmony_ci */
13068c2ecf20Sopenharmony_cistruct ionic_port_reset_cmd {
13078c2ecf20Sopenharmony_ci	u8 opcode;
13088c2ecf20Sopenharmony_ci	u8 index;
13098c2ecf20Sopenharmony_ci	u8 rsvd[62];
13108c2ecf20Sopenharmony_ci};
13118c2ecf20Sopenharmony_ci
13128c2ecf20Sopenharmony_ci/**
13138c2ecf20Sopenharmony_ci * struct ionic_port_reset_comp - Port reset command completion
13148c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
13158c2ecf20Sopenharmony_ci */
13168c2ecf20Sopenharmony_cistruct ionic_port_reset_comp {
13178c2ecf20Sopenharmony_ci	u8 status;
13188c2ecf20Sopenharmony_ci	u8 rsvd[15];
13198c2ecf20Sopenharmony_ci};
13208c2ecf20Sopenharmony_ci
13218c2ecf20Sopenharmony_ci/**
13228c2ecf20Sopenharmony_ci * enum ionic_stats_ctl_cmd - List of commands for stats control
13238c2ecf20Sopenharmony_ci * @IONIC_STATS_CTL_RESET:      Reset statistics
13248c2ecf20Sopenharmony_ci */
13258c2ecf20Sopenharmony_cienum ionic_stats_ctl_cmd {
13268c2ecf20Sopenharmony_ci	IONIC_STATS_CTL_RESET		= 0,
13278c2ecf20Sopenharmony_ci};
13288c2ecf20Sopenharmony_ci
13298c2ecf20Sopenharmony_ci/**
13308c2ecf20Sopenharmony_ci * enum ionic_port_attr - List of device attributes
13318c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_STATE:      Port state attribute
13328c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_SPEED:      Port speed attribute
13338c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_MTU:        Port MTU attribute
13348c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_AUTONEG:    Port autonegotation attribute
13358c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_FEC:        Port FEC attribute
13368c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_PAUSE:      Port pause attribute
13378c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_LOOPBACK:   Port loopback attribute
13388c2ecf20Sopenharmony_ci * @IONIC_PORT_ATTR_STATS_CTRL: Port statistics control attribute
13398c2ecf20Sopenharmony_ci */
13408c2ecf20Sopenharmony_cienum ionic_port_attr {
13418c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_STATE		= 0,
13428c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_SPEED		= 1,
13438c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_MTU		= 2,
13448c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_AUTONEG		= 3,
13458c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_FEC		= 4,
13468c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_PAUSE		= 5,
13478c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_LOOPBACK	= 6,
13488c2ecf20Sopenharmony_ci	IONIC_PORT_ATTR_STATS_CTRL	= 7,
13498c2ecf20Sopenharmony_ci};
13508c2ecf20Sopenharmony_ci
13518c2ecf20Sopenharmony_ci/**
13528c2ecf20Sopenharmony_ci * struct ionic_port_setattr_cmd - Set port attributes on the NIC
13538c2ecf20Sopenharmony_ci * @opcode:         Opcode
13548c2ecf20Sopenharmony_ci * @index:          Port index
13558c2ecf20Sopenharmony_ci * @attr:           Attribute type (enum ionic_port_attr)
13568c2ecf20Sopenharmony_ci * @state:          Port state
13578c2ecf20Sopenharmony_ci * @speed:          Port speed
13588c2ecf20Sopenharmony_ci * @mtu:            Port MTU
13598c2ecf20Sopenharmony_ci * @an_enable:      Port autonegotiation setting
13608c2ecf20Sopenharmony_ci * @fec_type:       Port FEC type setting
13618c2ecf20Sopenharmony_ci * @pause_type:     Port pause type setting
13628c2ecf20Sopenharmony_ci * @loopback_mode:  Port loopback mode
13638c2ecf20Sopenharmony_ci * @stats_ctl:      Port stats setting
13648c2ecf20Sopenharmony_ci */
13658c2ecf20Sopenharmony_cistruct ionic_port_setattr_cmd {
13668c2ecf20Sopenharmony_ci	u8     opcode;
13678c2ecf20Sopenharmony_ci	u8     index;
13688c2ecf20Sopenharmony_ci	u8     attr;
13698c2ecf20Sopenharmony_ci	u8     rsvd;
13708c2ecf20Sopenharmony_ci	union {
13718c2ecf20Sopenharmony_ci		u8      state;
13728c2ecf20Sopenharmony_ci		__le32  speed;
13738c2ecf20Sopenharmony_ci		__le32  mtu;
13748c2ecf20Sopenharmony_ci		u8      an_enable;
13758c2ecf20Sopenharmony_ci		u8      fec_type;
13768c2ecf20Sopenharmony_ci		u8      pause_type;
13778c2ecf20Sopenharmony_ci		u8      loopback_mode;
13788c2ecf20Sopenharmony_ci		u8      stats_ctl;
13798c2ecf20Sopenharmony_ci		u8      rsvd2[60];
13808c2ecf20Sopenharmony_ci	};
13818c2ecf20Sopenharmony_ci};
13828c2ecf20Sopenharmony_ci
13838c2ecf20Sopenharmony_ci/**
13848c2ecf20Sopenharmony_ci * struct ionic_port_setattr_comp - Port set attr command completion
13858c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
13868c2ecf20Sopenharmony_ci * @color:      Color bit
13878c2ecf20Sopenharmony_ci */
13888c2ecf20Sopenharmony_cistruct ionic_port_setattr_comp {
13898c2ecf20Sopenharmony_ci	u8     status;
13908c2ecf20Sopenharmony_ci	u8     rsvd[14];
13918c2ecf20Sopenharmony_ci	u8     color;
13928c2ecf20Sopenharmony_ci};
13938c2ecf20Sopenharmony_ci
13948c2ecf20Sopenharmony_ci/**
13958c2ecf20Sopenharmony_ci * struct ionic_port_getattr_cmd - Get port attributes from the NIC
13968c2ecf20Sopenharmony_ci * @opcode:     Opcode
13978c2ecf20Sopenharmony_ci * @index:      port index
13988c2ecf20Sopenharmony_ci * @attr:       Attribute type (enum ionic_port_attr)
13998c2ecf20Sopenharmony_ci */
14008c2ecf20Sopenharmony_cistruct ionic_port_getattr_cmd {
14018c2ecf20Sopenharmony_ci	u8     opcode;
14028c2ecf20Sopenharmony_ci	u8     index;
14038c2ecf20Sopenharmony_ci	u8     attr;
14048c2ecf20Sopenharmony_ci	u8     rsvd[61];
14058c2ecf20Sopenharmony_ci};
14068c2ecf20Sopenharmony_ci
14078c2ecf20Sopenharmony_ci/**
14088c2ecf20Sopenharmony_ci * struct ionic_port_getattr_comp - Port get attr command completion
14098c2ecf20Sopenharmony_ci * @status:         Status of the command (enum ionic_status_code)
14108c2ecf20Sopenharmony_ci * @state:          Port state
14118c2ecf20Sopenharmony_ci * @speed:          Port speed
14128c2ecf20Sopenharmony_ci * @mtu:            Port MTU
14138c2ecf20Sopenharmony_ci * @an_enable:      Port autonegotiation setting
14148c2ecf20Sopenharmony_ci * @fec_type:       Port FEC type setting
14158c2ecf20Sopenharmony_ci * @pause_type:     Port pause type setting
14168c2ecf20Sopenharmony_ci * @loopback_mode:  Port loopback mode
14178c2ecf20Sopenharmony_ci * @color:          Color bit
14188c2ecf20Sopenharmony_ci */
14198c2ecf20Sopenharmony_cistruct ionic_port_getattr_comp {
14208c2ecf20Sopenharmony_ci	u8     status;
14218c2ecf20Sopenharmony_ci	u8     rsvd[3];
14228c2ecf20Sopenharmony_ci	union {
14238c2ecf20Sopenharmony_ci		u8      state;
14248c2ecf20Sopenharmony_ci		__le32  speed;
14258c2ecf20Sopenharmony_ci		__le32  mtu;
14268c2ecf20Sopenharmony_ci		u8      an_enable;
14278c2ecf20Sopenharmony_ci		u8      fec_type;
14288c2ecf20Sopenharmony_ci		u8      pause_type;
14298c2ecf20Sopenharmony_ci		u8      loopback_mode;
14308c2ecf20Sopenharmony_ci		u8      rsvd2[11];
14318c2ecf20Sopenharmony_ci	} __packed;
14328c2ecf20Sopenharmony_ci	u8     color;
14338c2ecf20Sopenharmony_ci};
14348c2ecf20Sopenharmony_ci
14358c2ecf20Sopenharmony_ci/**
14368c2ecf20Sopenharmony_ci * struct ionic_lif_status - LIF status register
14378c2ecf20Sopenharmony_ci * @eid:             most recent NotifyQ event id
14388c2ecf20Sopenharmony_ci * @port_num:        port the LIF is connected to
14398c2ecf20Sopenharmony_ci * @link_status:     port status (enum ionic_port_oper_status)
14408c2ecf20Sopenharmony_ci * @link_speed:      speed of link in Mbps
14418c2ecf20Sopenharmony_ci * @link_down_count: number of times link went from up to down
14428c2ecf20Sopenharmony_ci */
14438c2ecf20Sopenharmony_cistruct ionic_lif_status {
14448c2ecf20Sopenharmony_ci	__le64 eid;
14458c2ecf20Sopenharmony_ci	u8     port_num;
14468c2ecf20Sopenharmony_ci	u8     rsvd;
14478c2ecf20Sopenharmony_ci	__le16 link_status;
14488c2ecf20Sopenharmony_ci	__le32 link_speed;		/* units of 1Mbps: eg 10000 = 10Gbps */
14498c2ecf20Sopenharmony_ci	__le16 link_down_count;
14508c2ecf20Sopenharmony_ci	u8      rsvd2[46];
14518c2ecf20Sopenharmony_ci};
14528c2ecf20Sopenharmony_ci
14538c2ecf20Sopenharmony_ci/**
14548c2ecf20Sopenharmony_ci * struct ionic_lif_reset_cmd - LIF reset command
14558c2ecf20Sopenharmony_ci * @opcode:    opcode
14568c2ecf20Sopenharmony_ci * @index:     LIF index
14578c2ecf20Sopenharmony_ci */
14588c2ecf20Sopenharmony_cistruct ionic_lif_reset_cmd {
14598c2ecf20Sopenharmony_ci	u8     opcode;
14608c2ecf20Sopenharmony_ci	u8     rsvd;
14618c2ecf20Sopenharmony_ci	__le16 index;
14628c2ecf20Sopenharmony_ci	__le32 rsvd2[15];
14638c2ecf20Sopenharmony_ci};
14648c2ecf20Sopenharmony_ci
14658c2ecf20Sopenharmony_citypedef struct ionic_admin_comp ionic_lif_reset_comp;
14668c2ecf20Sopenharmony_ci
14678c2ecf20Sopenharmony_cienum ionic_dev_state {
14688c2ecf20Sopenharmony_ci	IONIC_DEV_DISABLE	= 0,
14698c2ecf20Sopenharmony_ci	IONIC_DEV_ENABLE	= 1,
14708c2ecf20Sopenharmony_ci	IONIC_DEV_HANG_RESET	= 2,
14718c2ecf20Sopenharmony_ci};
14728c2ecf20Sopenharmony_ci
14738c2ecf20Sopenharmony_ci/**
14748c2ecf20Sopenharmony_ci * enum ionic_dev_attr - List of device attributes
14758c2ecf20Sopenharmony_ci * @IONIC_DEV_ATTR_STATE:     Device state attribute
14768c2ecf20Sopenharmony_ci * @IONIC_DEV_ATTR_NAME:      Device name attribute
14778c2ecf20Sopenharmony_ci * @IONIC_DEV_ATTR_FEATURES:  Device feature attributes
14788c2ecf20Sopenharmony_ci */
14798c2ecf20Sopenharmony_cienum ionic_dev_attr {
14808c2ecf20Sopenharmony_ci	IONIC_DEV_ATTR_STATE    = 0,
14818c2ecf20Sopenharmony_ci	IONIC_DEV_ATTR_NAME     = 1,
14828c2ecf20Sopenharmony_ci	IONIC_DEV_ATTR_FEATURES = 2,
14838c2ecf20Sopenharmony_ci};
14848c2ecf20Sopenharmony_ci
14858c2ecf20Sopenharmony_ci/**
14868c2ecf20Sopenharmony_ci * struct ionic_dev_setattr_cmd - Set Device attributes on the NIC
14878c2ecf20Sopenharmony_ci * @opcode:     Opcode
14888c2ecf20Sopenharmony_ci * @attr:       Attribute type (enum ionic_dev_attr)
14898c2ecf20Sopenharmony_ci * @state:      Device state (enum ionic_dev_state)
14908c2ecf20Sopenharmony_ci * @name:       The bus info, e.g. PCI slot-device-function, 0 terminated
14918c2ecf20Sopenharmony_ci * @features:   Device features
14928c2ecf20Sopenharmony_ci */
14938c2ecf20Sopenharmony_cistruct ionic_dev_setattr_cmd {
14948c2ecf20Sopenharmony_ci	u8     opcode;
14958c2ecf20Sopenharmony_ci	u8     attr;
14968c2ecf20Sopenharmony_ci	__le16 rsvd;
14978c2ecf20Sopenharmony_ci	union {
14988c2ecf20Sopenharmony_ci		u8      state;
14998c2ecf20Sopenharmony_ci		char    name[IONIC_IFNAMSIZ];
15008c2ecf20Sopenharmony_ci		__le64  features;
15018c2ecf20Sopenharmony_ci		u8      rsvd2[60];
15028c2ecf20Sopenharmony_ci	} __packed;
15038c2ecf20Sopenharmony_ci};
15048c2ecf20Sopenharmony_ci
15058c2ecf20Sopenharmony_ci/**
15068c2ecf20Sopenharmony_ci * struct ionic_dev_setattr_comp - Device set attr command completion
15078c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
15088c2ecf20Sopenharmony_ci * @features:   Device features
15098c2ecf20Sopenharmony_ci * @color:      Color bit
15108c2ecf20Sopenharmony_ci */
15118c2ecf20Sopenharmony_cistruct ionic_dev_setattr_comp {
15128c2ecf20Sopenharmony_ci	u8     status;
15138c2ecf20Sopenharmony_ci	u8     rsvd[3];
15148c2ecf20Sopenharmony_ci	union {
15158c2ecf20Sopenharmony_ci		__le64  features;
15168c2ecf20Sopenharmony_ci		u8      rsvd2[11];
15178c2ecf20Sopenharmony_ci	} __packed;
15188c2ecf20Sopenharmony_ci	u8     color;
15198c2ecf20Sopenharmony_ci};
15208c2ecf20Sopenharmony_ci
15218c2ecf20Sopenharmony_ci/**
15228c2ecf20Sopenharmony_ci * struct ionic_dev_getattr_cmd - Get Device attributes from the NIC
15238c2ecf20Sopenharmony_ci * @opcode:     opcode
15248c2ecf20Sopenharmony_ci * @attr:       Attribute type (enum ionic_dev_attr)
15258c2ecf20Sopenharmony_ci */
15268c2ecf20Sopenharmony_cistruct ionic_dev_getattr_cmd {
15278c2ecf20Sopenharmony_ci	u8     opcode;
15288c2ecf20Sopenharmony_ci	u8     attr;
15298c2ecf20Sopenharmony_ci	u8     rsvd[62];
15308c2ecf20Sopenharmony_ci};
15318c2ecf20Sopenharmony_ci
15328c2ecf20Sopenharmony_ci/**
15338c2ecf20Sopenharmony_ci * struct ionic_dev_setattr_comp - Device set attr command completion
15348c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
15358c2ecf20Sopenharmony_ci * @features:   Device features
15368c2ecf20Sopenharmony_ci * @color:      Color bit
15378c2ecf20Sopenharmony_ci */
15388c2ecf20Sopenharmony_cistruct ionic_dev_getattr_comp {
15398c2ecf20Sopenharmony_ci	u8     status;
15408c2ecf20Sopenharmony_ci	u8     rsvd[3];
15418c2ecf20Sopenharmony_ci	union {
15428c2ecf20Sopenharmony_ci		__le64  features;
15438c2ecf20Sopenharmony_ci		u8      rsvd2[11];
15448c2ecf20Sopenharmony_ci	} __packed;
15458c2ecf20Sopenharmony_ci	u8     color;
15468c2ecf20Sopenharmony_ci};
15478c2ecf20Sopenharmony_ci
15488c2ecf20Sopenharmony_ci/**
15498c2ecf20Sopenharmony_ci * RSS parameters
15508c2ecf20Sopenharmony_ci */
15518c2ecf20Sopenharmony_ci#define IONIC_RSS_HASH_KEY_SIZE		40
15528c2ecf20Sopenharmony_ci
15538c2ecf20Sopenharmony_cienum ionic_rss_hash_types {
15548c2ecf20Sopenharmony_ci	IONIC_RSS_TYPE_IPV4	= BIT(0),
15558c2ecf20Sopenharmony_ci	IONIC_RSS_TYPE_IPV4_TCP	= BIT(1),
15568c2ecf20Sopenharmony_ci	IONIC_RSS_TYPE_IPV4_UDP	= BIT(2),
15578c2ecf20Sopenharmony_ci	IONIC_RSS_TYPE_IPV6	= BIT(3),
15588c2ecf20Sopenharmony_ci	IONIC_RSS_TYPE_IPV6_TCP	= BIT(4),
15598c2ecf20Sopenharmony_ci	IONIC_RSS_TYPE_IPV6_UDP	= BIT(5),
15608c2ecf20Sopenharmony_ci};
15618c2ecf20Sopenharmony_ci
15628c2ecf20Sopenharmony_ci/**
15638c2ecf20Sopenharmony_ci * enum ionic_lif_attr - List of LIF attributes
15648c2ecf20Sopenharmony_ci * @IONIC_LIF_ATTR_STATE:       LIF state attribute
15658c2ecf20Sopenharmony_ci * @IONIC_LIF_ATTR_NAME:        LIF name attribute
15668c2ecf20Sopenharmony_ci * @IONIC_LIF_ATTR_MTU:         LIF MTU attribute
15678c2ecf20Sopenharmony_ci * @IONIC_LIF_ATTR_MAC:         LIF MAC attribute
15688c2ecf20Sopenharmony_ci * @IONIC_LIF_ATTR_FEATURES:    LIF features attribute
15698c2ecf20Sopenharmony_ci * @IONIC_LIF_ATTR_RSS:         LIF RSS attribute
15708c2ecf20Sopenharmony_ci * @IONIC_LIF_ATTR_STATS_CTRL:  LIF statistics control attribute
15718c2ecf20Sopenharmony_ci */
15728c2ecf20Sopenharmony_cienum ionic_lif_attr {
15738c2ecf20Sopenharmony_ci	IONIC_LIF_ATTR_STATE        = 0,
15748c2ecf20Sopenharmony_ci	IONIC_LIF_ATTR_NAME         = 1,
15758c2ecf20Sopenharmony_ci	IONIC_LIF_ATTR_MTU          = 2,
15768c2ecf20Sopenharmony_ci	IONIC_LIF_ATTR_MAC          = 3,
15778c2ecf20Sopenharmony_ci	IONIC_LIF_ATTR_FEATURES     = 4,
15788c2ecf20Sopenharmony_ci	IONIC_LIF_ATTR_RSS          = 5,
15798c2ecf20Sopenharmony_ci	IONIC_LIF_ATTR_STATS_CTRL   = 6,
15808c2ecf20Sopenharmony_ci};
15818c2ecf20Sopenharmony_ci
15828c2ecf20Sopenharmony_ci/**
15838c2ecf20Sopenharmony_ci * struct ionic_lif_setattr_cmd - Set LIF attributes on the NIC
15848c2ecf20Sopenharmony_ci * @opcode:     Opcode
15858c2ecf20Sopenharmony_ci * @attr:       Attribute type (enum ionic_lif_attr)
15868c2ecf20Sopenharmony_ci * @index:      LIF index
15878c2ecf20Sopenharmony_ci * @state:      LIF state (enum ionic_lif_state)
15888c2ecf20Sopenharmony_ci * @name:       The netdev name string, 0 terminated
15898c2ecf20Sopenharmony_ci * @mtu:        Mtu
15908c2ecf20Sopenharmony_ci * @mac:        Station mac
15918c2ecf20Sopenharmony_ci * @features:   Features (enum ionic_eth_hw_features)
15928c2ecf20Sopenharmony_ci * @rss:        RSS properties
15938c2ecf20Sopenharmony_ci *              @types:     The hash types to enable (see rss_hash_types)
15948c2ecf20Sopenharmony_ci *              @key:       The hash secret key
15958c2ecf20Sopenharmony_ci *              @addr:      Address for the indirection table shared memory
15968c2ecf20Sopenharmony_ci * @stats_ctl:  stats control commands (enum ionic_stats_ctl_cmd)
15978c2ecf20Sopenharmony_ci */
15988c2ecf20Sopenharmony_cistruct ionic_lif_setattr_cmd {
15998c2ecf20Sopenharmony_ci	u8     opcode;
16008c2ecf20Sopenharmony_ci	u8     attr;
16018c2ecf20Sopenharmony_ci	__le16 index;
16028c2ecf20Sopenharmony_ci	union {
16038c2ecf20Sopenharmony_ci		u8      state;
16048c2ecf20Sopenharmony_ci		char    name[IONIC_IFNAMSIZ];
16058c2ecf20Sopenharmony_ci		__le32  mtu;
16068c2ecf20Sopenharmony_ci		u8      mac[6];
16078c2ecf20Sopenharmony_ci		__le64  features;
16088c2ecf20Sopenharmony_ci		struct {
16098c2ecf20Sopenharmony_ci			__le16 types;
16108c2ecf20Sopenharmony_ci			u8     key[IONIC_RSS_HASH_KEY_SIZE];
16118c2ecf20Sopenharmony_ci			u8     rsvd[6];
16128c2ecf20Sopenharmony_ci			__le64 addr;
16138c2ecf20Sopenharmony_ci		} rss;
16148c2ecf20Sopenharmony_ci		u8      stats_ctl;
16158c2ecf20Sopenharmony_ci		u8      rsvd[60];
16168c2ecf20Sopenharmony_ci	} __packed;
16178c2ecf20Sopenharmony_ci};
16188c2ecf20Sopenharmony_ci
16198c2ecf20Sopenharmony_ci/**
16208c2ecf20Sopenharmony_ci * struct ionic_lif_setattr_comp - LIF set attr command completion
16218c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
16228c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
16238c2ecf20Sopenharmony_ci * @features:   features (enum ionic_eth_hw_features)
16248c2ecf20Sopenharmony_ci * @color:      Color bit
16258c2ecf20Sopenharmony_ci */
16268c2ecf20Sopenharmony_cistruct ionic_lif_setattr_comp {
16278c2ecf20Sopenharmony_ci	u8     status;
16288c2ecf20Sopenharmony_ci	u8     rsvd;
16298c2ecf20Sopenharmony_ci	__le16 comp_index;
16308c2ecf20Sopenharmony_ci	union {
16318c2ecf20Sopenharmony_ci		__le64  features;
16328c2ecf20Sopenharmony_ci		u8      rsvd2[11];
16338c2ecf20Sopenharmony_ci	} __packed;
16348c2ecf20Sopenharmony_ci	u8     color;
16358c2ecf20Sopenharmony_ci};
16368c2ecf20Sopenharmony_ci
16378c2ecf20Sopenharmony_ci/**
16388c2ecf20Sopenharmony_ci * struct ionic_lif_getattr_cmd - Get LIF attributes from the NIC
16398c2ecf20Sopenharmony_ci * @opcode:     Opcode
16408c2ecf20Sopenharmony_ci * @attr:       Attribute type (enum ionic_lif_attr)
16418c2ecf20Sopenharmony_ci * @index:      LIF index
16428c2ecf20Sopenharmony_ci */
16438c2ecf20Sopenharmony_cistruct ionic_lif_getattr_cmd {
16448c2ecf20Sopenharmony_ci	u8     opcode;
16458c2ecf20Sopenharmony_ci	u8     attr;
16468c2ecf20Sopenharmony_ci	__le16 index;
16478c2ecf20Sopenharmony_ci	u8     rsvd[60];
16488c2ecf20Sopenharmony_ci};
16498c2ecf20Sopenharmony_ci
16508c2ecf20Sopenharmony_ci/**
16518c2ecf20Sopenharmony_ci * struct ionic_lif_getattr_comp - LIF get attr command completion
16528c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
16538c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
16548c2ecf20Sopenharmony_ci * @state:      LIF state (enum ionic_lif_state)
16558c2ecf20Sopenharmony_ci * @name:       The netdev name string, 0 terminated
16568c2ecf20Sopenharmony_ci * @mtu:        Mtu
16578c2ecf20Sopenharmony_ci * @mac:        Station mac
16588c2ecf20Sopenharmony_ci * @features:   Features (enum ionic_eth_hw_features)
16598c2ecf20Sopenharmony_ci * @color:      Color bit
16608c2ecf20Sopenharmony_ci */
16618c2ecf20Sopenharmony_cistruct ionic_lif_getattr_comp {
16628c2ecf20Sopenharmony_ci	u8     status;
16638c2ecf20Sopenharmony_ci	u8     rsvd;
16648c2ecf20Sopenharmony_ci	__le16 comp_index;
16658c2ecf20Sopenharmony_ci	union {
16668c2ecf20Sopenharmony_ci		u8      state;
16678c2ecf20Sopenharmony_ci		__le32  mtu;
16688c2ecf20Sopenharmony_ci		u8      mac[6];
16698c2ecf20Sopenharmony_ci		__le64  features;
16708c2ecf20Sopenharmony_ci		u8      rsvd2[11];
16718c2ecf20Sopenharmony_ci	} __packed;
16728c2ecf20Sopenharmony_ci	u8     color;
16738c2ecf20Sopenharmony_ci};
16748c2ecf20Sopenharmony_ci
16758c2ecf20Sopenharmony_cienum ionic_rx_mode {
16768c2ecf20Sopenharmony_ci	IONIC_RX_MODE_F_UNICAST		= BIT(0),
16778c2ecf20Sopenharmony_ci	IONIC_RX_MODE_F_MULTICAST	= BIT(1),
16788c2ecf20Sopenharmony_ci	IONIC_RX_MODE_F_BROADCAST	= BIT(2),
16798c2ecf20Sopenharmony_ci	IONIC_RX_MODE_F_PROMISC		= BIT(3),
16808c2ecf20Sopenharmony_ci	IONIC_RX_MODE_F_ALLMULTI	= BIT(4),
16818c2ecf20Sopenharmony_ci	IONIC_RX_MODE_F_RDMA_SNIFFER	= BIT(5),
16828c2ecf20Sopenharmony_ci};
16838c2ecf20Sopenharmony_ci
16848c2ecf20Sopenharmony_ci/**
16858c2ecf20Sopenharmony_ci * struct ionic_rx_mode_set_cmd - Set LIF's Rx mode command
16868c2ecf20Sopenharmony_ci * @opcode:     opcode
16878c2ecf20Sopenharmony_ci * @lif_index:  LIF index
16888c2ecf20Sopenharmony_ci * @rx_mode:    Rx mode flags:
16898c2ecf20Sopenharmony_ci *                  IONIC_RX_MODE_F_UNICAST: Accept known unicast packets
16908c2ecf20Sopenharmony_ci *                  IONIC_RX_MODE_F_MULTICAST: Accept known multicast packets
16918c2ecf20Sopenharmony_ci *                  IONIC_RX_MODE_F_BROADCAST: Accept broadcast packets
16928c2ecf20Sopenharmony_ci *                  IONIC_RX_MODE_F_PROMISC: Accept any packets
16938c2ecf20Sopenharmony_ci *                  IONIC_RX_MODE_F_ALLMULTI: Accept any multicast packets
16948c2ecf20Sopenharmony_ci *                  IONIC_RX_MODE_F_RDMA_SNIFFER: Sniff RDMA packets
16958c2ecf20Sopenharmony_ci */
16968c2ecf20Sopenharmony_cistruct ionic_rx_mode_set_cmd {
16978c2ecf20Sopenharmony_ci	u8     opcode;
16988c2ecf20Sopenharmony_ci	u8     rsvd;
16998c2ecf20Sopenharmony_ci	__le16 lif_index;
17008c2ecf20Sopenharmony_ci	__le16 rx_mode;
17018c2ecf20Sopenharmony_ci	__le16 rsvd2[29];
17028c2ecf20Sopenharmony_ci};
17038c2ecf20Sopenharmony_ci
17048c2ecf20Sopenharmony_citypedef struct ionic_admin_comp ionic_rx_mode_set_comp;
17058c2ecf20Sopenharmony_ci
17068c2ecf20Sopenharmony_cienum ionic_rx_filter_match_type {
17078c2ecf20Sopenharmony_ci	IONIC_RX_FILTER_MATCH_VLAN = 0,
17088c2ecf20Sopenharmony_ci	IONIC_RX_FILTER_MATCH_MAC,
17098c2ecf20Sopenharmony_ci	IONIC_RX_FILTER_MATCH_MAC_VLAN,
17108c2ecf20Sopenharmony_ci};
17118c2ecf20Sopenharmony_ci
17128c2ecf20Sopenharmony_ci/**
17138c2ecf20Sopenharmony_ci * struct ionic_rx_filter_add_cmd - Add LIF Rx filter command
17148c2ecf20Sopenharmony_ci * @opcode:     opcode
17158c2ecf20Sopenharmony_ci * @qtype:      Queue type
17168c2ecf20Sopenharmony_ci * @lif_index:  LIF index
17178c2ecf20Sopenharmony_ci * @qid:        Queue ID
17188c2ecf20Sopenharmony_ci * @match:      Rx filter match type (see IONIC_RX_FILTER_MATCH_xxx)
17198c2ecf20Sopenharmony_ci * @vlan:       VLAN filter
17208c2ecf20Sopenharmony_ci *              @vlan:  VLAN ID
17218c2ecf20Sopenharmony_ci * @mac:        MAC filter
17228c2ecf20Sopenharmony_ci *              @addr:  MAC address (network-byte order)
17238c2ecf20Sopenharmony_ci * @mac_vlan:   MACVLAN filter
17248c2ecf20Sopenharmony_ci *              @vlan:  VLAN ID
17258c2ecf20Sopenharmony_ci *              @addr:  MAC address (network-byte order)
17268c2ecf20Sopenharmony_ci */
17278c2ecf20Sopenharmony_cistruct ionic_rx_filter_add_cmd {
17288c2ecf20Sopenharmony_ci	u8     opcode;
17298c2ecf20Sopenharmony_ci	u8     qtype;
17308c2ecf20Sopenharmony_ci	__le16 lif_index;
17318c2ecf20Sopenharmony_ci	__le32 qid;
17328c2ecf20Sopenharmony_ci	__le16 match;
17338c2ecf20Sopenharmony_ci	union {
17348c2ecf20Sopenharmony_ci		struct {
17358c2ecf20Sopenharmony_ci			__le16 vlan;
17368c2ecf20Sopenharmony_ci		} vlan;
17378c2ecf20Sopenharmony_ci		struct {
17388c2ecf20Sopenharmony_ci			u8     addr[6];
17398c2ecf20Sopenharmony_ci		} mac;
17408c2ecf20Sopenharmony_ci		struct {
17418c2ecf20Sopenharmony_ci			__le16 vlan;
17428c2ecf20Sopenharmony_ci			u8     addr[6];
17438c2ecf20Sopenharmony_ci		} mac_vlan;
17448c2ecf20Sopenharmony_ci		u8 rsvd[54];
17458c2ecf20Sopenharmony_ci	};
17468c2ecf20Sopenharmony_ci};
17478c2ecf20Sopenharmony_ci
17488c2ecf20Sopenharmony_ci/**
17498c2ecf20Sopenharmony_ci * struct ionic_rx_filter_add_comp - Add LIF Rx filter command completion
17508c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
17518c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
17528c2ecf20Sopenharmony_ci * @filter_id:  Filter ID
17538c2ecf20Sopenharmony_ci * @color:      Color bit
17548c2ecf20Sopenharmony_ci */
17558c2ecf20Sopenharmony_cistruct ionic_rx_filter_add_comp {
17568c2ecf20Sopenharmony_ci	u8     status;
17578c2ecf20Sopenharmony_ci	u8     rsvd;
17588c2ecf20Sopenharmony_ci	__le16 comp_index;
17598c2ecf20Sopenharmony_ci	__le32 filter_id;
17608c2ecf20Sopenharmony_ci	u8     rsvd2[7];
17618c2ecf20Sopenharmony_ci	u8     color;
17628c2ecf20Sopenharmony_ci};
17638c2ecf20Sopenharmony_ci
17648c2ecf20Sopenharmony_ci/**
17658c2ecf20Sopenharmony_ci * struct ionic_rx_filter_del_cmd - Delete LIF Rx filter command
17668c2ecf20Sopenharmony_ci * @opcode:     opcode
17678c2ecf20Sopenharmony_ci * @lif_index:  LIF index
17688c2ecf20Sopenharmony_ci * @filter_id:  Filter ID
17698c2ecf20Sopenharmony_ci */
17708c2ecf20Sopenharmony_cistruct ionic_rx_filter_del_cmd {
17718c2ecf20Sopenharmony_ci	u8     opcode;
17728c2ecf20Sopenharmony_ci	u8     rsvd;
17738c2ecf20Sopenharmony_ci	__le16 lif_index;
17748c2ecf20Sopenharmony_ci	__le32 filter_id;
17758c2ecf20Sopenharmony_ci	u8     rsvd2[56];
17768c2ecf20Sopenharmony_ci};
17778c2ecf20Sopenharmony_ci
17788c2ecf20Sopenharmony_citypedef struct ionic_admin_comp ionic_rx_filter_del_comp;
17798c2ecf20Sopenharmony_ci
17808c2ecf20Sopenharmony_cienum ionic_vf_attr {
17818c2ecf20Sopenharmony_ci	IONIC_VF_ATTR_SPOOFCHK	= 1,
17828c2ecf20Sopenharmony_ci	IONIC_VF_ATTR_TRUST	= 2,
17838c2ecf20Sopenharmony_ci	IONIC_VF_ATTR_MAC	= 3,
17848c2ecf20Sopenharmony_ci	IONIC_VF_ATTR_LINKSTATE	= 4,
17858c2ecf20Sopenharmony_ci	IONIC_VF_ATTR_VLAN	= 5,
17868c2ecf20Sopenharmony_ci	IONIC_VF_ATTR_RATE	= 6,
17878c2ecf20Sopenharmony_ci	IONIC_VF_ATTR_STATSADDR	= 7,
17888c2ecf20Sopenharmony_ci};
17898c2ecf20Sopenharmony_ci
17908c2ecf20Sopenharmony_ci/**
17918c2ecf20Sopenharmony_ci * enum ionic_vf_link_status - Virtual Function link status
17928c2ecf20Sopenharmony_ci * @IONIC_VF_LINK_STATUS_AUTO:   Use link state of the uplink
17938c2ecf20Sopenharmony_ci * @IONIC_VF_LINK_STATUS_UP:     Link always up
17948c2ecf20Sopenharmony_ci * @IONIC_VF_LINK_STATUS_DOWN:   Link always down
17958c2ecf20Sopenharmony_ci */
17968c2ecf20Sopenharmony_cienum ionic_vf_link_status {
17978c2ecf20Sopenharmony_ci	IONIC_VF_LINK_STATUS_AUTO = 0,
17988c2ecf20Sopenharmony_ci	IONIC_VF_LINK_STATUS_UP   = 1,
17998c2ecf20Sopenharmony_ci	IONIC_VF_LINK_STATUS_DOWN = 2,
18008c2ecf20Sopenharmony_ci};
18018c2ecf20Sopenharmony_ci
18028c2ecf20Sopenharmony_ci/**
18038c2ecf20Sopenharmony_ci * struct ionic_vf_setattr_cmd - Set VF attributes on the NIC
18048c2ecf20Sopenharmony_ci * @opcode:     Opcode
18058c2ecf20Sopenharmony_ci * @attr:       Attribute type (enum ionic_vf_attr)
18068c2ecf20Sopenharmony_ci * @vf_index:   VF index
18078c2ecf20Sopenharmony_ci *	@macaddr:	mac address
18088c2ecf20Sopenharmony_ci *	@vlanid:	vlan ID
18098c2ecf20Sopenharmony_ci *	@maxrate:	max Tx rate in Mbps
18108c2ecf20Sopenharmony_ci *	@spoofchk:	enable address spoof checking
18118c2ecf20Sopenharmony_ci *	@trust:		enable VF trust
18128c2ecf20Sopenharmony_ci *	@linkstate:	set link up or down
18138c2ecf20Sopenharmony_ci *	@stats_pa:	set DMA address for VF stats
18148c2ecf20Sopenharmony_ci */
18158c2ecf20Sopenharmony_cistruct ionic_vf_setattr_cmd {
18168c2ecf20Sopenharmony_ci	u8     opcode;
18178c2ecf20Sopenharmony_ci	u8     attr;
18188c2ecf20Sopenharmony_ci	__le16 vf_index;
18198c2ecf20Sopenharmony_ci	union {
18208c2ecf20Sopenharmony_ci		u8     macaddr[6];
18218c2ecf20Sopenharmony_ci		__le16 vlanid;
18228c2ecf20Sopenharmony_ci		__le32 maxrate;
18238c2ecf20Sopenharmony_ci		u8     spoofchk;
18248c2ecf20Sopenharmony_ci		u8     trust;
18258c2ecf20Sopenharmony_ci		u8     linkstate;
18268c2ecf20Sopenharmony_ci		__le64 stats_pa;
18278c2ecf20Sopenharmony_ci		u8     pad[60];
18288c2ecf20Sopenharmony_ci	} __packed;
18298c2ecf20Sopenharmony_ci};
18308c2ecf20Sopenharmony_ci
18318c2ecf20Sopenharmony_cistruct ionic_vf_setattr_comp {
18328c2ecf20Sopenharmony_ci	u8     status;
18338c2ecf20Sopenharmony_ci	u8     attr;
18348c2ecf20Sopenharmony_ci	__le16 vf_index;
18358c2ecf20Sopenharmony_ci	__le16 comp_index;
18368c2ecf20Sopenharmony_ci	u8     rsvd[9];
18378c2ecf20Sopenharmony_ci	u8     color;
18388c2ecf20Sopenharmony_ci};
18398c2ecf20Sopenharmony_ci
18408c2ecf20Sopenharmony_ci/**
18418c2ecf20Sopenharmony_ci * struct ionic_vf_getattr_cmd - Get VF attributes from the NIC
18428c2ecf20Sopenharmony_ci * @opcode:     Opcode
18438c2ecf20Sopenharmony_ci * @attr:       Attribute type (enum ionic_vf_attr)
18448c2ecf20Sopenharmony_ci * @vf_index:   VF index
18458c2ecf20Sopenharmony_ci */
18468c2ecf20Sopenharmony_cistruct ionic_vf_getattr_cmd {
18478c2ecf20Sopenharmony_ci	u8     opcode;
18488c2ecf20Sopenharmony_ci	u8     attr;
18498c2ecf20Sopenharmony_ci	__le16 vf_index;
18508c2ecf20Sopenharmony_ci	u8     rsvd[60];
18518c2ecf20Sopenharmony_ci};
18528c2ecf20Sopenharmony_ci
18538c2ecf20Sopenharmony_cistruct ionic_vf_getattr_comp {
18548c2ecf20Sopenharmony_ci	u8     status;
18558c2ecf20Sopenharmony_ci	u8     attr;
18568c2ecf20Sopenharmony_ci	__le16 vf_index;
18578c2ecf20Sopenharmony_ci	union {
18588c2ecf20Sopenharmony_ci		u8     macaddr[6];
18598c2ecf20Sopenharmony_ci		__le16 vlanid;
18608c2ecf20Sopenharmony_ci		__le32 maxrate;
18618c2ecf20Sopenharmony_ci		u8     spoofchk;
18628c2ecf20Sopenharmony_ci		u8     trust;
18638c2ecf20Sopenharmony_ci		u8     linkstate;
18648c2ecf20Sopenharmony_ci		__le64 stats_pa;
18658c2ecf20Sopenharmony_ci		u8     pad[11];
18668c2ecf20Sopenharmony_ci	} __packed;
18678c2ecf20Sopenharmony_ci	u8     color;
18688c2ecf20Sopenharmony_ci};
18698c2ecf20Sopenharmony_ci
18708c2ecf20Sopenharmony_ci/**
18718c2ecf20Sopenharmony_ci * struct ionic_qos_identify_cmd - QoS identify command
18728c2ecf20Sopenharmony_ci * @opcode:  opcode
18738c2ecf20Sopenharmony_ci * @ver:     Highest version of identify supported by driver
18748c2ecf20Sopenharmony_ci *
18758c2ecf20Sopenharmony_ci */
18768c2ecf20Sopenharmony_cistruct ionic_qos_identify_cmd {
18778c2ecf20Sopenharmony_ci	u8 opcode;
18788c2ecf20Sopenharmony_ci	u8 ver;
18798c2ecf20Sopenharmony_ci	u8 rsvd[62];
18808c2ecf20Sopenharmony_ci};
18818c2ecf20Sopenharmony_ci
18828c2ecf20Sopenharmony_ci/**
18838c2ecf20Sopenharmony_ci * struct ionic_qos_identify_comp - QoS identify command completion
18848c2ecf20Sopenharmony_ci * @status: Status of the command (enum ionic_status_code)
18858c2ecf20Sopenharmony_ci * @ver:    Version of identify returned by device
18868c2ecf20Sopenharmony_ci */
18878c2ecf20Sopenharmony_cistruct ionic_qos_identify_comp {
18888c2ecf20Sopenharmony_ci	u8 status;
18898c2ecf20Sopenharmony_ci	u8 ver;
18908c2ecf20Sopenharmony_ci	u8 rsvd[14];
18918c2ecf20Sopenharmony_ci};
18928c2ecf20Sopenharmony_ci
18938c2ecf20Sopenharmony_ci#define IONIC_QOS_TC_MAX		8
18948c2ecf20Sopenharmony_ci#define IONIC_QOS_ALL_TC		0xFF
18958c2ecf20Sopenharmony_ci/* Capri max supported, should be renamed. */
18968c2ecf20Sopenharmony_ci#define IONIC_QOS_CLASS_MAX		7
18978c2ecf20Sopenharmony_ci#define IONIC_QOS_PCP_MAX		8
18988c2ecf20Sopenharmony_ci#define IONIC_QOS_CLASS_NAME_SZ	32
18998c2ecf20Sopenharmony_ci#define IONIC_QOS_DSCP_MAX		64
19008c2ecf20Sopenharmony_ci#define IONIC_QOS_ALL_PCP		0xFF
19018c2ecf20Sopenharmony_ci#define IONIC_DSCP_BLOCK_SIZE		8
19028c2ecf20Sopenharmony_ci
19038c2ecf20Sopenharmony_ci/**
19048c2ecf20Sopenharmony_ci * enum ionic_qos_class
19058c2ecf20Sopenharmony_ci */
19068c2ecf20Sopenharmony_cienum ionic_qos_class {
19078c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_DEFAULT		= 0,
19088c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_USER_DEFINED_1	= 1,
19098c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_USER_DEFINED_2	= 2,
19108c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_USER_DEFINED_3	= 3,
19118c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_USER_DEFINED_4	= 4,
19128c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_USER_DEFINED_5	= 5,
19138c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_USER_DEFINED_6	= 6,
19148c2ecf20Sopenharmony_ci};
19158c2ecf20Sopenharmony_ci
19168c2ecf20Sopenharmony_ci/**
19178c2ecf20Sopenharmony_ci * enum ionic_qos_class_type - Traffic classification criteria
19188c2ecf20Sopenharmony_ci * @IONIC_QOS_CLASS_TYPE_NONE:    No QoS
19198c2ecf20Sopenharmony_ci * @IONIC_QOS_CLASS_TYPE_PCP:     Dot1Q PCP
19208c2ecf20Sopenharmony_ci * @IONIC_QOS_CLASS_TYPE_DSCP:    IP DSCP
19218c2ecf20Sopenharmony_ci */
19228c2ecf20Sopenharmony_cienum ionic_qos_class_type {
19238c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_TYPE_NONE	= 0,
19248c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_TYPE_PCP	= 1,
19258c2ecf20Sopenharmony_ci	IONIC_QOS_CLASS_TYPE_DSCP	= 2,
19268c2ecf20Sopenharmony_ci};
19278c2ecf20Sopenharmony_ci
19288c2ecf20Sopenharmony_ci/**
19298c2ecf20Sopenharmony_ci * enum ionic_qos_sched_type - QoS class scheduling type
19308c2ecf20Sopenharmony_ci * @IONIC_QOS_SCHED_TYPE_STRICT:  Strict priority
19318c2ecf20Sopenharmony_ci * @IONIC_QOS_SCHED_TYPE_DWRR:    Deficit weighted round-robin
19328c2ecf20Sopenharmony_ci */
19338c2ecf20Sopenharmony_cienum ionic_qos_sched_type {
19348c2ecf20Sopenharmony_ci	IONIC_QOS_SCHED_TYPE_STRICT	= 0,
19358c2ecf20Sopenharmony_ci	IONIC_QOS_SCHED_TYPE_DWRR	= 1,
19368c2ecf20Sopenharmony_ci};
19378c2ecf20Sopenharmony_ci
19388c2ecf20Sopenharmony_ci/**
19398c2ecf20Sopenharmony_ci * union ionic_qos_config - QoS configuration structure
19408c2ecf20Sopenharmony_ci * @flags:		Configuration flags
19418c2ecf20Sopenharmony_ci *	IONIC_QOS_CONFIG_F_ENABLE		enable
19428c2ecf20Sopenharmony_ci *	IONIC_QOS_CONFIG_F_NO_DROP		drop/nodrop
19438c2ecf20Sopenharmony_ci *	IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP		enable dot1q pcp rewrite
19448c2ecf20Sopenharmony_ci *	IONIC_QOS_CONFIG_F_RW_IP_DSCP		enable ip dscp rewrite
19458c2ecf20Sopenharmony_ci *	IONIC_QOS_CONFIG_F_NON_DISRUPTIVE	Non-disruptive TC update
19468c2ecf20Sopenharmony_ci * @sched_type:		QoS class scheduling type (enum ionic_qos_sched_type)
19478c2ecf20Sopenharmony_ci * @class_type:		QoS class type (enum ionic_qos_class_type)
19488c2ecf20Sopenharmony_ci * @pause_type:		QoS pause type (enum ionic_qos_pause_type)
19498c2ecf20Sopenharmony_ci * @name:		QoS class name
19508c2ecf20Sopenharmony_ci * @mtu:		MTU of the class
19518c2ecf20Sopenharmony_ci * @pfc_cos:		Priority-Flow Control class of service
19528c2ecf20Sopenharmony_ci * @dwrr_weight:	QoS class scheduling weight
19538c2ecf20Sopenharmony_ci * @strict_rlmt:	Rate limit for strict priority scheduling
19548c2ecf20Sopenharmony_ci * @rw_dot1q_pcp:	Rewrite dot1q pcp to this value	(valid iff F_RW_DOT1Q_PCP)
19558c2ecf20Sopenharmony_ci * @rw_ip_dscp:		Rewrite ip dscp to this value	(valid iff F_RW_IP_DSCP)
19568c2ecf20Sopenharmony_ci * @dot1q_pcp:		Dot1q pcp value
19578c2ecf20Sopenharmony_ci * @ndscp:		Number of valid dscp values in the ip_dscp field
19588c2ecf20Sopenharmony_ci * @ip_dscp:		IP dscp values
19598c2ecf20Sopenharmony_ci */
19608c2ecf20Sopenharmony_ciunion ionic_qos_config {
19618c2ecf20Sopenharmony_ci	struct {
19628c2ecf20Sopenharmony_ci#define IONIC_QOS_CONFIG_F_ENABLE		BIT(0)
19638c2ecf20Sopenharmony_ci#define IONIC_QOS_CONFIG_F_NO_DROP		BIT(1)
19648c2ecf20Sopenharmony_ci/* Used to rewrite PCP or DSCP value. */
19658c2ecf20Sopenharmony_ci#define IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP		BIT(2)
19668c2ecf20Sopenharmony_ci#define IONIC_QOS_CONFIG_F_RW_IP_DSCP		BIT(3)
19678c2ecf20Sopenharmony_ci/* Non-disruptive TC update */
19688c2ecf20Sopenharmony_ci#define IONIC_QOS_CONFIG_F_NON_DISRUPTIVE	BIT(4)
19698c2ecf20Sopenharmony_ci		u8      flags;
19708c2ecf20Sopenharmony_ci		u8      sched_type;
19718c2ecf20Sopenharmony_ci		u8      class_type;
19728c2ecf20Sopenharmony_ci		u8      pause_type;
19738c2ecf20Sopenharmony_ci		char    name[IONIC_QOS_CLASS_NAME_SZ];
19748c2ecf20Sopenharmony_ci		__le32  mtu;
19758c2ecf20Sopenharmony_ci		/* flow control */
19768c2ecf20Sopenharmony_ci		u8      pfc_cos;
19778c2ecf20Sopenharmony_ci		/* scheduler */
19788c2ecf20Sopenharmony_ci		union {
19798c2ecf20Sopenharmony_ci			u8      dwrr_weight;
19808c2ecf20Sopenharmony_ci			__le64  strict_rlmt;
19818c2ecf20Sopenharmony_ci		};
19828c2ecf20Sopenharmony_ci		/* marking */
19838c2ecf20Sopenharmony_ci		/* Used to rewrite PCP or DSCP value. */
19848c2ecf20Sopenharmony_ci		union {
19858c2ecf20Sopenharmony_ci			u8      rw_dot1q_pcp;
19868c2ecf20Sopenharmony_ci			u8      rw_ip_dscp;
19878c2ecf20Sopenharmony_ci		};
19888c2ecf20Sopenharmony_ci		/* classification */
19898c2ecf20Sopenharmony_ci		union {
19908c2ecf20Sopenharmony_ci			u8      dot1q_pcp;
19918c2ecf20Sopenharmony_ci			struct {
19928c2ecf20Sopenharmony_ci				u8      ndscp;
19938c2ecf20Sopenharmony_ci				u8      ip_dscp[IONIC_QOS_DSCP_MAX];
19948c2ecf20Sopenharmony_ci			};
19958c2ecf20Sopenharmony_ci		};
19968c2ecf20Sopenharmony_ci	};
19978c2ecf20Sopenharmony_ci	__le32  words[64];
19988c2ecf20Sopenharmony_ci};
19998c2ecf20Sopenharmony_ci
20008c2ecf20Sopenharmony_ci/**
20018c2ecf20Sopenharmony_ci * union ionic_qos_identity - QoS identity structure
20028c2ecf20Sopenharmony_ci * @version:	Version of the identify structure
20038c2ecf20Sopenharmony_ci * @type:	QoS system type
20048c2ecf20Sopenharmony_ci * @nclasses:	Number of usable QoS classes
20058c2ecf20Sopenharmony_ci * @config:	Current configuration of classes
20068c2ecf20Sopenharmony_ci */
20078c2ecf20Sopenharmony_ciunion ionic_qos_identity {
20088c2ecf20Sopenharmony_ci	struct {
20098c2ecf20Sopenharmony_ci		u8     version;
20108c2ecf20Sopenharmony_ci		u8     type;
20118c2ecf20Sopenharmony_ci		u8     rsvd[62];
20128c2ecf20Sopenharmony_ci		union ionic_qos_config config[IONIC_QOS_CLASS_MAX];
20138c2ecf20Sopenharmony_ci	};
20148c2ecf20Sopenharmony_ci	__le32 words[478];
20158c2ecf20Sopenharmony_ci};
20168c2ecf20Sopenharmony_ci
20178c2ecf20Sopenharmony_ci/**
20188c2ecf20Sopenharmony_ci * struct ionic_qos_init_cmd - QoS config init command
20198c2ecf20Sopenharmony_ci * @opcode:	Opcode
20208c2ecf20Sopenharmony_ci * @group:	QoS class id
20218c2ecf20Sopenharmony_ci * @info_pa:	destination address for qos info
20228c2ecf20Sopenharmony_ci */
20238c2ecf20Sopenharmony_cistruct ionic_qos_init_cmd {
20248c2ecf20Sopenharmony_ci	u8     opcode;
20258c2ecf20Sopenharmony_ci	u8     group;
20268c2ecf20Sopenharmony_ci	u8     rsvd[6];
20278c2ecf20Sopenharmony_ci	__le64 info_pa;
20288c2ecf20Sopenharmony_ci	u8     rsvd1[48];
20298c2ecf20Sopenharmony_ci};
20308c2ecf20Sopenharmony_ci
20318c2ecf20Sopenharmony_citypedef struct ionic_admin_comp ionic_qos_init_comp;
20328c2ecf20Sopenharmony_ci
20338c2ecf20Sopenharmony_ci/**
20348c2ecf20Sopenharmony_ci * struct ionic_qos_reset_cmd - QoS config reset command
20358c2ecf20Sopenharmony_ci * @opcode:	Opcode
20368c2ecf20Sopenharmony_ci * @group:	QoS class id
20378c2ecf20Sopenharmony_ci */
20388c2ecf20Sopenharmony_cistruct ionic_qos_reset_cmd {
20398c2ecf20Sopenharmony_ci	u8    opcode;
20408c2ecf20Sopenharmony_ci	u8    group;
20418c2ecf20Sopenharmony_ci	u8    rsvd[62];
20428c2ecf20Sopenharmony_ci};
20438c2ecf20Sopenharmony_ci
20448c2ecf20Sopenharmony_ci/**
20458c2ecf20Sopenharmony_ci * struct ionic_qos_clear_port_stats_cmd - Qos config reset command
20468c2ecf20Sopenharmony_ci * @opcode:	Opcode
20478c2ecf20Sopenharmony_ci */
20488c2ecf20Sopenharmony_cistruct ionic_qos_clear_stats_cmd {
20498c2ecf20Sopenharmony_ci	u8    opcode;
20508c2ecf20Sopenharmony_ci	u8    group_bitmap;
20518c2ecf20Sopenharmony_ci	u8    rsvd[62];
20528c2ecf20Sopenharmony_ci};
20538c2ecf20Sopenharmony_ci
20548c2ecf20Sopenharmony_citypedef struct ionic_admin_comp ionic_qos_reset_comp;
20558c2ecf20Sopenharmony_ci
20568c2ecf20Sopenharmony_ci/**
20578c2ecf20Sopenharmony_ci * struct ionic_fw_download_cmd - Firmware download command
20588c2ecf20Sopenharmony_ci * @opcode:	opcode
20598c2ecf20Sopenharmony_ci * @addr:	dma address of the firmware buffer
20608c2ecf20Sopenharmony_ci * @offset:	offset of the firmware buffer within the full image
20618c2ecf20Sopenharmony_ci * @length:	number of valid bytes in the firmware buffer
20628c2ecf20Sopenharmony_ci */
20638c2ecf20Sopenharmony_cistruct ionic_fw_download_cmd {
20648c2ecf20Sopenharmony_ci	u8     opcode;
20658c2ecf20Sopenharmony_ci	u8     rsvd[3];
20668c2ecf20Sopenharmony_ci	__le32 offset;
20678c2ecf20Sopenharmony_ci	__le64 addr;
20688c2ecf20Sopenharmony_ci	__le32 length;
20698c2ecf20Sopenharmony_ci};
20708c2ecf20Sopenharmony_ci
20718c2ecf20Sopenharmony_citypedef struct ionic_admin_comp ionic_fw_download_comp;
20728c2ecf20Sopenharmony_ci
20738c2ecf20Sopenharmony_ci/**
20748c2ecf20Sopenharmony_ci * enum ionic_fw_control_oper - FW control operations
20758c2ecf20Sopenharmony_ci * @IONIC_FW_RESET:		Reset firmware
20768c2ecf20Sopenharmony_ci * @IONIC_FW_INSTALL:		Install firmware
20778c2ecf20Sopenharmony_ci * @IONIC_FW_ACTIVATE:		Activate firmware
20788c2ecf20Sopenharmony_ci * @IONIC_FW_INSTALL_ASYNC:	Install firmware asynchronously
20798c2ecf20Sopenharmony_ci * @IONIC_FW_INSTALL_STATUS:	Firmware installation status
20808c2ecf20Sopenharmony_ci * @IONIC_FW_ACTIVATE_ASYNC:	Activate firmware asynchronously
20818c2ecf20Sopenharmony_ci * @IONIC_FW_ACTIVATE_STATUS:	Firmware activate status
20828c2ecf20Sopenharmony_ci */
20838c2ecf20Sopenharmony_cienum ionic_fw_control_oper {
20848c2ecf20Sopenharmony_ci	IONIC_FW_RESET			= 0,
20858c2ecf20Sopenharmony_ci	IONIC_FW_INSTALL		= 1,
20868c2ecf20Sopenharmony_ci	IONIC_FW_ACTIVATE		= 2,
20878c2ecf20Sopenharmony_ci	IONIC_FW_INSTALL_ASYNC		= 3,
20888c2ecf20Sopenharmony_ci	IONIC_FW_INSTALL_STATUS		= 4,
20898c2ecf20Sopenharmony_ci	IONIC_FW_ACTIVATE_ASYNC		= 5,
20908c2ecf20Sopenharmony_ci	IONIC_FW_ACTIVATE_STATUS	= 6,
20918c2ecf20Sopenharmony_ci	IONIC_FW_UPDATE_CLEANUP		= 7,
20928c2ecf20Sopenharmony_ci};
20938c2ecf20Sopenharmony_ci
20948c2ecf20Sopenharmony_ci/**
20958c2ecf20Sopenharmony_ci * struct ionic_fw_control_cmd - Firmware control command
20968c2ecf20Sopenharmony_ci * @opcode:    opcode
20978c2ecf20Sopenharmony_ci * @oper:      firmware control operation (enum ionic_fw_control_oper)
20988c2ecf20Sopenharmony_ci * @slot:      slot to activate
20998c2ecf20Sopenharmony_ci */
21008c2ecf20Sopenharmony_cistruct ionic_fw_control_cmd {
21018c2ecf20Sopenharmony_ci	u8  opcode;
21028c2ecf20Sopenharmony_ci	u8  rsvd[3];
21038c2ecf20Sopenharmony_ci	u8  oper;
21048c2ecf20Sopenharmony_ci	u8  slot;
21058c2ecf20Sopenharmony_ci	u8  rsvd1[58];
21068c2ecf20Sopenharmony_ci};
21078c2ecf20Sopenharmony_ci
21088c2ecf20Sopenharmony_ci/**
21098c2ecf20Sopenharmony_ci * struct ionic_fw_control_comp - Firmware control copletion
21108c2ecf20Sopenharmony_ci * @status:     Status of the command (enum ionic_status_code)
21118c2ecf20Sopenharmony_ci * @comp_index: Index in the descriptor ring for which this is the completion
21128c2ecf20Sopenharmony_ci * @slot:       Slot where the firmware was installed
21138c2ecf20Sopenharmony_ci * @color:      Color bit
21148c2ecf20Sopenharmony_ci */
21158c2ecf20Sopenharmony_cistruct ionic_fw_control_comp {
21168c2ecf20Sopenharmony_ci	u8     status;
21178c2ecf20Sopenharmony_ci	u8     rsvd;
21188c2ecf20Sopenharmony_ci	__le16 comp_index;
21198c2ecf20Sopenharmony_ci	u8     slot;
21208c2ecf20Sopenharmony_ci	u8     rsvd1[10];
21218c2ecf20Sopenharmony_ci	u8     color;
21228c2ecf20Sopenharmony_ci};
21238c2ecf20Sopenharmony_ci
21248c2ecf20Sopenharmony_ci/******************************************************************
21258c2ecf20Sopenharmony_ci ******************* RDMA Commands ********************************
21268c2ecf20Sopenharmony_ci ******************************************************************/
21278c2ecf20Sopenharmony_ci
21288c2ecf20Sopenharmony_ci/**
21298c2ecf20Sopenharmony_ci * struct ionic_rdma_reset_cmd - Reset RDMA LIF cmd
21308c2ecf20Sopenharmony_ci * @opcode:        opcode
21318c2ecf20Sopenharmony_ci * @lif_index:     LIF index
21328c2ecf20Sopenharmony_ci *
21338c2ecf20Sopenharmony_ci * There is no RDMA specific dev command completion struct.  Completion uses
21348c2ecf20Sopenharmony_ci * the common struct ionic_admin_comp.  Only the status is indicated.
21358c2ecf20Sopenharmony_ci * Nonzero status means the LIF does not support RDMA.
21368c2ecf20Sopenharmony_ci **/
21378c2ecf20Sopenharmony_cistruct ionic_rdma_reset_cmd {
21388c2ecf20Sopenharmony_ci	u8     opcode;
21398c2ecf20Sopenharmony_ci	u8     rsvd;
21408c2ecf20Sopenharmony_ci	__le16 lif_index;
21418c2ecf20Sopenharmony_ci	u8     rsvd2[60];
21428c2ecf20Sopenharmony_ci};
21438c2ecf20Sopenharmony_ci
21448c2ecf20Sopenharmony_ci/**
21458c2ecf20Sopenharmony_ci * struct ionic_rdma_queue_cmd - Create RDMA Queue command
21468c2ecf20Sopenharmony_ci * @opcode:        opcode, 52, 53
21478c2ecf20Sopenharmony_ci * @lif_index:     LIF index
21488c2ecf20Sopenharmony_ci * @qid_ver:       (qid | (RDMA version << 24))
21498c2ecf20Sopenharmony_ci * @cid:           intr, eq_id, or cq_id
21508c2ecf20Sopenharmony_ci * @dbid:          doorbell page id
21518c2ecf20Sopenharmony_ci * @depth_log2:    log base two of queue depth
21528c2ecf20Sopenharmony_ci * @stride_log2:   log base two of queue stride
21538c2ecf20Sopenharmony_ci * @dma_addr:      address of the queue memory
21548c2ecf20Sopenharmony_ci *
21558c2ecf20Sopenharmony_ci * The same command struct is used to create an RDMA event queue, completion
21568c2ecf20Sopenharmony_ci * queue, or RDMA admin queue.  The cid is an interrupt number for an event
21578c2ecf20Sopenharmony_ci * queue, an event queue id for a completion queue, or a completion queue id
21588c2ecf20Sopenharmony_ci * for an RDMA admin queue.
21598c2ecf20Sopenharmony_ci *
21608c2ecf20Sopenharmony_ci * The queue created via a dev command must be contiguous in dma space.
21618c2ecf20Sopenharmony_ci *
21628c2ecf20Sopenharmony_ci * The dev commands are intended only to be used during driver initialization,
21638c2ecf20Sopenharmony_ci * to create queues supporting the RDMA admin queue.  Other queues, and other
21648c2ecf20Sopenharmony_ci * types of RDMA resources like memory regions, will be created and registered
21658c2ecf20Sopenharmony_ci * via the RDMA admin queue, and will support a more complete interface
21668c2ecf20Sopenharmony_ci * providing scatter gather lists for larger, scattered queue buffers and
21678c2ecf20Sopenharmony_ci * memory registration.
21688c2ecf20Sopenharmony_ci *
21698c2ecf20Sopenharmony_ci * There is no RDMA specific dev command completion struct.  Completion uses
21708c2ecf20Sopenharmony_ci * the common struct ionic_admin_comp.  Only the status is indicated.
21718c2ecf20Sopenharmony_ci **/
21728c2ecf20Sopenharmony_cistruct ionic_rdma_queue_cmd {
21738c2ecf20Sopenharmony_ci	u8     opcode;
21748c2ecf20Sopenharmony_ci	u8     rsvd;
21758c2ecf20Sopenharmony_ci	__le16 lif_index;
21768c2ecf20Sopenharmony_ci	__le32 qid_ver;
21778c2ecf20Sopenharmony_ci	__le32 cid;
21788c2ecf20Sopenharmony_ci	__le16 dbid;
21798c2ecf20Sopenharmony_ci	u8     depth_log2;
21808c2ecf20Sopenharmony_ci	u8     stride_log2;
21818c2ecf20Sopenharmony_ci	__le64 dma_addr;
21828c2ecf20Sopenharmony_ci	u8     rsvd2[40];
21838c2ecf20Sopenharmony_ci};
21848c2ecf20Sopenharmony_ci
21858c2ecf20Sopenharmony_ci/******************************************************************
21868c2ecf20Sopenharmony_ci ******************* Notify Events ********************************
21878c2ecf20Sopenharmony_ci ******************************************************************/
21888c2ecf20Sopenharmony_ci
21898c2ecf20Sopenharmony_ci/**
21908c2ecf20Sopenharmony_ci * struct ionic_notifyq_event - Generic event reporting structure
21918c2ecf20Sopenharmony_ci * @eid:   event number
21928c2ecf20Sopenharmony_ci * @ecode: event code
21938c2ecf20Sopenharmony_ci * @data:  unspecified data about the event
21948c2ecf20Sopenharmony_ci *
21958c2ecf20Sopenharmony_ci * This is the generic event report struct from which the other
21968c2ecf20Sopenharmony_ci * actual events will be formed.
21978c2ecf20Sopenharmony_ci */
21988c2ecf20Sopenharmony_cistruct ionic_notifyq_event {
21998c2ecf20Sopenharmony_ci	__le64 eid;
22008c2ecf20Sopenharmony_ci	__le16 ecode;
22018c2ecf20Sopenharmony_ci	u8     data[54];
22028c2ecf20Sopenharmony_ci};
22038c2ecf20Sopenharmony_ci
22048c2ecf20Sopenharmony_ci/**
22058c2ecf20Sopenharmony_ci * struct ionic_link_change_event - Link change event notification
22068c2ecf20Sopenharmony_ci * @eid:		event number
22078c2ecf20Sopenharmony_ci * @ecode:		event code = IONIC_EVENT_LINK_CHANGE
22088c2ecf20Sopenharmony_ci * @link_status:	link up/down, with error bits (enum ionic_port_status)
22098c2ecf20Sopenharmony_ci * @link_speed:		speed of the network link
22108c2ecf20Sopenharmony_ci *
22118c2ecf20Sopenharmony_ci * Sent when the network link state changes between UP and DOWN
22128c2ecf20Sopenharmony_ci */
22138c2ecf20Sopenharmony_cistruct ionic_link_change_event {
22148c2ecf20Sopenharmony_ci	__le64 eid;
22158c2ecf20Sopenharmony_ci	__le16 ecode;
22168c2ecf20Sopenharmony_ci	__le16 link_status;
22178c2ecf20Sopenharmony_ci	__le32 link_speed;	/* units of 1Mbps: e.g. 10000 = 10Gbps */
22188c2ecf20Sopenharmony_ci	u8     rsvd[48];
22198c2ecf20Sopenharmony_ci};
22208c2ecf20Sopenharmony_ci
22218c2ecf20Sopenharmony_ci/**
22228c2ecf20Sopenharmony_ci * struct ionic_reset_event - Reset event notification
22238c2ecf20Sopenharmony_ci * @eid:		event number
22248c2ecf20Sopenharmony_ci * @ecode:		event code = IONIC_EVENT_RESET
22258c2ecf20Sopenharmony_ci * @reset_code:		reset type
22268c2ecf20Sopenharmony_ci * @state:		0=pending, 1=complete, 2=error
22278c2ecf20Sopenharmony_ci *
22288c2ecf20Sopenharmony_ci * Sent when the NIC or some subsystem is going to be or
22298c2ecf20Sopenharmony_ci * has been reset.
22308c2ecf20Sopenharmony_ci */
22318c2ecf20Sopenharmony_cistruct ionic_reset_event {
22328c2ecf20Sopenharmony_ci	__le64 eid;
22338c2ecf20Sopenharmony_ci	__le16 ecode;
22348c2ecf20Sopenharmony_ci	u8     reset_code;
22358c2ecf20Sopenharmony_ci	u8     state;
22368c2ecf20Sopenharmony_ci	u8     rsvd[52];
22378c2ecf20Sopenharmony_ci};
22388c2ecf20Sopenharmony_ci
22398c2ecf20Sopenharmony_ci/**
22408c2ecf20Sopenharmony_ci * struct ionic_heartbeat_event - Sent periodically by NIC to indicate health
22418c2ecf20Sopenharmony_ci * @eid:	event number
22428c2ecf20Sopenharmony_ci * @ecode:	event code = IONIC_EVENT_HEARTBEAT
22438c2ecf20Sopenharmony_ci */
22448c2ecf20Sopenharmony_cistruct ionic_heartbeat_event {
22458c2ecf20Sopenharmony_ci	__le64 eid;
22468c2ecf20Sopenharmony_ci	__le16 ecode;
22478c2ecf20Sopenharmony_ci	u8     rsvd[54];
22488c2ecf20Sopenharmony_ci};
22498c2ecf20Sopenharmony_ci
22508c2ecf20Sopenharmony_ci/**
22518c2ecf20Sopenharmony_ci * struct ionic_log_event - Sent to notify the driver of an internal error
22528c2ecf20Sopenharmony_ci * @eid:	event number
22538c2ecf20Sopenharmony_ci * @ecode:	event code = IONIC_EVENT_LOG
22548c2ecf20Sopenharmony_ci * @data:	log data
22558c2ecf20Sopenharmony_ci */
22568c2ecf20Sopenharmony_cistruct ionic_log_event {
22578c2ecf20Sopenharmony_ci	__le64 eid;
22588c2ecf20Sopenharmony_ci	__le16 ecode;
22598c2ecf20Sopenharmony_ci	u8     data[54];
22608c2ecf20Sopenharmony_ci};
22618c2ecf20Sopenharmony_ci
22628c2ecf20Sopenharmony_ci/**
22638c2ecf20Sopenharmony_ci * struct ionic_xcvr_event - Transceiver change event
22648c2ecf20Sopenharmony_ci * @eid:	event number
22658c2ecf20Sopenharmony_ci * @ecode:	event code = IONIC_EVENT_XCVR
22668c2ecf20Sopenharmony_ci */
22678c2ecf20Sopenharmony_cistruct ionic_xcvr_event {
22688c2ecf20Sopenharmony_ci	__le64 eid;
22698c2ecf20Sopenharmony_ci	__le16 ecode;
22708c2ecf20Sopenharmony_ci	u8     rsvd[54];
22718c2ecf20Sopenharmony_ci};
22728c2ecf20Sopenharmony_ci
22738c2ecf20Sopenharmony_ci/**
22748c2ecf20Sopenharmony_ci * struct ionic_port_stats - Port statistics structure
22758c2ecf20Sopenharmony_ci */
22768c2ecf20Sopenharmony_cistruct ionic_port_stats {
22778c2ecf20Sopenharmony_ci	__le64 frames_rx_ok;
22788c2ecf20Sopenharmony_ci	__le64 frames_rx_all;
22798c2ecf20Sopenharmony_ci	__le64 frames_rx_bad_fcs;
22808c2ecf20Sopenharmony_ci	__le64 frames_rx_bad_all;
22818c2ecf20Sopenharmony_ci	__le64 octets_rx_ok;
22828c2ecf20Sopenharmony_ci	__le64 octets_rx_all;
22838c2ecf20Sopenharmony_ci	__le64 frames_rx_unicast;
22848c2ecf20Sopenharmony_ci	__le64 frames_rx_multicast;
22858c2ecf20Sopenharmony_ci	__le64 frames_rx_broadcast;
22868c2ecf20Sopenharmony_ci	__le64 frames_rx_pause;
22878c2ecf20Sopenharmony_ci	__le64 frames_rx_bad_length;
22888c2ecf20Sopenharmony_ci	__le64 frames_rx_undersized;
22898c2ecf20Sopenharmony_ci	__le64 frames_rx_oversized;
22908c2ecf20Sopenharmony_ci	__le64 frames_rx_fragments;
22918c2ecf20Sopenharmony_ci	__le64 frames_rx_jabber;
22928c2ecf20Sopenharmony_ci	__le64 frames_rx_pripause;
22938c2ecf20Sopenharmony_ci	__le64 frames_rx_stomped_crc;
22948c2ecf20Sopenharmony_ci	__le64 frames_rx_too_long;
22958c2ecf20Sopenharmony_ci	__le64 frames_rx_vlan_good;
22968c2ecf20Sopenharmony_ci	__le64 frames_rx_dropped;
22978c2ecf20Sopenharmony_ci	__le64 frames_rx_less_than_64b;
22988c2ecf20Sopenharmony_ci	__le64 frames_rx_64b;
22998c2ecf20Sopenharmony_ci	__le64 frames_rx_65b_127b;
23008c2ecf20Sopenharmony_ci	__le64 frames_rx_128b_255b;
23018c2ecf20Sopenharmony_ci	__le64 frames_rx_256b_511b;
23028c2ecf20Sopenharmony_ci	__le64 frames_rx_512b_1023b;
23038c2ecf20Sopenharmony_ci	__le64 frames_rx_1024b_1518b;
23048c2ecf20Sopenharmony_ci	__le64 frames_rx_1519b_2047b;
23058c2ecf20Sopenharmony_ci	__le64 frames_rx_2048b_4095b;
23068c2ecf20Sopenharmony_ci	__le64 frames_rx_4096b_8191b;
23078c2ecf20Sopenharmony_ci	__le64 frames_rx_8192b_9215b;
23088c2ecf20Sopenharmony_ci	__le64 frames_rx_other;
23098c2ecf20Sopenharmony_ci	__le64 frames_tx_ok;
23108c2ecf20Sopenharmony_ci	__le64 frames_tx_all;
23118c2ecf20Sopenharmony_ci	__le64 frames_tx_bad;
23128c2ecf20Sopenharmony_ci	__le64 octets_tx_ok;
23138c2ecf20Sopenharmony_ci	__le64 octets_tx_total;
23148c2ecf20Sopenharmony_ci	__le64 frames_tx_unicast;
23158c2ecf20Sopenharmony_ci	__le64 frames_tx_multicast;
23168c2ecf20Sopenharmony_ci	__le64 frames_tx_broadcast;
23178c2ecf20Sopenharmony_ci	__le64 frames_tx_pause;
23188c2ecf20Sopenharmony_ci	__le64 frames_tx_pripause;
23198c2ecf20Sopenharmony_ci	__le64 frames_tx_vlan;
23208c2ecf20Sopenharmony_ci	__le64 frames_tx_less_than_64b;
23218c2ecf20Sopenharmony_ci	__le64 frames_tx_64b;
23228c2ecf20Sopenharmony_ci	__le64 frames_tx_65b_127b;
23238c2ecf20Sopenharmony_ci	__le64 frames_tx_128b_255b;
23248c2ecf20Sopenharmony_ci	__le64 frames_tx_256b_511b;
23258c2ecf20Sopenharmony_ci	__le64 frames_tx_512b_1023b;
23268c2ecf20Sopenharmony_ci	__le64 frames_tx_1024b_1518b;
23278c2ecf20Sopenharmony_ci	__le64 frames_tx_1519b_2047b;
23288c2ecf20Sopenharmony_ci	__le64 frames_tx_2048b_4095b;
23298c2ecf20Sopenharmony_ci	__le64 frames_tx_4096b_8191b;
23308c2ecf20Sopenharmony_ci	__le64 frames_tx_8192b_9215b;
23318c2ecf20Sopenharmony_ci	__le64 frames_tx_other;
23328c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_0;
23338c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_1;
23348c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_2;
23358c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_3;
23368c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_4;
23378c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_5;
23388c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_6;
23398c2ecf20Sopenharmony_ci	__le64 frames_tx_pri_7;
23408c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_0;
23418c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_1;
23428c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_2;
23438c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_3;
23448c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_4;
23458c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_5;
23468c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_6;
23478c2ecf20Sopenharmony_ci	__le64 frames_rx_pri_7;
23488c2ecf20Sopenharmony_ci	__le64 tx_pripause_0_1us_count;
23498c2ecf20Sopenharmony_ci	__le64 tx_pripause_1_1us_count;
23508c2ecf20Sopenharmony_ci	__le64 tx_pripause_2_1us_count;
23518c2ecf20Sopenharmony_ci	__le64 tx_pripause_3_1us_count;
23528c2ecf20Sopenharmony_ci	__le64 tx_pripause_4_1us_count;
23538c2ecf20Sopenharmony_ci	__le64 tx_pripause_5_1us_count;
23548c2ecf20Sopenharmony_ci	__le64 tx_pripause_6_1us_count;
23558c2ecf20Sopenharmony_ci	__le64 tx_pripause_7_1us_count;
23568c2ecf20Sopenharmony_ci	__le64 rx_pripause_0_1us_count;
23578c2ecf20Sopenharmony_ci	__le64 rx_pripause_1_1us_count;
23588c2ecf20Sopenharmony_ci	__le64 rx_pripause_2_1us_count;
23598c2ecf20Sopenharmony_ci	__le64 rx_pripause_3_1us_count;
23608c2ecf20Sopenharmony_ci	__le64 rx_pripause_4_1us_count;
23618c2ecf20Sopenharmony_ci	__le64 rx_pripause_5_1us_count;
23628c2ecf20Sopenharmony_ci	__le64 rx_pripause_6_1us_count;
23638c2ecf20Sopenharmony_ci	__le64 rx_pripause_7_1us_count;
23648c2ecf20Sopenharmony_ci	__le64 rx_pause_1us_count;
23658c2ecf20Sopenharmony_ci	__le64 frames_tx_truncated;
23668c2ecf20Sopenharmony_ci};
23678c2ecf20Sopenharmony_ci
23688c2ecf20Sopenharmony_cistruct ionic_mgmt_port_stats {
23698c2ecf20Sopenharmony_ci	__le64 frames_rx_ok;
23708c2ecf20Sopenharmony_ci	__le64 frames_rx_all;
23718c2ecf20Sopenharmony_ci	__le64 frames_rx_bad_fcs;
23728c2ecf20Sopenharmony_ci	__le64 frames_rx_bad_all;
23738c2ecf20Sopenharmony_ci	__le64 octets_rx_ok;
23748c2ecf20Sopenharmony_ci	__le64 octets_rx_all;
23758c2ecf20Sopenharmony_ci	__le64 frames_rx_unicast;
23768c2ecf20Sopenharmony_ci	__le64 frames_rx_multicast;
23778c2ecf20Sopenharmony_ci	__le64 frames_rx_broadcast;
23788c2ecf20Sopenharmony_ci	__le64 frames_rx_pause;
23798c2ecf20Sopenharmony_ci	__le64 frames_rx_bad_length;
23808c2ecf20Sopenharmony_ci	__le64 frames_rx_undersized;
23818c2ecf20Sopenharmony_ci	__le64 frames_rx_oversized;
23828c2ecf20Sopenharmony_ci	__le64 frames_rx_fragments;
23838c2ecf20Sopenharmony_ci	__le64 frames_rx_jabber;
23848c2ecf20Sopenharmony_ci	__le64 frames_rx_64b;
23858c2ecf20Sopenharmony_ci	__le64 frames_rx_65b_127b;
23868c2ecf20Sopenharmony_ci	__le64 frames_rx_128b_255b;
23878c2ecf20Sopenharmony_ci	__le64 frames_rx_256b_511b;
23888c2ecf20Sopenharmony_ci	__le64 frames_rx_512b_1023b;
23898c2ecf20Sopenharmony_ci	__le64 frames_rx_1024b_1518b;
23908c2ecf20Sopenharmony_ci	__le64 frames_rx_gt_1518b;
23918c2ecf20Sopenharmony_ci	__le64 frames_rx_fifo_full;
23928c2ecf20Sopenharmony_ci	__le64 frames_tx_ok;
23938c2ecf20Sopenharmony_ci	__le64 frames_tx_all;
23948c2ecf20Sopenharmony_ci	__le64 frames_tx_bad;
23958c2ecf20Sopenharmony_ci	__le64 octets_tx_ok;
23968c2ecf20Sopenharmony_ci	__le64 octets_tx_total;
23978c2ecf20Sopenharmony_ci	__le64 frames_tx_unicast;
23988c2ecf20Sopenharmony_ci	__le64 frames_tx_multicast;
23998c2ecf20Sopenharmony_ci	__le64 frames_tx_broadcast;
24008c2ecf20Sopenharmony_ci	__le64 frames_tx_pause;
24018c2ecf20Sopenharmony_ci};
24028c2ecf20Sopenharmony_ci
24038c2ecf20Sopenharmony_cienum ionic_pb_buffer_drop_stats {
24048c2ecf20Sopenharmony_ci	IONIC_BUFFER_INTRINSIC_DROP = 0,
24058c2ecf20Sopenharmony_ci	IONIC_BUFFER_DISCARDED,
24068c2ecf20Sopenharmony_ci	IONIC_BUFFER_ADMITTED,
24078c2ecf20Sopenharmony_ci	IONIC_BUFFER_OUT_OF_CELLS_DROP,
24088c2ecf20Sopenharmony_ci	IONIC_BUFFER_OUT_OF_CELLS_DROP_2,
24098c2ecf20Sopenharmony_ci	IONIC_BUFFER_OUT_OF_CREDIT_DROP,
24108c2ecf20Sopenharmony_ci	IONIC_BUFFER_TRUNCATION_DROP,
24118c2ecf20Sopenharmony_ci	IONIC_BUFFER_PORT_DISABLED_DROP,
24128c2ecf20Sopenharmony_ci	IONIC_BUFFER_COPY_TO_CPU_TAIL_DROP,
24138c2ecf20Sopenharmony_ci	IONIC_BUFFER_SPAN_TAIL_DROP,
24148c2ecf20Sopenharmony_ci	IONIC_BUFFER_MIN_SIZE_VIOLATION_DROP,
24158c2ecf20Sopenharmony_ci	IONIC_BUFFER_ENQUEUE_ERROR_DROP,
24168c2ecf20Sopenharmony_ci	IONIC_BUFFER_INVALID_PORT_DROP,
24178c2ecf20Sopenharmony_ci	IONIC_BUFFER_INVALID_OUTPUT_QUEUE_DROP,
24188c2ecf20Sopenharmony_ci	IONIC_BUFFER_DROP_MAX,
24198c2ecf20Sopenharmony_ci};
24208c2ecf20Sopenharmony_ci
24218c2ecf20Sopenharmony_cienum ionic_oflow_drop_stats {
24228c2ecf20Sopenharmony_ci	IONIC_OFLOW_OCCUPANCY_DROP,
24238c2ecf20Sopenharmony_ci	IONIC_OFLOW_EMERGENCY_STOP_DROP,
24248c2ecf20Sopenharmony_ci	IONIC_OFLOW_WRITE_BUFFER_ACK_FILL_UP_DROP,
24258c2ecf20Sopenharmony_ci	IONIC_OFLOW_WRITE_BUFFER_ACK_FULL_DROP,
24268c2ecf20Sopenharmony_ci	IONIC_OFLOW_WRITE_BUFFER_FULL_DROP,
24278c2ecf20Sopenharmony_ci	IONIC_OFLOW_CONTROL_FIFO_FULL_DROP,
24288c2ecf20Sopenharmony_ci	IONIC_OFLOW_DROP_MAX,
24298c2ecf20Sopenharmony_ci};
24308c2ecf20Sopenharmony_ci
24318c2ecf20Sopenharmony_ci/**
24328c2ecf20Sopenharmony_ci * struct port_pb_stats - packet buffers system stats
24338c2ecf20Sopenharmony_ci * uses ionic_pb_buffer_drop_stats for drop_counts[]
24348c2ecf20Sopenharmony_ci */
24358c2ecf20Sopenharmony_cistruct ionic_port_pb_stats {
24368c2ecf20Sopenharmony_ci	__le64 sop_count_in;
24378c2ecf20Sopenharmony_ci	__le64 eop_count_in;
24388c2ecf20Sopenharmony_ci	__le64 sop_count_out;
24398c2ecf20Sopenharmony_ci	__le64 eop_count_out;
24408c2ecf20Sopenharmony_ci	__le64 drop_counts[IONIC_BUFFER_DROP_MAX];
24418c2ecf20Sopenharmony_ci	__le64 input_queue_buffer_occupancy[IONIC_QOS_TC_MAX];
24428c2ecf20Sopenharmony_ci	__le64 input_queue_port_monitor[IONIC_QOS_TC_MAX];
24438c2ecf20Sopenharmony_ci	__le64 output_queue_port_monitor[IONIC_QOS_TC_MAX];
24448c2ecf20Sopenharmony_ci	__le64 oflow_drop_counts[IONIC_OFLOW_DROP_MAX];
24458c2ecf20Sopenharmony_ci	__le64 input_queue_good_pkts_in[IONIC_QOS_TC_MAX];
24468c2ecf20Sopenharmony_ci	__le64 input_queue_good_pkts_out[IONIC_QOS_TC_MAX];
24478c2ecf20Sopenharmony_ci	__le64 input_queue_err_pkts_in[IONIC_QOS_TC_MAX];
24488c2ecf20Sopenharmony_ci	__le64 input_queue_fifo_depth[IONIC_QOS_TC_MAX];
24498c2ecf20Sopenharmony_ci	__le64 input_queue_max_fifo_depth[IONIC_QOS_TC_MAX];
24508c2ecf20Sopenharmony_ci	__le64 input_queue_peak_occupancy[IONIC_QOS_TC_MAX];
24518c2ecf20Sopenharmony_ci	__le64 output_queue_buffer_occupancy[IONIC_QOS_TC_MAX];
24528c2ecf20Sopenharmony_ci};
24538c2ecf20Sopenharmony_ci
24548c2ecf20Sopenharmony_ci/**
24558c2ecf20Sopenharmony_ci * struct ionic_port_identity - port identity structure
24568c2ecf20Sopenharmony_ci * @version:        identity structure version
24578c2ecf20Sopenharmony_ci * @type:           type of port (enum ionic_port_type)
24588c2ecf20Sopenharmony_ci * @num_lanes:      number of lanes for the port
24598c2ecf20Sopenharmony_ci * @autoneg:        autoneg supported
24608c2ecf20Sopenharmony_ci * @min_frame_size: minimum frame size supported
24618c2ecf20Sopenharmony_ci * @max_frame_size: maximum frame size supported
24628c2ecf20Sopenharmony_ci * @fec_type:       supported fec types
24638c2ecf20Sopenharmony_ci * @pause_type:     supported pause types
24648c2ecf20Sopenharmony_ci * @loopback_mode:  supported loopback mode
24658c2ecf20Sopenharmony_ci * @speeds:         supported speeds
24668c2ecf20Sopenharmony_ci * @config:         current port configuration
24678c2ecf20Sopenharmony_ci */
24688c2ecf20Sopenharmony_ciunion ionic_port_identity {
24698c2ecf20Sopenharmony_ci	struct {
24708c2ecf20Sopenharmony_ci		u8     version;
24718c2ecf20Sopenharmony_ci		u8     type;
24728c2ecf20Sopenharmony_ci		u8     num_lanes;
24738c2ecf20Sopenharmony_ci		u8     autoneg;
24748c2ecf20Sopenharmony_ci		__le32 min_frame_size;
24758c2ecf20Sopenharmony_ci		__le32 max_frame_size;
24768c2ecf20Sopenharmony_ci		u8     fec_type[4];
24778c2ecf20Sopenharmony_ci		u8     pause_type[2];
24788c2ecf20Sopenharmony_ci		u8     loopback_mode[2];
24798c2ecf20Sopenharmony_ci		__le32 speeds[16];
24808c2ecf20Sopenharmony_ci		u8     rsvd2[44];
24818c2ecf20Sopenharmony_ci		union ionic_port_config config;
24828c2ecf20Sopenharmony_ci	};
24838c2ecf20Sopenharmony_ci	__le32 words[478];
24848c2ecf20Sopenharmony_ci};
24858c2ecf20Sopenharmony_ci
24868c2ecf20Sopenharmony_ci/**
24878c2ecf20Sopenharmony_ci * struct ionic_port_info - port info structure
24888c2ecf20Sopenharmony_ci * @config:          Port configuration data
24898c2ecf20Sopenharmony_ci * @status:          Port status data
24908c2ecf20Sopenharmony_ci * @stats:           Port statistics data
24918c2ecf20Sopenharmony_ci * @mgmt_stats:      Port management statistics data
24928c2ecf20Sopenharmony_ci * @port_pb_drop_stats:   uplink pb drop stats
24938c2ecf20Sopenharmony_ci */
24948c2ecf20Sopenharmony_cistruct ionic_port_info {
24958c2ecf20Sopenharmony_ci	union ionic_port_config config;
24968c2ecf20Sopenharmony_ci	struct ionic_port_status status;
24978c2ecf20Sopenharmony_ci	union {
24988c2ecf20Sopenharmony_ci		struct ionic_port_stats      stats;
24998c2ecf20Sopenharmony_ci		struct ionic_mgmt_port_stats mgmt_stats;
25008c2ecf20Sopenharmony_ci	};
25018c2ecf20Sopenharmony_ci	/* room for pb_stats to start at 2k offset */
25028c2ecf20Sopenharmony_ci	u8                          rsvd[760];
25038c2ecf20Sopenharmony_ci	struct ionic_port_pb_stats  pb_stats;
25048c2ecf20Sopenharmony_ci};
25058c2ecf20Sopenharmony_ci
25068c2ecf20Sopenharmony_ci/**
25078c2ecf20Sopenharmony_ci * struct ionic_lif_stats - LIF statistics structure
25088c2ecf20Sopenharmony_ci */
25098c2ecf20Sopenharmony_cistruct ionic_lif_stats {
25108c2ecf20Sopenharmony_ci	/* RX */
25118c2ecf20Sopenharmony_ci	__le64 rx_ucast_bytes;
25128c2ecf20Sopenharmony_ci	__le64 rx_ucast_packets;
25138c2ecf20Sopenharmony_ci	__le64 rx_mcast_bytes;
25148c2ecf20Sopenharmony_ci	__le64 rx_mcast_packets;
25158c2ecf20Sopenharmony_ci	__le64 rx_bcast_bytes;
25168c2ecf20Sopenharmony_ci	__le64 rx_bcast_packets;
25178c2ecf20Sopenharmony_ci	__le64 rsvd0;
25188c2ecf20Sopenharmony_ci	__le64 rsvd1;
25198c2ecf20Sopenharmony_ci	/* RX drops */
25208c2ecf20Sopenharmony_ci	__le64 rx_ucast_drop_bytes;
25218c2ecf20Sopenharmony_ci	__le64 rx_ucast_drop_packets;
25228c2ecf20Sopenharmony_ci	__le64 rx_mcast_drop_bytes;
25238c2ecf20Sopenharmony_ci	__le64 rx_mcast_drop_packets;
25248c2ecf20Sopenharmony_ci	__le64 rx_bcast_drop_bytes;
25258c2ecf20Sopenharmony_ci	__le64 rx_bcast_drop_packets;
25268c2ecf20Sopenharmony_ci	__le64 rx_dma_error;
25278c2ecf20Sopenharmony_ci	__le64 rsvd2;
25288c2ecf20Sopenharmony_ci	/* TX */
25298c2ecf20Sopenharmony_ci	__le64 tx_ucast_bytes;
25308c2ecf20Sopenharmony_ci	__le64 tx_ucast_packets;
25318c2ecf20Sopenharmony_ci	__le64 tx_mcast_bytes;
25328c2ecf20Sopenharmony_ci	__le64 tx_mcast_packets;
25338c2ecf20Sopenharmony_ci	__le64 tx_bcast_bytes;
25348c2ecf20Sopenharmony_ci	__le64 tx_bcast_packets;
25358c2ecf20Sopenharmony_ci	__le64 rsvd3;
25368c2ecf20Sopenharmony_ci	__le64 rsvd4;
25378c2ecf20Sopenharmony_ci	/* TX drops */
25388c2ecf20Sopenharmony_ci	__le64 tx_ucast_drop_bytes;
25398c2ecf20Sopenharmony_ci	__le64 tx_ucast_drop_packets;
25408c2ecf20Sopenharmony_ci	__le64 tx_mcast_drop_bytes;
25418c2ecf20Sopenharmony_ci	__le64 tx_mcast_drop_packets;
25428c2ecf20Sopenharmony_ci	__le64 tx_bcast_drop_bytes;
25438c2ecf20Sopenharmony_ci	__le64 tx_bcast_drop_packets;
25448c2ecf20Sopenharmony_ci	__le64 tx_dma_error;
25458c2ecf20Sopenharmony_ci	__le64 rsvd5;
25468c2ecf20Sopenharmony_ci	/* Rx Queue/Ring drops */
25478c2ecf20Sopenharmony_ci	__le64 rx_queue_disabled;
25488c2ecf20Sopenharmony_ci	__le64 rx_queue_empty;
25498c2ecf20Sopenharmony_ci	__le64 rx_queue_error;
25508c2ecf20Sopenharmony_ci	__le64 rx_desc_fetch_error;
25518c2ecf20Sopenharmony_ci	__le64 rx_desc_data_error;
25528c2ecf20Sopenharmony_ci	__le64 rsvd6;
25538c2ecf20Sopenharmony_ci	__le64 rsvd7;
25548c2ecf20Sopenharmony_ci	__le64 rsvd8;
25558c2ecf20Sopenharmony_ci	/* Tx Queue/Ring drops */
25568c2ecf20Sopenharmony_ci	__le64 tx_queue_disabled;
25578c2ecf20Sopenharmony_ci	__le64 tx_queue_error;
25588c2ecf20Sopenharmony_ci	__le64 tx_desc_fetch_error;
25598c2ecf20Sopenharmony_ci	__le64 tx_desc_data_error;
25608c2ecf20Sopenharmony_ci	__le64 tx_queue_empty;
25618c2ecf20Sopenharmony_ci	__le64 rsvd10;
25628c2ecf20Sopenharmony_ci	__le64 rsvd11;
25638c2ecf20Sopenharmony_ci	__le64 rsvd12;
25648c2ecf20Sopenharmony_ci
25658c2ecf20Sopenharmony_ci	/* RDMA/ROCE TX */
25668c2ecf20Sopenharmony_ci	__le64 tx_rdma_ucast_bytes;
25678c2ecf20Sopenharmony_ci	__le64 tx_rdma_ucast_packets;
25688c2ecf20Sopenharmony_ci	__le64 tx_rdma_mcast_bytes;
25698c2ecf20Sopenharmony_ci	__le64 tx_rdma_mcast_packets;
25708c2ecf20Sopenharmony_ci	__le64 tx_rdma_cnp_packets;
25718c2ecf20Sopenharmony_ci	__le64 rsvd13;
25728c2ecf20Sopenharmony_ci	__le64 rsvd14;
25738c2ecf20Sopenharmony_ci	__le64 rsvd15;
25748c2ecf20Sopenharmony_ci
25758c2ecf20Sopenharmony_ci	/* RDMA/ROCE RX */
25768c2ecf20Sopenharmony_ci	__le64 rx_rdma_ucast_bytes;
25778c2ecf20Sopenharmony_ci	__le64 rx_rdma_ucast_packets;
25788c2ecf20Sopenharmony_ci	__le64 rx_rdma_mcast_bytes;
25798c2ecf20Sopenharmony_ci	__le64 rx_rdma_mcast_packets;
25808c2ecf20Sopenharmony_ci	__le64 rx_rdma_cnp_packets;
25818c2ecf20Sopenharmony_ci	__le64 rx_rdma_ecn_packets;
25828c2ecf20Sopenharmony_ci	__le64 rsvd16;
25838c2ecf20Sopenharmony_ci	__le64 rsvd17;
25848c2ecf20Sopenharmony_ci
25858c2ecf20Sopenharmony_ci	__le64 rsvd18;
25868c2ecf20Sopenharmony_ci	__le64 rsvd19;
25878c2ecf20Sopenharmony_ci	__le64 rsvd20;
25888c2ecf20Sopenharmony_ci	__le64 rsvd21;
25898c2ecf20Sopenharmony_ci	__le64 rsvd22;
25908c2ecf20Sopenharmony_ci	__le64 rsvd23;
25918c2ecf20Sopenharmony_ci	__le64 rsvd24;
25928c2ecf20Sopenharmony_ci	__le64 rsvd25;
25938c2ecf20Sopenharmony_ci
25948c2ecf20Sopenharmony_ci	__le64 rsvd26;
25958c2ecf20Sopenharmony_ci	__le64 rsvd27;
25968c2ecf20Sopenharmony_ci	__le64 rsvd28;
25978c2ecf20Sopenharmony_ci	__le64 rsvd29;
25988c2ecf20Sopenharmony_ci	__le64 rsvd30;
25998c2ecf20Sopenharmony_ci	__le64 rsvd31;
26008c2ecf20Sopenharmony_ci	__le64 rsvd32;
26018c2ecf20Sopenharmony_ci	__le64 rsvd33;
26028c2ecf20Sopenharmony_ci
26038c2ecf20Sopenharmony_ci	__le64 rsvd34;
26048c2ecf20Sopenharmony_ci	__le64 rsvd35;
26058c2ecf20Sopenharmony_ci	__le64 rsvd36;
26068c2ecf20Sopenharmony_ci	__le64 rsvd37;
26078c2ecf20Sopenharmony_ci	__le64 rsvd38;
26088c2ecf20Sopenharmony_ci	__le64 rsvd39;
26098c2ecf20Sopenharmony_ci	__le64 rsvd40;
26108c2ecf20Sopenharmony_ci	__le64 rsvd41;
26118c2ecf20Sopenharmony_ci
26128c2ecf20Sopenharmony_ci	__le64 rsvd42;
26138c2ecf20Sopenharmony_ci	__le64 rsvd43;
26148c2ecf20Sopenharmony_ci	__le64 rsvd44;
26158c2ecf20Sopenharmony_ci	__le64 rsvd45;
26168c2ecf20Sopenharmony_ci	__le64 rsvd46;
26178c2ecf20Sopenharmony_ci	__le64 rsvd47;
26188c2ecf20Sopenharmony_ci	__le64 rsvd48;
26198c2ecf20Sopenharmony_ci	__le64 rsvd49;
26208c2ecf20Sopenharmony_ci
26218c2ecf20Sopenharmony_ci	/* RDMA/ROCE REQ Error/Debugs (768 - 895) */
26228c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_pkt_seq_err;
26238c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_rnr_retry_err;
26248c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_remote_access_err;
26258c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_remote_inv_req_err;
26268c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_remote_oper_err;
26278c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_implied_nak_seq_err;
26288c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_cqe_err;
26298c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_cqe_flush_err;
26308c2ecf20Sopenharmony_ci
26318c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_dup_responses;
26328c2ecf20Sopenharmony_ci	__le64 rdma_req_rx_invalid_packets;
26338c2ecf20Sopenharmony_ci	__le64 rdma_req_tx_local_access_err;
26348c2ecf20Sopenharmony_ci	__le64 rdma_req_tx_local_oper_err;
26358c2ecf20Sopenharmony_ci	__le64 rdma_req_tx_memory_mgmt_err;
26368c2ecf20Sopenharmony_ci	__le64 rsvd52;
26378c2ecf20Sopenharmony_ci	__le64 rsvd53;
26388c2ecf20Sopenharmony_ci	__le64 rsvd54;
26398c2ecf20Sopenharmony_ci
26408c2ecf20Sopenharmony_ci	/* RDMA/ROCE RESP Error/Debugs (896 - 1023) */
26418c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_dup_requests;
26428c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_out_of_buffer;
26438c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_out_of_seq_pkts;
26448c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_cqe_err;
26458c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_cqe_flush_err;
26468c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_local_len_err;
26478c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_inv_request_err;
26488c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_local_qp_oper_err;
26498c2ecf20Sopenharmony_ci
26508c2ecf20Sopenharmony_ci	__le64 rdma_resp_rx_out_of_atomic_resource;
26518c2ecf20Sopenharmony_ci	__le64 rdma_resp_tx_pkt_seq_err;
26528c2ecf20Sopenharmony_ci	__le64 rdma_resp_tx_remote_inv_req_err;
26538c2ecf20Sopenharmony_ci	__le64 rdma_resp_tx_remote_access_err;
26548c2ecf20Sopenharmony_ci	__le64 rdma_resp_tx_remote_oper_err;
26558c2ecf20Sopenharmony_ci	__le64 rdma_resp_tx_rnr_retry_err;
26568c2ecf20Sopenharmony_ci	__le64 rsvd57;
26578c2ecf20Sopenharmony_ci	__le64 rsvd58;
26588c2ecf20Sopenharmony_ci};
26598c2ecf20Sopenharmony_ci
26608c2ecf20Sopenharmony_ci/**
26618c2ecf20Sopenharmony_ci * struct ionic_lif_info - LIF info structure
26628c2ecf20Sopenharmony_ci * @config:	LIF configuration structure
26638c2ecf20Sopenharmony_ci * @status:	LIF status structure
26648c2ecf20Sopenharmony_ci * @stats:	LIF statistics structure
26658c2ecf20Sopenharmony_ci */
26668c2ecf20Sopenharmony_cistruct ionic_lif_info {
26678c2ecf20Sopenharmony_ci	union ionic_lif_config config;
26688c2ecf20Sopenharmony_ci	struct ionic_lif_status status;
26698c2ecf20Sopenharmony_ci	struct ionic_lif_stats stats;
26708c2ecf20Sopenharmony_ci};
26718c2ecf20Sopenharmony_ci
26728c2ecf20Sopenharmony_ciunion ionic_dev_cmd {
26738c2ecf20Sopenharmony_ci	u32 words[16];
26748c2ecf20Sopenharmony_ci	struct ionic_admin_cmd cmd;
26758c2ecf20Sopenharmony_ci	struct ionic_nop_cmd nop;
26768c2ecf20Sopenharmony_ci
26778c2ecf20Sopenharmony_ci	struct ionic_dev_identify_cmd identify;
26788c2ecf20Sopenharmony_ci	struct ionic_dev_init_cmd init;
26798c2ecf20Sopenharmony_ci	struct ionic_dev_reset_cmd reset;
26808c2ecf20Sopenharmony_ci	struct ionic_dev_getattr_cmd getattr;
26818c2ecf20Sopenharmony_ci	struct ionic_dev_setattr_cmd setattr;
26828c2ecf20Sopenharmony_ci
26838c2ecf20Sopenharmony_ci	struct ionic_port_identify_cmd port_identify;
26848c2ecf20Sopenharmony_ci	struct ionic_port_init_cmd port_init;
26858c2ecf20Sopenharmony_ci	struct ionic_port_reset_cmd port_reset;
26868c2ecf20Sopenharmony_ci	struct ionic_port_getattr_cmd port_getattr;
26878c2ecf20Sopenharmony_ci	struct ionic_port_setattr_cmd port_setattr;
26888c2ecf20Sopenharmony_ci
26898c2ecf20Sopenharmony_ci	struct ionic_vf_setattr_cmd vf_setattr;
26908c2ecf20Sopenharmony_ci	struct ionic_vf_getattr_cmd vf_getattr;
26918c2ecf20Sopenharmony_ci
26928c2ecf20Sopenharmony_ci	struct ionic_lif_identify_cmd lif_identify;
26938c2ecf20Sopenharmony_ci	struct ionic_lif_init_cmd lif_init;
26948c2ecf20Sopenharmony_ci	struct ionic_lif_reset_cmd lif_reset;
26958c2ecf20Sopenharmony_ci
26968c2ecf20Sopenharmony_ci	struct ionic_qos_identify_cmd qos_identify;
26978c2ecf20Sopenharmony_ci	struct ionic_qos_init_cmd qos_init;
26988c2ecf20Sopenharmony_ci	struct ionic_qos_reset_cmd qos_reset;
26998c2ecf20Sopenharmony_ci	struct ionic_qos_clear_stats_cmd qos_clear_stats;
27008c2ecf20Sopenharmony_ci
27018c2ecf20Sopenharmony_ci	struct ionic_q_identify_cmd q_identify;
27028c2ecf20Sopenharmony_ci	struct ionic_q_init_cmd q_init;
27038c2ecf20Sopenharmony_ci	struct ionic_q_control_cmd q_control;
27048c2ecf20Sopenharmony_ci
27058c2ecf20Sopenharmony_ci	struct ionic_fw_download_cmd fw_download;
27068c2ecf20Sopenharmony_ci	struct ionic_fw_control_cmd fw_control;
27078c2ecf20Sopenharmony_ci};
27088c2ecf20Sopenharmony_ci
27098c2ecf20Sopenharmony_ciunion ionic_dev_cmd_comp {
27108c2ecf20Sopenharmony_ci	u32 words[4];
27118c2ecf20Sopenharmony_ci	u8 status;
27128c2ecf20Sopenharmony_ci	struct ionic_admin_comp comp;
27138c2ecf20Sopenharmony_ci	struct ionic_nop_comp nop;
27148c2ecf20Sopenharmony_ci
27158c2ecf20Sopenharmony_ci	struct ionic_dev_identify_comp identify;
27168c2ecf20Sopenharmony_ci	struct ionic_dev_init_comp init;
27178c2ecf20Sopenharmony_ci	struct ionic_dev_reset_comp reset;
27188c2ecf20Sopenharmony_ci	struct ionic_dev_getattr_comp getattr;
27198c2ecf20Sopenharmony_ci	struct ionic_dev_setattr_comp setattr;
27208c2ecf20Sopenharmony_ci
27218c2ecf20Sopenharmony_ci	struct ionic_port_identify_comp port_identify;
27228c2ecf20Sopenharmony_ci	struct ionic_port_init_comp port_init;
27238c2ecf20Sopenharmony_ci	struct ionic_port_reset_comp port_reset;
27248c2ecf20Sopenharmony_ci	struct ionic_port_getattr_comp port_getattr;
27258c2ecf20Sopenharmony_ci	struct ionic_port_setattr_comp port_setattr;
27268c2ecf20Sopenharmony_ci
27278c2ecf20Sopenharmony_ci	struct ionic_vf_setattr_comp vf_setattr;
27288c2ecf20Sopenharmony_ci	struct ionic_vf_getattr_comp vf_getattr;
27298c2ecf20Sopenharmony_ci
27308c2ecf20Sopenharmony_ci	struct ionic_lif_identify_comp lif_identify;
27318c2ecf20Sopenharmony_ci	struct ionic_lif_init_comp lif_init;
27328c2ecf20Sopenharmony_ci	ionic_lif_reset_comp lif_reset;
27338c2ecf20Sopenharmony_ci
27348c2ecf20Sopenharmony_ci	struct ionic_qos_identify_comp qos_identify;
27358c2ecf20Sopenharmony_ci	ionic_qos_init_comp qos_init;
27368c2ecf20Sopenharmony_ci	ionic_qos_reset_comp qos_reset;
27378c2ecf20Sopenharmony_ci
27388c2ecf20Sopenharmony_ci	struct ionic_q_identify_comp q_identify;
27398c2ecf20Sopenharmony_ci	struct ionic_q_init_comp q_init;
27408c2ecf20Sopenharmony_ci
27418c2ecf20Sopenharmony_ci	ionic_fw_download_comp fw_download;
27428c2ecf20Sopenharmony_ci	struct ionic_fw_control_comp fw_control;
27438c2ecf20Sopenharmony_ci};
27448c2ecf20Sopenharmony_ci
27458c2ecf20Sopenharmony_ci/**
27468c2ecf20Sopenharmony_ci * union ionic_dev_info_regs - Device info register format (read-only)
27478c2ecf20Sopenharmony_ci * @signature:       Signature value of 0x44455649 ('DEVI')
27488c2ecf20Sopenharmony_ci * @version:         Current version of info
27498c2ecf20Sopenharmony_ci * @asic_type:       Asic type
27508c2ecf20Sopenharmony_ci * @asic_rev:        Asic revision
27518c2ecf20Sopenharmony_ci * @fw_status:       Firmware status
27528c2ecf20Sopenharmony_ci * @fw_heartbeat:    Firmware heartbeat counter
27538c2ecf20Sopenharmony_ci * @serial_num:      Serial number
27548c2ecf20Sopenharmony_ci * @fw_version:      Firmware version
27558c2ecf20Sopenharmony_ci */
27568c2ecf20Sopenharmony_ciunion ionic_dev_info_regs {
27578c2ecf20Sopenharmony_ci#define IONIC_DEVINFO_FWVERS_BUFLEN 32
27588c2ecf20Sopenharmony_ci#define IONIC_DEVINFO_SERIAL_BUFLEN 32
27598c2ecf20Sopenharmony_ci	struct {
27608c2ecf20Sopenharmony_ci		u32    signature;
27618c2ecf20Sopenharmony_ci		u8     version;
27628c2ecf20Sopenharmony_ci		u8     asic_type;
27638c2ecf20Sopenharmony_ci		u8     asic_rev;
27648c2ecf20Sopenharmony_ci#define IONIC_FW_STS_F_RUNNING	0x1
27658c2ecf20Sopenharmony_ci		u8     fw_status;
27668c2ecf20Sopenharmony_ci		u32    fw_heartbeat;
27678c2ecf20Sopenharmony_ci		char   fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
27688c2ecf20Sopenharmony_ci		char   serial_num[IONIC_DEVINFO_SERIAL_BUFLEN];
27698c2ecf20Sopenharmony_ci	};
27708c2ecf20Sopenharmony_ci	u32 words[512];
27718c2ecf20Sopenharmony_ci};
27728c2ecf20Sopenharmony_ci
27738c2ecf20Sopenharmony_ci/**
27748c2ecf20Sopenharmony_ci * union ionic_dev_cmd_regs - Device command register format (read-write)
27758c2ecf20Sopenharmony_ci * @doorbell:        Device Cmd Doorbell, write-only
27768c2ecf20Sopenharmony_ci *                   Write a 1 to signal device to process cmd,
27778c2ecf20Sopenharmony_ci *                   poll done for completion.
27788c2ecf20Sopenharmony_ci * @done:            Done indicator, bit 0 == 1 when command is complete
27798c2ecf20Sopenharmony_ci * @cmd:             Opcode-specific command bytes
27808c2ecf20Sopenharmony_ci * @comp:            Opcode-specific response bytes
27818c2ecf20Sopenharmony_ci * @data:            Opcode-specific side-data
27828c2ecf20Sopenharmony_ci */
27838c2ecf20Sopenharmony_ciunion ionic_dev_cmd_regs {
27848c2ecf20Sopenharmony_ci	struct {
27858c2ecf20Sopenharmony_ci		u32                   doorbell;
27868c2ecf20Sopenharmony_ci		u32                   done;
27878c2ecf20Sopenharmony_ci		union ionic_dev_cmd         cmd;
27888c2ecf20Sopenharmony_ci		union ionic_dev_cmd_comp    comp;
27898c2ecf20Sopenharmony_ci		u8                    rsvd[48];
27908c2ecf20Sopenharmony_ci		u32                   data[478];
27918c2ecf20Sopenharmony_ci	} __packed;
27928c2ecf20Sopenharmony_ci	u32 words[512];
27938c2ecf20Sopenharmony_ci};
27948c2ecf20Sopenharmony_ci
27958c2ecf20Sopenharmony_ci/**
27968c2ecf20Sopenharmony_ci * union ionic_dev_regs - Device register format for bar 0 page 0
27978c2ecf20Sopenharmony_ci * @info:            Device info registers
27988c2ecf20Sopenharmony_ci * @devcmd:          Device command registers
27998c2ecf20Sopenharmony_ci */
28008c2ecf20Sopenharmony_ciunion ionic_dev_regs {
28018c2ecf20Sopenharmony_ci	struct {
28028c2ecf20Sopenharmony_ci		union ionic_dev_info_regs info;
28038c2ecf20Sopenharmony_ci		union ionic_dev_cmd_regs  devcmd;
28048c2ecf20Sopenharmony_ci	} __packed;
28058c2ecf20Sopenharmony_ci	__le32 words[1024];
28068c2ecf20Sopenharmony_ci};
28078c2ecf20Sopenharmony_ci
28088c2ecf20Sopenharmony_ciunion ionic_adminq_cmd {
28098c2ecf20Sopenharmony_ci	struct ionic_admin_cmd cmd;
28108c2ecf20Sopenharmony_ci	struct ionic_nop_cmd nop;
28118c2ecf20Sopenharmony_ci	struct ionic_q_identify_cmd q_identify;
28128c2ecf20Sopenharmony_ci	struct ionic_q_init_cmd q_init;
28138c2ecf20Sopenharmony_ci	struct ionic_q_control_cmd q_control;
28148c2ecf20Sopenharmony_ci	struct ionic_lif_setattr_cmd lif_setattr;
28158c2ecf20Sopenharmony_ci	struct ionic_lif_getattr_cmd lif_getattr;
28168c2ecf20Sopenharmony_ci	struct ionic_rx_mode_set_cmd rx_mode_set;
28178c2ecf20Sopenharmony_ci	struct ionic_rx_filter_add_cmd rx_filter_add;
28188c2ecf20Sopenharmony_ci	struct ionic_rx_filter_del_cmd rx_filter_del;
28198c2ecf20Sopenharmony_ci	struct ionic_rdma_reset_cmd rdma_reset;
28208c2ecf20Sopenharmony_ci	struct ionic_rdma_queue_cmd rdma_queue;
28218c2ecf20Sopenharmony_ci	struct ionic_fw_download_cmd fw_download;
28228c2ecf20Sopenharmony_ci	struct ionic_fw_control_cmd fw_control;
28238c2ecf20Sopenharmony_ci};
28248c2ecf20Sopenharmony_ci
28258c2ecf20Sopenharmony_ciunion ionic_adminq_comp {
28268c2ecf20Sopenharmony_ci	struct ionic_admin_comp comp;
28278c2ecf20Sopenharmony_ci	struct ionic_nop_comp nop;
28288c2ecf20Sopenharmony_ci	struct ionic_q_identify_comp q_identify;
28298c2ecf20Sopenharmony_ci	struct ionic_q_init_comp q_init;
28308c2ecf20Sopenharmony_ci	struct ionic_lif_setattr_comp lif_setattr;
28318c2ecf20Sopenharmony_ci	struct ionic_lif_getattr_comp lif_getattr;
28328c2ecf20Sopenharmony_ci	struct ionic_rx_filter_add_comp rx_filter_add;
28338c2ecf20Sopenharmony_ci	struct ionic_fw_control_comp fw_control;
28348c2ecf20Sopenharmony_ci};
28358c2ecf20Sopenharmony_ci
28368c2ecf20Sopenharmony_ci#define IONIC_BARS_MAX			6
28378c2ecf20Sopenharmony_ci#define IONIC_PCI_BAR_DBELL		1
28388c2ecf20Sopenharmony_ci
28398c2ecf20Sopenharmony_ci/* BAR0 */
28408c2ecf20Sopenharmony_ci#define IONIC_BAR0_SIZE				0x8000
28418c2ecf20Sopenharmony_ci
28428c2ecf20Sopenharmony_ci#define IONIC_BAR0_DEV_INFO_REGS_OFFSET		0x0000
28438c2ecf20Sopenharmony_ci#define IONIC_BAR0_DEV_CMD_REGS_OFFSET		0x0800
28448c2ecf20Sopenharmony_ci#define IONIC_BAR0_DEV_CMD_DATA_REGS_OFFSET	0x0c00
28458c2ecf20Sopenharmony_ci#define IONIC_BAR0_INTR_STATUS_OFFSET		0x1000
28468c2ecf20Sopenharmony_ci#define IONIC_BAR0_INTR_CTRL_OFFSET		0x2000
28478c2ecf20Sopenharmony_ci#define IONIC_DEV_CMD_DONE			0x00000001
28488c2ecf20Sopenharmony_ci
28498c2ecf20Sopenharmony_ci#define IONIC_ASIC_TYPE_CAPRI			0
28508c2ecf20Sopenharmony_ci
28518c2ecf20Sopenharmony_ci/**
28528c2ecf20Sopenharmony_ci * struct ionic_doorbell - Doorbell register layout
28538c2ecf20Sopenharmony_ci * @p_index: Producer index
28548c2ecf20Sopenharmony_ci * @ring:    Selects the specific ring of the queue to update
28558c2ecf20Sopenharmony_ci *           Type-specific meaning:
28568c2ecf20Sopenharmony_ci *              ring=0: Default producer/consumer queue
28578c2ecf20Sopenharmony_ci *              ring=1: (CQ, EQ) Re-Arm queue.  RDMA CQs
28588c2ecf20Sopenharmony_ci *              send events to EQs when armed.  EQs send
28598c2ecf20Sopenharmony_ci *              interrupts when armed.
28608c2ecf20Sopenharmony_ci * @qid_lo:  Queue destination for the producer index and flags (low bits)
28618c2ecf20Sopenharmony_ci * @qid_hi:  Queue destination for the producer index and flags (high bits)
28628c2ecf20Sopenharmony_ci */
28638c2ecf20Sopenharmony_cistruct ionic_doorbell {
28648c2ecf20Sopenharmony_ci	__le16 p_index;
28658c2ecf20Sopenharmony_ci	u8     ring;
28668c2ecf20Sopenharmony_ci	u8     qid_lo;
28678c2ecf20Sopenharmony_ci	__le16 qid_hi;
28688c2ecf20Sopenharmony_ci	u16    rsvd2;
28698c2ecf20Sopenharmony_ci};
28708c2ecf20Sopenharmony_ci
28718c2ecf20Sopenharmony_cistruct ionic_intr_status {
28728c2ecf20Sopenharmony_ci	u32 status[2];
28738c2ecf20Sopenharmony_ci};
28748c2ecf20Sopenharmony_ci
28758c2ecf20Sopenharmony_cistruct ionic_notifyq_cmd {
28768c2ecf20Sopenharmony_ci	__le32 data;	/* Not used but needed for qcq structure */
28778c2ecf20Sopenharmony_ci};
28788c2ecf20Sopenharmony_ci
28798c2ecf20Sopenharmony_ciunion ionic_notifyq_comp {
28808c2ecf20Sopenharmony_ci	struct ionic_notifyq_event event;
28818c2ecf20Sopenharmony_ci	struct ionic_link_change_event link_change;
28828c2ecf20Sopenharmony_ci	struct ionic_reset_event reset;
28838c2ecf20Sopenharmony_ci	struct ionic_heartbeat_event heartbeat;
28848c2ecf20Sopenharmony_ci	struct ionic_log_event log;
28858c2ecf20Sopenharmony_ci};
28868c2ecf20Sopenharmony_ci
28878c2ecf20Sopenharmony_ci/* Deprecate */
28888c2ecf20Sopenharmony_cistruct ionic_identity {
28898c2ecf20Sopenharmony_ci	union ionic_drv_identity drv;
28908c2ecf20Sopenharmony_ci	union ionic_dev_identity dev;
28918c2ecf20Sopenharmony_ci	union ionic_lif_identity lif;
28928c2ecf20Sopenharmony_ci	union ionic_port_identity port;
28938c2ecf20Sopenharmony_ci	union ionic_qos_identity qos;
28948c2ecf20Sopenharmony_ci	union ionic_q_identity txq;
28958c2ecf20Sopenharmony_ci};
28968c2ecf20Sopenharmony_ci
28978c2ecf20Sopenharmony_ci#endif /* _IONIC_IF_H_ */
2898