Commit in reactos/drivers/net on MAIN
dd/ne2000/include/8390.h+14-11.3 -> 1.4
dd/ne2000/ne2000/main.c+6-41.6 -> 1.7
tcpip/datalink/lan.c+28-361.24 -> 1.25
tcpip/include/ip.h+4-41.17 -> 1.18
+52-45
4 modified files
Fixed bug in ne2000 driver, re: copying ethernet frame header when only
payload should be copied in MiniportTransferData.

Changed tcpip to not consider the ethernet header anywhere above 
ProtocolReceive.

reactos/drivers/net/dd/ne2000/include
8390.h 1.3 -> 1.4
diff -u -r1.3 -r1.4
--- 8390.h	11 May 2004 20:52:09 -0000	1.3
+++ 8390.h	14 Nov 2004 10:13:16 -0000	1.4
@@ -140,8 +140,21 @@
     UCHAR Status;           /* See RSR_* constants */
     UCHAR NextPacket;       /* Pointer to next packet in chain */
     USHORT PacketLength;    /* Length of packet including this header */
-} PACKET_HEADER, PPACKET_HEADER;
+} PACKET_HEADER, *PPACKET_HEADER;
 
+#define IEEE_802_ADDR_LENGTH 6
+
+/* Ethernet frame header */
+typedef struct _ETH_HEADER {
+    UCHAR Destination[IEEE_802_ADDR_LENGTH];
+    UCHAR Source[IEEE_802_ADDR_LENGTH];
+    USHORT PayloadType;
+} ETH_HEADER, *PETH_HEADER;
+
+typedef struct _DISCARD_HEADER {
+    PACKET_HEADER HWHeader;
+    ETH_HEADER EthernetHeader;
+} DISCARD_HEADER, *PDISCARD_HEADER;
 
 #define NICDisableInterrupts(Adapter) { \
     NDIS_DbgPrint(MAX_TRACE, ("NICDisableInterrupts()\n")); \

reactos/drivers/net/dd/ne2000/ne2000
main.c 1.6 -> 1.7
diff -u -r1.6 -r1.7
--- main.c	24 Jul 2004 04:48:01 -0000	1.6
+++ main.c	14 Nov 2004 10:13:17 -0000	1.7
@@ -764,14 +764,16 @@
     NdisQueryPacket(Packet, NULL, NULL, &DstBuffer, NULL);
     NdisQueryBuffer(DstBuffer, (PVOID)&DstData, &DstSize);
 
