18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/**************************************************************************/
38c2ecf20Sopenharmony_ci/*                                                                        */
48c2ecf20Sopenharmony_ci/*  IBM System i and System p Virtual NIC Device Driver                   */
58c2ecf20Sopenharmony_ci/*  Copyright (C) 2014 IBM Corp.                                          */
68c2ecf20Sopenharmony_ci/*  Santiago Leon (santi_leon@yahoo.com)                                  */
78c2ecf20Sopenharmony_ci/*  Thomas Falcon (tlfalcon@linux.vnet.ibm.com)                           */
88c2ecf20Sopenharmony_ci/*  John Allen (jallen@linux.vnet.ibm.com)                                */
98c2ecf20Sopenharmony_ci/*                                                                        */
108c2ecf20Sopenharmony_ci/*                                                                        */
118c2ecf20Sopenharmony_ci/* This module contains the implementation of a virtual ethernet device   */
128c2ecf20Sopenharmony_ci/* for use with IBM i/pSeries LPAR Linux.  It utilizes the logical LAN    */
138c2ecf20Sopenharmony_ci/* option of the RS/6000 Platform Architecture to interface with virtual */
148c2ecf20Sopenharmony_ci/* ethernet NICs that are presented to the partition by the hypervisor.   */
158c2ecf20Sopenharmony_ci/*                                                                        */
168c2ecf20Sopenharmony_ci/**************************************************************************/
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define IBMVNIC_NAME		"ibmvnic"
198c2ecf20Sopenharmony_ci#define IBMVNIC_DRIVER_VERSION	"1.0.1"
208c2ecf20Sopenharmony_ci#define IBMVNIC_INVALID_MAP	-1
218c2ecf20Sopenharmony_ci#define IBMVNIC_STATS_TIMEOUT	1
228c2ecf20Sopenharmony_ci#define IBMVNIC_INIT_FAILED	2
238c2ecf20Sopenharmony_ci#define IBMVNIC_OPEN_FAILED	3
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* basic structures plus 100 2k buffers */
268c2ecf20Sopenharmony_ci#define IBMVNIC_IO_ENTITLEMENT_DEFAULT	610305
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/* Initial module_parameters */
298c2ecf20Sopenharmony_ci#define IBMVNIC_RX_WEIGHT		16
308c2ecf20Sopenharmony_ci/* when changing this, update IBMVNIC_IO_ENTITLEMENT_DEFAULT */
318c2ecf20Sopenharmony_ci#define IBMVNIC_BUFFS_PER_POOL	100
328c2ecf20Sopenharmony_ci#define IBMVNIC_MAX_QUEUES	16
338c2ecf20Sopenharmony_ci#define IBMVNIC_MAX_QUEUE_SZ   4096
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#define IBMVNIC_TSO_BUF_SZ	65536
368c2ecf20Sopenharmony_ci#define IBMVNIC_TSO_BUFS	64
378c2ecf20Sopenharmony_ci#define IBMVNIC_TSO_POOL_MASK	0x80000000
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#define IBMVNIC_MAX_LTB_SIZE ((1 << (MAX_ORDER - 1)) * PAGE_SIZE)
408c2ecf20Sopenharmony_ci#define IBMVNIC_BUFFER_HLEN 500
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#define IBMVNIC_RESET_DELAY 100
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_cistruct ibmvnic_login_buffer {
458c2ecf20Sopenharmony_ci	__be32 len;
468c2ecf20Sopenharmony_ci	__be32 version;
478c2ecf20Sopenharmony_ci#define INITIAL_VERSION_LB 1
488c2ecf20Sopenharmony_ci	__be32 num_txcomp_subcrqs;
498c2ecf20Sopenharmony_ci	__be32 off_txcomp_subcrqs;
508c2ecf20Sopenharmony_ci	__be32 num_rxcomp_subcrqs;
518c2ecf20Sopenharmony_ci	__be32 off_rxcomp_subcrqs;
528c2ecf20Sopenharmony_ci	__be32 login_rsp_ioba;
538c2ecf20Sopenharmony_ci	__be32 login_rsp_len;
548c2ecf20Sopenharmony_ci	__be32 client_data_offset;
558c2ecf20Sopenharmony_ci	__be32 client_data_len;
568c2ecf20Sopenharmony_ci} __packed __aligned(8);
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_cistruct ibmvnic_login_rsp_buffer {
598c2ecf20Sopenharmony_ci	__be32 len;
608c2ecf20Sopenharmony_ci	__be32 version;
618c2ecf20Sopenharmony_ci#define INITIAL_VERSION_LRB 1
628c2ecf20Sopenharmony_ci	__be32 num_txsubm_subcrqs;
638c2ecf20Sopenharmony_ci	__be32 off_txsubm_subcrqs;
648c2ecf20Sopenharmony_ci	__be32 num_rxadd_subcrqs;
658c2ecf20Sopenharmony_ci	__be32 off_rxadd_subcrqs;
668c2ecf20Sopenharmony_ci	__be32 off_rxadd_buff_size;
678c2ecf20Sopenharmony_ci	__be32 num_supp_tx_desc;
688c2ecf20Sopenharmony_ci	__be32 off_supp_tx_desc;
698c2ecf20Sopenharmony_ci} __packed __aligned(8);
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistruct ibmvnic_query_ip_offload_buffer {
728c2ecf20Sopenharmony_ci	__be32 len;
738c2ecf20Sopenharmony_ci	__be32 version;
748c2ecf20Sopenharmony_ci#define INITIAL_VERSION_IOB 1
758c2ecf20Sopenharmony_ci	u8 ipv4_chksum;
768c2ecf20Sopenharmony_ci	u8 ipv6_chksum;
778c2ecf20Sopenharmony_ci	u8 tcp_ipv4_chksum;
788c2ecf20Sopenharmony_ci	u8 tcp_ipv6_chksum;
798c2ecf20Sopenharmony_ci	u8 udp_ipv4_chksum;
808c2ecf20Sopenharmony_ci	u8 udp_ipv6_chksum;
818c2ecf20Sopenharmony_ci	u8 large_tx_ipv4;
828c2ecf20Sopenharmony_ci	u8 large_tx_ipv6;
838c2ecf20Sopenharmony_ci	u8 large_rx_ipv4;
848c2ecf20Sopenharmony_ci	u8 large_rx_ipv6;
858c2ecf20Sopenharmony_ci	u8 reserved1[14];
868c2ecf20Sopenharmony_ci	__be16 max_ipv4_header_size;
878c2ecf20Sopenharmony_ci	__be16 max_ipv6_header_size;
888c2ecf20Sopenharmony_ci	__be16 max_tcp_header_size;
898c2ecf20Sopenharmony_ci	__be16 max_udp_header_size;
908c2ecf20Sopenharmony_ci	__be32 max_large_tx_size;
918c2ecf20Sopenharmony_ci	__be32 max_large_rx_size;
928c2ecf20Sopenharmony_ci	u8 reserved2[16];
938c2ecf20Sopenharmony_ci	u8 ipv6_extension_header;
948c2ecf20Sopenharmony_ci#define IPV6_EH_NOT_SUPPORTED	0x00
958c2ecf20Sopenharmony_ci#define IPV6_EH_SUPPORTED_LIM	0x01
968c2ecf20Sopenharmony_ci#define IPV6_EH_SUPPORTED	0xFF
978c2ecf20Sopenharmony_ci	u8 tcp_pseudosum_req;
988c2ecf20Sopenharmony_ci#define TCP_PS_NOT_REQUIRED	0x00
998c2ecf20Sopenharmony_ci#define TCP_PS_REQUIRED		0x01
1008c2ecf20Sopenharmony_ci	u8 reserved3[30];
1018c2ecf20Sopenharmony_ci	__be16 num_ipv6_ext_headers;
1028c2ecf20Sopenharmony_ci	__be32 off_ipv6_ext_headers;
1038c2ecf20Sopenharmony_ci	u8 reserved4[154];
1048c2ecf20Sopenharmony_ci} __packed __aligned(8);
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_cistruct ibmvnic_control_ip_offload_buffer {
1078c2ecf20Sopenharmony_ci	__be32 len;
1088c2ecf20Sopenharmony_ci	__be32 version;
1098c2ecf20Sopenharmony_ci#define INITIAL_VERSION_IOB 1
1108c2ecf20Sopenharmony_ci	u8 ipv4_chksum;
1118c2ecf20Sopenharmony_ci	u8 ipv6_chksum;
1128c2ecf20Sopenharmony_ci	u8 tcp_ipv4_chksum;
1138c2ecf20Sopenharmony_ci	u8 tcp_ipv6_chksum;
1148c2ecf20Sopenharmony_ci	u8 udp_ipv4_chksum;
1158c2ecf20Sopenharmony_ci	u8 udp_ipv6_chksum;
1168c2ecf20Sopenharmony_ci	u8 large_tx_ipv4;
1178c2ecf20Sopenharmony_ci	u8 large_tx_ipv6;
1188c2ecf20Sopenharmony_ci	u8 bad_packet_rx;
1198c2ecf20Sopenharmony_ci	u8 large_rx_ipv4;
1208c2ecf20Sopenharmony_ci	u8 large_rx_ipv6;
1218c2ecf20Sopenharmony_ci	u8 reserved4[111];
1228c2ecf20Sopenharmony_ci} __packed __aligned(8);
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_cistruct ibmvnic_fw_component {
1258c2ecf20Sopenharmony_ci	u8 name[48];
1268c2ecf20Sopenharmony_ci	__be32 trace_buff_size;
1278c2ecf20Sopenharmony_ci	u8 correlator;
1288c2ecf20Sopenharmony_ci	u8 trace_level;
1298c2ecf20Sopenharmony_ci	u8 parent_correlator;
1308c2ecf20Sopenharmony_ci	u8 error_check_level;
1318c2ecf20Sopenharmony_ci	u8 trace_on;
1328c2ecf20Sopenharmony_ci	u8 reserved[7];
1338c2ecf20Sopenharmony_ci	u8 description[192];
1348c2ecf20Sopenharmony_ci} __packed __aligned(8);
1358c2ecf20Sopenharmony_ci
1368c2ecf20Sopenharmony_cistruct ibmvnic_fw_trace_entry {
1378c2ecf20Sopenharmony_ci	__be32 trace_id;
1388c2ecf20Sopenharmony_ci	u8 num_valid_data;
1398c2ecf20Sopenharmony_ci	u8 reserved[3];
1408c2ecf20Sopenharmony_ci	__be64 pmc_registers;
1418c2ecf20Sopenharmony_ci	__be64 timebase;
1428c2ecf20Sopenharmony_ci	__be64 trace_data[5];
1438c2ecf20Sopenharmony_ci} __packed __aligned(8);
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_cistruct ibmvnic_statistics {
1468c2ecf20Sopenharmony_ci	__be32 version;
1478c2ecf20Sopenharmony_ci	__be32 promiscuous;
1488c2ecf20Sopenharmony_ci	__be64 rx_packets;
1498c2ecf20Sopenharmony_ci	__be64 rx_bytes;
1508c2ecf20Sopenharmony_ci	__be64 tx_packets;
1518c2ecf20Sopenharmony_ci	__be64 tx_bytes;
1528c2ecf20Sopenharmony_ci	__be64 ucast_tx_packets;
1538c2ecf20Sopenharmony_ci	__be64 ucast_rx_packets;
1548c2ecf20Sopenharmony_ci	__be64 mcast_tx_packets;
1558c2ecf20Sopenharmony_ci	__be64 mcast_rx_packets;
1568c2ecf20Sopenharmony_ci	__be64 bcast_tx_packets;
1578c2ecf20Sopenharmony_ci	__be64 bcast_rx_packets;
1588c2ecf20Sopenharmony_ci	__be64 align_errors;
1598c2ecf20Sopenharmony_ci	__be64 fcs_errors;
1608c2ecf20Sopenharmony_ci	__be64 single_collision_frames;
1618c2ecf20Sopenharmony_ci	__be64 multi_collision_frames;
1628c2ecf20Sopenharmony_ci	__be64 sqe_test_errors;
1638c2ecf20Sopenharmony_ci	__be64 deferred_tx;
1648c2ecf20Sopenharmony_ci	__be64 late_collisions;
1658c2ecf20Sopenharmony_ci	__be64 excess_collisions;
1668c2ecf20Sopenharmony_ci	__be64 internal_mac_tx_errors;
1678c2ecf20Sopenharmony_ci	__be64 carrier_sense;
1688c2ecf20Sopenharmony_ci	__be64 too_long_frames;
1698c2ecf20Sopenharmony_ci	__be64 internal_mac_rx_errors;
1708c2ecf20Sopenharmony_ci	u8 reserved[72];
1718c2ecf20Sopenharmony_ci} __packed __aligned(8);
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci#define NUM_TX_STATS 3
1748c2ecf20Sopenharmony_cistruct ibmvnic_tx_queue_stats {
1758c2ecf20Sopenharmony_ci	u64 packets;
1768c2ecf20Sopenharmony_ci	u64 bytes;
1778c2ecf20Sopenharmony_ci	u64 dropped_packets;
1788c2ecf20Sopenharmony_ci};
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci#define NUM_RX_STATS 3
1818c2ecf20Sopenharmony_cistruct ibmvnic_rx_queue_stats {
1828c2ecf20Sopenharmony_ci	u64 packets;
1838c2ecf20Sopenharmony_ci	u64 bytes;
1848c2ecf20Sopenharmony_ci	u64 interrupts;
1858c2ecf20Sopenharmony_ci};
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_cistruct ibmvnic_acl_buffer {
1888c2ecf20Sopenharmony_ci	__be32 len;
1898c2ecf20Sopenharmony_ci	__be32 version;
1908c2ecf20Sopenharmony_ci#define INITIAL_VERSION_IOB 1
1918c2ecf20Sopenharmony_ci	u8 mac_acls_restrict;
1928c2ecf20Sopenharmony_ci	u8 vlan_acls_restrict;
1938c2ecf20Sopenharmony_ci	u8 reserved1[22];
1948c2ecf20Sopenharmony_ci	__be32 num_mac_addrs;
1958c2ecf20Sopenharmony_ci	__be32 offset_mac_addrs;
1968c2ecf20Sopenharmony_ci	__be32 num_vlan_ids;
1978c2ecf20Sopenharmony_ci	__be32 offset_vlan_ids;
1988c2ecf20Sopenharmony_ci	u8 reserved2[80];
1998c2ecf20Sopenharmony_ci} __packed __aligned(8);
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci/* descriptors have been changed, how should this be defined?  1? 4? */
2028c2ecf20Sopenharmony_ci
2038c2ecf20Sopenharmony_ci#define IBMVNIC_TX_DESC_VERSIONS 3
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci/* is this still needed? */
2068c2ecf20Sopenharmony_cistruct ibmvnic_tx_comp_desc {
2078c2ecf20Sopenharmony_ci	u8 first;
2088c2ecf20Sopenharmony_ci	u8 num_comps;
2098c2ecf20Sopenharmony_ci	__be16 rcs[5];
2108c2ecf20Sopenharmony_ci	__be32 correlators[5];
2118c2ecf20Sopenharmony_ci} __packed __aligned(8);
2128c2ecf20Sopenharmony_ci
2138c2ecf20Sopenharmony_ci/* some flags that included in v0 descriptor, which is gone
2148c2ecf20Sopenharmony_ci * only used for IBMVNIC_TCP_CHKSUM and IBMVNIC_UDP_CHKSUM
2158c2ecf20Sopenharmony_ci * and only in some offload_flags variable that doesn't seem
2168c2ecf20Sopenharmony_ci * to be used anywhere, can probably be removed?
2178c2ecf20Sopenharmony_ci */
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define IBMVNIC_TCP_CHKSUM		0x20
2208c2ecf20Sopenharmony_ci#define IBMVNIC_UDP_CHKSUM		0x08
2218c2ecf20Sopenharmony_ci
2228c2ecf20Sopenharmony_ci#define IBMVNIC_MAX_FRAGS_PER_CRQ 3
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_cistruct ibmvnic_tx_desc {
2258c2ecf20Sopenharmony_ci	u8 first;
2268c2ecf20Sopenharmony_ci	u8 type;
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci#define IBMVNIC_TX_DESC 0x10
2298c2ecf20Sopenharmony_ci	u8 n_crq_elem;
2308c2ecf20Sopenharmony_ci	u8 n_sge;
2318c2ecf20Sopenharmony_ci	u8 flags1;
2328c2ecf20Sopenharmony_ci#define IBMVNIC_TX_COMP_NEEDED		0x80
2338c2ecf20Sopenharmony_ci#define IBMVNIC_TX_CHKSUM_OFFLOAD	0x40
2348c2ecf20Sopenharmony_ci#define IBMVNIC_TX_LSO			0x20
2358c2ecf20Sopenharmony_ci#define IBMVNIC_TX_PROT_TCP		0x10
2368c2ecf20Sopenharmony_ci#define IBMVNIC_TX_PROT_UDP		0x08
2378c2ecf20Sopenharmony_ci#define IBMVNIC_TX_PROT_IPV4		0x04
2388c2ecf20Sopenharmony_ci#define IBMVNIC_TX_PROT_IPV6		0x02
2398c2ecf20Sopenharmony_ci#define IBMVNIC_TX_VLAN_PRESENT		0x01
2408c2ecf20Sopenharmony_ci	u8 flags2;
2418c2ecf20Sopenharmony_ci#define IBMVNIC_TX_VLAN_INSERT		0x80
2428c2ecf20Sopenharmony_ci	__be16 mss;
2438c2ecf20Sopenharmony_ci	u8 reserved[4];
2448c2ecf20Sopenharmony_ci	__be32 correlator;
2458c2ecf20Sopenharmony_ci	__be16 vlan_id;
2468c2ecf20Sopenharmony_ci	__be16 dma_reg;
2478c2ecf20Sopenharmony_ci	__be32 sge_len;
2488c2ecf20Sopenharmony_ci	__be64 ioba;
2498c2ecf20Sopenharmony_ci} __packed __aligned(8);
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_cistruct ibmvnic_hdr_desc {
2528c2ecf20Sopenharmony_ci	u8 first;
2538c2ecf20Sopenharmony_ci	u8 type;
2548c2ecf20Sopenharmony_ci#define IBMVNIC_HDR_DESC		0x11
2558c2ecf20Sopenharmony_ci	u8 len;
2568c2ecf20Sopenharmony_ci	u8 l2_len;
2578c2ecf20Sopenharmony_ci	__be16 l3_len;
2588c2ecf20Sopenharmony_ci	u8 l4_len;
2598c2ecf20Sopenharmony_ci	u8 flag;
2608c2ecf20Sopenharmony_ci	u8 data[24];
2618c2ecf20Sopenharmony_ci} __packed __aligned(8);
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistruct ibmvnic_hdr_ext_desc {
2648c2ecf20Sopenharmony_ci	u8 first;
2658c2ecf20Sopenharmony_ci	u8 type;
2668c2ecf20Sopenharmony_ci#define IBMVNIC_HDR_EXT_DESC		0x12
2678c2ecf20Sopenharmony_ci	u8 len;
2688c2ecf20Sopenharmony_ci	u8 data[29];
2698c2ecf20Sopenharmony_ci} __packed __aligned(8);
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_cistruct ibmvnic_sge_desc {
2728c2ecf20Sopenharmony_ci	u8 first;
2738c2ecf20Sopenharmony_ci	u8 type;
2748c2ecf20Sopenharmony_ci#define IBMVNIC_SGE_DESC		0x30
2758c2ecf20Sopenharmony_ci	__be16 sge1_dma_reg;
2768c2ecf20Sopenharmony_ci	__be32 sge1_len;
2778c2ecf20Sopenharmony_ci	__be64 sge1_ioba;
2788c2ecf20Sopenharmony_ci	__be16 reserved;
2798c2ecf20Sopenharmony_ci	__be16 sge2_dma_reg;
2808c2ecf20Sopenharmony_ci	__be32 sge2_len;
2818c2ecf20Sopenharmony_ci	__be64 sge2_ioba;
2828c2ecf20Sopenharmony_ci} __packed __aligned(8);
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_cistruct ibmvnic_rx_comp_desc {
2858c2ecf20Sopenharmony_ci	u8 first;
2868c2ecf20Sopenharmony_ci	u8 flags;
2878c2ecf20Sopenharmony_ci#define IBMVNIC_IP_CHKSUM_GOOD		0x80
2888c2ecf20Sopenharmony_ci#define IBMVNIC_TCP_UDP_CHKSUM_GOOD	0x40
2898c2ecf20Sopenharmony_ci#define IBMVNIC_END_FRAME			0x20
2908c2ecf20Sopenharmony_ci#define IBMVNIC_EXACT_MC			0x10
2918c2ecf20Sopenharmony_ci#define IBMVNIC_VLAN_STRIPPED			0x08
2928c2ecf20Sopenharmony_ci	__be16 off_frame_data;
2938c2ecf20Sopenharmony_ci	__be32 len;
2948c2ecf20Sopenharmony_ci	__be64 correlator;
2958c2ecf20Sopenharmony_ci	__be16 vlan_tci;
2968c2ecf20Sopenharmony_ci	__be16 rc;
2978c2ecf20Sopenharmony_ci	u8 reserved[12];
2988c2ecf20Sopenharmony_ci} __packed __aligned(8);
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_cistruct ibmvnic_generic_scrq {
3018c2ecf20Sopenharmony_ci	u8 first;
3028c2ecf20Sopenharmony_ci	u8 reserved[31];
3038c2ecf20Sopenharmony_ci} __packed __aligned(8);
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_cistruct ibmvnic_rx_buff_add_desc {
3068c2ecf20Sopenharmony_ci	u8 first;
3078c2ecf20Sopenharmony_ci	u8 reserved[7];
3088c2ecf20Sopenharmony_ci	__be64 correlator;
3098c2ecf20Sopenharmony_ci	__be32 ioba;
3108c2ecf20Sopenharmony_ci	u8 map_id;
3118c2ecf20Sopenharmony_ci	__be32 len:24;
3128c2ecf20Sopenharmony_ci	u8 reserved2[8];
3138c2ecf20Sopenharmony_ci} __packed __aligned(8);
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_cistruct ibmvnic_rc {
3168c2ecf20Sopenharmony_ci	u8 code; /* one of enum ibmvnic_rc_codes */
3178c2ecf20Sopenharmony_ci	u8 detailed_data[3];
3188c2ecf20Sopenharmony_ci} __packed __aligned(4);
3198c2ecf20Sopenharmony_ci
3208c2ecf20Sopenharmony_cistruct ibmvnic_generic_crq {
3218c2ecf20Sopenharmony_ci	u8 first;
3228c2ecf20Sopenharmony_ci	u8 cmd;
3238c2ecf20Sopenharmony_ci	u8 params[10];
3248c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
3258c2ecf20Sopenharmony_ci} __packed __aligned(8);
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_cistruct ibmvnic_version_exchange {
3288c2ecf20Sopenharmony_ci	u8 first;
3298c2ecf20Sopenharmony_ci	u8 cmd;
3308c2ecf20Sopenharmony_ci	__be16 version;
3318c2ecf20Sopenharmony_ci#define IBMVNIC_INITIAL_VERSION 1
3328c2ecf20Sopenharmony_ci	u8 reserved[8];
3338c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
3348c2ecf20Sopenharmony_ci} __packed __aligned(8);
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_cistruct ibmvnic_capability {
3378c2ecf20Sopenharmony_ci	u8 first;
3388c2ecf20Sopenharmony_ci	u8 cmd;
3398c2ecf20Sopenharmony_ci	__be16 capability; /* one of ibmvnic_capabilities */
3408c2ecf20Sopenharmony_ci	__be64 number;
3418c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
3428c2ecf20Sopenharmony_ci} __packed __aligned(8);
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_cistruct ibmvnic_login {
3458c2ecf20Sopenharmony_ci	u8 first;
3468c2ecf20Sopenharmony_ci	u8 cmd;
3478c2ecf20Sopenharmony_ci	u8 reserved[6];
3488c2ecf20Sopenharmony_ci	__be32 ioba;
3498c2ecf20Sopenharmony_ci	__be32 len;
3508c2ecf20Sopenharmony_ci} __packed __aligned(8);
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_cistruct ibmvnic_phys_parms {
3538c2ecf20Sopenharmony_ci	u8 first;
3548c2ecf20Sopenharmony_ci	u8 cmd;
3558c2ecf20Sopenharmony_ci	u8 flags1;
3568c2ecf20Sopenharmony_ci#define IBMVNIC_EXTERNAL_LOOPBACK	0x80
3578c2ecf20Sopenharmony_ci#define IBMVNIC_INTERNAL_LOOPBACK	0x40
3588c2ecf20Sopenharmony_ci#define IBMVNIC_PROMISC		0x20
3598c2ecf20Sopenharmony_ci#define IBMVNIC_PHYS_LINK_ACTIVE	0x10
3608c2ecf20Sopenharmony_ci#define IBMVNIC_AUTONEG_DUPLEX	0x08
3618c2ecf20Sopenharmony_ci#define IBMVNIC_FULL_DUPLEX	0x04
3628c2ecf20Sopenharmony_ci#define IBMVNIC_HALF_DUPLEX	0x02
3638c2ecf20Sopenharmony_ci#define IBMVNIC_CAN_CHG_PHYS_PARMS	0x01
3648c2ecf20Sopenharmony_ci	u8 flags2;
3658c2ecf20Sopenharmony_ci#define IBMVNIC_LOGICAL_LNK_ACTIVE 0x80
3668c2ecf20Sopenharmony_ci	__be32 speed;
3678c2ecf20Sopenharmony_ci#define IBMVNIC_AUTONEG		0x80000000
3688c2ecf20Sopenharmony_ci#define IBMVNIC_10MBPS		0x40000000
3698c2ecf20Sopenharmony_ci#define IBMVNIC_100MBPS		0x20000000
3708c2ecf20Sopenharmony_ci#define IBMVNIC_1GBPS		0x10000000
3718c2ecf20Sopenharmony_ci#define IBMVNIC_10GBPS		0x08000000
3728c2ecf20Sopenharmony_ci#define IBMVNIC_40GBPS		0x04000000
3738c2ecf20Sopenharmony_ci#define IBMVNIC_100GBPS		0x02000000
3748c2ecf20Sopenharmony_ci#define IBMVNIC_25GBPS		0x01000000
3758c2ecf20Sopenharmony_ci#define IBMVNIC_50GBPS		0x00800000
3768c2ecf20Sopenharmony_ci#define IBMVNIC_200GBPS		0x00400000
3778c2ecf20Sopenharmony_ci	__be32 mtu;
3788c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
3798c2ecf20Sopenharmony_ci} __packed __aligned(8);
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_cistruct ibmvnic_logical_link_state {
3828c2ecf20Sopenharmony_ci	u8 first;
3838c2ecf20Sopenharmony_ci	u8 cmd;
3848c2ecf20Sopenharmony_ci	u8 link_state;
3858c2ecf20Sopenharmony_ci#define IBMVNIC_LOGICAL_LNK_DN 0x00
3868c2ecf20Sopenharmony_ci#define IBMVNIC_LOGICAL_LNK_UP 0x01
3878c2ecf20Sopenharmony_ci#define IBMVNIC_LOGICAL_LNK_QUERY 0xff
3888c2ecf20Sopenharmony_ci	u8 reserved[9];
3898c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
3908c2ecf20Sopenharmony_ci} __packed __aligned(8);
3918c2ecf20Sopenharmony_ci
3928c2ecf20Sopenharmony_cistruct ibmvnic_query_ip_offload {
3938c2ecf20Sopenharmony_ci	u8 first;
3948c2ecf20Sopenharmony_ci	u8 cmd;
3958c2ecf20Sopenharmony_ci	u8 reserved[2];
3968c2ecf20Sopenharmony_ci	__be32 len;
3978c2ecf20Sopenharmony_ci	__be32 ioba;
3988c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
3998c2ecf20Sopenharmony_ci} __packed __aligned(8);
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_cistruct ibmvnic_control_ip_offload {
4028c2ecf20Sopenharmony_ci	u8 first;
4038c2ecf20Sopenharmony_ci	u8 cmd;
4048c2ecf20Sopenharmony_ci	u8 reserved[2];
4058c2ecf20Sopenharmony_ci	__be32 ioba;
4068c2ecf20Sopenharmony_ci	__be32 len;
4078c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4088c2ecf20Sopenharmony_ci} __packed __aligned(8);
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_cistruct ibmvnic_request_dump_size {
4118c2ecf20Sopenharmony_ci	u8 first;
4128c2ecf20Sopenharmony_ci	u8 cmd;
4138c2ecf20Sopenharmony_ci	u8 reserved[6];
4148c2ecf20Sopenharmony_ci	__be32 len;
4158c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4168c2ecf20Sopenharmony_ci} __packed __aligned(8);
4178c2ecf20Sopenharmony_ci
4188c2ecf20Sopenharmony_cistruct ibmvnic_request_dump {
4198c2ecf20Sopenharmony_ci	u8 first;
4208c2ecf20Sopenharmony_ci	u8 cmd;
4218c2ecf20Sopenharmony_ci	u8 reserved1[2];
4228c2ecf20Sopenharmony_ci	__be32 ioba;
4238c2ecf20Sopenharmony_ci	__be32 len;
4248c2ecf20Sopenharmony_ci	u8 reserved2[4];
4258c2ecf20Sopenharmony_ci} __packed __aligned(8);
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_cistruct ibmvnic_request_dump_rsp {
4288c2ecf20Sopenharmony_ci	u8 first;
4298c2ecf20Sopenharmony_ci	u8 cmd;
4308c2ecf20Sopenharmony_ci	u8 reserved[6];
4318c2ecf20Sopenharmony_ci	__be32 dumped_len;
4328c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4338c2ecf20Sopenharmony_ci} __packed __aligned(8);
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_cistruct ibmvnic_request_ras_comp_num {
4368c2ecf20Sopenharmony_ci	u8 first;
4378c2ecf20Sopenharmony_ci	u8 cmd;
4388c2ecf20Sopenharmony_ci	u8 reserved1[2];
4398c2ecf20Sopenharmony_ci	__be32 num_components;
4408c2ecf20Sopenharmony_ci	u8 reserved2[4];
4418c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4428c2ecf20Sopenharmony_ci} __packed __aligned(8);
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_cistruct ibmvnic_request_ras_comps {
4458c2ecf20Sopenharmony_ci	u8 first;
4468c2ecf20Sopenharmony_ci	u8 cmd;
4478c2ecf20Sopenharmony_ci	u8 reserved[2];
4488c2ecf20Sopenharmony_ci	__be32 ioba;
4498c2ecf20Sopenharmony_ci	__be32 len;
4508c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4518c2ecf20Sopenharmony_ci} __packed __aligned(8);
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_cistruct ibmvnic_control_ras {
4548c2ecf20Sopenharmony_ci	u8 first;
4558c2ecf20Sopenharmony_ci	u8 cmd;
4568c2ecf20Sopenharmony_ci	u8 correlator;
4578c2ecf20Sopenharmony_ci	u8 level;
4588c2ecf20Sopenharmony_ci	u8 op;
4598c2ecf20Sopenharmony_ci#define IBMVNIC_TRACE_LEVEL	1
4608c2ecf20Sopenharmony_ci#define IBMVNIC_ERROR_LEVEL	2
4618c2ecf20Sopenharmony_ci#define IBMVNIC_TRACE_PAUSE	3
4628c2ecf20Sopenharmony_ci#define IBMVNIC_TRACE_RESUME	4
4638c2ecf20Sopenharmony_ci#define IBMVNIC_TRACE_ON		5
4648c2ecf20Sopenharmony_ci#define IBMVNIC_TRACE_OFF		6
4658c2ecf20Sopenharmony_ci#define IBMVNIC_CHG_TRACE_BUFF_SZ	7
4668c2ecf20Sopenharmony_ci	u8 trace_buff_sz[3];
4678c2ecf20Sopenharmony_ci	u8 reserved[4];
4688c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4698c2ecf20Sopenharmony_ci} __packed __aligned(8);
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_cistruct ibmvnic_collect_fw_trace {
4728c2ecf20Sopenharmony_ci	u8 first;
4738c2ecf20Sopenharmony_ci	u8 cmd;
4748c2ecf20Sopenharmony_ci	u8 correlator;
4758c2ecf20Sopenharmony_ci	u8 reserved;
4768c2ecf20Sopenharmony_ci	__be32 ioba;
4778c2ecf20Sopenharmony_ci	__be32 len;
4788c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4798c2ecf20Sopenharmony_ci} __packed __aligned(8);
4808c2ecf20Sopenharmony_ci
4818c2ecf20Sopenharmony_cistruct ibmvnic_request_statistics {
4828c2ecf20Sopenharmony_ci	u8 first;
4838c2ecf20Sopenharmony_ci	u8 cmd;
4848c2ecf20Sopenharmony_ci	u8 flags;
4858c2ecf20Sopenharmony_ci#define IBMVNIC_PHYSICAL_PORT	0x80
4868c2ecf20Sopenharmony_ci	u8 reserved1;
4878c2ecf20Sopenharmony_ci	__be32 ioba;
4888c2ecf20Sopenharmony_ci	__be32 len;
4898c2ecf20Sopenharmony_ci	u8 reserved[4];
4908c2ecf20Sopenharmony_ci} __packed __aligned(8);
4918c2ecf20Sopenharmony_ci
4928c2ecf20Sopenharmony_cistruct ibmvnic_request_debug_stats {
4938c2ecf20Sopenharmony_ci	u8 first;
4948c2ecf20Sopenharmony_ci	u8 cmd;
4958c2ecf20Sopenharmony_ci	u8 reserved[2];
4968c2ecf20Sopenharmony_ci	__be32 ioba;
4978c2ecf20Sopenharmony_ci	__be32 len;
4988c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
4998c2ecf20Sopenharmony_ci} __packed __aligned(8);
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_cistruct ibmvnic_error_indication {
5028c2ecf20Sopenharmony_ci	u8 first;
5038c2ecf20Sopenharmony_ci	u8 cmd;
5048c2ecf20Sopenharmony_ci	u8 flags;
5058c2ecf20Sopenharmony_ci#define IBMVNIC_FATAL_ERROR	0x80
5068c2ecf20Sopenharmony_ci	u8 reserved1;
5078c2ecf20Sopenharmony_ci	__be32 error_id;
5088c2ecf20Sopenharmony_ci	__be32 detail_error_sz;
5098c2ecf20Sopenharmony_ci	__be16 error_cause;
5108c2ecf20Sopenharmony_ci	u8 reserved2[2];
5118c2ecf20Sopenharmony_ci} __packed __aligned(8);
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_cistruct ibmvnic_link_state_indication {
5148c2ecf20Sopenharmony_ci	u8 first;
5158c2ecf20Sopenharmony_ci	u8 cmd;
5168c2ecf20Sopenharmony_ci	u8 reserved1[2];
5178c2ecf20Sopenharmony_ci	u8 phys_link_state;
5188c2ecf20Sopenharmony_ci	u8 logical_link_state;
5198c2ecf20Sopenharmony_ci	u8 reserved2[10];
5208c2ecf20Sopenharmony_ci} __packed __aligned(8);
5218c2ecf20Sopenharmony_ci
5228c2ecf20Sopenharmony_cistruct ibmvnic_change_mac_addr {
5238c2ecf20Sopenharmony_ci	u8 first;
5248c2ecf20Sopenharmony_ci	u8 cmd;
5258c2ecf20Sopenharmony_ci	u8 mac_addr[6];
5268c2ecf20Sopenharmony_ci	u8 reserved[4];
5278c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
5288c2ecf20Sopenharmony_ci} __packed __aligned(8);
5298c2ecf20Sopenharmony_ci
5308c2ecf20Sopenharmony_cistruct ibmvnic_multicast_ctrl {
5318c2ecf20Sopenharmony_ci	u8 first;
5328c2ecf20Sopenharmony_ci	u8 cmd;
5338c2ecf20Sopenharmony_ci	u8 mac_addr[6];
5348c2ecf20Sopenharmony_ci	u8 flags;
5358c2ecf20Sopenharmony_ci#define IBMVNIC_ENABLE_MC		0x80
5368c2ecf20Sopenharmony_ci#define IBMVNIC_DISABLE_MC		0x40
5378c2ecf20Sopenharmony_ci#define IBMVNIC_ENABLE_ALL		0x20
5388c2ecf20Sopenharmony_ci#define IBMVNIC_DISABLE_ALL	0x10
5398c2ecf20Sopenharmony_ci	u8 reserved1;
5408c2ecf20Sopenharmony_ci	__be16 reserved2; /* was num_enabled_mc_addr; */
5418c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
5428c2ecf20Sopenharmony_ci} __packed __aligned(8);
5438c2ecf20Sopenharmony_ci
5448c2ecf20Sopenharmony_cistruct ibmvnic_get_vpd_size {
5458c2ecf20Sopenharmony_ci	u8 first;
5468c2ecf20Sopenharmony_ci	u8 cmd;
5478c2ecf20Sopenharmony_ci	u8 reserved[14];
5488c2ecf20Sopenharmony_ci} __packed __aligned(8);
5498c2ecf20Sopenharmony_ci
5508c2ecf20Sopenharmony_cistruct ibmvnic_get_vpd_size_rsp {
5518c2ecf20Sopenharmony_ci	u8 first;
5528c2ecf20Sopenharmony_ci	u8 cmd;
5538c2ecf20Sopenharmony_ci	u8 reserved[2];
5548c2ecf20Sopenharmony_ci	__be64 len;
5558c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
5568c2ecf20Sopenharmony_ci} __packed __aligned(8);
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_cistruct ibmvnic_get_vpd {
5598c2ecf20Sopenharmony_ci	u8 first;
5608c2ecf20Sopenharmony_ci	u8 cmd;
5618c2ecf20Sopenharmony_ci	u8 reserved1[2];
5628c2ecf20Sopenharmony_ci	__be32 ioba;
5638c2ecf20Sopenharmony_ci	__be32 len;
5648c2ecf20Sopenharmony_ci	u8 reserved[4];
5658c2ecf20Sopenharmony_ci} __packed __aligned(8);
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_cistruct ibmvnic_get_vpd_rsp {
5688c2ecf20Sopenharmony_ci	u8 first;
5698c2ecf20Sopenharmony_ci	u8 cmd;
5708c2ecf20Sopenharmony_ci	u8 reserved[10];
5718c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
5728c2ecf20Sopenharmony_ci} __packed __aligned(8);
5738c2ecf20Sopenharmony_ci
5748c2ecf20Sopenharmony_cistruct ibmvnic_acl_change_indication {
5758c2ecf20Sopenharmony_ci	u8 first;
5768c2ecf20Sopenharmony_ci	u8 cmd;
5778c2ecf20Sopenharmony_ci	__be16 change_type;
5788c2ecf20Sopenharmony_ci#define IBMVNIC_MAC_ACL 0
5798c2ecf20Sopenharmony_ci#define IBMVNIC_VLAN_ACL 1
5808c2ecf20Sopenharmony_ci	u8 reserved[12];
5818c2ecf20Sopenharmony_ci} __packed __aligned(8);
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_cistruct ibmvnic_acl_query {
5848c2ecf20Sopenharmony_ci	u8 first;
5858c2ecf20Sopenharmony_ci	u8 cmd;
5868c2ecf20Sopenharmony_ci	u8 reserved1[2];
5878c2ecf20Sopenharmony_ci	__be32 ioba;
5888c2ecf20Sopenharmony_ci	__be32 len;
5898c2ecf20Sopenharmony_ci	u8 reserved2[4];
5908c2ecf20Sopenharmony_ci} __packed __aligned(8);
5918c2ecf20Sopenharmony_ci
5928c2ecf20Sopenharmony_cistruct ibmvnic_tune {
5938c2ecf20Sopenharmony_ci	u8 first;
5948c2ecf20Sopenharmony_ci	u8 cmd;
5958c2ecf20Sopenharmony_ci	u8 reserved1[2];
5968c2ecf20Sopenharmony_ci	__be32 ioba;
5978c2ecf20Sopenharmony_ci	__be32 len;
5988c2ecf20Sopenharmony_ci	u8 reserved2[4];
5998c2ecf20Sopenharmony_ci} __packed __aligned(8);
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_cistruct ibmvnic_request_map {
6028c2ecf20Sopenharmony_ci	u8 first;
6038c2ecf20Sopenharmony_ci	u8 cmd;
6048c2ecf20Sopenharmony_ci	u8 reserved1;
6058c2ecf20Sopenharmony_ci	u8 map_id;
6068c2ecf20Sopenharmony_ci	__be32 ioba;
6078c2ecf20Sopenharmony_ci	__be32 len;
6088c2ecf20Sopenharmony_ci	u8 reserved2[4];
6098c2ecf20Sopenharmony_ci} __packed __aligned(8);
6108c2ecf20Sopenharmony_ci
6118c2ecf20Sopenharmony_cistruct ibmvnic_request_map_rsp {
6128c2ecf20Sopenharmony_ci	u8 first;
6138c2ecf20Sopenharmony_ci	u8 cmd;
6148c2ecf20Sopenharmony_ci	u8 reserved1;
6158c2ecf20Sopenharmony_ci	u8 map_id;
6168c2ecf20Sopenharmony_ci	u8 reserved2[8];
6178c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
6188c2ecf20Sopenharmony_ci} __packed __aligned(8);
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_cistruct ibmvnic_request_unmap {
6218c2ecf20Sopenharmony_ci	u8 first;
6228c2ecf20Sopenharmony_ci	u8 cmd;
6238c2ecf20Sopenharmony_ci	u8 reserved1;
6248c2ecf20Sopenharmony_ci	u8 map_id;
6258c2ecf20Sopenharmony_ci	u8 reserved2[12];
6268c2ecf20Sopenharmony_ci} __packed __aligned(8);
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_cistruct ibmvnic_request_unmap_rsp {
6298c2ecf20Sopenharmony_ci	u8 first;
6308c2ecf20Sopenharmony_ci	u8 cmd;
6318c2ecf20Sopenharmony_ci	u8 reserved1;
6328c2ecf20Sopenharmony_ci	u8 map_id;
6338c2ecf20Sopenharmony_ci	u8 reserved2[8];
6348c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
6358c2ecf20Sopenharmony_ci} __packed __aligned(8);
6368c2ecf20Sopenharmony_ci
6378c2ecf20Sopenharmony_cistruct ibmvnic_query_map {
6388c2ecf20Sopenharmony_ci	u8 first;
6398c2ecf20Sopenharmony_ci	u8 cmd;
6408c2ecf20Sopenharmony_ci	u8 reserved[14];
6418c2ecf20Sopenharmony_ci} __packed __aligned(8);
6428c2ecf20Sopenharmony_ci
6438c2ecf20Sopenharmony_cistruct ibmvnic_query_map_rsp {
6448c2ecf20Sopenharmony_ci	u8 first;
6458c2ecf20Sopenharmony_ci	u8 cmd;
6468c2ecf20Sopenharmony_ci	u8 reserved;
6478c2ecf20Sopenharmony_ci	u8 page_size;
6488c2ecf20Sopenharmony_ci	__be32 tot_pages;
6498c2ecf20Sopenharmony_ci	__be32 free_pages;
6508c2ecf20Sopenharmony_ci	struct ibmvnic_rc rc;
6518c2ecf20Sopenharmony_ci} __packed __aligned(8);
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ciunion ibmvnic_crq {
6548c2ecf20Sopenharmony_ci	struct ibmvnic_generic_crq generic;
6558c2ecf20Sopenharmony_ci	struct ibmvnic_version_exchange version_exchange;
6568c2ecf20Sopenharmony_ci	struct ibmvnic_version_exchange version_exchange_rsp;
6578c2ecf20Sopenharmony_ci	struct ibmvnic_capability query_capability;
6588c2ecf20Sopenharmony_ci	struct ibmvnic_capability query_capability_rsp;
6598c2ecf20Sopenharmony_ci	struct ibmvnic_capability request_capability;
6608c2ecf20Sopenharmony_ci	struct ibmvnic_capability request_capability_rsp;
6618c2ecf20Sopenharmony_ci	struct ibmvnic_login login;
6628c2ecf20Sopenharmony_ci	struct ibmvnic_generic_crq login_rsp;
6638c2ecf20Sopenharmony_ci	struct ibmvnic_phys_parms query_phys_parms;
6648c2ecf20Sopenharmony_ci	struct ibmvnic_phys_parms query_phys_parms_rsp;
6658c2ecf20Sopenharmony_ci	struct ibmvnic_phys_parms query_phys_capabilities;
6668c2ecf20Sopenharmony_ci	struct ibmvnic_phys_parms query_phys_capabilities_rsp;
6678c2ecf20Sopenharmony_ci	struct ibmvnic_phys_parms set_phys_parms;
6688c2ecf20Sopenharmony_ci	struct ibmvnic_phys_parms set_phys_parms_rsp;
6698c2ecf20Sopenharmony_ci	struct ibmvnic_logical_link_state logical_link_state;
6708c2ecf20Sopenharmony_ci	struct ibmvnic_logical_link_state logical_link_state_rsp;
6718c2ecf20Sopenharmony_ci	struct ibmvnic_query_ip_offload query_ip_offload;
6728c2ecf20Sopenharmony_ci	struct ibmvnic_query_ip_offload query_ip_offload_rsp;
6738c2ecf20Sopenharmony_ci	struct ibmvnic_control_ip_offload control_ip_offload;
6748c2ecf20Sopenharmony_ci	struct ibmvnic_control_ip_offload control_ip_offload_rsp;
6758c2ecf20Sopenharmony_ci	struct ibmvnic_request_dump_size request_dump_size;
6768c2ecf20Sopenharmony_ci	struct ibmvnic_request_dump_size request_dump_size_rsp;
6778c2ecf20Sopenharmony_ci	struct ibmvnic_request_dump request_dump;
6788c2ecf20Sopenharmony_ci	struct ibmvnic_request_dump_rsp request_dump_rsp;
6798c2ecf20Sopenharmony_ci	struct ibmvnic_request_ras_comp_num request_ras_comp_num;
6808c2ecf20Sopenharmony_ci	struct ibmvnic_request_ras_comp_num request_ras_comp_num_rsp;
6818c2ecf20Sopenharmony_ci	struct ibmvnic_request_ras_comps request_ras_comps;
6828c2ecf20Sopenharmony_ci	struct ibmvnic_request_ras_comps request_ras_comps_rsp;
6838c2ecf20Sopenharmony_ci	struct ibmvnic_control_ras control_ras;
6848c2ecf20Sopenharmony_ci	struct ibmvnic_control_ras control_ras_rsp;
6858c2ecf20Sopenharmony_ci	struct ibmvnic_collect_fw_trace collect_fw_trace;
6868c2ecf20Sopenharmony_ci	struct ibmvnic_collect_fw_trace collect_fw_trace_rsp;
6878c2ecf20Sopenharmony_ci	struct ibmvnic_request_statistics request_statistics;
6888c2ecf20Sopenharmony_ci	struct ibmvnic_generic_crq request_statistics_rsp;
6898c2ecf20Sopenharmony_ci	struct ibmvnic_request_debug_stats request_debug_stats;
6908c2ecf20Sopenharmony_ci	struct ibmvnic_request_debug_stats request_debug_stats_rsp;
6918c2ecf20Sopenharmony_ci	struct ibmvnic_error_indication error_indication;
6928c2ecf20Sopenharmony_ci	struct ibmvnic_link_state_indication link_state_indication;
6938c2ecf20Sopenharmony_ci	struct ibmvnic_change_mac_addr change_mac_addr;
6948c2ecf20Sopenharmony_ci	struct ibmvnic_change_mac_addr change_mac_addr_rsp;
6958c2ecf20Sopenharmony_ci	struct ibmvnic_multicast_ctrl multicast_ctrl;
6968c2ecf20Sopenharmony_ci	struct ibmvnic_multicast_ctrl multicast_ctrl_rsp;
6978c2ecf20Sopenharmony_ci	struct ibmvnic_get_vpd_size get_vpd_size;
6988c2ecf20Sopenharmony_ci	struct ibmvnic_get_vpd_size_rsp get_vpd_size_rsp;
6998c2ecf20Sopenharmony_ci	struct ibmvnic_get_vpd get_vpd;
7008c2ecf20Sopenharmony_ci	struct ibmvnic_get_vpd_rsp get_vpd_rsp;
7018c2ecf20Sopenharmony_ci	struct ibmvnic_acl_change_indication acl_change_indication;
7028c2ecf20Sopenharmony_ci	struct ibmvnic_acl_query acl_query;
7038c2ecf20Sopenharmony_ci	struct ibmvnic_generic_crq acl_query_rsp;
7048c2ecf20Sopenharmony_ci	struct ibmvnic_tune tune;
7058c2ecf20Sopenharmony_ci	struct ibmvnic_generic_crq tune_rsp;
7068c2ecf20Sopenharmony_ci	struct ibmvnic_request_map request_map;
7078c2ecf20Sopenharmony_ci	struct ibmvnic_request_map_rsp request_map_rsp;
7088c2ecf20Sopenharmony_ci	struct ibmvnic_request_unmap request_unmap;
7098c2ecf20Sopenharmony_ci	struct ibmvnic_request_unmap_rsp request_unmap_rsp;
7108c2ecf20Sopenharmony_ci	struct ibmvnic_query_map query_map;
7118c2ecf20Sopenharmony_ci	struct ibmvnic_query_map_rsp query_map_rsp;
7128c2ecf20Sopenharmony_ci};
7138c2ecf20Sopenharmony_ci
7148c2ecf20Sopenharmony_cienum ibmvnic_rc_codes {
7158c2ecf20Sopenharmony_ci	SUCCESS = 0,
7168c2ecf20Sopenharmony_ci	PARTIALSUCCESS = 1,
7178c2ecf20Sopenharmony_ci	PERMISSION = 2,
7188c2ecf20Sopenharmony_ci	NOMEMORY = 3,
7198c2ecf20Sopenharmony_ci	PARAMETER = 4,
7208c2ecf20Sopenharmony_ci	UNKNOWNCOMMAND = 5,
7218c2ecf20Sopenharmony_ci	ABORTED = 6,
7228c2ecf20Sopenharmony_ci	INVALIDSTATE = 7,
7238c2ecf20Sopenharmony_ci	INVALIDIOBA = 8,
7248c2ecf20Sopenharmony_ci	INVALIDLENGTH = 9,
7258c2ecf20Sopenharmony_ci	UNSUPPORTEDOPTION = 10,
7268c2ecf20Sopenharmony_ci};
7278c2ecf20Sopenharmony_ci
7288c2ecf20Sopenharmony_cienum ibmvnic_capabilities {
7298c2ecf20Sopenharmony_ci	MIN_TX_QUEUES = 1,
7308c2ecf20Sopenharmony_ci	MIN_RX_QUEUES = 2,
7318c2ecf20Sopenharmony_ci	MIN_RX_ADD_QUEUES = 3,
7328c2ecf20Sopenharmony_ci	MAX_TX_QUEUES = 4,
7338c2ecf20Sopenharmony_ci	MAX_RX_QUEUES = 5,
7348c2ecf20Sopenharmony_ci	MAX_RX_ADD_QUEUES = 6,
7358c2ecf20Sopenharmony_ci	REQ_TX_QUEUES = 7,
7368c2ecf20Sopenharmony_ci	REQ_RX_QUEUES = 8,
7378c2ecf20Sopenharmony_ci	REQ_RX_ADD_QUEUES = 9,
7388c2ecf20Sopenharmony_ci	MIN_TX_ENTRIES_PER_SUBCRQ = 10,
7398c2ecf20Sopenharmony_ci	MIN_RX_ADD_ENTRIES_PER_SUBCRQ = 11,
7408c2ecf20Sopenharmony_ci	MAX_TX_ENTRIES_PER_SUBCRQ = 12,
7418c2ecf20Sopenharmony_ci	MAX_RX_ADD_ENTRIES_PER_SUBCRQ = 13,
7428c2ecf20Sopenharmony_ci	REQ_TX_ENTRIES_PER_SUBCRQ = 14,
7438c2ecf20Sopenharmony_ci	REQ_RX_ADD_ENTRIES_PER_SUBCRQ = 15,
7448c2ecf20Sopenharmony_ci	TCP_IP_OFFLOAD = 16,
7458c2ecf20Sopenharmony_ci	PROMISC_REQUESTED = 17,
7468c2ecf20Sopenharmony_ci	PROMISC_SUPPORTED = 18,
7478c2ecf20Sopenharmony_ci	MIN_MTU = 19,
7488c2ecf20Sopenharmony_ci	MAX_MTU = 20,
7498c2ecf20Sopenharmony_ci	REQ_MTU = 21,
7508c2ecf20Sopenharmony_ci	MAX_MULTICAST_FILTERS = 22,
7518c2ecf20Sopenharmony_ci	VLAN_HEADER_INSERTION = 23,
7528c2ecf20Sopenharmony_ci	RX_VLAN_HEADER_INSERTION = 24,
7538c2ecf20Sopenharmony_ci	MAX_TX_SG_ENTRIES = 25,
7548c2ecf20Sopenharmony_ci	RX_SG_SUPPORTED = 26,
7558c2ecf20Sopenharmony_ci	RX_SG_REQUESTED = 27,
7568c2ecf20Sopenharmony_ci	OPT_TX_COMP_SUB_QUEUES = 28,
7578c2ecf20Sopenharmony_ci	OPT_RX_COMP_QUEUES = 29,
7588c2ecf20Sopenharmony_ci	OPT_RX_BUFADD_Q_PER_RX_COMP_Q = 30,
7598c2ecf20Sopenharmony_ci	OPT_TX_ENTRIES_PER_SUBCRQ = 31,
7608c2ecf20Sopenharmony_ci	OPT_RXBA_ENTRIES_PER_SUBCRQ = 32,
7618c2ecf20Sopenharmony_ci	TX_RX_DESC_REQ = 33,
7628c2ecf20Sopenharmony_ci};
7638c2ecf20Sopenharmony_ci
7648c2ecf20Sopenharmony_cienum ibmvnic_error_cause {
7658c2ecf20Sopenharmony_ci	ADAPTER_PROBLEM = 0,
7668c2ecf20Sopenharmony_ci	BUS_PROBLEM = 1,
7678c2ecf20Sopenharmony_ci	FW_PROBLEM = 2,
7688c2ecf20Sopenharmony_ci	DD_PROBLEM = 3,
7698c2ecf20Sopenharmony_ci	EEH_RECOVERY = 4,
7708c2ecf20Sopenharmony_ci	FW_UPDATED = 5,
7718c2ecf20Sopenharmony_ci	LOW_MEMORY = 6,
7728c2ecf20Sopenharmony_ci};
7738c2ecf20Sopenharmony_ci
7748c2ecf20Sopenharmony_cienum ibmvnic_commands {
7758c2ecf20Sopenharmony_ci	VERSION_EXCHANGE = 0x01,
7768c2ecf20Sopenharmony_ci	VERSION_EXCHANGE_RSP = 0x81,
7778c2ecf20Sopenharmony_ci	QUERY_CAPABILITY = 0x02,
7788c2ecf20Sopenharmony_ci	QUERY_CAPABILITY_RSP = 0x82,
7798c2ecf20Sopenharmony_ci	REQUEST_CAPABILITY = 0x03,
7808c2ecf20Sopenharmony_ci	REQUEST_CAPABILITY_RSP = 0x83,
7818c2ecf20Sopenharmony_ci	LOGIN = 0x04,
7828c2ecf20Sopenharmony_ci	LOGIN_RSP = 0x84,
7838c2ecf20Sopenharmony_ci	QUERY_PHYS_PARMS = 0x05,
7848c2ecf20Sopenharmony_ci	QUERY_PHYS_PARMS_RSP = 0x85,
7858c2ecf20Sopenharmony_ci	QUERY_PHYS_CAPABILITIES = 0x06,
7868c2ecf20Sopenharmony_ci	QUERY_PHYS_CAPABILITIES_RSP = 0x86,
7878c2ecf20Sopenharmony_ci	SET_PHYS_PARMS = 0x07,
7888c2ecf20Sopenharmony_ci	SET_PHYS_PARMS_RSP = 0x87,
7898c2ecf20Sopenharmony_ci	ERROR_INDICATION = 0x08,
7908c2ecf20Sopenharmony_ci	LOGICAL_LINK_STATE = 0x0C,
7918c2ecf20Sopenharmony_ci	LOGICAL_LINK_STATE_RSP = 0x8C,
7928c2ecf20Sopenharmony_ci	REQUEST_STATISTICS = 0x0D,
7938c2ecf20Sopenharmony_ci	REQUEST_STATISTICS_RSP = 0x8D,
7948c2ecf20Sopenharmony_ci	COLLECT_FW_TRACE = 0x11,
7958c2ecf20Sopenharmony_ci	COLLECT_FW_TRACE_RSP = 0x91,
7968c2ecf20Sopenharmony_ci	LINK_STATE_INDICATION = 0x12,
7978c2ecf20Sopenharmony_ci	CHANGE_MAC_ADDR = 0x13,
7988c2ecf20Sopenharmony_ci	CHANGE_MAC_ADDR_RSP = 0x93,
7998c2ecf20Sopenharmony_ci	MULTICAST_CTRL = 0x14,
8008c2ecf20Sopenharmony_ci	MULTICAST_CTRL_RSP = 0x94,
8018c2ecf20Sopenharmony_ci	GET_VPD_SIZE = 0x15,
8028c2ecf20Sopenharmony_ci	GET_VPD_SIZE_RSP = 0x95,
8038c2ecf20Sopenharmony_ci	GET_VPD = 0x16,
8048c2ecf20Sopenharmony_ci	GET_VPD_RSP = 0x96,
8058c2ecf20Sopenharmony_ci	TUNE = 0x17,
8068c2ecf20Sopenharmony_ci	TUNE_RSP = 0x97,
8078c2ecf20Sopenharmony_ci	QUERY_IP_OFFLOAD = 0x18,
8088c2ecf20Sopenharmony_ci	QUERY_IP_OFFLOAD_RSP = 0x98,
8098c2ecf20Sopenharmony_ci	CONTROL_IP_OFFLOAD = 0x19,
8108c2ecf20Sopenharmony_ci	CONTROL_IP_OFFLOAD_RSP = 0x99,
8118c2ecf20Sopenharmony_ci	ACL_CHANGE_INDICATION = 0x1A,
8128c2ecf20Sopenharmony_ci	ACL_QUERY = 0x1B,
8138c2ecf20Sopenharmony_ci	ACL_QUERY_RSP = 0x9B,
8148c2ecf20Sopenharmony_ci	QUERY_MAP = 0x1D,
8158c2ecf20Sopenharmony_ci	QUERY_MAP_RSP = 0x9D,
8168c2ecf20Sopenharmony_ci	REQUEST_MAP = 0x1E,
8178c2ecf20Sopenharmony_ci	REQUEST_MAP_RSP = 0x9E,
8188c2ecf20Sopenharmony_ci	REQUEST_UNMAP = 0x1F,
8198c2ecf20Sopenharmony_ci	REQUEST_UNMAP_RSP = 0x9F,
8208c2ecf20Sopenharmony_ci	VLAN_CTRL = 0x20,
8218c2ecf20Sopenharmony_ci	VLAN_CTRL_RSP = 0xA0,
8228c2ecf20Sopenharmony_ci};
8238c2ecf20Sopenharmony_ci
8248c2ecf20Sopenharmony_cienum ibmvnic_crq_type {
8258c2ecf20Sopenharmony_ci	IBMVNIC_CRQ_CMD			= 0x80,
8268c2ecf20Sopenharmony_ci	IBMVNIC_CRQ_CMD_RSP		= 0x80,
8278c2ecf20Sopenharmony_ci	IBMVNIC_CRQ_INIT_CMD		= 0xC0,
8288c2ecf20Sopenharmony_ci	IBMVNIC_CRQ_INIT_RSP		= 0xC0,
8298c2ecf20Sopenharmony_ci	IBMVNIC_CRQ_XPORT_EVENT		= 0xFF,
8308c2ecf20Sopenharmony_ci};
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_cienum ibmvfc_crq_format {
8338c2ecf20Sopenharmony_ci	IBMVNIC_CRQ_INIT                 = 0x01,
8348c2ecf20Sopenharmony_ci	IBMVNIC_CRQ_INIT_COMPLETE        = 0x02,
8358c2ecf20Sopenharmony_ci	IBMVNIC_PARTITION_MIGRATED       = 0x06,
8368c2ecf20Sopenharmony_ci	IBMVNIC_DEVICE_FAILOVER          = 0x08,
8378c2ecf20Sopenharmony_ci};
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_cistruct ibmvnic_crq_queue {
8408c2ecf20Sopenharmony_ci	union ibmvnic_crq *msgs;
8418c2ecf20Sopenharmony_ci	int size, cur;
8428c2ecf20Sopenharmony_ci	dma_addr_t msg_token;
8438c2ecf20Sopenharmony_ci	spinlock_t lock;
8448c2ecf20Sopenharmony_ci	bool active;
8458c2ecf20Sopenharmony_ci	char name[32];
8468c2ecf20Sopenharmony_ci};
8478c2ecf20Sopenharmony_ci
8488c2ecf20Sopenharmony_ciunion sub_crq {
8498c2ecf20Sopenharmony_ci	struct ibmvnic_generic_scrq generic;
8508c2ecf20Sopenharmony_ci	struct ibmvnic_tx_comp_desc tx_comp;
8518c2ecf20Sopenharmony_ci	struct ibmvnic_tx_desc v1;
8528c2ecf20Sopenharmony_ci	struct ibmvnic_hdr_desc hdr;
8538c2ecf20Sopenharmony_ci	struct ibmvnic_hdr_ext_desc hdr_ext;
8548c2ecf20Sopenharmony_ci	struct ibmvnic_sge_desc sge;
8558c2ecf20Sopenharmony_ci	struct ibmvnic_rx_comp_desc rx_comp;
8568c2ecf20Sopenharmony_ci	struct ibmvnic_rx_buff_add_desc rx_add;
8578c2ecf20Sopenharmony_ci};
8588c2ecf20Sopenharmony_ci
8598c2ecf20Sopenharmony_cistruct ibmvnic_sub_crq_queue {
8608c2ecf20Sopenharmony_ci	union sub_crq *msgs;
8618c2ecf20Sopenharmony_ci	int size, cur;
8628c2ecf20Sopenharmony_ci	dma_addr_t msg_token;
8638c2ecf20Sopenharmony_ci	unsigned long crq_num;
8648c2ecf20Sopenharmony_ci	unsigned long hw_irq;
8658c2ecf20Sopenharmony_ci	unsigned int irq;
8668c2ecf20Sopenharmony_ci	unsigned int pool_index;
8678c2ecf20Sopenharmony_ci	int scrq_num;
8688c2ecf20Sopenharmony_ci	spinlock_t lock;
8698c2ecf20Sopenharmony_ci	struct sk_buff *rx_skb_top;
8708c2ecf20Sopenharmony_ci	struct ibmvnic_adapter *adapter;
8718c2ecf20Sopenharmony_ci	atomic_t used;
8728c2ecf20Sopenharmony_ci	char name[32];
8738c2ecf20Sopenharmony_ci	u64 handle;
8748c2ecf20Sopenharmony_ci};
8758c2ecf20Sopenharmony_ci
8768c2ecf20Sopenharmony_cistruct ibmvnic_long_term_buff {
8778c2ecf20Sopenharmony_ci	unsigned char *buff;
8788c2ecf20Sopenharmony_ci	dma_addr_t addr;
8798c2ecf20Sopenharmony_ci	u64 size;
8808c2ecf20Sopenharmony_ci	u8 map_id;
8818c2ecf20Sopenharmony_ci};
8828c2ecf20Sopenharmony_ci
8838c2ecf20Sopenharmony_cistruct ibmvnic_tx_buff {
8848c2ecf20Sopenharmony_ci	struct sk_buff *skb;
8858c2ecf20Sopenharmony_ci	dma_addr_t data_dma[IBMVNIC_MAX_FRAGS_PER_CRQ];
8868c2ecf20Sopenharmony_ci	unsigned int data_len[IBMVNIC_MAX_FRAGS_PER_CRQ];
8878c2ecf20Sopenharmony_ci	int index;
8888c2ecf20Sopenharmony_ci	int pool_index;
8898c2ecf20Sopenharmony_ci	bool last_frag;
8908c2ecf20Sopenharmony_ci	union sub_crq indir_arr[6];
8918c2ecf20Sopenharmony_ci	u8 hdr_data[140];
8928c2ecf20Sopenharmony_ci	dma_addr_t indir_dma;
8938c2ecf20Sopenharmony_ci	int num_entries;
8948c2ecf20Sopenharmony_ci};
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_cistruct ibmvnic_tx_pool {
8978c2ecf20Sopenharmony_ci	struct ibmvnic_tx_buff *tx_buff;
8988c2ecf20Sopenharmony_ci	int *free_map;
8998c2ecf20Sopenharmony_ci	int consumer_index;
9008c2ecf20Sopenharmony_ci	int producer_index;
9018c2ecf20Sopenharmony_ci	struct ibmvnic_long_term_buff long_term_buff;
9028c2ecf20Sopenharmony_ci	int num_buffers;
9038c2ecf20Sopenharmony_ci	int buf_size;
9048c2ecf20Sopenharmony_ci};
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_cistruct ibmvnic_rx_buff {
9078c2ecf20Sopenharmony_ci	struct sk_buff *skb;
9088c2ecf20Sopenharmony_ci	dma_addr_t dma;
9098c2ecf20Sopenharmony_ci	unsigned char *data;
9108c2ecf20Sopenharmony_ci	int size;
9118c2ecf20Sopenharmony_ci	int pool_index;
9128c2ecf20Sopenharmony_ci};
9138c2ecf20Sopenharmony_ci
9148c2ecf20Sopenharmony_cistruct ibmvnic_rx_pool {
9158c2ecf20Sopenharmony_ci	struct ibmvnic_rx_buff *rx_buff;
9168c2ecf20Sopenharmony_ci	int size;
9178c2ecf20Sopenharmony_ci	int index;
9188c2ecf20Sopenharmony_ci	int buff_size;
9198c2ecf20Sopenharmony_ci	atomic_t available;
9208c2ecf20Sopenharmony_ci	int *free_map;
9218c2ecf20Sopenharmony_ci	int next_free;
9228c2ecf20Sopenharmony_ci	int next_alloc;
9238c2ecf20Sopenharmony_ci	int active;
9248c2ecf20Sopenharmony_ci	struct ibmvnic_long_term_buff long_term_buff;
9258c2ecf20Sopenharmony_ci};
9268c2ecf20Sopenharmony_ci
9278c2ecf20Sopenharmony_cistruct ibmvnic_vpd {
9288c2ecf20Sopenharmony_ci	unsigned char *buff;
9298c2ecf20Sopenharmony_ci	dma_addr_t dma_addr;
9308c2ecf20Sopenharmony_ci	u64 len;
9318c2ecf20Sopenharmony_ci};
9328c2ecf20Sopenharmony_ci
9338c2ecf20Sopenharmony_cienum vnic_state {VNIC_PROBING = 1,
9348c2ecf20Sopenharmony_ci		 VNIC_PROBED,
9358c2ecf20Sopenharmony_ci		 VNIC_OPENING,
9368c2ecf20Sopenharmony_ci		 VNIC_OPEN,
9378c2ecf20Sopenharmony_ci		 VNIC_CLOSING,
9388c2ecf20Sopenharmony_ci		 VNIC_CLOSED,
9398c2ecf20Sopenharmony_ci		 VNIC_REMOVING,
9408c2ecf20Sopenharmony_ci		 VNIC_REMOVED};
9418c2ecf20Sopenharmony_ci
9428c2ecf20Sopenharmony_cienum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
9438c2ecf20Sopenharmony_ci			   VNIC_RESET_MOBILITY,
9448c2ecf20Sopenharmony_ci			   VNIC_RESET_FATAL,
9458c2ecf20Sopenharmony_ci			   VNIC_RESET_NON_FATAL,
9468c2ecf20Sopenharmony_ci			   VNIC_RESET_TIMEOUT,
9478c2ecf20Sopenharmony_ci			   VNIC_RESET_CHANGE_PARAM};
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_cistruct ibmvnic_rwi {
9508c2ecf20Sopenharmony_ci	enum ibmvnic_reset_reason reset_reason;
9518c2ecf20Sopenharmony_ci	struct list_head list;
9528c2ecf20Sopenharmony_ci};
9538c2ecf20Sopenharmony_ci
9548c2ecf20Sopenharmony_cistruct ibmvnic_tunables {
9558c2ecf20Sopenharmony_ci	u64 rx_queues;
9568c2ecf20Sopenharmony_ci	u64 tx_queues;
9578c2ecf20Sopenharmony_ci	u64 rx_entries;
9588c2ecf20Sopenharmony_ci	u64 tx_entries;
9598c2ecf20Sopenharmony_ci	u64 mtu;
9608c2ecf20Sopenharmony_ci};
9618c2ecf20Sopenharmony_ci
9628c2ecf20Sopenharmony_cistruct ibmvnic_adapter {
9638c2ecf20Sopenharmony_ci	struct vio_dev *vdev;
9648c2ecf20Sopenharmony_ci	struct net_device *netdev;
9658c2ecf20Sopenharmony_ci	struct ibmvnic_crq_queue crq;
9668c2ecf20Sopenharmony_ci	u8 mac_addr[ETH_ALEN];
9678c2ecf20Sopenharmony_ci	struct ibmvnic_query_ip_offload_buffer ip_offload_buf;
9688c2ecf20Sopenharmony_ci	dma_addr_t ip_offload_tok;
9698c2ecf20Sopenharmony_ci	struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl;
9708c2ecf20Sopenharmony_ci	dma_addr_t ip_offload_ctrl_tok;
9718c2ecf20Sopenharmony_ci	u32 msg_enable;
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci	/* Vital Product Data (VPD) */
9748c2ecf20Sopenharmony_ci	struct ibmvnic_vpd *vpd;
9758c2ecf20Sopenharmony_ci	char fw_version[32];
9768c2ecf20Sopenharmony_ci
9778c2ecf20Sopenharmony_ci	/* Statistics */
9788c2ecf20Sopenharmony_ci	struct ibmvnic_statistics stats;
9798c2ecf20Sopenharmony_ci	dma_addr_t stats_token;
9808c2ecf20Sopenharmony_ci	struct completion stats_done;
9818c2ecf20Sopenharmony_ci	spinlock_t stats_lock;
9828c2ecf20Sopenharmony_ci	int replenish_no_mem;
9838c2ecf20Sopenharmony_ci	int replenish_add_buff_success;
9848c2ecf20Sopenharmony_ci	int replenish_add_buff_failure;
9858c2ecf20Sopenharmony_ci	int replenish_task_cycles;
9868c2ecf20Sopenharmony_ci	int tx_send_failed;
9878c2ecf20Sopenharmony_ci	int tx_map_failed;
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_ci	struct ibmvnic_tx_queue_stats *tx_stats_buffers;
9908c2ecf20Sopenharmony_ci	struct ibmvnic_rx_queue_stats *rx_stats_buffers;
9918c2ecf20Sopenharmony_ci
9928c2ecf20Sopenharmony_ci	int phys_link_state;
9938c2ecf20Sopenharmony_ci	int logical_link_state;
9948c2ecf20Sopenharmony_ci
9958c2ecf20Sopenharmony_ci	u32 speed;
9968c2ecf20Sopenharmony_ci	u8 duplex;
9978c2ecf20Sopenharmony_ci
9988c2ecf20Sopenharmony_ci	/* login data */
9998c2ecf20Sopenharmony_ci	struct ibmvnic_login_buffer *login_buf;
10008c2ecf20Sopenharmony_ci	dma_addr_t login_buf_token;
10018c2ecf20Sopenharmony_ci	int login_buf_sz;
10028c2ecf20Sopenharmony_ci
10038c2ecf20Sopenharmony_ci	struct ibmvnic_login_rsp_buffer *login_rsp_buf;
10048c2ecf20Sopenharmony_ci	dma_addr_t login_rsp_buf_token;
10058c2ecf20Sopenharmony_ci	int login_rsp_buf_sz;
10068c2ecf20Sopenharmony_ci
10078c2ecf20Sopenharmony_ci	atomic_t running_cap_crqs;
10088c2ecf20Sopenharmony_ci	bool wait_capability;
10098c2ecf20Sopenharmony_ci
10108c2ecf20Sopenharmony_ci	struct ibmvnic_sub_crq_queue **tx_scrq;
10118c2ecf20Sopenharmony_ci	struct ibmvnic_sub_crq_queue **rx_scrq;
10128c2ecf20Sopenharmony_ci
10138c2ecf20Sopenharmony_ci	/* rx structs */
10148c2ecf20Sopenharmony_ci	struct napi_struct *napi;
10158c2ecf20Sopenharmony_ci	struct ibmvnic_rx_pool *rx_pool;
10168c2ecf20Sopenharmony_ci	u64 promisc;
10178c2ecf20Sopenharmony_ci
10188c2ecf20Sopenharmony_ci	struct ibmvnic_tx_pool *tx_pool;
10198c2ecf20Sopenharmony_ci	struct ibmvnic_tx_pool *tso_pool;
10208c2ecf20Sopenharmony_ci	struct completion init_done;
10218c2ecf20Sopenharmony_ci	int init_done_rc;
10228c2ecf20Sopenharmony_ci
10238c2ecf20Sopenharmony_ci	struct completion fw_done;
10248c2ecf20Sopenharmony_ci	/* Used for serialization of device commands */
10258c2ecf20Sopenharmony_ci	struct mutex fw_lock;
10268c2ecf20Sopenharmony_ci	int fw_done_rc;
10278c2ecf20Sopenharmony_ci
10288c2ecf20Sopenharmony_ci	struct completion reset_done;
10298c2ecf20Sopenharmony_ci	int reset_done_rc;
10308c2ecf20Sopenharmony_ci	bool wait_for_reset;
10318c2ecf20Sopenharmony_ci
10328c2ecf20Sopenharmony_ci	/* partner capabilities */
10338c2ecf20Sopenharmony_ci	u64 min_tx_queues;
10348c2ecf20Sopenharmony_ci	u64 min_rx_queues;
10358c2ecf20Sopenharmony_ci	u64 min_rx_add_queues;
10368c2ecf20Sopenharmony_ci	u64 max_tx_queues;
10378c2ecf20Sopenharmony_ci	u64 max_rx_queues;
10388c2ecf20Sopenharmony_ci	u64 max_rx_add_queues;
10398c2ecf20Sopenharmony_ci	u64 req_tx_queues;
10408c2ecf20Sopenharmony_ci	u64 req_rx_queues;
10418c2ecf20Sopenharmony_ci	u64 req_rx_add_queues;
10428c2ecf20Sopenharmony_ci	u64 min_tx_entries_per_subcrq;
10438c2ecf20Sopenharmony_ci	u64 min_rx_add_entries_per_subcrq;
10448c2ecf20Sopenharmony_ci	u64 max_tx_entries_per_subcrq;
10458c2ecf20Sopenharmony_ci	u64 max_rx_add_entries_per_subcrq;
10468c2ecf20Sopenharmony_ci	u64 req_tx_entries_per_subcrq;
10478c2ecf20Sopenharmony_ci	u64 req_rx_add_entries_per_subcrq;
10488c2ecf20Sopenharmony_ci	u64 tcp_ip_offload;
10498c2ecf20Sopenharmony_ci	u64 promisc_requested;
10508c2ecf20Sopenharmony_ci	u64 promisc_supported;
10518c2ecf20Sopenharmony_ci	u64 min_mtu;
10528c2ecf20Sopenharmony_ci	u64 max_mtu;
10538c2ecf20Sopenharmony_ci	u64 req_mtu;
10548c2ecf20Sopenharmony_ci	u64 max_multicast_filters;
10558c2ecf20Sopenharmony_ci	u64 vlan_header_insertion;
10568c2ecf20Sopenharmony_ci	u64 rx_vlan_header_insertion;
10578c2ecf20Sopenharmony_ci	u64 max_tx_sg_entries;
10588c2ecf20Sopenharmony_ci	u64 rx_sg_supported;
10598c2ecf20Sopenharmony_ci	u64 rx_sg_requested;
10608c2ecf20Sopenharmony_ci	u64 opt_tx_comp_sub_queues;
10618c2ecf20Sopenharmony_ci	u64 opt_rx_comp_queues;
10628c2ecf20Sopenharmony_ci	u64 opt_rx_bufadd_q_per_rx_comp_q;
10638c2ecf20Sopenharmony_ci	u64 opt_tx_entries_per_subcrq;
10648c2ecf20Sopenharmony_ci	u64 opt_rxba_entries_per_subcrq;
10658c2ecf20Sopenharmony_ci	__be64 tx_rx_desc_req;
10668c2ecf20Sopenharmony_ci	u8 map_id;
10678c2ecf20Sopenharmony_ci	u32 num_active_rx_scrqs;
10688c2ecf20Sopenharmony_ci	u32 num_active_rx_pools;
10698c2ecf20Sopenharmony_ci	u32 num_active_rx_napi;
10708c2ecf20Sopenharmony_ci	u32 num_active_tx_scrqs;
10718c2ecf20Sopenharmony_ci	u32 num_active_tx_pools;
10728c2ecf20Sopenharmony_ci	u32 cur_rx_buf_sz;
10738c2ecf20Sopenharmony_ci
10748c2ecf20Sopenharmony_ci	struct tasklet_struct tasklet;
10758c2ecf20Sopenharmony_ci	enum vnic_state state;
10768c2ecf20Sopenharmony_ci	enum ibmvnic_reset_reason reset_reason;
10778c2ecf20Sopenharmony_ci	/* when taking both state and rwi locks, take state lock first */
10788c2ecf20Sopenharmony_ci	spinlock_t rwi_lock;
10798c2ecf20Sopenharmony_ci	struct list_head rwi_list;
10808c2ecf20Sopenharmony_ci	struct work_struct ibmvnic_reset;
10818c2ecf20Sopenharmony_ci	struct delayed_work ibmvnic_delayed_reset;
10828c2ecf20Sopenharmony_ci	unsigned long resetting;
10838c2ecf20Sopenharmony_ci	bool napi_enabled, from_passive_init;
10848c2ecf20Sopenharmony_ci	bool login_pending;
10858c2ecf20Sopenharmony_ci	/* last device reset time */
10868c2ecf20Sopenharmony_ci	unsigned long last_reset_time;
10878c2ecf20Sopenharmony_ci
10888c2ecf20Sopenharmony_ci	bool failover_pending;
10898c2ecf20Sopenharmony_ci	bool force_reset_recovery;
10908c2ecf20Sopenharmony_ci
10918c2ecf20Sopenharmony_ci	struct ibmvnic_tunables desired;
10928c2ecf20Sopenharmony_ci	struct ibmvnic_tunables fallback;
10938c2ecf20Sopenharmony_ci
10948c2ecf20Sopenharmony_ci	/* Used for serialization of state field. When taking both state
10958c2ecf20Sopenharmony_ci	 * and rwi locks, take state lock first.
10968c2ecf20Sopenharmony_ci	 */
10978c2ecf20Sopenharmony_ci	spinlock_t state_lock;
10988c2ecf20Sopenharmony_ci};
1099