1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /**************************************************************************/
4 /* IBM System i and System p Virtual NIC Device Driver */
5 /* Copyright (C) 2014 IBM Corp. */
6 /* Santiago Leon (santi_leon@yahoo.com) */
7 /* Thomas Falcon (tlfalcon@linux.vnet.ibm.com) */
8 /* John Allen (jallen@linux.vnet.ibm.com) */
11 /* This module contains the implementation of a virtual ethernet device */
12 /* for use with IBM i/pSeries LPAR Linux. It utilizes the logical LAN */
13 /* option of the RS/6000 Platform Architecture to interface with virtual */
14 /* ethernet NICs that are presented to the partition by the hypervisor. */
16 /**************************************************************************/
18 #define IBMVNIC_NAME "ibmvnic"
19 #define IBMVNIC_DRIVER_VERSION "1.0.1"
20 #define IBMVNIC_INVALID_MAP -1
21 #define IBMVNIC_STATS_TIMEOUT 1
22 #define IBMVNIC_INIT_FAILED 2
23 #define IBMVNIC_OPEN_FAILED 3
25 /* basic structures plus 100 2k buffers */
26 #define IBMVNIC_IO_ENTITLEMENT_DEFAULT 610305
28 /* Initial module_parameters */
29 #define IBMVNIC_RX_WEIGHT 16
30 /* when changing this, update IBMVNIC_IO_ENTITLEMENT_DEFAULT */
31 #define IBMVNIC_BUFFS_PER_POOL 100
32 #define IBMVNIC_MAX_QUEUES 16
33 #define IBMVNIC_MAX_QUEUE_SZ 4096
35 #define IBMVNIC_TSO_BUF_SZ 65536
36 #define IBMVNIC_TSO_BUFS 64
37 #define IBMVNIC_TSO_POOL_MASK 0x80000000
39 #define IBMVNIC_MAX_LTB_SIZE ((1 << (MAX_ORDER - 1)) * PAGE_SIZE)
40 #define IBMVNIC_BUFFER_HLEN 500
42 #define IBMVNIC_RESET_DELAY 100
44 struct ibmvnic_login_buffer {
47 #define INITIAL_VERSION_LB 1
48 __be32 num_txcomp_subcrqs;
49 __be32 off_txcomp_subcrqs;
50 __be32 num_rxcomp_subcrqs;
51 __be32 off_rxcomp_subcrqs;
52 __be32 login_rsp_ioba;
54 __be32 client_data_offset;
55 __be32 client_data_len;
56 } __packed __aligned(8);
58 struct ibmvnic_login_rsp_buffer {
61 #define INITIAL_VERSION_LRB 1
62 __be32 num_txsubm_subcrqs;
63 __be32 off_txsubm_subcrqs;
64 __be32 num_rxadd_subcrqs;
65 __be32 off_rxadd_subcrqs;
66 __be32 off_rxadd_buff_size;
67 __be32 num_supp_tx_desc;
68 __be32 off_supp_tx_desc;
69 } __packed __aligned(8);
71 struct ibmvnic_query_ip_offload_buffer {
74 #define INITIAL_VERSION_IOB 1
86 __be16 max_ipv4_header_size;
87 __be16 max_ipv6_header_size;
88 __be16 max_tcp_header_size;
89 __be16 max_udp_header_size;
90 __be32 max_large_tx_size;
91 __be32 max_large_rx_size;
93 u8 ipv6_extension_header;
94 #define IPV6_EH_NOT_SUPPORTED 0x00
95 #define IPV6_EH_SUPPORTED_LIM 0x01
96 #define IPV6_EH_SUPPORTED 0xFF
98 #define TCP_PS_NOT_REQUIRED 0x00
99 #define TCP_PS_REQUIRED 0x01
101 __be16 num_ipv6_ext_headers;
102 __be32 off_ipv6_ext_headers;
104 } __packed __aligned(8);
106 struct ibmvnic_control_ip_offload_buffer {
109 #define INITIAL_VERSION_IOB 1
122 } __packed __aligned(8);
124 struct ibmvnic_fw_component {
126 __be32 trace_buff_size;
129 u8 parent_correlator;
130 u8 error_check_level;
134 } __packed __aligned(8);
136 struct ibmvnic_fw_trace_entry {
140 __be64 pmc_registers;
142 __be64 trace_data[5];
143 } __packed __aligned(8);
145 struct ibmvnic_statistics {
152 __be64 ucast_tx_packets;
153 __be64 ucast_rx_packets;
154 __be64 mcast_tx_packets;
155 __be64 mcast_rx_packets;
156 __be64 bcast_tx_packets;
157 __be64 bcast_rx_packets;
160 __be64 single_collision_frames;
161 __be64 multi_collision_frames;
162 __be64 sqe_test_errors;
164 __be64 late_collisions;
165 __be64 excess_collisions;
166 __be64 internal_mac_tx_errors;
167 __be64 carrier_sense;
168 __be64 too_long_frames;
169 __be64 internal_mac_rx_errors;
171 } __packed __aligned(8);
173 #define NUM_TX_STATS 3
174 struct ibmvnic_tx_queue_stats {
180 #define NUM_RX_STATS 3
181 struct ibmvnic_rx_queue_stats {
187 struct ibmvnic_acl_buffer {
190 #define INITIAL_VERSION_IOB 1
191 u8 mac_acls_restrict;
192 u8 vlan_acls_restrict;
194 __be32 num_mac_addrs;
195 __be32 offset_mac_addrs;
197 __be32 offset_vlan_ids;
199 } __packed __aligned(8);
201 /* descriptors have been changed, how should this be defined? 1? 4? */
203 #define IBMVNIC_TX_DESC_VERSIONS 3
205 /* is this still needed? */
206 struct ibmvnic_tx_comp_desc {
210 __be32 correlators[5];
211 } __packed __aligned(8);
213 /* some flags that included in v0 descriptor, which is gone
214 * only used for IBMVNIC_TCP_CHKSUM and IBMVNIC_UDP_CHKSUM
215 * and only in some offload_flags variable that doesn't seem
216 * to be used anywhere, can probably be removed?
219 #define IBMVNIC_TCP_CHKSUM 0x20
220 #define IBMVNIC_UDP_CHKSUM 0x08
222 #define IBMVNIC_MAX_FRAGS_PER_CRQ 3
224 struct ibmvnic_tx_desc {
228 #define IBMVNIC_TX_DESC 0x10
232 #define IBMVNIC_TX_COMP_NEEDED 0x80
233 #define IBMVNIC_TX_CHKSUM_OFFLOAD 0x40
234 #define IBMVNIC_TX_LSO 0x20
235 #define IBMVNIC_TX_PROT_TCP 0x10
236 #define IBMVNIC_TX_PROT_UDP 0x08
237 #define IBMVNIC_TX_PROT_IPV4 0x04
238 #define IBMVNIC_TX_PROT_IPV6 0x02
239 #define IBMVNIC_TX_VLAN_PRESENT 0x01
241 #define IBMVNIC_TX_VLAN_INSERT 0x80
249 } __packed __aligned(8);
251 struct ibmvnic_hdr_desc {
254 #define IBMVNIC_HDR_DESC 0x11
261 } __packed __aligned(8);
263 struct ibmvnic_hdr_ext_desc {
266 #define IBMVNIC_HDR_EXT_DESC 0x12
269 } __packed __aligned(8);
271 struct ibmvnic_sge_desc {
274 #define IBMVNIC_SGE_DESC 0x30
282 } __packed __aligned(8);
284 struct ibmvnic_rx_comp_desc {
287 #define IBMVNIC_IP_CHKSUM_GOOD 0x80
288 #define IBMVNIC_TCP_UDP_CHKSUM_GOOD 0x40
289 #define IBMVNIC_END_FRAME 0x20
290 #define IBMVNIC_EXACT_MC 0x10
291 #define IBMVNIC_VLAN_STRIPPED 0x08
292 __be16 off_frame_data;
298 } __packed __aligned(8);
300 struct ibmvnic_generic_scrq {
303 } __packed __aligned(8);
305 struct ibmvnic_rx_buff_add_desc {
313 } __packed __aligned(8);
316 u8 code; /* one of enum ibmvnic_rc_codes */
318 } __packed __aligned(4);
320 struct ibmvnic_generic_crq {
324 struct ibmvnic_rc rc;
325 } __packed __aligned(8);
327 struct ibmvnic_version_exchange {
331 #define IBMVNIC_INITIAL_VERSION 1
333 struct ibmvnic_rc rc;
334 } __packed __aligned(8);
336 struct ibmvnic_capability {
339 __be16 capability; /* one of ibmvnic_capabilities */
341 struct ibmvnic_rc rc;
342 } __packed __aligned(8);
344 struct ibmvnic_login {
350 } __packed __aligned(8);
352 struct ibmvnic_phys_parms {
356 #define IBMVNIC_EXTERNAL_LOOPBACK 0x80
357 #define IBMVNIC_INTERNAL_LOOPBACK 0x40
358 #define IBMVNIC_PROMISC 0x20
359 #define IBMVNIC_PHYS_LINK_ACTIVE 0x10
360 #define IBMVNIC_AUTONEG_DUPLEX 0x08
361 #define IBMVNIC_FULL_DUPLEX 0x04
362 #define IBMVNIC_HALF_DUPLEX 0x02
363 #define IBMVNIC_CAN_CHG_PHYS_PARMS 0x01
365 #define IBMVNIC_LOGICAL_LNK_ACTIVE 0x80
367 #define IBMVNIC_AUTONEG 0x80000000
368 #define IBMVNIC_10MBPS 0x40000000
369 #define IBMVNIC_100MBPS 0x20000000
370 #define IBMVNIC_1GBPS 0x10000000
371 #define IBMVNIC_10GBPS 0x08000000
372 #define IBMVNIC_40GBPS 0x04000000
373 #define IBMVNIC_100GBPS 0x02000000
374 #define IBMVNIC_25GBPS 0x01000000
375 #define IBMVNIC_50GBPS 0x00800000
376 #define IBMVNIC_200GBPS 0x00400000
378 struct ibmvnic_rc rc;
379 } __packed __aligned(8);
381 struct ibmvnic_logical_link_state {
385 #define IBMVNIC_LOGICAL_LNK_DN 0x00
386 #define IBMVNIC_LOGICAL_LNK_UP 0x01
387 #define IBMVNIC_LOGICAL_LNK_QUERY 0xff
389 struct ibmvnic_rc rc;
390 } __packed __aligned(8);
392 struct ibmvnic_query_ip_offload {
398 struct ibmvnic_rc rc;
399 } __packed __aligned(8);
401 struct ibmvnic_control_ip_offload {
407 struct ibmvnic_rc rc;
408 } __packed __aligned(8);
410 struct ibmvnic_request_dump_size {
415 struct ibmvnic_rc rc;
416 } __packed __aligned(8);
418 struct ibmvnic_request_dump {
425 } __packed __aligned(8);
427 struct ibmvnic_request_dump_rsp {
432 struct ibmvnic_rc rc;
433 } __packed __aligned(8);
435 struct ibmvnic_request_ras_comp_num {
439 __be32 num_components;
441 struct ibmvnic_rc rc;
442 } __packed __aligned(8);
444 struct ibmvnic_request_ras_comps {
450 struct ibmvnic_rc rc;
451 } __packed __aligned(8);
453 struct ibmvnic_control_ras {
459 #define IBMVNIC_TRACE_LEVEL 1
460 #define IBMVNIC_ERROR_LEVEL 2
461 #define IBMVNIC_TRACE_PAUSE 3
462 #define IBMVNIC_TRACE_RESUME 4
463 #define IBMVNIC_TRACE_ON 5
464 #define IBMVNIC_TRACE_OFF 6
465 #define IBMVNIC_CHG_TRACE_BUFF_SZ 7
468 struct ibmvnic_rc rc;
469 } __packed __aligned(8);
471 struct ibmvnic_collect_fw_trace {
478 struct ibmvnic_rc rc;
479 } __packed __aligned(8);
481 struct ibmvnic_request_statistics {
485 #define IBMVNIC_PHYSICAL_PORT 0x80
490 } __packed __aligned(8);
492 struct ibmvnic_request_debug_stats {
498 struct ibmvnic_rc rc;
499 } __packed __aligned(8);
501 struct ibmvnic_error_indication {
505 #define IBMVNIC_FATAL_ERROR 0x80
508 __be32 detail_error_sz;
511 } __packed __aligned(8);
513 struct ibmvnic_link_state_indication {
518 u8 logical_link_state;
520 } __packed __aligned(8);
522 struct ibmvnic_change_mac_addr {
527 struct ibmvnic_rc rc;
528 } __packed __aligned(8);
530 struct ibmvnic_multicast_ctrl {
535 #define IBMVNIC_ENABLE_MC 0x80
536 #define IBMVNIC_DISABLE_MC 0x40
537 #define IBMVNIC_ENABLE_ALL 0x20
538 #define IBMVNIC_DISABLE_ALL 0x10
540 __be16 reserved2; /* was num_enabled_mc_addr; */
541 struct ibmvnic_rc rc;
542 } __packed __aligned(8);
544 struct ibmvnic_get_vpd_size {
548 } __packed __aligned(8);
550 struct ibmvnic_get_vpd_size_rsp {
555 struct ibmvnic_rc rc;
556 } __packed __aligned(8);
558 struct ibmvnic_get_vpd {
565 } __packed __aligned(8);
567 struct ibmvnic_get_vpd_rsp {
571 struct ibmvnic_rc rc;
572 } __packed __aligned(8);
574 struct ibmvnic_acl_change_indication {
578 #define IBMVNIC_MAC_ACL 0
579 #define IBMVNIC_VLAN_ACL 1
581 } __packed __aligned(8);
583 struct ibmvnic_acl_query {
590 } __packed __aligned(8);
592 struct ibmvnic_tune {
599 } __packed __aligned(8);
601 struct ibmvnic_request_map {
609 } __packed __aligned(8);
611 struct ibmvnic_request_map_rsp {
617 struct ibmvnic_rc rc;
618 } __packed __aligned(8);
620 struct ibmvnic_request_unmap {
626 } __packed __aligned(8);
628 struct ibmvnic_request_unmap_rsp {
634 struct ibmvnic_rc rc;
635 } __packed __aligned(8);
637 struct ibmvnic_query_map {
641 } __packed __aligned(8);
643 struct ibmvnic_query_map_rsp {
650 struct ibmvnic_rc rc;
651 } __packed __aligned(8);
654 struct ibmvnic_generic_crq generic;
655 struct ibmvnic_version_exchange version_exchange;
656 struct ibmvnic_version_exchange version_exchange_rsp;
657 struct ibmvnic_capability query_capability;
658 struct ibmvnic_capability query_capability_rsp;
659 struct ibmvnic_capability request_capability;
660 struct ibmvnic_capability request_capability_rsp;
661 struct ibmvnic_login login;
662 struct ibmvnic_generic_crq login_rsp;
663 struct ibmvnic_phys_parms query_phys_parms;
664 struct ibmvnic_phys_parms query_phys_parms_rsp;
665 struct ibmvnic_phys_parms query_phys_capabilities;
666 struct ibmvnic_phys_parms query_phys_capabilities_rsp;
667 struct ibmvnic_phys_parms set_phys_parms;
668 struct ibmvnic_phys_parms set_phys_parms_rsp;
669 struct ibmvnic_logical_link_state logical_link_state;
670 struct ibmvnic_logical_link_state logical_link_state_rsp;
671 struct ibmvnic_query_ip_offload query_ip_offload;
672 struct ibmvnic_query_ip_offload query_ip_offload_rsp;
673 struct ibmvnic_control_ip_offload control_ip_offload;
674 struct ibmvnic_control_ip_offload control_ip_offload_rsp;
675 struct ibmvnic_request_dump_size request_dump_size;
676 struct ibmvnic_request_dump_size request_dump_size_rsp;
677 struct ibmvnic_request_dump request_dump;
678 struct ibmvnic_request_dump_rsp request_dump_rsp;
679 struct ibmvnic_request_ras_comp_num request_ras_comp_num;
680 struct ibmvnic_request_ras_comp_num request_ras_comp_num_rsp;
681 struct ibmvnic_request_ras_comps request_ras_comps;
682 struct ibmvnic_request_ras_comps request_ras_comps_rsp;
683 struct ibmvnic_control_ras control_ras;
684 struct ibmvnic_control_ras control_ras_rsp;
685 struct ibmvnic_collect_fw_trace collect_fw_trace;
686 struct ibmvnic_collect_fw_trace collect_fw_trace_rsp;
687 struct ibmvnic_request_statistics request_statistics;
688 struct ibmvnic_generic_crq request_statistics_rsp;
689 struct ibmvnic_request_debug_stats request_debug_stats;
690 struct ibmvnic_request_debug_stats request_debug_stats_rsp;
691 struct ibmvnic_error_indication error_indication;
692 struct ibmvnic_link_state_indication link_state_indication;
693 struct ibmvnic_change_mac_addr change_mac_addr;
694 struct ibmvnic_change_mac_addr change_mac_addr_rsp;
695 struct ibmvnic_multicast_ctrl multicast_ctrl;
696 struct ibmvnic_multicast_ctrl multicast_ctrl_rsp;
697 struct ibmvnic_get_vpd_size get_vpd_size;
698 struct ibmvnic_get_vpd_size_rsp get_vpd_size_rsp;
699 struct ibmvnic_get_vpd get_vpd;
700 struct ibmvnic_get_vpd_rsp get_vpd_rsp;
701 struct ibmvnic_acl_change_indication acl_change_indication;
702 struct ibmvnic_acl_query acl_query;
703 struct ibmvnic_generic_crq acl_query_rsp;
704 struct ibmvnic_tune tune;
705 struct ibmvnic_generic_crq tune_rsp;
706 struct ibmvnic_request_map request_map;
707 struct ibmvnic_request_map_rsp request_map_rsp;
708 struct ibmvnic_request_unmap request_unmap;
709 struct ibmvnic_request_unmap_rsp request_unmap_rsp;
710 struct ibmvnic_query_map query_map;
711 struct ibmvnic_query_map_rsp query_map_rsp;
714 enum ibmvnic_rc_codes {
725 UNSUPPORTEDOPTION = 10,
728 enum ibmvnic_capabilities {
731 MIN_RX_ADD_QUEUES = 3,
734 MAX_RX_ADD_QUEUES = 6,
737 REQ_RX_ADD_QUEUES = 9,
738 MIN_TX_ENTRIES_PER_SUBCRQ = 10,
739 MIN_RX_ADD_ENTRIES_PER_SUBCRQ = 11,
740 MAX_TX_ENTRIES_PER_SUBCRQ = 12,
741 MAX_RX_ADD_ENTRIES_PER_SUBCRQ = 13,
742 REQ_TX_ENTRIES_PER_SUBCRQ = 14,
743 REQ_RX_ADD_ENTRIES_PER_SUBCRQ = 15,
745 PROMISC_REQUESTED = 17,
746 PROMISC_SUPPORTED = 18,
750 MAX_MULTICAST_FILTERS = 22,
751 VLAN_HEADER_INSERTION = 23,
752 RX_VLAN_HEADER_INSERTION = 24,
753 MAX_TX_SG_ENTRIES = 25,
754 RX_SG_SUPPORTED = 26,
755 RX_SG_REQUESTED = 27,
756 OPT_TX_COMP_SUB_QUEUES = 28,
757 OPT_RX_COMP_QUEUES = 29,
758 OPT_RX_BUFADD_Q_PER_RX_COMP_Q = 30,
759 OPT_TX_ENTRIES_PER_SUBCRQ = 31,
760 OPT_RXBA_ENTRIES_PER_SUBCRQ = 32,
764 enum ibmvnic_error_cause {
774 enum ibmvnic_commands {
775 VERSION_EXCHANGE = 0x01,
776 VERSION_EXCHANGE_RSP = 0x81,
777 QUERY_CAPABILITY = 0x02,
778 QUERY_CAPABILITY_RSP = 0x82,
779 REQUEST_CAPABILITY = 0x03,
780 REQUEST_CAPABILITY_RSP = 0x83,
783 QUERY_PHYS_PARMS = 0x05,
784 QUERY_PHYS_PARMS_RSP = 0x85,
785 QUERY_PHYS_CAPABILITIES = 0x06,
786 QUERY_PHYS_CAPABILITIES_RSP = 0x86,
787 SET_PHYS_PARMS = 0x07,
788 SET_PHYS_PARMS_RSP = 0x87,
789 ERROR_INDICATION = 0x08,
790 LOGICAL_LINK_STATE = 0x0C,
791 LOGICAL_LINK_STATE_RSP = 0x8C,
792 REQUEST_STATISTICS = 0x0D,
793 REQUEST_STATISTICS_RSP = 0x8D,
794 COLLECT_FW_TRACE = 0x11,
795 COLLECT_FW_TRACE_RSP = 0x91,
796 LINK_STATE_INDICATION = 0x12,
797 CHANGE_MAC_ADDR = 0x13,
798 CHANGE_MAC_ADDR_RSP = 0x93,
799 MULTICAST_CTRL = 0x14,
800 MULTICAST_CTRL_RSP = 0x94,
802 GET_VPD_SIZE_RSP = 0x95,
807 QUERY_IP_OFFLOAD = 0x18,
808 QUERY_IP_OFFLOAD_RSP = 0x98,
809 CONTROL_IP_OFFLOAD = 0x19,
810 CONTROL_IP_OFFLOAD_RSP = 0x99,
811 ACL_CHANGE_INDICATION = 0x1A,
813 ACL_QUERY_RSP = 0x9B,
815 QUERY_MAP_RSP = 0x9D,
817 REQUEST_MAP_RSP = 0x9E,
818 REQUEST_UNMAP = 0x1F,
819 REQUEST_UNMAP_RSP = 0x9F,
821 VLAN_CTRL_RSP = 0xA0,
824 enum ibmvnic_crq_type {
825 IBMVNIC_CRQ_CMD = 0x80,
826 IBMVNIC_CRQ_CMD_RSP = 0x80,
827 IBMVNIC_CRQ_INIT_CMD = 0xC0,
828 IBMVNIC_CRQ_INIT_RSP = 0xC0,
829 IBMVNIC_CRQ_XPORT_EVENT = 0xFF,
832 enum ibmvfc_crq_format {
833 IBMVNIC_CRQ_INIT = 0x01,
834 IBMVNIC_CRQ_INIT_COMPLETE = 0x02,
835 IBMVNIC_PARTITION_MIGRATED = 0x06,
836 IBMVNIC_DEVICE_FAILOVER = 0x08,
839 struct ibmvnic_crq_queue {
840 union ibmvnic_crq *msgs;
842 dma_addr_t msg_token;
849 struct ibmvnic_generic_scrq generic;
850 struct ibmvnic_tx_comp_desc tx_comp;
851 struct ibmvnic_tx_desc v1;
852 struct ibmvnic_hdr_desc hdr;
853 struct ibmvnic_hdr_ext_desc hdr_ext;
854 struct ibmvnic_sge_desc sge;
855 struct ibmvnic_rx_comp_desc rx_comp;
856 struct ibmvnic_rx_buff_add_desc rx_add;
859 struct ibmvnic_sub_crq_queue {
862 dma_addr_t msg_token;
863 unsigned long crq_num;
864 unsigned long hw_irq;
866 unsigned int pool_index;
869 struct sk_buff *rx_skb_top;
870 struct ibmvnic_adapter *adapter;
876 struct ibmvnic_long_term_buff {
883 struct ibmvnic_tx_buff {
885 dma_addr_t data_dma[IBMVNIC_MAX_FRAGS_PER_CRQ];
886 unsigned int data_len[IBMVNIC_MAX_FRAGS_PER_CRQ];
890 union sub_crq indir_arr[6];
892 dma_addr_t indir_dma;
896 struct ibmvnic_tx_pool {
897 struct ibmvnic_tx_buff *tx_buff;
901 struct ibmvnic_long_term_buff long_term_buff;
906 struct ibmvnic_rx_buff {
914 struct ibmvnic_rx_pool {
915 struct ibmvnic_rx_buff *rx_buff;
924 struct ibmvnic_long_term_buff long_term_buff;
933 enum vnic_state {VNIC_PROBING = 1,
942 enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
945 VNIC_RESET_NON_FATAL,
947 VNIC_RESET_CHANGE_PARAM};
950 enum ibmvnic_reset_reason reset_reason;
951 struct list_head list;
954 struct ibmvnic_tunables {
962 struct ibmvnic_adapter {
963 struct vio_dev *vdev;
964 struct net_device *netdev;
965 struct ibmvnic_crq_queue crq;
966 u8 mac_addr[ETH_ALEN];
967 struct ibmvnic_query_ip_offload_buffer ip_offload_buf;
968 dma_addr_t ip_offload_tok;
969 struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl;
970 dma_addr_t ip_offload_ctrl_tok;
973 /* Vital Product Data (VPD) */
974 struct ibmvnic_vpd *vpd;
978 struct ibmvnic_statistics stats;
979 dma_addr_t stats_token;
980 struct completion stats_done;
981 spinlock_t stats_lock;
982 int replenish_no_mem;
983 int replenish_add_buff_success;
984 int replenish_add_buff_failure;
985 int replenish_task_cycles;
989 struct ibmvnic_tx_queue_stats *tx_stats_buffers;
990 struct ibmvnic_rx_queue_stats *rx_stats_buffers;
993 int logical_link_state;
999 struct ibmvnic_login_buffer *login_buf;
1000 dma_addr_t login_buf_token;
1003 struct ibmvnic_login_rsp_buffer *login_rsp_buf;
1004 dma_addr_t login_rsp_buf_token;
1005 int login_rsp_buf_sz;
1007 atomic_t running_cap_crqs;
1008 bool wait_capability;
1010 struct ibmvnic_sub_crq_queue **tx_scrq;
1011 struct ibmvnic_sub_crq_queue **rx_scrq;
1014 struct napi_struct *napi;
1015 struct ibmvnic_rx_pool *rx_pool;
1018 struct ibmvnic_tx_pool *tx_pool;
1019 struct ibmvnic_tx_pool *tso_pool;
1020 struct completion init_done;
1023 struct completion fw_done;
1024 /* Used for serialization of device commands */
1025 struct mutex fw_lock;
1028 struct completion reset_done;
1030 bool wait_for_reset;
1032 /* partner capabilities */
1035 u64 min_rx_add_queues;
1038 u64 max_rx_add_queues;
1041 u64 req_rx_add_queues;
1042 u64 min_tx_entries_per_subcrq;
1043 u64 min_rx_add_entries_per_subcrq;
1044 u64 max_tx_entries_per_subcrq;
1045 u64 max_rx_add_entries_per_subcrq;
1046 u64 req_tx_entries_per_subcrq;
1047 u64 req_rx_add_entries_per_subcrq;
1049 u64 promisc_requested;
1050 u64 promisc_supported;
1054 u64 max_multicast_filters;
1055 u64 vlan_header_insertion;
1056 u64 rx_vlan_header_insertion;
1057 u64 max_tx_sg_entries;
1058 u64 rx_sg_supported;
1059 u64 rx_sg_requested;
1060 u64 opt_tx_comp_sub_queues;
1061 u64 opt_rx_comp_queues;
1062 u64 opt_rx_bufadd_q_per_rx_comp_q;
1063 u64 opt_tx_entries_per_subcrq;
1064 u64 opt_rxba_entries_per_subcrq;
1065 __be64 tx_rx_desc_req;
1067 u32 num_active_rx_scrqs;
1068 u32 num_active_rx_pools;
1069 u32 num_active_rx_napi;
1070 u32 num_active_tx_scrqs;
1071 u32 num_active_tx_pools;
1074 struct tasklet_struct tasklet;
1075 enum vnic_state state;
1076 enum ibmvnic_reset_reason reset_reason;
1077 /* when taking both state and rwi locks, take state lock first */
1078 spinlock_t rwi_lock;
1079 struct list_head rwi_list;
1080 struct work_struct ibmvnic_reset;
1081 struct delayed_work ibmvnic_delayed_reset;
1082 unsigned long resetting;
1083 bool napi_enabled, from_passive_init;
1085 /* last device reset time */
1086 unsigned long last_reset_time;
1088 bool failover_pending;
1089 bool force_reset_recovery;
1091 struct ibmvnic_tunables desired;
1092 struct ibmvnic_tunables fallback;
1094 /* Used for serialization of state field. When taking both state
1095 * and rwi locks, take state lock first.
1097 spinlock_t state_lock;