@@ -324,7 +324,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
324
324
"request_sg_cnt=%x reply_sg_cnt=%x.\n" ,
325
325
bsg_job -> request_payload .sg_cnt ,
326
326
bsg_job -> reply_payload .sg_cnt );
327
- rval = - EPERM ;
327
+ rval = - ENOBUFS ;
328
328
goto done ;
329
329
}
330
330
@@ -3059,17 +3059,61 @@ qla24xx_bsg_request(struct bsg_job *bsg_job)
3059
3059
return ret ;
3060
3060
}
3061
3061
3062
- int
3063
- qla24xx_bsg_timeout (struct bsg_job * bsg_job )
3062
+ static bool qla_bsg_found (struct qla_qpair * qpair , struct bsg_job * bsg_job )
3064
3063
{
3064
+ bool found = false;
3065
3065
struct fc_bsg_reply * bsg_reply = bsg_job -> reply ;
3066
3066
scsi_qla_host_t * vha = shost_priv (fc_bsg_to_shost (bsg_job ));
3067
3067
struct qla_hw_data * ha = vha -> hw ;
3068
- srb_t * sp ;
3069
- int cnt , que ;
3068
+ srb_t * sp = NULL ;
3069
+ int cnt ;
3070
3070
unsigned long flags ;
3071
3071
struct req_que * req ;
3072
3072
3073
+ spin_lock_irqsave (qpair -> qp_lock_ptr , flags );
3074
+ req = qpair -> req ;
3075
+
3076
+ for (cnt = 1 ; cnt < req -> num_outstanding_cmds ; cnt ++ ) {
3077
+ sp = req -> outstanding_cmds [cnt ];
3078
+ if (sp &&
3079
+ (sp -> type == SRB_CT_CMD ||
3080
+ sp -> type == SRB_ELS_CMD_HST ||
3081
+ sp -> type == SRB_ELS_CMD_HST_NOLOGIN ) &&
3082
+ sp -> u .bsg_job == bsg_job ) {
3083
+ req -> outstanding_cmds [cnt ] = NULL ;
3084
+ spin_unlock_irqrestore (qpair -> qp_lock_ptr , flags );
3085
+
3086
+ if (!ha -> flags .eeh_busy && ha -> isp_ops -> abort_command (sp )) {
3087
+ ql_log (ql_log_warn , vha , 0x7089 ,
3088
+ "mbx abort_command failed.\n" );
3089
+ bsg_reply -> result = - EIO ;
3090
+ } else {
3091
+ ql_dbg (ql_dbg_user , vha , 0x708a ,
3092
+ "mbx abort_command success.\n" );
3093
+ bsg_reply -> result = 0 ;
3094
+ }
3095
+ /* ref: INIT */
3096
+ kref_put (& sp -> cmd_kref , qla2x00_sp_release );
3097
+
3098
+ found = true;
3099
+ goto done ;
3100
+ }
3101
+ }
3102
+ spin_unlock_irqrestore (qpair -> qp_lock_ptr , flags );
3103
+
3104
+ done :
3105
+ return found ;
3106
+ }
3107
+
3108
+ int
3109
+ qla24xx_bsg_timeout (struct bsg_job * bsg_job )
3110
+ {
3111
+ struct fc_bsg_reply * bsg_reply = bsg_job -> reply ;
3112
+ scsi_qla_host_t * vha = shost_priv (fc_bsg_to_shost (bsg_job ));
3113
+ struct qla_hw_data * ha = vha -> hw ;
3114
+ int i ;
3115
+ struct qla_qpair * qpair ;
3116
+
3073
3117
ql_log (ql_log_info , vha , 0x708b , "%s CMD timeout. bsg ptr %p.\n" ,
3074
3118
__func__ , bsg_job );
3075
3119
@@ -3079,48 +3123,22 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)
3079
3123
qla_pci_set_eeh_busy (vha );
3080
3124
}
3081
3125
3126
+ if (qla_bsg_found (ha -> base_qpair , bsg_job ))
3127
+ goto done ;
3128
+
3082
3129
/* find the bsg job from the active list of commands */
3083
- spin_lock_irqsave (& ha -> hardware_lock , flags );
3084
- for (que = 0 ; que < ha -> max_req_queues ; que ++ ) {
3085
- req = ha -> req_q_map [que ];
3086
- if (!req )
3130
+ for (i = 0 ; i < ha -> max_qpairs ; i ++ ) {
3131
+ qpair = vha -> hw -> queue_pair_map [i ];
3132
+ if (!qpair )
3087
3133
continue ;
3088
-
3089
- for (cnt = 1 ; cnt < req -> num_outstanding_cmds ; cnt ++ ) {
3090
- sp = req -> outstanding_cmds [cnt ];
3091
- if (sp &&
3092
- (sp -> type == SRB_CT_CMD ||
3093
- sp -> type == SRB_ELS_CMD_HST ||
3094
- sp -> type == SRB_ELS_CMD_HST_NOLOGIN ||
3095
- sp -> type == SRB_FXIOCB_BCMD ) &&
3096
- sp -> u .bsg_job == bsg_job ) {
3097
- req -> outstanding_cmds [cnt ] = NULL ;
3098
- spin_unlock_irqrestore (& ha -> hardware_lock , flags );
3099
-
3100
- if (!ha -> flags .eeh_busy && ha -> isp_ops -> abort_command (sp )) {
3101
- ql_log (ql_log_warn , vha , 0x7089 ,
3102
- "mbx abort_command failed.\n" );
3103
- bsg_reply -> result = - EIO ;
3104
- } else {
3105
- ql_dbg (ql_dbg_user , vha , 0x708a ,
3106
- "mbx abort_command success.\n" );
3107
- bsg_reply -> result = 0 ;
3108
- }
3109
- spin_lock_irqsave (& ha -> hardware_lock , flags );
3110
- goto done ;
3111
-
3112
- }
3113
- }
3134
+ if (qla_bsg_found (qpair , bsg_job ))
3135
+ goto done ;
3114
3136
}
3115
- spin_unlock_irqrestore ( & ha -> hardware_lock , flags );
3137
+
3116
3138
ql_log (ql_log_info , vha , 0x708b , "SRB not found to abort.\n" );
3117
3139
bsg_reply -> result = - ENXIO ;
3118
- return 0 ;
3119
3140
3120
3141
done :
3121
- spin_unlock_irqrestore (& ha -> hardware_lock , flags );
3122
- /* ref: INIT */
3123
- kref_put (& sp -> cmd_kref , qla2x00_sp_release );
3124
3142
return 0 ;
3125
3143
}
3126
3144
0 commit comments