diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-08-19 01:08:28 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-19 19:52:40 -0400 |
commit | 78f84e1a7028a77b72aebc769642a5e93d32b4f9 (patch) | |
tree | da78f8bcdac0d8cba74b0653a8184c992b16be86 /drivers/net/qlcnic/qlcnic_main.c | |
parent | fe4d434da8e96142e36eb22fc5cf29ef2c2df9c2 (diff) |
qlcnic: fix npar state
Privilege functions should wait for npar state to be operational.
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/qlcnic_main.c')
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index de4be00e31e5..6a8e9702c7b7 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c | |||
@@ -916,6 +916,27 @@ qlcnic_reset_npar_config(struct qlcnic_adapter *adapter) | |||
916 | return 0; | 916 | return 0; |
917 | } | 917 | } |
918 | 918 | ||
919 | static int qlcnic_check_npar_opertional(struct qlcnic_adapter *adapter) | ||
920 | { | ||
921 | u8 npar_opt_timeo = QLCNIC_DEV_NPAR_OPER_TIMEO; | ||
922 | u32 npar_state; | ||
923 | |||
924 | if (adapter->op_mode == QLCNIC_MGMT_FUNC) | ||
925 | return 0; | ||
926 | |||
927 | npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE); | ||
928 | while (npar_state != QLCNIC_DEV_NPAR_OPER && --npar_opt_timeo) { | ||
929 | msleep(1000); | ||
930 | npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE); | ||
931 | } | ||
932 | if (!npar_opt_timeo) { | ||
933 | dev_err(&adapter->pdev->dev, | ||
934 | "Waiting for NPAR state to opertional timeout\n"); | ||
935 | return -EIO; | ||
936 | } | ||
937 | return 0; | ||
938 | } | ||
939 | |||
919 | static int | 940 | static int |
920 | qlcnic_start_firmware(struct qlcnic_adapter *adapter) | 941 | qlcnic_start_firmware(struct qlcnic_adapter *adapter) |
921 | { | 942 | { |
@@ -978,6 +999,11 @@ wait_init: | |||
978 | 999 | ||
979 | QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY); | 1000 | QLCWR32(adapter, QLCNIC_CRB_DEV_STATE, QLCNIC_DEV_READY); |
980 | qlcnic_idc_debug_info(adapter, 1); | 1001 | qlcnic_idc_debug_info(adapter, 1); |
1002 | err = qlcnic_check_npar_opertional(adapter); | ||
1003 | if (err) { | ||
1004 | qlcnic_release_firmware(adapter); | ||
1005 | return err; | ||
1006 | } | ||
981 | if (qlcnic_set_default_offload_settings(adapter)) | 1007 | if (qlcnic_set_default_offload_settings(adapter)) |
982 | goto err_out; | 1008 | goto err_out; |
983 | if (qlcnic_reset_npar_config(adapter)) | 1009 | if (qlcnic_reset_npar_config(adapter)) |
@@ -2919,29 +2945,18 @@ static void qlcnic_io_resume(struct pci_dev *pdev) | |||
2919 | FW_POLL_DELAY); | 2945 | FW_POLL_DELAY); |
2920 | } | 2946 | } |
2921 | 2947 | ||
2922 | |||
2923 | static int | 2948 | static int |
2924 | qlcnicvf_start_firmware(struct qlcnic_adapter *adapter) | 2949 | qlcnicvf_start_firmware(struct qlcnic_adapter *adapter) |
2925 | { | 2950 | { |
2926 | int err; | 2951 | int err; |
2927 | u8 npar_opt_timeo = QLCNIC_DEV_NPAR_OPER_TIMEO; | ||
2928 | u32 npar_state; | ||
2929 | 2952 | ||
2930 | err = qlcnic_can_start_firmware(adapter); | 2953 | err = qlcnic_can_start_firmware(adapter); |
2931 | if (err) | 2954 | if (err) |
2932 | return err; | 2955 | return err; |
2933 | 2956 | ||
2934 | npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE); | 2957 | err = qlcnic_check_npar_opertional(adapter); |
2935 | while (npar_state != QLCNIC_DEV_NPAR_OPER && --npar_opt_timeo) { | 2958 | if (err) |
2936 | msleep(1000); | 2959 | return err; |
2937 | npar_state = QLCRD32(adapter, QLCNIC_CRB_DEV_NPAR_STATE); | ||
2938 | } | ||
2939 | |||
2940 | if (!npar_opt_timeo) { | ||
2941 | dev_err(&adapter->pdev->dev, | ||
2942 | "Waiting for NPAR state to opertional timeout\n"); | ||
2943 | return -EIO; | ||
2944 | } | ||
2945 | 2960 | ||
2946 | qlcnic_check_options(adapter); | 2961 | qlcnic_check_options(adapter); |
2947 | 2962 | ||