[openib-general] Re: [PATCH] ibdm nits and a few questions

Bernhard Fischer rep.nop at aon.at
Thu Jul 7 06:59:52 PDT 2005


On Thu, Jul 07, 2005 at 10:15:15AM +0300, Eitan Zahavi wrote:
>Hi Ber,
>
>Thanks for the patch and the word list. I will apply these right away.

massage -> message
randesvous -> rendezvous
menager -> manager
contant -> content
accoumulate -> accumulate
somthing -> something
Constractor -> Constructor
naem -> name

>
>> 
>> What about removing all the generated scripts (configure et al) and
>> auto-tools helpers (aclocal.m4 etc and most of config/*) from the
>> repository?
>[EZ] I thought I have done that. I will double check.

In both ibdm,IBMgtSim there is a configure config/share
config/libtoolize.
ibdm/config/depcomp libtool.m4 install-sh are (or should be) all
generated.
>
>> Note that the other userspace IB libraries do not have these in the
>> repository but each do provide a toplevel ./autogen.sh -- as opposed
>> to ibdm's ./config/bootstrap.
>[EZ] We can rename the bootstrap autogen.sh but from what I learned about
>auto tools many use ./config/bootstrap ...
>Is it really annoying?

It's not consistent, but i don't really care either way.

>> There are a number of other unused variables.
>[EZ] We should fix all of those! 

IBMgtSim/src/sim.cpp does not compile for me. I tried gcc-3.x as well as
4.x to no avail. Ideas?
sim.cpp:201: error: expected `}' at end of input

>> Is ibdm supposed to be compilable with pure ISO c++ compilers, btw?
>> There is at least one place which uses a variable sized array which AFAIK
>> is not valid ISO c++.
>[EZ] I'm not sure what the answer to that is.

I guess it's a question of policy. If gcc can deal with it, it's fine
with me, fwiw.


o IBMSClientInMsgs::proccessClientMsg() strip clientSock which from a
  short glance seems to be unused.

Attached patch does:
in ibmgtsim
- turn ibms_disconnect() and ibms_disconnect()) into a void functions
- add static in few places
- opensm off gen2 doesn't seem to have osm_build_id.h so check for
  osm_base.h instead
- correct offset in configure.in's --enable-debug help text

Signed-off-by: Bernhard Fischer <rep.nop at aon.at>

Please review the patch and advise on the sim.cpp compile failure i get
with pristine sources.
TIA,
Bernhard

-------------- next part --------------
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/config/osm.m4 gen2.2810/utils/src/linux-user/IBMgtSim/config/osm.m4
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/config/osm.m4	2005-03-24 17:56:41.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/config/osm.m4	2005-07-06 17:40:30.000000000 +0200
@@ -35,14 +35,14 @@ if test "x$with_osm" = xnone; then 
 fi
 
 dnl validate the defined path
-AC_CHECK_FILE($with_osm/include/opensm/osm_build_id.h,,
-   AC_MSG_ERROR([ could not find $with_osm/include/opensm/osm_build_id.h]))
+AC_CHECK_FILE($with_osm/include/infiniband/opensm/osm_base.h,,
+   AC_MSG_ERROR([ could not find $with_osm/include/infiniband/opensm/osm_base.h]))
 
 AC_SUBST(with_osm)
 
 dnl now figure out somehow if the build was for debug or not
 dnl the header file should have the string debug if OpenSM is debug mode:
-if test `grep debug $with_osm/include/opensm/osm_build_id.h | wc -l` = 1; then
+if test "$debug" != "false"; then
    dnl why did they need so many ???
    OSM_DEBUG_FLAGS='-DDEBUG -D_DEBUG -D_DEBUG_ -DDBG'
    AC_MSG_NOTICE(OSM compiled in DEBUG mode)
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/configure.in gen2.2810/utils/src/linux-user/IBMgtSim/configure.in
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/configure.in	2005-03-24 17:56:44.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/configure.in	2005-07-06 17:39:30.000000000 +0200
@@ -68,7 +68,7 @@ AC_CHECK_FUNCS([strchr strstr strtol str
 
 dnl Define an input config option to control debug compile
 AC_ARG_ENABLE(debug,
-[  --enable-debug    Turn on debugging],
+[  --enable-debug          Turn on debugging],
 [case "${enableval}" in
   yes) debug=true ;;
   no)  debug=false ;;
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/client.cpp gen2.2810/utils/src/linux-user/IBMgtSim/src/client.cpp
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/client.cpp	2005-03-24 17:55:58.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/client.cpp	2005-07-07 14:18:38.000000000 +0200
@@ -302,7 +302,7 @@ ibms_send(
 }
 
 /* disconnect from the simulator */
-int
+void
 ibms_disconnect(
   ibms_conn_handle_t conHdl)
 {
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/ibms_client_api.h gen2.2810/utils/src/linux-user/IBMgtSim/src/ibms_client_api.h
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/ibms_client_api.h	2005-03-24 17:55:59.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/ibms_client_api.h	2005-07-07 14:18:46.000000000 +0200
@@ -114,7 +114,7 @@ int 
 ibms_send(ibms_conn_handle_t conHdl, ibms_mad_msg_t *pMadMsg);
 
 /* disconnect from the simulator */
-int
+void
 ibms_disconnect(ibms_conn_handle_t conHdl);
 
 #ifdef __cplusplus
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/Makefile.am gen2.2810/utils/src/linux-user/IBMgtSim/src/Makefile.am
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/Makefile.am	2005-03-24 17:55:59.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/Makefile.am	2005-07-07 15:35:34.734297717 +0200
@@ -43,7 +43,7 @@ endif
 
 AM_CXXFLAGS = $(DBG)
 
-INCLUDES		= -I$(with_ibdm)/include -I$(with_osm)/include $(TCL_CPPFLAGS)
+INCLUDES= -I$(with_ibdm)/include -I$(with_osm)/include/infiniband -I$(with_osm) $(TCL_CPPFLAGS)
 
 AM_CPPFLAGS = -I$(top_srcdir)/datamodel $(OSM_DEBUG_FLAGS)
 
@@ -63,7 +63,7 @@ ibmssh_SOURCES = sim.cpp server.cpp node
 ibmssh_LDFLAGS = -static -Wl,-rpath -Wl,$(TCL_PREFIX)/lib \
 	-Wl,-rpath -Wl,$(with_osm)/lib \
 	-Wl,-rpath -Wl,$(with_ibdm)/lib 
-
+ibmssh_CXXCPPFLAGS = #-DBUILD_STANDALONE_SIM
 ibmssh_LDADD = -libmscli -L$(with_ibdm)/lib -libdmcom -L$(with_osm)/lib -lcomplib $(TCL_LIBS) 
 
 # SWIG FILES:
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/msgmgr.cpp gen2.2810/utils/src/linux-user/IBMgtSim/src/msgmgr.cpp
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/msgmgr.cpp	2005-03-24 17:55:59.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/msgmgr.cpp	2005-07-07 15:13:26.723783641 +0200
@@ -309,7 +309,7 @@ msgManager &msgMgr(int vl, std::ostream 
   }
   
   return (*pMgr);
-};
+}
 
 // we provide two global definitions for entering and leaving functions:
 int msgMgrEnterFunc = msgMgr().reg('R',"$ [", "top", "msg");
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/node.h gen2.2810/utils/src/linux-user/IBMgtSim/src/node.h
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/node.h	2005-07-06 11:52:53.000000000 +0200
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/node.h	2005-07-07 13:31:16.000000000 +0200
@@ -64,11 +64,11 @@ typedef std::list< uint16_t > list_uint1
 
 inline class IBMSNode * ibmsGetIBNodeSimNode(IBNode *pIBNode) {
   return ((IBMSNode *)pIBNode->appData1.ptr);
-};
+}
 
 inline void ibmsSetIBNodeSimNode(IBNode *pIBNode, class IBMSNode *pSimNode) {
   pIBNode->appData1.ptr = pSimNode;
-};
+}
 
 /* This class holds the variables defining statistical behaviour of the
    port counters */
