win-pvdrivers

changeset 142:8d3f39a47293

Tidy up after xennet-unload-crash bug fix
author James Harper <james.harper@bendigoit.com.au>
date Tue Jan 22 16:30:53 2008 +1100 (2008-01-22)
parents 28ac4e5c2231
children 21a7b050e472
files common/include/xen_public.h xenenum/sources xenenum/xenenum.c xennet/sources xennet/xennet.c xenpci/sources xenvbd/sources
line diff
     1.1 --- a/common/include/xen_public.h	Tue Jan 22 16:15:57 2008 +1100
     1.2 +++ b/common/include/xen_public.h	Tue Jan 22 16:30:53 2008 +1100
     1.3 @@ -108,8 +108,6 @@ typedef struct _XEN_IFACE {
     1.4    PXEN_XENBUS_LIST XenBus_List;
     1.5    PXEN_XENBUS_ADDWATCH XenBus_AddWatch;
     1.6    PXEN_XENBUS_REMWATCH XenBus_RemWatch;
     1.7 -
     1.8 -  PVOID tmp;
     1.9  } XEN_IFACE, *PXEN_IFACE;
    1.10  
    1.11  #define XEN_DATA_MAGIC 0x12345678
     2.1 --- a/xenenum/sources	Tue Jan 22 16:15:57 2008 +1100
     2.2 +++ b/xenenum/sources	Tue Jan 22 16:30:53 2008 +1100
     2.3 @@ -1,7 +1,7 @@
     2.4  TARGETNAME=xenenum
     2.5  TARGETTYPE=DRIVER
     2.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     2.7 -VERSION=0.5.0.20
     2.8 +VERSION=0.5.0.21
     2.9  KMDF_VERSION=1
    2.10  MSC_WARNING_LEVEL=/W4
    2.11  INF_NAME=xenenum
     3.1 --- a/xenenum/xenenum.c	Tue Jan 22 16:15:57 2008 +1100
     3.2 +++ b/xenenum/xenenum.c	Tue Jan 22 16:30:53 2008 +1100
     3.3 @@ -540,8 +540,6 @@ XenEnum_ChildListCreateDevice(WDFCHILDLI
     3.4    ChildDeviceData->XenInterface.XenBus_AddWatch = XenInterface.XenBus_AddWatch;
     3.5    ChildDeviceData->XenInterface.XenBus_RemWatch = XenInterface.XenBus_RemWatch;
     3.6  
     3.7 -  ChildDeviceData->XenInterface.tmp = ExAllocatePoolWithTag(NonPagedPool, PAGE_SIZE, 0x66606660);
     3.8 -
     3.9    WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenInterface, &GUID_XEN_IFACE, NULL);
    3.10    status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
    3.11    if (!NT_SUCCESS(status)) {
     4.1 --- a/xennet/sources	Tue Jan 22 16:15:57 2008 +1100
     4.2 +++ b/xennet/sources	Tue Jan 22 16:30:53 2008 +1100
     4.3 @@ -1,7 +1,7 @@
     4.4  TARGETNAME=XENNET
     4.5  TARGETTYPE=DRIVER
     4.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     4.7 -VERSION=0.5.0.190
     4.8 +VERSION=0.5.0.191
     4.9  KMDF_VERSION=1
    4.10  MSC_WARNING_LEVEL=/W4
    4.11  INF_NAME=xennet
     5.1 --- a/xennet/xennet.c	Tue Jan 22 16:15:57 2008 +1100
     5.2 +++ b/xennet/xennet.c	Tue Jan 22 16:30:53 2008 +1100
     5.3 @@ -130,14 +130,6 @@ struct xennet_info
     5.4    ULONG64 stat_rx_no_buffer;
     5.5  };
     5.6  
     5.7 -static int NdisAlloc;
     5.8 -static int MdlAlloc;
     5.9 -static int BufferAlloc;
    5.10 -static int PacketAlloc;
    5.11 -static int PageAlloc;
    5.12 -static int PacketPoolAlloc;
    5.13 -static int BufferPoolAlloc;
    5.14 -
    5.15  /* This function copied from linux's lib/vsprintf.c, see it for attribution */
    5.16  static unsigned long
    5.17  simple_strtoul(const char *cp,char **endp,unsigned int base)
    5.18 @@ -230,9 +222,7 @@ XenNet_TxBufferGC(struct xennet_info *xi
    5.19        pmdl = *(PMDL *)pkt->MiniportReservedEx;
    5.20        ptr = MmGetMdlVirtualAddress(pmdl);
    5.21        IoFreeMdl(pmdl);
    5.22 -MdlAlloc--;
    5.23        NdisFreeMemory(ptr, 0, 0); // <= DISPATCH_LEVEL
    5.24 -NdisAlloc--;
    5.25        InterlockedDecrement(&xi->tx_outstanding);
    5.26        xi->stat_tx_ok++;
    5.27        NdisMSendComplete(xi->adapter_handle, pkt, NDIS_STATUS_SUCCESS);
    5.28 @@ -283,14 +273,9 @@ XenNet_TxBufferFree(struct xennet_info *
    5.29      /* free linearized data page */
    5.30      pmdl = *(PMDL *)packet->MiniportReservedEx;
    5.31      ptr = MmGetMdlVirtualAddress(pmdl);
    5.32 -KdPrint((__DRIVER_NAME " --- TxBufferFree %p\n", ptr));
    5.33      IoFreeMdl(pmdl);
    5.34 -MdlAlloc--;
    5.35 -      NdisFreeMemory(ptr, 0, 0); // <= DISPATCH_LEVEL
    5.36 -NdisAlloc--;
    5.37 -
    5.38 +    NdisFreeMemory(ptr, 0, 0); // <= DISPATCH_LEVEL
    5.39      NdisMSendComplete(xi->adapter_handle, packet, NDIS_STATUS_FAILURE);
    5.40 -
    5.41      entry = RemoveHeadList(&xi->tx_waiting_pkt_list);
    5.42    }
    5.43  
    5.44 @@ -308,11 +293,8 @@ NdisAlloc--;
    5.45      /* free linearized data page */
    5.46      pmdl = *(PMDL *)packet->MiniportReservedEx;
    5.47      ptr = MmGetMdlVirtualAddress(pmdl);
    5.48 -KdPrint((__DRIVER_NAME " --- TxBufferFree %p\n", ptr));
    5.49      IoFreeMdl(pmdl);
    5.50 -MdlAlloc--;
    5.51 -      NdisFreeMemory(ptr, 0, 0); // <= DISPATCH_LEVEL
    5.52 -NdisAlloc--;
    5.53 +    NdisFreeMemory(ptr, 0, 0); // <= DISPATCH_LEVEL
    5.54  
    5.55      NdisMSendComplete(xi->adapter_handle, packet, NDIS_STATUS_FAILURE);
    5.56    }
    5.57 @@ -333,7 +315,7 @@ XenNet_RxBufferAlloc(struct xennet_info 
    5.58    KIRQL OldIrql;
    5.59    PLIST_ENTRY entry;
    5.60  
    5.61 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    5.62 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    5.63  
    5.64    KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
    5.65  
    5.66 @@ -372,7 +354,7 @@ XenNet_RxBufferAlloc(struct xennet_info 
    5.67  
    5.68    KeReleaseSpinLock(&xi->rx_lock, OldIrql);
    5.69  
    5.70 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    5.71 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    5.72  
    5.73    return NDIS_STATUS_SUCCESS;
    5.74  }
    5.75 @@ -394,8 +376,6 @@ XenNet_RxBufferFree(struct xennet_info *
    5.76  
    5.77    KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
    5.78  
    5.79 -  KdPrint((__DRIVER_NAME "     A\n"));
    5.80 -
    5.81    for (i = 0; i < NET_RX_RING_SIZE; i++)
    5.82    {
    5.83      if (!xi->rx_buffers[i])
    5.84 @@ -410,43 +390,30 @@ XenNet_RxBufferFree(struct xennet_info *
    5.85      NdisAdjustBufferLength(buffer, sizeof(buffer_entry_t));
    5.86      buff_va = NdisBufferVirtualAddressSafe(buffer, NormalPagePriority);
    5.87      NdisFreeBuffer(buffer);
    5.88 -    BufferAlloc--;
    5.89      if (ungranted)
    5.90      {
    5.91        NdisFreeMemory(buff_va, 0, 0); // <= DISPATCH_LEVEL
    5.92 -      NdisAlloc--;
    5.93      }
    5.94    }
    5.95  
    5.96 -  KdPrint((__DRIVER_NAME "     B\n"));
    5.97 -
    5.98    while ((entry = RemoveHeadList(&xi->rx_free_buf_list)) != &xi->rx_free_buf_list)
    5.99    {
   5.100      buffer = CONTAINING_RECORD(entry, buffer_entry_t, entry)->buffer;
   5.101      NdisAdjustBufferLength(buffer, sizeof(buffer_entry_t));
   5.102      buff_va = NdisBufferVirtualAddressSafe(buffer, NormalPagePriority);
   5.103      NdisFreeBuffer(buffer);
   5.104 -    BufferAlloc--;
   5.105      NdisFreeMemory(buff_va, 0, 0); // <= DISPATCH_LEVEL
   5.106 -    NdisAlloc--;
   5.107    }
   5.108  
   5.109 -  KdPrint((__DRIVER_NAME "     C\n"));
   5.110 -
   5.111    while ((entry = RemoveHeadList(&xi->rx_free_pkt_list)) != &xi->rx_free_pkt_list)
   5.112    {
   5.113      packet = CONTAINING_RECORD(entry, NDIS_PACKET, MiniportReservedEx[sizeof(PVOID)]);
   5.114      NdisFreePacket(packet);
   5.115 -    PacketAlloc--;
   5.116    }
   5.117  
   5.118 -  KdPrint((__DRIVER_NAME "     D\n"));
   5.119 -
   5.120    KeReleaseSpinLock(&xi->rx_lock, OldIrql);
   5.121  }
   5.122  
   5.123 -int in_dpc = 0;
   5.124 -
   5.125  VOID
   5.126  XenNet_ReturnPacket(
   5.127    IN NDIS_HANDLE MiniportAdapterContext,
   5.128 @@ -460,14 +427,12 @@ XenNet_ReturnPacket(
   5.129    UINT buff_len;
   5.130    UINT tot_buff_len;
   5.131    buffer_entry_t *buffer_entry;
   5.132 -//  KIRQL OldIrql;
   5.133  
   5.134 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ " (in_dpc = %d)\n", in_dpc));
   5.135 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   5.136  
   5.137    NdisQueryPacketLength(Packet, &tot_buff_len);
   5.138  //  NdisGetFirstBufferFromPacketSafe(Packet, &buffer, &buff_va, &buff_len,
   5.139  //    &tot_buff_len, NormalPagePriority);
   5.140 -  KdPrint((__DRIVER_NAME " Packet = %08x, tot_buff_len = %d, XN_MAX_PKT_SIZE = %d\n", Packet, tot_buff_len, XN_MAX_PKT_SIZE));
   5.141    ASSERT(tot_buff_len <= XN_MAX_PKT_SIZE);
   5.142  //  ASSERT(buff_va != NULL);
   5.143  
   5.144 @@ -476,16 +441,12 @@ XenNet_ReturnPacket(
   5.145    {
   5.146      NdisAdjustBufferLength(buffer, sizeof(buffer_entry_t));
   5.147      buffer_entry = NdisBufferVirtualAddressSafe(buffer, NormalPagePriority);
   5.148 -//    KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
   5.149      InsertTailList(&xi->rx_free_buf_list, &buffer_entry->entry);
   5.150 -//    KeReleaseSpinLock(&xi->rx_lock, OldIrql);
   5.151      NdisUnchainBufferAtBack(Packet, &buffer);
   5.152    }
   5.153  
   5.154    NdisReinitializePacket(Packet);
   5.155 -//  KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
   5.156    InsertTailList(&xi->rx_free_pkt_list, (PLIST_ENTRY)&Packet->MiniportReservedEx[sizeof(PVOID)]);
   5.157 -//  KeReleaseSpinLock(&xi->rx_lock, OldIrql);
   5.158    
   5.159    InterlockedDecrement(&xi->rx_outstanding);
   5.160  
   5.161 @@ -493,7 +454,7 @@ XenNet_ReturnPacket(
   5.162    if (!xi->connected && !xi->rx_outstanding)
   5.163      KeSetEvent(&xi->shutdown_event, 1, FALSE);  
   5.164  
   5.165 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.166 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.167  }
   5.168  
   5.169  // Called at DISPATCH_LEVEL
   5.170 @@ -510,11 +471,10 @@ XenNet_RxBufferCheck(struct xennet_info 
   5.171    int more_frags = 0;
   5.172    UINT length;
   5.173  
   5.174 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   5.175 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   5.176  
   5.177    ASSERT(xi->connected);
   5.178  
   5.179 -  in_dpc = 1;
   5.180    KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
   5.181  
   5.182    do {
   5.183 @@ -525,27 +485,20 @@ XenNet_RxBufferCheck(struct xennet_info 
   5.184        rxrsp = RING_GET_RESPONSE(&xi->rx, cons);
   5.185        ASSERT(rxrsp->status > 0);
   5.186  
   5.187 -      KdPrint((__DRIVER_NAME " rx id = %d\n", rxrsp->id));
   5.188 -
   5.189        if (!more_frags) // handling the packet's 1st buffer
   5.190        {
   5.191          entry = RemoveHeadList(&xi->rx_free_pkt_list);
   5.192          ASSERT(entry != &xi->rx_free_pkt_list);
   5.193          packet = CONTAINING_RECORD(entry, NDIS_PACKET, MiniportReservedEx[sizeof(PVOID)]);
   5.194          NDIS_SET_PACKET_HEADER_SIZE(packet, XN_HDR_SIZE);
   5.195 -        KdPrint((__DRIVER_NAME " New Packet = %08x\n", packet));
   5.196          NdisQueryPacketLength(packet, &length);
   5.197 -        KdPrint((__DRIVER_NAME " Length = %d\n", length));
   5.198        }
   5.199  
   5.200        buffer = xi->rx_buffers[rxrsp->id];
   5.201        xi->rx_buffers[rxrsp->id] = NULL;
   5.202        NdisAdjustBufferLength(buffer, rxrsp->status);
   5.203        NdisChainBufferAtBack(packet, buffer);
   5.204 -      KdPrint((__DRIVER_NAME " Appended %d bytes\n", rxrsp->status));
   5.205        NdisQueryPacketLength(packet, &length);
   5.206 -      KdPrint((__DRIVER_NAME " Length = %d\n", length));
   5.207 -
   5.208        xi->XenInterface.GntTbl_EndAccess(xi->XenInterface.InterfaceHeader.Context,
   5.209          xi->grant_rx_ref[rxrsp->id]);
   5.210        xi->grant_rx_ref[rxrsp->id] = GRANT_INVALID_REF;
   5.211 @@ -575,7 +528,6 @@ XenNet_RxBufferCheck(struct xennet_info 
   5.212      RING_FINAL_CHECK_FOR_RESPONSES(&xi->rx, moretodo);
   5.213    } while (moretodo);
   5.214  
   5.215 -  in_dpc = 0;
   5.216    KeReleaseSpinLock(&xi->rx_lock, OldIrql);
   5.217  
   5.218    if (more_frags)
   5.219 @@ -587,7 +539,7 @@ XenNet_RxBufferCheck(struct xennet_info 
   5.220    /* Give netback more buffers */
   5.221    XenNet_RxBufferAlloc(xi);
   5.222  
   5.223 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.224 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.225  
   5.226    return NDIS_STATUS_SUCCESS;
   5.227  }
   5.228 @@ -625,8 +577,8 @@ XenNet_BackEndStateHandler(char *Path, P
   5.229    char *err;
   5.230    ULONG new_backend_state;
   5.231  
   5.232 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   5.233 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   5.234 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   5.235 +//  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   5.236  
   5.237    err = xi->XenInterface.XenBus_Read(xi->XenInterface.InterfaceHeader.Context,
   5.238      XBT_NIL, Path, &Value);
   5.239 @@ -684,7 +636,7 @@ XenNet_BackEndStateHandler(char *Path, P
   5.240  
   5.241    KeSetEvent(&xi->backend_state_change_event, 1, FALSE);
   5.242  
   5.243 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.244 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.245  
   5.246    return;
   5.247  }
   5.248 @@ -754,7 +706,6 @@ XenNet_Init(
   5.249  
   5.250    /* Alloc memory for adapter private info */
   5.251    status = NdisAllocateMemoryWithTag(&xi, sizeof(*xi), XENNET_POOL_TAG);
   5.252 -NdisAlloc++;
   5.253    if (!NT_SUCCESS(status))
   5.254    {
   5.255      KdPrint(("NdisAllocateMemoryWithTag failed with 0x%x\n", status));
   5.256 @@ -781,7 +732,6 @@ NdisAlloc++;
   5.257    
   5.258    NdisAllocatePacketPool(&status, &xi->packet_pool, XN_RX_QUEUE_LEN,
   5.259      PROTOCOL_RESERVED_SIZE_IN_PACKET);
   5.260 -PacketPoolAlloc++;
   5.261    if (status != NDIS_STATUS_SUCCESS)
   5.262    {
   5.263      KdPrint(("NdisAllocatePacketPool failed with 0x%x\n", status));
   5.264 @@ -791,7 +741,6 @@ PacketPoolAlloc++;
   5.265    NdisSetPacketPoolProtocolId(xi->packet_pool, NDIS_PROTOCOL_ID_TCP_IP);
   5.266  
   5.267    NdisAllocateBufferPool(&status, &xi->buffer_pool, XN_RX_QUEUE_LEN);
   5.268 -BufferPoolAlloc++;
   5.269    if (status != NDIS_STATUS_SUCCESS)
   5.270    {
   5.271      KdPrint(("NdisAllocateBufferPool failed with 0x%x\n", status));
   5.272 @@ -852,7 +801,6 @@ BufferPoolAlloc++;
   5.273  
   5.274    RtlStringCbPrintfA(TmpPath, ARRAY_SIZE(TmpPath),
   5.275        "%s/backend", xi->pdo_data->Path);
   5.276 -  KdPrint(("About to read %s to get backend path\n", TmpPath));
   5.277    res = xi->XenInterface.XenBus_Read(xi->XenInterface.InterfaceHeader.Context,
   5.278        XBT_NIL, TmpPath, &Value);
   5.279    if (res)
   5.280 @@ -889,7 +837,6 @@ BufferPoolAlloc++;
   5.281      xi->event_channel, XenNet_Interrupt, xi);
   5.282  
   5.283    xi->tx_mdl = AllocatePage();
   5.284 -  PageAlloc++;
   5.285    xi->tx_pgs = MmGetMdlVirtualAddress(xi->tx_mdl);
   5.286    SHARED_RING_INIT(xi->tx_pgs);
   5.287    FRONT_RING_INIT(&xi->tx, xi->tx_pgs, PAGE_SIZE);
   5.288 @@ -898,7 +845,6 @@ BufferPoolAlloc++;
   5.289      *MmGetMdlPfnArray(xi->tx_mdl), FALSE);
   5.290  
   5.291    xi->rx_mdl = AllocatePage();
   5.292 -  PageAlloc++;
   5.293    xi->rx_pgs = MmGetMdlVirtualAddress(xi->rx_mdl);
   5.294    SHARED_RING_INIT(xi->rx_pgs);
   5.295    FRONT_RING_INIT(&xi->rx, xi->rx_pgs, PAGE_SIZE);
   5.296 @@ -954,33 +900,21 @@ BufferPoolAlloc++;
   5.297  
   5.298    KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
   5.299  
   5.300 -KdPrint((__DRIVER_NAME "     A\n"));
   5.301    for (i = 0; i < XN_RX_QUEUE_LEN; i++)
   5.302    {
   5.303 -KdPrint((__DRIVER_NAME "     B - %d\n", sizeof(buffer_entry_t)));
   5.304      status = NdisAllocateMemoryWithTag(&buffer_entry, sizeof(buffer_entry_t), XENNET_POOL_TAG);
   5.305 -    NdisAlloc++;
   5.306      if (status != NDIS_STATUS_SUCCESS)
   5.307      {
   5.308        KdPrint(("NdisAllocateMemoryWithTag Failed! status = 0x%x\n", status));
   5.309        break;
   5.310      }
   5.311 -KdPrint((__DRIVER_NAME "     C - %d\n", sizeof(buffer_entry->data)));
   5.312      NdisAllocateBuffer(&status, &buffer_entry->buffer, xi->buffer_pool, buffer_entry, sizeof(buffer_entry->data));
   5.313      ASSERT(status == NDIS_STATUS_SUCCESS); // should never fail
   5.314 -    BufferAlloc++;
   5.315 -KdPrint((__DRIVER_NAME "     D\n"));
   5.316 -    
   5.317      InsertTailList(&xi->rx_free_buf_list, &buffer_entry->entry);
   5.318 -KdPrint((__DRIVER_NAME "     E\n"));
   5.319  
   5.320      NdisAllocatePacket(&status, &packet, xi->packet_pool);
   5.321 -    PacketAlloc++;
   5.322 -KdPrint((__DRIVER_NAME "     F\n"));
   5.323      entry = (PLIST_ENTRY)&packet->MiniportReservedEx[sizeof(PVOID)];
   5.324 -KdPrint((__DRIVER_NAME "     G\n"));
   5.325      InsertTailList(&xi->rx_free_pkt_list, entry);
   5.326 -KdPrint((__DRIVER_NAME "     H\n"));
   5.327    }
   5.328  
   5.329    KeReleaseSpinLock(&xi->rx_lock, OldIrql);
   5.330 @@ -1023,7 +957,6 @@ KdPrint((__DRIVER_NAME "     H\n"));
   5.331  
   5.332  err:
   5.333    NdisFreeMemory(xi, 0, 0);
   5.334 -NdisAlloc--;
   5.335    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.336    return status;
   5.337  }
   5.338 @@ -1542,7 +1475,6 @@ XenNet_Linearize(PNDIS_PACKET Packet)
   5.339    ASSERT(tot_buff_len <= XN_MAX_PKT_SIZE);
   5.340  
   5.341    status = NdisAllocateMemoryWithTag(&start, PAGE_SIZE, XENNET_POOL_TAG);
   5.342 -NdisAlloc++;
   5.343    if (!NT_SUCCESS(status))
   5.344    {
   5.345      KdPrint(("Could not allocate memory for linearization\n"));
   5.346 @@ -1554,10 +1486,8 @@ NdisAlloc++;
   5.347    {
   5.348      KdPrint(("Could not allocate MDL for linearization\n"));
   5.349      NdisFreeMemory(start, 0, 0);
   5.350 -NdisAlloc--;
   5.351      return NULL;
   5.352    }
   5.353 -MdlAlloc++;
   5.354    MmBuildMdlForNonPagedPool(pmdl);
   5.355  
   5.356    while (buffer)
   5.357 @@ -1731,8 +1661,6 @@ XenNet_Halt(
   5.358  
   5.359    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   5.360    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   5.361 -//  KdPrint((__DRIVER_NAME "     tx_outstanding = %d\n", xi->tx_outstanding));
   5.362 -//  KdPrint((__DRIVER_NAME "     rx_outstanding = %d\n", xi->rx_outstanding));
   5.363  
   5.364    // set frontend state to 'closing'
   5.365    xi->state = XenbusStateClosing;
   5.366 @@ -1777,22 +1705,11 @@ XenNet_Halt(
   5.367  
   5.368    // TODO: remove event channel xenbus entry (how?)
   5.369  
   5.370 -//  KdPrint((__DRIVER_NAME "     tx_outstanding = %d\n", xi->tx_outstanding));
   5.371 -//  KdPrint((__DRIVER_NAME "     rx_outstanding = %d\n", xi->rx_outstanding));
   5.372 -
   5.373 -KdPrint((__DRIVER_NAME "     NdisAlloc = %d\n", NdisAlloc));
   5.374 -KdPrint((__DRIVER_NAME "     MdlAlloc = %d\n", MdlAlloc));
   5.375 -KdPrint((__DRIVER_NAME "     BufferAlloc = %d\n", BufferAlloc));
   5.376 -KdPrint((__DRIVER_NAME "     PacketAlloc = %d\n", PacketAlloc));
   5.377 -KdPrint((__DRIVER_NAME "     PageAlloc = %d\n", PageAlloc));
   5.378 -KdPrint((__DRIVER_NAME "     PacketPoolAlloc = %d\n", PacketPoolAlloc));
   5.379 -KdPrint((__DRIVER_NAME "     BufferPoolAlloc = %d\n", BufferPoolAlloc));
   5.380    /* free TX resources */
   5.381    if (xi->XenInterface.GntTbl_EndAccess(if_cxt, xi->tx_ring_ref))
   5.382    {
   5.383      xi->tx_ring_ref = GRANT_INVALID_REF;
   5.384      FreePages(xi->tx_mdl);
   5.385 -PageAlloc--;
   5.386    }
   5.387    /* if EndAccess fails then tx/rx ring pages LEAKED -- it's not safe to reuse
   5.388       pages Dom0 still has access to */
   5.389 @@ -1803,21 +1720,12 @@ PageAlloc--;
   5.390    {
   5.391      xi->rx_ring_ref = GRANT_INVALID_REF;
   5.392      FreePages(xi->rx_mdl);
   5.393 -PageAlloc--;
   5.394    }
   5.395    xi->rx_pgs = NULL;
   5.396  
   5.397    XenNet_TxBufferFree(xi);
   5.398    XenNet_RxBufferFree(MiniportAdapterContext);
   5.399  
   5.400 -KdPrint((__DRIVER_NAME "     NdisAlloc = %d\n", NdisAlloc));
   5.401 -KdPrint((__DRIVER_NAME "     MdlAlloc = %d\n", MdlAlloc));
   5.402 -KdPrint((__DRIVER_NAME "     BufferAlloc = %d\n", BufferAlloc));
   5.403 -KdPrint((__DRIVER_NAME "     PacketAlloc = %d\n", PacketAlloc));
   5.404 -KdPrint((__DRIVER_NAME "     PageAlloc = %d\n", PageAlloc));
   5.405 -KdPrint((__DRIVER_NAME "     PacketPoolAlloc = %d\n", PacketPoolAlloc));
   5.406 -KdPrint((__DRIVER_NAME "     BufferPoolAlloc = %d\n", BufferPoolAlloc));
   5.407 -
   5.408    /* Remove watch on backend state */
   5.409    RtlStringCbPrintfA(TmpPath, ARRAY_SIZE(TmpPath), "%s/state", xi->backend_path);
   5.410    xi->XenInterface.XenBus_RemWatch(if_cxt, XBT_NIL, TmpPath,
   5.411 @@ -1826,41 +1734,10 @@ KdPrint((__DRIVER_NAME "     BufferPoolA
   5.412    xi->XenInterface.InterfaceHeader.InterfaceDereference(NULL);
   5.413  
   5.414    NdisFreeBufferPool(xi->buffer_pool);
   5.415 -BufferPoolAlloc--;
   5.416    NdisFreePacketPool(xi->packet_pool);
   5.417 -PacketPoolAlloc--;
   5.418 -
   5.419 -KdPrint((__DRIVER_NAME "     NdisAlloc = %d\n", NdisAlloc));
   5.420 -KdPrint((__DRIVER_NAME "     MdlAlloc = %d\n", MdlAlloc));
   5.421 -KdPrint((__DRIVER_NAME "     BufferAlloc = %d\n", BufferAlloc));
   5.422 -KdPrint((__DRIVER_NAME "     PacketAlloc = %d\n", PacketAlloc));
   5.423 -KdPrint((__DRIVER_NAME "     PageAlloc = %d\n", PageAlloc));
   5.424 -KdPrint((__DRIVER_NAME "     PacketPoolAlloc = %d\n", PacketPoolAlloc));
   5.425 -KdPrint((__DRIVER_NAME "     BufferPoolAlloc = %d\n", BufferPoolAlloc));
   5.426 -
   5.427 -  KdPrint((__DRIVER_NAME "     tx_outstanding = %d\n", xi->tx_outstanding));
   5.428 -  KdPrint((__DRIVER_NAME "     rx_outstanding = %d\n", xi->rx_outstanding));
   5.429  
   5.430    NdisFreeMemory(xi, 0, 0); // <= DISPATCH_LEVEL
   5.431 -NdisAlloc--;
   5.432  
   5.433 -KdPrint((__DRIVER_NAME "     NdisAlloc = %d\n", NdisAlloc));
   5.434 -KdPrint((__DRIVER_NAME "     MdlAlloc = %d\n", MdlAlloc));
   5.435 -KdPrint((__DRIVER_NAME "     BufferAlloc = %d\n", BufferAlloc));
   5.436 -KdPrint((__DRIVER_NAME "     PacketAlloc = %d\n", PacketAlloc));
   5.437 -KdPrint((__DRIVER_NAME "     PageAlloc = %d\n", PageAlloc));
   5.438 -KdPrint((__DRIVER_NAME "     PacketPoolAlloc = %d\n", PacketPoolAlloc));
   5.439 -KdPrint((__DRIVER_NAME "     BufferPoolAlloc = %d\n", BufferPoolAlloc));
   5.440 -
   5.441 -
   5.442 -#if 0
   5.443 -  if (xi->XenInterface.tmp != NULL)
   5.444 -  {
   5.445 -KdPrint(("     tmp = 0x%p\n", xi->XenInterface.tmp));
   5.446 -    ExFreePoolWithTag(xi->XenInterface.tmp, 0x66606660);
   5.447 -    xi->XenInterface.tmp = NULL;
   5.448 -  }
   5.449 -#endif
   5.450    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.451  }
   5.452  
   5.453 @@ -1889,14 +1766,6 @@ DriverEntry(
   5.454    NDIS_HANDLE ndis_wrapper_handle;
   5.455    NDIS_MINIPORT_CHARACTERISTICS mini_chars;
   5.456  
   5.457 -NdisAlloc = 0;
   5.458 -MdlAlloc = 0;
   5.459 -BufferAlloc = 0;
   5.460 -PacketAlloc = 0;
   5.461 -PageAlloc = 0;
   5.462 -PacketPoolAlloc = 0;
   5.463 -BufferPoolAlloc = 0;
   5.464 -
   5.465    RtlZeroMemory(&mini_chars, sizeof(mini_chars));
   5.466  
   5.467    WDF_DRIVER_CONFIG_INIT(&config, WDF_NO_EVENT_CALLBACK);
     6.1 --- a/xenpci/sources	Tue Jan 22 16:15:57 2008 +1100
     6.2 +++ b/xenpci/sources	Tue Jan 22 16:30:53 2008 +1100
     6.3 @@ -1,7 +1,7 @@
     6.4  TARGETNAME=XENPCI
     6.5  TARGETTYPE=DRIVER
     6.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     6.7 -VERSION=0.5.0.42
     6.8 +VERSION=0.5.0.43
     6.9  KMDF_VERSION=1
    6.10  MSC_WARNING_LEVEL=/W4
    6.11  INF_NAME=xenpci
     7.1 --- a/xenvbd/sources	Tue Jan 22 16:15:57 2008 +1100
     7.2 +++ b/xenvbd/sources	Tue Jan 22 16:30:53 2008 +1100
     7.3 @@ -1,7 +1,7 @@
     7.4  TARGETNAME=XENVBD
     7.5  TARGETTYPE=DRIVER
     7.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     7.7 -VERSION=0.5.0.16
     7.8 +VERSION=0.5.0.17
     7.9  KMDF_VERSION=1
    7.10  MSC_WARNING_LEVEL=/W4
    7.11  INF_NAME=xenvbd