https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1b2ca2810782464458687…
commit 1b2ca2810782464458687cbd70b2feaee10d6279
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Mon Jul 2 22:29:05 2018 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Thu Feb 7 19:48:54 2019 +0100
[NDIS] Improve debug output
---
drivers/network/ndis/include/miniport.h | 3 ++-
drivers/network/ndis/ndis/miniport.c | 23 ++++++++++++-----------
drivers/network/ndis/ndis/protocol.c | 8 +++++++-
3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/drivers/network/ndis/include/miniport.h
b/drivers/network/ndis/include/miniport.h
index 6df63d7440..d538909d78 100644
--- a/drivers/network/ndis/include/miniport.h
+++ b/drivers/network/ndis/include/miniport.h
@@ -109,7 +109,8 @@ extern KSPIN_LOCK AdapterListLock;
#if DBG
VOID
MiniDisplayPacket(
- PNDIS_PACKET Packet);
+ PNDIS_PACKET Packet,
+ PCSTR Reason);
#endif /* DBG */
VOID
diff --git a/drivers/network/ndis/ndis/miniport.c b/drivers/network/ndis/ndis/miniport.c
index 38ee5d01b3..645291cab9 100644
--- a/drivers/network/ndis/ndis/miniport.c
+++ b/drivers/network/ndis/ndis/miniport.c
@@ -59,7 +59,8 @@ KSPIN_LOCK AdapterListLock;
VOID
MiniDisplayPacket(
- PNDIS_PACKET Packet)
+ PNDIS_PACKET Packet,
+ PCSTR Reason)
{
#if DBG
ULONG i, Length;
@@ -71,15 +72,15 @@ MiniDisplayPacket(
0,
64);
- DbgPrint("*** PACKET START ***");
+ DbgPrint("*** %s PACKET START (%p) ***\n", Reason, Packet);
for (i = 0; i < Length; i++) {
- if (i % 12 == 0)
+ if (i % 16 == 0)
DbgPrint("\n%04X ", i);
DbgPrint("%02X ", Buffer[i]);
}
- DbgPrint("*** PACKET STOP ***\n");
+ DbgPrint("\n*** %s PACKET STOP ***\n", Reason);
}
#endif /* DBG */
}
@@ -624,8 +625,8 @@ MiniAdapterHasAddress(
*/
{
UINT Length;
- PUCHAR Start1;
- PUCHAR Start2;
+ PUCHAR PacketAddress;
+ PUCHAR AdapterAddress;
PNDIS_BUFFER NdisBuffer;
UINT BufferLength;
@@ -653,7 +654,7 @@ MiniAdapterHasAddress(
return FALSE;
}
- NdisQueryBuffer(NdisBuffer, (PVOID)&Start2, &BufferLength);
+ NdisQueryBuffer(NdisBuffer, (PVOID)&PacketAddress, &BufferLength);
/* FIXME: Should handle fragmented packets */
@@ -675,12 +676,12 @@ MiniAdapterHasAddress(
return FALSE;
}
- Start1 = (PUCHAR)&Adapter->Address;
+ AdapterAddress = (PUCHAR)&Adapter->Address;
NDIS_DbgPrint(MAX_TRACE, ("packet address: %x:%x:%x:%x:%x:%x adapter address:
%x:%x:%x:%x:%x:%x\n",
- *((char *)Start1), *(((char *)Start1)+1), *(((char
*)Start1)+2), *(((char *)Start1)+3), *(((char *)Start1)+4), *(((char *)Start1)+5),
- *((char *)Start2), *(((char *)Start2)+1), *(((char
*)Start2)+2), *(((char *)Start2)+3), *(((char *)Start2)+4), *(((char *)Start2)+5)));
+ *(PacketAddress), *(PacketAddress+1), *(PacketAddress+2),
*(PacketAddress+3), *(PacketAddress+4), *(PacketAddress+5),
+ *(AdapterAddress), *(AdapterAddress+1),
*(AdapterAddress+2), *(AdapterAddress+3), *(AdapterAddress+4), *(AdapterAddress+5)));
- return (RtlCompareMemory((PVOID)Start1, (PVOID)Start2, Length) == Length);
+ return (RtlCompareMemory(PacketAddress, AdapterAddress, Length) == Length);
}
diff --git a/drivers/network/ndis/ndis/protocol.c b/drivers/network/ndis/ndis/protocol.c
index c32bfd45d3..d584d36f15 100644
--- a/drivers/network/ndis/ndis/protocol.c
+++ b/drivers/network/ndis/ndis/protocol.c
@@ -262,7 +262,7 @@ ProIndicatePacket(
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
#if DBG
- MiniDisplayPacket(Packet);
+ MiniDisplayPacket(Packet, "INDICATE");
#endif
NdisQueryPacket(Packet, NULL, NULL, NULL, &PacketLength);
@@ -395,11 +395,17 @@ proSendPacketToMiniport(PLOGICAL_ADAPTER Adapter, PNDIS_PACKET
Packet)
KIRQL RaiseOldIrql;
NDIS_STATUS NdisStatus;
+ NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
+
if(MiniIsBusy(Adapter, NdisWorkItemSend)) {
+ NDIS_DbgPrint(MID_TRACE, ("Busy: NdisWorkItemSend.\n"));
+
MiniQueueWorkItem(Adapter, NdisWorkItemSend, Packet, FALSE);
return NDIS_STATUS_PENDING;
}
+ MiniDisplayPacket(Packet, "SEND");
+
if(Adapter->NdisMiniportBlock.DriverHandle->MiniportCharacteristics.SendPacketsHandler)
{
if(Adapter->NdisMiniportBlock.Flags & NDIS_ATTRIBUTE_DESERIALIZE)