[ofw] [Patch] [IPoIB_NDIS6_CM] Fixing port rate reporting mechanism
Alex Naslednikov
xalex at mellanox.co.il
Mon Jan 11 02:35:37 PST 2010
This patch fixes the improper reporting of IPoIB port rate and removes
obsolete OID_GEN_LINK_SPEED
signed-off by: Alexander Naslednikov (xalex at mellanox.co.il)
Index: D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.cpp
===================================================================
--- D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.cpp (revision 5450)
+++ D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.cpp (revision 5451)
@@ -52,6 +52,8 @@
#define TWELVE_X_IN_100BPS 300000000
+
+
/* Declarations */
static void
adapter_construct(
@@ -596,7 +598,7 @@
link_state.MediaConnectState = MediaConnectStateDisconnected;
link_state.MediaDuplexState = MediaDuplexStateFull;
link_state.XmitLinkSpeed =
- link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_adapter->port_rate );
link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;
IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,
@@ -742,6 +744,7 @@
cl_obj_lock( &p_adapter->obj );
old_state = p_adapter->state;
+ ASSERT( p_adapter->state != IB_PNP_PORT_REMOVE );
p_adapter->state = IB_PNP_PORT_DOWN;
cl_obj_unlock( &p_adapter->obj );
status = IB_SUCCESS;
@@ -771,7 +774,7 @@
link_state.MediaConnectState = MediaConnectStateDisconnected;
link_state.MediaDuplexState = MediaDuplexStateFull;
link_state.XmitLinkSpeed =
- link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_adapter->port_rate );
link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;
IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,
@@ -848,7 +851,7 @@
link_state.MediaConnectState = MediaConnectStateDisconnected;
link_state.MediaDuplexState = MediaDuplexStateFull;
link_state.XmitLinkSpeed =
- link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_adapter->port_rate );
link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;
IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,
@@ -1227,7 +1230,7 @@
link_state.MediaConnectState = MediaConnectStateConnected;
link_state.MediaDuplexState = MediaDuplexStateFull;
link_state.XmitLinkSpeed =
- link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_adapter->port_rate );
link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;
IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,
p_adapter->h_adapter,
@@ -1287,7 +1290,7 @@
link_state.MediaConnectState = MediaConnectStateDisconnected;
link_state.MediaDuplexState = MediaDuplexStateFull;
link_state.XmitLinkSpeed =
- link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_adapter->port_rate );
link_state.PauseFunctions = NdisPauseFunctionsSendAndReceive;
IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,
Index: D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp
===================================================================
--- D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp (revision 5450)
+++ D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_port.cpp (revision 5451)
@@ -6033,7 +6033,8 @@
link_state.Header.Size = sizeof(NDIS_LINK_STATE);
link_state.MediaConnectState = MediaConnectStateDisconnected;
link_state.MediaDuplexState = MediaDuplexStateFull;
- link_state.XmitLinkSpeed = link_state.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ link_state.XmitLinkSpeed =
+ link_state.RcvLinkSpeed = SET_PORT_RATE_BPS( p_port->p_adapter->port_rate );
IPOIB_INIT_NDIS_STATUS_INDICATION(&status_indication,
p_port->p_adapter->h_adapter,
Index: D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.h
===================================================================
--- D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.h (revision 5450)
+++ D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_adapter.h (revision 5451)
@@ -495,7 +495,9 @@
(_pStatusIndication)->StatusBufferSize = _BufSize; \
}
-// TODO: Set this according to device
#define IPOIB_MEDIA_MAX_SPEED 40000000000
+#define SET_PORT_RATE_BPS(x) (uint64_t(100) * x)
+
+
#endif /* _IPOIB_ADAPTER_H_ */
Index: D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_driver.cpp
===================================================================
--- D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_driver.cpp (revision 5450)
+++ D:/windows/MLNX_WinOF-2_1/ulp/ipoib_NDIS6_CM/kernel/ipoib_driver.cpp (revision 5451)
@@ -64,154 +64,8 @@
PDRIVER_OBJECT g_p_drv_obj;
-#if 0
-static const NDIS_OID SUPPORTED_OIDS[] =
-{
- OID_GEN_SUPPORTED_LIST,
- OID_GEN_HARDWARE_STATUS,
- OID_GEN_MEDIA_SUPPORTED,
- OID_GEN_MEDIA_IN_USE,
- OID_GEN_MAXIMUM_LOOKAHEAD,
- OID_GEN_MAXIMUM_FRAME_SIZE,
- OID_GEN_LINK_SPEED,
- OID_GEN_TRANSMIT_BUFFER_SPACE,
- OID_GEN_RECEIVE_BUFFER_SPACE,
- OID_GEN_TRANSMIT_BLOCK_SIZE,
- OID_GEN_RECEIVE_BLOCK_SIZE,
- OID_GEN_VENDOR_ID,
- OID_GEN_VENDOR_DESCRIPTION,
- OID_GEN_CURRENT_PACKET_FILTER,
- OID_GEN_CURRENT_LOOKAHEAD,
- OID_GEN_DRIVER_VERSION,
- OID_GEN_MAXIMUM_TOTAL_SIZE,
- OID_GEN_PROTOCOL_OPTIONS,
- OID_GEN_MAC_OPTIONS,
- OID_GEN_MEDIA_CONNECT_STATUS,
- OID_GEN_MAXIMUM_SEND_PACKETS,
- OID_GEN_NETWORK_LAYER_ADDRESSES,
- OID_GEN_VENDOR_DRIVER_VERSION,
- OID_GEN_PHYSICAL_MEDIUM,
- OID_GEN_XMIT_OK,
- OID_GEN_RCV_OK,
- OID_GEN_XMIT_ERROR,
- OID_GEN_RCV_ERROR,
- OID_GEN_RCV_NO_BUFFER,
- OID_GEN_DIRECTED_BYTES_XMIT,
- OID_GEN_DIRECTED_FRAMES_XMIT,
- OID_GEN_MULTICAST_BYTES_XMIT,
- OID_GEN_MULTICAST_FRAMES_XMIT,
- OID_GEN_BROADCAST_BYTES_XMIT,
- OID_GEN_BROADCAST_FRAMES_XMIT,
- OID_GEN_DIRECTED_BYTES_RCV,
- OID_GEN_DIRECTED_FRAMES_RCV,
- OID_GEN_MULTICAST_BYTES_RCV,
- OID_GEN_MULTICAST_FRAMES_RCV,
- OID_GEN_BROADCAST_BYTES_RCV,
- OID_GEN_BROADCAST_FRAMES_RCV,
- OID_802_3_PERMANENT_ADDRESS,
- OID_802_3_CURRENT_ADDRESS,
- OID_802_3_MULTICAST_LIST,
- OID_802_3_MAXIMUM_LIST_SIZE,
- OID_802_3_MAC_OPTIONS,
- OID_802_3_RCV_ERROR_ALIGNMENT,
- OID_802_3_XMIT_ONE_COLLISION,
- OID_802_3_XMIT_MORE_COLLISIONS,
- OID_TCP_TASK_OFFLOAD
-};
-#endif
-NDIS_OID NICSupportedOidsTest[] =
-{
- OID_GEN_SUPPORTED_LIST,
- OID_GEN_HARDWARE_STATUS,
- OID_GEN_MEDIA_SUPPORTED,
- OID_GEN_MEDIA_IN_USE,
- OID_GEN_MAXIMUM_LOOKAHEAD,
- OID_GEN_MAXIMUM_FRAME_SIZE,
- OID_GEN_TRANSMIT_BUFFER_SPACE,
- OID_GEN_RECEIVE_BUFFER_SPACE,
- OID_GEN_TRANSMIT_BLOCK_SIZE,
- OID_GEN_RECEIVE_BLOCK_SIZE,
- OID_GEN_VENDOR_ID,
- OID_GEN_VENDOR_DESCRIPTION,
- OID_GEN_VENDOR_DRIVER_VERSION,
- OID_GEN_CURRENT_PACKET_FILTER,
- OID_GEN_CURRENT_LOOKAHEAD,
- OID_GEN_DRIVER_VERSION,
- OID_GEN_MAXIMUM_TOTAL_SIZE,
- OID_GEN_MAC_OPTIONS,
- OID_GEN_MAXIMUM_SEND_PACKETS,
- OID_GEN_XMIT_OK,
- OID_GEN_RCV_OK,
- OID_GEN_XMIT_ERROR,
- OID_GEN_RCV_ERROR,
- OID_GEN_RCV_NO_BUFFER,
- OID_GEN_RCV_CRC_ERROR,
- OID_GEN_TRANSMIT_QUEUE_LENGTH,
- OID_802_3_PERMANENT_ADDRESS,
- OID_802_3_CURRENT_ADDRESS,
- OID_802_3_MULTICAST_LIST,
- OID_802_3_MAXIMUM_LIST_SIZE,
- OID_802_3_RCV_ERROR_ALIGNMENT,
- OID_802_3_XMIT_ONE_COLLISION,
- OID_802_3_XMIT_MORE_COLLISIONS,
- OID_802_3_XMIT_DEFERRED,
- OID_802_3_XMIT_MAX_COLLISIONS,
- OID_802_3_RCV_OVERRUN,
- OID_802_3_XMIT_UNDERRUN,
- OID_802_3_XMIT_HEARTBEAT_FAILURE,
- OID_802_3_XMIT_TIMES_CRS_LOST,
- OID_802_3_XMIT_LATE_COLLISIONS,
-#if !BUILD_W2K
- OID_GEN_PHYSICAL_MEDIUM,
-#endif
-
- OID_TCP_TASK_OFFLOAD,
-
-/* powermanagement */
-
- OID_PNP_CAPABILITIES,
- OID_PNP_SET_POWER,
- OID_PNP_QUERY_POWER,
- OID_PNP_ADD_WAKE_UP_PATTERN,
- OID_PNP_REMOVE_WAKE_UP_PATTERN,
- OID_PNP_ENABLE_WAKE_UP,
-
-
-/* custom oid WMI support */
-// OID_CUSTOM_PERF_COUNTERS,
- // OID_CUSTOM_STRING,
-
- OID_GEN_RECEIVE_SCALE_CAPABILITIES,
- OID_GEN_RECEIVE_SCALE_PARAMETERS,
-
-//
-// new and required for NDIS 6 miniports
-//
- OID_GEN_LINK_PARAMETERS,
- OID_GEN_INTERRUPT_MODERATION,
- OID_GEN_STATISTICS,
-
-/* Offload */
- OID_TCP_OFFLOAD_CURRENT_CONFIG,
- OID_TCP_OFFLOAD_PARAMETERS,
- OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES,
- OID_OFFLOAD_ENCAPSULATION,
-
-/* Header - Data seperation */
- // OID_GEN_HD_SPLIT_PARAMETERS,
- // OID_GEN_HD_SPLIT_CURRENT_CONFIG,
-
-/* VLAN */
- // OID_ADD_VALN_ID,
- // OID_DELETE_VLAN_ID,
-
-/* Set MAC */
- // OID_SET_MAC_ADDRESS
-
-};
-
static const NDIS_OID SUPPORTED_OIDS[] =
{
OID_GEN_SUPPORTED_LIST,
@@ -1167,11 +1021,11 @@
gat.Header.Revision = NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES_REVISION_1;
gat.Header.Size = sizeof(NDIS_MINIPORT_ADAPTER_GENERAL_ATTRIBUTES);
- gat.MediaType = NdisMedium802_3;
- gat.MaxXmitLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
- gat.MaxRcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
- gat.XmitLinkSpeed = IPOIB_MEDIA_MAX_SPEED; //TODO NDIS60 NDIS_LINK_SPEED_UNKNOWN
- gat.RcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED; // TODO NDIS60 NDIS_LINK_SPEED_UNKNOWN ???
+ gat.MediaType = NdisMedium802_3;
+ gat.MaxXmitLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ gat.MaxRcvLinkSpeed = IPOIB_MEDIA_MAX_SPEED;
+ gat.XmitLinkSpeed = NDIS_LINK_SPEED_UNKNOWN;
+ gat.RcvLinkSpeed = NDIS_LINK_SPEED_UNKNOWN;
gat.MediaConnectState = MediaConnectStateConnected; //TODO NDIS60 Check the current state
gat.MediaDuplexState = MediaDuplexStateFull;
@@ -2347,44 +2201,6 @@
}
break;
- case OID_GEN_LINK_SPEED:
- IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Port %d received query for OID_GEN_LINK_SPEED\n", port_num) );
- if (oid_info.buf_len < buf_len)
- {
- break;
- }
-
- cl_obj_lock( &p_adapter->obj );
- switch( p_adapter->state )
- {
- case IB_PNP_PORT_ADD:
- /* Mark the adapter as pending an OID */
- p_adapter->pending_query = TRUE;
-
- /* Save the request parameters. */
- p_adapter->query_oid = oid_info;
- p_adapter->query_oid.p_pending_oid = pNdisRequest;
-
- IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Port %d returning NDIS_STATUS_PENDING\n", port_num) );
- status = NDIS_STATUS_PENDING;
- break;
-
- case IB_PNP_PORT_REMOVE:
- IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Port %d returning NDIS_STATUS_NOT_ACCEPTED\n", port_num) );
- status = NDIS_STATUS_NOT_ACCEPTED;
- break;
-
- default:
- CL_ASSERT( p_adapter->p_port );
- info = p_adapter->port_rate;
- break;
- }
- cl_obj_unlock( &p_adapter->obj );
- break;
-
case OID_GEN_TRANSMIT_BUFFER_SPACE:
IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
("Port %d received query for OID_GEN_TRANSMIT_BUFFER_SPACE\n", port_num) );
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_ndis6_cm_RATE.patch
Type: application/octet-stream
Size: 10982 bytes
Desc: ipoib_ndis6_cm_RATE.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20100111/c3a78527/attachment.obj>
More information about the ofw
mailing list