OpenSM patches for saquery porting - 1 of 6:
authortzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 4 Feb 2009 15:11:30 +0000 (15:11 +0000)
committertzachid <tzachid@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 4 Feb 2009 15:11:30 +0000 (15:11 +0000)
  The following OpenSM patches update OpenSM's ib_types.h a small step closer to the OFED version by
  1) matching field names.
  2) missing #defines
  3) missing functions
Changes were required in order to port the OFED 1.4 ibsaquery command.
Signed off by: stan.smith@intel.com

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

ulp/opensm/user/include/iba/ib_types.h

index 165b261..92d018b 100644 (file)
@@ -1696,6 +1696,50 @@ ib_class_is_rmpp(
 #define IB_SMINFO_STATE_MASTER                         3\r
 /**********/\r
 \r
+/****d* IBA Base: Constants/IB_PATH_REC_SL_MASK\r
+* NAME\r
+*      IB_PATH_REC_SL_MASK\r
+*\r
+* DESCRIPTION\r
+*      Mask for the sl field for path record\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PATH_REC_SL_MASK                            0x000F\r
+\r
+/****d* IBA Base: Constants/IB_MULTIPATH_REC_SL_MASK\r
+* NAME\r
+*      IB_MILTIPATH_REC_SL_MASK\r
+*\r
+* DESCRIPTION\r
+*      Mask for the sl field for MultiPath record\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MULTIPATH_REC_SL_MASK                       0x000F\r
+\r
+/****d* IBA Base: Constants/IB_PATH_REC_QOS_CLASS_MASK\r
+* NAME\r
+*      IB_PATH_REC_QOS_CLASS_MASK\r
+*\r
+* DESCRIPTION\r
+*      Mask for the QoS class field for path record\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PATH_REC_QOS_CLASS_MASK                     0xFFF0\r
+\r
+/****d* IBA Base: Constants/IB_MULTIPATH_REC_QOS_CLASS_MASK\r
+* NAME\r
+*      IB_MULTIPATH_REC_QOS_CLASS_MASK\r
+*\r
+* DESCRIPTION\r
+*      Mask for the QoS class field for MultiPath record\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MULTIPATH_REC_QOS_CLASS_MASK                        0xFFF0\r
+\r
 /****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK\r
 * NAME\r
 *      IB_PATH_REC_SELECTOR_MASK\r
@@ -2310,7 +2354,7 @@ ib_gid_get_guid(
 #include <complib/cl_packon.h>\r
 typedef struct _ib_path_rec\r
 {\r
-       uint8_t                                 resv0[8];\r
+       ib_net64_t                              service_id;\r
        ib_gid_t                                dgid;\r
        ib_gid_t                                sgid;\r
        ib_net16_t                              dlid;\r
@@ -2319,7 +2363,7 @@ typedef struct _ib_path_rec
        uint8_t                                 tclass;\r
        uint8_t                                 num_path; \r
        ib_net16_t                              pkey;\r
-       ib_net16_t                              sl;\r
+       ib_net16_t                              qos_class_sl;\r
        uint8_t                                 mtu;\r
        uint8_t                                 rate;\r
        uint8_t                                 pkt_life;\r
@@ -2670,7 +2714,7 @@ ib_path_rec_init_local(
        p_rec->num_path = num_path;\r
        p_rec->pkey = pkey;\r
        /* Lower 4 bits of path rec's SL are reserved. */\r
-       p_rec->sl = cl_ntoh16( sl );\r
+       p_rec->qos_class_sl = cl_ntoh16( sl );\r
        p_rec->mtu = (uint8_t)((mtu & IB_PATH_REC_BASE_MASK) |\r
                        (uint8_t)(mtu_selector << 6));\r
        p_rec->rate = (uint8_t)((rate & IB_PATH_REC_BASE_MASK) |\r
@@ -2683,7 +2727,7 @@ ib_path_rec_init_local(
        p_rec->hop_flow_raw = 0;\r
        p_rec->tclass = 0;\r
 \r
-       *((uint64_t*)p_rec->resv0) = 0;\r
+       *((uint64_t*)p_rec->service_id) = 0;\r
        *((uint32_t*)p_rec->resv2) = 0;\r
        *((uint16_t*)p_rec->resv2 + 2) = 0;\r
 }\r
@@ -2788,7 +2832,7 @@ static inline uint8_t     OSM_API
 ib_path_rec_sl(\r
        IN      const   ib_path_rec_t* const    p_rec )\r
 {\r
-       return( (uint8_t)((cl_ntoh16( p_rec->sl )) & 0xF) );\r
+       return( (uint8_t)((cl_ntoh16( p_rec->qos_class_sl )) & 0xF) );\r
 }\r
 /*\r
 * PARAMETERS\r
@@ -2804,6 +2848,71 @@ ib_path_rec_sl(
 *      ib_path_rec_t\r
 *********/\r
 \r
+/****f* IBA Base: Types/ib_path_rec_set_qos_class\r
+* NAME\r
+*      ib_path_rec_set_qos_class\r
+*\r
+* DESCRIPTION\r
+*      Set path QoS class.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline void OSM_API\r
+ib_path_rec_set_qos_class(IN ib_path_rec_t * const p_rec,\r
+                         IN const uint16_t qos_class)\r
+{\r
+       p_rec->qos_class_sl =\r
+           (p_rec->qos_class_sl & CL_HTON16(IB_PATH_REC_SL_MASK)) |\r
+           cl_hton16(qos_class << 4);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+*      p_rec\r
+*              [in] Pointer to the path record object.\r
+*\r
+*      qos_class\r
+*              [in] QoS class to set.\r
+*\r
+* RETURN VALUES\r
+*      None\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*      ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_qos_class\r
+* NAME\r
+*      ib_path_rec_qos_class\r
+*\r
+* DESCRIPTION\r
+*      Get QoS class.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline uint16_t OSM_API\r
+ib_path_rec_qos_class(IN const ib_path_rec_t * const p_rec)\r
+{\r
+       return (cl_ntoh16(p_rec->qos_class_sl) >> 4);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+*      p_rec\r
+*              [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+*      QoS class of the path record.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*      ib_path_rec_t\r
+*********/\r
+\r
+\r
 /****f* IBA Base: Types/ib_path_rec_mtu\r
 * NAME\r
 *      ib_path_rec_mtu\r
@@ -3127,8 +3236,7 @@ typedef struct _ib_class_port_info
        uint8_t                                 base_ver;\r
        uint8_t                                 class_ver;\r
        ib_net16_t                              cap_mask;\r
-       uint8_t                                 reserved[3];\r
-       uint8_t                                 resp_time_val;\r
+       ib_net32_t                              cap_mask2_resp_time;\r
        ib_gid_t                                redir_gid;\r
        ib_net32_t                              redir_tc_sl_fl;\r
        ib_net16_t                              redir_lid;\r
@@ -3155,8 +3263,9 @@ typedef struct _ib_class_port_info
 *      cap_mask\r
 *              Supported capabilities of this management class.\r
 *\r
-*      resp_time_value\r
-*              Maximum expected response time.\r
+*      cap_mask2_resp_time\r
+*              Maximum expected response time and additional\r
+*              supported capabilities of this management class.\r
 *\r
 *      redr_gid\r
 *              GID to use for redirection, or zero\r
@@ -3202,6 +3311,135 @@ typedef struct _ib_class_port_info
 *\r
 *********/\r
 \r
+/****f* IBA Base: Types/ib_class_set_resp_time_val\r
+* NAME\r
+*      ib_class_set_resp_time_val\r
+*\r
+* DESCRIPTION\r
+*      Set maximum expected response time.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline void OSM_API\r
+ib_class_set_resp_time_val(IN ib_class_port_info_t * const p_cpi,\r
+                          IN const uint8_t val)\r
+{\r
+       p_cpi->cap_mask2_resp_time =\r
+           (p_cpi->cap_mask2_resp_time & CL_HTON32(~IB_CLASS_RESP_TIME_MASK)) |\r
+           cl_hton32(val & IB_CLASS_RESP_TIME_MASK);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+*      p_cpi\r
+*              [in] Pointer to the class port info object.\r
+*\r
+*      val\r
+*              [in] Response time value to set.\r
+*\r
+* RETURN VALUES\r
+*      None\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*      ib_class_port_info_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_class_resp_time_val\r
+* NAME\r
+*      ib_class_resp_time_val\r
+*\r
+* DESCRIPTION\r
+*      Get response time value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline uint8_t OSM_API\r
+ib_class_resp_time_val(IN ib_class_port_info_t * const p_cpi)\r
+{\r
+       return (uint8_t)(cl_ntoh32(p_cpi->cap_mask2_resp_time) &\r
+                        IB_CLASS_RESP_TIME_MASK);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+*      p_cpi\r
+*              [in] Pointer to the class port info object.\r
+*\r
+* RETURN VALUES\r
+*      Response time value.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*      ib_class_port_info_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_class_set_cap_mask2\r
+* NAME\r
+*      ib_class_set_cap_mask2\r
+*\r
+* DESCRIPTION\r
+*      Set ClassPortInfo:CapabilityMask2.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline void OSM_API\r
+ib_class_set_cap_mask2(IN ib_class_port_info_t * const p_cpi,\r
+                      IN const uint32_t cap_mask2)\r
+{\r
+       p_cpi->cap_mask2_resp_time = (p_cpi->cap_mask2_resp_time &\r
+               CL_HTON32(IB_CLASS_RESP_TIME_MASK)) |\r
+               cl_hton32(cap_mask2 << 5);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+*      p_cpi\r
+*              [in] Pointer to the class port info object.\r
+*\r
+*      cap_mask2\r
+*              [in] CapabilityMask2 value to set.\r
+*\r
+* RETURN VALUES\r
+*      None\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*      ib_class_port_info_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_class_cap_mask2\r
+* NAME\r
+*      ib_class_cap_mask2\r
+*\r
+* DESCRIPTION\r
+*      Get ClassPortInfo:CapabilityMask2.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline uint32_t OSM_API\r
+ib_class_cap_mask2(IN const ib_class_port_info_t * const p_cpi)\r
+{\r
+       return (cl_ntoh32(p_cpi->cap_mask2_resp_time) >> 5);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+*      p_cpi\r
+*              [in] Pointer to the class port info object.\r
+*\r
+* RETURN VALUES\r
+*      CapabilityMask2 of the ClassPortInfo.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*      ib_class_port_info_t\r
+*********/\r
+\r
 /****s* IBA Base: Types/ib_sm_info_t\r
 * NAME\r
 *      ib_sm_info_t\r
@@ -7203,6 +7441,40 @@ ib_inform_info_set_qpn(
 *      ib_inform_info_t\r
 *********/\r
 \r
+/****f* IBA Base: Types/ib_inform_info_get_prod_type\r
+* NAME\r
+*      ib_inform_info_get_prod_type\r
+*\r
+* DESCRIPTION\r
+*      Get Producer Type of the Inform Info\r
+*      13.4.8.3 InformInfo\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline ib_net32_t OSM_API\r
+ib_inform_info_get_prod_type(IN const ib_inform_info_t * p_inf)\r
+{\r
+       uint32_t nt;\r
+\r
+       nt = cl_ntoh16(p_inf->g_or_v.generic.node_type_lsb) |\r
+           (p_inf->g_or_v.generic.node_type_msb << 16);\r
+       return cl_hton32(nt);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+*      p_inf\r
+*              [in] pointer to an inform info\r
+*\r
+* RETURN VALUES\r
+*     The producer type\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*      ib_inform_info_t\r
+*********/\r
+\r
 /****f* IBA Base: Types/ib_inform_info_get_node_type\r
 * NAME\r
 *      ib_inform_info_get_node_type\r