[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH 2/2] Clean up use of MmGetSystemAddressForMdlSafe()



It is not necessary in most cases, because we can ASSERT that the MDL
is already mapped to a system address for anything locally allocated.

Also this patch substitutes use of local variable name StartVa with BaseVa,
to avoid confusion with Mdl->StartVa.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenvif/checksum.c    |  28 ++++----
 src/xenvif/controller.c  |  10 +--
 src/xenvif/receiver.c    | 165 ++++++++++++++++++++++++++--------------------
 src/xenvif/transmitter.c | 167 ++++++++++++++++++++++++-----------------------
 4 files changed, 198 insertions(+), 172 deletions(-)

diff --git a/src/xenvif/checksum.c b/src/xenvif/checksum.c
index ad375f6..c9879fb 100644
--- a/src/xenvif/checksum.c
+++ b/src/xenvif/checksum.c
@@ -45,7 +45,7 @@
 static FORCEINLINE VOID
 __AccumulateChecksum(
     IN OUT  PULONG  Accumulator,
-    IN      PUCHAR  MappedSystemVa,
+    IN      PUCHAR  BaseVa,
     IN      ULONG   ByteCount
     )
 {
@@ -54,15 +54,15 @@ __AccumulateChecksum(
     Current = *Accumulator;
 
     while (ByteCount > 1) {
-        Current += *((PUSHORT)MappedSystemVa);
+        Current += *((PUSHORT)BaseVa);
         if (Current & (1 << 31))
             Current = (Current & 0xFFFF) + (Current >> 16);
-        MappedSystemVa += 2;
+        BaseVa += 2;
         ByteCount -= 2;
     }
 
     if (ByteCount != 0)
-        Current += (USHORT)*MappedSystemVa;
+        Current += (USHORT)*BaseVa;
 
     while ((Current >> 16) != 0)
         Current = (Current & 0xFFFF) + (Current >> 16);
@@ -73,11 +73,11 @@ __AccumulateChecksum(
 VOID
 AccumulateChecksum(
     IN OUT  PULONG  Accumulator,
-    IN      PVOID   MappedSystemVa,
+    IN      PVOID   BaseVa,
     IN      ULONG   ByteCount
     )
 {
-    __AccumulateChecksum(Accumulator, MappedSystemVa, ByteCount);
+    __AccumulateChecksum(Accumulator, BaseVa, ByteCount);
 }
 
 BOOLEAN
@@ -324,20 +324,20 @@ ChecksumTcpPacket(
     Length = __min(Length, Payload->Length);
 
     while (Length != 0) {
-        PUCHAR  MappedSystemVa;
+        PUCHAR  BaseVa;
         ULONG   ByteCount;
 
         ASSERT(Mdl != NULL);
 
-        MappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-        MappedSystemVa += Offset;
+        BaseVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
+        BaseVa += Offset;
 
         ByteCount = Mdl->ByteCount;
         ASSERT3U(Offset, <=, ByteCount);
         ByteCount -= Offset;
         ByteCount = __min(ByteCount, Length);
 
-        __AccumulateChecksum(&Accumulator, MappedSystemVa, ByteCount);
+        __AccumulateChecksum(&Accumulator, BaseVa, ByteCount);
 
         Length -= ByteCount;
 
@@ -403,20 +403,20 @@ ChecksumUdpPacket(
     Length = __min(Length, Payload->Length);
 
     while (Length != 0) {
-        PUCHAR  MappedSystemVa;
+        PUCHAR  BaseVa;
         ULONG   ByteCount;
 
         ASSERT(Mdl != NULL);
 
-        MappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-        MappedSystemVa += Offset;
+        BaseVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
+        BaseVa += Offset;
 
         ByteCount = Mdl->ByteCount;
         ASSERT3U(Offset, <=, ByteCount);
         ByteCount -= Offset;
         ByteCount = __min(ByteCount, Length);
 
-        __AccumulateChecksum(&Accumulator, MappedSystemVa, ByteCount);
+        __AccumulateChecksum(&Accumulator, BaseVa, ByteCount);
 
         Length -= ByteCount;
 
diff --git a/src/xenvif/controller.c b/src/xenvif/controller.c
index 243295f..a542c0d 100644
--- a/src/xenvif/controller.c
+++ b/src/xenvif/controller.c
@@ -462,8 +462,8 @@ ControllerConnect(
     if (Controller->Mdl == NULL)
         goto fail7;
 
-    Controller->Shared = MmGetSystemAddressForMdlSafe(Controller->Mdl,
-                                                      NormalPagePriority);
+    ASSERT(Controller->Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    Controller->Shared = Controller->Mdl->MappedSystemVa;
     ASSERT(Controller->Shared != NULL);
 
     SHARED_RING_INIT(Controller->Shared);
@@ -896,7 +896,8 @@ ControllerSetHashKey(
     if (Controller->Mdl == NULL)
         goto fail1;
 
-    Buffer = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
+    ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    Buffer = Mdl->MappedSystemVa;
     ASSERT(Buffer != NULL);
 
     RtlCopyMemory(Buffer, Key, Size);
@@ -1074,7 +1075,8 @@ ControllerSetHashMapping(
     if (Controller->Mdl == NULL)
         goto fail2;
 
-    Buffer = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
+    ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    Buffer = Mdl->MappedSystemVa;
     ASSERT(Buffer != NULL);
 
     RtlCopyMemory(Buffer, Mapping, Size * sizeof (ULONG));
diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c
index 67a5cb2..5715dba 100644
--- a/src/xenvif/receiver.c
+++ b/src/xenvif/receiver.c
@@ -395,7 +395,7 @@ ReceiverRingProcessTag(
 {
     PXENVIF_PACKET_INFO          Info;
     ULONG                        PayloadLength;
-    PUCHAR                       StartVa;
+    PUCHAR                       BaseVa;
     PETHERNET_HEADER             EthernetHeader;
     ULONG                        Offset;
 
@@ -403,12 +403,14 @@ ReceiverRingProcessTag(
 
     PayloadLength = Packet->Length - Info->Length;
 
-    StartVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl, NormalPagePriority);
-    ASSERT(StartVa != NULL);
-    StartVa += Packet->Offset;
+    ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Packet->Mdl.MappedSystemVa;
+    ASSERT(BaseVa != NULL);
+
+    BaseVa += Packet->Offset;
 
     ASSERT(Info->EthernetHeader.Length != 0);
-    EthernetHeader = (PETHERNET_HEADER)(StartVa + Info->EthernetHeader.Offset);
+    EthernetHeader = (PETHERNET_HEADER)(BaseVa + Info->EthernetHeader.Offset);
 
     if (!ETHERNET_HEADER_IS_TAGGED(EthernetHeader) ||
         Ring->OffloadOptions.OffloadTagManipulation == 0)
@@ -444,11 +446,13 @@ ReceiverRingProcessTag(
 
     Info->Length -= sizeof (ETHERNET_TAG);
 
-    StartVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl, NormalPagePriority);
-    ASSERT(StartVa != NULL);
-    StartVa += Packet->Offset;
+    ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Packet->Mdl.MappedSystemVa;
+    ASSERT(BaseVa != NULL);
+
+    BaseVa += Packet->Offset;
 
-    EthernetHeader = (PETHERNET_HEADER)(StartVa + Info->EthernetHeader.Offset);
+    EthernetHeader = (PETHERNET_HEADER)(BaseVa + Info->EthernetHeader.Offset);
 
     ASSERT3U(PayloadLength, ==, Packet->Length - Info->Length);
 }
@@ -464,7 +468,7 @@ ReceiverRingProcessChecksum(
     PXENVIF_PACKET_INFO         Info;
     XENVIF_PACKET_PAYLOAD       Payload;
     uint16_t                    flags;
-    PUCHAR                      StartVa;
+    PUCHAR                      BaseVa;
     PIP_HEADER                  IpHeader;
 
     Receiver = Ring->Receiver;
@@ -490,11 +494,13 @@ ReceiverRingProcessChecksum(
     if (Info->IpHeader.Length == 0)
         return;
 
-    StartVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl, NormalPagePriority);
-    ASSERT(StartVa != NULL);
-    StartVa += Packet->Offset;
+    ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Packet->Mdl.MappedSystemVa;
+    ASSERT(BaseVa != NULL);
+
+    BaseVa += Packet->Offset;
 
-    IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+    IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
 
     if (IpHeader->Version == 4) {
         BOOLEAN OffloadChecksum;
@@ -511,7 +517,7 @@ ReceiverRingProcessChecksum(
 
             Embedded = IpHeader->Version4.Checksum;
 
-            Calculated = ChecksumIpVersion4Header(StartVa, Info);
+            Calculated = ChecksumIpVersion4Header(BaseVa, Info);
 
             if (ChecksumVerify(Calculated, Embedded))
                 Packet->Flags.IpChecksumSucceeded = 1;
@@ -526,7 +532,7 @@ ReceiverRingProcessChecksum(
         PTCP_HEADER     TcpHeader;
         BOOLEAN         OffloadChecksum;
 
-        TcpHeader = (PTCP_HEADER)(StartVa + Info->TcpHeader.Offset);
+        TcpHeader = (PTCP_HEADER)(BaseVa + Info->TcpHeader.Offset);
 
         if (IpHeader->Version == 4 && 
Ring->OffloadOptions.OffloadIpVersion4TcpChecksum)
             OffloadChecksum = TRUE;
@@ -546,8 +552,8 @@ ReceiverRingProcessChecksum(
 
                 Embedded = TcpHeader->Checksum;
 
-                Calculated = ChecksumPseudoHeader(StartVa, Info);
-                Calculated = ChecksumTcpPacket(StartVa, Info, Calculated, 
&Payload);
+                Calculated = ChecksumPseudoHeader(BaseVa, Info);
+                Calculated = ChecksumTcpPacket(BaseVa, Info, Calculated, 
&Payload);
 
                 if (ChecksumVerify(Calculated, Embedded))
                     Packet->Flags.TcpChecksumSucceeded = 1;
@@ -563,8 +569,8 @@ ReceiverRingProcessChecksum(
             (flags & NETRXF_data_validated)) {
             USHORT  Calculated;
 
-            Calculated = ChecksumPseudoHeader(StartVa, Info);
-            Calculated = ChecksumTcpPacket(StartVa, Info, Calculated, 
&Payload);
+            Calculated = ChecksumPseudoHeader(BaseVa, Info);
+            Calculated = ChecksumTcpPacket(BaseVa, Info, Calculated, &Payload);
 
             TcpHeader->Checksum = Calculated;
         }
@@ -572,7 +578,7 @@ ReceiverRingProcessChecksum(
         PUDP_HEADER     UdpHeader;
         BOOLEAN         OffloadChecksum;
 
-        UdpHeader = (PUDP_HEADER)(StartVa + Info->UdpHeader.Offset);
+        UdpHeader = (PUDP_HEADER)(BaseVa + Info->UdpHeader.Offset);
 
         if (IpHeader->Version == 4 && 
Ring->OffloadOptions.OffloadIpVersion4UdpChecksum)
             OffloadChecksum = TRUE;
@@ -597,8 +603,8 @@ ReceiverRingProcessChecksum(
                 } else {
                     USHORT  Calculated;
 
-                    Calculated = ChecksumPseudoHeader(StartVa, Info);
-                    Calculated = ChecksumUdpPacket(StartVa, Info, Calculated, 
&Payload);
+                    Calculated = ChecksumPseudoHeader(BaseVa, Info);
+                    Calculated = ChecksumUdpPacket(BaseVa, Info, Calculated, 
&Payload);
 
                     if (ChecksumVerify(Calculated, Embedded))
                         Packet->Flags.UdpChecksumSucceeded = 1;
@@ -615,8 +621,8 @@ ReceiverRingProcessChecksum(
             (flags & NETRXF_data_validated)) {
             USHORT  Calculated;
 
-            Calculated = ChecksumPseudoHeader(StartVa, Info);
-            Calculated = ChecksumUdpPacket(StartVa, Info, Calculated, 
&Payload);
+            Calculated = ChecksumPseudoHeader(BaseVa, Info);
+            Calculated = ChecksumUdpPacket(BaseVa, Info, Calculated, &Payload);
 
             UdpHeader->Checksum = Calculated;
         }
@@ -645,7 +651,8 @@ ReceiverRingPullup(
         PUCHAR  SourceVa;
         ULONG   CopyLength;
 
-        SourceVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
+        ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+        SourceVa = Mdl->MappedSystemVa;
         ASSERT(SourceVa != NULL);
 
         CopyLength = __min(Mdl->ByteCount, Length);
@@ -655,7 +662,7 @@ ReceiverRingPullup(
         DestinationVa += CopyLength;
 
         Mdl->ByteOffset += CopyLength;
-        Mdl->MappedSystemVa = (PUCHAR)Mdl->MappedSystemVa + CopyLength;
+        Mdl->MappedSystemVa = SourceVa + CopyLength;
         Length -= CopyLength;
 
         Mdl->ByteCount -= CopyLength;
@@ -686,12 +693,13 @@ __ReceiverRingPullupPacket(
     IN  PXENVIF_RECEIVER_PACKET Packet
     )
 {
-    PUCHAR                      StartVa;
+    PUCHAR                      BaseVa;
     XENVIF_PACKET_PAYLOAD       Payload;
     ULONG                       Length;
 
-    StartVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl, NormalPagePriority);
-    ASSERT(StartVa != NULL);
+    ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Packet->Mdl.MappedSystemVa;
+    ASSERT(BaseVa != NULL);
 
     Payload.Mdl = Packet->Mdl.Next;
     Payload.Offset = 0;
@@ -701,7 +709,7 @@ __ReceiverRingPullupPacket(
 
     Packet->Mdl.Next = NULL;
 
-    (VOID) ReceiverRingPullup(Ring, StartVa + Packet->Mdl.ByteCount, &Payload, 
Length);
+    (VOID) ReceiverRingPullup(Ring, BaseVa + Packet->Mdl.ByteCount, &Payload, 
Length);
     Packet->Mdl.ByteCount += Length;
 
     if (Payload.Length != 0) {
@@ -723,7 +731,7 @@ __ReceiverRingBuildSegment(
     PXENVIF_RECEIVER_PACKET     Segment;
     PMDL                        Mdl;
     PUCHAR                      InfoVa;
-    PUCHAR                      StartVa;
+    PUCHAR                      BaseVa;
     PIP_HEADER                  IpHeader;
     PTCP_HEADER                 TcpHeader;
     ULONG                       Seq;
@@ -733,8 +741,10 @@ __ReceiverRingBuildSegment(
 
     Info = &Packet->Info;
 
-    InfoVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl, NormalPagePriority);
+    ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    InfoVa = Packet->Mdl.MappedSystemVa;
     ASSERT(InfoVa != NULL);
+
     InfoVa += Packet->Offset;
 
     Segment = __ReceiverRingGetPacket(Ring, TRUE);
@@ -754,14 +764,16 @@ __ReceiverRingBuildSegment(
 
     Mdl = &Segment->Mdl;
 
-    StartVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-    ASSERT(StartVa != NULL);
-    StartVa += Segment->Offset;
+    ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Mdl->MappedSystemVa;
+    ASSERT(BaseVa != NULL);
+
+    BaseVa += Segment->Offset;
 
     Mdl->ByteCount = Segment->Offset;
 
     // Copy in the header
-    RtlCopyMemory(StartVa, InfoVa, Info->Length);
+    RtlCopyMemory(BaseVa, InfoVa, Info->Length);
     Mdl->ByteCount += Info->Length;
 
     // Adjust the info for the next segment
@@ -792,7 +804,7 @@ __ReceiverRingBuildSegment(
     TcpHeader->Flags &= ~TCP_CWR;
 
     // Adjust the segment IP header
-    IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+    IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
     if (IpHeader->Version == 4) {
         ULONG   PacketLength;
 
@@ -803,7 +815,7 @@ __ReceiverRingBuildSegment(
                        SegmentSize;
 
         IpHeader->Version4.PacketLength = HTONS((USHORT)PacketLength);
-        IpHeader->Version4.Checksum = ChecksumIpVersion4Header(StartVa, Info);
+        IpHeader->Version4.Checksum = ChecksumIpVersion4Header(BaseVa, Info);
     } else {
         ULONG   PayloadLength;
 
@@ -818,7 +830,7 @@ __ReceiverRingBuildSegment(
     }
 
     // Adjust the segment TCP header
-    TcpHeader = (PTCP_HEADER)(StartVa + Info->TcpHeader.Offset);
+    TcpHeader = (PTCP_HEADER)(BaseVa + Info->TcpHeader.Offset);
 
     TcpHeader->Flags &= ~(TCP_PSH | TCP_FIN);
 
@@ -833,18 +845,20 @@ __ReceiverRingBuildSegment(
             goto fail2;
 
         Mdl = Mdl->Next;
-        StartVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-        ASSERT(StartVa != NULL);
+
+        ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+        BaseVa = Mdl->MappedSystemVa;
+        ASSERT(BaseVa != NULL);
 
         Mdl->ByteOffset = Ring->BackfillSize;
 
-        StartVa += Ring->BackfillSize;
-        Mdl->MappedSystemVa = StartVa;
+        BaseVa += Ring->BackfillSize;
+        Mdl->MappedSystemVa = BaseVa;
 
         Length = __min(SegmentSize - Segment->Length, PAGE_SIZE - 
Mdl->ByteOffset);
         ASSERT(Length != 0);
 
-        (VOID) ReceiverRingPullup(Ring, StartVa, Payload, Length);
+        (VOID) ReceiverRingPullup(Ring, BaseVa, Payload, Length);
         Mdl->ByteCount += Length;
         Segment->Length += Length;
 
@@ -922,8 +936,10 @@ ReceiverRingProcessLargePacket(
 
     Packet->Mdl.Next = NULL;
 
-    InfoVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl, NormalPagePriority);
+    ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    InfoVa = Packet->Mdl.MappedSystemVa;
     ASSERT(InfoVa != NULL);
+
     InfoVa += Packet->Offset;
 
     IpHeader = (PIP_HEADER)(InfoVa + Info->IpHeader.Offset);
@@ -1103,7 +1119,7 @@ ReceiverRingProcessStandardPacket(
         __ReceiverRingPullupPacket(Ring, Packet);
     else if (Payload.Mdl != NULL && Payload.Mdl->ByteOffset < 
Ring->BackfillSize) {
         PMDL    Mdl;
-        PUCHAR  StartVa;
+        PUCHAR  BaseVa;
 
         // NDIS Header/Data split requires that the data MDL has a minimum 
length
         // of headroom (i.e. ByteOffset) so that it can pre-pend the header to 
the data
@@ -1115,17 +1131,18 @@ ReceiverRingProcessStandardPacket(
         if (Mdl == NULL)
             goto fail2;
 
-        StartVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-        ASSERT(StartVa != NULL);
+        ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+        BaseVa = Mdl->MappedSystemVa;
+        ASSERT(BaseVa != NULL);
 
         Mdl->ByteOffset = Ring->BackfillSize;
         Mdl->ByteCount = __min(Payload.Mdl->ByteCount,
                                PAGE_SIZE - Mdl->ByteOffset);
 
-        StartVa += Ring->BackfillSize;
-        Mdl->MappedSystemVa = StartVa;
+        BaseVa += Ring->BackfillSize;
+        Mdl->MappedSystemVa = BaseVa;
 
-        (VOID) ReceiverRingPullup(Ring, StartVa, &Payload, Mdl->ByteCount);
+        (VOID) ReceiverRingPullup(Ring, BaseVa, &Payload, Mdl->ByteCount);
 
         if (Payload.Length != 0) {
             ASSERT(Payload.Mdl != NULL);
@@ -1181,7 +1198,7 @@ ReceiverRingProcessPacket(
     XENVIF_PACKET_PAYLOAD           Payload;
     PXENVIF_RECEIVER_PACKET         New;
     PXENVIF_PACKET_INFO             Info;
-    PUCHAR                          StartVa;
+    PUCHAR                          BaseVa;
     PETHERNET_HEADER                EthernetHeader;
     PETHERNET_ADDRESS               DestinationAddress;
     NTSTATUS                        status;
@@ -1220,15 +1237,17 @@ ReceiverRingProcessPacket(
     // Override offset to align
     Packet->Offset = Receiver->IpAlignOffset;
 
-    StartVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl, NormalPagePriority);
-    ASSERT(StartVa != NULL);
-    StartVa += Packet->Offset;
+    ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Packet->Mdl.MappedSystemVa;
+    ASSERT(BaseVa != NULL);
+
+    BaseVa += Packet->Offset;
 
     Packet->Mdl.ByteCount = Packet->Offset;
 
     Info = &Packet->Info;
 
-    status = ParsePacket(StartVa, ReceiverRingPullup, Ring, &Payload, Info);
+    status = ParsePacket(BaseVa, ReceiverRingPullup, Ring, &Payload, Info);
     if (!NT_SUCCESS(status)) {
         FrontendIncrementStatistic(Frontend,
                                    XENVIF_RECEIVER_FRONTEND_ERRORS,
@@ -1246,7 +1265,7 @@ ReceiverRingProcessPacket(
     }
 
     ASSERT(Info->EthernetHeader.Length != 0);
-    EthernetHeader = (PETHERNET_HEADER)(StartVa + Info->EthernetHeader.Offset);
+    EthernetHeader = (PETHERNET_HEADER)(BaseVa + Info->EthernetHeader.Offset);
 
     DestinationAddress = &EthernetHeader->DestinationAddress;
 
@@ -1383,7 +1402,7 @@ __ReceiverRingReleaseLock(
         PLIST_ENTRY             ListEntry;
         PXENVIF_RECEIVER_PACKET Packet;
         PXENVIF_PACKET_INFO     Info;
-        PUCHAR                  StartVa;
+        PUCHAR                  BaseVa;
         PETHERNET_HEADER        EthernetHeader;
         PETHERNET_ADDRESS       DestinationAddress;
         ETHERNET_ADDRESS_TYPE   Type;
@@ -1400,15 +1419,16 @@ __ReceiverRingReleaseLock(
                                    XENVIF_RECEIVER_PACKET,
                                    ListEntry);
 
-        StartVa = MmGetSystemAddressForMdlSafe(&Packet->Mdl,
-                                               NormalPagePriority);
-        ASSERT(StartVa != NULL);
-        StartVa += Packet->Offset;
+        ASSERT(Packet->Mdl.MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+        BaseVa = Packet->Mdl.MappedSystemVa;
+        ASSERT(BaseVa != NULL);
+
+        BaseVa += Packet->Offset;
 
         Info = &Packet->Info;
 
         ASSERT(Info->EthernetHeader.Length != 0);
-        EthernetHeader = (PETHERNET_HEADER)(StartVa + 
Info->EthernetHeader.Offset);
+        EthernetHeader = (PETHERNET_HEADER)(BaseVa + 
Info->EthernetHeader.Offset);
 
         DestinationAddress = &EthernetHeader->DestinationAddress;
 
@@ -1458,7 +1478,7 @@ __ReceiverRingReleaseLock(
                                        1);
 
         if (Info->IpHeader.Length != 0) {
-            PIP_HEADER  IpHeader = (PIP_HEADER)(StartVa + 
Info->IpHeader.Offset);
+            PIP_HEADER  IpHeader = (PIP_HEADER)(BaseVa + 
Info->IpHeader.Offset);
 
             if (IpHeader->Version == 4) {
                 FrontendIncrementStatistic(Frontend,
@@ -2043,18 +2063,18 @@ ReceiverRingPoll(
 
                 Extra = (extra->flags & XEN_NETIF_EXTRA_FLAG_MORE) ? TRUE : 
FALSE;
             } else {
-                PUCHAR  StartVa;
+                PUCHAR  BaseVa;
 
                 ASSERT3U(rsp->id, ==, id);
 
-                StartVa = MmGetSystemAddressForMdlSafe(Mdl,
-                                                       NormalPagePriority);
-                ASSERT(StartVa != NULL);
+                ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+                BaseVa = Mdl->MappedSystemVa;
+                ASSERT(BaseVa != NULL);
 
                 Mdl->ByteOffset = rsp->offset;
 
-                StartVa += rsp->offset;
-                Mdl->MappedSystemVa = StartVa;
+                BaseVa += rsp->offset;
+                Mdl->MappedSystemVa = BaseVa;
 
                 Mdl->ByteCount = rsp->status;
 
@@ -2554,7 +2574,8 @@ __ReceiverRingConnect(
     if (Ring->Mdl == NULL)
         goto fail3;
 
-    Ring->Shared = MmGetSystemAddressForMdlSafe(Ring->Mdl, NormalPagePriority);
+    ASSERT(Ring->Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    Ring->Shared = Ring->Mdl->MappedSystemVa;
     ASSERT(Ring->Shared != NULL);
 
     SHARED_RING_INIT(Ring->Shared);
diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c
index 6bb12aa..ea165d6 100644
--- a/src/xenvif/transmitter.c
+++ b/src/xenvif/transmitter.c
@@ -373,7 +373,6 @@ TransmitterBufferCtor(
 {
     PXENVIF_TRANSMITTER_BUFFER  Buffer = Object;
     PMDL                               Mdl;
-    PUCHAR                             MdlMappedSystemVa;
     NTSTATUS                   status;
 
     UNREFERENCED_PARAMETER(Argument);
@@ -386,10 +385,6 @@ TransmitterBufferCtor(
     if (Mdl == NULL)
        goto fail1;
 
-    MdlMappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-    ASSERT(MdlMappedSystemVa != NULL);
-    RtlFillMemory(MdlMappedSystemVa, PAGE_SIZE, 0xAA);
-
     Mdl->ByteCount = 0;
     Buffer->Mdl = Mdl;
 
@@ -808,22 +803,22 @@ TransmitterPullup(
     Payload->Length -= Length;
 
     while (Length != 0) {
-        PUCHAR  MdlMappedSystemVa;
+        PUCHAR  SourceVa;
         ULONG   MdlByteCount;
         ULONG   CopyLength;
 
         ASSERT(Mdl != NULL);
 
-        MdlMappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, 
NormalPagePriority);
-        ASSERT(MdlMappedSystemVa != NULL);
+        SourceVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
+        ASSERT(SourceVa != NULL);
 
-        MdlMappedSystemVa += Offset;
+        SourceVa += Offset;
 
         MdlByteCount = Mdl->ByteCount - Offset;
 
         CopyLength = __min(MdlByteCount, Length);
 
-        RtlCopyMemory(DestinationVa, MdlMappedSystemVa, CopyLength);
+        RtlCopyMemory(DestinationVa, SourceVa, CopyLength);
         DestinationVa += CopyLength;
 
         Offset += CopyLength;
@@ -872,7 +867,7 @@ __TransmitterRingCopyPayload(
     while (Payload.Length != 0) {
         PMDL        Mdl;
         ULONG       Length;
-        PUCHAR      MdlMappedSystemVa;
+        PUCHAR      BaseVa;
         PFN_NUMBER  Pfn;
 
         Buffer = __TransmitterGetBuffer(Ring);
@@ -888,8 +883,11 @@ __TransmitterRingCopyPayload(
 
         Length = __min(Payload.Length, PAGE_SIZE);
 
-        MdlMappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, 
NormalPagePriority);
-        (VOID) TransmitterPullup(Transmitter, MdlMappedSystemVa, &Payload, 
Length);
+        ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+        BaseVa = Mdl->MappedSystemVa;
+        ASSERT(BaseVa != NULL);
+
+        (VOID) TransmitterPullup(Transmitter, BaseVa, &Payload, Length);
 
         Mdl->ByteCount = Length;
 
@@ -1170,7 +1168,7 @@ __TransmitterRingPrepareHeader(
     PXENVIF_TRANSMITTER_FRAGMENT    Fragment;
     PXENVIF_TRANSMITTER_BUFFER      Buffer;
     PMDL                            Mdl;
-    PUCHAR                          StartVa;
+    PUCHAR                          BaseVa;
     PFN_NUMBER                      Pfn;
     PETHERNET_HEADER                EthernetHeader;
     BOOLEAN                         SquashError;
@@ -1205,10 +1203,11 @@ __TransmitterRingPrepareHeader(
 
     Mdl = Buffer->Mdl;
 
-    StartVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-    ASSERT(StartVa != NULL);
+    ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Mdl->MappedSystemVa;
+    ASSERT(BaseVa != NULL);
 
-    RtlCopyMemory(StartVa, Packet->Header, Info->Length);
+    RtlCopyMemory(BaseVa, Packet->Header, Info->Length);
 
     Mdl->ByteCount = Info->Length;
 
@@ -1244,7 +1243,7 @@ __TransmitterRingPrepareHeader(
     State->Count++;
 
     ASSERT(Info->EthernetHeader.Length != 0);
-    EthernetHeader = (PETHERNET_HEADER)(StartVa + 
Info->EthernetHeader.Offset);        
+    EthernetHeader = (PETHERNET_HEADER)(BaseVa + Info->EthernetHeader.Offset);
 
     if (Packet->OffloadOptions.OffloadTagManipulation) {
         ULONG   Offset;
@@ -1292,10 +1291,10 @@ __TransmitterRingPrepareHeader(
         ASSERT(!Info->IsAFragment);
 
         ASSERT(Info->IpHeader.Length != 0);
-        IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+        IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
 
         ASSERT(Info->TcpHeader.Length != 0);
-        TcpHeader = (PTCP_HEADER)(StartVa + Info->TcpHeader.Offset);
+        TcpHeader = (PTCP_HEADER)(BaseVa + Info->TcpHeader.Offset);
 
         // Fix up the IP packet length
         Length = Info->IpHeader.Length +
@@ -1331,10 +1330,10 @@ __TransmitterRingPrepareHeader(
         ASSERT(!Info->IsAFragment);
 
         ASSERT(Info->IpHeader.Length != 0);
-        IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+        IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
 
         ASSERT(Info->TcpHeader.Length != 0);
-        TcpHeader = (PTCP_HEADER)(StartVa + Info->TcpHeader.Offset);
+        TcpHeader = (PTCP_HEADER)(BaseVa + Info->TcpHeader.Offset);
 
         // Fix up the IP payload length
         Length = Info->IpOptions.Length + 
@@ -1375,11 +1374,11 @@ __TransmitterRingPrepareHeader(
     if (Info->IpHeader.Length != 0) {
         PIP_HEADER  IpHeader;
 
-        IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+        IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
 
         if (IpHeader->Version == 4) {
             if (Packet->OffloadOptions.OffloadIpVersion4HeaderChecksum) {
-                IpHeader->Version4.Checksum = 
ChecksumIpVersion4Header(StartVa, Info);
+                IpHeader->Version4.Checksum = ChecksumIpVersion4Header(BaseVa, 
Info);
 
                 Packet->Flags.IpChecksumNotValidated = 1;
             } else if (Transmitter->ValidateChecksums != 0) {
@@ -1388,7 +1387,7 @@ __TransmitterRingPrepareHeader(
 
                 Embedded = IpHeader->Version4.Checksum;
 
-                Calculated = ChecksumIpVersion4Header(StartVa, Info);
+                Calculated = ChecksumIpVersion4Header(BaseVa, Info);
 
                 if (ChecksumVerify(Calculated, Embedded))
                     Packet->Flags.IpChecksumSucceeded = 1;
@@ -1403,11 +1402,11 @@ __TransmitterRingPrepareHeader(
     if (Info->TcpHeader.Length != 0) {
         PTCP_HEADER TcpHeader;
 
-        TcpHeader = (PTCP_HEADER)(StartVa + Info->TcpHeader.Offset);
+        TcpHeader = (PTCP_HEADER)(BaseVa + Info->TcpHeader.Offset);
 
         if (Packet->OffloadOptions.OffloadIpVersion4TcpChecksum ||
             Packet->OffloadOptions.OffloadIpVersion6TcpChecksum) {
-            TcpHeader->Checksum = ChecksumPseudoHeader(StartVa, Info);
+            TcpHeader->Checksum = ChecksumPseudoHeader(BaseVa, Info);
 
             Packet->Flags.TcpChecksumNotValidated = 1;
         } else if (Transmitter->ValidateChecksums != 0) {
@@ -1416,8 +1415,8 @@ __TransmitterRingPrepareHeader(
 
             Embedded = TcpHeader->Checksum;
 
-            Calculated = ChecksumPseudoHeader(StartVa, Info);
-            Calculated = ChecksumTcpPacket(StartVa, Info, Calculated, Payload);
+            Calculated = ChecksumPseudoHeader(BaseVa, Info);
+            Calculated = ChecksumTcpPacket(BaseVa, Info, Calculated, Payload);
 
             if (ChecksumVerify(Calculated, Embedded))
                 Packet->Flags.TcpChecksumSucceeded = 1;
@@ -1431,11 +1430,11 @@ __TransmitterRingPrepareHeader(
     if (Info->UdpHeader.Length != 0) {
         PUDP_HEADER UdpHeader;
 
-        UdpHeader = (PUDP_HEADER)(StartVa + Info->UdpHeader.Offset);
+        UdpHeader = (PUDP_HEADER)(BaseVa + Info->UdpHeader.Offset);
 
         if (Packet->OffloadOptions.OffloadIpVersion4UdpChecksum ||
             Packet->OffloadOptions.OffloadIpVersion6UdpChecksum) {
-            UdpHeader->Checksum = ChecksumPseudoHeader(StartVa, Info);
+            UdpHeader->Checksum = ChecksumPseudoHeader(BaseVa, Info);
 
             Packet->Flags.UdpChecksumNotValidated = 1;
         } else if (Transmitter->ValidateChecksums != 0) {
@@ -1443,7 +1442,7 @@ __TransmitterRingPrepareHeader(
             USHORT      Embedded;
 
             ASSERT(Info->IpHeader.Length != 0);
-            IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+            IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
 
             Embedded = UdpHeader->Checksum;
 
@@ -1453,8 +1452,8 @@ __TransmitterRingPrepareHeader(
             } else {
                 USHORT  Calculated;
 
-                Calculated = ChecksumPseudoHeader(StartVa, Info);
-                Calculated = ChecksumUdpPacket(StartVa, Info, Calculated, 
Payload);
+                Calculated = ChecksumPseudoHeader(BaseVa, Info);
+                Calculated = ChecksumUdpPacket(BaseVa, Info, Calculated, 
Payload);
 
                 if (ChecksumVerify(Calculated, Embedded))
                     Packet->Flags.UdpChecksumSucceeded = 1;
@@ -1688,7 +1687,7 @@ __TransmitterRingPreparePacket(
             PXENVIF_TRANSMITTER_FRAGMENT    Fragment;
             PXENVIF_TRANSMITTER_BUFFER      Buffer;
             PMDL                            Mdl;
-            PUCHAR                          MdlMappedSystemVa;
+            PUCHAR                          BaseVa;
 
             // Add padding to the tail buffer
             ListEntry = State->List.Blink;
@@ -1701,12 +1700,13 @@ __TransmitterRingPreparePacket(
 
             ASSERT3U(Mdl->ByteCount, <=, PAGE_SIZE - Trailer);
 
-            MdlMappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, 
NormalPagePriority);
-            ASSERT(MdlMappedSystemVa != NULL);
+            ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+            BaseVa = Mdl->MappedSystemVa;
+            ASSERT(BaseVa != NULL);
 
-            MdlMappedSystemVa += Mdl->ByteCount;
+            BaseVa += Mdl->ByteCount;
 
-            RtlZeroMemory(MdlMappedSystemVa, Trailer);
+            RtlZeroMemory(BaseVa, Trailer);
             Mdl->ByteCount += Trailer;
 
             if (!SingleFragment) {
@@ -1768,7 +1768,7 @@ __TransmitterRingPrepareArp(
     PXENVIF_TRANSMITTER_FRAGMENT    Fragment;
     PXENVIF_TRANSMITTER_BUFFER      Buffer;
     PMDL                            Mdl;
-    PUCHAR                          MdlMappedSystemVa;
+    PUCHAR                          BaseVa;
     PETHERNET_UNTAGGED_HEADER       EthernetHeader;
     PARP_HEADER                     ArpHeader;
     ETHERNET_ADDRESS                SenderHardwareAddress;
@@ -1799,18 +1799,19 @@ __TransmitterRingPrepareArp(
 
     Mdl = Buffer->Mdl;
 
-    MdlMappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
-    ASSERT(MdlMappedSystemVa != NULL);
+    ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Mdl->MappedSystemVa;
+    ASSERT(BaseVa != NULL);
 
-    EthernetHeader = (PETHERNET_UNTAGGED_HEADER)MdlMappedSystemVa;
+    EthernetHeader = (PETHERNET_UNTAGGED_HEADER)BaseVa;
 
     MacQueryBroadcastAddress(Mac, &EthernetHeader->DestinationAddress);
     MacQueryCurrentAddress(Mac, &EthernetHeader->SourceAddress);
     EthernetHeader->TypeOrLength = HTONS(ETHERTYPE_ARP);
 
-    MdlMappedSystemVa += sizeof (ETHERNET_UNTAGGED_HEADER);
+    BaseVa += sizeof (ETHERNET_UNTAGGED_HEADER);
 
-    ArpHeader = (PARP_HEADER)MdlMappedSystemVa;
+    ArpHeader = (PARP_HEADER)BaseVa;
 
     ArpHeader->HardwareType = HTONS(HARDWARE_ETHER);
     ArpHeader->ProtocolType = HTONS(PROTOCOL_IPV4);
@@ -1818,21 +1819,21 @@ __TransmitterRingPrepareArp(
     ArpHeader->ProtocolAddressLength = IPV4_ADDRESS_LENGTH;
     ArpHeader->Operation = HTONS(ARP_REQUEST);
 
-    MdlMappedSystemVa += sizeof (ARP_HEADER);
+    BaseVa += sizeof (ARP_HEADER);
 
-    RtlCopyMemory(MdlMappedSystemVa, SenderHardwareAddress.Byte, 
ETHERNET_ADDRESS_LENGTH);
-    MdlMappedSystemVa += ETHERNET_ADDRESS_LENGTH;
+    RtlCopyMemory(BaseVa, SenderHardwareAddress.Byte, ETHERNET_ADDRESS_LENGTH);
+    BaseVa += ETHERNET_ADDRESS_LENGTH;
 
-    RtlCopyMemory(MdlMappedSystemVa, SenderProtocolAddress.Byte, 
IPV4_ADDRESS_LENGTH);
-    MdlMappedSystemVa += IPV4_ADDRESS_LENGTH;
+    RtlCopyMemory(BaseVa, SenderProtocolAddress.Byte, IPV4_ADDRESS_LENGTH);
+    BaseVa += IPV4_ADDRESS_LENGTH;
 
-    RtlCopyMemory(MdlMappedSystemVa, TargetHardwareAddress.Byte, 
ETHERNET_ADDRESS_LENGTH);
-    MdlMappedSystemVa += ETHERNET_ADDRESS_LENGTH;
+    RtlCopyMemory(BaseVa, TargetHardwareAddress.Byte, ETHERNET_ADDRESS_LENGTH);
+    BaseVa += ETHERNET_ADDRESS_LENGTH;
 
-    RtlCopyMemory(MdlMappedSystemVa, TargetProtocolAddress.Byte, 
IPV4_ADDRESS_LENGTH);
-    MdlMappedSystemVa += IPV4_ADDRESS_LENGTH;
+    RtlCopyMemory(BaseVa, TargetProtocolAddress.Byte, IPV4_ADDRESS_LENGTH);
+    BaseVa += IPV4_ADDRESS_LENGTH;
 
-    Mdl->ByteCount = (ULONG)(MdlMappedSystemVa - 
(PUCHAR)MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority));
+    Mdl->ByteCount = (ULONG)(BaseVa - (PUCHAR)(Mdl->MappedSystemVa));
 
     Fragment = __TransmitterGetFragment(Ring);
 
@@ -1909,7 +1910,7 @@ __TransmitterRingPrepareNeighbourAdvertisement(
     PXENVIF_TRANSMITTER_FRAGMENT    Fragment;
     PXENVIF_TRANSMITTER_BUFFER      Buffer;
     PMDL                            Mdl;
-    PUCHAR                          MdlMappedSystemVa;
+    PUCHAR                          BaseVa;
     PETHERNET_UNTAGGED_HEADER       EthernetHeader;
     PIPV6_HEADER                    IpHeader;
     PICMPV6_HEADER                  IcmpHeader;
@@ -1939,18 +1940,19 @@ __TransmitterRingPrepareNeighbourAdvertisement(
 
     Mdl = Buffer->Mdl;
 
-    MdlMappedSystemVa = MmGetSystemAddressForMdlSafe(Buffer->Mdl, 
NormalPagePriority);
-    ASSERT(MdlMappedSystemVa != NULL);
+    ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    BaseVa = Mdl->MappedSystemVa;
+    ASSERT(BaseVa != NULL);
 
-    EthernetHeader = (PETHERNET_UNTAGGED_HEADER)MdlMappedSystemVa;
+    EthernetHeader = (PETHERNET_UNTAGGED_HEADER)BaseVa;
 
     MacQueryBroadcastAddress(Mac, &EthernetHeader->DestinationAddress);
     MacQueryCurrentAddress(Mac, &EthernetHeader->SourceAddress);
     EthernetHeader->TypeOrLength = HTONS(ETHERTYPE_IPV6);
 
-    MdlMappedSystemVa += sizeof (ETHERNET_UNTAGGED_HEADER);
+    BaseVa += sizeof (ETHERNET_UNTAGGED_HEADER);
 
-    IpHeader = (PIPV6_HEADER)MdlMappedSystemVa;
+    IpHeader = (PIPV6_HEADER)BaseVa;
     RtlZeroMemory(IpHeader, sizeof (IPV6_HEADER));
 
     IpHeader->Version = 6;
@@ -1967,28 +1969,28 @@ __TransmitterRingPrepareNeighbourAdvertisement(
     IpHeader->DestinationAddress.Byte[15] = 0x02;
 
     PayloadLength = 0;
-    MdlMappedSystemVa += sizeof (IPV6_HEADER);
+    BaseVa += sizeof (IPV6_HEADER);
 
-    IcmpHeader = (PICMPV6_HEADER)MdlMappedSystemVa;
+    IcmpHeader = (PICMPV6_HEADER)BaseVa;
 
     IcmpHeader->Type = ICMPV6_TYPE_NA;
     IcmpHeader->Code = 0;
     IcmpHeader->Data = HTONL(0x02); // Override flag
 
     PayloadLength += sizeof (ICMPV6_HEADER);
-    MdlMappedSystemVa += sizeof (ICMPV6_HEADER);
+    BaseVa += sizeof (ICMPV6_HEADER);
 
-    RtlCopyMemory(MdlMappedSystemVa, TargetProtocolAddress.Byte, 
IPV6_ADDRESS_LENGTH);
+    RtlCopyMemory(BaseVa, TargetProtocolAddress.Byte, IPV6_ADDRESS_LENGTH);
 
     PayloadLength += IPV6_ADDRESS_LENGTH;
-    MdlMappedSystemVa += IPV6_ADDRESS_LENGTH;
+    BaseVa += IPV6_ADDRESS_LENGTH;
 
-    RtlCopyMemory(MdlMappedSystemVa, SenderHardwareAddress.Byte, 
ETHERNET_ADDRESS_LENGTH);
+    RtlCopyMemory(BaseVa, SenderHardwareAddress.Byte, ETHERNET_ADDRESS_LENGTH);
 
     PayloadLength += ETHERNET_ADDRESS_LENGTH;
-    MdlMappedSystemVa += ETHERNET_ADDRESS_LENGTH;
+    BaseVa += ETHERNET_ADDRESS_LENGTH;
 
-    Mdl->ByteCount = (ULONG)(MdlMappedSystemVa - 
(PUCHAR)MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority));
+    Mdl->ByteCount = (ULONG)(BaseVa - (PUCHAR)(Mdl->MappedSystemVa));
 
     // Fix up IP payload length and ICMPv6 checksum
     IpHeader->PayloadLength = HTONS(PayloadLength);
@@ -2452,7 +2454,7 @@ __TransmitterRingCompletePacket(
     PXENVIF_FRONTEND                Frontend;
     PXENVIF_PACKET_PAYLOAD          Payload;
     PXENVIF_PACKET_INFO             Info;
-    PUCHAR                          StartVa;
+    PUCHAR                          BaseVa;
     PETHERNET_HEADER                EthernetHeader;
     PETHERNET_ADDRESS               DestinationAddress;
     ETHERNET_ADDRESS_TYPE           Type;
@@ -2475,12 +2477,12 @@ __TransmitterRingCompletePacket(
         goto done;
     }
 
-    StartVa = Packet->Header;
+    BaseVa = Packet->Header;
     Info = &Packet->Info;
     Payload = &Packet->Payload;
 
     ASSERT(Info->EthernetHeader.Length != 0);
-    EthernetHeader = (PETHERNET_HEADER)(StartVa + Info->EthernetHeader.Offset);
+    EthernetHeader = (PETHERNET_HEADER)(BaseVa + Info->EthernetHeader.Offset);
 
     DestinationAddress = &EthernetHeader->DestinationAddress;
 
@@ -2530,7 +2532,7 @@ __TransmitterRingCompletePacket(
                                    1);
 
     if (Info->IpHeader.Length != 0) {
-        PIP_HEADER  IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+        PIP_HEADER  IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
 
         if (IpHeader->Version == 4) {
             FrontendIncrementStatistic(Frontend,
@@ -3731,7 +3733,8 @@ __TransmitterRingConnect(
     if (Ring->Mdl == NULL)
         goto fail3;
 
-    Ring->Shared = MmGetSystemAddressForMdlSafe(Ring->Mdl, NormalPagePriority);
+    ASSERT(Ring->Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    Ring->Shared = Ring->Mdl->MappedSystemVa;
     ASSERT(Ring->Shared != NULL);
 
     SHARED_RING_INIT(Ring->Shared);
@@ -5065,14 +5068,14 @@ __TransmitterHashPacket(
     )
 {
     PXENVIF_FRONTEND                Frontend;
-    PUCHAR                          StartVa;
+    PUCHAR                          BaseVa;
     PXENVIF_PACKET_INFO             Info;
     PIP_HEADER                      IpHeader;
     ULONG                           Value;
 
     Frontend = Transmitter->Frontend;
 
-    StartVa = Packet->Header;
+    BaseVa = Packet->Header;
     Info = &Packet->Info;
 
     if (Info->IpHeader.Length == 0) {
@@ -5080,7 +5083,7 @@ __TransmitterHashPacket(
         goto done;
     }
 
-    IpHeader = (PIP_HEADER)(StartVa + Info->IpHeader.Offset);
+    IpHeader = (PIP_HEADER)(BaseVa + Info->IpHeader.Offset);
 
     Value = 0;
 
@@ -5112,7 +5115,7 @@ __TransmitterHashPacket(
     if (Info->TcpHeader.Length != 0) {
         PTCP_HEADER TcpHeader;
 
-        TcpHeader = (PTCP_HEADER)(StartVa + Info->TcpHeader.Offset);
+        TcpHeader = (PTCP_HEADER)(BaseVa + Info->TcpHeader.Offset);
 
         __TransmitterHashAccumulate(&Value,
                                     (PUCHAR)&TcpHeader->SourcePort,
@@ -5125,7 +5128,7 @@ __TransmitterHashPacket(
 
         ASSERT(Info->UdpHeader.Length != 0);
 
-        UdpHeader = (PUDP_HEADER)(StartVa + Info->UdpHeader.Offset);
+        UdpHeader = (PUDP_HEADER)(BaseVa + Info->UdpHeader.Offset);
 
         __TransmitterHashAccumulate(&Value,
                                     (PUCHAR)&UdpHeader->SourcePort,
@@ -5155,7 +5158,7 @@ TransmitterQueuePacket(
 {
     PXENVIF_FRONTEND                Frontend;
     PXENVIF_TRANSMITTER_PACKET      Packet;
-    PUCHAR                          StartVa;
+    PUCHAR                          BaseVa;
     PXENVIF_PACKET_PAYLOAD          Payload;
     PXENVIF_PACKET_INFO             Info;
     XENVIF_PACKET_HASH_ALGORITHM    Algorithm;
@@ -5181,7 +5184,7 @@ TransmitterQueuePacket(
     Packet->Hash = *Hash;
     Packet->Cookie = Cookie;
 
-    StartVa = Packet->Header;
+    BaseVa = Packet->Header;
 
     Payload = &Packet->Payload;
     Payload->Mdl = Packet->Mdl;
@@ -5190,7 +5193,7 @@ TransmitterQueuePacket(
 
     Info = &Packet->Info;
 
-    (VOID) ParsePacket(StartVa, TransmitterPullup, Transmitter, Payload, Info);
+    (VOID) ParsePacket(BaseVa, TransmitterPullup, Transmitter, Payload, Info);
 
     Algorithm = Hash->Algorithm;
 
-- 
2.5.3


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.