1 /**************************************************************************/
3 /* IBM System i and System p Virtual NIC Device Driver */
4 /* Copyright (C) 2014 IBM Corp. */
5 /* Santiago Leon (santi_leon@yahoo.com) */
6 /* Thomas Falcon (tlfalcon@linux.vnet.ibm.com) */
7 /* John Allen (jallen@linux.vnet.ibm.com) */
9 /* This program is free software; you can redistribute it and/or modify */
10 /* it under the terms of the GNU General Public License as published by */
11 /* the Free Software Foundation; either version 2 of the License, or */
12 /* (at your option) any later version. */
14 /* This program is distributed in the hope that it will be useful, */
15 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
16 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
17 /* GNU General Public License for more details. */
19 /* You should have received a copy of the GNU General Public License */
20 /* along with this program. */
22 /* This module contains the implementation of a virtual ethernet device */
23 /* for use with IBM i/pSeries LPAR Linux. It utilizes the logical LAN */
24 /* option of the RS/6000 Platform Architecture to interface with virtual */
25 /* ethernet NICs that are presented to the partition by the hypervisor. */
27 /**************************************************************************/
29 #define IBMVNIC_NAME "ibmvnic"
30 #define IBMVNIC_DRIVER_VERSION "1.0.1"
31 #define IBMVNIC_INVALID_MAP -1
32 #define IBMVNIC_STATS_TIMEOUT 1
33 #define IBMVNIC_INIT_FAILED 2
35 /* basic structures plus 100 2k buffers */
36 #define IBMVNIC_IO_ENTITLEMENT_DEFAULT 610305
38 /* Initial module_parameters */
39 #define IBMVNIC_RX_WEIGHT 16
40 /* when changing this, update IBMVNIC_IO_ENTITLEMENT_DEFAULT */
41 #define IBMVNIC_BUFFS_PER_POOL 100
42 #define IBMVNIC_MAX_QUEUES 10
44 #define IBMVNIC_TSO_BUF_SZ 65536
45 #define IBMVNIC_TSO_BUFS 64
46 #define IBMVNIC_TSO_POOL_MASK 0x80000000
48 #define IBMVNIC_MAX_LTB_SIZE ((1 << (MAX_ORDER - 1)) * PAGE_SIZE)
49 #define IBMVNIC_BUFFER_HLEN 500
51 struct ibmvnic_login_buffer {
54 #define INITIAL_VERSION_LB 1
55 __be32 num_txcomp_subcrqs;
56 __be32 off_txcomp_subcrqs;
57 __be32 num_rxcomp_subcrqs;
58 __be32 off_rxcomp_subcrqs;
59 __be32 login_rsp_ioba;
61 __be32 client_data_offset;
62 __be32 client_data_len;
63 } __packed __aligned(8);
65 struct ibmvnic_login_rsp_buffer {
68 #define INITIAL_VERSION_LRB 1
69 __be32 num_txsubm_subcrqs;
70 __be32 off_txsubm_subcrqs;
71 __be32 num_rxadd_subcrqs;
72 __be32 off_rxadd_subcrqs;
73 __be32 off_rxadd_buff_size;
74 __be32 num_supp_tx_desc;
75 __be32 off_supp_tx_desc;
76 } __packed __aligned(8);
78 struct ibmvnic_query_ip_offload_buffer {
81 #define INITIAL_VERSION_IOB 1
93 __be16 max_ipv4_header_size;
94 __be16 max_ipv6_header_size;
95 __be16 max_tcp_header_size;
96 __be16 max_udp_header_size;
97 __be32 max_large_tx_size;
98 __be32 max_large_rx_size;
100 u8 ipv6_extension_header;
101 #define IPV6_EH_NOT_SUPPORTED 0x00
102 #define IPV6_EH_SUPPORTED_LIM 0x01
103 #define IPV6_EH_SUPPORTED 0xFF
104 u8 tcp_pseudosum_req;
105 #define TCP_PS_NOT_REQUIRED 0x00
106 #define TCP_PS_REQUIRED 0x01
108 __be16 num_ipv6_ext_headers;
109 __be32 off_ipv6_ext_headers;
111 } __packed __aligned(8);
113 struct ibmvnic_control_ip_offload_buffer {
116 #define INITIAL_VERSION_IOB 1
129 } __packed __aligned(8);
131 struct ibmvnic_fw_component {
133 __be32 trace_buff_size;
136 u8 parent_correlator;
137 u8 error_check_level;
141 } __packed __aligned(8);
143 struct ibmvnic_fw_trace_entry {
147 __be64 pmc_registers;
149 __be64 trace_data[5];
150 } __packed __aligned(8);
152 struct ibmvnic_statistics {
159 __be64 ucast_tx_packets;
160 __be64 ucast_rx_packets;
161 __be64 mcast_tx_packets;
162 __be64 mcast_rx_packets;
163 __be64 bcast_tx_packets;
164 __be64 bcast_rx_packets;
167 __be64 single_collision_frames;
168 __be64 multi_collision_frames;
169 __be64 sqe_test_errors;
171 __be64 late_collisions;
172 __be64 excess_collisions;
173 __be64 internal_mac_tx_errors;
174 __be64 carrier_sense;
175 __be64 too_long_frames;
176 __be64 internal_mac_rx_errors;
178 } __packed __aligned(8);
180 #define NUM_TX_STATS 3
181 struct ibmvnic_tx_queue_stats {
187 #define NUM_RX_STATS 3
188 struct ibmvnic_rx_queue_stats {
194 struct ibmvnic_acl_buffer {
197 #define INITIAL_VERSION_IOB 1
198 u8 mac_acls_restrict;
199 u8 vlan_acls_restrict;
201 __be32 num_mac_addrs;
202 __be32 offset_mac_addrs;
204 __be32 offset_vlan_ids;
206 } __packed __aligned(8);
208 /* descriptors have been changed, how should this be defined? 1? 4? */
210 #define IBMVNIC_TX_DESC_VERSIONS 3
212 /* is this still needed? */
213 struct ibmvnic_tx_comp_desc {
217 __be32 correlators[5];
218 } __packed __aligned(8);
220 /* some flags that included in v0 descriptor, which is gone
221 * only used for IBMVNIC_TCP_CHKSUM and IBMVNIC_UDP_CHKSUM
222 * and only in some offload_flags variable that doesn't seem
223 * to be used anywhere, can probably be removed?
226 #define IBMVNIC_TCP_CHKSUM 0x20
227 #define IBMVNIC_UDP_CHKSUM 0x08
229 #define IBMVNIC_MAX_FRAGS_PER_CRQ 3
231 struct ibmvnic_tx_desc {
235 #define IBMVNIC_TX_DESC 0x10
239 #define IBMVNIC_TX_COMP_NEEDED 0x80
240 #define IBMVNIC_TX_CHKSUM_OFFLOAD 0x40
241 #define IBMVNIC_TX_LSO 0x20
242 #define IBMVNIC_TX_PROT_TCP 0x10
243 #define IBMVNIC_TX_PROT_UDP 0x08
244 #define IBMVNIC_TX_PROT_IPV4 0x04
245 #define IBMVNIC_TX_PROT_IPV6 0x02
246 #define IBMVNIC_TX_VLAN_PRESENT 0x01
248 #define IBMVNIC_TX_VLAN_INSERT 0x80
256 } __packed __aligned(8);
258 struct ibmvnic_hdr_desc {
261 #define IBMVNIC_HDR_DESC 0x11
268 } __packed __aligned(8);
270 struct ibmvnic_hdr_ext_desc {
273 #define IBMVNIC_HDR_EXT_DESC 0x12
276 } __packed __aligned(8);
278 struct ibmvnic_sge_desc {
281 #define IBMVNIC_SGE_DESC 0x30
289 } __packed __aligned(8);
291 struct ibmvnic_rx_comp_desc {
294 #define IBMVNIC_IP_CHKSUM_GOOD 0x80
295 #define IBMVNIC_TCP_UDP_CHKSUM_GOOD 0x40
296 #define IBMVNIC_END_FRAME 0x20
297 #define IBMVNIC_EXACT_MC 0x10
298 #define IBMVNIC_VLAN_STRIPPED 0x08
299 __be16 off_frame_data;
305 } __packed __aligned(8);
307 struct ibmvnic_generic_scrq {
310 } __packed __aligned(8);
312 struct ibmvnic_rx_buff_add_desc {
320 } __packed __aligned(8);
323 u8 code; /* one of enum ibmvnic_rc_codes */
325 } __packed __aligned(4);
327 struct ibmvnic_generic_crq {
331 struct ibmvnic_rc rc;
332 } __packed __aligned(8);
334 struct ibmvnic_version_exchange {
338 #define IBMVNIC_INITIAL_VERSION 1
340 struct ibmvnic_rc rc;
341 } __packed __aligned(8);
343 struct ibmvnic_capability {
346 __be16 capability; /* one of ibmvnic_capabilities */
348 struct ibmvnic_rc rc;
349 } __packed __aligned(8);
351 struct ibmvnic_login {
357 } __packed __aligned(8);
359 struct ibmvnic_phys_parms {
363 #define IBMVNIC_EXTERNAL_LOOPBACK 0x80
364 #define IBMVNIC_INTERNAL_LOOPBACK 0x40
365 #define IBMVNIC_PROMISC 0x20
366 #define IBMVNIC_PHYS_LINK_ACTIVE 0x10
367 #define IBMVNIC_AUTONEG_DUPLEX 0x08
368 #define IBMVNIC_FULL_DUPLEX 0x04
369 #define IBMVNIC_HALF_DUPLEX 0x02
370 #define IBMVNIC_CAN_CHG_PHYS_PARMS 0x01
372 #define IBMVNIC_LOGICAL_LNK_ACTIVE 0x80
374 #define IBMVNIC_AUTONEG 0x80
375 #define IBMVNIC_10MBPS 0x40
376 #define IBMVNIC_100MBPS 0x20
377 #define IBMVNIC_1GBPS 0x10
378 #define IBMVNIC_10GBPS 0x08
380 struct ibmvnic_rc rc;
381 } __packed __aligned(8);
383 struct ibmvnic_logical_link_state {
387 #define IBMVNIC_LOGICAL_LNK_DN 0x00
388 #define IBMVNIC_LOGICAL_LNK_UP 0x01
389 #define IBMVNIC_LOGICAL_LNK_QUERY 0xff
391 struct ibmvnic_rc rc;
392 } __packed __aligned(8);
394 struct ibmvnic_query_ip_offload {
400 struct ibmvnic_rc rc;
401 } __packed __aligned(8);
403 struct ibmvnic_control_ip_offload {
409 struct ibmvnic_rc rc;
410 } __packed __aligned(8);
412 struct ibmvnic_request_dump_size {
417 struct ibmvnic_rc rc;
418 } __packed __aligned(8);
420 struct ibmvnic_request_dump {
427 } __packed __aligned(8);
429 struct ibmvnic_request_dump_rsp {
434 struct ibmvnic_rc rc;
435 } __packed __aligned(8);
437 struct ibmvnic_request_ras_comp_num {
441 __be32 num_components;
443 struct ibmvnic_rc rc;
444 } __packed __aligned(8);
446 struct ibmvnic_request_ras_comps {
452 struct ibmvnic_rc rc;
453 } __packed __aligned(8);
455 struct ibmvnic_control_ras {
461 #define IBMVNIC_TRACE_LEVEL 1
462 #define IBMVNIC_ERROR_LEVEL 2
463 #define IBMVNIC_TRACE_PAUSE 3
464 #define IBMVNIC_TRACE_RESUME 4
465 #define IBMVNIC_TRACE_ON 5
466 #define IBMVNIC_TRACE_OFF 6
467 #define IBMVNIC_CHG_TRACE_BUFF_SZ 7
470 struct ibmvnic_rc rc;
471 } __packed __aligned(8);
473 struct ibmvnic_collect_fw_trace {
480 struct ibmvnic_rc rc;
481 } __packed __aligned(8);
483 struct ibmvnic_request_statistics {
487 #define IBMVNIC_PHYSICAL_PORT 0x80
492 } __packed __aligned(8);
494 struct ibmvnic_request_debug_stats {
500 struct ibmvnic_rc rc;
501 } __packed __aligned(8);
503 struct ibmvnic_error_indication {
507 #define IBMVNIC_FATAL_ERROR 0x80
510 __be32 detail_error_sz;
513 } __packed __aligned(8);
515 struct ibmvnic_request_error_info {
522 } __packed __aligned(8);
524 struct ibmvnic_request_error_rsp {
530 struct ibmvnic_rc rc;
531 } __packed __aligned(8);
533 struct ibmvnic_link_state_indication {
538 u8 logical_link_state;
540 } __packed __aligned(8);
542 struct ibmvnic_change_mac_addr {
547 struct ibmvnic_rc rc;
548 } __packed __aligned(8);
550 struct ibmvnic_multicast_ctrl {
555 #define IBMVNIC_ENABLE_MC 0x80
556 #define IBMVNIC_DISABLE_MC 0x40
557 #define IBMVNIC_ENABLE_ALL 0x20
558 #define IBMVNIC_DISABLE_ALL 0x10
560 __be16 reserved2; /* was num_enabled_mc_addr; */
561 struct ibmvnic_rc rc;
562 } __packed __aligned(8);
564 struct ibmvnic_get_vpd_size {
568 } __packed __aligned(8);
570 struct ibmvnic_get_vpd_size_rsp {
575 struct ibmvnic_rc rc;
576 } __packed __aligned(8);
578 struct ibmvnic_get_vpd {
585 } __packed __aligned(8);
587 struct ibmvnic_get_vpd_rsp {
591 struct ibmvnic_rc rc;
592 } __packed __aligned(8);
594 struct ibmvnic_acl_change_indication {
598 #define IBMVNIC_MAC_ACL 0
599 #define IBMVNIC_VLAN_ACL 1
601 } __packed __aligned(8);
603 struct ibmvnic_acl_query {
610 } __packed __aligned(8);
612 struct ibmvnic_tune {
619 } __packed __aligned(8);
621 struct ibmvnic_request_map {
629 } __packed __aligned(8);
631 struct ibmvnic_request_map_rsp {
637 struct ibmvnic_rc rc;
638 } __packed __aligned(8);
640 struct ibmvnic_request_unmap {
646 } __packed __aligned(8);
648 struct ibmvnic_request_unmap_rsp {
654 struct ibmvnic_rc rc;
655 } __packed __aligned(8);
657 struct ibmvnic_query_map {
661 } __packed __aligned(8);
663 struct ibmvnic_query_map_rsp {
670 struct ibmvnic_rc rc;
671 } __packed __aligned(8);
674 struct ibmvnic_generic_crq generic;
675 struct ibmvnic_version_exchange version_exchange;
676 struct ibmvnic_version_exchange version_exchange_rsp;
677 struct ibmvnic_capability query_capability;
678 struct ibmvnic_capability query_capability_rsp;
679 struct ibmvnic_capability request_capability;
680 struct ibmvnic_capability request_capability_rsp;
681 struct ibmvnic_login login;
682 struct ibmvnic_generic_crq login_rsp;
683 struct ibmvnic_phys_parms query_phys_parms;
684 struct ibmvnic_phys_parms query_phys_parms_rsp;
685 struct ibmvnic_phys_parms query_phys_capabilities;
686 struct ibmvnic_phys_parms query_phys_capabilities_rsp;
687 struct ibmvnic_phys_parms set_phys_parms;
688 struct ibmvnic_phys_parms set_phys_parms_rsp;
689 struct ibmvnic_logical_link_state logical_link_state;
690 struct ibmvnic_logical_link_state logical_link_state_rsp;
691 struct ibmvnic_query_ip_offload query_ip_offload;
692 struct ibmvnic_query_ip_offload query_ip_offload_rsp;
693 struct ibmvnic_control_ip_offload control_ip_offload;
694 struct ibmvnic_control_ip_offload control_ip_offload_rsp;
695 struct ibmvnic_request_dump_size request_dump_size;
696 struct ibmvnic_request_dump_size request_dump_size_rsp;
697 struct ibmvnic_request_dump request_dump;
698 struct ibmvnic_request_dump_rsp request_dump_rsp;
699 struct ibmvnic_request_ras_comp_num request_ras_comp_num;
700 struct ibmvnic_request_ras_comp_num request_ras_comp_num_rsp;
701 struct ibmvnic_request_ras_comps request_ras_comps;
702 struct ibmvnic_request_ras_comps request_ras_comps_rsp;
703 struct ibmvnic_control_ras control_ras;
704 struct ibmvnic_control_ras control_ras_rsp;
705 struct ibmvnic_collect_fw_trace collect_fw_trace;
706 struct ibmvnic_collect_fw_trace collect_fw_trace_rsp;
707 struct ibmvnic_request_statistics request_statistics;
708 struct ibmvnic_generic_crq request_statistics_rsp;
709 struct ibmvnic_request_debug_stats request_debug_stats;
710 struct ibmvnic_request_debug_stats request_debug_stats_rsp;
711 struct ibmvnic_error_indication error_indication;
712 struct ibmvnic_request_error_info request_error_info;
713 struct ibmvnic_request_error_rsp request_error_rsp;
714 struct ibmvnic_link_state_indication link_state_indication;
715 struct ibmvnic_change_mac_addr change_mac_addr;
716 struct ibmvnic_change_mac_addr change_mac_addr_rsp;
717 struct ibmvnic_multicast_ctrl multicast_ctrl;
718 struct ibmvnic_multicast_ctrl multicast_ctrl_rsp;
719 struct ibmvnic_get_vpd_size get_vpd_size;
720 struct ibmvnic_get_vpd_size_rsp get_vpd_size_rsp;
721 struct ibmvnic_get_vpd get_vpd;
722 struct ibmvnic_get_vpd_rsp get_vpd_rsp;
723 struct ibmvnic_acl_change_indication acl_change_indication;
724 struct ibmvnic_acl_query acl_query;
725 struct ibmvnic_generic_crq acl_query_rsp;
726 struct ibmvnic_tune tune;
727 struct ibmvnic_generic_crq tune_rsp;
728 struct ibmvnic_request_map request_map;
729 struct ibmvnic_request_map_rsp request_map_rsp;
730 struct ibmvnic_request_unmap request_unmap;
731 struct ibmvnic_request_unmap_rsp request_unmap_rsp;
732 struct ibmvnic_query_map query_map;
733 struct ibmvnic_query_map_rsp query_map_rsp;
736 enum ibmvnic_rc_codes {
747 UNSUPPORTEDOPTION = 10,
750 enum ibmvnic_capabilities {
753 MIN_RX_ADD_QUEUES = 3,
756 MAX_RX_ADD_QUEUES = 6,
759 REQ_RX_ADD_QUEUES = 9,
760 MIN_TX_ENTRIES_PER_SUBCRQ = 10,
761 MIN_RX_ADD_ENTRIES_PER_SUBCRQ = 11,
762 MAX_TX_ENTRIES_PER_SUBCRQ = 12,
763 MAX_RX_ADD_ENTRIES_PER_SUBCRQ = 13,
764 REQ_TX_ENTRIES_PER_SUBCRQ = 14,
765 REQ_RX_ADD_ENTRIES_PER_SUBCRQ = 15,
767 PROMISC_REQUESTED = 17,
768 PROMISC_SUPPORTED = 18,
772 MAX_MULTICAST_FILTERS = 22,
773 VLAN_HEADER_INSERTION = 23,
774 RX_VLAN_HEADER_INSERTION = 24,
775 MAX_TX_SG_ENTRIES = 25,
776 RX_SG_SUPPORTED = 26,
777 RX_SG_REQUESTED = 27,
778 OPT_TX_COMP_SUB_QUEUES = 28,
779 OPT_RX_COMP_QUEUES = 29,
780 OPT_RX_BUFADD_Q_PER_RX_COMP_Q = 30,
781 OPT_TX_ENTRIES_PER_SUBCRQ = 31,
782 OPT_RXBA_ENTRIES_PER_SUBCRQ = 32,
786 enum ibmvnic_error_cause {
796 enum ibmvnic_commands {
797 VERSION_EXCHANGE = 0x01,
798 VERSION_EXCHANGE_RSP = 0x81,
799 QUERY_CAPABILITY = 0x02,
800 QUERY_CAPABILITY_RSP = 0x82,
801 REQUEST_CAPABILITY = 0x03,
802 REQUEST_CAPABILITY_RSP = 0x83,
805 QUERY_PHYS_PARMS = 0x05,
806 QUERY_PHYS_PARMS_RSP = 0x85,
807 QUERY_PHYS_CAPABILITIES = 0x06,
808 QUERY_PHYS_CAPABILITIES_RSP = 0x86,
809 SET_PHYS_PARMS = 0x07,
810 SET_PHYS_PARMS_RSP = 0x87,
811 ERROR_INDICATION = 0x08,
812 REQUEST_ERROR_INFO = 0x09,
813 REQUEST_ERROR_RSP = 0x89,
814 LOGICAL_LINK_STATE = 0x0C,
815 LOGICAL_LINK_STATE_RSP = 0x8C,
816 REQUEST_STATISTICS = 0x0D,
817 REQUEST_STATISTICS_RSP = 0x8D,
818 COLLECT_FW_TRACE = 0x11,
819 COLLECT_FW_TRACE_RSP = 0x91,
820 LINK_STATE_INDICATION = 0x12,
821 CHANGE_MAC_ADDR = 0x13,
822 CHANGE_MAC_ADDR_RSP = 0x93,
823 MULTICAST_CTRL = 0x14,
824 MULTICAST_CTRL_RSP = 0x94,
826 GET_VPD_SIZE_RSP = 0x95,
831 QUERY_IP_OFFLOAD = 0x18,
832 QUERY_IP_OFFLOAD_RSP = 0x98,
833 CONTROL_IP_OFFLOAD = 0x19,
834 CONTROL_IP_OFFLOAD_RSP = 0x99,
835 ACL_CHANGE_INDICATION = 0x1A,
837 ACL_QUERY_RSP = 0x9B,
839 QUERY_MAP_RSP = 0x9D,
841 REQUEST_MAP_RSP = 0x9E,
842 REQUEST_UNMAP = 0x1F,
843 REQUEST_UNMAP_RSP = 0x9F,
845 VLAN_CTRL_RSP = 0xA0,
848 enum ibmvnic_crq_type {
849 IBMVNIC_CRQ_CMD = 0x80,
850 IBMVNIC_CRQ_CMD_RSP = 0x80,
851 IBMVNIC_CRQ_INIT_CMD = 0xC0,
852 IBMVNIC_CRQ_INIT_RSP = 0xC0,
853 IBMVNIC_CRQ_XPORT_EVENT = 0xFF,
856 enum ibmvfc_crq_format {
857 IBMVNIC_CRQ_INIT = 0x01,
858 IBMVNIC_CRQ_INIT_COMPLETE = 0x02,
859 IBMVNIC_PARTITION_MIGRATED = 0x06,
860 IBMVNIC_DEVICE_FAILOVER = 0x08,
863 struct ibmvnic_crq_queue {
864 union ibmvnic_crq *msgs;
866 dma_addr_t msg_token;
871 struct ibmvnic_generic_scrq generic;
872 struct ibmvnic_tx_comp_desc tx_comp;
873 struct ibmvnic_tx_desc v1;
874 struct ibmvnic_hdr_desc hdr;
875 struct ibmvnic_hdr_ext_desc hdr_ext;
876 struct ibmvnic_sge_desc sge;
877 struct ibmvnic_rx_comp_desc rx_comp;
878 struct ibmvnic_rx_buff_add_desc rx_add;
881 struct ibmvnic_sub_crq_queue {
884 dma_addr_t msg_token;
885 unsigned long crq_num;
886 unsigned long hw_irq;
888 unsigned int pool_index;
891 struct sk_buff *rx_skb_top;
892 struct ibmvnic_adapter *adapter;
896 struct ibmvnic_long_term_buff {
903 struct ibmvnic_tx_buff {
905 dma_addr_t data_dma[IBMVNIC_MAX_FRAGS_PER_CRQ];
906 unsigned int data_len[IBMVNIC_MAX_FRAGS_PER_CRQ];
910 union sub_crq indir_arr[6];
912 dma_addr_t indir_dma;
916 struct ibmvnic_tx_pool {
917 struct ibmvnic_tx_buff *tx_buff;
921 struct ibmvnic_long_term_buff long_term_buff;
926 struct ibmvnic_rx_buff {
934 struct ibmvnic_rx_pool {
935 struct ibmvnic_rx_buff *rx_buff;
944 struct ibmvnic_long_term_buff long_term_buff;
947 struct ibmvnic_error_buff {
951 struct list_head list;
961 enum vnic_state {VNIC_PROBING = 1,
970 enum ibmvnic_reset_reason {VNIC_RESET_FAILOVER = 1,
973 VNIC_RESET_NON_FATAL,
975 VNIC_RESET_CHANGE_PARAM};
978 enum ibmvnic_reset_reason reset_reason;
979 struct list_head list;
982 struct ibmvnic_tunables {
991 struct ibmvnic_adapter {
992 struct vio_dev *vdev;
993 struct net_device *netdev;
994 struct ibmvnic_crq_queue crq;
995 u8 mac_addr[ETH_ALEN];
996 struct ibmvnic_query_ip_offload_buffer ip_offload_buf;
997 dma_addr_t ip_offload_tok;
998 struct ibmvnic_control_ip_offload_buffer ip_offload_ctrl;
999 dma_addr_t ip_offload_ctrl_tok;
1002 /* Vital Product Data (VPD) */
1003 struct ibmvnic_vpd *vpd;
1004 char fw_version[32];
1007 struct ibmvnic_statistics stats;
1008 dma_addr_t stats_token;
1009 struct completion stats_done;
1010 spinlock_t stats_lock;
1011 int replenish_no_mem;
1012 int replenish_add_buff_success;
1013 int replenish_add_buff_failure;
1014 int replenish_task_cycles;
1018 struct ibmvnic_tx_queue_stats *tx_stats_buffers;
1019 struct ibmvnic_rx_queue_stats *rx_stats_buffers;
1021 int phys_link_state;
1022 int logical_link_state;
1025 struct ibmvnic_login_buffer *login_buf;
1026 dma_addr_t login_buf_token;
1029 struct ibmvnic_login_rsp_buffer *login_rsp_buf;
1030 dma_addr_t login_rsp_buf_token;
1031 int login_rsp_buf_sz;
1033 atomic_t running_cap_crqs;
1034 bool wait_capability;
1036 struct ibmvnic_sub_crq_queue **tx_scrq;
1037 struct ibmvnic_sub_crq_queue **rx_scrq;
1040 struct napi_struct *napi;
1041 struct ibmvnic_rx_pool *rx_pool;
1044 struct ibmvnic_tx_pool *tx_pool;
1045 struct ibmvnic_tx_pool *tso_pool;
1046 struct completion init_done;
1049 struct list_head errors;
1050 spinlock_t error_list_lock;
1052 struct completion fw_done;
1055 struct completion reset_done;
1057 bool wait_for_reset;
1059 /* partner capabilities */
1062 u64 min_rx_add_queues;
1065 u64 max_rx_add_queues;
1068 u64 req_rx_add_queues;
1069 u64 min_tx_entries_per_subcrq;
1070 u64 min_rx_add_entries_per_subcrq;
1071 u64 max_tx_entries_per_subcrq;
1072 u64 max_rx_add_entries_per_subcrq;
1073 u64 req_tx_entries_per_subcrq;
1074 u64 req_rx_add_entries_per_subcrq;
1076 u64 promisc_requested;
1077 u64 promisc_supported;
1081 u64 max_multicast_filters;
1082 u64 vlan_header_insertion;
1083 u64 rx_vlan_header_insertion;
1084 u64 max_tx_sg_entries;
1085 u64 rx_sg_supported;
1086 u64 rx_sg_requested;
1087 u64 opt_tx_comp_sub_queues;
1088 u64 opt_rx_comp_queues;
1089 u64 opt_rx_bufadd_q_per_rx_comp_q;
1090 u64 opt_tx_entries_per_subcrq;
1091 u64 opt_rxba_entries_per_subcrq;
1092 __be64 tx_rx_desc_req;
1094 u32 num_active_rx_scrqs;
1095 u32 num_active_rx_pools;
1096 u32 num_active_rx_napi;
1097 u32 num_active_tx_scrqs;
1098 u32 num_active_tx_pools;
1100 struct tasklet_struct tasklet;
1101 enum vnic_state state;
1102 enum ibmvnic_reset_reason reset_reason;
1103 struct mutex reset_lock, rwi_lock;
1104 struct list_head rwi_list;
1105 struct work_struct ibmvnic_reset;
1107 bool napi_enabled, from_passive_init;
1109 bool mac_change_pending;
1110 bool failover_pending;
1112 struct ibmvnic_tunables desired;
1113 struct ibmvnic_tunables fallback;