]> xenbits.xensource.com Git - pvdrivers/win/xenvif.git/commitdiff
Adjust Packet's MDL when stripping ETHERNET_TAG from headers
authorOwen Smith <owen.smith@cloud.com>
Tue, 5 Mar 2024 15:33:30 +0000 (15:33 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Thu, 14 Mar 2024 10:35:08 +0000 (10:35 +0000)
Tagged headers have the ETHERNET_TAG stripped to convert to
ETHERNET_UNTAGGED_HEADERs. As part of the fix up, the offsets for each
header was adjusted, and the underlying MDL's MappedSystemVa was adjusted.
However, the ByteCount and ByteOffset were not adjusted, resulting in
instances of data corruption when MappedSystemVa != StartVa + ByteOffset.

It is possible to configure the default gateway to respond to ARP packets
with TPID wrappings. Openvswitch will not strip this header since this commit:

    commit f0fb825a3785320430686834741c718ff4f8ebf4
    Author: Eric Garver <e@erig.me>
    Date:   Wed Mar 1 17:47:59 2017 -0500

        Add support for 802.1ad (QinQ tunneling)

Which means Windows was receiving corrupted ARP responses, leading to an
inability to access the network correctly. This would usually show as
Windows indicating that no internet access was available, or being unable
it access other VMs or other resources beyond the default gateway.

Signed-off-by: Owen Smith <owen.smith@cloud.com>
src/xenvif/receiver.c

index 0ce5b67782d0f399a6e7811656ceb595dc1631fd..37e2c60ef38ba2c87b728b0ad88beefda5204d76 100644 (file)
@@ -442,10 +442,11 @@ ReceiverRingProcessTag(
                   Offset);
 
     // Fix up the packet information
-    BaseVa += sizeof (ETHERNET_TAG);
+    Packet->Mdl.MappedSystemVa = (PUCHAR)Packet->Mdl.MappedSystemVa + sizeof(ETHERNET_TAG);
+    Packet->Mdl.ByteOffset += sizeof(ETHERNET_TAG);
+    Packet->Mdl.ByteCount -= sizeof(ETHERNET_TAG);
 
-    BaseVa -= Packet->Offset;
-    Packet->Mdl.MappedSystemVa = BaseVa;
+    ASSERT3P((PUCHAR)Packet->Mdl.StartVa + Packet->Mdl.ByteOffset, ==, Packet->Mdl.MappedSystemVa);
 
     Packet->Length -= sizeof (ETHERNET_TAG);