[IPoIB] Add support for event logging
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 19 Dec 2005 19:30:43 +0000 (19:30 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Mon, 19 Dec 2005 19:30:43 +0000 (19:30 +0000)
Signed-off-by: Yossi Leybovich (sleybo@mellanox.co.il)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@212 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/ipoib/kernel/SOURCES
ulp/ipoib/kernel/ipoib.rc
ulp/ipoib/kernel/ipoib_adapter.c
ulp/ipoib/kernel/ipoib_adapter.h
ulp/ipoib/kernel/ipoib_driver.c
ulp/ipoib/kernel/ipoib_driver.h
ulp/ipoib/kernel/ipoib_log.mc [new file with mode: 0644]
ulp/ipoib/kernel/ipoib_port.c
ulp/ipoib/kernel/netipoib.inf

index dda2142..75f58a5 100644 (file)
@@ -2,7 +2,8 @@ TARGETNAME=ipoib
 TARGETPATH=..\..\..\bin\kernel\obj$(BUILD_ALT_DIR)\r
 TARGETTYPE=DRIVER\r
 \r
-SOURCES= ipoib.rc \\r
+SOURCES=       ipoib_log.mc \\r
+               ipoib.rc \\r
                ipoib_driver.c \\r
                ipoib_adapter.c \\r
                ipoib_endpoint.c \\r
index 9d04836..525372f 100644 (file)
@@ -45,3 +45,4 @@
 #define VER_ORIGINALFILENAME_STR       "ipoib.sys"\r
 \r
 #include <common.ver>\r
+#include "ipoib_log.rc"\r
index ca07bcc..47a4ad3 100644 (file)
@@ -806,35 +806,65 @@ __ipoib_pnp_dereg(
 void\r
 ipoib_set_rate(\r
        IN                              ipoib_adapter_t* const          p_adapter,\r
-       IN              const   uint8_t                                         link_width )\r
+       IN              const   uint8_t                                         link_width, \r
+       IN              const   uint8_t                                         link_speed )\r
 {\r
        IPOIB_ENTER( IPOIB_DBG_INIT );\r
 \r
        cl_obj_lock( &p_adapter->obj );\r
        /* Set the link speed based on the IB link speed (1x vs 4x, etc). */\r
+       switch( link_speed )\r
+       {\r
+       case IB_LINK_SPEED_ACTIVE_2_5:\r
+               IPOIB_TRACE( IPOIB_DBG_INIT | IPOIB_DBG_INFO,\r
+                       ("Link speed is 2.5Gs\n") );\r
+               p_adapter->rate = IB_LINK_SPEED_ACTIVE_2_5;\r
+               break;\r
+\r
+       case IB_LINK_SPEED_ACTIVE_5:\r
+               IPOIB_TRACE( IPOIB_DBG_INIT | IPOIB_DBG_INFO,\r
+                       ("Link speed is 5G\n") );\r
+               p_adapter->rate = IB_LINK_SPEED_ACTIVE_5;\r
+               break;\r
+\r
+       case IB_LINK_SPEED_ACTIVE_10:\r
+               IPOIB_TRACE( IPOIB_DBG_INIT | IPOIB_DBG_INFO,\r
+                       ("Link speed is 10G\n") );\r
+               p_adapter->rate = IB_LINK_SPEED_ACTIVE_10;\r
+               break;\r
+\r
+       default:\r
+               IPOIB_TRACE( IPOIB_DBG_ERROR,\r
+                       ("Invalid link speed %d.\n", link_speed) );\r
+               p_adapter->rate = 0;\r
+       }\r
+\r
        switch( link_width )\r
        {\r
        case IB_LINK_WIDTH_ACTIVE_1X:\r
-               IPOIB_TRACE( IPOIB_DBG_INFO, ("Link speed is 2.5Gbps\n") );\r
-               p_adapter->rate = ONE_X_IN_100BPS;\r
+               IPOIB_TRACE( IPOIB_DBG_INIT | IPOIB_DBG_INFO,\r
+                       ("Link width is 1X\n") );\r
+               p_adapter->rate *= ONE_X_IN_100BPS;\r
                break;\r
 \r
        case IB_LINK_WIDTH_ACTIVE_4X:\r
-               IPOIB_TRACE( IPOIB_DBG_INFO, ("Link speed is 10Gbps\n") );\r
-               p_adapter->rate = FOUR_X_IN_100BPS;\r
+               IPOIB_TRACE( IPOIB_DBG_INIT | IPOIB_DBG_INFO,\r
+                       ("Link width is 4X\n") );\r
+               p_adapter->rate *= FOUR_X_IN_100BPS;\r
                break;\r
 \r
        case IB_LINK_WIDTH_ACTIVE_12X:\r
-               IPOIB_TRACE( IPOIB_DBG_INFO, ("Link speed is 30Gbps\n") );\r
-               p_adapter->rate = TWELVE_X_IN_100BPS;\r
+               IPOIB_TRACE( IPOIB_DBG_INIT | IPOIB_DBG_INFO,\r
+                       ("Link width is 12X\n") );\r
+               p_adapter->rate *= TWELVE_X_IN_100BPS;\r
                break;\r
 \r
        default:\r
-               IPOIB_TRACE( IPOIB_DBG_INFO, ("Invalid rate.\n") );\r
+               IPOIB_TRACE( IPOIB_DBG_ERROR,\r
+                       ("Invalid link rate (%d).\n", link_width) );\r
                p_adapter->rate = 0;\r
        }\r
        cl_obj_unlock( &p_adapter->obj );\r
-\r
        IPOIB_EXIT( IPOIB_DBG_INIT );\r
 }\r
 \r
@@ -875,14 +905,22 @@ ipoib_set_active(
                /* Join all programmed multicast groups. */\r
                for( i = 0; i < p_adapter->mcast_array_size; i++ )\r
                {\r
-                       ipoib_port_join_mcast( p_adapter->p_port, p_adapter->mcast_array[i] );\r
+                       ipoib_port_join_mcast(\r
+                               p_adapter->p_port, p_adapter->mcast_array[i] );\r
                }\r
 \r
                /* Register all existing addresses. */\r
                ipoib_reg_addrs( p_adapter );\r
 \r
-               /* Now that we're in the broadcast group, notify that we have a link. */\r
+               /*\r
+                * Now that we're in the broadcast group, notify that\r
+                * we have a link.\r
+                */\r
                IPOIB_TRACE( IPOIB_DBG_INFO, ("Link UP!\n") );\r
+               NdisWriteErrorLogEntry( p_adapter->h_adapter,\r
+                       EVENT_IPOIB_PORT_UP + (p_adapter->rate/ONE_X_IN_100BPS),\r
+                       1, p_adapter->rate );\r
+       \r
                NdisMIndicateStatus( p_adapter->h_adapter, NDIS_STATUS_MEDIA_CONNECT,\r
                        NULL, 0 );\r
                NdisMIndicateStatusComplete( p_adapter->h_adapter );\r
index 8e63fe3..3a1849a 100644 (file)
@@ -383,7 +383,8 @@ ipoib_inc_send_stat(
 void\r
 ipoib_set_rate(\r
        IN                              ipoib_adapter_t* const          p_adapter,\r
-       IN              const   uint8_t                                         rate );\r
+       IN              const   uint8_t                                         link_width,\r
+       IN              const   uint8_t                                         link_speed );\r
 \r
 \r
 void\r
index 2cf6367..e87dc71 100644 (file)
@@ -634,6 +634,8 @@ ipoib_initialize(
        ib_status = ipoib_start_adapter( p_adapter );\r
        if( ib_status != IB_SUCCESS )\r
        {\r
+               NdisWriteErrorLogEntry( h_adapter,\r
+                       NDIS_ERROR_CODE_HARDWARE_FAILURE, 0 );\r
                ipoib_destroy_adapter( p_adapter );\r
                IPOIB_TRACE_EXIT( IPOIB_DBG_ERROR,\r
                        ("ipoib_start_adapter returned status %d.\n", ib_status ) );\r
index 0d42d59..a3bb2cf 100644 (file)
@@ -34,6 +34,7 @@
 #define _IPOIB_DRIVER_H_\r
 \r
 \r
+#include "ipoib_log.h"\r
 #include "ipoib_adapter.h"\r
 #include <complib/cl_spinlock.h>\r
 #include <complib/cl_qlist.h>\r
diff --git a/ulp/ipoib/kernel/ipoib_log.mc b/ulp/ipoib/kernel/ipoib_log.mc
new file mode 100644 (file)
index 0000000..7f7c8a8
--- /dev/null
@@ -0,0 +1,130 @@
+;/*++\r
+;=============================================================================\r
+;Copyright (c) 2001 Mellanox Technologies\r
+;\r
+;Module Name:\r
+;\r
+;    ipoiblog.mc\r
+;\r
+;Abstract:\r
+;\r
+;    IPoIB Driver event log messages\r
+;\r
+;Authors:\r
+;\r
+;    Yossi Leybovich\r
+;\r
+;Environment:\r
+;\r
+;   Kernel Mode .\r
+;\r
+;=============================================================================\r
+;--*/\r
+;\r
+MessageIdTypedef = NDIS_ERROR_CODE\r
+\r
+SeverityNames = (\r
+       Success                 = 0x0:STATUS_SEVERITY_SUCCESS\r
+       Informational   = 0x1:STATUS_SEVERITY_INFORMATIONAL\r
+       Warning                 = 0x2:STATUS_SEVERITY_WARNING\r
+       Error                   = 0x3:STATUS_SEVERITY_ERROR\r
+       )\r
+\r
+FacilityNames = (\r
+       System                  = 0x0\r
+       RpcRuntime              = 0x2:FACILITY_RPC_RUNTIME\r
+       RpcStubs                = 0x3:FACILITY_RPC_STUBS\r
+       Io                              = 0x4:FACILITY_IO_ERROR_CODE\r
+       IPoIB                   = 0x7:FACILITY_IPOIB_ERROR_CODE\r
+       )\r
+\r
+\r
+MessageId=0x0001\r
+Facility=IPoIB\r
+Severity=Warning\r
+SymbolicName=EVENT_IPOIB_PORT_DOWN\r
+Language=English\r
+%2: Network controller link is down.\r
+.\r
+\r
+MessageId=0x0002\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP\r
+Language=English\r
+%2: Network controller link is up.\r
+.\r
+\r
+\r
+MessageId=0x0003\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP1\r
+Language=English\r
+%2: Network controller link is up at 2.5Gbps.\r
+.\r
+\r
+MessageId=0x0004\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP2\r
+Language=English\r
+%2: Network controller link is up at 5Gbps.\r
+.\r
+\r
+MessageId=0x0006\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP3\r
+Language=English\r
+%2: Network controller link is up at 10Gbps.\r
+.\r
+\r
+MessageId=0x000a\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP4\r
+Language=English\r
+%2: Network controller link is up at 20Gps.\r
+.\r
+\r
+MessageId=0x000e\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP5\r
+Language=English\r
+%2: Network controller link is up at 30Gps.\r
+.\r
+\r
+MessageId=0x0012\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP6\r
+Language=English\r
+%2: Network controller link is up at 40Gps.\r
+.\r
+\r
+MessageId=0x001a\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP7\r
+Language=English\r
+%2: Network controller link is up at 60Gps.\r
+.\r
+\r
+MessageId=0x0032\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_PORT_UP8\r
+Language=English\r
+%2: Network controller link is up at 120Gps.\r
+.\r
+\r
+MessageId=0x0040\r
+Facility=IPoIB\r
+Severity=Informational\r
+SymbolicName=EVENT_IPOIB_INIT_SUCCESS\r
+Language=English\r
+%2: Driver Initialized succesfully.\r
+.\r
+\r
index 62abcea..756cc9a 100644 (file)
@@ -4435,8 +4435,11 @@ __port_info_cb(
                        IPOIB_TRACE( IPOIB_DBG_INFO,\r
                                ("Received port info: link width = %d.\n",\r
                                p_port_rec->port_info.link_width_active) );\r
+\r
                        ipoib_set_rate( p_port->p_adapter,\r
-                               p_port_rec->port_info.link_width_active );\r
+                               p_port_rec->port_info.link_width_active,\r
+                               ib_port_info_get_link_speed_active( &p_port_rec->port_info ) );\r
+\r
                        __port_get_mcast( p_port );\r
                }\r
                else\r
@@ -4725,6 +4728,9 @@ ipoib_port_down(
        cl_obj_lock( &p_port->obj );\r
        p_port->state = IB_QPS_ERROR;\r
 \r
+       NdisWriteErrorLogEntry( p_port->p_adapter->h_adapter,\r
+               EVENT_IPOIB_PORT_DOWN, 0);\r
+\r
        if( p_port->ib_mgr.h_query )\r
        {\r
                p_port->p_adapter->p_ifc->cancel_query( p_port->p_adapter->h_al, p_port->ib_mgr.h_query );\r
index 1d15fd1..b0053e8 100644 (file)
@@ -141,7 +141,7 @@ HKR,"Parameters","DebugFlags",%REG_DWORD_NO_CLOBBER%,0x80000000
 AddReg = IpoibAddEventLogReg\r
 \r
 [IpoibAddEventLogReg]\r
-HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll"\r
+HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll";"%%SystemRoot%%\System32\drivers\ipoib.sys"\r
 HKR, , TypesSupported,   0x00010001, 7\r
 \r
 \r