-    SrcData = Adapter->PacketOffset + sizeof(PACKET_HEADER) + ByteOffset;
-    if (ByteOffset + sizeof(PACKET_HEADER) + BytesToTransfer > Adapter->PacketHeader.PacketLength)
-        BytesToTransfer = Adapter->PacketHeader.PacketLength- sizeof(PACKET_HEADER) - ByteOffset;
+    SrcData = Adapter->PacketOffset + sizeof(DISCARD_HEADER) + ByteOffset;
+    if (ByteOffset + sizeof(DISCARD_HEADER) + BytesToTransfer > 
+	Adapter->PacketHeader.PacketLength)
+        BytesToTransfer = Adapter->PacketHeader.PacketLength - 
+	    sizeof(DISCARD_HEADER) - ByteOffset;
 
     /* Start copying the data */
     BytesCopied = 0;
     for (;;) {
-        BytesToCopy = (DstSize < BytesToTransfer)? DstSize : BytesToTransfer;
+        BytesToCopy = (DstSize < BytesToTransfer) ? DstSize : BytesToTransfer;
         if (SrcData + BytesToCopy > RecvStop)
             BytesToCopy = (RecvStop - SrcData);
 

reactos/drivers/net/tcpip/datalink
lan.c 1.24 -> 1.25
diff -u -r1.24 -r1.25
--- lan.c	13 Nov 2004 00:06:32 -0000	1.24
+++ lan.c	14 Nov 2004 10:13:17 -0000	1.25
@@ -227,10 +227,8 @@
 
 	/*OskitDumpBuffer( IPPacket.Header, IPPacket.TotalSize );*/
 
-        PacketType = ((PETH_HEADER)IPPacket.Header)->EType;
-	IPPacket.Header = ((PCHAR)IPPacket.Header) + sizeof(ETH_HEADER);
-	IPPacket.Position = sizeof(ETH_HEADER);
-	IPPacket.TotalSize -= sizeof(ETH_HEADER);
+        PacketType = PC(IPPacket.NdisPacket)->PacketType;
+	IPPacket.Position = 0;
 
 	TI_DbgPrint
 		(DEBUG_DATALINK,
@@ -358,56 +356,50 @@
     TI_DbgPrint(DEBUG_DATALINK, ("Adapter: %x (MTU %d)\n", 
 				 Adapter, Adapter->MTU));
 
-    //TcpipAcquireSpinLockAtDpcLevel(&Adapter->Lock);
-    NdisStatus = AllocatePacketWithBuffer( &NdisPacket, NULL, Adapter->MTU );
+    NdisStatus = AllocatePacketWithBuffer( &NdisPacket, NULL,
+                                           PacketSize + HeaderBufferSize );
     if( NdisStatus != NDIS_STATUS_SUCCESS ) {
-	//TcpipReleaseSpinLockFromDpcLevel(&Adapter->Lock);
 	return NDIS_STATUS_NOT_ACCEPTED;
     }
 
+    PC(NdisPacket)->PacketType = PacketType;
+
     TI_DbgPrint(DEBUG_DATALINK, ("pretransfer LookaheadBufferSize %d packsize %d\n",LookaheadBufferSize,PacketSize));
 
     GetDataPtr( NdisPacket, 0, &BufferData, &temp );
 
     IPPacket.NdisPacket = NdisPacket;
     IPPacket.Position = 0;
-	
-    if ((LookaheadBufferSize + HeaderBufferSize) < PacketSize)
+
+    if (LookaheadBufferSize == PacketSize)
     {
-        TI_DbgPrint(DEBUG_DATALINK, ("pretransfer LookaheadBufferSize %d packsize %d bufferdata %x\n",LookaheadBufferSize,PacketSize, BufferData));
-	/* The following is this way because we want a nice, whole packet
-	 * in NdisPacket, including ethernet header (which this code assumes)
-	 * is in there.  We are indeed retransferring some bytes.  Eventually,
-	 * I will change the downstream functions to take the payload only. 
-	 * 
-	 * Below: Count the ethernet header size, but don't count the crc */
-        NdisTransferData(&NdisStatus,
-                         Adapter->NdisHandle,
-                         MacReceiveContext,
-			 0,
-                         PacketSize + sizeof(ETH_HEADER) - sizeof(ULONG),
-                         NdisPacket,
-                         &BytesTransferred);
-    } else {
-	TI_DbgPrint(DEBUG_DATALINK, ("copy\n"));
-	NdisStatus = NDIS_STATUS_SUCCESS;
-	BytesTransferred = PacketSize;
-	RtlCopyMemory(BufferData,
-		      HeaderBuffer, 
-		      HeaderBufferSize);
-	RtlCopyMemory(BufferData + HeaderBufferSize,
-		      LookaheadBuffer, LookaheadBufferSize);
+        /* Optimized code path for packets that are fully contained in
+         * the lookahead buffer. */
+        NdisCopyLookaheadData(BufferData,
+                              LookaheadBuffer,
+                              LookaheadBufferSize,
+                              Adapter->MacOptions);
+    }
+    else
+    {
+	if (NdisStatus == NDIS_STATUS_SUCCESS)
+        {
+            NdisTransferData(&NdisStatus, Adapter->NdisHandle,
+                             MacReceiveContext, 0, PacketSize, 
+			     NdisPacket, &BytesTransferred);
+        }
+        else
+        {
+            BytesTransferred = 0;
+        }
     }
     TI_DbgPrint(DEBUG_DATALINK, ("Calling complete\n"));
 
-    /* Release the packet descriptor */
-    //TcpipReleaseSpinLockFromDpcLevel(&Adapter->Lock);
-
     if (NdisStatus != NDIS_STATUS_PENDING)
 	ProtocolTransferDataComplete(BindingContext,
 				     NdisPacket,
 				     NdisStatus,
-				     PacketSize + HeaderBufferSize);    
+				     PacketSize);
 
     TI_DbgPrint(DEBUG_DATALINK, ("leaving\n"));
 

reactos/drivers/net/tcpip/include
ip.h 1.17 -> 1.18
diff -u -r1.17 -r1.18
--- ip.h	9 Nov 2004 09:39:37 -0000	1.17
+++ ip.h	14 Nov 2004 10:13:17 -0000	1.18
@@ -96,11 +96,11 @@
 
 /* Packet context */
 typedef struct _PACKET_CONTEXT {
-    PACKET_COMPLETION_ROUTINE Complete;   /* Transport level completion handler */
+    PACKET_COMPLETION_ROUTINE DLComplete; /* Data link level completion handler
+					   * Also used to link to next packet 
+					   * in a queue */
     PVOID Context;                        /* Context information for handler */
-    PACKET_COMPLETION_ROUTINE DLComplete; /* Data link level completion handler. Also
-                                             used to link to next packet in a queue */
-    UINT DLOffset;                        /* Offset where data (IP header) starts */
+    UINT  PacketType;                     /* Type of packet */
 } PACKET_CONTEXT, *PPACKET_CONTEXT;
 
 /* The ProtocolReserved field is structured as a PACKET_CONTEXT */
CVSspam 0.2.8