@@ -227,7 +227,7 @@ class IBMSNode {
     remNode - to the Sim Node of the other side 
     remIBPort - to the remote side IB Fabric Port object on the other side.
   */
-  int IBMSNode::getRemoteNodeByOutPort(
+  int getRemoteNodeByOutPort(
     uint8_t outPortNum,
     IBMSNode **ppRemNode,
     IBPort **ppRemIBPort, int isVl15 = 0);
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/sim.cpp gen2.2810/utils/src/linux-user/IBMgtSim/src/sim.cpp
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/sim.cpp	2005-03-24 17:55:59.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/sim.cpp	2005-07-07 15:36:19.307584427 +0200
@@ -35,9 +35,10 @@
 #include "sim.h"
 #include "msgmgr.h"
 #include "sma.h"
+extern "C" {
 #include <getopt.h>
 #include <inttypes.h>
-
+}
 //////////////////////////////////////////////////////////////
 //
 // CLASS  IBMgtSim
@@ -142,7 +143,7 @@ IBMgtSim::populateFabricNodes()
     ibmsSetIBNodeSimNode(pNode, pSimNode);
 
     // TODO use a list of mgtclass instead
-    IBMSSma *pSma = new IBMSSma(pSimNode, 0x81);
+    IBMSSma *pSma = new IBMSSma(pSimNode, 0x81); //unused?
   }
   
   return 0;
@@ -185,19 +186,21 @@ int IBMgtSim::init(string topoFileName, 
   return 0;
 }
 
+#ifdef BUILD_STANDALONE_SIM
 //////////////////////////////////////////////////////////////
 //
-static char IBMgtSimUsage[] = 
-"Usage: ibmgtsim [-vh] -t <topology file> [-p <server port>][-w <num workers>]";
 
-void
-show_usage() {
+static void
+show_usage(void) {
+ string IBMgtSimUsage = 
+"Usage: ibmgtsim [-vh] -t <topology file> [-p <server port>][-w <num workers>]";
   cout << IBMgtSimUsage << endl;
 }
 
-void 
-show_help() {
-  cout << "HELP" << endl;
+static void
+show_help(void) {
+  string IBMgtSimHelp = "Descriptive HELP text";
+  cout << IBMgtSimHelp << endl;
 }
 
 //////////////////////////////////////////////////////////////
@@ -205,7 +208,6 @@ show_help() {
 // MAIN
 //
 
-#ifdef BUILD_STANDALONE_SIM
 int main(int argc, char **argv) 
 {
   /*
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/simmsg.cpp gen2.2810/utils/src/linux-user/IBMgtSim/src/simmsg.cpp
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/simmsg.cpp	2005-03-24 17:55:58.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/simmsg.cpp	2005-07-07 15:09:04.683521475 +0200
@@ -41,9 +41,9 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string>
-#include "simmsg.h"
+#include "helper.h"
 
-std::string
+static std::string
 __ibms_dump_conn_msg(
   IN const ibms_client_msg_t *p_msg) 
 {
@@ -62,7 +62,7 @@ __ibms_dump_conn_msg(
   return msg;
 }
 
-std::string
+static std::string
 __ibms_dump_disconn_msg(
   IN const ibms_client_msg_t *p_msg) 
 {
@@ -79,16 +79,18 @@ __ibms_dump_disconn_msg(
   return msg;
 }
 
-std::string
+static std::string
 __ibms_dump_cap_msg(
   IN const ibms_client_msg_t *p_msg)
 {
   char msg[512];
-  sprintf(msg, "MSG: CAP");
+  sprintf(msg, "MSG: CAP %08x MASK %08x",
+	  p_msg->msg.cap.capabilities,
+	  p_msg->msg.cap.mask);
   return msg;
 }
 
-std::string
+static std::string
 __ibms_dump_bind_msg(
   IN const ibms_client_msg_t *p_msg)
 {
@@ -112,7 +114,7 @@ __ibms_dump_bind_msg(
   return msg;
 }
 
-std::string
+static std::string
 __ibms_dump_mad_msg(
   IN const ibms_client_msg_t *p_msg)
 {
@@ -198,7 +200,7 @@ ibms_get_mad_header_str(ib_mad_t madHead
             CL_NTOH16(madHeader.attr_id),
             CL_NTOH32(madHeader.attr_mod));
     return (std::string)msg;
-};
+}
 
 std::string 
 ibms_get_node_info_str(ib_node_info_t*     pNodeInfo)
@@ -236,7 +238,7 @@ ibms_get_port_info_str(ib_port_info_t*  
             ib_port_info_get_neighbor_mtu(pPortInfo),
             ib_port_info_get_vl_cap(pPortInfo));
     return (std::string)msg;
-};
+}
 
 void 
 ibms_dump_msg(
diff -X excl -rduNp gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/tcpcomm.h gen2.2810/utils/src/linux-user/IBMgtSim/src/tcpcomm.h
--- gen2.2810.oorig/utils/src/linux-user/IBMgtSim/src/tcpcomm.h	2005-03-24 17:55:58.000000000 +0100
+++ gen2.2810/utils/src/linux-user/IBMgtSim/src/tcpcomm.h	2005-07-07 13:44:14.000000000 +0200
@@ -119,7 +119,7 @@ class GenServer {
     int &resLen, char *(pResponse[]) );
 
   /* virtual function called when a client is closed - under a lock */
-  virtual int closingClient(int clientSock) {};
+  virtual int closingClient(int clientSock);
 };
 
 /* 


More information about the general mailing list