aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/qlcnic
diff options
context:
space:
mode:
authorRajesh Borundia <rajesh.borundia@qlogic.com>2010-08-31 13:17:47 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-01 13:41:54 -0400
commit174240a8efc441f01f2909ee167c0c15099c0212 (patch)
tree059bf1a61e9e2d0b0a7091c87cec48cab7a4d0f1 /drivers/net/qlcnic
parentda48e6c362d24d324f36a780d8566109e5f5a1d7 (diff)
qlcnic: fix for setting default eswitch config
o Default eswitch config was set, even before eswitch capabilty get detected. As a result setting default config was getting fail. Signed-off-by: Rajesh Borundia <rajesh.borundia@qlogic.com> Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/qlcnic')
-rw-r--r--drivers/net/qlcnic/qlcnic_main.c96
1 files changed, 65 insertions, 31 deletions
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c
index 3f2f93b1a9fe..e0c6811610ab 100644
--- a/drivers/net/qlcnic/qlcnic_main.c
+++ b/drivers/net/qlcnic/qlcnic_main.c
@@ -667,7 +667,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
667{ 667{
668 u32 fw_major, fw_minor, fw_build; 668 u32 fw_major, fw_minor, fw_build;
669 struct pci_dev *pdev = adapter->pdev; 669 struct pci_dev *pdev = adapter->pdev;
670 struct qlcnic_info nic_info;
671 670
672 fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR); 671 fw_major = QLCRD32(adapter, QLCNIC_FW_VERSION_MAJOR);
673 fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR); 672 fw_minor = QLCRD32(adapter, QLCNIC_FW_VERSION_MINOR);
@@ -688,16 +687,6 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
688 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G; 687 adapter->num_jumbo_rxd = MAX_JUMBO_RCV_DESCRIPTORS_1G;
689 } 688 }
690 689
691 if (!qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw.pci_func)) {
692 adapter->physical_port = nic_info.phys_port;
693 adapter->switch_mode = nic_info.switch_mode;
694 adapter->max_tx_ques = nic_info.max_tx_ques;
695 adapter->max_rx_ques = nic_info.max_rx_ques;
696 adapter->capabilities = nic_info.capabilities;
697 adapter->max_mac_filters = nic_info.max_mac_filters;
698 adapter->max_mtu = nic_info.max_mtu;
699 }
700
701 adapter->msix_supported = !!use_msi_x; 690 adapter->msix_supported = !!use_msi_x;
702 adapter->rss_supported = !!use_msi_x; 691 adapter->rss_supported = !!use_msi_x;
703 692
@@ -706,6 +695,32 @@ qlcnic_check_options(struct qlcnic_adapter *adapter)
706 adapter->max_rds_rings = MAX_RDS_RINGS; 695 adapter->max_rds_rings = MAX_RDS_RINGS;
707} 696}
708 697
698static int
699qlcnic_initialize_nic(struct qlcnic_adapter *adapter)
700{
701 int err;
702 struct qlcnic_info nic_info;
703
704 err = qlcnic_get_nic_info(adapter, &nic_info, adapter->ahw.pci_func);
705 if (err)
706 return err;
707
708 adapter->physical_port = nic_info.phys_port;
709 adapter->switch_mode = nic_info.switch_mode;
710 adapter->max_tx_ques = nic_info.max_tx_ques;
711 adapter->max_rx_ques = nic_info.max_rx_ques;
712 adapter->capabilities = nic_info.capabilities;
713 adapter->max_mac_filters = nic_info.max_mac_filters;
714 adapter->max_mtu = nic_info.max_mtu;
715
716 if (adapter->capabilities & BIT_6)
717 adapter->flags |= QLCNIC_ESWITCH_ENABLED;
718 else
719 adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
720
721 return err;
722}
723
709static void 724static void
710qlcnic_set_vlan_config(struct qlcnic_adapter *adapter, 725qlcnic_set_vlan_config(struct qlcnic_adapter *adapter,
711 struct qlcnic_esw_func_cfg *esw_cfg) 726 struct qlcnic_esw_func_cfg *esw_cfg)
@@ -791,6 +806,10 @@ qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter)
791 u32 op_mode, priv_level; 806 u32 op_mode, priv_level;
792 int err = 0; 807 int err = 0;
793 808
809 err = qlcnic_initialize_nic(adapter);
810 if (err)
811 return err;
812
794 if (adapter->flags & QLCNIC_ADAPTER_INITIALIZED) 813 if (adapter->flags & QLCNIC_ADAPTER_INITIALIZED)
795 return 0; 814 return 0;
796 815
@@ -803,8 +822,7 @@ qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter)
803 else 822 else
804 priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func); 823 priv_level = QLC_DEV_GET_DRV(op_mode, adapter->ahw.pci_func);
805 824
806 if (adapter->capabilities & BIT_6) { 825 if (adapter->flags & QLCNIC_ESWITCH_ENABLED) {
807 adapter->flags |= QLCNIC_ESWITCH_ENABLED;
808 if (priv_level == QLCNIC_MGMT_FUNC) { 826 if (priv_level == QLCNIC_MGMT_FUNC) {
809 adapter->op_mode = QLCNIC_MGMT_FUNC; 827 adapter->op_mode = QLCNIC_MGMT_FUNC;
810 err = qlcnic_init_pci_info(adapter); 828 err = qlcnic_init_pci_info(adapter);
@@ -821,8 +839,7 @@ qlcnic_check_eswitch_mode(struct qlcnic_adapter *adapter)
821 "HAL Version: %d, Privileged function\n", 839 "HAL Version: %d, Privileged function\n",
822 adapter->fw_hal_version); 840 adapter->fw_hal_version);
823 } 841 }
824 } else 842 }
825 adapter->flags &= ~QLCNIC_ESWITCH_ENABLED;
826 843
827 adapter->flags |= QLCNIC_ADAPTER_INITIALIZED; 844 adapter->flags |= QLCNIC_ADAPTER_INITIALIZED;
828 845
@@ -836,9 +853,7 @@ qlcnic_set_default_offload_settings(struct qlcnic_adapter *adapter)
836 struct qlcnic_npar_info *npar; 853 struct qlcnic_npar_info *npar;
837 u8 i; 854 u8 i;
838 855
839 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) || 856 if (adapter->need_fw_reset)
840 adapter->need_fw_reset ||
841 adapter->op_mode != QLCNIC_MGMT_FUNC)
842 return 0; 857 return 0;
843 858
844 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) { 859 for (i = 0; i < QLCNIC_MAX_PCI_FUNC; i++) {
@@ -894,8 +909,7 @@ qlcnic_reset_npar_config(struct qlcnic_adapter *adapter)
894 struct qlcnic_npar_info *npar; 909 struct qlcnic_npar_info *npar;
895 struct qlcnic_info nic_info; 910 struct qlcnic_info nic_info;
896 911
897 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) || 912 if (!adapter->need_fw_reset)
898 !adapter->need_fw_reset || adapter->op_mode != QLCNIC_MGMT_FUNC)
899 return 0; 913 return 0;
900 914
901 /* Set the NPAR config data after FW reset */ 915 /* Set the NPAR config data after FW reset */
@@ -947,6 +961,28 @@ static int qlcnic_check_npar_opertional(struct qlcnic_adapter *adapter)
947} 961}
948 962
949static int 963static int
964qlcnic_set_mgmt_operations(struct qlcnic_adapter *adapter)
965{
966 int err;
967
968 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
969 adapter->op_mode != QLCNIC_MGMT_FUNC)
970 return 0;
971
972 err = qlcnic_set_default_offload_settings(adapter);
973 if (err)
974 return err;
975
976 err = qlcnic_reset_npar_config(adapter);
977 if (err)
978 return err;
979
980 qlcnic_dev_set_npar_ready(adapter);
981
982 return err;
983}
984
985static int
950qlcnic_start_firmware(struct qlcnic_adapter *adapter) 986qlcnic_start_firmware(struct qlcnic_adapter *adapter)
951{ 987{
952 int err; 988 int err;
@@ -991,20 +1027,17 @@ check_fw_status:
991 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY); 1027 QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY);
992 qlcnic_idc_debug_info(adapter, 1); 1028 qlcnic_idc_debug_info(adapter, 1);
993 1029
994 err = qlcnic_set_default_offload_settings(adapter);
995 if (err)
996 goto err_out;
997 err = qlcnic_reset_npar_config(adapter);
998 if (err)
999 goto err_out;
1000 qlcnic_check_options(adapter);
1001 err = qlcnic_check_eswitch_mode(adapter); 1030 err = qlcnic_check_eswitch_mode(adapter);
1002 if (err) { 1031 if (err) {
1003 dev_err(&adapter->pdev->dev, 1032 dev_err(&adapter->pdev->dev,
1004 "Memory allocation failed for eswitch\n"); 1033 "Memory allocation failed for eswitch\n");
1005 goto err_out; 1034 goto err_out;
1006 } 1035 }
1007 qlcnic_dev_set_npar_ready(adapter); 1036 err = qlcnic_set_mgmt_operations(adapter);
1037 if (err)
1038 goto err_out;
1039
1040 qlcnic_check_options(adapter);
1008 adapter->need_fw_reset = 0; 1041 adapter->need_fw_reset = 0;
1009 1042
1010 qlcnic_release_firmware(adapter); 1043 qlcnic_release_firmware(adapter);
@@ -2719,9 +2752,6 @@ qlcnic_dev_request_reset(struct qlcnic_adapter *adapter)
2719static void 2752static void
2720qlcnic_dev_set_npar_ready(struct qlcnic_adapter *adapter) 2753qlcnic_dev_set_npar_ready(struct qlcnic_adapter *adapter)
2721{ 2754{
2722 if (!(adapter->flags & QLCNIC_ESWITCH_ENABLED) ||
2723 adapter->op_mode != QLCNIC_MGMT_FUNC)
2724 return;
2725 if (qlcnic_api_lock(adapter)) 2755 if (qlcnic_api_lock(adapter))
2726 return; 2756 return;
2727 2757
@@ -3004,6 +3034,10 @@ qlcnicvf_start_firmware(struct qlcnic_adapter *adapter)
3004 if (err) 3034 if (err)
3005 return err; 3035 return err;
3006 3036
3037 err = qlcnic_initialize_nic(adapter);
3038 if (err)
3039 return err;
3040
3007 qlcnic_check_options(adapter); 3041 qlcnic_check_options(adapter);
3008 3042
3009 adapter->need_fw_reset = 0; 3043 adapter->need_fw_reset = 0;