Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3d68ea32611095c7e09409ac1b2a56da22fd5eb7
Commit:     3d68ea32611095c7e09409ac1b2a56da22fd5eb7
Parent:     6ac50727bda29e961385e4c40318dadbb5730193
Author:     Ralph Campbell <[EMAIL PROTECTED]>
AuthorDate: Thu Jan 10 00:50:41 2008 -0800
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 14:17:44 2008 -0800

    IB/ipath: Add mappings from HW register to PortInfo port physical state
    
    Add new mappings from port physical state (a HW register value) to the
    IB SubnGet(PortInfo) port physical state.
    
    Signed-off-by: Ralph Campbell <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/ipath/ipath_verbs.c |   47 +++++++++++++++++++----------
 drivers/infiniband/hw/ipath/ipath_verbs.h |   10 ++++++
 2 files changed, 41 insertions(+), 16 deletions(-)

diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c 
b/drivers/infiniband/hw/ipath/ipath_verbs.c
index 904ff15..32d8f88 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -1133,20 +1133,34 @@ static int ipath_query_device(struct ib_device *ibdev,
        return 0;
 }
 
-const u8 ipath_cvt_physportstate[16] = {
-       [INFINIPATH_IBCS_LT_STATE_DISABLED] = 3,
-       [INFINIPATH_IBCS_LT_STATE_LINKUP] = 5,
-       [INFINIPATH_IBCS_LT_STATE_POLLACTIVE] = 2,
-       [INFINIPATH_IBCS_LT_STATE_POLLQUIET] = 2,
-       [INFINIPATH_IBCS_LT_STATE_SLEEPDELAY] = 1,
-       [INFINIPATH_IBCS_LT_STATE_SLEEPQUIET] = 1,
-       [INFINIPATH_IBCS_LT_STATE_CFGDEBOUNCE] = 4,
-       [INFINIPATH_IBCS_LT_STATE_CFGRCVFCFG] = 4,
-       [INFINIPATH_IBCS_LT_STATE_CFGWAITRMT] = 4,
-       [INFINIPATH_IBCS_LT_STATE_CFGIDLE] = 4,
-       [INFINIPATH_IBCS_LT_STATE_RECOVERRETRAIN] = 6,
-       [INFINIPATH_IBCS_LT_STATE_RECOVERWAITRMT] = 6,
-       [INFINIPATH_IBCS_LT_STATE_RECOVERIDLE] = 6,
+const u8 ipath_cvt_physportstate[32] = {
+       [INFINIPATH_IBCS_LT_STATE_DISABLED] = IB_PHYSPORTSTATE_DISABLED,
+       [INFINIPATH_IBCS_LT_STATE_LINKUP] = IB_PHYSPORTSTATE_LINKUP,
+       [INFINIPATH_IBCS_LT_STATE_POLLACTIVE] = IB_PHYSPORTSTATE_POLL,
+       [INFINIPATH_IBCS_LT_STATE_POLLQUIET] = IB_PHYSPORTSTATE_POLL,
+       [INFINIPATH_IBCS_LT_STATE_SLEEPDELAY] = IB_PHYSPORTSTATE_SLEEP,
+       [INFINIPATH_IBCS_LT_STATE_SLEEPQUIET] = IB_PHYSPORTSTATE_SLEEP,
+       [INFINIPATH_IBCS_LT_STATE_CFGDEBOUNCE] =
+               IB_PHYSPORTSTATE_CFG_TRAIN,
+       [INFINIPATH_IBCS_LT_STATE_CFGRCVFCFG] =
+               IB_PHYSPORTSTATE_CFG_TRAIN,
+       [INFINIPATH_IBCS_LT_STATE_CFGWAITRMT] =
+               IB_PHYSPORTSTATE_CFG_TRAIN,
+       [INFINIPATH_IBCS_LT_STATE_CFGIDLE] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [INFINIPATH_IBCS_LT_STATE_RECOVERRETRAIN] =
+               IB_PHYSPORTSTATE_LINK_ERR_RECOVER,
+       [INFINIPATH_IBCS_LT_STATE_RECOVERWAITRMT] =
+               IB_PHYSPORTSTATE_LINK_ERR_RECOVER,
+       [INFINIPATH_IBCS_LT_STATE_RECOVERIDLE] =
+               IB_PHYSPORTSTATE_LINK_ERR_RECOVER,
+       [0x10] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [0x11] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [0x12] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [0x13] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [0x14] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [0x15] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [0x16] = IB_PHYSPORTSTATE_CFG_TRAIN,
+       [0x17] = IB_PHYSPORTSTATE_CFG_TRAIN
 };
 
 u32 ipath_get_cr_errpkey(struct ipath_devdata *dd)
@@ -1171,8 +1185,9 @@ static int ipath_query_port(struct ib_device *ibdev,
        ibcstat = dd->ipath_lastibcstat;
        props->state = ((ibcstat >> 4) & 0x3) + 1;
        /* See phys_state_show() */
-       props->phys_state = ipath_cvt_physportstate[
-               dd->ipath_lastibcstat & 0xf];
+       props->phys_state = /* MEA: assumes shift == 0 */
+               ipath_cvt_physportstate[dd->ipath_lastibcstat &
+               dd->ibcs_lts_mask];
        props->port_cap_flags = dev->port_cap_flags;
        props->gid_tbl_len = 1;
        props->max_msg_sz = 0x80000000;
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.h 
b/drivers/infiniband/hw/ipath/ipath_verbs.h
index 1c89850..3d59736 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.h
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.h
@@ -832,7 +832,17 @@ unsigned ipath_get_pkey(struct ipath_devdata *, unsigned);
 
 extern const enum ib_wc_opcode ib_ipath_wc_opcode[];
 
+/*
+ * Below converts HCA-specific LinkTrainingState to IB PhysPortState
+ * values.
+ */
 extern const u8 ipath_cvt_physportstate[];
+#define IB_PHYSPORTSTATE_SLEEP 1
+#define IB_PHYSPORTSTATE_POLL 2
+#define IB_PHYSPORTSTATE_DISABLED 3
+#define IB_PHYSPORTSTATE_CFG_TRAIN 4
+#define IB_PHYSPORTSTATE_LINKUP 5
+#define IB_PHYSPORTSTATE_LINK_ERR_RECOVER 6
 
 extern const int ib_ipath_state_ops[];
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to