[HW] fixes to APM support: missed some lines and apm_state was not converted into...
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 17 Sep 2009 16:43:18 +0000 (16:43 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 17 Sep 2009 16:43:18 +0000 (16:43 +0000)
Signed off by: leonid@mellanox.co.il

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2443 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

hw/mlx4/kernel/hca/data.c
hw/mthca/kernel/hca_data.c

index 91df60d..5962a14 100644 (file)
@@ -549,6 +549,14 @@ static ib_qp_state_t  from_qp_state(enum ib_qp_state qps, int draining)
        return ib_qps;\r
 }\r
 \r
+enum ib_mig_state to_apm_state(ib_apm_state_t apm)\r
+{\r
+       if (apm == IB_APM_MIGRATED) return IB_MIG_MIGRATED;\r
+       if (apm == IB_APM_REARM) return IB_MIG_REARM;\r
+       if (apm == IB_APM_ARMED) return IB_MIG_ARMED;\r
+       return 0xffffffff;\r
+}\r
+\r
 ib_api_status_t\r
 to_qp_attr(\r
        IN       const  struct ib_qp *p_ib_qp,\r
@@ -792,7 +800,7 @@ to_qp_attr(
                                // IB_QP_PATH_MIG_STATE\r
                                if (p_ib_qp_mod->state.rts.opts & IB_MOD_QP_APM_STATE) {\r
                                        *p_qp_attr_mask |= IB_QP_PATH_MIG_STATE;        \r
-                                       p_ib_qp_attr->path_mig_state =  p_ib_qp_mod->state.rts.apm_state;\r
+                                       p_ib_qp_attr->path_mig_state =  to_apm_state(p_ib_qp_mod->state.rts.apm_state);\r
                                }\r
 \r
                                // IB_QP_ACCESS_FLAGS\r
@@ -810,7 +818,8 @@ to_qp_attr(
                                                status = IB_ERROR;\r
                                                break;\r
                                        }\r
-                                       p_ib_qp_attr->alt_timeout                = p_ib_qp_mod->state.rts.alternate_av.conn.local_ack_timeout; // XXX: conv\r
+                                       p_ib_qp_attr->alt_timeout               = p_ib_qp_mod->state.rts.alternate_av.conn.local_ack_timeout; // XXX: conv\r
+                                       p_ib_qp_attr->alt_port_num              = p_ib_qp_mod->state.rts.alternate_av.port_num;\r
                                }\r
                                break;\r
                                \r
@@ -839,7 +848,7 @@ to_qp_attr(
                                // IB_QP_PATH_MIG_STATE\r
                                if (p_ib_qp_mod->state.rts.opts & IB_MOD_QP_APM_STATE) {\r
                                        *p_qp_attr_mask |= IB_QP_PATH_MIG_STATE;        \r
-                                       p_ib_qp_attr->path_mig_state =  p_ib_qp_mod->state.rts.apm_state;\r
+                                       p_ib_qp_attr->path_mig_state =  to_apm_state(p_ib_qp_mod->state.rts.apm_state);\r
                                }\r
 \r
                                // IB_QP_ACCESS_FLAGS\r
@@ -857,6 +866,8 @@ to_qp_attr(
                                                status = IB_ERROR;\r
                                                break;\r
                                        }\r
+                                       p_ib_qp_attr->alt_timeout               = p_ib_qp_mod->state.rts.alternate_av.conn.local_ack_timeout; // XXX: conv\r
+                                       p_ib_qp_attr->alt_port_num              = p_ib_qp_mod->state.rts.alternate_av.port_num;\r
                                }\r
                                break;\r
                                        \r
index f3d002b..80389be 100644 (file)
@@ -409,6 +409,14 @@ enum ib_qp_state mlnx_qps_from_ibal(ib_qp_state_t ib_qps)
        return qps;\r
 }\r
 \r
+enum ib_mig_state to_apm_state(ib_apm_state_t apm)\r
+{\r
+       if (apm == IB_APM_MIGRATED) return IB_MIG_MIGRATED;\r
+       if (apm == IB_APM_REARM) return IB_MIG_REARM;\r
+       if (apm == IB_APM_ARMED) return IB_MIG_ARMED;\r
+       return 0xffffffff;\r
+}\r
+\r
 ib_api_status_t\r
 mlnx_conv_qp_modify_attr(\r
        IN       const  struct ib_qp *ib_qp_p,\r
@@ -644,7 +652,7 @@ mlnx_conv_qp_modify_attr(
                                // IB_QP_PATH_MIG_STATE\r
                                if (modify_attr_p->state.rts.opts & IB_MOD_QP_APM_STATE) {\r
                                        *qp_attr_mask_p |= IB_QP_PATH_MIG_STATE;        \r
-                                       qp_attr_p->path_mig_state =  modify_attr_p->state.rts.apm_state;\r
+                                       qp_attr_p->path_mig_state =  to_apm_state(modify_attr_p->state.rts.apm_state);\r
                                }\r
 \r
                                // IB_QP_ACCESS_FLAGS\r
@@ -691,7 +699,7 @@ mlnx_conv_qp_modify_attr(
                                // IB_QP_PATH_MIG_STATE\r
                                if (modify_attr_p->state.rts.opts & IB_MOD_QP_APM_STATE) {\r
                                        *qp_attr_mask_p |= IB_QP_PATH_MIG_STATE;        \r
-                                       qp_attr_p->path_mig_state =  modify_attr_p->state.rts.apm_state;\r
+                                       qp_attr_p->path_mig_state =  to_apm_state(modify_attr_p->state.rts.apm_state);\r
                                }\r
 \r
                                // IB_QP_ACCESS_FLAGS\r