Author: cgutman
Date: Mon Dec 5 18:42:21 2011
New Revision: 54600
URL:
http://svn.reactos.org/svn/reactos?rev=54600&view=rev
Log:
[TCPIP]
- Make interface octets in/out stats more accurate
Modified:
trunk/reactos/drivers/network/tcpip/datalink/lan.c
trunk/reactos/lib/drivers/ip/network/transmit.c
Modified: trunk/reactos/drivers/network/tcpip/datalink/lan.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/tcpip/data…
==============================================================================
--- trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/tcpip/datalink/lan.c [iso-8859-1] Mon Dec 5 18:42:21
2011
@@ -353,7 +353,8 @@
("Ether Type = %x Total = %d\n",
PacketType, IPPacket.TotalSize));
- Interface->Stats.InBytes += IPPacket.TotalSize;
+ /* Update interface stats */
+ Interface->Stats.InBytes += IPPacket.TotalSize + Adapter->HeaderSize;
/* NDIS packet is freed in all of these cases */
switch (PacketType) {
@@ -680,6 +681,7 @@
PLAN_ADAPTER Adapter = (PLAN_ADAPTER)Context;
KIRQL OldIrql;
PNDIS_PACKET XmitPacket;
+ PIP_INTERFACE Interface = Adapter->Context;
TI_DbgPrint(DEBUG_DATALINK,
("Called( NdisPacket %x, Offset %d, Adapter %x )\n",
@@ -713,7 +715,7 @@
(*PC(NdisPacket)->DLComplete)(PC(NdisPacket)->Context, NdisPacket,
NDIS_STATUS_SUCCESS);
- switch (Adapter->Media) {
+ switch (Adapter->Media) {
case NdisMedium802_3:
EHeader = (PETH_HEADER)Data;
@@ -728,25 +730,25 @@
RtlCopyMemory(EHeader->SrcAddr, Adapter->HWAddress,
IEEE_802_ADDR_LENGTH);
switch (Type) {
- case LAN_PROTO_IPv4:
- EHeader->EType = ETYPE_IPv4;
- break;
- case LAN_PROTO_ARP:
- EHeader->EType = ETYPE_ARP;
- break;
- case LAN_PROTO_IPv6:
- EHeader->EType = ETYPE_IPv6;
- break;
- default:
- ASSERT(FALSE);
- return;
+ case LAN_PROTO_IPv4:
+ EHeader->EType = ETYPE_IPv4;
+ break;
+ case LAN_PROTO_ARP:
+ EHeader->EType = ETYPE_ARP;
+ break;
+ case LAN_PROTO_IPv6:
+ EHeader->EType = ETYPE_IPv6;
+ break;
+ default:
+ ASSERT(FALSE);
+ return;
}
break;
default:
/* FIXME: Support other medias */
break;
- }
+ }
TI_DbgPrint( MID_TRACE, ("LinkAddress: %x\n", LinkAddress));
if( LinkAddress ) {
@@ -761,11 +763,14 @@
((PCHAR)LinkAddress)[5] & 0xff));
}
- if (Adapter->MTU < Size) {
- /* This is NOT a pointer. MSDN explicitly says so. */
- NDIS_PER_PACKET_INFO_FROM_PACKET(NdisPacket,
- TcpLargeSendPacketInfo) =
(PVOID)((ULONG_PTR)Adapter->MTU);
- }
+ if (Adapter->MTU < Size) {
+ /* This is NOT a pointer. MSDN explicitly says so. */
+ NDIS_PER_PACKET_INFO_FROM_PACKET(NdisPacket,
+ TcpLargeSendPacketInfo) =
(PVOID)((ULONG_PTR)Adapter->MTU);
+ }
+
+ /* Update interface stats */
+ Interface->Stats.OutBytes += Size;
TcpipAcquireSpinLock( &Adapter->Lock, &OldIrql );
TI_DbgPrint(MID_TRACE, ("NdisSend\n"));
Modified: trunk/reactos/lib/drivers/ip/network/transmit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/network/tra…
==============================================================================
--- trunk/reactos/lib/drivers/ip/network/transmit.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/network/transmit.c [iso-8859-1] Mon Dec 5 18:42:21 2011
@@ -234,8 +234,6 @@
* send routine (IPSendFragment)
*/
{
- UINT PacketSize;
-
TI_DbgPrint(MAX_TRACE, ("Called. IPPacket (0x%X) NCE (0x%X)\n", IPPacket,
NCE));
DISPLAY_IP_PACKET(IPPacket);
@@ -243,10 +241,6 @@
/* Fetch path MTU now, because it may change */
TI_DbgPrint(MID_TRACE,("PathMTU: %d\n", NCE->Interface->MTU));
- NdisQueryPacketLength(IPPacket->NdisPacket, &PacketSize);
-
- NCE->Interface->Stats.OutBytes += PacketSize;
-
return SendFragments(IPPacket, NCE, NCE->Interface->MTU);
}