diff options
Diffstat (limited to 'drivers/scsi/ibmvscsi/ibmvfc.c')
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvfc.c | 68 |
1 files changed, 42 insertions, 26 deletions
diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 26abed2c3a41..182c8e75aaf0 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c | |||
@@ -842,9 +842,13 @@ static void ibmvfc_reset_host(struct ibmvfc_host *vhost) | |||
842 | * ibmvfc_retry_host_init - Retry host initialization if allowed | 842 | * ibmvfc_retry_host_init - Retry host initialization if allowed |
843 | * @vhost: ibmvfc host struct | 843 | * @vhost: ibmvfc host struct |
844 | * | 844 | * |
845 | * Returns: 1 if init will be retried / 0 if not | ||
846 | * | ||
845 | **/ | 847 | **/ |
846 | static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost) | 848 | static int ibmvfc_retry_host_init(struct ibmvfc_host *vhost) |
847 | { | 849 | { |
850 | int retry = 0; | ||
851 | |||
848 | if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) { | 852 | if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) { |
849 | vhost->delay_init = 1; | 853 | vhost->delay_init = 1; |
850 | if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) { | 854 | if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) { |
@@ -853,11 +857,14 @@ static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost) | |||
853 | ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE); | 857 | ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE); |
854 | } else if (vhost->init_retries == IBMVFC_MAX_HOST_INIT_RETRIES) | 858 | } else if (vhost->init_retries == IBMVFC_MAX_HOST_INIT_RETRIES) |
855 | __ibmvfc_reset_host(vhost); | 859 | __ibmvfc_reset_host(vhost); |
856 | else | 860 | else { |
857 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT); | 861 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT); |
862 | retry = 1; | ||
863 | } | ||
858 | } | 864 | } |
859 | 865 | ||
860 | wake_up(&vhost->work_wait_q); | 866 | wake_up(&vhost->work_wait_q); |
867 | return retry; | ||
861 | } | 868 | } |
862 | 869 | ||
863 | /** | 870 | /** |
@@ -2733,15 +2740,19 @@ static void ibmvfc_init_tgt(struct ibmvfc_target *tgt, | |||
2733 | * @tgt: ibmvfc target struct | 2740 | * @tgt: ibmvfc target struct |
2734 | * @job_step: initialization job step | 2741 | * @job_step: initialization job step |
2735 | * | 2742 | * |
2743 | * Returns: 1 if step will be retried / 0 if not | ||
2744 | * | ||
2736 | **/ | 2745 | **/ |
2737 | static void ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt, | 2746 | static int ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt, |
2738 | void (*job_step) (struct ibmvfc_target *)) | 2747 | void (*job_step) (struct ibmvfc_target *)) |
2739 | { | 2748 | { |
2740 | if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) { | 2749 | if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) { |
2741 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 2750 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
2742 | wake_up(&tgt->vhost->work_wait_q); | 2751 | wake_up(&tgt->vhost->work_wait_q); |
2752 | return 0; | ||
2743 | } else | 2753 | } else |
2744 | ibmvfc_init_tgt(tgt, job_step); | 2754 | ibmvfc_init_tgt(tgt, job_step); |
2755 | return 1; | ||
2745 | } | 2756 | } |
2746 | 2757 | ||
2747 | /* Defined in FC-LS */ | 2758 | /* Defined in FC-LS */ |
@@ -2790,7 +2801,7 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt) | |||
2790 | struct ibmvfc_process_login *rsp = &evt->xfer_iu->prli; | 2801 | struct ibmvfc_process_login *rsp = &evt->xfer_iu->prli; |
2791 | struct ibmvfc_prli_svc_parms *parms = &rsp->parms; | 2802 | struct ibmvfc_prli_svc_parms *parms = &rsp->parms; |
2792 | u32 status = rsp->common.status; | 2803 | u32 status = rsp->common.status; |
2793 | int index; | 2804 | int index, level = IBMVFC_DEFAULT_LOG_LEVEL; |
2794 | 2805 | ||
2795 | vhost->discovery_threads--; | 2806 | vhost->discovery_threads--; |
2796 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); | 2807 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); |
@@ -2826,13 +2837,14 @@ static void ibmvfc_tgt_prli_done(struct ibmvfc_event *evt) | |||
2826 | break; | 2837 | break; |
2827 | case IBMVFC_MAD_FAILED: | 2838 | case IBMVFC_MAD_FAILED: |
2828 | default: | 2839 | default: |
2829 | tgt_err(tgt, "Process Login failed: %s (%x:%x) rc=0x%02X\n", | ||
2830 | ibmvfc_get_cmd_error(rsp->status, rsp->error), | ||
2831 | rsp->status, rsp->error, status); | ||
2832 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 2840 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) |
2833 | ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_prli); | 2841 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_prli); |
2834 | else | 2842 | else |
2835 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 2843 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
2844 | |||
2845 | tgt_log(tgt, level, "Process Login failed: %s (%x:%x) rc=0x%02X\n", | ||
2846 | ibmvfc_get_cmd_error(rsp->status, rsp->error), | ||
2847 | rsp->status, rsp->error, status); | ||
2836 | break; | 2848 | break; |
2837 | }; | 2849 | }; |
2838 | 2850 | ||
@@ -2891,6 +2903,7 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt) | |||
2891 | struct ibmvfc_host *vhost = evt->vhost; | 2903 | struct ibmvfc_host *vhost = evt->vhost; |
2892 | struct ibmvfc_port_login *rsp = &evt->xfer_iu->plogi; | 2904 | struct ibmvfc_port_login *rsp = &evt->xfer_iu->plogi; |
2893 | u32 status = rsp->common.status; | 2905 | u32 status = rsp->common.status; |
2906 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | ||
2894 | 2907 | ||
2895 | vhost->discovery_threads--; | 2908 | vhost->discovery_threads--; |
2896 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); | 2909 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); |
@@ -2919,15 +2932,15 @@ static void ibmvfc_tgt_plogi_done(struct ibmvfc_event *evt) | |||
2919 | break; | 2932 | break; |
2920 | case IBMVFC_MAD_FAILED: | 2933 | case IBMVFC_MAD_FAILED: |
2921 | default: | 2934 | default: |
2922 | tgt_err(tgt, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", | ||
2923 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error, | ||
2924 | ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type, | ||
2925 | ibmvfc_get_ls_explain(rsp->fc_explain), rsp->fc_explain, status); | ||
2926 | |||
2927 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 2935 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) |
2928 | ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); | 2936 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_send_plogi); |
2929 | else | 2937 | else |
2930 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 2938 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
2939 | |||
2940 | tgt_log(tgt, level, "Port Login failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", | ||
2941 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error, | ||
2942 | ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type, | ||
2943 | ibmvfc_get_ls_explain(rsp->fc_explain), rsp->fc_explain, status); | ||
2931 | break; | 2944 | break; |
2932 | }; | 2945 | }; |
2933 | 2946 | ||
@@ -3281,6 +3294,7 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt) | |||
3281 | struct ibmvfc_host *vhost = evt->vhost; | 3294 | struct ibmvfc_host *vhost = evt->vhost; |
3282 | struct ibmvfc_query_tgt *rsp = &evt->xfer_iu->query_tgt; | 3295 | struct ibmvfc_query_tgt *rsp = &evt->xfer_iu->query_tgt; |
3283 | u32 status = rsp->common.status; | 3296 | u32 status = rsp->common.status; |
3297 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | ||
3284 | 3298 | ||
3285 | vhost->discovery_threads--; | 3299 | vhost->discovery_threads--; |
3286 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); | 3300 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE); |
@@ -3300,19 +3314,19 @@ static void ibmvfc_tgt_query_target_done(struct ibmvfc_event *evt) | |||
3300 | break; | 3314 | break; |
3301 | case IBMVFC_MAD_FAILED: | 3315 | case IBMVFC_MAD_FAILED: |
3302 | default: | 3316 | default: |
3303 | tgt_err(tgt, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", | ||
3304 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error, | ||
3305 | ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type, | ||
3306 | ibmvfc_get_gs_explain(rsp->fc_explain), rsp->fc_explain, status); | ||
3307 | |||
3308 | if ((rsp->status & IBMVFC_FABRIC_MAPPED) == IBMVFC_FABRIC_MAPPED && | 3317 | if ((rsp->status & IBMVFC_FABRIC_MAPPED) == IBMVFC_FABRIC_MAPPED && |
3309 | rsp->error == IBMVFC_UNABLE_TO_PERFORM_REQ && | 3318 | rsp->error == IBMVFC_UNABLE_TO_PERFORM_REQ && |
3310 | rsp->fc_explain == IBMVFC_PORT_NAME_NOT_REG) | 3319 | rsp->fc_explain == IBMVFC_PORT_NAME_NOT_REG) |
3311 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 3320 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
3312 | else if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 3321 | else if (ibmvfc_retry_cmd(rsp->status, rsp->error)) |
3313 | ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_query_target); | 3322 | level += ibmvfc_retry_tgt_init(tgt, ibmvfc_tgt_query_target); |
3314 | else | 3323 | else |
3315 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); | 3324 | ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); |
3325 | |||
3326 | tgt_log(tgt, level, "Query Target failed: %s (%x:%x) %s (%x) %s (%x) rc=0x%02X\n", | ||
3327 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error, | ||
3328 | ibmvfc_get_fc_type(rsp->fc_type), rsp->fc_type, | ||
3329 | ibmvfc_get_gs_explain(rsp->fc_explain), rsp->fc_explain, status); | ||
3316 | break; | 3330 | break; |
3317 | }; | 3331 | }; |
3318 | 3332 | ||
@@ -3431,6 +3445,7 @@ static void ibmvfc_discover_targets_done(struct ibmvfc_event *evt) | |||
3431 | struct ibmvfc_host *vhost = evt->vhost; | 3445 | struct ibmvfc_host *vhost = evt->vhost; |
3432 | struct ibmvfc_discover_targets *rsp = &evt->xfer_iu->discover_targets; | 3446 | struct ibmvfc_discover_targets *rsp = &evt->xfer_iu->discover_targets; |
3433 | u32 mad_status = rsp->common.status; | 3447 | u32 mad_status = rsp->common.status; |
3448 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | ||
3434 | 3449 | ||
3435 | switch (mad_status) { | 3450 | switch (mad_status) { |
3436 | case IBMVFC_MAD_SUCCESS: | 3451 | case IBMVFC_MAD_SUCCESS: |
@@ -3439,9 +3454,9 @@ static void ibmvfc_discover_targets_done(struct ibmvfc_event *evt) | |||
3439 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_ALLOC_TGTS); | 3454 | ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_ALLOC_TGTS); |
3440 | break; | 3455 | break; |
3441 | case IBMVFC_MAD_FAILED: | 3456 | case IBMVFC_MAD_FAILED: |
3442 | dev_err(vhost->dev, "Discover Targets failed: %s (%x:%x)\n", | 3457 | level += ibmvfc_retry_host_init(vhost); |
3443 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error); | 3458 | ibmvfc_log(vhost, level, "Discover Targets failed: %s (%x:%x)\n", |
3444 | ibmvfc_retry_host_init(vhost); | 3459 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error); |
3445 | break; | 3460 | break; |
3446 | case IBMVFC_MAD_DRIVER_FAILED: | 3461 | case IBMVFC_MAD_DRIVER_FAILED: |
3447 | break; | 3462 | break; |
@@ -3493,18 +3508,19 @@ static void ibmvfc_npiv_login_done(struct ibmvfc_event *evt) | |||
3493 | u32 mad_status = evt->xfer_iu->npiv_login.common.status; | 3508 | u32 mad_status = evt->xfer_iu->npiv_login.common.status; |
3494 | struct ibmvfc_npiv_login_resp *rsp = &vhost->login_buf->resp; | 3509 | struct ibmvfc_npiv_login_resp *rsp = &vhost->login_buf->resp; |
3495 | unsigned int npiv_max_sectors; | 3510 | unsigned int npiv_max_sectors; |
3511 | int level = IBMVFC_DEFAULT_LOG_LEVEL; | ||
3496 | 3512 | ||
3497 | switch (mad_status) { | 3513 | switch (mad_status) { |
3498 | case IBMVFC_MAD_SUCCESS: | 3514 | case IBMVFC_MAD_SUCCESS: |
3499 | ibmvfc_free_event(evt); | 3515 | ibmvfc_free_event(evt); |
3500 | break; | 3516 | break; |
3501 | case IBMVFC_MAD_FAILED: | 3517 | case IBMVFC_MAD_FAILED: |
3502 | dev_err(vhost->dev, "NPIV Login failed: %s (%x:%x)\n", | ||
3503 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error); | ||
3504 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) | 3518 | if (ibmvfc_retry_cmd(rsp->status, rsp->error)) |
3505 | ibmvfc_retry_host_init(vhost); | 3519 | level += ibmvfc_retry_host_init(vhost); |
3506 | else | 3520 | else |
3507 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); | 3521 | ibmvfc_link_down(vhost, IBMVFC_LINK_DEAD); |
3522 | ibmvfc_log(vhost, level, "NPIV Login failed: %s (%x:%x)\n", | ||
3523 | ibmvfc_get_cmd_error(rsp->status, rsp->error), rsp->status, rsp->error); | ||
3508 | ibmvfc_free_event(evt); | 3524 | ibmvfc_free_event(evt); |
3509 | return; | 3525 | return; |
3510 | case IBMVFC_MAD_CRQ_ERROR: | 3526 | case IBMVFC_MAD_CRQ_ERROR: |