diff --git a/src/Home/Net/Drivers/PCNet.ZC b/src/Home/Net/Drivers/PCNet.ZC index bf84da61..637956de 100755 --- a/src/Home/Net/Drivers/PCNet.ZC +++ b/src/Home/Net/Drivers/PCNet.ZC @@ -635,7 +635,13 @@ I64 PCNetPacketReceive(U8 **packet_buffer_out, U16 *packet_length_out) NetDebug("PCNET RECEIVE PACKET: de_index incremented = 0x%0X", pcnet.current_rx_de_index); *packet_buffer_out = pcnet.rx_buffer_addr_phys + de_index * ETHERNET_FRAME_SIZE; - *packet_length_out = packet_length; + + // ASTRPRCV causes 802.3 packets to be stripped and FCS to be checked + U16 ethertype = (*packet_buffer_out)[ETHERNET_ETHERTYPE_OFFSET + 1] | (*packet_buffer_out)[ETHERNET_ETHERTYPE_OFFSET] << 8; + if (ethertype < ETHERNET_v2_MTU) + *packet_length_out = ethertype; + else + *packet_length_out = packet_length - FCS_LENGTH; // ethertype ii TODO: Validate FCS return de_index; } diff --git a/src/Home/Net/Protocols/Ethernet.ZC b/src/Home/Net/Protocols/Ethernet.ZC index 611b3b34..cdd54b33 100755 --- a/src/Home/Net/Protocols/Ethernet.ZC +++ b/src/Home/Net/Protocols/Ethernet.ZC @@ -29,6 +29,8 @@ U0 EthernetGlobalsInit() U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length) { + // length is assumed to NOT include the FCS. + // Shrine says MemCopy has a high overhead. // Almost tempted to say that means that a lot // of the current system should be done with @@ -45,10 +47,7 @@ U0 EthernetFrameParse(CEthernetFrame *frame_out, U8 *frame, U16 length) frame_out->data = frame + ETHERNET_DATA_OFFSET; - if (frame_out->ethertype <= ETHERNET_v2_MTU) // check if the field is a length or an ethertype - frame_out->length = frame_out->ethertype; - else - frame_out->length = length - ETHERNET_MAC_HEADER_LENGTH - FCS_LENGTH; + frame_out->length = length - ETHERNET_MAC_HEADER_LENGTH; } U0 EthernetFrameFinish(I64 de_index)