diff options
author | Bhanu Prakash Gollapudi <bprakash@broadcom.com> | 2012-12-21 22:40:32 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2013-01-29 18:48:48 -0500 |
commit | f246fe2a56b3286d0675aba5ebc79ec3b98117f6 (patch) | |
tree | 87651ed3f79d359f93e074cb0a6473bb34f120a9 /drivers/scsi/bnx2fc/bnx2fc.h | |
parent | e7f4fed5fa96d3da12c3e1c8ed9f536235eec3b5 (diff) |
[SCSI] bnx2fc: Tx/Rx byte counts reset to 0 when exceeding 32 bit values
Since the FW counters are 32-bit, accumulate the stats in the driver.
[jejb: fix checkpatch warning]
Signed-off-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bnx2fc/bnx2fc.h')
-rw-r--r-- | drivers/scsi/bnx2fc/bnx2fc.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/scsi/bnx2fc/bnx2fc.h b/drivers/scsi/bnx2fc/bnx2fc.h index 6c9e71792674..3971d7eb774a 100644 --- a/drivers/scsi/bnx2fc/bnx2fc.h +++ b/drivers/scsi/bnx2fc/bnx2fc.h | |||
@@ -156,6 +156,18 @@ | |||
156 | #define BNX2FC_RELOGIN_WAIT_TIME 200 | 156 | #define BNX2FC_RELOGIN_WAIT_TIME 200 |
157 | #define BNX2FC_RELOGIN_WAIT_CNT 10 | 157 | #define BNX2FC_RELOGIN_WAIT_CNT 10 |
158 | 158 | ||
159 | #define BNX2FC_STATS(hba, stat, cnt) \ | ||
160 | do { \ | ||
161 | u32 val; \ | ||
162 | \ | ||
163 | val = fw_stats->stat.cnt; \ | ||
164 | if (hba->prev_stats.stat.cnt <= val) \ | ||
165 | val -= hba->prev_stats.stat.cnt; \ | ||
166 | else \ | ||
167 | val += (0xfffffff - hba->prev_stats.stat.cnt); \ | ||
168 | hba->bfw_stats.cnt += val; \ | ||
169 | } while (0) | ||
170 | |||
159 | /* bnx2fc driver uses only one instance of fcoe_percpu_s */ | 171 | /* bnx2fc driver uses only one instance of fcoe_percpu_s */ |
160 | extern struct fcoe_percpu_s bnx2fc_global; | 172 | extern struct fcoe_percpu_s bnx2fc_global; |
161 | 173 | ||
@@ -167,6 +179,14 @@ struct bnx2fc_percpu_s { | |||
167 | spinlock_t fp_work_lock; | 179 | spinlock_t fp_work_lock; |
168 | }; | 180 | }; |
169 | 181 | ||
182 | struct bnx2fc_fw_stats { | ||
183 | u64 fc_crc_cnt; | ||
184 | u64 fcoe_tx_pkt_cnt; | ||
185 | u64 fcoe_rx_pkt_cnt; | ||
186 | u64 fcoe_tx_byte_cnt; | ||
187 | u64 fcoe_rx_byte_cnt; | ||
188 | }; | ||
189 | |||
170 | struct bnx2fc_hba { | 190 | struct bnx2fc_hba { |
171 | struct list_head list; | 191 | struct list_head list; |
172 | struct cnic_dev *cnic; | 192 | struct cnic_dev *cnic; |
@@ -207,6 +227,8 @@ struct bnx2fc_hba { | |||
207 | struct bnx2fc_rport **tgt_ofld_list; | 227 | struct bnx2fc_rport **tgt_ofld_list; |
208 | 228 | ||
209 | /* statistics */ | 229 | /* statistics */ |
230 | struct bnx2fc_fw_stats bfw_stats; | ||
231 | struct fcoe_statistics_params prev_stats; | ||
210 | struct fcoe_statistics_params *stats_buffer; | 232 | struct fcoe_statistics_params *stats_buffer; |
211 | dma_addr_t stats_buf_dma; | 233 | dma_addr_t stats_buf_dma; |
212 | struct completion stat_req_done; | 234 | struct completion stat_req_done; |