scsi: fnic: fnic stats for max CQs processed and ISR time
authorSatish Kharat <satishkh@cisco.com>
Tue, 15 Jan 2019 01:09:25 +0000 (17:09 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 23 Jan 2019 02:18:34 +0000 (21:18 -0500)
This change is to add fnic stats for the max number of CQs (corresponding
to copy WQ) processed in a given interrupt, max time taken by the ISR.

Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fnic/fnic_scsi.c
drivers/scsi/fnic/fnic_stats.h
drivers/scsi/fnic/fnic_trace.c

index a49b0f36b2f883b7da263d1b5d674cb0e216e352..4140f07415dd43058148ed2c3c154cb43d268964 100644 (file)
@@ -1325,13 +1325,32 @@ int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do)
        unsigned int wq_work_done = 0;
        unsigned int i, cq_index;
        unsigned int cur_work_done;
+       struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats;
+       u64 start_jiffies = 0;
+       u64 end_jiffies = 0;
+       u64 delta_jiffies = 0;
+       u64 delta_ms = 0;
 
        for (i = 0; i < fnic->wq_copy_count; i++) {
                cq_index = i + fnic->raw_wq_count + fnic->rq_count;
+
+               start_jiffies = jiffies;
                cur_work_done = vnic_cq_copy_service(&fnic->cq[cq_index],
                                                     fnic_fcpio_cmpl_handler,
                                                     copy_work_to_do);
+               end_jiffies = jiffies;
+
                wq_work_done += cur_work_done;
+               delta_jiffies = end_jiffies - start_jiffies;
+               if (delta_jiffies >
+                       (u64) atomic64_read(&misc_stats->max_isr_jiffies)) {
+                       atomic64_set(&misc_stats->max_isr_jiffies,
+                                       delta_jiffies);
+                       delta_ms = jiffies_to_msecs(delta_jiffies);
+                       atomic64_set(&misc_stats->max_isr_time_ms, delta_ms);
+                       atomic64_set(&misc_stats->corr_work_done,
+                                       cur_work_done);
+               }
        }
        return wq_work_done;
 }
index 299e925921b1298f3d289686fcf6215f0a6495d1..1b1006a882e93c48a514f16ead8af88584841ed7 100644 (file)
@@ -97,6 +97,9 @@ struct vlan_stats {
 struct misc_stats {
        u64 last_isr_time;
        u64 last_ack_time;
+       atomic64_t max_isr_jiffies;
+       atomic64_t max_isr_time_ms;
+       atomic64_t corr_work_done;
        atomic64_t isr_count;
        atomic64_t max_cq_entries;
        atomic64_t ack_index_out_of_range;
index 8c0d4ee824db143156570f60fe5a1a504a9eca15..ce32380a182e0f0401025de3160cdbfb75a9827a 100644 (file)
@@ -409,6 +409,9 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
        len += snprintf(debug->debug_buffer + len, buf_size - len,
                  "Last ISR time: %llu (%8llu.%09lu)\n"
                  "Last ACK time: %llu (%8llu.%09lu)\n"
+                 "Max ISR jiffies: %llu\n"
+                 "Max ISR time (ms) (0 denotes < 1 ms): %llu\n"
+                 "Corr. work done: %llu\n"
                  "Number of ISRs: %lld\n"
                  "Maximum CQ Entries: %lld\n"
                  "Number of ACK index out of range: %lld\n"
@@ -428,6 +431,9 @@ int fnic_get_stats_data(struct stats_debug_info *debug,
                  (s64)val1.tv_sec, val1.tv_nsec,
                  (u64)stats->misc_stats.last_ack_time,
                  (s64)val2.tv_sec, val2.tv_nsec,
+                 (u64)atomic64_read(&stats->misc_stats.max_isr_jiffies),
+                 (u64)atomic64_read(&stats->misc_stats.max_isr_time_ms),
+                 (u64)atomic64_read(&stats->misc_stats.corr_work_done),
                  (u64)atomic64_read(&stats->misc_stats.isr_count),
                  (u64)atomic64_read(&stats->misc_stats.max_cq_entries),
                  (u64)atomic64_read(&stats->misc_stats.ack_index_out_of_range),