[IPOIB_NDIS6_CM] fix the improper reporting of IPoIB port rate and removes obsolete...
authorstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 13 Jan 2010 18:40:25 +0000 (18:40 +0000)
committerstansmith <stansmith@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 13 Jan 2010 18:40:25 +0000 (18:40 +0000)
signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)

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

ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.cpp
ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.h
ulp/ipoib_NDIS6_CM/kernel/ipoib_driver.cpp
ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp

index 0759973..c18dfee 100644 (file)
@@ -595,7 +595,7 @@ static inline void __ipoib_get_down(
        link_state.MediaConnectState = MediaConnectStateDisconnected;\r
        link_state.MediaDuplexState = MediaDuplexStateFull;\r
        link_state.XmitLinkSpeed = \r
-       link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
+       link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_adapter->port_rate );\r
        link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;\r
 \r
        IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,\r
@@ -741,6 +741,7 @@ __ipoib_pnp_cb(
 \r
                cl_obj_lock( &p_adapter->obj );\r
                old_state = p_adapter->state;\r
+               ASSERT( p_adapter->state != IB_PNP_PORT_REMOVE );\r
                p_adapter->state = IB_PNP_PORT_DOWN;\r
                cl_obj_unlock( &p_adapter->obj );\r
                status = IB_SUCCESS;\r
@@ -770,7 +771,7 @@ __ipoib_pnp_cb(
                                link_state.MediaConnectState = MediaConnectStateDisconnected;\r
                                link_state.MediaDuplexState = MediaDuplexStateFull;\r
                                link_state.XmitLinkSpeed = \r
-                               link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
+                               link_state.RcvLinkSpeed  = SET_PORT_RATE_BPS( p_adapter->port_rate );\r
                                link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;\r
 \r
                                IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,\r
@@ -847,7 +848,7 @@ __ipoib_pnp_cb(
                        link_state.MediaConnectState = MediaConnectStateDisconnected;\r
                        link_state.MediaDuplexState = MediaDuplexStateFull;\r
                        link_state.XmitLinkSpeed = \r
-                       link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
+                       link_state.RcvLinkSpeed  = SET_PORT_RATE_BPS( p_adapter->port_rate );\r
                        link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;\r
 \r
                        IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,\r
@@ -1226,7 +1227,7 @@ ipoib_set_active(
                        link_state.MediaConnectState = MediaConnectStateConnected;\r
                        link_state.MediaDuplexState = MediaDuplexStateFull;\r
                        link_state.XmitLinkSpeed = \r
-                       link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
+                       link_state.RcvLinkSpeed  = SET_PORT_RATE_BPS( p_adapter->port_rate ); \r
                        link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;\r
                        IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,\r
                                                                   p_adapter->h_adapter,\r
@@ -1286,7 +1287,7 @@ ipoib_set_inactive(
                link_state.MediaConnectState = MediaConnectStateDisconnected;\r
                link_state.MediaDuplexState = MediaDuplexStateFull;\r
                link_state.XmitLinkSpeed = \r
-               link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
+               link_state.RcvLinkSpeed  = SET_PORT_RATE_BPS( p_adapter->port_rate ); \r
                link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;\r
 \r
                IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,\r
index c739ea1..c0718e9 100644 (file)
@@ -495,7 +495,9 @@ ipoib_dereg_addrs(
         (_pStatusIndication)->StatusBufferSize = _BufSize;                                 \\r
     }\r
 \r
-// TODO: Set this according to device\r
 #define IPOIB_MEDIA_MAX_SPEED  40000000000\r
 \r
+#define SET_PORT_RATE_BPS(x) (uint64_t(100) * x)\r
+\r
+\r
 #endif /* _IPOIB_ADAPTER_H_ */\r
index 7ec6a5d..fff1d6c 100644 (file)
 PDRIVER_OBJECT                         g_p_drv_obj;\r
 \r
 \r
-#if 0\r
-static const NDIS_OID SUPPORTED_OIDS[] =\r
-{\r
-       OID_GEN_SUPPORTED_LIST,\r
-       OID_GEN_HARDWARE_STATUS,\r
-       OID_GEN_MEDIA_SUPPORTED,\r
-       OID_GEN_MEDIA_IN_USE,\r
-       OID_GEN_MAXIMUM_LOOKAHEAD,\r
-       OID_GEN_MAXIMUM_FRAME_SIZE,\r
-       OID_GEN_LINK_SPEED,\r
-       OID_GEN_TRANSMIT_BUFFER_SPACE,\r
-       OID_GEN_RECEIVE_BUFFER_SPACE,\r
-       OID_GEN_TRANSMIT_BLOCK_SIZE,\r
-       OID_GEN_RECEIVE_BLOCK_SIZE,\r
-       OID_GEN_VENDOR_ID,\r
-       OID_GEN_VENDOR_DESCRIPTION,\r
-       OID_GEN_CURRENT_PACKET_FILTER,\r
-       OID_GEN_CURRENT_LOOKAHEAD,\r
-       OID_GEN_DRIVER_VERSION,\r
-       OID_GEN_MAXIMUM_TOTAL_SIZE,\r
-       OID_GEN_PROTOCOL_OPTIONS,\r
-       OID_GEN_MAC_OPTIONS,\r
-       OID_GEN_MEDIA_CONNECT_STATUS,\r
-       OID_GEN_MAXIMUM_SEND_PACKETS,\r
-       OID_GEN_NETWORK_LAYER_ADDRESSES,\r
-       OID_GEN_VENDOR_DRIVER_VERSION,\r
-       OID_GEN_PHYSICAL_MEDIUM,\r
-       OID_GEN_XMIT_OK,\r
-       OID_GEN_RCV_OK,\r
-       OID_GEN_XMIT_ERROR,\r
-       OID_GEN_RCV_ERROR,\r
-       OID_GEN_RCV_NO_BUFFER,\r
-       OID_GEN_DIRECTED_BYTES_XMIT,\r
-       OID_GEN_DIRECTED_FRAMES_XMIT,\r
-       OID_GEN_MULTICAST_BYTES_XMIT,\r
-       OID_GEN_MULTICAST_FRAMES_XMIT,\r
-       OID_GEN_BROADCAST_BYTES_XMIT,\r
-       OID_GEN_BROADCAST_FRAMES_XMIT,\r
-       OID_GEN_DIRECTED_BYTES_RCV,\r
-       OID_GEN_DIRECTED_FRAMES_RCV,\r
-       OID_GEN_MULTICAST_BYTES_RCV,\r
-       OID_GEN_MULTICAST_FRAMES_RCV,\r
-       OID_GEN_BROADCAST_BYTES_RCV,\r
-       OID_GEN_BROADCAST_FRAMES_RCV,\r
-       OID_802_3_PERMANENT_ADDRESS,\r
-       OID_802_3_CURRENT_ADDRESS,\r
-       OID_802_3_MULTICAST_LIST,\r
-       OID_802_3_MAXIMUM_LIST_SIZE,\r
-       OID_802_3_MAC_OPTIONS,\r
-       OID_802_3_RCV_ERROR_ALIGNMENT,\r
-       OID_802_3_XMIT_ONE_COLLISION,\r
-       OID_802_3_XMIT_MORE_COLLISIONS,\r
-       OID_TCP_TASK_OFFLOAD\r
-};\r
-#endif\r
-\r
-NDIS_OID NICSupportedOidsTest[] =\r
-{\r
-    OID_GEN_SUPPORTED_LIST,\r
-    OID_GEN_HARDWARE_STATUS,\r
-    OID_GEN_MEDIA_SUPPORTED,\r
-    OID_GEN_MEDIA_IN_USE,\r
-    OID_GEN_MAXIMUM_LOOKAHEAD,\r
-    OID_GEN_MAXIMUM_FRAME_SIZE,\r
-    OID_GEN_TRANSMIT_BUFFER_SPACE,\r
-    OID_GEN_RECEIVE_BUFFER_SPACE,\r
-    OID_GEN_TRANSMIT_BLOCK_SIZE,\r
-    OID_GEN_RECEIVE_BLOCK_SIZE,\r
-    OID_GEN_VENDOR_ID,\r
-    OID_GEN_VENDOR_DESCRIPTION,\r
-    OID_GEN_VENDOR_DRIVER_VERSION,\r
-    OID_GEN_CURRENT_PACKET_FILTER,\r
-    OID_GEN_CURRENT_LOOKAHEAD,\r
-    OID_GEN_DRIVER_VERSION,\r
-    OID_GEN_MAXIMUM_TOTAL_SIZE,\r
-    OID_GEN_MAC_OPTIONS,\r
-    OID_GEN_MAXIMUM_SEND_PACKETS,\r
-    OID_GEN_XMIT_OK,\r
-    OID_GEN_RCV_OK,\r
-    OID_GEN_XMIT_ERROR,\r
-    OID_GEN_RCV_ERROR,\r
-    OID_GEN_RCV_NO_BUFFER,\r
-    OID_GEN_RCV_CRC_ERROR,\r
-    OID_GEN_TRANSMIT_QUEUE_LENGTH,\r
-    OID_802_3_PERMANENT_ADDRESS,\r
-    OID_802_3_CURRENT_ADDRESS,\r
-    OID_802_3_MULTICAST_LIST,\r
-    OID_802_3_MAXIMUM_LIST_SIZE,\r
-    OID_802_3_RCV_ERROR_ALIGNMENT,\r
-    OID_802_3_XMIT_ONE_COLLISION,\r
-    OID_802_3_XMIT_MORE_COLLISIONS,\r
-    OID_802_3_XMIT_DEFERRED,\r
-    OID_802_3_XMIT_MAX_COLLISIONS,\r
-    OID_802_3_RCV_OVERRUN,\r
-    OID_802_3_XMIT_UNDERRUN,\r
-    OID_802_3_XMIT_HEARTBEAT_FAILURE,\r
-    OID_802_3_XMIT_TIMES_CRS_LOST,\r
-    OID_802_3_XMIT_LATE_COLLISIONS,\r
-\r
-#if !BUILD_W2K\r
-    OID_GEN_PHYSICAL_MEDIUM,\r
-#endif\r
-\r
-    OID_TCP_TASK_OFFLOAD,\r
-    \r
-/* powermanagement */\r
-\r
-    OID_PNP_CAPABILITIES,\r
-    OID_PNP_SET_POWER,\r
-    OID_PNP_QUERY_POWER,\r
-    OID_PNP_ADD_WAKE_UP_PATTERN,\r
-    OID_PNP_REMOVE_WAKE_UP_PATTERN,\r
-    OID_PNP_ENABLE_WAKE_UP,\r
-\r
-\r
-/* custom oid WMI support */\r
-//    OID_CUSTOM_PERF_COUNTERS,\r
- //   OID_CUSTOM_STRING,\r
 \r
-    OID_GEN_RECEIVE_SCALE_CAPABILITIES,\r
-    OID_GEN_RECEIVE_SCALE_PARAMETERS,\r
-\r
-//\r
-// new and required for NDIS 6 miniports\r
-//\r
-    OID_GEN_LINK_PARAMETERS,\r
-    OID_GEN_INTERRUPT_MODERATION,\r
-    OID_GEN_STATISTICS,\r
-\r
-/* Offload */\r
-    OID_TCP_OFFLOAD_CURRENT_CONFIG,\r
-    OID_TCP_OFFLOAD_PARAMETERS,\r
-    OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES,\r
-    OID_OFFLOAD_ENCAPSULATION,\r
-\r
-/* Header - Data seperation */\r
-   // OID_GEN_HD_SPLIT_PARAMETERS,\r
- //   OID_GEN_HD_SPLIT_CURRENT_CONFIG,\r
-    \r
-/* VLAN */\r
-  //  OID_ADD_VALN_ID,\r
- //   OID_DELETE_VLAN_ID,\r
-\r
-/* Set MAC */\r
-  //  OID_SET_MAC_ADDRESS\r
-\r
-};\r
 \r
 static const NDIS_OID SUPPORTED_OIDS[] =\r
 {\r
@@ -1167,11 +1021,11 @@ SetGenericAttributes(
        gat.Header.Revision = NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_1;\r
        gat.Header.Size = sizeof(NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES);\r
 \r
-       gat.MediaType = NdisMedium802_3;    \r
-       gat.MaxXmitLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
-       gat.MaxRcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
-       gat.XmitLinkSpeed = IPOIB_MEDIA_MAX_SPEED; //TODO NDIS60 NDIS_LINK_SPEED_UNKNOWN\r
-       gat.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED; // TODO NDIS60 NDIS_LINK_SPEED_UNKNOWN ???\r
+       gat.MediaType =                 NdisMedium802_3;    \r
+       gat.MaxXmitLinkSpeed =  IPOIB_MEDIA_MAX_SPEED;\r
+       gat.MaxRcvLinkSpeed =   IPOIB_MEDIA_MAX_SPEED;\r
+       gat.XmitLinkSpeed =             NDIS_LINK_SPEED_UNKNOWN;\r
+       gat.RcvLinkSpeed =      NDIS_LINK_SPEED_UNKNOWN;\r
 \r
        gat.MediaConnectState = MediaConnectStateConnected; //TODO NDIS60 Check the current state\r
        gat.MediaDuplexState = MediaDuplexStateFull;\r
@@ -2344,44 +2198,6 @@ ipoib_query_info(
                        }\r
                        break;\r
        \r
-               case OID_GEN_LINK_SPEED:\r
-                       IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,\r
-                               ("Port %d received query for OID_GEN_LINK_SPEED\n", port_num) );\r
-                       if (oid_info.buf_len < buf_len)\r
-                       {\r
-                               break;\r
-                       }\r
-       \r
-                       cl_obj_lock( &p_adapter->obj );\r
-                       switch( p_adapter->state )\r
-                       {\r
-                       case IB_PNP_PORT_ADD:\r
-                               /* Mark the adapter as pending an OID */\r
-                               p_adapter->pending_query = TRUE;\r
-       \r
-                               /* Save the request parameters. */\r
-                               p_adapter->query_oid = oid_info;\r
-                               p_adapter->query_oid.p_pending_oid = pNdisRequest;\r
-       \r
-                               IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,\r
-                                       ("Port %d returning NDIS_STATUS_PENDING\n", port_num) );\r
-                               status = NDIS_STATUS_PENDING;\r
-                               break;\r
-       \r
-                       case IB_PNP_PORT_REMOVE:\r
-                               IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,\r
-                                       ("Port %d returning NDIS_STATUS_NOT_ACCEPTED\n", port_num) );\r
-                               status = NDIS_STATUS_NOT_ACCEPTED;\r
-                               break;\r
-       \r
-                       default:\r
-                               CL_ASSERT( p_adapter->p_port );\r
-                               info = p_adapter->port_rate;\r
-                               break;\r
-                       }\r
-                       cl_obj_unlock( &p_adapter->obj );\r
-                       break;\r
-       \r
                case OID_GEN_TRANSMIT_BUFFER_SPACE:\r
                        IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,\r
                                ("Port %d received query for OID_GEN_TRANSMIT_BUFFER_SPACE\n", port_num) );\r
index 2bff845..df8d9bf 100644 (file)
@@ -6006,7 +6006,8 @@ __endpt_mgr_reset_all(
                        link_state.Header.Size = sizeof(NDIS_LINK_STATE);\r
                        link_state.MediaConnectState = MediaConnectStateDisconnected;\r
                        link_state.MediaDuplexState = MediaDuplexStateFull;\r
-                       link_state.XmitLinkSpeed = link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;\r
+                       link_state.XmitLinkSpeed =\r
+                       link_state.RcvLinkSpeed  = link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_port->p_adapter->port_rate );\r
 \r
                        IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,\r
                                                                p_port->p_adapter->h_adapter,\r