[ofw] [PATCH] add GetOidName() routine
Smith, Stan
stan.smith at intel.com
Mon Jan 3 14:38:54 PST 2011
Use the GetOidName() routine to output names of OIDs instead of numeric value.
remove trailing whitespace.
signed-off-by: stan smith <stan.smith at intel.com>
--- A/ulp/ipoib_NDIS6_CM/kernel/ipoib_driver.cpp Mon Jan 03 14:30:21 2011
+++ B/ulp/ipoib_NDIS6_CM/kernel/ipoib_driver.cpp Mon Jan 03 14:29:59 2011
@@ -219,7 +219,7 @@
{NDIS_STRING_CONST("BCJoinRetry"), 1, IPOIB_OFFSET(bc_join_retry), IPOIB_SIZE(bc_join_retry), 50, 0, 1000},
{NDIS_STRING_CONST("CmEnabled"), 0, IPOIB_OFFSET(cm_enabled), IPOIB_SIZE(cm_enabled), FALSE, FALSE, TRUE},
{NDIS_STRING_CONST("CmPayloadMtu"), 1, IPOIB_OFFSET(cm_payload_mtu), IPOIB_SIZE(cm_payload_mtu), MAX_CM_PAYLOAD_MTU, 512, MAX_CM_PAYLOAD_MTU}
-};
+};
#define IPOIB_NUM_REG_PARAMS (sizeof (HCARegTable) / sizeof(IPOIB_REG_ENTRY))
@@ -2100,6 +2100,104 @@
}
#endif
+static PCHAR
+GetOidName(ULONG oid)
+{
+ PCHAR oidName;
+ static CHAR unknown[28];
+
+ switch (oid)
+ {
+ #undef MAKECASE
+ #define MAKECASE(oidx) case oidx: oidName = #oidx; break;
+
+ MAKECASE(OID_GEN_MACHINE_NAME)
+ MAKECASE(OID_GEN_SUPPORTED_LIST)
+ MAKECASE(OID_GEN_HARDWARE_STATUS)
+ MAKECASE(OID_GEN_MEDIA_SUPPORTED)
+ MAKECASE(OID_GEN_MEDIA_IN_USE)
+ MAKECASE(OID_GEN_MAXIMUM_LOOKAHEAD)
+ MAKECASE(OID_GEN_CURRENT_LOOKAHEAD)
+ MAKECASE(OID_GEN_MAXIMUM_FRAME_SIZE)
+ MAKECASE(OID_GEN_LINK_SPEED)
+ MAKECASE(OID_GEN_TRANSMIT_BUFFER_SPACE)
+ MAKECASE(OID_GEN_RECEIVE_BUFFER_SPACE)
+ MAKECASE(OID_GEN_TRANSMIT_BLOCK_SIZE)
+ MAKECASE(OID_GEN_RECEIVE_BLOCK_SIZE)
+ MAKECASE(OID_GEN_VENDOR_ID)
+ MAKECASE(OID_GEN_VENDOR_DESCRIPTION)
+ MAKECASE(OID_GEN_CURRENT_PACKET_FILTER)
+ MAKECASE(OID_GEN_DRIVER_VERSION)
+ MAKECASE(OID_GEN_MAXIMUM_TOTAL_SIZE)
+ MAKECASE(OID_GEN_PROTOCOL_OPTIONS)
+ MAKECASE(OID_GEN_MAC_OPTIONS)
+ MAKECASE(OID_GEN_MEDIA_CONNECT_STATUS)
+ MAKECASE(OID_GEN_MAXIMUM_SEND_PACKETS)
+ MAKECASE(OID_GEN_VENDOR_DRIVER_VERSION)
+ MAKECASE(OID_GEN_SUPPORTED_GUIDS)
+ MAKECASE(OID_GEN_NETWORK_LAYER_ADDRESSES)
+ MAKECASE(OID_GEN_TRANSPORT_HEADER_OFFSET)
+ MAKECASE(OID_GEN_MEDIA_CAPABILITIES)
+ MAKECASE(OID_GEN_PHYSICAL_MEDIUM)
+ MAKECASE(OID_GEN_XMIT_OK)
+ MAKECASE(OID_GEN_RCV_OK)
+ MAKECASE(OID_GEN_XMIT_ERROR)
+ MAKECASE(OID_GEN_RCV_ERROR)
+ MAKECASE(OID_GEN_RCV_NO_BUFFER)
+ MAKECASE(OID_GEN_DIRECTED_BYTES_XMIT)
+ MAKECASE(OID_GEN_DIRECTED_FRAMES_XMIT)
+ MAKECASE(OID_GEN_MULTICAST_BYTES_XMIT)
+ MAKECASE(OID_GEN_MULTICAST_FRAMES_XMIT)
+ MAKECASE(OID_GEN_BROADCAST_BYTES_XMIT)
+ MAKECASE(OID_GEN_BROADCAST_FRAMES_XMIT)
+ MAKECASE(OID_GEN_DIRECTED_BYTES_RCV)
+ MAKECASE(OID_GEN_DIRECTED_FRAMES_RCV)
+ MAKECASE(OID_GEN_MULTICAST_BYTES_RCV)
+ MAKECASE(OID_GEN_MULTICAST_FRAMES_RCV)
+ MAKECASE(OID_GEN_BROADCAST_BYTES_RCV)
+ MAKECASE(OID_GEN_BROADCAST_FRAMES_RCV)
+ MAKECASE(OID_GEN_RCV_CRC_ERROR)
+ MAKECASE(OID_GEN_TRANSMIT_QUEUE_LENGTH)
+ MAKECASE(OID_GEN_GET_TIME_CAPS)
+ MAKECASE(OID_GEN_GET_NETCARD_TIME)
+ MAKECASE(OID_GEN_NETCARD_LOAD)
+ MAKECASE(OID_GEN_DEVICE_PROFILE)
+ MAKECASE(OID_GEN_INIT_TIME_MS)
+ MAKECASE(OID_GEN_RESET_COUNTS)
+ MAKECASE(OID_GEN_MEDIA_SENSE_COUNTS)
+ MAKECASE(OID_PNP_CAPABILITIES)
+ MAKECASE(OID_PNP_SET_POWER)
+ MAKECASE(OID_PNP_QUERY_POWER)
+ MAKECASE(OID_PNP_ADD_WAKE_UP_PATTERN)
+ MAKECASE(OID_PNP_REMOVE_WAKE_UP_PATTERN)
+ MAKECASE(OID_PNP_ENABLE_WAKE_UP)
+ MAKECASE(OID_802_3_PERMANENT_ADDRESS)
+ MAKECASE(OID_802_3_CURRENT_ADDRESS)
+ MAKECASE(OID_802_3_MULTICAST_LIST)
+ MAKECASE(OID_802_3_MAXIMUM_LIST_SIZE)
+ MAKECASE(OID_802_3_MAC_OPTIONS)
+ MAKECASE(OID_802_3_RCV_ERROR_ALIGNMENT)
+ MAKECASE(OID_802_3_XMIT_ONE_COLLISION)
+ MAKECASE(OID_802_3_XMIT_MORE_COLLISIONS)
+ MAKECASE(OID_802_3_XMIT_DEFERRED)
+ MAKECASE(OID_802_3_XMIT_MAX_COLLISIONS)
+ MAKECASE(OID_802_3_RCV_OVERRUN)
+ MAKECASE(OID_802_3_XMIT_UNDERRUN)
+ MAKECASE(OID_802_3_XMIT_HEARTBEAT_FAILURE)
+ MAKECASE(OID_802_3_XMIT_TIMES_CRS_LOST)
+ MAKECASE(OID_802_3_XMIT_LATE_COLLISIONS)
+
+ default:
+ StringCchPrintf( unknown, sizeof(unknown),
+ "<* Unknown OID? %#X *>", oid );
+ oidName = unknown;
+ break;
+ }
+
+ return oidName;
+#undef MAKECASE
+}
+
//! Returns information about the capabilities and status of the driver and/or its NIC.
/* IRQL = DISPATCH_LEVEL
@@ -2248,11 +2346,8 @@
info = p_adapter->params.xfer_block_size;
IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Port %d received query for 1 of OID_GEN_MAXIMUM_LOOKAHEAD, "
- "_CURRENT_LOOKAHEAD, "
- "_TRANSMIT_BLOCK_SIZE, "
- "_RECEIVE_BLOCK_SIZE, "
- "_GEN_MAXIMUM_TOTAL_SIZE = %d\n", port_num, info) );
+ ("Port %d received query for %s = %d\n",
+ port_num, GetOidName(oid_info.oid), info) );
break;
case OID_GEN_VENDOR_ID:
@@ -2588,8 +2683,8 @@
case OID_PNP_CAPABILITIES:
status = NDIS_STATUS_NOT_SUPPORTED;
IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Port %d received an unsupported Optional oid of 0x%.8X!\n",
- port_num, oid_info.oid) );
+ ("Port %d received an unsupported Optional oid of %s\n",
+ port_num, GetOidName(oid_info.oid)) );
break;
case OID_GEN_PROTOCOL_OPTIONS:
@@ -2597,12 +2692,8 @@
case OID_GEN_TRANSPORT_HEADER_OFFSET:
case OID_PNP_ENABLE_WAKE_UP:
IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Port %d received query for OID_GEN_PROTOCOL_OPTIONS or "
- "OID_GEN_NETWORK_LAYER_ADDRESSES or "
- "OID_GEN_TRANSPORT_HEADER_OFFSET OID_PNP_ENABLE_WAKE_UP\n",
- port_num) );
- IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Number of OID: 0x%.8X!\n", oid_info.oid) );
+ ("Port %d received query for %s\n",
+ port_num, GetOidName(oid_info.oid)) );
status = NDIS_STATUS_SUCCESS;
break;
@@ -3030,7 +3121,8 @@
#endif
status = NDIS_STATUS_NOT_SUPPORTED;
IPOIB_PRINT( TRACE_LEVEL_INFORMATION,IPOIB_DBG_OID,
- ("Port %d received an unsupported oid of 0x%.8X!\n", port_num, oid));
+ ("Port %d received an unsupported oid %s\n",
+ port_num, GetOidName(oid)));
break;
case OID_GEN_INTERRUPT_MODERATION:
@@ -3065,8 +3157,8 @@
default:
status = NDIS_STATUS_INVALID_OID;
- IPOIB_PRINT( TRACE_LEVEL_ERROR,IPOIB_DBG_ERROR,
- ("Port %d received an invalid oid of 0x%.8X!\n", port_num, oid));
+ IPOIB_PRINT( TRACE_LEVEL_ERROR, IPOIB_DBG_ERROR,
+ ("Port %d received unsupported OID %s\n", port_num, GetOidName(oid)));
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ipoib_driver.cpp.patch
Type: application/octet-stream
Size: 6878 bytes
Desc: ipoib_driver.cpp.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20110103/1052a378/attachment.obj>
More information about the ofw
mailing list