[SCSI] lpfc 8.3.33: Add Interrupts per second stats via debugfs
authorJames Smart <james.smart@emulex.com>
Fri, 3 Aug 2012 16:36:03 +0000 (12:36 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 14 Sep 2012 13:40:15 +0000 (14:40 +0100)
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_sli.h

index 982bd40353ec55aebbb744d0ba61910e5a3b5104..83a1c9e4902d198769a7b9c9245dfd1713d38e12 100644 (file)
@@ -2825,10 +2825,26 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
 void lpfc_poll_eratt(unsigned long ptr)
 {
        struct lpfc_hba *phba;
-       uint32_t eratt = 0;
+       uint32_t eratt = 0, rem;
+       uint64_t sli_intr, cnt;
 
        phba = (struct lpfc_hba *)ptr;
 
+       /* Here we will also keep track of interrupts per sec of the hba */
+       sli_intr = phba->sli.slistat.sli_intr;
+
+       if (phba->sli.slistat.sli_prev_intr > sli_intr)
+               cnt = (((uint64_t)(-1) - phba->sli.slistat.sli_prev_intr) +
+                       sli_intr);
+       else
+               cnt = (sli_intr - phba->sli.slistat.sli_prev_intr);
+
+       /* 64-bit integer division not supporte on 32-bit x86 - use do_div */
+       rem = do_div(cnt, LPFC_ERATT_POLL_INTERVAL);
+       phba->sli.slistat.sli_ips = cnt;
+
+       phba->sli.slistat.sli_prev_intr = sli_intr;
+
        /* Check chip HA register for error event */
        eratt = lpfc_sli_check_eratt(phba);
 
index 4b9b44e8e064eeb03ab22870e3f21d62289d9a9f..2f48d000a3b430f5db5da07eb188ac8ba1c02b72 100644 (file)
@@ -255,6 +255,8 @@ struct lpfc_sli_stat {
        uint64_t mbox_stat_err;  /* Mbox cmds completed status error */
        uint64_t mbox_cmd;       /* Mailbox commands issued */
        uint64_t sli_intr;       /* Count of Host Attention interrupts */
+       uint64_t sli_prev_intr;  /* Previous cnt of Host Attention interrupts */
+       uint64_t sli_ips;        /* Host Attention interrupts per sec */
        uint32_t err_attn_event; /* Error Attn event counters */
        uint32_t link_event;     /* Link event counters */
        uint32_t mbox_event;     /* Mailbox event counters */