aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libfc/fc_exch.c30
-rw-r--r--drivers/scsi/libfc/fc_lport.c7
-rw-r--r--include/scsi/libfc.h1
3 files changed, 33 insertions, 5 deletions
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 1d0334f83f78..10a6a2a7bfc5 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -99,11 +99,6 @@ struct fc_exch_mgr {
99 u16 max_xid; 99 u16 max_xid;
100 u16 pool_max_index; 100 u16 pool_max_index;
101 101
102 /*
103 * currently exchange mgr stats are updated but not used.
104 * either stats can be expose via sysfs or remove them
105 * all together if not used XXX
106 */
107 struct { 102 struct {
108 atomic_t no_free_exch; 103 atomic_t no_free_exch;
109 atomic_t no_free_exch_xid; 104 atomic_t no_free_exch_xid;
@@ -2156,6 +2151,31 @@ out:
2156} 2151}
2157 2152
2158/** 2153/**
2154 * fc_exch_update_stats() - update exches stats to lport
2155 * @lport: The local port to update exchange manager stats
2156 */
2157void fc_exch_update_stats(struct fc_lport *lport)
2158{
2159 struct fc_host_statistics *st;
2160 struct fc_exch_mgr_anchor *ema;
2161 struct fc_exch_mgr *mp;
2162
2163 st = &lport->host_stats;
2164
2165 list_for_each_entry(ema, &lport->ema_list, ema_list) {
2166 mp = ema->mp;
2167 st->fc_no_free_exch += atomic_read(&mp->stats.no_free_exch);
2168 st->fc_no_free_exch_xid +=
2169 atomic_read(&mp->stats.no_free_exch_xid);
2170 st->fc_xid_not_found += atomic_read(&mp->stats.xid_not_found);
2171 st->fc_xid_busy += atomic_read(&mp->stats.xid_busy);
2172 st->fc_seq_not_found += atomic_read(&mp->stats.seq_not_found);
2173 st->fc_non_bls_resp += atomic_read(&mp->stats.non_bls_resp);
2174 }
2175}
2176EXPORT_SYMBOL(fc_exch_update_stats);
2177
2178/**
2159 * fc_exch_mgr_add() - Add an exchange manager to a local port's list of EMs 2179 * fc_exch_mgr_add() - Add an exchange manager to a local port's list of EMs
2160 * @lport: The local port to add the exchange manager to 2180 * @lport: The local port to add the exchange manager to
2161 * @mp: The exchange manager to be added to the local port 2181 * @mp: The exchange manager to be added to the local port
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 3e8c48dfa42f..ca278d4b0f66 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -329,6 +329,9 @@ struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost)
329 fc_stats->fcp_control_requests += stats->ControlRequests; 329 fc_stats->fcp_control_requests += stats->ControlRequests;
330 fcp_in_bytes += stats->InputBytes; 330 fcp_in_bytes += stats->InputBytes;
331 fcp_out_bytes += stats->OutputBytes; 331 fcp_out_bytes += stats->OutputBytes;
332 fc_stats->fcp_packet_alloc_failures += stats->FcpPktAllocFails;
333 fc_stats->fcp_packet_aborts += stats->FcpPktAborts;
334 fc_stats->fcp_frame_alloc_failures += stats->FcpFrameAllocFails;
332 fc_stats->link_failure_count += stats->LinkFailureCount; 335 fc_stats->link_failure_count += stats->LinkFailureCount;
333 } 336 }
334 fc_stats->fcp_input_megabytes = div_u64(fcp_in_bytes, 1000000); 337 fc_stats->fcp_input_megabytes = div_u64(fcp_in_bytes, 1000000);
@@ -339,6 +342,10 @@ struct fc_host_statistics *fc_get_host_stats(struct Scsi_Host *shost)
339 fc_stats->loss_of_signal_count = -1; 342 fc_stats->loss_of_signal_count = -1;
340 fc_stats->prim_seq_protocol_err_count = -1; 343 fc_stats->prim_seq_protocol_err_count = -1;
341 fc_stats->dumped_frames = -1; 344 fc_stats->dumped_frames = -1;
345
346 /* update exches stats */
347 fc_exch_update_stats(lport);
348
342 return fc_stats; 349 return fc_stats;
343} 350}
344EXPORT_SYMBOL(fc_get_host_stats); 351EXPORT_SYMBOL(fc_get_host_stats);
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index f257a74e6de4..399162b50a8d 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -1121,6 +1121,7 @@ void fc_fill_hdr(struct fc_frame *, const struct fc_frame *,
1121 * EXCHANGE MANAGER LAYER 1121 * EXCHANGE MANAGER LAYER
1122 *****************************/ 1122 *****************************/
1123int fc_exch_init(struct fc_lport *); 1123int fc_exch_init(struct fc_lport *);
1124void fc_exch_update_stats(struct fc_lport *lport);
1124struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *, 1125struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *,
1125 struct fc_exch_mgr *, 1126 struct fc_exch_mgr *,
1126 bool (*match)(struct fc_frame *)); 1127 bool (*match)(struct fc_frame *));