aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/s390/scsi/zfcp_ext.h2
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c20
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c24
-rw-r--r--include/scsi/scsi.h17
4 files changed, 28 insertions, 35 deletions
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 368b304d1e3f..f95dc99339fd 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -103,8 +103,6 @@ extern int zfcp_adapter_scsi_register(struct zfcp_adapter *);
103extern void zfcp_adapter_scsi_unregister(struct zfcp_adapter *); 103extern void zfcp_adapter_scsi_unregister(struct zfcp_adapter *);
104extern void zfcp_set_fcp_dl(struct fcp_cmnd_iu *, fcp_dl_t); 104extern void zfcp_set_fcp_dl(struct fcp_cmnd_iu *, fcp_dl_t);
105extern char *zfcp_get_fcp_rsp_info_ptr(struct fcp_rsp_iu *); 105extern char *zfcp_get_fcp_rsp_info_ptr(struct fcp_rsp_iu *);
106extern void set_host_byte(int *, char);
107extern void set_driver_byte(int *, char);
108extern char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *); 106extern char *zfcp_get_fcp_sns_info_ptr(struct fcp_rsp_iu *);
109extern fcp_dl_t zfcp_get_fcp_dl(struct fcp_cmnd_iu *); 107extern fcp_dl_t zfcp_get_fcp_dl(struct fcp_cmnd_iu *);
110 108
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 243e792f2407..150e78dd00b2 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -3040,18 +3040,18 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3040 * DID_SOFT_ERROR by retrying the request for devices 3040 * DID_SOFT_ERROR by retrying the request for devices
3041 * that allow retries. 3041 * that allow retries.
3042 */ 3042 */
3043 set_host_byte(&scpnt->result, DID_SOFT_ERROR); 3043 set_host_byte(scpnt, DID_SOFT_ERROR);
3044 set_driver_byte(&scpnt->result, SUGGEST_RETRY); 3044 set_driver_byte(scpnt, SUGGEST_RETRY);
3045 goto skip_fsfstatus; 3045 goto skip_fsfstatus;
3046 } 3046 }
3047 3047
3048 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) { 3048 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
3049 set_host_byte(&scpnt->result, DID_ERROR); 3049 set_host_byte(scpnt, DID_ERROR);
3050 goto skip_fsfstatus; 3050 goto skip_fsfstatus;
3051 } 3051 }
3052 3052
3053 /* set message byte of result in SCSI command */ 3053 /* set message byte of result in SCSI command */
3054 scpnt->result |= COMMAND_COMPLETE << 8; 3054 set_msg_byte(scpnt, COMMAND_COMPLETE);
3055 3055
3056 /* 3056 /*
3057 * copy SCSI status code of FCP_STATUS of FCP_RSP IU to status byte 3057 * copy SCSI status code of FCP_STATUS of FCP_RSP IU to status byte
@@ -3067,23 +3067,23 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3067 switch (fcp_rsp_info[3]) { 3067 switch (fcp_rsp_info[3]) {
3068 case RSP_CODE_GOOD: 3068 case RSP_CODE_GOOD:
3069 /* ok, continue */ 3069 /* ok, continue */
3070 set_host_byte(&scpnt->result, DID_OK); 3070 set_host_byte(scpnt, DID_OK);
3071 break; 3071 break;
3072 case RSP_CODE_LENGTH_MISMATCH: 3072 case RSP_CODE_LENGTH_MISMATCH:
3073 /* hardware bug */ 3073 /* hardware bug */
3074 set_host_byte(&scpnt->result, DID_ERROR); 3074 set_host_byte(scpnt, DID_ERROR);
3075 goto skip_fsfstatus; 3075 goto skip_fsfstatus;
3076 case RSP_CODE_FIELD_INVALID: 3076 case RSP_CODE_FIELD_INVALID:
3077 /* driver or hardware bug */ 3077 /* driver or hardware bug */
3078 set_host_byte(&scpnt->result, DID_ERROR); 3078 set_host_byte(scpnt, DID_ERROR);
3079 goto skip_fsfstatus; 3079 goto skip_fsfstatus;
3080 case RSP_CODE_RO_MISMATCH: 3080 case RSP_CODE_RO_MISMATCH:
3081 /* hardware bug */ 3081 /* hardware bug */
3082 set_host_byte(&scpnt->result, DID_ERROR); 3082 set_host_byte(scpnt, DID_ERROR);
3083 goto skip_fsfstatus; 3083 goto skip_fsfstatus;
3084 default: 3084 default:
3085 /* invalid FCP response code */ 3085 /* invalid FCP response code */
3086 set_host_byte(&scpnt->result, DID_ERROR); 3086 set_host_byte(scpnt, DID_ERROR);
3087 goto skip_fsfstatus; 3087 goto skip_fsfstatus;
3088 } 3088 }
3089 } 3089 }
@@ -3104,7 +3104,7 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3104 scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid); 3104 scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid);
3105 if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) < 3105 if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) <
3106 scpnt->underflow) 3106 scpnt->underflow)
3107 set_host_byte(&scpnt->result, DID_ERROR); 3107 set_host_byte(scpnt, DID_ERROR);
3108 } 3108 }
3109 3109
3110 skip_fsfstatus: 3110 skip_fsfstatus:
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 446fb1da25df..160307382d2c 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -107,28 +107,6 @@ zfcp_set_fcp_dl(struct fcp_cmnd_iu *fcp_cmd, fcp_dl_t fcp_dl)
107 *zfcp_get_fcp_dl_ptr(fcp_cmd) = fcp_dl; 107 *zfcp_get_fcp_dl_ptr(fcp_cmd) = fcp_dl;
108} 108}
109 109
110/*
111 * note: it's a bit-or operation not an assignment
112 * regarding the specified byte
113 */
114static inline void
115set_byte(int *result, char status, char pos)
116{
117 *result |= status << (pos * 8);
118}
119
120void
121set_host_byte(int *result, char status)
122{
123 set_byte(result, status, 2);
124}
125
126void
127set_driver_byte(int *result, char status)
128{
129 set_byte(result, status, 3);
130}
131
132static int 110static int
133zfcp_scsi_slave_alloc(struct scsi_device *sdp) 111zfcp_scsi_slave_alloc(struct scsi_device *sdp)
134{ 112{
@@ -196,7 +174,7 @@ zfcp_scsi_slave_configure(struct scsi_device *sdp)
196static void 174static void
197zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result) 175zfcp_scsi_command_fail(struct scsi_cmnd *scpnt, int result)
198{ 176{
199 set_host_byte(&scpnt->result, result); 177 set_host_byte(scpnt, result);
200 if ((scpnt->device != NULL) && (scpnt->device->host != NULL)) 178 if ((scpnt->device != NULL) && (scpnt->device->host != NULL))
201 zfcp_scsi_dbf_event_result("fail", 4, 179 zfcp_scsi_dbf_event_result("fail", 4,
202 (struct zfcp_adapter*) scpnt->device->host->hostdata[0], 180 (struct zfcp_adapter*) scpnt->device->host->hostdata[0],
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 2b5b9356c314..00137a7769ee 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -9,6 +9,7 @@
9#define _SCSI_SCSI_H 9#define _SCSI_SCSI_H
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12#include <scsi/scsi_cmnd.h>
12 13
13/* 14/*
14 * The maximum number of SG segments that we will put inside a 15 * The maximum number of SG segments that we will put inside a
@@ -425,6 +426,22 @@ struct scsi_lun {
425#define driver_byte(result) (((result) >> 24) & 0xff) 426#define driver_byte(result) (((result) >> 24) & 0xff)
426#define suggestion(result) (driver_byte(result) & SUGGEST_MASK) 427#define suggestion(result) (driver_byte(result) & SUGGEST_MASK)
427 428
429static inline void set_msg_byte(struct scsi_cmnd *cmd, char status)
430{
431 cmd->result |= status << 8;
432}
433
434static inline void set_host_byte(struct scsi_cmnd *cmd, char status)
435{
436 cmd->result |= status << 16;
437}
438
439static inline void set_driver_byte(struct scsi_cmnd *cmd, char status)
440{
441 cmd->result |= status << 24;
442}
443
444
428#define sense_class(sense) (((sense) >> 4) & 0x7) 445#define sense_class(sense) (((sense) >> 4) & 0x7)
429#define sense_error(sense) ((sense) & 0xf) 446#define sense_error(sense) ((sense) & 0xf)
430#define sense_valid(sense) ((sense) & 0x80); 447#define sense_valid(sense) ((sense) & 0x80);