]> err.no Git - linux-2.6/commitdiff
IB/ipath: Add ability to set and clear IB local loopback
authorBryan O'Sullivan <bos@pathscale.com>
Thu, 15 Mar 2007 21:44:45 +0000 (14:44 -0700)
committerRoland Dreier <rolandd@cisco.com>
Thu, 19 Apr 2007 03:20:53 +0000 (20:20 -0700)
This is a sticky state.  It is useful for diagnosing problems with
boards versus cable/switch problems.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ipath/ipath_common.h
drivers/infiniband/hw/ipath/ipath_driver.c

index 54139d3981812a2ffdc78166d2dcf7722ea29b91..a413678035297c969d48fa820e704f388340f4e3 100644 (file)
@@ -78,6 +78,8 @@
 #define IPATH_IB_LINKINIT              3
 #define IPATH_IB_LINKDOWN_SLEEP                4
 #define IPATH_IB_LINKDOWN_DISABLE      5
+#define IPATH_IB_LINK_LOOPBACK 6 /* enable local loopback */
+#define IPATH_IB_LINK_EXTERNAL 7 /* normal, disable local loopback */
 
 /*
  * stats maintained by the driver.  For now, at least, this is global
index ae7f21a0cdc0673377b4f6a2d443bb561d86d7f8..c2fe5417ff450141a22707e7d43b5eee01668ffe 100644 (file)
@@ -1662,6 +1662,22 @@ int ipath_set_linkstate(struct ipath_devdata *dd, u8 newstate)
                lstate = IPATH_LINKACTIVE;
                break;
 
+       case IPATH_IB_LINK_LOOPBACK:
+               dev_info(&dd->pcidev->dev, "Enabling IB local loopback\n");
+               dd->ipath_ibcctrl |= INFINIPATH_IBCC_LOOPBACK;
+               ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl,
+                                dd->ipath_ibcctrl);
+               ret = 0;
+               goto bail; // no state change to wait for
+
+       case IPATH_IB_LINK_EXTERNAL:
+               dev_info(&dd->pcidev->dev, "Disabling IB local loopback (normal)\n");
+               dd->ipath_ibcctrl &= ~INFINIPATH_IBCC_LOOPBACK;
+               ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl,
+                                dd->ipath_ibcctrl);
+               ret = 0;
+               goto bail; // no state change to wait for
+
        default:
                ipath_dbg("Invalid linkstate 0x%x requested\n", newstate);
                ret = -EINVAL;