win-pvdrivers

changeset 140:76a661426861

Fixed an error on freeing rx buffers. System now crashes after unload, as per the original fault. Dammit.
author James Harper <james.harper@bendigoit.com.au>
date Mon Jan 21 23:45:15 2008 +1100 (2008-01-21)
parents 00e9b5835d28
children 28ac4e5c2231
files xennet/sources xennet/xennet.c
line diff
     1.1 --- a/xennet/sources	Mon Jan 21 23:23:23 2008 +1100
     1.2 +++ b/xennet/sources	Mon Jan 21 23:45:15 2008 +1100
     1.3 @@ -1,7 +1,7 @@
     1.4  TARGETNAME=XENNET
     1.5  TARGETTYPE=DRIVER
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7 -VERSION=0.5.0.174
     1.8 +VERSION=0.5.0.175
     1.9  KMDF_VERSION=1
    1.10  MSC_WARNING_LEVEL=/W4
    1.11  INF_NAME=xennet
     2.1 --- a/xennet/xennet.c	Mon Jan 21 23:23:23 2008 +1100
     2.2 +++ b/xennet/xennet.c	Mon Jan 21 23:45:15 2008 +1100
     2.3 @@ -395,6 +395,8 @@ XenNet_RxBufferFree(struct xennet_info *
     2.4  
     2.5    KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
     2.6  
     2.7 +  KdPrint((__DRIVER_NAME "     A\n"));
     2.8 +
     2.9    for (i = 0; i < NET_RX_RING_SIZE; i++)
    2.10    {
    2.11      if (!xi->rx_buffers[i])
    2.12 @@ -414,9 +416,11 @@ XenNet_RxBufferFree(struct xennet_info *
    2.13      NdisAlloc--;
    2.14    }
    2.15  
    2.16 +  KdPrint((__DRIVER_NAME "     B\n"));
    2.17 +
    2.18    while ((entry = RemoveHeadList(&xi->rx_free_buf_list)) != &xi->rx_free_buf_list)
    2.19    {
    2.20 -    buffer = (PNDIS_BUFFER)CONTAINING_RECORD(entry, buffer_entry_t, entry);
    2.21 +    buffer = CONTAINING_RECORD(entry, buffer_entry_t, entry)->buffer;
    2.22      NdisAdjustBufferLength(buffer, sizeof(buffer_entry_t));
    2.23      buff_va = NdisBufferVirtualAddressSafe(buffer, NormalPagePriority);
    2.24      NdisFreeBuffer(buffer);
    2.25 @@ -425,6 +429,8 @@ XenNet_RxBufferFree(struct xennet_info *
    2.26      NdisAlloc--;
    2.27    }
    2.28  
    2.29 +  KdPrint((__DRIVER_NAME "     C\n"));
    2.30 +
    2.31    while ((entry = RemoveHeadList(&xi->rx_free_pkt_list)) != &xi->rx_free_pkt_list)
    2.32    {
    2.33      packet = CONTAINING_RECORD(entry, NDIS_PACKET, MiniportReservedEx[sizeof(PVOID)]);
    2.34 @@ -432,6 +438,8 @@ XenNet_RxBufferFree(struct xennet_info *
    2.35      PacketAlloc--;
    2.36    }
    2.37  
    2.38 +  KdPrint((__DRIVER_NAME "     D\n"));
    2.39 +
    2.40    KeReleaseSpinLock(&xi->rx_lock, OldIrql);
    2.41  }
    2.42  
    2.43 @@ -1784,6 +1792,14 @@ PageAlloc--;
    2.44    XenNet_TxBufferFree(xi);
    2.45    XenNet_RxBufferFree(MiniportAdapterContext);
    2.46  
    2.47 +KdPrint((__DRIVER_NAME "     NdisAlloc = %d\n", NdisAlloc));
    2.48 +KdPrint((__DRIVER_NAME "     MdlAlloc = %d\n", MdlAlloc));
    2.49 +KdPrint((__DRIVER_NAME "     BufferAlloc = %d\n", BufferAlloc));
    2.50 +KdPrint((__DRIVER_NAME "     PacketAlloc = %d\n", PacketAlloc));
    2.51 +KdPrint((__DRIVER_NAME "     PageAlloc = %d\n", PageAlloc));
    2.52 +KdPrint((__DRIVER_NAME "     PacketPoolAlloc = %d\n", PacketPoolAlloc));
    2.53 +KdPrint((__DRIVER_NAME "     BufferPoolAlloc = %d\n", BufferPoolAlloc));
    2.54 +
    2.55    /* Remove watch on backend state */
    2.56    RtlStringCbPrintfA(TmpPath, ARRAY_SIZE(TmpPath), "%s/state", xi->backend_path);
    2.57    xi->XenInterface.XenBus_RemWatch(if_cxt, XBT_NIL, TmpPath,