[openib-general] [PATCH 2/3] osm: Changes for windows compatability

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Wed Dec 27 01:03:50 PST 2006


Hi Hal.

Fixing windows compilation problems.

Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
 osm/opensm/osm_ucast_ftree.c |   42 ++++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 20 deletions(-)

diff --git a/osm/opensm/osm_ucast_ftree.c b/osm/opensm/osm_ucast_ftree.c
index ba95a0d..054e3c9 100644
--- a/osm/opensm/osm_ucast_ftree.c
+++ b/osm/opensm/osm_ucast_ftree.c
@@ -135,8 +135,8 @@ typedef uint8_t * ftree_fwd_tbl_t;
 typedef struct ftree_port_t_ 
 {
    cl_map_item_t  map_item;
-   uint16_t       port_num;           /* port number on the current node */
-   uint16_t       remote_port_num;    /* port number on the remote node */
+   uint8_t        port_num;           /* port number on the current node */
+   uint8_t        remote_port_num;    /* port number on the remote node */
    uint32_t       counter_up;         /* number of allocated routs upwards */
    uint32_t       counter_down;       /* number of allocated routs downwards */
 } ftree_port_t;
@@ -212,7 +212,7 @@ typedef struct ftree_fabric_t_
    cl_qmap_t       hca_tbl;
    cl_qmap_t       sw_tbl;
    cl_qmap_t       sw_by_tuple_tbl;
-   uint32_t        tree_rank;
+   uint16_t        tree_rank;
    ftree_sw_t   ** leaf_switches;
    uint32_t        leaf_switches_num;
    uint16_t        max_hcas_per_leaf;
@@ -226,7 +226,7 @@ typedef struct ftree_fabric_t_
  **
  ***************************************************/
 
-int
+int OSM_CDECL
 __osm_ftree_compare_switches_by_index(
    IN  const void * p1, 
    IN  const void * p2)
@@ -247,7 +247,7 @@ __osm_ftree_compare_switches_by_index(
 
 /***************************************************/
 
-int
+int OSM_CDECL
 __osm_ftree_compare_port_groups_by_remote_switch_index(
    IN  const void * p1, 
    IN  const void * p2)
@@ -401,8 +401,8 @@ __osm_ftree_sw_tbl_element_destroy(
 
 static ftree_port_t * 
 __osm_ftree_port_create( 
-   IN  uint16_t port_num,
-   IN  uint16_t remote_port_num)
+   IN  uint8_t port_num,
+   IN  uint8_t remote_port_num)
 {
    ftree_port_t * p_port = (ftree_port_t *)malloc(sizeof(ftree_port_t));
    if (!p_port)
@@ -553,8 +553,8 @@ __osm_ftree_port_group_dump(
 static void
 __osm_ftree_port_group_add_port(
    IN  ftree_port_group_t * p_group,
-   IN  uint16_t             port_num,
-   IN  uint16_t             remote_port_num)
+   IN  uint8_t              port_num,
+   IN  uint8_t              remote_port_num)
 {
    uint16_t i;
    ftree_port_t * p_port;
@@ -722,8 +722,8 @@ __osm_ftree_sw_get_port_group_by_remote_
 static void 
 __osm_ftree_sw_add_port(
    IN  ftree_sw_t       * p_sw,
-   IN  uint16_t           port_num,
-   IN  uint16_t           remote_port_num,
+   IN  uint8_t            port_num,
+   IN  uint8_t            remote_port_num,
    IN  ib_net16_t         base_lid,
    IN  uint8_t            lmc,
    IN  ib_net16_t         remote_base_lid,
@@ -872,8 +872,8 @@ __osm_ftree_hca_get_port_group_by_remote
 static void 
 __osm_ftree_hca_add_port(
    IN  ftree_hca_t * p_hca,
-   IN  uint16_t      port_num,
-   IN  uint16_t      remote_port_num,
+   IN  uint8_t       port_num,
+   IN  uint8_t       remote_port_num,
    IN  ib_net16_t    base_lid,
    IN  uint8_t       lmc,
    IN  ib_net16_t    remote_base_lid,
@@ -1799,7 +1799,7 @@ __osm_ftree_fabric_route_upgoing_by_goin
 
       /* find the least loaded port of the group (in indexing order) */
       p_min_port = NULL;
-      ports_num = cl_ptr_vector_get_size(&p_group->ports);
+      ports_num = (uint16_t)cl_ptr_vector_get_size(&p_group->ports);
       /* ToDo: no need to select a least loaded port for non-main path.
          Think about optimization. */
       for (j = 0; j < ports_num; j++) 
@@ -1951,7 +1951,7 @@ __osm_ftree_fabric_route_downgoing_by_go
    {
       p_group = p_sw->up_port_groups[i];
 
-      ports_num = cl_ptr_vector_get_size(&p_group->ports);
+      ports_num = (uint16_t)cl_ptr_vector_get_size(&p_group->ports);
       for (j = 0; j < ports_num; j++)
       {
          cl_ptr_vector_at(&p_group->ports, j, (void **)&p_port);
@@ -2182,7 +2182,9 @@ __osm_ftree_fabric_route_to_hcas(
          osm_log(&p_ftree->p_osm->log, OSM_LOG_DEBUG,"__osm_ftree_fabric_route_to_hcas: "
                  "Routing %u dummy HCAs\n",
                  p_ftree->max_hcas_per_leaf - p_sw->down_port_groups_num);
-         for (j = 0; j < (p_ftree->max_hcas_per_leaf - p_sw->down_port_groups_num); j++)
+         for ( j = 0;
+               ((int)j) < (p_ftree->max_hcas_per_leaf - p_sw->down_port_groups_num);
+               j++)
          {
             /* assign downgoing ports by stepping up */
             __osm_ftree_fabric_route_downgoing_by_going_up(
@@ -2329,7 +2331,7 @@ __osm_ftree_rank_from_switch(
    osm_node_t   * p_node;
    osm_node_t   * p_remote_node;
    osm_physp_t  * p_osm_port;
-   uint16_t       i;
+   uint8_t        i;
    cl_list_t      bfs_list;
    ftree_sw_tbl_element_t * p_sw_tbl_element = NULL;
 
@@ -2394,7 +2396,7 @@ __osm_ftree_rank_switches_from_hca(
    osm_node_t     * p_osm_node = p_hca->p_osm_node;
    osm_node_t     * p_remote_osm_node;
    osm_physp_t    * p_osm_port;
-   static uint16_t i = 0;
+   static uint8_t   i = 0;
    int res = 0;
 
    OSM_LOG_ENTER(&p_ftree->p_osm->log, __osm_ftree_rank_switches_from_hca);
@@ -2493,7 +2495,7 @@ __osm_ftree_fabric_construct_hca_ports(
    uint8_t           remote_node_type;
    ib_net64_t        remote_node_guid;
    osm_physp_t     * p_remote_osm_port;
-   uint16_t          i;
+   uint8_t           i;
    uint8_t           remote_port_num;
    int res = 0;
 
@@ -2590,7 +2592,7 @@ __osm_ftree_fabric_construct_sw_ports(
    osm_physp_t       * p_remote_osm_port;
    ftree_direction_t   direction;
    void              * p_remote_hca_or_sw;
-   uint16_t            i;
+   uint8_t             i;
    uint8_t             remote_port_num;
    int res = 0;
 
-- 
1.4.4.1.GIT





More information about the general mailing list