diff options
| author | Vasu Dev <vasu.dev@intel.com> | 2012-05-25 13:26:54 -0400 |
|---|---|---|
| committer | James Bottomley <JBottomley@Parallels.com> | 2012-07-20 03:31:48 -0400 |
| commit | 4e5fae7adbe4f21538b9e62c0fc9b029bbd606cb (patch) | |
| tree | 99c14af426c0e3f6b38583ac66e7622028d669c6 /drivers/scsi | |
| parent | 0f02a6652803235a4893c7b01dd6eab862a913ec (diff) | |
[SCSI] libfc: update fcp and exch stats
Updates newly added stats from fc_get_host_stats,
added new function fc_exch_update_stats to
update exches related stats from fc_exch.c
by going thru internal ema_list elements.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Acked-by : Robert Love <robert.w.love@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
| -rw-r--r-- | drivers/scsi/libfc/fc_exch.c | 30 | ||||
| -rw-r--r-- | drivers/scsi/libfc/fc_lport.c | 7 |
2 files changed, 32 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 | */ | ||
| 2157 | void 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 | } | ||
| 2176 | EXPORT_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 | } |
| 344 | EXPORT_SYMBOL(fc_get_host_stats); | 351 | EXPORT_SYMBOL(fc_get_host_stats); |
