aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_fsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_fsf.c')
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c93
1 files changed, 39 insertions, 54 deletions
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 3aad70916289..5eb96052941a 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -2109,64 +2109,52 @@ static void zfcp_fsf_update_lat(struct fsf_latency_record *lat_rec, u32 lat)
2109 lat_rec->max = max(lat_rec->max, lat); 2109 lat_rec->max = max(lat_rec->max, lat);
2110} 2110}
2111 2111
2112static void zfcp_fsf_req_latency(struct zfcp_fsf_req *req) 2112static void zfcp_fsf_req_trace(struct zfcp_fsf_req *req, struct scsi_cmnd *scsi)
2113{ 2113{
2114 struct fsf_qual_latency_info *lat_inf; 2114 struct fsf_qual_latency_info *lat_in;
2115 struct latency_cont *lat; 2115 struct latency_cont *lat = NULL;
2116 struct zfcp_unit *unit = req->unit; 2116 struct zfcp_unit *unit = req->unit;
2117 struct zfcp_blk_drv_data blktrc;
2118 int ticks = req->adapter->timer_ticks;
2117 2119
2118 lat_inf = &req->qtcb->prefix.prot_status_qual.latency_info; 2120 lat_in = &req->qtcb->prefix.prot_status_qual.latency_info;
2119 2121
2120 switch (req->qtcb->bottom.io.data_direction) { 2122 blktrc.flags = 0;
2121 case FSF_DATADIR_READ: 2123 blktrc.magic = ZFCP_BLK_DRV_DATA_MAGIC;
2122 lat = &unit->latencies.read; 2124 if (req->status & ZFCP_STATUS_FSFREQ_ERROR)
2123 break; 2125 blktrc.flags |= ZFCP_BLK_REQ_ERROR;
2124 case FSF_DATADIR_WRITE: 2126 blktrc.inb_usage = req->queue_req.qdio_inb_usage;
2125 lat = &unit->latencies.write; 2127 blktrc.outb_usage = req->queue_req.qdio_outb_usage;
2126 break; 2128
2127 case FSF_DATADIR_CMND: 2129 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) {
2128 lat = &unit->latencies.cmd; 2130 blktrc.flags |= ZFCP_BLK_LAT_VALID;
2129 break; 2131 blktrc.channel_lat = lat_in->channel_lat * ticks;
2130 default: 2132 blktrc.fabric_lat = lat_in->fabric_lat * ticks;
2131 return; 2133
2132 } 2134 switch (req->qtcb->bottom.io.data_direction) {
2133 2135 case FSF_DATADIR_READ:
2134 spin_lock(&unit->latencies.lock); 2136 lat = &unit->latencies.read;
2135 zfcp_fsf_update_lat(&lat->channel, lat_inf->channel_lat); 2137 break;
2136 zfcp_fsf_update_lat(&lat->fabric, lat_inf->fabric_lat); 2138 case FSF_DATADIR_WRITE:
2137 lat->counter++; 2139 lat = &unit->latencies.write;
2138 spin_unlock(&unit->latencies.lock); 2140 break;
2139} 2141 case FSF_DATADIR_CMND:
2140 2142 lat = &unit->latencies.cmd;
2141#ifdef CONFIG_BLK_DEV_IO_TRACE 2143 break;
2142static void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req) 2144 }
2143{
2144 struct fsf_qual_latency_info *lat_inf;
2145 struct scsi_cmnd *scsi_cmnd = (struct scsi_cmnd *)fsf_req->data;
2146 struct request *req = scsi_cmnd->request;
2147 struct zfcp_blk_drv_data trace;
2148 int ticks = fsf_req->adapter->timer_ticks;
2149 2145
2150 trace.flags = 0; 2146 if (lat) {
2151 trace.magic = ZFCP_BLK_DRV_DATA_MAGIC; 2147 spin_lock(&unit->latencies.lock);
2152 if (fsf_req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) { 2148 zfcp_fsf_update_lat(&lat->channel, lat_in->channel_lat);
2153 trace.flags |= ZFCP_BLK_LAT_VALID; 2149 zfcp_fsf_update_lat(&lat->fabric, lat_in->fabric_lat);
2154 lat_inf = &fsf_req->qtcb->prefix.prot_status_qual.latency_info; 2150 lat->counter++;
2155 trace.channel_lat = lat_inf->channel_lat * ticks; 2151 spin_unlock(&unit->latencies.lock);
2156 trace.fabric_lat = lat_inf->fabric_lat * ticks; 2152 }
2157 } 2153 }
2158 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)
2159 trace.flags |= ZFCP_BLK_REQ_ERROR;
2160 trace.inb_usage = fsf_req->queue_req.qdio_inb_usage;
2161 trace.outb_usage = fsf_req->queue_req.qdio_outb_usage;
2162 2154
2163 blk_add_driver_data(req->q, req, &trace, sizeof(trace)); 2155 blk_add_driver_data(scsi->request->q, scsi->request, &blktrc,
2164} 2156 sizeof(blktrc));
2165#else
2166static inline void zfcp_fsf_trace_latency(struct zfcp_fsf_req *fsf_req)
2167{
2168} 2157}
2169#endif
2170 2158
2171static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req) 2159static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
2172{ 2160{
@@ -2199,10 +2187,7 @@ static void zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *req)
2199 2187
2200 scpnt->result |= fcp_rsp_iu->scsi_status; 2188 scpnt->result |= fcp_rsp_iu->scsi_status;
2201 2189
2202 if (req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) 2190 zfcp_fsf_req_trace(req, scpnt);
2203 zfcp_fsf_req_latency(req);
2204
2205 zfcp_fsf_trace_latency(req);
2206 2191
2207 if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) { 2192 if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) {
2208 if (fcp_rsp_info[3] == RSP_CODE_GOOD) 2193 if (fcp_rsp_info[3] == RSP_CODE_GOOD)