]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/infiniband/hw/ipath/ipath_stats.c
Merge branch 'linus' into perfcounters/core
[mv-sheeva.git] / drivers / infiniband / hw / ipath / ipath_stats.c
index f0271415cd5b19558f7fae74baaef2330a96490d..f63e143e3292130cceea8426442e6e263b797d53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007, 2008 QLogic Corporation. All rights reserved.
  * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
@@ -112,6 +112,14 @@ u64 ipath_snap_cntr(struct ipath_devdata *dd, ipath_creg creg)
                        dd->ipath_lastrpkts = val;
                }
                val64 = dd->ipath_rpkts;
+       } else if (creg == dd->ipath_cregs->cr_ibsymbolerrcnt) {
+               if (dd->ibdeltainprog)
+                       val64 -= val64 - dd->ibsymsnap;
+               val64 -= dd->ibsymdelta;
+       } else if (creg == dd->ipath_cregs->cr_iblinkerrrecovcnt) {
+               if (dd->ibdeltainprog)
+                       val64 -= val64 - dd->iblnkerrsnap;
+               val64 -= dd->iblnkerrdelta;
        } else
                val64 = (u64) val;
 
@@ -133,15 +141,17 @@ bail:
 static void ipath_qcheck(struct ipath_devdata *dd)
 {
        static u64 last_tot_hdrqfull;
+       struct ipath_portdata *pd = dd->ipath_pd[0];
        size_t blen = 0;
        char buf[128];
+       u32 hdrqtail;
 
        *buf = 0;
-       if (dd->ipath_pd[0]->port_hdrqfull != dd->ipath_p0_hdrqfull) {
+       if (pd->port_hdrqfull != dd->ipath_p0_hdrqfull) {
                blen = snprintf(buf, sizeof buf, "port 0 hdrqfull %u",
-                               dd->ipath_pd[0]->port_hdrqfull -
+                               pd->port_hdrqfull -
                                dd->ipath_p0_hdrqfull);
-               dd->ipath_p0_hdrqfull = dd->ipath_pd[0]->port_hdrqfull;
+               dd->ipath_p0_hdrqfull = pd->port_hdrqfull;
        }
        if (ipath_stats.sps_etidfull != dd->ipath_last_tidfull) {
                blen += snprintf(buf + blen, sizeof buf - blen,
@@ -173,17 +183,18 @@ static void ipath_qcheck(struct ipath_devdata *dd)
        if (blen)
                ipath_dbg("%s\n", buf);
 
-       if (dd->ipath_port0head != (u32)
-           le64_to_cpu(*dd->ipath_hdrqtailptr)) {
+       hdrqtail = ipath_get_hdrqtail(pd);
+       if (pd->port_head != hdrqtail) {
                if (dd->ipath_lastport0rcv_cnt ==
                    ipath_stats.sps_port0pkts) {
                        ipath_cdbg(PKT, "missing rcv interrupts? "
-                                  "port0 hd=%llx tl=%x; port0pkts %llx\n",
-                                  (unsigned long long)
-                                  le64_to_cpu(*dd->ipath_hdrqtailptr),
-                                  dd->ipath_port0head,
+                                  "port0 hd=%x tl=%x; port0pkts %llx; write"
+                                  " hd (w/intr)\n",
+                                  pd->port_head, hdrqtail,
                                   (unsigned long long)
                                   ipath_stats.sps_port0pkts);
+                       ipath_write_ureg(dd, ur_rcvhdrhead, hdrqtail |
+                               dd->ipath_rhdrhead_intr_off, pd->port_port);
                }
                dd->ipath_lastport0rcv_cnt = ipath_stats.sps_port0pkts;
        }
@@ -237,7 +248,7 @@ static void ipath_chk_errormask(struct ipath_devdata *dd)
 void ipath_get_faststats(unsigned long opaque)
 {
        struct ipath_devdata *dd = (struct ipath_devdata *) opaque;
-       u32 val;
+       int i;
        static unsigned cnt;
        unsigned long flags;
        u64 traffic_wds;
@@ -289,11 +300,11 @@ void ipath_get_faststats(unsigned long opaque)
            && time_after(jiffies, dd->ipath_unmasktime)) {
                char ebuf[256];
                int iserr;
-               iserr = ipath_decode_err(ebuf, sizeof ebuf,
-                       dd->ipath_maskederrs);
+               iserr = ipath_decode_err(dd, ebuf, sizeof ebuf,
+                                        dd->ipath_maskederrs);
                if (dd->ipath_maskederrs &
-                               ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL |
-                               INFINIPATH_E_PKTERRS ))
+                   ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL |
+                     INFINIPATH_E_PKTERRS))
                        ipath_dev_err(dd, "Re-enabling masked errors "
                                      "(%s)\n", ebuf);
                else {
@@ -305,28 +316,28 @@ void ipath_get_faststats(unsigned long opaque)
                         * level.
                         */
                        if (iserr)
-                                       ipath_dbg("Re-enabling queue full errors (%s)\n",
-                                                       ebuf);
+                               ipath_dbg(
+                                       "Re-enabling queue full errors (%s)\n",
+                                       ebuf);
                        else
                                ipath_cdbg(ERRPKT, "Re-enabling packet"
-                                               " problem interrupt (%s)\n", ebuf);
+                                       " problem interrupt (%s)\n", ebuf);
                }
 
                /* re-enable masked errors */
                dd->ipath_errormask |= dd->ipath_maskederrs;
                ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask,
-                       dd->ipath_errormask);
+                                dd->ipath_errormask);
                dd->ipath_maskederrs = 0;
        }
 
        /* limit qfull messages to ~one per minute per port */
        if ((++cnt & 0x10)) {
-               for (val = dd->ipath_cfgports - 1; ((int)val) >= 0;
-                    val--) {
-                       if (dd->ipath_lastegrheads[val] != -1)
-                               dd->ipath_lastegrheads[val] = -1;
-                       if (dd->ipath_lastrcvhdrqtails[val] != -1)
-                               dd->ipath_lastrcvhdrqtails[val] = -1;
+               for (i = (int) dd->ipath_cfgports; --i >= 0; ) {
+                       struct ipath_portdata *pd = dd->ipath_pd[i];
+
+                       if (pd && pd->port_lastrcvhdrqtail != -1)
+                               pd->port_lastrcvhdrqtail = -1;
                }
        }