win-pvdrivers

changeset 175:c8d4df1e1d12

Tinkered with locking in xennet to try and fix smp crashes
author James Harper <james.harper@bendigoit.com.au>
date Tue Feb 05 22:53:41 2008 +1100 (2008-02-05)
parents 02a14f8e0298
children 09f1c620ba55
files common.inc makedist.bat xennet/xennet.c
line diff
     1.1 --- a/common.inc	Tue Feb 05 22:18:20 2008 +1100
     1.2 +++ b/common.inc	Tue Feb 05 22:53:41 2008 +1100
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.6.5.15
     1.5 +VERSION=0.7.0.0
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  KMDF_VERSION=1
     1.8  !IF $(_NT_TOOLS_VERSION) > 0x700
     2.1 --- a/makedist.bat	Tue Feb 05 22:18:20 2008 +1100
     2.2 +++ b/makedist.bat	Tue Feb 05 22:53:41 2008 +1100
     2.3 @@ -1,6 +1,6 @@
     2.4  @echo off
     2.5 -cmd /C "C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk AMD64 WNET && CD \Projects\win-pvdrivers.hg && build -cZg"
     2.6 -cmd /C "C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk WNET && CD \Projects\win-pvdrivers.hg && build -cZg"
     2.7 -cmd /C "C:\WinDDK\6000\bin\setenv.bat C:\WinDDK\6000\ chk WXP && CD \Projects\win-pvdrivers.hg && build -cZg"
     2.8 +cmd /C "C:\WinDDK\6001.17121\bin\setenv.bat C:\WinDDK\6001.17121\ chk AMD64 WNET && CD \Projects\win-pvdrivers.hg && build -cZg"
     2.9 +cmd /C "C:\WinDDK\6001.17121\bin\setenv.bat C:\WinDDK\6001.17121\ chk WNET && CD \Projects\win-pvdrivers.hg && build -cZg"
    2.10 +cmd /C "C:\WinDDK\6001.17121\bin\setenv.bat C:\WinDDK\6001.17121\ chk WXP && CD \Projects\win-pvdrivers.hg && build -cZg"
    2.11  xcopy target\* dist /E /EXCLUDE:exclude.txt /I /D /Y
    2.12  copy doc\*.txt dist
     3.1 --- a/xennet/xennet.c	Tue Feb 05 22:18:20 2008 +1100
     3.2 +++ b/xennet/xennet.c	Tue Feb 05 22:53:41 2008 +1100
     3.3 @@ -300,7 +300,8 @@ XenNet_TxBufferFree(struct xennet_info *
     3.4    }
     3.5  }
     3.6  
     3.7 -// Called at DISPATCH_LEVEL with no locks held
     3.8 +// Called at DISPATCH_LEVEL with rx lock held
     3.9 +
    3.10  static NDIS_STATUS
    3.11  XenNet_RxBufferAlloc(struct xennet_info *xi)
    3.12  {
    3.13 @@ -310,15 +311,10 @@ XenNet_RxBufferAlloc(struct xennet_info 
    3.14    RING_IDX req_prod = xi->rx.req_prod_pvt;
    3.15    grant_ref_t ref;
    3.16    netif_rx_request_t *req;
    3.17 -//  NDIS_STATUS status;
    3.18 -//  PVOID start;
    3.19 -  KIRQL OldIrql;
    3.20    PLIST_ENTRY entry;
    3.21  
    3.22  //  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.23  
    3.24 -  KeAcquireSpinLock(&xi->rx_lock, &OldIrql);
    3.25 -
    3.26    batch_target = xi->rx_target - (req_prod - xi->rx.rsp_cons);
    3.27  
    3.28    for (i = 0; i < batch_target; i++)
    3.29 @@ -352,8 +348,6 @@ XenNet_RxBufferAlloc(struct xennet_info 
    3.30        xi->event_channel);
    3.31    }
    3.32  
    3.33 -  KeReleaseSpinLock(&xi->rx_lock, OldIrql);
    3.34 -
    3.35  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    3.36  
    3.37    return NDIS_STATUS_SUCCESS;
    3.38 @@ -431,10 +425,6 @@ XenNet_ReturnPacket(
    3.39  //  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.40  
    3.41    NdisQueryPacketLength(Packet, &tot_buff_len);
    3.42 -//  NdisGetFirstBufferFromPacketSafe(Packet, &buffer, &buff_va, &buff_len,
    3.43 -//    &tot_buff_len, NormalPagePriority);
    3.44 -  ASSERT(tot_buff_len <= XN_MAX_PKT_SIZE);
    3.45 -//  ASSERT(buff_va != NULL);
    3.46  
    3.47    NdisUnchainBufferAtBack(Packet, &buffer);
    3.48    while (buffer)
    3.49 @@ -528,8 +518,6 @@ XenNet_RxBufferCheck(struct xennet_info 
    3.50      RING_FINAL_CHECK_FOR_RESPONSES(&xi->rx, moretodo);
    3.51    } while (moretodo);
    3.52  
    3.53 -  KeReleaseSpinLock(&xi->rx_lock, OldIrql);
    3.54 -
    3.55    if (more_frags)
    3.56    {
    3.57      KdPrint((__DRIVER_NAME "     Missing fragments\n"));
    3.58 @@ -539,6 +527,8 @@ XenNet_RxBufferCheck(struct xennet_info 
    3.59    /* Give netback more buffers */
    3.60    XenNet_RxBufferAlloc(xi);
    3.61  
    3.62 +  KeReleaseSpinLock(&xi->rx_lock, OldIrql);
    3.63 +
    3.64  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    3.65  
    3.66    return NDIS_STATUS_SUCCESS;
    3.67 @@ -917,10 +907,10 @@ XenNet_Init(
    3.68      InsertTailList(&xi->rx_free_pkt_list, entry);
    3.69    }
    3.70  
    3.71 +  XenNet_RxBufferAlloc(xi);
    3.72 +
    3.73    KeReleaseSpinLock(&xi->rx_lock, OldIrql);
    3.74  
    3.75 -  XenNet_RxBufferAlloc(xi);
    3.76 -
    3.77    /* get mac address */
    3.78    RtlStringCbPrintfA(TmpPath, ARRAY_SIZE(TmpPath), "%s/mac", xi->backend_path);
    3.79    xi->XenInterface.XenBus_Read(xi->XenInterface.InterfaceHeader.Context,
    3.80 @@ -1556,14 +1546,14 @@ XenNet_SendQueuedPackets(struct xennet_i
    3.81      entry = RemoveHeadList(&xi->tx_waiting_pkt_list);
    3.82    }
    3.83  
    3.84 -  KeReleaseSpinLock(&xi->tx_lock, OldIrql);
    3.85 -
    3.86    RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xi->tx, notify);
    3.87    if (notify)
    3.88    {
    3.89      xi->XenInterface.EvtChn_Notify(xi->XenInterface.InterfaceHeader.Context,
    3.90        xi->event_channel);
    3.91    }
    3.92 +
    3.93 +  KeReleaseSpinLock(&xi->tx_lock, OldIrql);
    3.94  }
    3.95  
    3.96  VOID