[ofa-general] [PATCH 4/4] ib-mgmt/ibn3 branch: libibnetdisc add windows support
Sean Hefty
sean.hefty at intel.com
Tue Apr 21 12:06:42 PDT 2009
Allow libibnetdisc to build and run on Windows as part of the WinOF
distribution
Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---
.../libibnetdisc/include/infiniband/ibnetdisc.h | 48 ++++++++++++-----------
infiniband-diags/libibnetdisc/src/chassis.c | 4 +-
infiniband-diags/libibnetdisc/src/ibnetdisc.c | 18 ++++----
infiniband-diags/libibnetdisc/src/libibnetdisc.map | 8 ---
4 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h
b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h
index a882994..370ae31 100644
--- a/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h
+++ b/infiniband-diags/libibnetdisc/include/infiniband/ibnetdisc.h
@@ -37,6 +37,7 @@
#include <stdio.h>
#include <infiniband/mad.h>
#include <iba/ib_types.h>
+#include <infiniband/mad_osd.h>
struct ib_fabric; /* forward declare */
struct chassis; /* forward declare */
@@ -140,11 +141,12 @@ typedef struct ib_fabric {
/** =========================================================================
* Initialization (fabric operations)
*/
-void ibnd_debug(int i);
-void ibnd_show_progress(int i);
+MAD_EXPORT void ibnd_debug(int i);
+MAD_EXPORT void ibnd_show_progress(int i);
-ibnd_fabric_t *ibnd_discover_fabric(char *dev_name, int dev_port,
- int timeout_ms, ib_portid_t *from, int hops);
+MAD_EXPORT ibnd_fabric_t *ibnd_discover_fabric(char *dev_name, int dev_port,
+ int timeout_ms,
+ ib_portid_t *from, int hops);
/**
* dev_name: (required) local device name to use to access the fabric
* dev_port: (required) local device port to use to access the fabric
@@ -156,33 +158,35 @@ ibnd_fabric_t *ibnd_discover_fabric(char *dev_name, int dev_port,
* hops: (optional) Specify how much of the fabric to traverse.
* negative value == scan entire fabric
*/
-void ibnd_destroy_fabric(ibnd_fabric_t *fabric);
+MAD_EXPORT void ibnd_destroy_fabric(ibnd_fabric_t *fabric);
/** =========================================================================
* Node operations
*/
-ibnd_node_t *ibnd_find_node_guid(ibnd_fabric_t *fabric, uint64_t guid);
-ibnd_node_t *ibnd_find_node_dr(ibnd_fabric_t *fabric, char *dr_str);
-ibnd_node_t *ibnd_update_node(ibnd_node_t *node);
+MAD_EXPORT ibnd_node_t *ibnd_find_node_guid(ibnd_fabric_t *fabric, uint64_t guid);
+MAD_EXPORT ibnd_node_t *ibnd_find_node_dr(ibnd_fabric_t *fabric, char *dr_str);
+MAD_EXPORT ibnd_node_t *ibnd_update_node(ibnd_node_t *node);
typedef void (*ibnd_iter_node_func_t)(ibnd_node_t *node, void *user_data);
-void ibnd_iter_nodes(ibnd_fabric_t *fabric,
- ibnd_iter_node_func_t func,
- void *user_data);
-void ibnd_iter_nodes_type(ibnd_fabric_t *fabric,
- ibnd_iter_node_func_t func,
- int node_type,
- void *user_data);
+MAD_EXPORT void ibnd_iter_nodes(ibnd_fabric_t *fabric,
+ ibnd_iter_node_func_t func,
+ void *user_data);
+MAD_EXPORT void ibnd_iter_nodes_type(ibnd_fabric_t *fabric,
+ ibnd_iter_node_func_t func,
+ int node_type,
+ void *user_data);
/** =========================================================================
* Chassis queries
*/
-uint64_t ibnd_get_chassis_guid(ibnd_fabric_t *fabric, unsigned char chassisnum);
-char *ibnd_get_chassis_type(ibnd_node_t *node);
-char *ibnd_get_chassis_slot_str(ibnd_node_t *node, char *str, size_t size);
-
-int ibnd_is_xsigo_guid(uint64_t guid);
-int ibnd_is_xsigo_tca(uint64_t guid);
-int ibnd_is_xsigo_hca(uint64_t guid);
+MAD_EXPORT uint64_t ibnd_get_chassis_guid(ibnd_fabric_t *fabric,
+ unsigned char chassisnum);
+MAD_EXPORT char *ibnd_get_chassis_type(ibnd_node_t *node);
+MAD_EXPORT char *ibnd_get_chassis_slot_str(ibnd_node_t *node,
+ char *str, size_t size);
+
+MAD_EXPORT int ibnd_is_xsigo_guid(uint64_t guid);
+MAD_EXPORT int ibnd_is_xsigo_tca(uint64_t guid);
+MAD_EXPORT int ibnd_is_xsigo_hca(uint64_t guid);
#endif /* _IBNETDISC_H_ */
diff --git a/infiniband-diags/libibnetdisc/src/chassis.c b/infiniband-diags/libibnetdisc/src/chassis.c
index 6b4930e..dbb0abe 100644
--- a/infiniband-diags/libibnetdisc/src/chassis.c
+++ b/infiniband-diags/libibnetdisc/src/chassis.c
@@ -156,6 +156,8 @@ static int is_xsigo_switch(uint64_t guid)
static uint64_t xsigo_chassisguid(ibnd_node_t *node)
{
uint64_t sysimgguid = mad_get_field64(node->info, 0, IB_NODE_SYSTEM_GUID_F);
+ uint64_t remote_sysimgguid;
+
if (!is_xsigo_ca(sysimgguid)) {
/* Byte 3 is NodeType and byte 4 is PortType */
/* If NodeType is 1 (switch), PortType is masked */
@@ -172,7 +174,7 @@ static uint64_t xsigo_chassisguid(ibnd_node_t *node)
return sysimgguid;
/* If peer port is Leaf 1, use its chassis GUID */
- uint64_t remote_sysimgguid = mad_get_field64(
+ remote_sysimgguid = mad_get_field64(
node->ports[1]->remoteport->node->info,
0, IB_NODE_SYSTEM_GUID_F);
if (is_xsigo_leafone(remote_sysimgguid))
diff --git a/infiniband-diags/libibnetdisc/src/ibnetdisc.c b/infiniband-diags/libibnetdisc/src/ibnetdisc.c
index 479bae7..77a92e0 100644
--- a/infiniband-diags/libibnetdisc/src/ibnetdisc.c
+++ b/infiniband-diags/libibnetdisc/src/ibnetdisc.c
@@ -59,12 +59,13 @@
static int timeout_ms = 2000;
static int show_progress = 0;
+int ibdebug;
void
decode_port_info(ibnd_port_t *port)
{
- port->base_lid = mad_get_field(port->info, 0, IB_PORT_LID_F);
- port->lmc = mad_get_field(port->info, 0, IB_PORT_LMC_F);
+ port->base_lid = (uint16_t) mad_get_field(port->info, 0, IB_PORT_LID_F);
+ port->lmc = (uint8_t) mad_get_field(port->info, 0, IB_PORT_LMC_F);
}
static int
@@ -72,11 +73,12 @@ get_port_info(struct ibnd_fabric *fabric, struct ibnd_port *port,
int portnum, ib_portid_t *portid)
{
char width[64], speed[64];
+ int iwidth;
+ int ispeed;
+
port->port.portnum = portnum;
- int iwidth = mad_get_field(port->port.info, 0,
- IB_PORT_LINK_WIDTH_ACTIVE_F);
- int ispeed = mad_get_field(port->port.info, 0,
- IB_PORT_LINK_SPEED_ACTIVE_F);
+ iwidth = mad_get_field(port->port.info, 0, IB_PORT_LINK_WIDTH_ACTIVE_F);
+ ispeed = mad_get_field(port->port.info, 0, IB_PORT_LINK_SPEED_ACTIVE_F);
if (!smp_query_via(port->port.info, portid, IB_ATTR_PORT_INFO, portnum, timeout_ms,
fabric->ibmad_port))
@@ -150,8 +152,8 @@ query_node(struct ibnd_fabric *fabric, struct ibnd_node *inode,
return -1;
decode_port_info(port);
- port->base_lid = node->smalid; /* LID is still defined by port 0 */
- port->lmc = node->smalmc;
+ port->base_lid = (uint16_t) node->smalid; /* LID is still defined by port 0 */
+ port->lmc = (uint8_t) node->smalmc;
if (!smp_query_via(node->switchinfo, portid, IB_ATTR_SWITCH_INFO, 0, timeout_ms,
fabric->ibmad_port))
diff --git a/infiniband-diags/libibnetdisc/src/libibnetdisc.map b/infiniband-diags/libibnetdisc/src/libibnetdisc.map
index 5e8c315..bd108ab 100644
--- a/infiniband-diags/libibnetdisc/src/libibnetdisc.map
+++ b/infiniband-diags/libibnetdisc/src/libibnetdisc.map
@@ -3,24 +3,16 @@ IBNETDISC_1.0 {
ibnd_debug;
ibnd_show_progress;
ibnd_discover_fabric;
- ibnd_cache_fabric;
- ibnd_read_fabric;
ibnd_destroy_fabric;
ibnd_find_node_guid;
ibnd_update_node;
ibnd_find_node_dr;
- ibnd_linkwidth_str;
- ibnd_linkspeed_str;
- ibnd_node_type_str;
- ibnd_node_type_str_short;
ibnd_is_xsigo_guid;
ibnd_is_xsigo_tca;
ibnd_is_xsigo_hca;
ibnd_get_chassis_guid;
ibnd_get_chassis_type;
ibnd_get_chassis_slot_str;
- ibnd_linkstate_str;
- ibnd_physstate_str;
ibnd_iter_nodes;
ibnd_iter_nodes_type;
local: *;
More information about the general
mailing list