[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [win-pv-devel] [PATCH] Get rid of Granter abstraction
Since the addition of GNTTAB Caches in XENBUS, the Granter abstraction in XENVIF has been fairly pointless. This patch finally gets rid of it. Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx> --- src/xenvif/frontend.c | 96 +++++--------- src/xenvif/frontend.h | 7 - src/xenvif/granter.c | 310 ------------------------------------------- src/xenvif/granter.h | 93 ------------- src/xenvif/receiver.c | 181 ++++++++++++++++++------- src/xenvif/transmitter.c | 255 ++++++++++++++++++++++++----------- vs2012/xenvif/xenvif.vcxproj | 1 - vs2013/xenvif/xenvif.vcxproj | 1 - 8 files changed, 343 insertions(+), 601 deletions(-) delete mode 100644 src/xenvif/granter.c delete mode 100644 src/xenvif/granter.h diff --git a/src/xenvif/frontend.c b/src/xenvif/frontend.c index 7e9989a..88e387f 100644 --- a/src/xenvif/frontend.c +++ b/src/xenvif/frontend.c @@ -43,7 +43,6 @@ #include "thread.h" #include "frontend.h" #include "names.h" -#include "granter.h" #include "mac.h" #include "tcpip.h" #include "receiver.h" @@ -65,7 +64,6 @@ struct _XENVIF_FRONTEND { USHORT BackendDomain; ULONG QueueCount; - PXENVIF_GRANTER Granter; PXENVIF_MAC Mac; PXENVIF_RECEIVER Receiver; PXENVIF_TRANSMITTER Transmitter; @@ -290,7 +288,6 @@ FrontendGet ## _Function( \ return __FrontendGet ## _Function ## (Frontend); \ } -DEFINE_FRONTEND_GET_FUNCTION(Granter, PXENVIF_GRANTER) DEFINE_FRONTEND_GET_FUNCTION(Mac, PXENVIF_MAC) DEFINE_FRONTEND_GET_FUNCTION(Transmitter, PXENVIF_TRANSMITTER) DEFINE_FRONTEND_GET_FUNCTION(Receiver, PXENVIF_RECEIVER) @@ -1407,22 +1404,18 @@ __FrontendConnect( if (!NT_SUCCESS(status)) goto fail2; - status = GranterConnect(__FrontendGetGranter(Frontend)); - if (!NT_SUCCESS(status)) - goto fail3; - status = MacConnect(__FrontendGetMac(Frontend)); if (!NT_SUCCESS(status)) - goto fail4; + goto fail3; __FrontendReadQueueCount(Frontend); status = ReceiverConnect(__FrontendGetReceiver(Frontend)); if (!NT_SUCCESS(status)) - goto fail5; + goto fail4; status = TransmitterConnect(__FrontendGetTransmitter(Frontend)); if (!NT_SUCCESS(status)) - goto fail6; + goto fail5; Attempt = 0; do { @@ -1472,7 +1465,7 @@ abort: } while (status == STATUS_RETRY); if (!NT_SUCCESS(status)) - goto fail7; + goto fail6; status = XENBUS_STORE(Printf, &Frontend->StoreInterface, @@ -1482,25 +1475,22 @@ abort: "%u", XenbusStateConnected); if (!NT_SUCCESS(status)) - goto fail8; + goto fail7; State = XenbusStateInitWait; status = __FrontendWaitForStateChange(Frontend, Path, &State); if (!NT_SUCCESS(status)) - goto fail9; + goto fail8; status = STATUS_UNSUCCESSFUL; if (State != XenbusStateConnected) - goto fail10; + goto fail9; ThreadWake(Frontend->MibThread); Trace("<====\n"); return STATUS_SUCCESS; -fail10: - Error("fail10\n"); - fail9: Error("fail9\n"); @@ -1510,22 +1500,20 @@ fail8: fail7: Error("fail7\n"); - TransmitterDisconnect(__FrontendGetTransmitter(Frontend)); - fail6: Error("fail6\n"); - ReceiverDisconnect(__FrontendGetReceiver(Frontend)); + TransmitterDisconnect(__FrontendGetTransmitter(Frontend)); fail5: Error("fail5\n"); - MacDisconnect(__FrontendGetMac(Frontend)); + ReceiverDisconnect(__FrontendGetReceiver(Frontend)); fail4: Error("fail4\n"); - GranterDisconnect(__FrontendGetGranter(Frontend)); + MacDisconnect(__FrontendGetMac(Frontend)); fail3: Error("fail3\n"); @@ -1557,7 +1545,6 @@ __FrontendDisconnect( TransmitterDisconnect(__FrontendGetTransmitter(Frontend)); ReceiverDisconnect(__FrontendGetReceiver(Frontend)); MacDisconnect(__FrontendGetMac(Frontend)); - GranterDisconnect(__FrontendGetGranter(Frontend)); XENBUS_DEBUG(Deregister, &Frontend->DebugInterface, @@ -1580,39 +1567,30 @@ __FrontendEnable( Trace("====>\n"); - status = GranterEnable(__FrontendGetGranter(Frontend)); - if (!NT_SUCCESS(status)) - goto fail1; - status = MacEnable(__FrontendGetMac(Frontend)); if (!NT_SUCCESS(status)) - goto fail2; + goto fail1; status = ReceiverEnable(__FrontendGetReceiver(Frontend)); if (!NT_SUCCESS(status)) - goto fail3; + goto fail2; status = TransmitterEnable(__FrontendGetTransmitter(Frontend)); if (!NT_SUCCESS(status)) - goto fail4; + goto fail3; Trace("<====\n"); return STATUS_SUCCESS; -fail4: - Error("fail4\n"); - - ReceiverDisable(__FrontendGetReceiver(Frontend)); - fail3: Error("fail3\n"); - MacDisable(__FrontendGetMac(Frontend)); + ReceiverDisable(__FrontendGetReceiver(Frontend)); fail2: Error("fail2\n"); - GranterDisable(__FrontendGetGranter(Frontend)); + MacDisable(__FrontendGetMac(Frontend)); fail1: Error("fail1 (%08x)\n", status); @@ -1630,7 +1608,6 @@ __FrontendDisable( TransmitterDisable(__FrontendGetTransmitter(Frontend)); ReceiverDisable(__FrontendGetReceiver(Frontend)); MacDisable(__FrontendGetMac(Frontend)); - GranterDisable(__FrontendGetGranter(Frontend)); Trace("<====\n"); } @@ -1981,64 +1958,57 @@ FrontendInitialize( FdoGetSuspendInterface(PdoGetFdo(Pdo), &(*Frontend)->SuspendInterface); FdoGetStoreInterface(PdoGetFdo(Pdo), &(*Frontend)->StoreInterface); - status = GranterInitialize(*Frontend, &(*Frontend)->Granter); - if (!NT_SUCCESS(status)) - goto fail6; - status = MacInitialize(*Frontend, &(*Frontend)->Mac); if (!NT_SUCCESS(status)) - goto fail7; + goto fail6; status = ReceiverInitialize(*Frontend, &(*Frontend)->Receiver); if (!NT_SUCCESS(status)) - goto fail8; + goto fail7; status = TransmitterInitialize(*Frontend, &(*Frontend)->Transmitter); if (!NT_SUCCESS(status)) - goto fail9; + goto fail8; status = ThreadCreate(FrontendEject, *Frontend, &(*Frontend)->EjectThread); if (!NT_SUCCESS(status)) - goto fail10; + goto fail9; status = ThreadCreate(FrontendMib, *Frontend, &(*Frontend)->MibThread); if (!NT_SUCCESS(status)) - goto fail11; + goto fail10; Trace("<====\n"); return STATUS_SUCCESS; -fail11: - Error("fail11\n"); +fail10: + Error("fail10\n"); ThreadAlert((*Frontend)->EjectThread); ThreadJoin((*Frontend)->EjectThread); (*Frontend)->EjectThread = NULL; -fail10: - Error("fail10\n"); +fail9: + Error("fail9\n"); TransmitterTeardown(__FrontendGetTransmitter(*Frontend)); (*Frontend)->Transmitter = NULL; -fail9: - Error("fail9\n"); +fail8: + Error("fail8\n"); ReceiverTeardown(__FrontendGetReceiver(*Frontend)); (*Frontend)->Receiver = NULL; -fail8: - Error("fail8\n"); +fail7: + Error("fail7\n"); MacTeardown(__FrontendGetMac(*Frontend)); (*Frontend)->Mac = NULL; -fail7: - Error("fail7\n"); - - GranterTeardown(__FrontendGetGranter(*Frontend)); - (*Frontend)->Granter = NULL; +fail6: + Error("fail6\n"); RtlZeroMemory(&(*Frontend)->StoreInterface, sizeof (XENBUS_STORE_INTERFACE)); @@ -2049,9 +2019,6 @@ fail7: RtlZeroMemory(&(*Frontend)->DebugInterface, sizeof (XENBUS_DEBUG_INTERFACE)); -fail6: - Error("fail6\n"); - (*Frontend)->State = FRONTEND_STATE_INVALID; RtlZeroMemory(&(*Frontend)->Lock, sizeof (KSPIN_LOCK)); @@ -2124,9 +2091,6 @@ FrontendTeardown( MacTeardown(__FrontendGetMac(Frontend)); Frontend->Mac = NULL; - GranterTeardown(__FrontendGetGranter(Frontend)); - Frontend->Granter = NULL; - RtlZeroMemory(&Frontend->StoreInterface, sizeof (XENBUS_STORE_INTERFACE)); diff --git a/src/xenvif/frontend.h b/src/xenvif/frontend.h index 21a370a..adcf53c 100644 --- a/src/xenvif/frontend.h +++ b/src/xenvif/frontend.h @@ -129,13 +129,6 @@ FrontendFreePath( IN PCHAR Path ); -#include "granter.h" - -extern PXENVIF_GRANTER -FrontendGetGranter( - IN PXENVIF_FRONTEND Frontend - ); - #include "mac.h" extern PXENVIF_MAC diff --git a/src/xenvif/granter.c b/src/xenvif/granter.c deleted file mode 100644 index 5efbf81..0000000 --- a/src/xenvif/granter.c +++ /dev/null @@ -1,310 +0,0 @@ -/* Copyright (c) Citrix Systems Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, - * with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include <ntddk.h> -#include <ntstrsafe.h> -#include <stdlib.h> -#include <util.h> - -#include "pdo.h" -#include "frontend.h" -#include "granter.h" -#include "dbg_print.h" -#include "assert.h" - -struct _XENVIF_GRANTER { - PXENVIF_FRONTEND Frontend; - KSPIN_LOCK Lock; - XENBUS_GNTTAB_INTERFACE GnttabInterface; - PXENBUS_GNTTAB_CACHE Cache; -}; - -#define XENVIF_GRANTER_TAG 'NARG' - -#define MAXNAMELEN 128 - -static FORCEINLINE PVOID -__GranterAllocate( - IN ULONG Length - ) -{ - return __AllocateNonPagedPoolWithTag(Length, XENVIF_GRANTER_TAG); -} - -static FORCEINLINE VOID -__GranterFree( - IN PVOID Buffer - ) -{ - __FreePoolWithTag(Buffer, XENVIF_GRANTER_TAG); -} - -NTSTATUS -GranterInitialize( - IN PXENVIF_FRONTEND Frontend, - OUT PXENVIF_GRANTER *Granter - ) -{ - NTSTATUS status; - - *Granter = __GranterAllocate(sizeof (XENVIF_GRANTER)); - - status = STATUS_NO_MEMORY; - if (*Granter == NULL) - goto fail1; - - KeInitializeSpinLock(&(*Granter)->Lock); - - FdoGetGnttabInterface(PdoGetFdo(FrontendGetPdo(Frontend)), - &(*Granter)->GnttabInterface); - - (*Granter)->Frontend = Frontend; - - return STATUS_SUCCESS; - -fail1: - Error("fail1 (%08x)\n", status); - - return status; -} - -static VOID -__drv_requiresIRQL(DISPATCH_LEVEL) -GranterAcquireLock( - IN PVOID Argument - ) -{ - PXENVIF_GRANTER Granter = Argument; - - ASSERT3U(KeGetCurrentIrql(), ==, DISPATCH_LEVEL); - - KeAcquireSpinLockAtDpcLevel(&Granter->Lock); -} - -static VOID -__drv_requiresIRQL(DISPATCH_LEVEL) -GranterReleaseLock( - IN PVOID Argument - ) -{ - PXENVIF_GRANTER Granter = Argument; - - ASSERT3U(KeGetCurrentIrql(), ==, DISPATCH_LEVEL); - -#pragma prefast(disable:26110) - KeReleaseSpinLockFromDpcLevel(&Granter->Lock); -} - -NTSTATUS -GranterConnect( - IN PXENVIF_GRANTER Granter - ) -{ - PXENVIF_FRONTEND Frontend; - CHAR Name[MAXNAMELEN]; - ULONG Index; - NTSTATUS status; - - Frontend = Granter->Frontend; - - status = XENBUS_GNTTAB(Acquire, &Granter->GnttabInterface); - if (!NT_SUCCESS(status)) - goto fail1; - - status = RtlStringCbPrintfA(Name, - sizeof (Name), - "%s", - FrontendGetPath(Granter->Frontend)); - if (!NT_SUCCESS(status)) - goto fail2; - - for (Index = 0; Name[Index] != '\0'; Index++) - if (Name[Index] == '/') - Name[Index] = '_'; - - ASSERT3P(Granter->Cache, ==, NULL); - - status = XENBUS_GNTTAB(CreateCache, - &Granter->GnttabInterface, - Name, - 0, - GranterAcquireLock, - GranterReleaseLock, - Granter, - &Granter->Cache); - if (!NT_SUCCESS(status)) - goto fail3; - - return STATUS_SUCCESS; - -fail3: - Error("fail3\n"); - -fail2: - Error("fail2\n"); - - XENBUS_GNTTAB(Release, &Granter->GnttabInterface); - -fail1: - Error("fail1 (%08x)\n", status); - - return status; -} - -NTSTATUS -GranterEnable( - IN PXENVIF_GRANTER Granter - ) -{ - UNREFERENCED_PARAMETER(Granter); - - return STATUS_SUCCESS; -} - -NTSTATUS -GranterPermitAccess( - IN PXENVIF_GRANTER Granter, - IN PFN_NUMBER Pfn, - IN BOOLEAN ReadOnly, - OUT PXENVIF_GRANTER_HANDLE Handle - ) -{ - PXENVIF_FRONTEND Frontend; - PXENBUS_GNTTAB_ENTRY Entry; - NTSTATUS status; - - Frontend = Granter->Frontend; - - ASSERT3P(Granter->Cache, !=, NULL); - - status = XENBUS_GNTTAB(PermitForeignAccess, - &Granter->GnttabInterface, - Granter->Cache, - FALSE, - FrontendGetBackendDomain(Frontend), - Pfn, - ReadOnly, - &Entry); - if (!NT_SUCCESS(status)) - goto fail1; - - *Handle = Entry; - return STATUS_SUCCESS; - -fail1: - Error("fail1 (%08x)\n", status); - - return status; -} - -VOID -GranterRevokeAccess( - IN PXENVIF_GRANTER Granter, - IN XENVIF_GRANTER_HANDLE Handle - ) -{ - PXENVIF_FRONTEND Frontend; - PXENBUS_GNTTAB_ENTRY Entry = Handle; - NTSTATUS status; - - Frontend = Granter->Frontend; - - ASSERT3P(Granter->Cache, !=, NULL); - - status = XENBUS_GNTTAB(RevokeForeignAccess, - &Granter->GnttabInterface, - Granter->Cache, - FALSE, - Entry); - ASSERT(NT_SUCCESS(status)); -} - -ULONG -GranterGetReference( - IN PXENVIF_GRANTER Granter, - IN XENVIF_GRANTER_HANDLE Handle - ) -{ - PXENVIF_FRONTEND Frontend; - PXENBUS_GNTTAB_ENTRY Entry; - - Frontend = Granter->Frontend; - - Entry = Handle; - - return XENBUS_GNTTAB(GetReference, - &Granter->GnttabInterface, - Entry); -} - -VOID -GranterDisable( - IN PXENVIF_GRANTER Granter - ) -{ - UNREFERENCED_PARAMETER(Granter); -} - -VOID -GranterDisconnect( - IN PXENVIF_GRANTER Granter - ) -{ - PXENVIF_FRONTEND Frontend; - - Frontend = Granter->Frontend; - - ASSERT3P(Granter->Cache, !=, NULL); - - XENBUS_GNTTAB(DestroyCache, - &Granter->GnttabInterface, - Granter->Cache); - Granter->Cache = NULL; - - XENBUS_GNTTAB(Release, &Granter->GnttabInterface); -} - -VOID -GranterTeardown( - IN PXENVIF_GRANTER Granter - ) -{ - Granter->Frontend = NULL; - - RtlZeroMemory(&Granter->GnttabInterface, - sizeof (XENBUS_GNTTAB_INTERFACE)); - - RtlZeroMemory(&Granter->Lock, sizeof (KSPIN_LOCK)); - - ASSERT(IsZeroMemory(Granter, sizeof (XENVIF_GRANTER))); - - __GranterFree(Granter); -} diff --git a/src/xenvif/granter.h b/src/xenvif/granter.h deleted file mode 100644 index b9e51c3..0000000 --- a/src/xenvif/granter.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (c) Citrix Systems Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, - * with or without modification, are permitted provided - * that the following conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the - * following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the - * following disclaimer in the documentation and/or other - * materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _XENVIF_GRANTER_H -#define _XENVIF_GRANTER_H - -#include <ntddk.h> -#include <gnttab_interface.h> - -typedef struct _XENVIF_GRANTER XENVIF_GRANTER, *PXENVIF_GRANTER; - -typedef PVOID XENVIF_GRANTER_HANDLE, *PXENVIF_GRANTER_HANDLE; - -NTSTATUS -GranterInitialize( - IN PXENVIF_FRONTEND Frontend, - OUT PXENVIF_GRANTER *Granter - ); - -NTSTATUS -GranterConnect( - IN PXENVIF_GRANTER Granter - ); - -NTSTATUS -GranterEnable( - IN PXENVIF_GRANTER Granter - ); - -NTSTATUS -GranterPermitAccess( - IN PXENVIF_GRANTER Granter, - IN PFN_NUMBER Pfn, - IN BOOLEAN ReadOnly, - OUT PXENVIF_GRANTER_HANDLE Handle - ); - -VOID -GranterRevokeAccess( - IN PXENVIF_GRANTER Granter, - IN XENVIF_GRANTER_HANDLE Handle - ); - -ULONG -GranterGetReference( - IN PXENVIF_GRANTER Granter, - IN XENVIF_GRANTER_HANDLE Handle - ); - -VOID -GranterDisable( - IN PXENVIF_GRANTER Granter - ); - -VOID -GranterDisconnect( - IN PXENVIF_GRANTER Granter - ); - -VOID -GranterTeardown( - IN PXENVIF_GRANTER Granter - ); - -#endif // _XENVIF_GRANTER_H diff --git a/src/xenvif/receiver.c b/src/xenvif/receiver.c index da869d9..5318baf 100644 --- a/src/xenvif/receiver.c +++ b/src/xenvif/receiver.c @@ -37,6 +37,7 @@ #include <debug_interface.h> #include <store_interface.h> #include <cache_interface.h> +#include <gnttab_interface.h> #include <evtchn_interface.h> // This should be in public/io/netif.h @@ -50,7 +51,6 @@ #include "frontend.h" #include "checksum.h" #include "parse.h" -#include "granter.h" #include "mac.h" #include "transmitter.h" #include "vif.h" @@ -66,7 +66,7 @@ typedef struct _XENVIF_RECEIVER_FRAGMENT { LIST_ENTRY ListEntry; ULONG Next; PVOID Context; - XENVIF_GRANTER_HANDLE Handle; + PXENBUS_GNTTAB_ENTRY Entry; } XENVIF_RECEIVER_FRAGMENT, *PXENVIF_RECEIVER_FRAGMENT; #define XENVIF_RECEIVER_RING_SIZE (__CONST_RING_SIZE(netif_rx, PAGE_SIZE)) @@ -80,10 +80,11 @@ typedef struct _XENVIF_RECEIVER_RING { KSPIN_LOCK Lock; PXENBUS_CACHE PacketCache; PXENBUS_CACHE FragmentCache; + PXENBUS_GNTTAB_CACHE GnttabCache; PMDL Mdl; netif_rx_front_ring_t Front; netif_rx_sring_t *Shared; - XENVIF_GRANTER_HANDLE Handle; + PXENBUS_GNTTAB_ENTRY Entry; PXENBUS_EVTCHN_CHANNEL Channel; KDPC Dpc; ULONG Dpcs; @@ -104,6 +105,7 @@ typedef struct _XENVIF_RECEIVER_RING { struct _XENVIF_RECEIVER { PXENVIF_FRONTEND Frontend; XENBUS_CACHE_INTERFACE CacheInterface; + XENBUS_GNTTAB_INTERFACE GnttabInterface; XENBUS_EVTCHN_INTERFACE EvtchnInterface; PXENVIF_RECEIVER_RING Rings[MAXIMUM_PROCESSORS]; BOOLEAN Split; @@ -1449,6 +1451,7 @@ __ReceiverRingPreparePacket( PXENVIF_FRONTEND Frontend; PXENVIF_RECEIVER_FRAGMENT Fragment; PMDL Mdl; + PFN_NUMBER Pfn; NTSTATUS status; Receiver = Ring->Receiver; @@ -1462,10 +1465,16 @@ __ReceiverRingPreparePacket( Mdl = &Packet->Mdl; - status = GranterPermitAccess(FrontendGetGranter(Frontend), - MmGetMdlPfnArray(Mdl)[0], - FALSE, - &Fragment->Handle); + Pfn = MmGetMdlPfnArray(Mdl)[0]; + + status = XENBUS_GNTTAB(PermitForeignAccess, + &Receiver->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + FALSE, + &Fragment->Entry); if (!NT_SUCCESS(status)) goto fail2; @@ -1555,8 +1564,9 @@ ReceiverRingFill( Ring->RequestsPosted++; req->id = id; - req->gref = GranterGetReference(FrontendGetGranter(Frontend), - Fragment->Handle); + req->gref = XENBUS_GNTTAB(GetReference, + &Receiver->GnttabInterface, + Fragment->Entry); ASSERT3U(id, <=, XENVIF_RECEIVER_MAXIMUM_FRAGMENT_ID); ASSERT3P(Ring->Pending[id], ==, NULL); @@ -1604,9 +1614,12 @@ __ReceiverRingEmpty( Mdl = Fragment->Context; Fragment->Context = NULL; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Fragment->Handle); - Fragment->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Receiver->GnttabInterface, + Ring->GnttabCache, + TRUE, + Fragment->Entry); + Fragment->Entry = NULL; __ReceiverRingPutFragment(Ring, Fragment); @@ -1738,9 +1751,12 @@ ReceiverRingPoll( Mdl = Fragment->Context; Fragment->Context = NULL; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Fragment->Handle); - Fragment->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Receiver->GnttabInterface, + Ring->GnttabCache, + TRUE, + Fragment->Entry); + Fragment->Entry = NULL; __ReceiverRingPutFragment(Ring, Fragment); @@ -2157,16 +2173,39 @@ __ReceiverRingConnect( PXENVIF_FRONTEND Frontend; PFN_NUMBER Pfn; CHAR Name[MAXNAMELEN]; + ULONG Index; NTSTATUS status; Receiver = Ring->Receiver; Frontend = Receiver->Frontend; + status = RtlStringCbPrintfA(Name, + sizeof (Name), + "%s_receiver", + Ring->Path); + if (!NT_SUCCESS(status)) + goto fail1; + + for (Index = 0; Name[Index] != '\0'; Index++) + if (Name[Index] == '/') + Name[Index] = '_'; + + status = XENBUS_GNTTAB(CreateCache, + &Receiver->GnttabInterface, + Name, + 0, + ReceiverRingAcquireLock, + ReceiverRingReleaseLock, + Ring, + &Ring->GnttabCache); + if (!NT_SUCCESS(status)) + goto fail2; + Ring->Mdl = __AllocatePage(); status = STATUS_NO_MEMORY; if (Ring->Mdl == NULL) - goto fail1; + goto fail3; Ring->Shared = MmGetSystemAddressForMdlSafe(Ring->Mdl, NormalPagePriority); ASSERT(Ring->Shared != NULL); @@ -2177,19 +2216,23 @@ __ReceiverRingConnect( Pfn = MmGetMdlPfnArray(Ring->Mdl)[0]; - status = GranterPermitAccess(FrontendGetGranter(Frontend), - Pfn, - FALSE, - &Ring->Handle); + status = XENBUS_GNTTAB(PermitForeignAccess, + &Receiver->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + FALSE, + &Ring->Entry); if (!NT_SUCCESS(status)) - goto fail2; + goto fail4; status = RtlStringCbPrintfA(Name, sizeof (Name), __MODULE__ "|RECEIVER[%u]", Ring->Index); if (!NT_SUCCESS(status)) - goto fail3; + goto fail5; ASSERT(!Ring->Connected); @@ -2203,7 +2246,7 @@ __ReceiverRingConnect( status = STATUS_UNSUCCESSFUL; if (Ring->Channel == NULL) - goto fail4; + goto fail6; if (FrontendGetQueueCount(Frontend) > 1) { (VOID) XENBUS_EVTCHN(Bind, @@ -2229,12 +2272,12 @@ __ReceiverRingConnect( Ring, &Ring->DebugCallback); if (!NT_SUCCESS(status)) - goto fail5; + goto fail7; return STATUS_SUCCESS; -fail5: - Error("fail5\n"); +fail7: + Error("fail7\n"); Ring->Connected = FALSE; @@ -2245,18 +2288,21 @@ fail5: Ring->Events = 0; -fail4: - Error("fail4\n"); +fail6: + Error("fail6\n"); -fail3: - Error("fail3\n"); +fail5: + Error("fail5\n"); - GranterRevokeAccess(FrontendGetGranter(Frontend), - Ring->Handle); - Ring->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Receiver->GnttabInterface, + Ring->GnttabCache, + TRUE, + Ring->Entry); + Ring->Entry = NULL; -fail2: - Error("fail2\n"); +fail4: + Error("fail4\n"); RtlZeroMemory(&Ring->Front, sizeof (netif_rx_front_ring_t)); RtlZeroMemory(Ring->Shared, PAGE_SIZE); @@ -2265,6 +2311,17 @@ fail2: __FreePage(Ring->Mdl); Ring->Mdl = NULL; +fail3: + Error("fail3\n"); + + XENBUS_GNTTAB(DestroyCache, + &Receiver->GnttabInterface, + Ring->GnttabCache); + Ring->GnttabCache = NULL; + +fail2: + Error("fail2\n"); + fail1: Error("fail1 (%08x)\n", status); @@ -2297,9 +2354,9 @@ __ReceiverRingStoreWrite( Path, "rx-ring-ref", "%u", - GranterGetReference(FrontendGetGranter(Frontend), - Ring->Handle)); - + XENBUS_GNTTAB(GetReference, + &Receiver->GnttabInterface, + Ring->Entry)); if (!NT_SUCCESS(status)) goto fail1; @@ -2417,9 +2474,12 @@ __ReceiverRingDisconnect( Ring->DebugCallback); Ring->DebugCallback = NULL; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Ring->Handle); - Ring->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Receiver->GnttabInterface, + Ring->GnttabCache, + TRUE, + Ring->Entry); + Ring->Entry = NULL; RtlZeroMemory(&Ring->Front, sizeof (netif_rx_front_ring_t)); RtlZeroMemory(Ring->Shared, PAGE_SIZE); @@ -2427,6 +2487,11 @@ __ReceiverRingDisconnect( Ring->Shared = NULL; __FreePage(Ring->Mdl); Ring->Mdl = NULL; + + XENBUS_GNTTAB(DestroyCache, + &Receiver->GnttabInterface, + Ring->GnttabCache); + Ring->GnttabCache = NULL; } static FORCEINLINE VOID @@ -2592,6 +2657,9 @@ ReceiverInitialize( FdoGetCacheInterface(PdoGetFdo(FrontendGetPdo(Frontend)), &(*Receiver)->CacheInterface); + FdoGetGnttabInterface(PdoGetFdo(FrontendGetPdo(Frontend)), + &(*Receiver)->GnttabInterface); + FdoGetEvtchnInterface(PdoGetFdo(FrontendGetPdo(Frontend)), &(*Receiver)->EvtchnInterface); @@ -2639,6 +2707,9 @@ fail2: RtlZeroMemory(&(*Receiver)->EvtchnInterface, sizeof (XENBUS_EVTCHN_INTERFACE)); + RtlZeroMemory(&(*Receiver)->GnttabInterface, + sizeof (XENBUS_GNTTAB_INTERFACE)); + RtlZeroMemory(&(*Receiver)->CacheInterface, sizeof (XENBUS_CACHE_INTERFACE)); @@ -2692,6 +2763,10 @@ ReceiverConnect( if (!NT_SUCCESS(status)) goto fail3; + status = XENBUS_GNTTAB(Acquire, &Receiver->GnttabInterface); + if (!NT_SUCCESS(status)) + goto fail4; + status = XENBUS_STORE(Read, &Receiver->StoreInterface, NULL, @@ -2720,7 +2795,7 @@ ReceiverConnect( status = __ReceiverRingConnect(Ring); if (!NT_SUCCESS(status)) - goto fail4; + goto fail5; } status = XENBUS_DEBUG(Register, @@ -2730,16 +2805,16 @@ ReceiverConnect( Receiver, &Receiver->DebugCallback); if (!NT_SUCCESS(status)) - goto fail5; + goto fail6; return STATUS_SUCCESS; +fail6: + Error("fail6\n"); + fail5: Error("fail5\n"); -fail4: - Error("fail4\n"); - for (Index = 0; Index < Count; ++Index) { PXENVIF_RECEIVER_RING Ring; @@ -2750,6 +2825,11 @@ fail4: __ReceiverRingDisconnect(Ring); } + XENBUS_GNTTAB(Release, &Receiver->GnttabInterface); + +fail4: + Error("fail4\n"); + XENBUS_EVTCHN(Release, &Receiver->EvtchnInterface); fail3: @@ -3039,11 +3119,13 @@ ReceiverDisconnect( __ReceiverRingDisconnect(Ring); } + XENBUS_GNTTAB(Release, &Receiver->GnttabInterface); + + XENBUS_EVTCHN(Release, &Receiver->EvtchnInterface); + XENBUS_STORE(Release, &Receiver->StoreInterface); XENBUS_DEBUG(Release, &Receiver->DebugInterface); - - XENBUS_EVTCHN(Release, &Receiver->EvtchnInterface); } VOID @@ -3080,6 +3162,9 @@ ReceiverTeardown( RtlZeroMemory(&Receiver->EvtchnInterface, sizeof (XENBUS_EVTCHN_INTERFACE)); + RtlZeroMemory(&Receiver->GnttabInterface, + sizeof (XENBUS_GNTTAB_INTERFACE)); + RtlZeroMemory(&Receiver->CacheInterface, sizeof (XENBUS_CACHE_INTERFACE)); diff --git a/src/xenvif/transmitter.c b/src/xenvif/transmitter.c index 28b2613..7ccd675 100644 --- a/src/xenvif/transmitter.c +++ b/src/xenvif/transmitter.c @@ -49,7 +49,6 @@ #include "checksum.h" #include "parse.h" #include "transmitter.h" -#include "granter.h" #include "mac.h" #include "vif.h" #include "thread.h" @@ -80,7 +79,7 @@ typedef struct _XENVIF_TRANSMITTER_FRAGMENT { USHORT Id; XENVIF_TRANSMITTER_FRAGMENT_TYPE Type; PVOID Context; - XENVIF_GRANTER_HANDLE Handle; + PXENBUS_GNTTAB_ENTRY Entry; ULONG Offset; ULONG Length; BOOLEAN Extra; @@ -106,11 +105,12 @@ typedef struct _XENVIF_TRANSMITTER_RING { PCHAR Path; PXENBUS_CACHE BufferCache; PXENBUS_CACHE FragmentCache; + PXENBUS_GNTTAB_CACHE GnttabCache; PXENBUS_RANGE_SET RangeSet; PMDL Mdl; netif_tx_front_ring_t Front; netif_tx_sring_t *Shared; - XENVIF_GRANTER_HANDLE Handle; + PXENBUS_GNTTAB_ENTRY Entry; PXENBUS_EVTCHN_CHANNEL Channel; KDPC Dpc; ULONG Dpcs; @@ -145,6 +145,7 @@ typedef struct _XENVIF_TRANSMITTER_RING { struct _XENVIF_TRANSMITTER { PXENVIF_FRONTEND Frontend; XENBUS_CACHE_INTERFACE CacheInterface; + XENBUS_GNTTAB_INTERFACE GnttabInterface; XENBUS_RANGE_SET_INTERFACE RangeSetInterface; XENBUS_EVTCHN_INTERFACE EvtchnInterface; PXENVIF_TRANSMITTER_RING Rings[MAXIMUM_PROCESSORS]; @@ -657,10 +658,14 @@ __TransmitterRingCopyPayload( Pfn = MmGetMdlPfnArray(Mdl)[0]; - status = GranterPermitAccess(FrontendGetGranter(Frontend), - Pfn, - TRUE, - &Fragment->Handle); + status = XENBUS_GNTTAB(PermitForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + TRUE, + &Fragment->Entry); if (!NT_SUCCESS(status)) goto fail3; @@ -719,9 +724,12 @@ fail1: Fragment->Length = 0; Fragment->Offset = 0; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Fragment->Handle); - Fragment->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + Fragment->Entry); + Fragment->Entry = NULL; ASSERT3U(Fragment->Type, ==, XENVIF_TRANSMITTER_FRAGMENT_TYPE_BUFFER); Buffer = Fragment->Context; @@ -803,10 +811,14 @@ __TransmitterRingGrantPayload( PageOffset = MdlOffset & (PAGE_SIZE - 1); PageLength = __min(MdlLength, PAGE_SIZE - PageOffset); - status = GranterPermitAccess(FrontendGetGranter(Frontend), - Pfn, - TRUE, - &Fragment->Handle); + status = XENBUS_GNTTAB(PermitForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + TRUE, + &Fragment->Entry); if (!NT_SUCCESS(status)) goto fail2; @@ -877,9 +889,12 @@ fail1: Fragment->Length = 0; Fragment->Offset = 0; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Fragment->Handle); - Fragment->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + Fragment->Entry); + Fragment->Entry = NULL; ASSERT3P(Fragment->Context, ==, Packet); Fragment->Context = NULL; @@ -959,10 +974,14 @@ __TransmitterRingPrepareHeader( Pfn = MmGetMdlPfnArray(Mdl)[0]; - status = GranterPermitAccess(FrontendGetGranter(Frontend), - Pfn, - TRUE, - &Fragment->Handle); + status = XENBUS_GNTTAB(PermitForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + TRUE, + &Fragment->Entry); if (!NT_SUCCESS(status)) goto fail4; @@ -1126,9 +1145,12 @@ fail5: Fragment->Length = 0; Fragment->Offset = 0; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Fragment->Handle); - Fragment->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + Fragment->Entry); + Fragment->Entry = NULL; fail4: Error("fail4\n"); @@ -1193,9 +1215,12 @@ __TransmitterRingUnprepareFragments( Fragment->Length = 0; Fragment->Offset = 0; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Fragment->Handle); - Fragment->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + Fragment->Entry); + Fragment->Entry = NULL; switch (Fragment->Type) { case XENVIF_TRANSMITTER_FRAGMENT_TYPE_BUFFER: { @@ -1501,10 +1526,14 @@ __TransmitterRingPrepareArp( Pfn = MmGetMdlPfnArray(Mdl)[0]; - status = GranterPermitAccess(FrontendGetGranter(Frontend), - Pfn, - TRUE, - &Fragment->Handle); + status = XENBUS_GNTTAB(PermitForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + TRUE, + &Fragment->Entry); if (!NT_SUCCESS(status)) goto fail3; @@ -1674,10 +1703,14 @@ __TransmitterRingPrepareNeighbourAdvertisement( Pfn = MmGetMdlPfnArray(Mdl)[0]; - status = GranterPermitAccess(FrontendGetGranter(Frontend), - Pfn, - TRUE, - &Fragment->Handle); + status = XENBUS_GNTTAB(PermitForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + TRUE, + &Fragment->Entry); if (!NT_SUCCESS(status)) goto fail3; @@ -1789,8 +1822,9 @@ __TransmitterRingPostFragments( Ring->RequestsPosted++; req->id = Fragment->Id; - req->gref = GranterGetReference(FrontendGetGranter(Frontend), - Fragment->Handle); + req->gref = XENBUS_GNTTAB(GetReference, + &Transmitter->GnttabInterface, + Fragment->Entry); req->offset = (USHORT)Fragment->Offset; req->size = (USHORT)Fragment->Length; req->flags = NETTXF_more_data; @@ -2104,9 +2138,12 @@ TransmitterRingPoll( Fragment->Length = 0; Fragment->Offset = 0; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Fragment->Handle); - Fragment->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + Fragment->Entry); + Fragment->Entry = NULL; Fragment->Extra = FALSE; __TransmitterPutFragment(Ring, Fragment); @@ -2900,7 +2937,7 @@ __TransmitterRingInitialize( TransmitterFragmentDtor, TransmitterRingAcquireLock, TransmitterRingReleaseLock, - (*Ring), + *Ring, &(*Ring)->FragmentCache); if (!NT_SUCCESS(status)) goto fail9; @@ -2991,6 +3028,7 @@ __TransmitterRingConnect( PXENVIF_FRONTEND Frontend; PFN_NUMBER Pfn; CHAR Name[MAXNAMELEN]; + ULONG Index; NTSTATUS status; ASSERT(!Ring->Connected); @@ -2998,11 +3036,33 @@ __TransmitterRingConnect( Transmitter = Ring->Transmitter; Frontend = Transmitter->Frontend; + status = RtlStringCbPrintfA(Name, + sizeof (Name), + "%s_transmitter", + Ring->Path); + if (!NT_SUCCESS(status)) + goto fail1; + + for (Index = 0; Name[Index] != '\0'; Index++) + if (Name[Index] == '/') + Name[Index] = '_'; + + status = XENBUS_GNTTAB(CreateCache, + &Transmitter->GnttabInterface, + Name, + 0, + TransmitterRingAcquireLock, + TransmitterRingReleaseLock, + Ring, + &Ring->GnttabCache); + if (!NT_SUCCESS(status)) + goto fail2; + Ring->Mdl = __AllocatePage(); status = STATUS_NO_MEMORY; if (Ring->Mdl == NULL) - goto fail1; + goto fail3; Ring->Shared = MmGetSystemAddressForMdlSafe(Ring->Mdl, NormalPagePriority); ASSERT(Ring->Shared != NULL); @@ -3013,19 +3073,23 @@ __TransmitterRingConnect( Pfn = MmGetMdlPfnArray(Ring->Mdl)[0]; - status = GranterPermitAccess(FrontendGetGranter(Frontend), - Pfn, - FALSE, - &Ring->Handle); + status = XENBUS_GNTTAB(PermitForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + FrontendGetBackendDomain(Frontend), + Pfn, + FALSE, + &Ring->Entry); if (!NT_SUCCESS(status)) - goto fail2; + goto fail4; status = RtlStringCbPrintfA(Name, sizeof (Name), __MODULE__ "|TRANSMITTER[%u]", Ring->Index); if (!NT_SUCCESS(status)) - goto fail3; + goto fail5; ASSERT3U(KeGetCurrentIrql(), ==, DISPATCH_LEVEL); @@ -3040,7 +3104,7 @@ __TransmitterRingConnect( status = STATUS_UNSUCCESSFUL; if (Ring->Channel == NULL) - goto fail4; + goto fail6; if (FrontendGetQueueCount(Frontend) > 1) { (VOID) XENBUS_EVTCHN(Bind, @@ -3065,14 +3129,14 @@ __TransmitterRingConnect( Ring, &Ring->DebugCallback); if (!NT_SUCCESS(status)) - goto fail5; + goto fail7; Ring->Connected = TRUE; return STATUS_SUCCESS; -fail5: - Error("fail5\n"); +fail7: + Error("fail7\n"); XENBUS_EVTCHN(Close, &Transmitter->EvtchnInterface, @@ -3081,18 +3145,21 @@ fail5: Ring->Events = 0; -fail4: - Error("fail4\n"); +fail6: + Error("fail6\n"); -fail3: - Error("fail3\n"); +fail5: + Error("fail5\n"); - GranterRevokeAccess(FrontendGetGranter(Frontend), - Ring->Handle); - Ring->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + Ring->Entry); + Ring->Entry = NULL; -fail2: - Error("fail2\n"); +fail4: + Error("fail4\n"); RtlZeroMemory(&Ring->Front, sizeof (netif_tx_front_ring_t)); RtlZeroMemory(Ring->Shared, PAGE_SIZE); @@ -3101,6 +3168,17 @@ fail2: __FreePage(Ring->Mdl); Ring->Mdl = NULL; +fail3: + Error("fail3\n"); + + XENBUS_GNTTAB(DestroyCache, + &Transmitter->GnttabInterface, + Ring->GnttabCache); + Ring->GnttabCache = NULL; + +fail2: + Error("fail2\n"); + fail1: Error("fail1 (%08x)\n", status); @@ -3133,9 +3211,9 @@ __TransmitterRingStoreWrite( Path, "tx-ring-ref", "%u", - GranterGetReference(FrontendGetGranter(Frontend), - Ring->Handle)); - + XENBUS_GNTTAB(GetReference, + &Transmitter->GnttabInterface, + Ring->Entry)); if (!NT_SUCCESS(status)) goto fail1; @@ -3292,9 +3370,12 @@ __TransmitterRingDisconnect( Ring->DebugCallback); Ring->DebugCallback = NULL; - GranterRevokeAccess(FrontendGetGranter(Frontend), - Ring->Handle); - Ring->Handle = NULL; + (VOID) XENBUS_GNTTAB(RevokeForeignAccess, + &Transmitter->GnttabInterface, + Ring->GnttabCache, + TRUE, + Ring->Entry); + Ring->Entry = NULL; RtlZeroMemory(&Ring->Front, sizeof (netif_tx_front_ring_t)); RtlZeroMemory(Ring->Shared, PAGE_SIZE); @@ -3303,6 +3384,10 @@ __TransmitterRingDisconnect( __FreePage(Ring->Mdl); Ring->Mdl = NULL; + XENBUS_GNTTAB(DestroyCache, + &Transmitter->GnttabInterface, + Ring->GnttabCache); + Ring->GnttabCache = NULL; } static FORCEINLINE VOID @@ -3527,6 +3612,9 @@ TransmitterInitialize( FdoGetCacheInterface(PdoGetFdo(FrontendGetPdo(Frontend)), &(*Transmitter)->CacheInterface); + FdoGetGnttabInterface(PdoGetFdo(FrontendGetPdo(Frontend)), + &(*Transmitter)->GnttabInterface); + FdoGetEvtchnInterface(PdoGetFdo(FrontendGetPdo(Frontend)), &(*Transmitter)->EvtchnInterface); @@ -3584,6 +3672,9 @@ fail2: RtlZeroMemory(&(*Transmitter)->Lock, sizeof (KSPIN_LOCK)); + RtlZeroMemory(&(*Transmitter)->GnttabInterface, + sizeof (XENBUS_GNTTAB_INTERFACE)); + RtlZeroMemory(&(*Transmitter)->CacheInterface, sizeof (XENBUS_CACHE_INTERFACE)); @@ -3634,6 +3725,10 @@ TransmitterConnect( if (!NT_SUCCESS(status)) goto fail3; + status = XENBUS_GNTTAB(Acquire, &Transmitter->GnttabInterface); + if (!NT_SUCCESS(status)) + goto fail4; + status = XENBUS_CACHE(Create, &Transmitter->CacheInterface, "packet_cache", @@ -3646,7 +3741,7 @@ TransmitterConnect( Transmitter, &Transmitter->PacketCache); if (!NT_SUCCESS(status)) - goto fail4; + goto fail5; status = XENBUS_STORE(Read, &Transmitter->StoreInterface, @@ -3676,7 +3771,7 @@ TransmitterConnect( status = __TransmitterRingConnect(Ring); if (!NT_SUCCESS(status)) - goto fail5; + goto fail6; } status = XENBUS_DEBUG(Register, @@ -3686,16 +3781,16 @@ TransmitterConnect( Transmitter, &Transmitter->DebugCallback); if (!NT_SUCCESS(status)) - goto fail6; + goto fail7; return STATUS_SUCCESS; +fail7: + Error("fail7\n"); + fail6: Error("fail6\n"); -fail5: - Error("fail5\n"); - for (Index = 0; Index < MAXIMUM_PROCESSORS; ++Index) { PXENVIF_TRANSMITTER_RING Ring; @@ -3711,6 +3806,11 @@ fail5: Transmitter->PacketCache); Transmitter->PacketCache = NULL; +fail5: + Error("fail5\n"); + + XENBUS_GNTTAB(Release, &Transmitter->GnttabInterface); + fail4: Error("fail4\n"); @@ -3847,11 +3947,13 @@ TransmitterDisconnect( Transmitter->PacketCache); Transmitter->PacketCache = NULL; + XENBUS_GNTTAB(Release, &Transmitter->GnttabInterface); + + XENBUS_EVTCHN(Release, &Transmitter->EvtchnInterface); + XENBUS_STORE(Release, &Transmitter->StoreInterface); XENBUS_DEBUG(Release, &Transmitter->DebugInterface); - - XENBUS_EVTCHN(Release, &Transmitter->EvtchnInterface); } VOID @@ -3889,6 +3991,9 @@ TransmitterTeardown( RtlZeroMemory(&Transmitter->Lock, sizeof (KSPIN_LOCK)); + RtlZeroMemory(&Transmitter->GnttabInterface, + sizeof (XENBUS_GNTTAB_INTERFACE)); + RtlZeroMemory(&Transmitter->CacheInterface, sizeof (XENBUS_CACHE_INTERFACE)); diff --git a/vs2012/xenvif/xenvif.vcxproj b/vs2012/xenvif/xenvif.vcxproj index edd71ea..4120018 100644 --- a/vs2012/xenvif/xenvif.vcxproj +++ b/vs2012/xenvif/xenvif.vcxproj @@ -93,7 +93,6 @@ <ClCompile Include="../../src/xenvif/driver.c" /> <ClCompile Include="../../src/xenvif/fdo.c" /> <ClCompile Include="../../src/xenvif/frontend.c" /> - <ClCompile Include="../../src/xenvif/granter.c" /> <ClCompile Include="../../src/xenvif/link.c" /> <ClCompile Include="../../src/xenvif/mac.c" /> <ClCompile Include="../../src/xenvif/parse.c" /> diff --git a/vs2013/xenvif/xenvif.vcxproj b/vs2013/xenvif/xenvif.vcxproj index 3dd8d9a..0e774b7 100644 --- a/vs2013/xenvif/xenvif.vcxproj +++ b/vs2013/xenvif/xenvif.vcxproj @@ -124,7 +124,6 @@ <ClCompile Include="../../src/xenvif/driver.c" /> <ClCompile Include="../../src/xenvif/fdo.c" /> <ClCompile Include="../../src/xenvif/frontend.c" /> - <ClCompile Include="../../src/xenvif/granter.c" /> <ClCompile Include="../../src/xenvif/link.c" /> <ClCompile Include="../../src/xenvif/mac.c" /> <ClCompile Include="../../src/xenvif/parse.c" /> -- 2.1.1 _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |