diff options
author | Anirban Chakraborty <anirban.chakraborty@qlogic.com> | 2011-04-01 10:28:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-06 15:47:11 -0400 |
commit | b1fc6d3cfaff6fefd838b84532cb356f8a80da7b (patch) | |
tree | cb453fc6ff25043aac738d84a56a9fd65a8715eb /drivers/net/qlcnic | |
parent | f848d6dd10e8e27d5dd61a8ab7174a7dde3a3db5 (diff) |
qlcnic: Cleanup patch
1. Changed adapter structure to move away from embedding hardware and
receive context structs and use pointers to those objects
2. Packed all the structs that interface with FW
3. Removed unused code and structs
Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic')
-rw-r--r-- | drivers/net/qlcnic/qlcnic.h | 126 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_ctx.c | 135 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_ethtool.c | 40 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_hw.c | 56 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_init.c | 26 | ||||
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 158 |
6 files changed, 268 insertions, 273 deletions
diff --git a/drivers/net/qlcnic/qlcnic.h b/drivers/net/qlcnic/qlcnic.h index dc44564ef6f9..15d950a4f46d 100644 --- a/drivers/net/qlcnic/qlcnic.h +++ b/drivers/net/qlcnic/qlcnic.h | |||
@@ -93,8 +93,6 @@ | |||
93 | #define TX_IP_PKT 0x04 | 93 | #define TX_IP_PKT 0x04 |
94 | #define TX_TCP_LSO 0x05 | 94 | #define TX_TCP_LSO 0x05 |
95 | #define TX_TCP_LSO6 0x06 | 95 | #define TX_TCP_LSO6 0x06 |
96 | #define TX_IPSEC 0x07 | ||
97 | #define TX_IPSEC_CMD 0x0a | ||
98 | #define TX_TCPV6_PKT 0x0b | 96 | #define TX_TCPV6_PKT 0x0b |
99 | #define TX_UDPV6_PKT 0x0c | 97 | #define TX_UDPV6_PKT 0x0c |
100 | 98 | ||
@@ -200,7 +198,7 @@ struct rcv_desc { | |||
200 | __le16 reserved; | 198 | __le16 reserved; |
201 | __le32 buffer_length; /* allocated buffer length (usually 2K) */ | 199 | __le32 buffer_length; /* allocated buffer length (usually 2K) */ |
202 | __le64 addr_buffer; | 200 | __le64 addr_buffer; |
203 | }; | 201 | } __packed; |
204 | 202 | ||
205 | /* opcode field in status_desc */ | 203 | /* opcode field in status_desc */ |
206 | #define QLCNIC_SYN_OFFLOAD 0x03 | 204 | #define QLCNIC_SYN_OFFLOAD 0x03 |
@@ -365,12 +363,6 @@ struct qlcnic_skb_frag { | |||
365 | u64 length; | 363 | u64 length; |
366 | }; | 364 | }; |
367 | 365 | ||
368 | struct qlcnic_recv_crb { | ||
369 | u32 crb_rcv_producer[NUM_RCV_DESC_RINGS]; | ||
370 | u32 crb_sts_consumer[NUM_STS_DESC_RINGS]; | ||
371 | u32 sw_int_mask[NUM_STS_DESC_RINGS]; | ||
372 | }; | ||
373 | |||
374 | /* Following defines are for the state of the buffers */ | 366 | /* Following defines are for the state of the buffers */ |
375 | #define QLCNIC_BUFFER_FREE 0 | 367 | #define QLCNIC_BUFFER_FREE 0 |
376 | #define QLCNIC_BUFFER_BUSY 1 | 368 | #define QLCNIC_BUFFER_BUSY 1 |
@@ -387,10 +379,10 @@ struct qlcnic_cmd_buffer { | |||
387 | 379 | ||
388 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ | 380 | /* In rx_buffer, we do not need multiple fragments as is a single buffer */ |
389 | struct qlcnic_rx_buffer { | 381 | struct qlcnic_rx_buffer { |
390 | struct list_head list; | 382 | u16 ref_handle; |
391 | struct sk_buff *skb; | 383 | struct sk_buff *skb; |
384 | struct list_head list; | ||
392 | u64 dma; | 385 | u64 dma; |
393 | u16 ref_handle; | ||
394 | }; | 386 | }; |
395 | 387 | ||
396 | /* Board types */ | 388 | /* Board types */ |
@@ -494,12 +486,12 @@ struct qlcnic_host_tx_ring { | |||
494 | * present elsewhere. | 486 | * present elsewhere. |
495 | */ | 487 | */ |
496 | struct qlcnic_recv_context { | 488 | struct qlcnic_recv_context { |
489 | struct qlcnic_host_rds_ring *rds_rings; | ||
490 | struct qlcnic_host_sds_ring *sds_rings; | ||
497 | u32 state; | 491 | u32 state; |
498 | u16 context_id; | 492 | u16 context_id; |
499 | u16 virt_port; | 493 | u16 virt_port; |
500 | 494 | ||
501 | struct qlcnic_host_rds_ring *rds_rings; | ||
502 | struct qlcnic_host_sds_ring *sds_rings; | ||
503 | }; | 495 | }; |
504 | 496 | ||
505 | /* HW context creation */ | 497 | /* HW context creation */ |
@@ -538,9 +530,6 @@ struct qlcnic_recv_context { | |||
538 | #define QLCNIC_CDRP_CMD_DESTROY_RX_CTX 0x00000008 | 530 | #define QLCNIC_CDRP_CMD_DESTROY_RX_CTX 0x00000008 |
539 | #define QLCNIC_CDRP_CMD_CREATE_TX_CTX 0x00000009 | 531 | #define QLCNIC_CDRP_CMD_CREATE_TX_CTX 0x00000009 |
540 | #define QLCNIC_CDRP_CMD_DESTROY_TX_CTX 0x0000000a | 532 | #define QLCNIC_CDRP_CMD_DESTROY_TX_CTX 0x0000000a |
541 | #define QLCNIC_CDRP_CMD_SETUP_STATISTICS 0x0000000e | ||
542 | #define QLCNIC_CDRP_CMD_GET_STATISTICS 0x0000000f | ||
543 | #define QLCNIC_CDRP_CMD_DELETE_STATISTICS 0x00000010 | ||
544 | #define QLCNIC_CDRP_CMD_SET_MTU 0x00000012 | 533 | #define QLCNIC_CDRP_CMD_SET_MTU 0x00000012 |
545 | #define QLCNIC_CDRP_CMD_READ_PHY 0x00000013 | 534 | #define QLCNIC_CDRP_CMD_READ_PHY 0x00000013 |
546 | #define QLCNIC_CDRP_CMD_WRITE_PHY 0x00000014 | 535 | #define QLCNIC_CDRP_CMD_WRITE_PHY 0x00000014 |
@@ -549,17 +538,11 @@ struct qlcnic_recv_context { | |||
549 | #define QLCNIC_CDRP_CMD_SET_FLOW_CTL 0x00000017 | 538 | #define QLCNIC_CDRP_CMD_SET_FLOW_CTL 0x00000017 |
550 | #define QLCNIC_CDRP_CMD_READ_MAX_MTU 0x00000018 | 539 | #define QLCNIC_CDRP_CMD_READ_MAX_MTU 0x00000018 |
551 | #define QLCNIC_CDRP_CMD_READ_MAX_LRO 0x00000019 | 540 | #define QLCNIC_CDRP_CMD_READ_MAX_LRO 0x00000019 |
552 | #define QLCNIC_CDRP_CMD_CONFIGURE_TOE 0x0000001a | ||
553 | #define QLCNIC_CDRP_CMD_FUNC_ATTRIB 0x0000001b | ||
554 | #define QLCNIC_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c | ||
555 | #define QLCNIC_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d | ||
556 | #define QLCNIC_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e | ||
557 | #define QLCNIC_CDRP_CMD_MAC_ADDRESS 0x0000001f | 541 | #define QLCNIC_CDRP_CMD_MAC_ADDRESS 0x0000001f |
558 | 542 | ||
559 | #define QLCNIC_CDRP_CMD_GET_PCI_INFO 0x00000020 | 543 | #define QLCNIC_CDRP_CMD_GET_PCI_INFO 0x00000020 |
560 | #define QLCNIC_CDRP_CMD_GET_NIC_INFO 0x00000021 | 544 | #define QLCNIC_CDRP_CMD_GET_NIC_INFO 0x00000021 |
561 | #define QLCNIC_CDRP_CMD_SET_NIC_INFO 0x00000022 | 545 | #define QLCNIC_CDRP_CMD_SET_NIC_INFO 0x00000022 |
562 | #define QLCNIC_CDRP_CMD_RESET_NPAR 0x00000023 | ||
563 | #define QLCNIC_CDRP_CMD_GET_ESWITCH_CAPABILITY 0x00000024 | 546 | #define QLCNIC_CDRP_CMD_GET_ESWITCH_CAPABILITY 0x00000024 |
564 | #define QLCNIC_CDRP_CMD_TOGGLE_ESWITCH 0x00000025 | 547 | #define QLCNIC_CDRP_CMD_TOGGLE_ESWITCH 0x00000025 |
565 | #define QLCNIC_CDRP_CMD_GET_ESWITCH_STATUS 0x00000026 | 548 | #define QLCNIC_CDRP_CMD_GET_ESWITCH_STATUS 0x00000026 |
@@ -597,14 +580,14 @@ struct qlcnic_hostrq_sds_ring { | |||
597 | __le32 ring_size; /* Ring entries */ | 580 | __le32 ring_size; /* Ring entries */ |
598 | __le16 msi_index; | 581 | __le16 msi_index; |
599 | __le16 rsvd; /* Padding */ | 582 | __le16 rsvd; /* Padding */ |
600 | }; | 583 | } __packed; |
601 | 584 | ||
602 | struct qlcnic_hostrq_rds_ring { | 585 | struct qlcnic_hostrq_rds_ring { |
603 | __le64 host_phys_addr; /* Ring base addr */ | 586 | __le64 host_phys_addr; /* Ring base addr */ |
604 | __le64 buff_size; /* Packet buffer size */ | 587 | __le64 buff_size; /* Packet buffer size */ |
605 | __le32 ring_size; /* Ring entries */ | 588 | __le32 ring_size; /* Ring entries */ |
606 | __le32 ring_kind; /* Class of ring */ | 589 | __le32 ring_kind; /* Class of ring */ |
607 | }; | 590 | } __packed; |
608 | 591 | ||
609 | struct qlcnic_hostrq_rx_ctx { | 592 | struct qlcnic_hostrq_rx_ctx { |
610 | __le64 host_rsp_dma_addr; /* Response dma'd here */ | 593 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
@@ -625,17 +608,17 @@ struct qlcnic_hostrq_rx_ctx { | |||
625 | - N hostrq_rds_rings | 608 | - N hostrq_rds_rings |
626 | - N hostrq_sds_rings */ | 609 | - N hostrq_sds_rings */ |
627 | char data[0]; | 610 | char data[0]; |
628 | }; | 611 | } __packed; |
629 | 612 | ||
630 | struct qlcnic_cardrsp_rds_ring{ | 613 | struct qlcnic_cardrsp_rds_ring{ |
631 | __le32 host_producer_crb; /* Crb to use */ | 614 | __le32 host_producer_crb; /* Crb to use */ |
632 | __le32 rsvd1; /* Padding */ | 615 | __le32 rsvd1; /* Padding */ |
633 | }; | 616 | } __packed; |
634 | 617 | ||
635 | struct qlcnic_cardrsp_sds_ring { | 618 | struct qlcnic_cardrsp_sds_ring { |
636 | __le32 host_consumer_crb; /* Crb to use */ | 619 | __le32 host_consumer_crb; /* Crb to use */ |
637 | __le32 interrupt_crb; /* Crb to use */ | 620 | __le32 interrupt_crb; /* Crb to use */ |
638 | }; | 621 | } __packed; |
639 | 622 | ||
640 | struct qlcnic_cardrsp_rx_ctx { | 623 | struct qlcnic_cardrsp_rx_ctx { |
641 | /* These ring offsets are relative to data[0] below */ | 624 | /* These ring offsets are relative to data[0] below */ |
@@ -654,7 +637,7 @@ struct qlcnic_cardrsp_rx_ctx { | |||
654 | - N cardrsp_rds_rings | 637 | - N cardrsp_rds_rings |
655 | - N cardrs_sds_rings */ | 638 | - N cardrs_sds_rings */ |
656 | char data[0]; | 639 | char data[0]; |
657 | }; | 640 | } __packed; |
658 | 641 | ||
659 | #define SIZEOF_HOSTRQ_RX(HOSTRQ_RX, rds_rings, sds_rings) \ | 642 | #define SIZEOF_HOSTRQ_RX(HOSTRQ_RX, rds_rings, sds_rings) \ |
660 | (sizeof(HOSTRQ_RX) + \ | 643 | (sizeof(HOSTRQ_RX) + \ |
@@ -674,7 +657,7 @@ struct qlcnic_hostrq_cds_ring { | |||
674 | __le64 host_phys_addr; /* Ring base addr */ | 657 | __le64 host_phys_addr; /* Ring base addr */ |
675 | __le32 ring_size; /* Ring entries */ | 658 | __le32 ring_size; /* Ring entries */ |
676 | __le32 rsvd; /* Padding */ | 659 | __le32 rsvd; /* Padding */ |
677 | }; | 660 | } __packed; |
678 | 661 | ||
679 | struct qlcnic_hostrq_tx_ctx { | 662 | struct qlcnic_hostrq_tx_ctx { |
680 | __le64 host_rsp_dma_addr; /* Response dma'd here */ | 663 | __le64 host_rsp_dma_addr; /* Response dma'd here */ |
@@ -689,12 +672,12 @@ struct qlcnic_hostrq_tx_ctx { | |||
689 | __le16 rsvd3; /* Padding */ | 672 | __le16 rsvd3; /* Padding */ |
690 | struct qlcnic_hostrq_cds_ring cds_ring; /* Desc of cds ring */ | 673 | struct qlcnic_hostrq_cds_ring cds_ring; /* Desc of cds ring */ |
691 | u8 reserved[128]; /* future expansion */ | 674 | u8 reserved[128]; /* future expansion */ |
692 | }; | 675 | } __packed; |
693 | 676 | ||
694 | struct qlcnic_cardrsp_cds_ring { | 677 | struct qlcnic_cardrsp_cds_ring { |
695 | __le32 host_producer_crb; /* Crb to use */ | 678 | __le32 host_producer_crb; /* Crb to use */ |
696 | __le32 interrupt_crb; /* Crb to use */ | 679 | __le32 interrupt_crb; /* Crb to use */ |
697 | }; | 680 | } __packed; |
698 | 681 | ||
699 | struct qlcnic_cardrsp_tx_ctx { | 682 | struct qlcnic_cardrsp_tx_ctx { |
700 | __le32 host_ctx_state; /* Starting state */ | 683 | __le32 host_ctx_state; /* Starting state */ |
@@ -703,7 +686,7 @@ struct qlcnic_cardrsp_tx_ctx { | |||
703 | u8 virt_port; /* Virtual/Logical id of port */ | 686 | u8 virt_port; /* Virtual/Logical id of port */ |
704 | struct qlcnic_cardrsp_cds_ring cds_ring; /* Card cds settings */ | 687 | struct qlcnic_cardrsp_cds_ring cds_ring; /* Card cds settings */ |
705 | u8 reserved[128]; /* future expansion */ | 688 | u8 reserved[128]; /* future expansion */ |
706 | }; | 689 | } __packed; |
707 | 690 | ||
708 | #define SIZEOF_HOSTRQ_TX(HOSTRQ_TX) (sizeof(HOSTRQ_TX)) | 691 | #define SIZEOF_HOSTRQ_TX(HOSTRQ_TX) (sizeof(HOSTRQ_TX)) |
709 | #define SIZEOF_CARDRSP_TX(CARDRSP_TX) (sizeof(CARDRSP_TX)) | 692 | #define SIZEOF_CARDRSP_TX(CARDRSP_TX) (sizeof(CARDRSP_TX)) |
@@ -782,50 +765,20 @@ struct qlcnic_nic_intr_coalesce { | |||
782 | /* | 765 | /* |
783 | * Driver --> Firmware | 766 | * Driver --> Firmware |
784 | */ | 767 | */ |
785 | #define QLCNIC_H2C_OPCODE_START 0 | 768 | #define QLCNIC_H2C_OPCODE_CONFIG_RSS 0x1 |
786 | #define QLCNIC_H2C_OPCODE_CONFIG_RSS 1 | 769 | #define QLCNIC_H2C_OPCODE_CONFIG_INTR_COALESCE 0x3 |
787 | #define QLCNIC_H2C_OPCODE_CONFIG_RSS_TBL 2 | 770 | #define QLCNIC_H2C_OPCODE_CONFIG_LED 0x4 |
788 | #define QLCNIC_H2C_OPCODE_CONFIG_INTR_COALESCE 3 | 771 | #define QLCNIC_H2C_OPCODE_LRO_REQUEST 0x7 |
789 | #define QLCNIC_H2C_OPCODE_CONFIG_LED 4 | 772 | #define QLCNIC_H2C_OPCODE_SET_MAC_RECEIVE_MODE 0xc |
790 | #define QLCNIC_H2C_OPCODE_CONFIG_PROMISCUOUS 5 | 773 | #define QLCNIC_H2C_OPCODE_CONFIG_IPADDR 0x12 |
791 | #define QLCNIC_H2C_OPCODE_CONFIG_L2_MAC 6 | 774 | #define QLCNIC_H2C_OPCODE_GET_LINKEVENT 0x15 |
792 | #define QLCNIC_H2C_OPCODE_LRO_REQUEST 7 | 775 | #define QLCNIC_H2C_OPCODE_CONFIG_BRIDGING 0x17 |
793 | #define QLCNIC_H2C_OPCODE_GET_SNMP_STATS 8 | 776 | #define QLCNIC_H2C_OPCODE_CONFIG_HW_LRO 0x18 |
794 | #define QLCNIC_H2C_OPCODE_PROXY_START_REQUEST 9 | ||
795 | #define QLCNIC_H2C_OPCODE_PROXY_STOP_REQUEST 10 | ||
796 | #define QLCNIC_H2C_OPCODE_PROXY_SET_MTU 11 | ||
797 | #define QLCNIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE 12 | ||
798 | #define QLCNIC_H2C_OPCODE_GET_FINGER_PRINT_REQUEST 13 | ||
799 | #define QLCNIC_H2C_OPCODE_INSTALL_LICENSE_REQUEST 14 | ||
800 | #define QLCNIC_H2C_OPCODE_GET_LICENSE_CAPABILITY_REQUEST 15 | ||
801 | #define QLCNIC_H2C_OPCODE_GET_NET_STATS 16 | ||
802 | #define QLCNIC_H2C_OPCODE_PROXY_UPDATE_P2V 17 | ||
803 | #define QLCNIC_H2C_OPCODE_CONFIG_IPADDR 18 | ||
804 | #define QLCNIC_H2C_OPCODE_PROXY_STOP_DONE 20 | ||
805 | #define QLCNIC_H2C_OPCODE_GET_LINKEVENT 21 | ||
806 | #define QLCNIC_C2C_OPCODE 22 | ||
807 | #define QLCNIC_H2C_OPCODE_CONFIG_BRIDGING 23 | ||
808 | #define QLCNIC_H2C_OPCODE_CONFIG_HW_LRO 24 | ||
809 | #define QLCNIC_H2C_OPCODE_LAST 25 | ||
810 | /* | 777 | /* |
811 | * Firmware --> Driver | 778 | * Firmware --> Driver |
812 | */ | 779 | */ |
813 | 780 | ||
814 | #define QLCNIC_C2H_OPCODE_START 128 | ||
815 | #define QLCNIC_C2H_OPCODE_CONFIG_RSS_RESPONSE 129 | ||
816 | #define QLCNIC_C2H_OPCODE_CONFIG_RSS_TBL_RESPONSE 130 | ||
817 | #define QLCNIC_C2H_OPCODE_CONFIG_MAC_RESPONSE 131 | ||
818 | #define QLCNIC_C2H_OPCODE_CONFIG_PROMISCUOUS_RESPONSE 132 | ||
819 | #define QLCNIC_C2H_OPCODE_CONFIG_L2_MAC_RESPONSE 133 | ||
820 | #define QLCNIC_C2H_OPCODE_LRO_DELETE_RESPONSE 134 | ||
821 | #define QLCNIC_C2H_OPCODE_LRO_ADD_FAILURE_RESPONSE 135 | ||
822 | #define QLCNIC_C2H_OPCODE_GET_SNMP_STATS 136 | ||
823 | #define QLCNIC_C2H_OPCODE_GET_FINGER_PRINT_REPLY 137 | ||
824 | #define QLCNIC_C2H_OPCODE_INSTALL_LICENSE_REPLY 138 | ||
825 | #define QLCNIC_C2H_OPCODE_GET_LICENSE_CAPABILITIES_REPLY 139 | ||
826 | #define QLCNIC_C2H_OPCODE_GET_NET_STATS_RESPONSE 140 | ||
827 | #define QLCNIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE 141 | 781 | #define QLCNIC_C2H_OPCODE_GET_LINKEVENT_RESPONSE 141 |
828 | #define QLCNIC_C2H_OPCODE_LAST 142 | ||
829 | 782 | ||
830 | #define VPORT_MISS_MODE_DROP 0 /* drop all unmatched */ | 783 | #define VPORT_MISS_MODE_DROP 0 /* drop all unmatched */ |
831 | #define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */ | 784 | #define VPORT_MISS_MODE_ACCEPT_ALL 1 /* accept all packets */ |
@@ -894,7 +847,7 @@ struct qlcnic_nic_req { | |||
894 | __le64 qhdr; | 847 | __le64 qhdr; |
895 | __le64 req_hdr; | 848 | __le64 req_hdr; |
896 | __le64 words[6]; | 849 | __le64 words[6]; |
897 | }; | 850 | } __packed; |
898 | 851 | ||
899 | struct qlcnic_mac_req { | 852 | struct qlcnic_mac_req { |
900 | u8 op; | 853 | u8 op; |
@@ -905,7 +858,7 @@ struct qlcnic_mac_req { | |||
905 | struct qlcnic_vlan_req { | 858 | struct qlcnic_vlan_req { |
906 | __le16 vlan_id; | 859 | __le16 vlan_id; |
907 | __le16 rsvd[3]; | 860 | __le16 rsvd[3]; |
908 | }; | 861 | } __packed; |
909 | 862 | ||
910 | struct qlcnic_ipaddr { | 863 | struct qlcnic_ipaddr { |
911 | __be32 ipv4; | 864 | __be32 ipv4; |
@@ -964,14 +917,14 @@ struct qlcnic_filter_hash { | |||
964 | }; | 917 | }; |
965 | 918 | ||
966 | struct qlcnic_adapter { | 919 | struct qlcnic_adapter { |
967 | struct qlcnic_hardware_context ahw; | 920 | struct qlcnic_hardware_context *ahw; |
968 | 921 | struct qlcnic_recv_context *recv_ctx; | |
922 | struct qlcnic_host_tx_ring *tx_ring; | ||
969 | struct net_device *netdev; | 923 | struct net_device *netdev; |
970 | struct pci_dev *pdev; | 924 | struct pci_dev *pdev; |
971 | struct list_head mac_list; | ||
972 | 925 | ||
973 | spinlock_t tx_clean_lock; | 926 | unsigned long state; |
974 | spinlock_t mac_learn_lock; | 927 | u32 flags; |
975 | 928 | ||
976 | u16 num_txd; | 929 | u16 num_txd; |
977 | u16 num_rxd; | 930 | u16 num_rxd; |
@@ -989,7 +942,6 @@ struct qlcnic_adapter { | |||
989 | 942 | ||
990 | u8 mc_enabled; | 943 | u8 mc_enabled; |
991 | u8 max_mc_count; | 944 | u8 max_mc_count; |
992 | u8 rss_supported; | ||
993 | u8 fw_wait_cnt; | 945 | u8 fw_wait_cnt; |
994 | u8 fw_fail_cnt; | 946 | u8 fw_fail_cnt; |
995 | u8 tx_timeo_cnt; | 947 | u8 tx_timeo_cnt; |
@@ -1014,7 +966,6 @@ struct qlcnic_adapter { | |||
1014 | 966 | ||
1015 | u32 fw_hal_version; | 967 | u32 fw_hal_version; |
1016 | u32 capabilities; | 968 | u32 capabilities; |
1017 | u32 flags; | ||
1018 | u32 irq; | 969 | u32 irq; |
1019 | u32 temp; | 970 | u32 temp; |
1020 | 971 | ||
@@ -1039,9 +990,7 @@ struct qlcnic_adapter { | |||
1039 | struct qlcnic_nic_template *nic_ops; | 990 | struct qlcnic_nic_template *nic_ops; |
1040 | 991 | ||
1041 | struct qlcnic_adapter_stats stats; | 992 | struct qlcnic_adapter_stats stats; |
1042 | 993 | struct list_head mac_list; | |
1043 | struct qlcnic_recv_context recv_ctx; | ||
1044 | struct qlcnic_host_tx_ring *tx_ring; | ||
1045 | 994 | ||
1046 | void __iomem *tgt_mask_reg; | 995 | void __iomem *tgt_mask_reg; |
1047 | void __iomem *tgt_status_reg; | 996 | void __iomem *tgt_status_reg; |
@@ -1056,7 +1005,8 @@ struct qlcnic_adapter { | |||
1056 | 1005 | ||
1057 | struct qlcnic_filter_hash fhash; | 1006 | struct qlcnic_filter_hash fhash; |
1058 | 1007 | ||
1059 | unsigned long state; | 1008 | spinlock_t tx_clean_lock; |
1009 | spinlock_t mac_learn_lock; | ||
1060 | __le32 file_prd_off; /*File fw product offset*/ | 1010 | __le32 file_prd_off; /*File fw product offset*/ |
1061 | u32 fw_version; | 1011 | u32 fw_version; |
1062 | const struct firmware *fw; | 1012 | const struct firmware *fw; |
@@ -1078,7 +1028,7 @@ struct qlcnic_info { | |||
1078 | __le16 min_tx_bw; | 1028 | __le16 min_tx_bw; |
1079 | __le16 max_tx_bw; | 1029 | __le16 max_tx_bw; |
1080 | u8 reserved2[104]; | 1030 | u8 reserved2[104]; |
1081 | }; | 1031 | } __packed; |
1082 | 1032 | ||
1083 | struct qlcnic_pci_info { | 1033 | struct qlcnic_pci_info { |
1084 | __le16 id; /* pci function id */ | 1034 | __le16 id; /* pci function id */ |
@@ -1092,7 +1042,7 @@ struct qlcnic_pci_info { | |||
1092 | 1042 | ||
1093 | u8 mac[ETH_ALEN]; | 1043 | u8 mac[ETH_ALEN]; |
1094 | u8 reserved2[106]; | 1044 | u8 reserved2[106]; |
1095 | }; | 1045 | } __packed; |
1096 | 1046 | ||
1097 | struct qlcnic_npar_info { | 1047 | struct qlcnic_npar_info { |
1098 | u16 pvid; | 1048 | u16 pvid; |
@@ -1209,7 +1159,7 @@ struct __qlcnic_esw_statistics { | |||
1209 | __le64 local_frames; | 1159 | __le64 local_frames; |
1210 | __le64 numbytes; | 1160 | __le64 numbytes; |
1211 | __le64 rsvd[3]; | 1161 | __le64 rsvd[3]; |
1212 | }; | 1162 | } __packed; |
1213 | 1163 | ||
1214 | struct qlcnic_esw_statistics { | 1164 | struct qlcnic_esw_statistics { |
1215 | struct __qlcnic_esw_statistics rx; | 1165 | struct __qlcnic_esw_statistics rx; |
@@ -1293,7 +1243,7 @@ void qlcnic_release_tx_buffers(struct qlcnic_adapter *adapter); | |||
1293 | 1243 | ||
1294 | int qlcnic_check_fw_status(struct qlcnic_adapter *adapter); | 1244 | int qlcnic_check_fw_status(struct qlcnic_adapter *adapter); |
1295 | void qlcnic_watchdog_task(struct work_struct *work); | 1245 | void qlcnic_watchdog_task(struct work_struct *work); |
1296 | void qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, | 1246 | void qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, |
1297 | struct qlcnic_host_rds_ring *rds_ring); | 1247 | struct qlcnic_host_rds_ring *rds_ring); |
1298 | int qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max); | 1248 | int qlcnic_process_rcv_ring(struct qlcnic_host_sds_ring *sds_ring, int max); |
1299 | void qlcnic_set_multi(struct net_device *netdev); | 1249 | void qlcnic_set_multi(struct net_device *netdev); |
diff --git a/drivers/net/qlcnic/qlcnic_ctx.c b/drivers/net/qlcnic/qlcnic_ctx.c index 27631f23b3fd..050fa5a99ff7 100644 --- a/drivers/net/qlcnic/qlcnic_ctx.c +++ b/drivers/net/qlcnic/qlcnic_ctx.c | |||
@@ -67,11 +67,11 @@ qlcnic_issue_cmd(struct qlcnic_adapter *adapter, | |||
67 | int | 67 | int |
68 | qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu) | 68 | qlcnic_fw_cmd_set_mtu(struct qlcnic_adapter *adapter, int mtu) |
69 | { | 69 | { |
70 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 70 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
71 | 71 | ||
72 | if (recv_ctx->state == QLCNIC_HOST_CTX_STATE_ACTIVE) { | 72 | if (recv_ctx->state == QLCNIC_HOST_CTX_STATE_ACTIVE) { |
73 | if (qlcnic_issue_cmd(adapter, | 73 | if (qlcnic_issue_cmd(adapter, |
74 | adapter->ahw.pci_func, | 74 | adapter->ahw->pci_func, |
75 | adapter->fw_hal_version, | 75 | adapter->fw_hal_version, |
76 | recv_ctx->context_id, | 76 | recv_ctx->context_id, |
77 | mtu, | 77 | mtu, |
@@ -102,12 +102,12 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
102 | dma_addr_t hostrq_phys_addr, cardrsp_phys_addr; | 102 | dma_addr_t hostrq_phys_addr, cardrsp_phys_addr; |
103 | u64 phys_addr; | 103 | u64 phys_addr; |
104 | 104 | ||
105 | int i, nrds_rings, nsds_rings; | 105 | u8 i, nrds_rings, nsds_rings; |
106 | size_t rq_size, rsp_size; | 106 | size_t rq_size, rsp_size; |
107 | u32 cap, reg, val, reg2; | 107 | u32 cap, reg, val, reg2; |
108 | int err; | 108 | int err; |
109 | 109 | ||
110 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 110 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
111 | 111 | ||
112 | nrds_rings = adapter->max_rds_rings; | 112 | nrds_rings = adapter->max_rds_rings; |
113 | nsds_rings = adapter->max_sds_rings; | 113 | nsds_rings = adapter->max_sds_rings; |
@@ -119,14 +119,14 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
119 | SIZEOF_CARDRSP_RX(struct qlcnic_cardrsp_rx_ctx, nrds_rings, | 119 | SIZEOF_CARDRSP_RX(struct qlcnic_cardrsp_rx_ctx, nrds_rings, |
120 | nsds_rings); | 120 | nsds_rings); |
121 | 121 | ||
122 | addr = pci_alloc_consistent(adapter->pdev, | 122 | addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size, |
123 | rq_size, &hostrq_phys_addr); | 123 | &hostrq_phys_addr, GFP_KERNEL); |
124 | if (addr == NULL) | 124 | if (addr == NULL) |
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | prq = (struct qlcnic_hostrq_rx_ctx *)addr; | 126 | prq = (struct qlcnic_hostrq_rx_ctx *)addr; |
127 | 127 | ||
128 | addr = pci_alloc_consistent(adapter->pdev, | 128 | addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size, |
129 | rsp_size, &cardrsp_phys_addr); | 129 | &cardrsp_phys_addr, GFP_KERNEL); |
130 | if (addr == NULL) { | 130 | if (addr == NULL) { |
131 | err = -ENOMEM; | 131 | err = -ENOMEM; |
132 | goto out_free_rq; | 132 | goto out_free_rq; |
@@ -151,7 +151,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
151 | 151 | ||
152 | prq->num_rds_rings = cpu_to_le16(nrds_rings); | 152 | prq->num_rds_rings = cpu_to_le16(nrds_rings); |
153 | prq->num_sds_rings = cpu_to_le16(nsds_rings); | 153 | prq->num_sds_rings = cpu_to_le16(nsds_rings); |
154 | prq->rds_ring_offset = cpu_to_le32(0); | 154 | prq->rds_ring_offset = 0; |
155 | 155 | ||
156 | val = le32_to_cpu(prq->rds_ring_offset) + | 156 | val = le32_to_cpu(prq->rds_ring_offset) + |
157 | (sizeof(struct qlcnic_hostrq_rds_ring) * nrds_rings); | 157 | (sizeof(struct qlcnic_hostrq_rds_ring) * nrds_rings); |
@@ -187,7 +187,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
187 | 187 | ||
188 | phys_addr = hostrq_phys_addr; | 188 | phys_addr = hostrq_phys_addr; |
189 | err = qlcnic_issue_cmd(adapter, | 189 | err = qlcnic_issue_cmd(adapter, |
190 | adapter->ahw.pci_func, | 190 | adapter->ahw->pci_func, |
191 | adapter->fw_hal_version, | 191 | adapter->fw_hal_version, |
192 | (u32)(phys_addr >> 32), | 192 | (u32)(phys_addr >> 32), |
193 | (u32)(phys_addr & 0xffffffff), | 193 | (u32)(phys_addr & 0xffffffff), |
@@ -207,7 +207,7 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
207 | rds_ring = &recv_ctx->rds_rings[i]; | 207 | rds_ring = &recv_ctx->rds_rings[i]; |
208 | 208 | ||
209 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); | 209 | reg = le32_to_cpu(prsp_rds[i].host_producer_crb); |
210 | rds_ring->crb_rcv_producer = adapter->ahw.pci_base0 + reg; | 210 | rds_ring->crb_rcv_producer = adapter->ahw->pci_base0 + reg; |
211 | } | 211 | } |
212 | 212 | ||
213 | prsp_sds = ((struct qlcnic_cardrsp_sds_ring *) | 213 | prsp_sds = ((struct qlcnic_cardrsp_sds_ring *) |
@@ -219,8 +219,8 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
219 | reg = le32_to_cpu(prsp_sds[i].host_consumer_crb); | 219 | reg = le32_to_cpu(prsp_sds[i].host_consumer_crb); |
220 | reg2 = le32_to_cpu(prsp_sds[i].interrupt_crb); | 220 | reg2 = le32_to_cpu(prsp_sds[i].interrupt_crb); |
221 | 221 | ||
222 | sds_ring->crb_sts_consumer = adapter->ahw.pci_base0 + reg; | 222 | sds_ring->crb_sts_consumer = adapter->ahw->pci_base0 + reg; |
223 | sds_ring->crb_intr_mask = adapter->ahw.pci_base0 + reg2; | 223 | sds_ring->crb_intr_mask = adapter->ahw->pci_base0 + reg2; |
224 | } | 224 | } |
225 | 225 | ||
226 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); | 226 | recv_ctx->state = le32_to_cpu(prsp->host_ctx_state); |
@@ -228,19 +228,20 @@ qlcnic_fw_cmd_create_rx_ctx(struct qlcnic_adapter *adapter) | |||
228 | recv_ctx->virt_port = prsp->virt_port; | 228 | recv_ctx->virt_port = prsp->virt_port; |
229 | 229 | ||
230 | out_free_rsp: | 230 | out_free_rsp: |
231 | pci_free_consistent(adapter->pdev, rsp_size, prsp, cardrsp_phys_addr); | 231 | dma_free_coherent(&adapter->pdev->dev, rsp_size, prsp, |
232 | cardrsp_phys_addr); | ||
232 | out_free_rq: | 233 | out_free_rq: |
233 | pci_free_consistent(adapter->pdev, rq_size, prq, hostrq_phys_addr); | 234 | dma_free_coherent(&adapter->pdev->dev, rq_size, prq, hostrq_phys_addr); |
234 | return err; | 235 | return err; |
235 | } | 236 | } |
236 | 237 | ||
237 | static void | 238 | static void |
238 | qlcnic_fw_cmd_destroy_rx_ctx(struct qlcnic_adapter *adapter) | 239 | qlcnic_fw_cmd_destroy_rx_ctx(struct qlcnic_adapter *adapter) |
239 | { | 240 | { |
240 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 241 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
241 | 242 | ||
242 | if (qlcnic_issue_cmd(adapter, | 243 | if (qlcnic_issue_cmd(adapter, |
243 | adapter->ahw.pci_func, | 244 | adapter->ahw->pci_func, |
244 | adapter->fw_hal_version, | 245 | adapter->fw_hal_version, |
245 | recv_ctx->context_id, | 246 | recv_ctx->context_id, |
246 | QLCNIC_DESTROY_CTX_RESET, | 247 | QLCNIC_DESTROY_CTX_RESET, |
@@ -274,14 +275,14 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) | |||
274 | *(tx_ring->hw_consumer) = 0; | 275 | *(tx_ring->hw_consumer) = 0; |
275 | 276 | ||
276 | rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx); | 277 | rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx); |
277 | rq_addr = pci_alloc_consistent(adapter->pdev, | 278 | rq_addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size, |
278 | rq_size, &rq_phys_addr); | 279 | &rq_phys_addr, GFP_KERNEL); |
279 | if (!rq_addr) | 280 | if (!rq_addr) |
280 | return -ENOMEM; | 281 | return -ENOMEM; |
281 | 282 | ||
282 | rsp_size = SIZEOF_CARDRSP_TX(struct qlcnic_cardrsp_tx_ctx); | 283 | rsp_size = SIZEOF_CARDRSP_TX(struct qlcnic_cardrsp_tx_ctx); |
283 | rsp_addr = pci_alloc_consistent(adapter->pdev, | 284 | rsp_addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size, |
284 | rsp_size, &rsp_phys_addr); | 285 | &rsp_phys_addr, GFP_KERNEL); |
285 | if (!rsp_addr) { | 286 | if (!rsp_addr) { |
286 | err = -ENOMEM; | 287 | err = -ENOMEM; |
287 | goto out_free_rq; | 288 | goto out_free_rq; |
@@ -313,7 +314,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) | |||
313 | 314 | ||
314 | phys_addr = rq_phys_addr; | 315 | phys_addr = rq_phys_addr; |
315 | err = qlcnic_issue_cmd(adapter, | 316 | err = qlcnic_issue_cmd(adapter, |
316 | adapter->ahw.pci_func, | 317 | adapter->ahw->pci_func, |
317 | adapter->fw_hal_version, | 318 | adapter->fw_hal_version, |
318 | (u32)(phys_addr >> 32), | 319 | (u32)(phys_addr >> 32), |
319 | ((u32)phys_addr & 0xffffffff), | 320 | ((u32)phys_addr & 0xffffffff), |
@@ -322,7 +323,7 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) | |||
322 | 323 | ||
323 | if (err == QLCNIC_RCODE_SUCCESS) { | 324 | if (err == QLCNIC_RCODE_SUCCESS) { |
324 | temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); | 325 | temp = le32_to_cpu(prsp->cds_ring.host_producer_crb); |
325 | tx_ring->crb_cmd_producer = adapter->ahw.pci_base0 + temp; | 326 | tx_ring->crb_cmd_producer = adapter->ahw->pci_base0 + temp; |
326 | 327 | ||
327 | adapter->tx_context_id = | 328 | adapter->tx_context_id = |
328 | le16_to_cpu(prsp->context_id); | 329 | le16_to_cpu(prsp->context_id); |
@@ -332,10 +333,11 @@ qlcnic_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter) | |||
332 | err = -EIO; | 333 | err = -EIO; |
333 | } | 334 | } |
334 | 335 | ||
335 | pci_free_consistent(adapter->pdev, rsp_size, rsp_addr, rsp_phys_addr); | 336 | dma_free_coherent(&adapter->pdev->dev, rsp_size, rsp_addr, |
337 | rsp_phys_addr); | ||
336 | 338 | ||
337 | out_free_rq: | 339 | out_free_rq: |
338 | pci_free_consistent(adapter->pdev, rq_size, rq_addr, rq_phys_addr); | 340 | dma_free_coherent(&adapter->pdev->dev, rq_size, rq_addr, rq_phys_addr); |
339 | 341 | ||
340 | return err; | 342 | return err; |
341 | } | 343 | } |
@@ -344,7 +346,7 @@ static void | |||
344 | qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter) | 346 | qlcnic_fw_cmd_destroy_tx_ctx(struct qlcnic_adapter *adapter) |
345 | { | 347 | { |
346 | if (qlcnic_issue_cmd(adapter, | 348 | if (qlcnic_issue_cmd(adapter, |
347 | adapter->ahw.pci_func, | 349 | adapter->ahw->pci_func, |
348 | adapter->fw_hal_version, | 350 | adapter->fw_hal_version, |
349 | adapter->tx_context_id, | 351 | adapter->tx_context_id, |
350 | QLCNIC_DESTROY_CTX_RESET, | 352 | QLCNIC_DESTROY_CTX_RESET, |
@@ -361,7 +363,7 @@ qlcnic_fw_cmd_query_phy(struct qlcnic_adapter *adapter, u32 reg, u32 *val) | |||
361 | { | 363 | { |
362 | 364 | ||
363 | if (qlcnic_issue_cmd(adapter, | 365 | if (qlcnic_issue_cmd(adapter, |
364 | adapter->ahw.pci_func, | 366 | adapter->ahw->pci_func, |
365 | adapter->fw_hal_version, | 367 | adapter->fw_hal_version, |
366 | reg, | 368 | reg, |
367 | 0, | 369 | 0, |
@@ -378,7 +380,7 @@ int | |||
378 | qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val) | 380 | qlcnic_fw_cmd_set_phy(struct qlcnic_adapter *adapter, u32 reg, u32 val) |
379 | { | 381 | { |
380 | return qlcnic_issue_cmd(adapter, | 382 | return qlcnic_issue_cmd(adapter, |
381 | adapter->ahw.pci_func, | 383 | adapter->ahw->pci_func, |
382 | adapter->fw_hal_version, | 384 | adapter->fw_hal_version, |
383 | reg, | 385 | reg, |
384 | val, | 386 | val, |
@@ -398,20 +400,19 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) | |||
398 | 400 | ||
399 | struct pci_dev *pdev = adapter->pdev; | 401 | struct pci_dev *pdev = adapter->pdev; |
400 | 402 | ||
401 | recv_ctx = &adapter->recv_ctx; | 403 | recv_ctx = adapter->recv_ctx; |
402 | tx_ring = adapter->tx_ring; | 404 | tx_ring = adapter->tx_ring; |
403 | 405 | ||
404 | tx_ring->hw_consumer = (__le32 *)pci_alloc_consistent(pdev, sizeof(u32), | 406 | tx_ring->hw_consumer = (__le32 *) dma_alloc_coherent(&pdev->dev, |
405 | &tx_ring->hw_cons_phys_addr); | 407 | sizeof(u32), &tx_ring->hw_cons_phys_addr, GFP_KERNEL); |
406 | if (tx_ring->hw_consumer == NULL) { | 408 | if (tx_ring->hw_consumer == NULL) { |
407 | dev_err(&pdev->dev, "failed to allocate tx consumer\n"); | 409 | dev_err(&pdev->dev, "failed to allocate tx consumer\n"); |
408 | return -ENOMEM; | 410 | return -ENOMEM; |
409 | } | 411 | } |
410 | *(tx_ring->hw_consumer) = 0; | ||
411 | 412 | ||
412 | /* cmd desc ring */ | 413 | /* cmd desc ring */ |
413 | addr = pci_alloc_consistent(pdev, TX_DESC_RINGSIZE(tx_ring), | 414 | addr = dma_alloc_coherent(&pdev->dev, TX_DESC_RINGSIZE(tx_ring), |
414 | &tx_ring->phys_addr); | 415 | &tx_ring->phys_addr, GFP_KERNEL); |
415 | 416 | ||
416 | if (addr == NULL) { | 417 | if (addr == NULL) { |
417 | dev_err(&pdev->dev, "failed to allocate tx desc ring\n"); | 418 | dev_err(&pdev->dev, "failed to allocate tx desc ring\n"); |
@@ -423,9 +424,9 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) | |||
423 | 424 | ||
424 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 425 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
425 | rds_ring = &recv_ctx->rds_rings[ring]; | 426 | rds_ring = &recv_ctx->rds_rings[ring]; |
426 | addr = pci_alloc_consistent(adapter->pdev, | 427 | addr = dma_alloc_coherent(&adapter->pdev->dev, |
427 | RCV_DESC_RINGSIZE(rds_ring), | 428 | RCV_DESC_RINGSIZE(rds_ring), |
428 | &rds_ring->phys_addr); | 429 | &rds_ring->phys_addr, GFP_KERNEL); |
429 | if (addr == NULL) { | 430 | if (addr == NULL) { |
430 | dev_err(&pdev->dev, | 431 | dev_err(&pdev->dev, |
431 | "failed to allocate rds ring [%d]\n", ring); | 432 | "failed to allocate rds ring [%d]\n", ring); |
@@ -439,9 +440,9 @@ int qlcnic_alloc_hw_resources(struct qlcnic_adapter *adapter) | |||
439 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 440 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
440 | sds_ring = &recv_ctx->sds_rings[ring]; | 441 | sds_ring = &recv_ctx->sds_rings[ring]; |
441 | 442 | ||
442 | addr = pci_alloc_consistent(adapter->pdev, | 443 | addr = dma_alloc_coherent(&adapter->pdev->dev, |
443 | STATUS_DESC_RINGSIZE(sds_ring), | 444 | STATUS_DESC_RINGSIZE(sds_ring), |
444 | &sds_ring->phys_addr); | 445 | &sds_ring->phys_addr, GFP_KERNEL); |
445 | if (addr == NULL) { | 446 | if (addr == NULL) { |
446 | dev_err(&pdev->dev, | 447 | dev_err(&pdev->dev, |
447 | "failed to allocate sds ring [%d]\n", ring); | 448 | "failed to allocate sds ring [%d]\n", ring); |
@@ -501,11 +502,11 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
501 | struct qlcnic_host_tx_ring *tx_ring; | 502 | struct qlcnic_host_tx_ring *tx_ring; |
502 | int ring; | 503 | int ring; |
503 | 504 | ||
504 | recv_ctx = &adapter->recv_ctx; | 505 | recv_ctx = adapter->recv_ctx; |
505 | 506 | ||
506 | tx_ring = adapter->tx_ring; | 507 | tx_ring = adapter->tx_ring; |
507 | if (tx_ring->hw_consumer != NULL) { | 508 | if (tx_ring->hw_consumer != NULL) { |
508 | pci_free_consistent(adapter->pdev, | 509 | dma_free_coherent(&adapter->pdev->dev, |
509 | sizeof(u32), | 510 | sizeof(u32), |
510 | tx_ring->hw_consumer, | 511 | tx_ring->hw_consumer, |
511 | tx_ring->hw_cons_phys_addr); | 512 | tx_ring->hw_cons_phys_addr); |
@@ -513,7 +514,7 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
513 | } | 514 | } |
514 | 515 | ||
515 | if (tx_ring->desc_head != NULL) { | 516 | if (tx_ring->desc_head != NULL) { |
516 | pci_free_consistent(adapter->pdev, | 517 | dma_free_coherent(&adapter->pdev->dev, |
517 | TX_DESC_RINGSIZE(tx_ring), | 518 | TX_DESC_RINGSIZE(tx_ring), |
518 | tx_ring->desc_head, tx_ring->phys_addr); | 519 | tx_ring->desc_head, tx_ring->phys_addr); |
519 | tx_ring->desc_head = NULL; | 520 | tx_ring->desc_head = NULL; |
@@ -523,7 +524,7 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
523 | rds_ring = &recv_ctx->rds_rings[ring]; | 524 | rds_ring = &recv_ctx->rds_rings[ring]; |
524 | 525 | ||
525 | if (rds_ring->desc_head != NULL) { | 526 | if (rds_ring->desc_head != NULL) { |
526 | pci_free_consistent(adapter->pdev, | 527 | dma_free_coherent(&adapter->pdev->dev, |
527 | RCV_DESC_RINGSIZE(rds_ring), | 528 | RCV_DESC_RINGSIZE(rds_ring), |
528 | rds_ring->desc_head, | 529 | rds_ring->desc_head, |
529 | rds_ring->phys_addr); | 530 | rds_ring->phys_addr); |
@@ -535,7 +536,7 @@ void qlcnic_free_hw_resources(struct qlcnic_adapter *adapter) | |||
535 | sds_ring = &recv_ctx->sds_rings[ring]; | 536 | sds_ring = &recv_ctx->sds_rings[ring]; |
536 | 537 | ||
537 | if (sds_ring->desc_head != NULL) { | 538 | if (sds_ring->desc_head != NULL) { |
538 | pci_free_consistent(adapter->pdev, | 539 | dma_free_coherent(&adapter->pdev->dev, |
539 | STATUS_DESC_RINGSIZE(sds_ring), | 540 | STATUS_DESC_RINGSIZE(sds_ring), |
540 | sds_ring->desc_head, | 541 | sds_ring->desc_head, |
541 | sds_ring->phys_addr); | 542 | sds_ring->phys_addr); |
@@ -551,9 +552,9 @@ int qlcnic_get_mac_address(struct qlcnic_adapter *adapter, u8 *mac) | |||
551 | int err; | 552 | int err; |
552 | u32 arg1; | 553 | u32 arg1; |
553 | 554 | ||
554 | arg1 = adapter->ahw.pci_func | BIT_8; | 555 | arg1 = adapter->ahw->pci_func | BIT_8; |
555 | err = qlcnic_issue_cmd(adapter, | 556 | err = qlcnic_issue_cmd(adapter, |
556 | adapter->ahw.pci_func, | 557 | adapter->ahw->pci_func, |
557 | adapter->fw_hal_version, | 558 | adapter->fw_hal_version, |
558 | arg1, | 559 | arg1, |
559 | 0, | 560 | 0, |
@@ -582,15 +583,15 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, | |||
582 | void *nic_info_addr; | 583 | void *nic_info_addr; |
583 | size_t nic_size = sizeof(struct qlcnic_info); | 584 | size_t nic_size = sizeof(struct qlcnic_info); |
584 | 585 | ||
585 | nic_info_addr = pci_alloc_consistent(adapter->pdev, | 586 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, |
586 | nic_size, &nic_dma_t); | 587 | &nic_dma_t, GFP_KERNEL); |
587 | if (!nic_info_addr) | 588 | if (!nic_info_addr) |
588 | return -ENOMEM; | 589 | return -ENOMEM; |
589 | memset(nic_info_addr, 0, nic_size); | 590 | memset(nic_info_addr, 0, nic_size); |
590 | 591 | ||
591 | nic_info = (struct qlcnic_info *) nic_info_addr; | 592 | nic_info = (struct qlcnic_info *) nic_info_addr; |
592 | err = qlcnic_issue_cmd(adapter, | 593 | err = qlcnic_issue_cmd(adapter, |
593 | adapter->ahw.pci_func, | 594 | adapter->ahw->pci_func, |
594 | adapter->fw_hal_version, | 595 | adapter->fw_hal_version, |
595 | MSD(nic_dma_t), | 596 | MSD(nic_dma_t), |
596 | LSD(nic_dma_t), | 597 | LSD(nic_dma_t), |
@@ -623,7 +624,8 @@ int qlcnic_get_nic_info(struct qlcnic_adapter *adapter, | |||
623 | err = -EIO; | 624 | err = -EIO; |
624 | } | 625 | } |
625 | 626 | ||
626 | pci_free_consistent(adapter->pdev, nic_size, nic_info_addr, nic_dma_t); | 627 | dma_free_coherent(&adapter->pdev->dev, nic_size, nic_info_addr, |
628 | nic_dma_t); | ||
627 | return err; | 629 | return err; |
628 | } | 630 | } |
629 | 631 | ||
@@ -639,8 +641,8 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic) | |||
639 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) | 641 | if (adapter->op_mode != QLCNIC_MGMT_FUNC) |
640 | return err; | 642 | return err; |
641 | 643 | ||
642 | nic_info_addr = pci_alloc_consistent(adapter->pdev, nic_size, | 644 | nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size, |
643 | &nic_dma_t); | 645 | &nic_dma_t, GFP_KERNEL); |
644 | if (!nic_info_addr) | 646 | if (!nic_info_addr) |
645 | return -ENOMEM; | 647 | return -ENOMEM; |
646 | 648 | ||
@@ -659,7 +661,7 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic) | |||
659 | nic_info->max_tx_bw = cpu_to_le16(nic->max_tx_bw); | 661 | nic_info->max_tx_bw = cpu_to_le16(nic->max_tx_bw); |
660 | 662 | ||
661 | err = qlcnic_issue_cmd(adapter, | 663 | err = qlcnic_issue_cmd(adapter, |
662 | adapter->ahw.pci_func, | 664 | adapter->ahw->pci_func, |
663 | adapter->fw_hal_version, | 665 | adapter->fw_hal_version, |
664 | MSD(nic_dma_t), | 666 | MSD(nic_dma_t), |
665 | LSD(nic_dma_t), | 667 | LSD(nic_dma_t), |
@@ -672,7 +674,8 @@ int qlcnic_set_nic_info(struct qlcnic_adapter *adapter, struct qlcnic_info *nic) | |||
672 | err = -EIO; | 674 | err = -EIO; |
673 | } | 675 | } |
674 | 676 | ||
675 | pci_free_consistent(adapter->pdev, nic_size, nic_info_addr, nic_dma_t); | 677 | dma_free_coherent(&adapter->pdev->dev, nic_size, nic_info_addr, |
678 | nic_dma_t); | ||
676 | return err; | 679 | return err; |
677 | } | 680 | } |
678 | 681 | ||
@@ -687,15 +690,15 @@ int qlcnic_get_pci_info(struct qlcnic_adapter *adapter, | |||
687 | size_t npar_size = sizeof(struct qlcnic_pci_info); | 690 | size_t npar_size = sizeof(struct qlcnic_pci_info); |
688 | size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC; | 691 | size_t pci_size = npar_size * QLCNIC_MAX_PCI_FUNC; |
689 | 692 | ||
690 | pci_info_addr = pci_alloc_consistent(adapter->pdev, pci_size, | 693 | pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size, |
691 | &pci_info_dma_t); | 694 | &pci_info_dma_t, GFP_KERNEL); |
692 | if (!pci_info_addr) | 695 | if (!pci_info_addr) |
693 | return -ENOMEM; | 696 | return -ENOMEM; |
694 | memset(pci_info_addr, 0, pci_size); | 697 | memset(pci_info_addr, 0, pci_size); |
695 | 698 | ||
696 | npar = (struct qlcnic_pci_info *) pci_info_addr; | 699 | npar = (struct qlcnic_pci_info *) pci_info_addr; |
697 | err = qlcnic_issue_cmd(adapter, | 700 | err = qlcnic_issue_cmd(adapter, |
698 | adapter->ahw.pci_func, | 701 | adapter->ahw->pci_func, |
699 | adapter->fw_hal_version, | 702 | adapter->fw_hal_version, |
700 | MSD(pci_info_dma_t), | 703 | MSD(pci_info_dma_t), |
701 | LSD(pci_info_dma_t), | 704 | LSD(pci_info_dma_t), |
@@ -721,7 +724,7 @@ int qlcnic_get_pci_info(struct qlcnic_adapter *adapter, | |||
721 | err = -EIO; | 724 | err = -EIO; |
722 | } | 725 | } |
723 | 726 | ||
724 | pci_free_consistent(adapter->pdev, pci_size, pci_info_addr, | 727 | dma_free_coherent(&adapter->pdev->dev, pci_size, pci_info_addr, |
725 | pci_info_dma_t); | 728 | pci_info_dma_t); |
726 | return err; | 729 | return err; |
727 | } | 730 | } |
@@ -741,7 +744,7 @@ int qlcnic_config_port_mirroring(struct qlcnic_adapter *adapter, u8 id, | |||
741 | arg1 |= pci_func << 8; | 744 | arg1 |= pci_func << 8; |
742 | 745 | ||
743 | err = qlcnic_issue_cmd(adapter, | 746 | err = qlcnic_issue_cmd(adapter, |
744 | adapter->ahw.pci_func, | 747 | adapter->ahw->pci_func, |
745 | adapter->fw_hal_version, | 748 | adapter->fw_hal_version, |
746 | arg1, | 749 | arg1, |
747 | 0, | 750 | 0, |
@@ -775,14 +778,14 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
775 | return -ENOMEM; | 778 | return -ENOMEM; |
776 | 779 | ||
777 | if (adapter->op_mode != QLCNIC_MGMT_FUNC && | 780 | if (adapter->op_mode != QLCNIC_MGMT_FUNC && |
778 | func != adapter->ahw.pci_func) { | 781 | func != adapter->ahw->pci_func) { |
779 | dev_err(&adapter->pdev->dev, | 782 | dev_err(&adapter->pdev->dev, |
780 | "Not privilege to query stats for func=%d", func); | 783 | "Not privilege to query stats for func=%d", func); |
781 | return -EIO; | 784 | return -EIO; |
782 | } | 785 | } |
783 | 786 | ||
784 | stats_addr = pci_alloc_consistent(adapter->pdev, stats_size, | 787 | stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size, |
785 | &stats_dma_t); | 788 | &stats_dma_t, GFP_KERNEL); |
786 | if (!stats_addr) { | 789 | if (!stats_addr) { |
787 | dev_err(&adapter->pdev->dev, "Unable to allocate memory\n"); | 790 | dev_err(&adapter->pdev->dev, "Unable to allocate memory\n"); |
788 | return -ENOMEM; | 791 | return -ENOMEM; |
@@ -793,7 +796,7 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
793 | arg1 |= rx_tx << 15 | stats_size << 16; | 796 | arg1 |= rx_tx << 15 | stats_size << 16; |
794 | 797 | ||
795 | err = qlcnic_issue_cmd(adapter, | 798 | err = qlcnic_issue_cmd(adapter, |
796 | adapter->ahw.pci_func, | 799 | adapter->ahw->pci_func, |
797 | adapter->fw_hal_version, | 800 | adapter->fw_hal_version, |
798 | arg1, | 801 | arg1, |
799 | MSD(stats_dma_t), | 802 | MSD(stats_dma_t), |
@@ -816,7 +819,7 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func, | |||
816 | esw_stats->numbytes = le64_to_cpu(stats->numbytes); | 819 | esw_stats->numbytes = le64_to_cpu(stats->numbytes); |
817 | } | 820 | } |
818 | 821 | ||
819 | pci_free_consistent(adapter->pdev, stats_size, stats_addr, | 822 | dma_free_coherent(&adapter->pdev->dev, stats_size, stats_addr, |
820 | stats_dma_t); | 823 | stats_dma_t); |
821 | return err; | 824 | return err; |
822 | } | 825 | } |
@@ -900,7 +903,7 @@ int qlcnic_clear_esw_stats(struct qlcnic_adapter *adapter, const u8 func_esw, | |||
900 | arg1 |= BIT_14 | rx_tx << 15; | 903 | arg1 |= BIT_14 | rx_tx << 15; |
901 | 904 | ||
902 | return qlcnic_issue_cmd(adapter, | 905 | return qlcnic_issue_cmd(adapter, |
903 | adapter->ahw.pci_func, | 906 | adapter->ahw->pci_func, |
904 | adapter->fw_hal_version, | 907 | adapter->fw_hal_version, |
905 | arg1, | 908 | arg1, |
906 | 0, | 909 | 0, |
@@ -921,7 +924,7 @@ __qlcnic_get_eswitch_port_config(struct qlcnic_adapter *adapter, | |||
921 | u8 pci_func; | 924 | u8 pci_func; |
922 | pci_func = (*arg1 >> 8); | 925 | pci_func = (*arg1 >> 8); |
923 | err = qlcnic_issue_cmd(adapter, | 926 | err = qlcnic_issue_cmd(adapter, |
924 | adapter->ahw.pci_func, | 927 | adapter->ahw->pci_func, |
925 | adapter->fw_hal_version, | 928 | adapter->fw_hal_version, |
926 | *arg1, | 929 | *arg1, |
927 | 0, | 930 | 0, |
@@ -999,7 +1002,7 @@ int qlcnic_config_switch_port(struct qlcnic_adapter *adapter, | |||
999 | } | 1002 | } |
1000 | 1003 | ||
1001 | err = qlcnic_issue_cmd(adapter, | 1004 | err = qlcnic_issue_cmd(adapter, |
1002 | adapter->ahw.pci_func, | 1005 | adapter->ahw->pci_func, |
1003 | adapter->fw_hal_version, | 1006 | adapter->fw_hal_version, |
1004 | arg1, | 1007 | arg1, |
1005 | arg2, | 1008 | arg2, |
diff --git a/drivers/net/qlcnic/qlcnic_ethtool.c b/drivers/net/qlcnic/qlcnic_ethtool.c index 45b2755d6cba..7e53cad6be16 100644 --- a/drivers/net/qlcnic/qlcnic_ethtool.c +++ b/drivers/net/qlcnic/qlcnic_ethtool.c | |||
@@ -150,10 +150,10 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
150 | { | 150 | { |
151 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 151 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
152 | int check_sfp_module = 0; | 152 | int check_sfp_module = 0; |
153 | u16 pcifn = adapter->ahw.pci_func; | 153 | u16 pcifn = adapter->ahw->pci_func; |
154 | 154 | ||
155 | /* read which mode */ | 155 | /* read which mode */ |
156 | if (adapter->ahw.port_type == QLCNIC_GBE) { | 156 | if (adapter->ahw->port_type == QLCNIC_GBE) { |
157 | ecmd->supported = (SUPPORTED_10baseT_Half | | 157 | ecmd->supported = (SUPPORTED_10baseT_Half | |
158 | SUPPORTED_10baseT_Full | | 158 | SUPPORTED_10baseT_Full | |
159 | SUPPORTED_100baseT_Half | | 159 | SUPPORTED_100baseT_Half | |
@@ -170,7 +170,7 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
170 | ecmd->duplex = adapter->link_duplex; | 170 | ecmd->duplex = adapter->link_duplex; |
171 | ecmd->autoneg = adapter->link_autoneg; | 171 | ecmd->autoneg = adapter->link_autoneg; |
172 | 172 | ||
173 | } else if (adapter->ahw.port_type == QLCNIC_XGBE) { | 173 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { |
174 | u32 val; | 174 | u32 val; |
175 | 175 | ||
176 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); | 176 | val = QLCRD32(adapter, QLCNIC_PORT_MODE_ADDR); |
@@ -201,7 +201,7 @@ skip: | |||
201 | ecmd->phy_address = adapter->physical_port; | 201 | ecmd->phy_address = adapter->physical_port; |
202 | ecmd->transceiver = XCVR_EXTERNAL; | 202 | ecmd->transceiver = XCVR_EXTERNAL; |
203 | 203 | ||
204 | switch (adapter->ahw.board_type) { | 204 | switch (adapter->ahw->board_type) { |
205 | case QLCNIC_BRDTYPE_P3P_REF_QG: | 205 | case QLCNIC_BRDTYPE_P3P_REF_QG: |
206 | case QLCNIC_BRDTYPE_P3P_4_GB: | 206 | case QLCNIC_BRDTYPE_P3P_4_GB: |
207 | case QLCNIC_BRDTYPE_P3P_4_GB_MM: | 207 | case QLCNIC_BRDTYPE_P3P_4_GB_MM: |
@@ -238,7 +238,7 @@ skip: | |||
238 | ecmd->autoneg = AUTONEG_DISABLE; | 238 | ecmd->autoneg = AUTONEG_DISABLE; |
239 | break; | 239 | break; |
240 | case QLCNIC_BRDTYPE_P3P_10G_TP: | 240 | case QLCNIC_BRDTYPE_P3P_10G_TP: |
241 | if (adapter->ahw.port_type == QLCNIC_XGBE) { | 241 | if (adapter->ahw->port_type == QLCNIC_XGBE) { |
242 | ecmd->autoneg = AUTONEG_DISABLE; | 242 | ecmd->autoneg = AUTONEG_DISABLE; |
243 | ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); | 243 | ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP); |
244 | ecmd->advertising |= | 244 | ecmd->advertising |= |
@@ -256,7 +256,7 @@ skip: | |||
256 | break; | 256 | break; |
257 | default: | 257 | default: |
258 | dev_err(&adapter->pdev->dev, "Unsupported board model %d\n", | 258 | dev_err(&adapter->pdev->dev, "Unsupported board model %d\n", |
259 | adapter->ahw.board_type); | 259 | adapter->ahw->board_type); |
260 | return -EIO; | 260 | return -EIO; |
261 | } | 261 | } |
262 | 262 | ||
@@ -288,7 +288,7 @@ qlcnic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
288 | __u32 status; | 288 | __u32 status; |
289 | 289 | ||
290 | /* read which mode */ | 290 | /* read which mode */ |
291 | if (adapter->ahw.port_type == QLCNIC_GBE) { | 291 | if (adapter->ahw->port_type == QLCNIC_GBE) { |
292 | /* autonegotiation */ | 292 | /* autonegotiation */ |
293 | if (qlcnic_fw_cmd_set_phy(adapter, | 293 | if (qlcnic_fw_cmd_set_phy(adapter, |
294 | QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG, | 294 | QLCNIC_NIU_GB_MII_MGMT_ADDR_AUTONEG, |
@@ -340,14 +340,14 @@ static void | |||
340 | qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) | 340 | qlcnic_get_regs(struct net_device *dev, struct ethtool_regs *regs, void *p) |
341 | { | 341 | { |
342 | struct qlcnic_adapter *adapter = netdev_priv(dev); | 342 | struct qlcnic_adapter *adapter = netdev_priv(dev); |
343 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 343 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
344 | struct qlcnic_host_sds_ring *sds_ring; | 344 | struct qlcnic_host_sds_ring *sds_ring; |
345 | u32 *regs_buff = p; | 345 | u32 *regs_buff = p; |
346 | int ring, i = 0, j = 0; | 346 | int ring, i = 0, j = 0; |
347 | 347 | ||
348 | memset(p, 0, qlcnic_get_regs_len(dev)); | 348 | memset(p, 0, qlcnic_get_regs_len(dev)); |
349 | regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) | | 349 | regs->version = (QLCNIC_ETHTOOL_REGS_VER << 24) | |
350 | (adapter->ahw.revision_id << 16) | (adapter->pdev)->device; | 350 | (adapter->ahw->revision_id << 16) | (adapter->pdev)->device; |
351 | 351 | ||
352 | regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE & 0xffff)); | 352 | regs_buff[0] = (0xcafe0000 | (QLCNIC_DEV_INFO_SIZE & 0xffff)); |
353 | regs_buff[1] = QLCNIC_MGMT_API_VERSION; | 353 | regs_buff[1] = QLCNIC_MGMT_API_VERSION; |
@@ -382,7 +382,7 @@ static u32 qlcnic_test_link(struct net_device *dev) | |||
382 | u32 val; | 382 | u32 val; |
383 | 383 | ||
384 | val = QLCRD32(adapter, CRB_XG_STATE_P3P); | 384 | val = QLCRD32(adapter, CRB_XG_STATE_P3P); |
385 | val = XG_LINK_STATE_P3P(adapter->ahw.pci_func, val); | 385 | val = XG_LINK_STATE_P3P(adapter->ahw->pci_func, val); |
386 | return (val == XG_LINK_UP_P3P) ? 0 : 1; | 386 | return (val == XG_LINK_UP_P3P) ? 0 : 1; |
387 | } | 387 | } |
388 | 388 | ||
@@ -482,7 +482,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
482 | int port = adapter->physical_port; | 482 | int port = adapter->physical_port; |
483 | __u32 val; | 483 | __u32 val; |
484 | 484 | ||
485 | if (adapter->ahw.port_type == QLCNIC_GBE) { | 485 | if (adapter->ahw->port_type == QLCNIC_GBE) { |
486 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | 486 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) |
487 | return; | 487 | return; |
488 | /* get flow control settings */ | 488 | /* get flow control settings */ |
@@ -504,7 +504,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
504 | pause->tx_pause = !(qlcnic_gb_get_gb3_mask(val)); | 504 | pause->tx_pause = !(qlcnic_gb_get_gb3_mask(val)); |
505 | break; | 505 | break; |
506 | } | 506 | } |
507 | } else if (adapter->ahw.port_type == QLCNIC_XGBE) { | 507 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { |
508 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) | 508 | if ((port < 0) || (port > QLCNIC_NIU_MAX_XG_PORTS)) |
509 | return; | 509 | return; |
510 | pause->rx_pause = 1; | 510 | pause->rx_pause = 1; |
@@ -515,7 +515,7 @@ qlcnic_get_pauseparam(struct net_device *netdev, | |||
515 | pause->tx_pause = !(qlcnic_xg_get_xg1_mask(val)); | 515 | pause->tx_pause = !(qlcnic_xg_get_xg1_mask(val)); |
516 | } else { | 516 | } else { |
517 | dev_err(&netdev->dev, "Unknown board type: %x\n", | 517 | dev_err(&netdev->dev, "Unknown board type: %x\n", |
518 | adapter->ahw.port_type); | 518 | adapter->ahw->port_type); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | 521 | ||
@@ -528,7 +528,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
528 | __u32 val; | 528 | __u32 val; |
529 | 529 | ||
530 | /* read mode */ | 530 | /* read mode */ |
531 | if (adapter->ahw.port_type == QLCNIC_GBE) { | 531 | if (adapter->ahw->port_type == QLCNIC_GBE) { |
532 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) | 532 | if ((port < 0) || (port > QLCNIC_NIU_MAX_GBE_PORTS)) |
533 | return -EIO; | 533 | return -EIO; |
534 | /* set flow control */ | 534 | /* set flow control */ |
@@ -571,7 +571,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
571 | break; | 571 | break; |
572 | } | 572 | } |
573 | QLCWR32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, val); | 573 | QLCWR32(adapter, QLCNIC_NIU_GB_PAUSE_CTL, val); |
574 | } else if (adapter->ahw.port_type == QLCNIC_XGBE) { | 574 | } else if (adapter->ahw->port_type == QLCNIC_XGBE) { |
575 | if (!pause->rx_pause || pause->autoneg) | 575 | if (!pause->rx_pause || pause->autoneg) |
576 | return -EOPNOTSUPP; | 576 | return -EOPNOTSUPP; |
577 | 577 | ||
@@ -593,7 +593,7 @@ qlcnic_set_pauseparam(struct net_device *netdev, | |||
593 | QLCWR32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, val); | 593 | QLCWR32(adapter, QLCNIC_NIU_XG_PAUSE_CTL, val); |
594 | } else { | 594 | } else { |
595 | dev_err(&netdev->dev, "Unknown board type: %x\n", | 595 | dev_err(&netdev->dev, "Unknown board type: %x\n", |
596 | adapter->ahw.port_type); | 596 | adapter->ahw->port_type); |
597 | } | 597 | } |
598 | return 0; | 598 | return 0; |
599 | } | 599 | } |
@@ -639,8 +639,8 @@ static int qlcnic_irq_test(struct net_device *netdev) | |||
639 | goto clear_it; | 639 | goto clear_it; |
640 | 640 | ||
641 | adapter->diag_cnt = 0; | 641 | adapter->diag_cnt = 0; |
642 | ret = qlcnic_issue_cmd(adapter, adapter->ahw.pci_func, | 642 | ret = qlcnic_issue_cmd(adapter, adapter->ahw->pci_func, |
643 | adapter->fw_hal_version, adapter->portnum, | 643 | adapter->fw_hal_version, adapter->ahw->pci_func, |
644 | 0, 0, 0x00000011); | 644 | 0, 0, 0x00000011); |
645 | if (ret) | 645 | if (ret) |
646 | goto done; | 646 | goto done; |
@@ -749,14 +749,14 @@ qlcnic_get_ethtool_stats(struct net_device *dev, | |||
749 | return; | 749 | return; |
750 | 750 | ||
751 | memset(&port_stats, 0, sizeof(struct qlcnic_esw_statistics)); | 751 | memset(&port_stats, 0, sizeof(struct qlcnic_esw_statistics)); |
752 | ret = qlcnic_get_port_stats(adapter, adapter->ahw.pci_func, | 752 | ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func, |
753 | QLCNIC_QUERY_RX_COUNTER, &port_stats.rx); | 753 | QLCNIC_QUERY_RX_COUNTER, &port_stats.rx); |
754 | if (ret) | 754 | if (ret) |
755 | return; | 755 | return; |
756 | 756 | ||
757 | qlcnic_fill_device_stats(&index, data, &port_stats.rx); | 757 | qlcnic_fill_device_stats(&index, data, &port_stats.rx); |
758 | 758 | ||
759 | ret = qlcnic_get_port_stats(adapter, adapter->ahw.pci_func, | 759 | ret = qlcnic_get_port_stats(adapter, adapter->ahw->pci_func, |
760 | QLCNIC_QUERY_TX_COUNTER, &port_stats.tx); | 760 | QLCNIC_QUERY_TX_COUNTER, &port_stats.tx); |
761 | if (ret) | 761 | if (ret) |
762 | return; | 762 | return; |
diff --git a/drivers/net/qlcnic/qlcnic_hw.c b/drivers/net/qlcnic/qlcnic_hw.c index 616940f0a8d0..7e3f52690e3f 100644 --- a/drivers/net/qlcnic/qlcnic_hw.c +++ b/drivers/net/qlcnic/qlcnic_hw.c | |||
@@ -457,7 +457,7 @@ int qlcnic_nic_set_promisc(struct qlcnic_adapter *adapter, u32 mode) | |||
457 | 457 | ||
458 | req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23); | 458 | req.qhdr = cpu_to_le64(QLCNIC_HOST_REQUEST << 23); |
459 | 459 | ||
460 | word = QLCNIC_H2C_OPCODE_PROXY_SET_VPORT_MISS_MODE | | 460 | word = QLCNIC_H2C_OPCODE_SET_MAC_RECEIVE_MODE | |
461 | ((u64)adapter->portnum << 16); | 461 | ((u64)adapter->portnum << 16); |
462 | req.req_hdr = cpu_to_le64(word); | 462 | req.req_hdr = cpu_to_le64(word); |
463 | 463 | ||
@@ -780,7 +780,7 @@ qlcnic_pci_get_crb_addr_2M(struct qlcnic_adapter *adapter, | |||
780 | m = &crb_128M_2M_map[CRB_BLK(off)].sub_block[CRB_SUBBLK(off)]; | 780 | m = &crb_128M_2M_map[CRB_BLK(off)].sub_block[CRB_SUBBLK(off)]; |
781 | 781 | ||
782 | if (m->valid && (m->start_128M <= off) && (m->end_128M > off)) { | 782 | if (m->valid && (m->start_128M <= off) && (m->end_128M > off)) { |
783 | *addr = adapter->ahw.pci_base0 + m->start_2M + | 783 | *addr = adapter->ahw->pci_base0 + m->start_2M + |
784 | (off - m->start_128M); | 784 | (off - m->start_128M); |
785 | return 0; | 785 | return 0; |
786 | } | 786 | } |
@@ -788,7 +788,7 @@ qlcnic_pci_get_crb_addr_2M(struct qlcnic_adapter *adapter, | |||
788 | /* | 788 | /* |
789 | * Not in direct map, use crb window | 789 | * Not in direct map, use crb window |
790 | */ | 790 | */ |
791 | *addr = adapter->ahw.pci_base0 + CRB_INDIRECT_2M + (off & MASK(16)); | 791 | *addr = adapter->ahw->pci_base0 + CRB_INDIRECT_2M + (off & MASK(16)); |
792 | return 1; | 792 | return 1; |
793 | } | 793 | } |
794 | 794 | ||
@@ -801,7 +801,7 @@ static int | |||
801 | qlcnic_pci_set_crbwindow_2M(struct qlcnic_adapter *adapter, ulong off) | 801 | qlcnic_pci_set_crbwindow_2M(struct qlcnic_adapter *adapter, ulong off) |
802 | { | 802 | { |
803 | u32 window; | 803 | u32 window; |
804 | void __iomem *addr = adapter->ahw.pci_base0 + CRB_WINDOW_2M; | 804 | void __iomem *addr = adapter->ahw->pci_base0 + CRB_WINDOW_2M; |
805 | 805 | ||
806 | off -= QLCNIC_PCI_CRBSPACE; | 806 | off -= QLCNIC_PCI_CRBSPACE; |
807 | 807 | ||
@@ -838,13 +838,13 @@ qlcnic_hw_write_wx_2M(struct qlcnic_adapter *adapter, ulong off, u32 data) | |||
838 | 838 | ||
839 | if (rv > 0) { | 839 | if (rv > 0) { |
840 | /* indirect access */ | 840 | /* indirect access */ |
841 | write_lock_irqsave(&adapter->ahw.crb_lock, flags); | 841 | write_lock_irqsave(&adapter->ahw->crb_lock, flags); |
842 | crb_win_lock(adapter); | 842 | crb_win_lock(adapter); |
843 | rv = qlcnic_pci_set_crbwindow_2M(adapter, off); | 843 | rv = qlcnic_pci_set_crbwindow_2M(adapter, off); |
844 | if (!rv) | 844 | if (!rv) |
845 | writel(data, addr); | 845 | writel(data, addr); |
846 | crb_win_unlock(adapter); | 846 | crb_win_unlock(adapter); |
847 | write_unlock_irqrestore(&adapter->ahw.crb_lock, flags); | 847 | write_unlock_irqrestore(&adapter->ahw->crb_lock, flags); |
848 | return rv; | 848 | return rv; |
849 | } | 849 | } |
850 | 850 | ||
@@ -869,12 +869,12 @@ qlcnic_hw_read_wx_2M(struct qlcnic_adapter *adapter, ulong off) | |||
869 | 869 | ||
870 | if (rv > 0) { | 870 | if (rv > 0) { |
871 | /* indirect access */ | 871 | /* indirect access */ |
872 | write_lock_irqsave(&adapter->ahw.crb_lock, flags); | 872 | write_lock_irqsave(&adapter->ahw->crb_lock, flags); |
873 | crb_win_lock(adapter); | 873 | crb_win_lock(adapter); |
874 | if (!qlcnic_pci_set_crbwindow_2M(adapter, off)) | 874 | if (!qlcnic_pci_set_crbwindow_2M(adapter, off)) |
875 | data = readl(addr); | 875 | data = readl(addr); |
876 | crb_win_unlock(adapter); | 876 | crb_win_unlock(adapter); |
877 | write_unlock_irqrestore(&adapter->ahw.crb_lock, flags); | 877 | write_unlock_irqrestore(&adapter->ahw->crb_lock, flags); |
878 | return data; | 878 | return data; |
879 | } | 879 | } |
880 | 880 | ||
@@ -904,9 +904,9 @@ qlcnic_pci_set_window_2M(struct qlcnic_adapter *adapter, | |||
904 | 904 | ||
905 | window = OCM_WIN_P3P(addr); | 905 | window = OCM_WIN_P3P(addr); |
906 | 906 | ||
907 | writel(window, adapter->ahw.ocm_win_crb); | 907 | writel(window, adapter->ahw->ocm_win_crb); |
908 | /* read back to flush */ | 908 | /* read back to flush */ |
909 | readl(adapter->ahw.ocm_win_crb); | 909 | readl(adapter->ahw->ocm_win_crb); |
910 | 910 | ||
911 | *start = QLCNIC_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr); | 911 | *start = QLCNIC_PCI_OCM0_2M + GET_MEM_OFFS_2M(addr); |
912 | return 0; | 912 | return 0; |
@@ -920,13 +920,13 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off, | |||
920 | int ret; | 920 | int ret; |
921 | u32 start; | 921 | u32 start; |
922 | 922 | ||
923 | mutex_lock(&adapter->ahw.mem_lock); | 923 | mutex_lock(&adapter->ahw->mem_lock); |
924 | 924 | ||
925 | ret = qlcnic_pci_set_window_2M(adapter, off, &start); | 925 | ret = qlcnic_pci_set_window_2M(adapter, off, &start); |
926 | if (ret != 0) | 926 | if (ret != 0) |
927 | goto unlock; | 927 | goto unlock; |
928 | 928 | ||
929 | addr = adapter->ahw.pci_base0 + start; | 929 | addr = adapter->ahw->pci_base0 + start; |
930 | 930 | ||
931 | if (op == 0) /* read */ | 931 | if (op == 0) /* read */ |
932 | *data = readq(addr); | 932 | *data = readq(addr); |
@@ -934,7 +934,7 @@ qlcnic_pci_mem_access_direct(struct qlcnic_adapter *adapter, u64 off, | |||
934 | writeq(*data, addr); | 934 | writeq(*data, addr); |
935 | 935 | ||
936 | unlock: | 936 | unlock: |
937 | mutex_unlock(&adapter->ahw.mem_lock); | 937 | mutex_unlock(&adapter->ahw->mem_lock); |
938 | 938 | ||
939 | return ret; | 939 | return ret; |
940 | } | 940 | } |
@@ -942,23 +942,23 @@ unlock: | |||
942 | void | 942 | void |
943 | qlcnic_pci_camqm_read_2M(struct qlcnic_adapter *adapter, u64 off, u64 *data) | 943 | qlcnic_pci_camqm_read_2M(struct qlcnic_adapter *adapter, u64 off, u64 *data) |
944 | { | 944 | { |
945 | void __iomem *addr = adapter->ahw.pci_base0 + | 945 | void __iomem *addr = adapter->ahw->pci_base0 + |
946 | QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM); | 946 | QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM); |
947 | 947 | ||
948 | mutex_lock(&adapter->ahw.mem_lock); | 948 | mutex_lock(&adapter->ahw->mem_lock); |
949 | *data = readq(addr); | 949 | *data = readq(addr); |
950 | mutex_unlock(&adapter->ahw.mem_lock); | 950 | mutex_unlock(&adapter->ahw->mem_lock); |
951 | } | 951 | } |
952 | 952 | ||
953 | void | 953 | void |
954 | qlcnic_pci_camqm_write_2M(struct qlcnic_adapter *adapter, u64 off, u64 data) | 954 | qlcnic_pci_camqm_write_2M(struct qlcnic_adapter *adapter, u64 off, u64 data) |
955 | { | 955 | { |
956 | void __iomem *addr = adapter->ahw.pci_base0 + | 956 | void __iomem *addr = adapter->ahw->pci_base0 + |
957 | QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM); | 957 | QLCNIC_PCI_CAMQM_2M_BASE + (off - QLCNIC_PCI_CAMQM); |
958 | 958 | ||
959 | mutex_lock(&adapter->ahw.mem_lock); | 959 | mutex_lock(&adapter->ahw->mem_lock); |
960 | writeq(data, addr); | 960 | writeq(data, addr); |
961 | mutex_unlock(&adapter->ahw.mem_lock); | 961 | mutex_unlock(&adapter->ahw->mem_lock); |
962 | } | 962 | } |
963 | 963 | ||
964 | #define MAX_CTL_CHECK 1000 | 964 | #define MAX_CTL_CHECK 1000 |
@@ -997,7 +997,7 @@ qlcnic_pci_mem_write_2M(struct qlcnic_adapter *adapter, | |||
997 | correct: | 997 | correct: |
998 | off8 = off & ~0xf; | 998 | off8 = off & ~0xf; |
999 | 999 | ||
1000 | mutex_lock(&adapter->ahw.mem_lock); | 1000 | mutex_lock(&adapter->ahw->mem_lock); |
1001 | 1001 | ||
1002 | writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); | 1002 | writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); |
1003 | writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); | 1003 | writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); |
@@ -1049,7 +1049,7 @@ correct: | |||
1049 | ret = 0; | 1049 | ret = 0; |
1050 | 1050 | ||
1051 | done: | 1051 | done: |
1052 | mutex_unlock(&adapter->ahw.mem_lock); | 1052 | mutex_unlock(&adapter->ahw->mem_lock); |
1053 | 1053 | ||
1054 | return ret; | 1054 | return ret; |
1055 | } | 1055 | } |
@@ -1091,7 +1091,7 @@ qlcnic_pci_mem_read_2M(struct qlcnic_adapter *adapter, | |||
1091 | correct: | 1091 | correct: |
1092 | off8 = off & ~0xf; | 1092 | off8 = off & ~0xf; |
1093 | 1093 | ||
1094 | mutex_lock(&adapter->ahw.mem_lock); | 1094 | mutex_lock(&adapter->ahw->mem_lock); |
1095 | 1095 | ||
1096 | writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); | 1096 | writel(off8, (mem_crb + MIU_TEST_AGT_ADDR_LO)); |
1097 | writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); | 1097 | writel(0, (mem_crb + MIU_TEST_AGT_ADDR_HI)); |
@@ -1121,7 +1121,7 @@ correct: | |||
1121 | ret = 0; | 1121 | ret = 0; |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | mutex_unlock(&adapter->ahw.mem_lock); | 1124 | mutex_unlock(&adapter->ahw->mem_lock); |
1125 | 1125 | ||
1126 | return ret; | 1126 | return ret; |
1127 | } | 1127 | } |
@@ -1145,7 +1145,7 @@ int qlcnic_get_board_info(struct qlcnic_adapter *adapter) | |||
1145 | if (qlcnic_rom_fast_read(adapter, offset, &board_type)) | 1145 | if (qlcnic_rom_fast_read(adapter, offset, &board_type)) |
1146 | return -EIO; | 1146 | return -EIO; |
1147 | 1147 | ||
1148 | adapter->ahw.board_type = board_type; | 1148 | adapter->ahw->board_type = board_type; |
1149 | 1149 | ||
1150 | if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { | 1150 | if (board_type == QLCNIC_BRDTYPE_P3P_4_GB_MM) { |
1151 | u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I); | 1151 | u32 gpio = QLCRD32(adapter, QLCNIC_ROMUSB_GLB_PAD_GPIO_I); |
@@ -1164,20 +1164,20 @@ int qlcnic_get_board_info(struct qlcnic_adapter *adapter) | |||
1164 | case QLCNIC_BRDTYPE_P3P_10G_SFP_QT: | 1164 | case QLCNIC_BRDTYPE_P3P_10G_SFP_QT: |
1165 | case QLCNIC_BRDTYPE_P3P_10G_XFP: | 1165 | case QLCNIC_BRDTYPE_P3P_10G_XFP: |
1166 | case QLCNIC_BRDTYPE_P3P_10000_BASE_T: | 1166 | case QLCNIC_BRDTYPE_P3P_10000_BASE_T: |
1167 | adapter->ahw.port_type = QLCNIC_XGBE; | 1167 | adapter->ahw->port_type = QLCNIC_XGBE; |
1168 | break; | 1168 | break; |
1169 | case QLCNIC_BRDTYPE_P3P_REF_QG: | 1169 | case QLCNIC_BRDTYPE_P3P_REF_QG: |
1170 | case QLCNIC_BRDTYPE_P3P_4_GB: | 1170 | case QLCNIC_BRDTYPE_P3P_4_GB: |
1171 | case QLCNIC_BRDTYPE_P3P_4_GB_MM: | 1171 | case QLCNIC_BRDTYPE_P3P_4_GB_MM: |
1172 | adapter->ahw.port_type = QLCNIC_GBE; | 1172 | adapter->ahw->port_type = QLCNIC_GBE; |
1173 | break; | 1173 | break; |
1174 | case QLCNIC_BRDTYPE_P3P_10G_TP: | 1174 | case QLCNIC_BRDTYPE_P3P_10G_TP: |
1175 | adapter->ahw.port_type = (adapter->portnum < 2) ? | 1175 | adapter->ahw->port_type = (adapter->portnum < 2) ? |
1176 | QLCNIC_XGBE : QLCNIC_GBE; | 1176 | QLCNIC_XGBE : QLCNIC_GBE; |
1177 | break; | 1177 | break; |
1178 | default: | 1178 | default: |
1179 | dev_err(&pdev->dev, "unknown board type %x\n", board_type); | 1179 | dev_err(&pdev->dev, "unknown board type %x\n", board_type); |
1180 | adapter->ahw.port_type = QLCNIC_XGBE; | 1180 | adapter->ahw->port_type = QLCNIC_XGBE; |
1181 | break; | 1181 | break; |
1182 | } | 1182 | } |
1183 | 1183 | ||
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c index a7f1d5b7e811..476ea14c0ff3 100644 --- a/drivers/net/qlcnic/qlcnic_init.c +++ b/drivers/net/qlcnic/qlcnic_init.c | |||
@@ -94,7 +94,7 @@ void qlcnic_release_rx_buffers(struct qlcnic_adapter *adapter) | |||
94 | struct qlcnic_rx_buffer *rx_buf; | 94 | struct qlcnic_rx_buffer *rx_buf; |
95 | int i, ring; | 95 | int i, ring; |
96 | 96 | ||
97 | recv_ctx = &adapter->recv_ctx; | 97 | recv_ctx = adapter->recv_ctx; |
98 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 98 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
99 | rds_ring = &recv_ctx->rds_rings[ring]; | 99 | rds_ring = &recv_ctx->rds_rings[ring]; |
100 | for (i = 0; i < rds_ring->num_desc; ++i) { | 100 | for (i = 0; i < rds_ring->num_desc; ++i) { |
@@ -119,7 +119,7 @@ void qlcnic_reset_rx_buffers_list(struct qlcnic_adapter *adapter) | |||
119 | struct qlcnic_rx_buffer *rx_buf; | 119 | struct qlcnic_rx_buffer *rx_buf; |
120 | int i, ring; | 120 | int i, ring; |
121 | 121 | ||
122 | recv_ctx = &adapter->recv_ctx; | 122 | recv_ctx = adapter->recv_ctx; |
123 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 123 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
124 | rds_ring = &recv_ctx->rds_rings[ring]; | 124 | rds_ring = &recv_ctx->rds_rings[ring]; |
125 | 125 | ||
@@ -173,7 +173,7 @@ void qlcnic_free_sw_resources(struct qlcnic_adapter *adapter) | |||
173 | struct qlcnic_host_tx_ring *tx_ring; | 173 | struct qlcnic_host_tx_ring *tx_ring; |
174 | int ring; | 174 | int ring; |
175 | 175 | ||
176 | recv_ctx = &adapter->recv_ctx; | 176 | recv_ctx = adapter->recv_ctx; |
177 | 177 | ||
178 | if (recv_ctx->rds_rings == NULL) | 178 | if (recv_ctx->rds_rings == NULL) |
179 | goto skip_rds; | 179 | goto skip_rds; |
@@ -226,7 +226,7 @@ int qlcnic_alloc_sw_resources(struct qlcnic_adapter *adapter) | |||
226 | } | 226 | } |
227 | tx_ring->cmd_buf_arr = cmd_buf_arr; | 227 | tx_ring->cmd_buf_arr = cmd_buf_arr; |
228 | 228 | ||
229 | recv_ctx = &adapter->recv_ctx; | 229 | recv_ctx = adapter->recv_ctx; |
230 | 230 | ||
231 | size = adapter->max_rds_rings * sizeof(struct qlcnic_host_rds_ring); | 231 | size = adapter->max_rds_rings * sizeof(struct qlcnic_host_rds_ring); |
232 | rds_ring = kzalloc(size, GFP_KERNEL); | 232 | rds_ring = kzalloc(size, GFP_KERNEL); |
@@ -864,7 +864,7 @@ nomn: | |||
864 | for (i = 0; i < entries; i++) { | 864 | for (i = 0; i < entries; i++) { |
865 | 865 | ||
866 | __le32 flags, file_chiprev, offs; | 866 | __le32 flags, file_chiprev, offs; |
867 | u8 chiprev = adapter->ahw.revision_id; | 867 | u8 chiprev = adapter->ahw->revision_id; |
868 | u32 flagbit; | 868 | u32 flagbit; |
869 | 869 | ||
870 | offs = cpu_to_le32(ptab_descr->findex) + | 870 | offs = cpu_to_le32(ptab_descr->findex) + |
@@ -1394,7 +1394,7 @@ static struct sk_buff *qlcnic_process_rxbuf(struct qlcnic_adapter *adapter, | |||
1394 | return skb; | 1394 | return skb; |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | static int | 1397 | static inline int |
1398 | qlcnic_check_rx_tagging(struct qlcnic_adapter *adapter, struct sk_buff *skb, | 1398 | qlcnic_check_rx_tagging(struct qlcnic_adapter *adapter, struct sk_buff *skb, |
1399 | u16 *vlan_tag) | 1399 | u16 *vlan_tag) |
1400 | { | 1400 | { |
@@ -1425,7 +1425,7 @@ qlcnic_process_rcv(struct qlcnic_adapter *adapter, | |||
1425 | int ring, u64 sts_data0) | 1425 | int ring, u64 sts_data0) |
1426 | { | 1426 | { |
1427 | struct net_device *netdev = adapter->netdev; | 1427 | struct net_device *netdev = adapter->netdev; |
1428 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 1428 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
1429 | struct qlcnic_rx_buffer *buffer; | 1429 | struct qlcnic_rx_buffer *buffer; |
1430 | struct sk_buff *skb; | 1430 | struct sk_buff *skb; |
1431 | struct qlcnic_host_rds_ring *rds_ring; | 1431 | struct qlcnic_host_rds_ring *rds_ring; |
@@ -1488,7 +1488,7 @@ qlcnic_process_lro(struct qlcnic_adapter *adapter, | |||
1488 | int ring, u64 sts_data0, u64 sts_data1) | 1488 | int ring, u64 sts_data0, u64 sts_data1) |
1489 | { | 1489 | { |
1490 | struct net_device *netdev = adapter->netdev; | 1490 | struct net_device *netdev = adapter->netdev; |
1491 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 1491 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
1492 | struct qlcnic_rx_buffer *buffer; | 1492 | struct qlcnic_rx_buffer *buffer; |
1493 | struct sk_buff *skb; | 1493 | struct sk_buff *skb; |
1494 | struct qlcnic_host_rds_ring *rds_ring; | 1494 | struct qlcnic_host_rds_ring *rds_ring; |
@@ -1625,7 +1625,7 @@ skip: | |||
1625 | 1625 | ||
1626 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 1626 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
1627 | struct qlcnic_host_rds_ring *rds_ring = | 1627 | struct qlcnic_host_rds_ring *rds_ring = |
1628 | &adapter->recv_ctx.rds_rings[ring]; | 1628 | &adapter->recv_ctx->rds_rings[ring]; |
1629 | 1629 | ||
1630 | if (!list_empty(&sds_ring->free_list[ring])) { | 1630 | if (!list_empty(&sds_ring->free_list[ring])) { |
1631 | list_for_each(cur, &sds_ring->free_list[ring]) { | 1631 | list_for_each(cur, &sds_ring->free_list[ring]) { |
@@ -1651,12 +1651,13 @@ skip: | |||
1651 | } | 1651 | } |
1652 | 1652 | ||
1653 | void | 1653 | void |
1654 | qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, | 1654 | qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, |
1655 | struct qlcnic_host_rds_ring *rds_ring) | 1655 | struct qlcnic_host_rds_ring *rds_ring) |
1656 | { | 1656 | { |
1657 | struct rcv_desc *pdesc; | 1657 | struct rcv_desc *pdesc; |
1658 | struct qlcnic_rx_buffer *buffer; | 1658 | struct qlcnic_rx_buffer *buffer; |
1659 | int producer, count = 0; | 1659 | int count = 0; |
1660 | u32 producer; | ||
1660 | struct list_head *head; | 1661 | struct list_head *head; |
1661 | 1662 | ||
1662 | producer = rds_ring->producer; | 1663 | producer = rds_ring->producer; |
@@ -1696,7 +1697,8 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter, | |||
1696 | { | 1697 | { |
1697 | struct rcv_desc *pdesc; | 1698 | struct rcv_desc *pdesc; |
1698 | struct qlcnic_rx_buffer *buffer; | 1699 | struct qlcnic_rx_buffer *buffer; |
1699 | int producer, count = 0; | 1700 | int count = 0; |
1701 | uint32_t producer; | ||
1700 | struct list_head *head; | 1702 | struct list_head *head; |
1701 | 1703 | ||
1702 | if (!spin_trylock(&rds_ring->lock)) | 1704 | if (!spin_trylock(&rds_ring->lock)) |
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index de6f86681a3c..dde7e4403830 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -113,7 +113,7 @@ static DEFINE_PCI_DEVICE_TABLE(qlcnic_pci_tbl) = { | |||
113 | MODULE_DEVICE_TABLE(pci, qlcnic_pci_tbl); | 113 | MODULE_DEVICE_TABLE(pci, qlcnic_pci_tbl); |
114 | 114 | ||
115 | 115 | ||
116 | void | 116 | inline void |
117 | qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter, | 117 | qlcnic_update_cmd_producer(struct qlcnic_adapter *adapter, |
118 | struct qlcnic_host_tx_ring *tx_ring) | 118 | struct qlcnic_host_tx_ring *tx_ring) |
119 | { | 119 | { |
@@ -169,7 +169,7 @@ qlcnic_napi_add(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
169 | { | 169 | { |
170 | int ring; | 170 | int ring; |
171 | struct qlcnic_host_sds_ring *sds_ring; | 171 | struct qlcnic_host_sds_ring *sds_ring; |
172 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 172 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
173 | 173 | ||
174 | if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings)) | 174 | if (qlcnic_alloc_sds_rings(recv_ctx, adapter->max_sds_rings)) |
175 | return -ENOMEM; | 175 | return -ENOMEM; |
@@ -193,14 +193,14 @@ qlcnic_napi_del(struct qlcnic_adapter *adapter) | |||
193 | { | 193 | { |
194 | int ring; | 194 | int ring; |
195 | struct qlcnic_host_sds_ring *sds_ring; | 195 | struct qlcnic_host_sds_ring *sds_ring; |
196 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 196 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
197 | 197 | ||
198 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 198 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
199 | sds_ring = &recv_ctx->sds_rings[ring]; | 199 | sds_ring = &recv_ctx->sds_rings[ring]; |
200 | netif_napi_del(&sds_ring->napi); | 200 | netif_napi_del(&sds_ring->napi); |
201 | } | 201 | } |
202 | 202 | ||
203 | qlcnic_free_sds_rings(&adapter->recv_ctx); | 203 | qlcnic_free_sds_rings(adapter->recv_ctx); |
204 | } | 204 | } |
205 | 205 | ||
206 | static void | 206 | static void |
@@ -208,7 +208,7 @@ qlcnic_napi_enable(struct qlcnic_adapter *adapter) | |||
208 | { | 208 | { |
209 | int ring; | 209 | int ring; |
210 | struct qlcnic_host_sds_ring *sds_ring; | 210 | struct qlcnic_host_sds_ring *sds_ring; |
211 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 211 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
212 | 212 | ||
213 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 213 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
214 | return; | 214 | return; |
@@ -225,7 +225,7 @@ qlcnic_napi_disable(struct qlcnic_adapter *adapter) | |||
225 | { | 225 | { |
226 | int ring; | 226 | int ring; |
227 | struct qlcnic_host_sds_ring *sds_ring; | 227 | struct qlcnic_host_sds_ring *sds_ring; |
228 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 228 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
229 | 229 | ||
230 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) | 230 | if (adapter->is_up != QLCNIC_ADAPTER_UP_MAGIC) |
231 | return; | 231 | return; |
@@ -359,7 +359,7 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter) | |||
359 | struct pci_dev *pdev = adapter->pdev; | 359 | struct pci_dev *pdev = adapter->pdev; |
360 | int err, num_msix; | 360 | int err, num_msix; |
361 | 361 | ||
362 | if (adapter->rss_supported) { | 362 | if (adapter->msix_supported) { |
363 | num_msix = (num_online_cpus() >= MSIX_ENTRIES_PER_ADAPTER) ? | 363 | num_msix = (num_online_cpus() >= MSIX_ENTRIES_PER_ADAPTER) ? |
364 | MSIX_ENTRIES_PER_ADAPTER : 2; | 364 | MSIX_ENTRIES_PER_ADAPTER : 2; |
365 | } else | 365 | } else |
@@ -369,7 +369,7 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter) | |||
369 | 369 | ||
370 | adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED); | 370 | adapter->flags &= ~(QLCNIC_MSI_ENABLED | QLCNIC_MSIX_ENABLED); |
371 | 371 | ||
372 | legacy_intrp = &legacy_intr[adapter->ahw.pci_func]; | 372 | legacy_intrp = &legacy_intr[adapter->ahw->pci_func]; |
373 | 373 | ||
374 | adapter->int_vec_bit = legacy_intrp->int_vec_bit; | 374 | adapter->int_vec_bit = legacy_intrp->int_vec_bit; |
375 | adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter, | 375 | adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter, |
@@ -391,8 +391,7 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter) | |||
391 | adapter->flags |= QLCNIC_MSIX_ENABLED; | 391 | adapter->flags |= QLCNIC_MSIX_ENABLED; |
392 | qlcnic_set_msix_bit(pdev, 1); | 392 | qlcnic_set_msix_bit(pdev, 1); |
393 | 393 | ||
394 | if (adapter->rss_supported) | 394 | adapter->max_sds_rings = num_msix; |
395 | adapter->max_sds_rings = num_msix; | ||
396 | 395 | ||
397 | dev_info(&pdev->dev, "using msi-x interrupts\n"); | 396 | dev_info(&pdev->dev, "using msi-x interrupts\n"); |
398 | return; | 397 | return; |
@@ -407,7 +406,7 @@ qlcnic_setup_intr(struct qlcnic_adapter *adapter) | |||
407 | if (use_msi && !pci_enable_msi(pdev)) { | 406 | if (use_msi && !pci_enable_msi(pdev)) { |
408 | adapter->flags |= QLCNIC_MSI_ENABLED; | 407 | adapter->flags |= QLCNIC_MSI_ENABLED; |
409 | adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter, | 408 | adapter->tgt_status_reg = qlcnic_get_ioaddr(adapter, |
410 | msi_tgt_status[adapter->ahw.pci_func]); | 409 | msi_tgt_status[adapter->ahw->pci_func]); |
411 | dev_info(&pdev->dev, "using msi interrupts\n"); | 410 | dev_info(&pdev->dev, "using msi interrupts\n"); |
412 | adapter->msix_entries[0].vector = pdev->irq; | 411 | adapter->msix_entries[0].vector = pdev->irq; |
413 | return; | 412 | return; |
@@ -429,8 +428,8 @@ qlcnic_teardown_intr(struct qlcnic_adapter *adapter) | |||
429 | static void | 428 | static void |
430 | qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter) | 429 | qlcnic_cleanup_pci_map(struct qlcnic_adapter *adapter) |
431 | { | 430 | { |
432 | if (adapter->ahw.pci_base0 != NULL) | 431 | if (adapter->ahw->pci_base0 != NULL) |
433 | iounmap(adapter->ahw.pci_base0); | 432 | iounmap(adapter->ahw->pci_base0); |
434 | } | 433 | } |
435 | 434 | ||
436 | static int | 435 | static int |
@@ -500,7 +499,7 @@ qlcnic_set_function_modes(struct qlcnic_adapter *adapter) | |||
500 | u32 ref_count; | 499 | u32 ref_count; |
501 | int i, ret = 1; | 500 | int i, ret = 1; |
502 | u32 data = QLCNIC_MGMT_FUNC; | 501 | u32 data = QLCNIC_MGMT_FUNC; |
503 | void __iomem *priv_op = adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE; | 502 | void __iomem *priv_op = adapter->ahw->pci_base0 + QLCNIC_DRV_OP_MODE; |
504 | 503 | ||
505 | /* If other drivers are not in use set their privilege level */ | 504 | /* If other drivers are not in use set their privilege level */ |
506 | ref_count = QLCRD32(adapter, QLCNIC_CRB_DRV_ACTIVE); | 505 | ref_count = QLCRD32(adapter, QLCNIC_CRB_DRV_ACTIVE); |
@@ -512,16 +511,16 @@ qlcnic_set_function_modes(struct qlcnic_adapter *adapter) | |||
512 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { | 511 | for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { |
513 | id = i; | 512 | id = i; |
514 | if (adapter->npars[i].type != QLCNIC_TYPE_NIC || | 513 | if (adapter->npars[i].type != QLCNIC_TYPE_NIC || |
515 | id == adapter->ahw.pci_func) | 514 | id == adapter->ahw->pci_func) |
516 | continue; | 515 | continue; |
517 | data |= (qlcnic_config_npars & | 516 | data |= (qlcnic_config_npars & |
518 | QLC_DEV_SET_DRV(0xf, id)); | 517 | QLC_DEV_SET_DRV(0xf, id)); |
519 | } | 518 | } |
520 | } else { | 519 | } else { |
521 | data = readl(priv_op); | 520 | data = readl(priv_op); |
522 | data = (data & ~QLC_DEV_SET_DRV(0xf, adapter->ahw.pci_func)) | | 521 | data = (data & ~QLC_DEV_SET_DRV(0xf, adapter->ahw->pci_func)) | |
523 | (QLC_DEV_SET_DRV(QLCNIC_MGMT_FUNC, | 522 | (QLC_DEV_SET_DRV(QLCNIC_MGMT_FUNC, |
524 | adapter->ahw.pci_func)); | 523 | adapter->ahw->pci_func)); |
525 | } | 524 | } |
526 | writel(data, priv_op); | 525 | writel(data, priv_op); |
527 | qlcnic_api_unlock(adapter); | 526 | qlcnic_api_unlock(adapter); |
@@ -539,22 +538,23 @@ qlcnic_check_vf(struct qlcnic_adapter *adapter) | |||
539 | u32 op_mode, priv_level; | 538 | u32 op_mode, priv_level; |
540 | 539 | ||
541 | /* Determine FW API version */ | 540 | /* Determine FW API version */ |
542 | adapter->fw_hal_version = readl(adapter->ahw.pci_base0 + QLCNIC_FW_API); | 541 | adapter->fw_hal_version = readl(adapter->ahw->pci_base0 + |
542 | QLCNIC_FW_API); | ||
543 | 543 | ||
544 | /* Find PCI function number */ | 544 | /* Find PCI function number */ |
545 | pci_read_config_dword(adapter->pdev, QLCNIC_MSIX_TABLE_OFFSET, &func); | 545 | pci_read_config_dword(adapter->pdev, QLCNIC_MSIX_TABLE_OFFSET, &func); |
546 | msix_base_addr = adapter->ahw.pci_base0 + QLCNIC_MSIX_BASE; | 546 | msix_base_addr = adapter->ahw->pci_base0 + QLCNIC_MSIX_BASE; |
547 | msix_base = readl(msix_base_addr); | 547 | msix_base = readl(msix_base_addr); |
548 | func = (func - msix_base)/QLCNIC_MSIX_TBL_PGSIZE; | 548 | func = (func - msix_base)/QLCNIC_MSIX_TBL_PGSIZE; |
549 | adapter->ahw.pci_func = func; | 549 | adapter->ahw->pci_func = func; |
550 | 550 | ||
551 | /* Determine function privilege level */ | 551 | /* Determine function privilege level */ |
552 | priv_op = adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE; | 552 | priv_op = adapter->ahw->pci_base0 + QLCNIC_DRV_OP_MODE; |
553 | op_mode = readl(priv_op); | 553 | op_mode = readl(priv_op); |
554 | if (op_mode == QLC_DEV_DRV_DEFAULT) | 554 | if (op_mode == QLC_DEV_DRV_DEFAULT) |
555 | priv_level = QLCNIC_MGMT_FUNC; | 555 | priv_level = QLCNIC_MGMT_FUNC; |
556 | else | 556 | else |
557 | priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func); | 557 | priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw->pci_func); |
558 | 558 | ||
559 | if (priv_level == QLCNIC_NON_PRIV_FUNC) { | 559 | if (priv_level == QLCNIC_NON_PRIV_FUNC) { |
560 | adapter->op_mode = QLCNIC_NON_PRIV_FUNC; | 560 | adapter->op_mode = QLCNIC_NON_PRIV_FUNC; |
@@ -593,13 +593,14 @@ qlcnic_setup_pci_map(struct qlcnic_adapter *adapter) | |||
593 | 593 | ||
594 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); | 594 | dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20)); |
595 | 595 | ||
596 | adapter->ahw.pci_base0 = mem_ptr0; | 596 | adapter->ahw->pci_base0 = mem_ptr0; |
597 | adapter->ahw.pci_len0 = pci_len0; | 597 | adapter->ahw->pci_len0 = pci_len0; |
598 | 598 | ||
599 | qlcnic_check_vf(adapter); | 599 | qlcnic_check_vf(adapter); |
600 | 600 | ||
601 | adapter->ahw.ocm_win_crb = qlcnic_get_ioaddr(adapter, | 601 | adapter->ahw->ocm_win_crb = qlcnic_get_ioaddr(adapter, |
602 | QLCNIC_PCIX_PS_REG(PCIX_OCM_WINDOW_REG(adapter->ahw.pci_func))); | 602 | QLCNIC_PCIX_PS_REG(PCIX_OCM_WINDOW_REG( |
603 | adapter->ahw->pci_func))); | ||
603 | 604 | ||
604 | return 0; | 605 | return 0; |
605 | } | 606 | } |
@@ -641,7 +642,7 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) | |||
641 | 642 | ||
642 | dev_info(&pdev->dev, "firmware v%d.%d.%d\n", | 643 | dev_info(&pdev->dev, "firmware v%d.%d.%d\n", |
643 | fw_major, fw_minor, fw_build); | 644 | fw_major, fw_minor, fw_build); |
644 | if (adapter->ahw.port_type == QLCNIC_XGBE) { | 645 | if (adapter->ahw->port_type == QLCNIC_XGBE) { |
645 | if (adapter->flags & QLCNIC_ESWITCH_ENABLED) { | 646 | if (adapter->flags & QLCNIC_ESWITCH_ENABLED) { |
646 | adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_VF; | 647 | adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_VF; |
647 | adapter->max_rxd = MAX_RCV_DESCRIPTORS_VF; | 648 | adapter->max_rxd = MAX_RCV_DESCRIPTORS_VF; |
@@ -653,7 +654,7 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) | |||
653 | adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; | 654 | adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; |
654 | adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; | 655 | adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_10G; |
655 | 656 | ||
656 | } else if (adapter->ahw.port_type == QLCNIC_GBE) { | 657 | } else if (adapter->ahw->port_type == QLCNIC_GBE) { |
657 | adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_1G; | 658 | adapter->num_rxd = DEFAULT_RCV_DESCRIPTORS_1G; |
658 | adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; | 659 | adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; |
659 | adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; | 660 | adapter->max_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; |
@@ -661,7 +662,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter) | |||
661 | } | 662 | } |
662 | 663 | ||
663 | adapter->msix_supported = !!use_msi_x; | 664 | adapter->msix_supported = !!use_msi_x; |
664 | adapter->rss_supported = !!use_msi_x; | ||
665 | 665 | ||
666 | adapter->num_txd = MAX_CMD_DESCRIPTORS; | 666 | adapter->num_txd = MAX_CMD_DESCRIPTORS; |
667 | 667 | ||
@@ -674,7 +674,7 @@ qlcnic_initialize_nic(struct qlcnic_adapter *adapter) | |||
674 | int err; | 674 | int err; |
675 | struct qlcnic_info nic_info; | 675 | struct qlcnic_info nic_info; |
676 | 676 | ||
677 | err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw.pci_func); | 677 | err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw->pci_func); |
678 | if (err) | 678 | if (err) |
679 | return err; | 679 | return err; |
680 | 680 | ||
@@ -736,7 +736,7 @@ qlcnic_set_eswitch_port_config(struct qlcnic_adapter *adapter) | |||
736 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) | 736 | if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED)) |
737 | return 0; | 737 | return 0; |
738 | 738 | ||
739 | esw_cfg.pci_func = adapter->ahw.pci_func; | 739 | esw_cfg.pci_func = adapter->ahw->pci_func; |
740 | if (qlcnic_get_eswitch_port_config(adapter, &esw_cfg)) | 740 | if (qlcnic_get_eswitch_port_config(adapter, &esw_cfg)) |
741 | return -EIO; | 741 | return -EIO; |
742 | qlcnic_set_vlan_config(adapter, &esw_cfg); | 742 | qlcnic_set_vlan_config(adapter, &esw_cfg); |
@@ -793,14 +793,14 @@ qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter) | |||
793 | if (adapter->flags & QLCNIC_ADAPTER_INITIALIZED) | 793 | if (adapter->flags & QLCNIC_ADAPTER_INITIALIZED) |
794 | return 0; | 794 | return 0; |
795 | 795 | ||
796 | priv_op = adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE; | 796 | priv_op = adapter->ahw->pci_base0 + QLCNIC_DRV_OP_MODE; |
797 | op_mode = readl(priv_op); | 797 | op_mode = readl(priv_op); |
798 | priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func); | 798 | priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw->pci_func); |
799 | 799 | ||
800 | if (op_mode == QLC_DEV_DRV_DEFAULT) | 800 | if (op_mode == QLC_DEV_DRV_DEFAULT) |
801 | priv_level = QLCNIC_MGMT_FUNC; | 801 | priv_level = QLCNIC_MGMT_FUNC; |
802 | else | 802 | else |
803 | priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func); | 803 | priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw->pci_func); |
804 | 804 | ||
805 | if (adapter->flags & QLCNIC_ESWITCH_ENABLED) { | 805 | if (adapter->flags & QLCNIC_ESWITCH_ENABLED) { |
806 | if (priv_level == QLCNIC_MGMT_FUNC) { | 806 | if (priv_level == QLCNIC_MGMT_FUNC) { |
@@ -1040,7 +1040,7 @@ qlcnic_request_irq(struct qlcnic_adapter *adapter) | |||
1040 | 1040 | ||
1041 | unsigned long flags = 0; | 1041 | unsigned long flags = 0; |
1042 | struct net_device *netdev = adapter->netdev; | 1042 | struct net_device *netdev = adapter->netdev; |
1043 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 1043 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
1044 | 1044 | ||
1045 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { | 1045 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { |
1046 | handler = qlcnic_tmp_intr; | 1046 | handler = qlcnic_tmp_intr; |
@@ -1077,7 +1077,7 @@ qlcnic_free_irq(struct qlcnic_adapter *adapter) | |||
1077 | int ring; | 1077 | int ring; |
1078 | struct qlcnic_host_sds_ring *sds_ring; | 1078 | struct qlcnic_host_sds_ring *sds_ring; |
1079 | 1079 | ||
1080 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 1080 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
1081 | 1081 | ||
1082 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1082 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
1083 | sds_ring = &recv_ctx->sds_rings[ring]; | 1083 | sds_ring = &recv_ctx->sds_rings[ring]; |
@@ -1117,14 +1117,14 @@ __qlcnic_up(struct qlcnic_adapter *adapter, struct net_device *netdev) | |||
1117 | return -EIO; | 1117 | return -EIO; |
1118 | 1118 | ||
1119 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 1119 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
1120 | rds_ring = &adapter->recv_ctx.rds_rings[ring]; | 1120 | rds_ring = &adapter->recv_ctx->rds_rings[ring]; |
1121 | qlcnic_post_rx_buffers(adapter, ring, rds_ring); | 1121 | qlcnic_post_rx_buffers(adapter, rds_ring); |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | qlcnic_set_multi(netdev); | 1124 | qlcnic_set_multi(netdev); |
1125 | qlcnic_fw_cmd_set_mtu(adapter, netdev->mtu); | 1125 | qlcnic_fw_cmd_set_mtu(adapter, netdev->mtu); |
1126 | 1126 | ||
1127 | adapter->ahw.linkup = 0; | 1127 | adapter->ahw->linkup = 0; |
1128 | 1128 | ||
1129 | if (adapter->max_sds_rings > 1) | 1129 | if (adapter->max_sds_rings > 1) |
1130 | qlcnic_config_rss(adapter, 1); | 1130 | qlcnic_config_rss(adapter, 1); |
@@ -1274,7 +1274,7 @@ void qlcnic_diag_free_res(struct net_device *netdev, int max_sds_rings) | |||
1274 | clear_bit(__QLCNIC_DEV_UP, &adapter->state); | 1274 | clear_bit(__QLCNIC_DEV_UP, &adapter->state); |
1275 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { | 1275 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { |
1276 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1276 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
1277 | sds_ring = &adapter->recv_ctx.sds_rings[ring]; | 1277 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; |
1278 | qlcnic_disable_int(sds_ring); | 1278 | qlcnic_disable_int(sds_ring); |
1279 | } | 1279 | } |
1280 | } | 1280 | } |
@@ -1295,6 +1295,39 @@ out: | |||
1295 | netif_device_attach(netdev); | 1295 | netif_device_attach(netdev); |
1296 | } | 1296 | } |
1297 | 1297 | ||
1298 | static int qlcnic_alloc_adapter_resources(struct qlcnic_adapter *adapter) | ||
1299 | { | ||
1300 | int err = 0; | ||
1301 | adapter->ahw = kzalloc(sizeof(struct qlcnic_hardware_context), | ||
1302 | GFP_KERNEL); | ||
1303 | if (!adapter->ahw) { | ||
1304 | dev_err(&adapter->pdev->dev, | ||
1305 | "Failed to allocate recv ctx resources for adapter\n"); | ||
1306 | err = -ENOMEM; | ||
1307 | goto err_out; | ||
1308 | } | ||
1309 | adapter->recv_ctx = kzalloc(sizeof(struct qlcnic_recv_context), | ||
1310 | GFP_KERNEL); | ||
1311 | if (!adapter->recv_ctx) { | ||
1312 | dev_err(&adapter->pdev->dev, | ||
1313 | "Failed to allocate recv ctx resources for adapter\n"); | ||
1314 | kfree(adapter->ahw); | ||
1315 | adapter->ahw = NULL; | ||
1316 | err = -ENOMEM; | ||
1317 | } | ||
1318 | err_out: | ||
1319 | return err; | ||
1320 | } | ||
1321 | |||
1322 | static void qlcnic_free_adapter_resources(struct qlcnic_adapter *adapter) | ||
1323 | { | ||
1324 | kfree(adapter->recv_ctx); | ||
1325 | adapter->recv_ctx = NULL; | ||
1326 | |||
1327 | kfree(adapter->ahw); | ||
1328 | adapter->ahw = NULL; | ||
1329 | } | ||
1330 | |||
1298 | int qlcnic_diag_alloc_res(struct net_device *netdev, int test) | 1331 | int qlcnic_diag_alloc_res(struct net_device *netdev, int test) |
1299 | { | 1332 | { |
1300 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 1333 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
@@ -1327,13 +1360,13 @@ int qlcnic_diag_alloc_res(struct net_device *netdev, int test) | |||
1327 | } | 1360 | } |
1328 | 1361 | ||
1329 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { | 1362 | for (ring = 0; ring < adapter->max_rds_rings; ring++) { |
1330 | rds_ring = &adapter->recv_ctx.rds_rings[ring]; | 1363 | rds_ring = &adapter->recv_ctx->rds_rings[ring]; |
1331 | qlcnic_post_rx_buffers(adapter, ring, rds_ring); | 1364 | qlcnic_post_rx_buffers(adapter, rds_ring); |
1332 | } | 1365 | } |
1333 | 1366 | ||
1334 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { | 1367 | if (adapter->diag_test == QLCNIC_INTERRUPT_TEST) { |
1335 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 1368 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
1336 | sds_ring = &adapter->recv_ctx.sds_rings[ring]; | 1369 | sds_ring = &adapter->recv_ctx->sds_rings[ring]; |
1337 | qlcnic_enable_int(sds_ring); | 1370 | qlcnic_enable_int(sds_ring); |
1338 | } | 1371 | } |
1339 | } | 1372 | } |
@@ -1503,23 +1536,26 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1503 | adapter = netdev_priv(netdev); | 1536 | adapter = netdev_priv(netdev); |
1504 | adapter->netdev = netdev; | 1537 | adapter->netdev = netdev; |
1505 | adapter->pdev = pdev; | 1538 | adapter->pdev = pdev; |
1506 | adapter->dev_rst_time = jiffies; | ||
1507 | 1539 | ||
1540 | if (qlcnic_alloc_adapter_resources(adapter)) | ||
1541 | goto err_out_free_netdev; | ||
1542 | |||
1543 | adapter->dev_rst_time = jiffies; | ||
1508 | revision_id = pdev->revision; | 1544 | revision_id = pdev->revision; |
1509 | adapter->ahw.revision_id = revision_id; | 1545 | adapter->ahw->revision_id = revision_id; |
1510 | 1546 | ||
1511 | rwlock_init(&adapter->ahw.crb_lock); | 1547 | rwlock_init(&adapter->ahw->crb_lock); |
1512 | mutex_init(&adapter->ahw.mem_lock); | 1548 | mutex_init(&adapter->ahw->mem_lock); |
1513 | 1549 | ||
1514 | spin_lock_init(&adapter->tx_clean_lock); | 1550 | spin_lock_init(&adapter->tx_clean_lock); |
1515 | INIT_LIST_HEAD(&adapter->mac_list); | 1551 | INIT_LIST_HEAD(&adapter->mac_list); |
1516 | 1552 | ||
1517 | err = qlcnic_setup_pci_map(adapter); | 1553 | err = qlcnic_setup_pci_map(adapter); |
1518 | if (err) | 1554 | if (err) |
1519 | goto err_out_free_netdev; | 1555 | goto err_out_free_hw; |
1520 | 1556 | ||
1521 | /* This will be reset for mezz cards */ | 1557 | /* This will be reset for mezz cards */ |
1522 | adapter->portnum = adapter->ahw.pci_func; | 1558 | adapter->portnum = adapter->ahw->pci_func; |
1523 | 1559 | ||
1524 | err = qlcnic_get_board_info(adapter); | 1560 | err = qlcnic_get_board_info(adapter); |
1525 | if (err) { | 1561 | if (err) { |
@@ -1547,7 +1583,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1547 | 1583 | ||
1548 | pr_info("%s: %s Board Chip rev 0x%x\n", | 1584 | pr_info("%s: %s Board Chip rev 0x%x\n", |
1549 | module_name(THIS_MODULE), | 1585 | module_name(THIS_MODULE), |
1550 | brd_name, adapter->ahw.revision_id); | 1586 | brd_name, adapter->ahw->revision_id); |
1551 | } | 1587 | } |
1552 | 1588 | ||
1553 | qlcnic_clear_stats(adapter); | 1589 | qlcnic_clear_stats(adapter); |
@@ -1562,7 +1598,7 @@ qlcnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1562 | 1598 | ||
1563 | qlcnic_schedule_work(adapter, qlcnic_fw_poll_work, FW_POLL_DELAY); | 1599 | qlcnic_schedule_work(adapter, qlcnic_fw_poll_work, FW_POLL_DELAY); |
1564 | 1600 | ||
1565 | switch (adapter->ahw.port_type) { | 1601 | switch (adapter->ahw->port_type) { |
1566 | case QLCNIC_GBE: | 1602 | case QLCNIC_GBE: |
1567 | dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n", | 1603 | dev_info(&adapter->pdev->dev, "%s: GbE port initialized\n", |
1568 | adapter->netdev->name); | 1604 | adapter->netdev->name); |
@@ -1587,6 +1623,9 @@ err_out_decr_ref: | |||
1587 | err_out_iounmap: | 1623 | err_out_iounmap: |
1588 | qlcnic_cleanup_pci_map(adapter); | 1624 | qlcnic_cleanup_pci_map(adapter); |
1589 | 1625 | ||
1626 | err_out_free_hw: | ||
1627 | qlcnic_free_adapter_resources(adapter); | ||
1628 | |||
1590 | err_out_free_netdev: | 1629 | err_out_free_netdev: |
1591 | free_netdev(netdev); | 1630 | free_netdev(netdev); |
1592 | 1631 | ||
@@ -1640,6 +1679,7 @@ static void __devexit qlcnic_remove(struct pci_dev *pdev) | |||
1640 | pci_disable_device(pdev); | 1679 | pci_disable_device(pdev); |
1641 | pci_set_drvdata(pdev, NULL); | 1680 | pci_set_drvdata(pdev, NULL); |
1642 | 1681 | ||
1682 | qlcnic_free_adapter_resources(adapter); | ||
1643 | free_netdev(netdev); | 1683 | free_netdev(netdev); |
1644 | } | 1684 | } |
1645 | static int __qlcnic_shutdown(struct pci_dev *pdev) | 1685 | static int __qlcnic_shutdown(struct pci_dev *pdev) |
@@ -2248,16 +2288,16 @@ void qlcnic_advert_link_change(struct qlcnic_adapter *adapter, int linkup) | |||
2248 | { | 2288 | { |
2249 | struct net_device *netdev = adapter->netdev; | 2289 | struct net_device *netdev = adapter->netdev; |
2250 | 2290 | ||
2251 | if (adapter->ahw.linkup && !linkup) { | 2291 | if (adapter->ahw->linkup && !linkup) { |
2252 | netdev_info(netdev, "NIC Link is down\n"); | 2292 | netdev_info(netdev, "NIC Link is down\n"); |
2253 | adapter->ahw.linkup = 0; | 2293 | adapter->ahw->linkup = 0; |
2254 | if (netif_running(netdev)) { | 2294 | if (netif_running(netdev)) { |
2255 | netif_carrier_off(netdev); | 2295 | netif_carrier_off(netdev); |
2256 | netif_stop_queue(netdev); | 2296 | netif_stop_queue(netdev); |
2257 | } | 2297 | } |
2258 | } else if (!adapter->ahw.linkup && linkup) { | 2298 | } else if (!adapter->ahw->linkup && linkup) { |
2259 | netdev_info(netdev, "NIC Link is up\n"); | 2299 | netdev_info(netdev, "NIC Link is up\n"); |
2260 | adapter->ahw.linkup = 1; | 2300 | adapter->ahw->linkup = 1; |
2261 | if (netif_running(netdev)) { | 2301 | if (netif_running(netdev)) { |
2262 | netif_carrier_on(netdev); | 2302 | netif_carrier_on(netdev); |
2263 | netif_wake_queue(netdev); | 2303 | netif_wake_queue(netdev); |
@@ -2493,7 +2533,7 @@ static void qlcnic_poll_controller(struct net_device *netdev) | |||
2493 | int ring; | 2533 | int ring; |
2494 | struct qlcnic_host_sds_ring *sds_ring; | 2534 | struct qlcnic_host_sds_ring *sds_ring; |
2495 | struct qlcnic_adapter *adapter = netdev_priv(netdev); | 2535 | struct qlcnic_adapter *adapter = netdev_priv(netdev); |
2496 | struct qlcnic_recv_context *recv_ctx = &adapter->recv_ctx; | 2536 | struct qlcnic_recv_context *recv_ctx = adapter->recv_ctx; |
2497 | 2537 | ||
2498 | disable_irq(adapter->irq); | 2538 | disable_irq(adapter->irq); |
2499 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { | 2539 | for (ring = 0; ring < adapter->max_sds_rings; ring++) { |
@@ -3503,7 +3543,7 @@ validate_esw_config(struct qlcnic_adapter *adapter, | |||
3503 | u8 pci_func; | 3543 | u8 pci_func; |
3504 | int i; | 3544 | int i; |
3505 | 3545 | ||
3506 | op_mode = readl(adapter->ahw.pci_base0 + QLCNIC_DRV_OP_MODE); | 3546 | op_mode = readl(adapter->ahw->pci_base0 + QLCNIC_DRV_OP_MODE); |
3507 | 3547 | ||
3508 | for (i = 0; i < count; i++) { | 3548 | for (i = 0; i < count; i++) { |
3509 | pci_func = esw_cfg[i].pci_func; | 3549 | pci_func = esw_cfg[i].pci_func; |
@@ -3569,13 +3609,13 @@ qlcnic_sysfs_write_esw_config(struct file *file, struct kobject *kobj, | |||
3569 | if (qlcnic_config_switch_port(adapter, &esw_cfg[i])) | 3609 | if (qlcnic_config_switch_port(adapter, &esw_cfg[i])) |
3570 | return QL_STATUS_INVALID_PARAM; | 3610 | return QL_STATUS_INVALID_PARAM; |
3571 | 3611 | ||
3572 | if (adapter->ahw.pci_func != esw_cfg[i].pci_func) | 3612 | if (adapter->ahw->pci_func != esw_cfg[i].pci_func) |
3573 | continue; | 3613 | continue; |
3574 | 3614 | ||
3575 | op_mode = esw_cfg[i].op_mode; | 3615 | op_mode = esw_cfg[i].op_mode; |
3576 | qlcnic_get_eswitch_port_config(adapter, &esw_cfg[i]); | 3616 | qlcnic_get_eswitch_port_config(adapter, &esw_cfg[i]); |
3577 | esw_cfg[i].op_mode = op_mode; | 3617 | esw_cfg[i].op_mode = op_mode; |
3578 | esw_cfg[i].pci_func = adapter->ahw.pci_func; | 3618 | esw_cfg[i].pci_func = adapter->ahw->pci_func; |
3579 | 3619 | ||
3580 | switch (esw_cfg[i].op_mode) { | 3620 | switch (esw_cfg[i].op_mode) { |
3581 | case QLCNIC_PORT_DEFAULTS: | 3621 | case QLCNIC_PORT_DEFAULTS: |