win-pvdrivers

changeset 14:bde45c4eca0c

fix warnings in net driver
author Andy Grover <andy@groveronline.com>
date Wed Nov 28 14:51:20 2007 -0800 (2007-11-28)
parents be8c09632f31
children 7f0f866dced6
files xennet/xennet.c
line diff
     1.1 --- a/xennet/xennet.c	Wed Nov 28 14:51:17 2007 -0800
     1.2 +++ b/xennet/xennet.c	Wed Nov 28 14:51:20 2007 -0800
     1.3 @@ -29,12 +29,14 @@ Foundation, Inc., 51 Franklin Street, Fi
     1.4  #define NET_TX_RING_SIZE __RING_SIZE((struct netif_tx_sring *)0, PAGE_SIZE)
     1.5  #define NET_RX_RING_SIZE __RING_SIZE((struct netif_rx_sring *)0, PAGE_SIZE)
     1.6  
     1.7 +#pragma warning(disable: 4127)
     1.8 +
     1.9  struct xennet_info
    1.10  {
    1.11    PDEVICE_OBJECT pdo;
    1.12    PDEVICE_OBJECT fdo;
    1.13    PDEVICE_OBJECT lower_do;
    1.14 -  WDFDEVICE *wdf_device;
    1.15 +  WDFDEVICE wdf_device;
    1.16  
    1.17    WCHAR name[NAME_SIZE];
    1.18    NDIS_HANDLE adapter_handle;
    1.19 @@ -52,12 +54,13 @@ struct xennet_info
    1.20    struct netif_tx_front_ring tx;
    1.21    struct netif_rx_front_ring rx;
    1.22  
    1.23 -  /* do we need to keep track of these? */
    1.24 -  struct netif_tx_sring *txs;
    1.25 -  struct netif_rx_sring *rxs;
    1.26 +  PMDL tx_mdl;
    1.27 +  PMDL rx_mdl;
    1.28 +  struct netif_tx_sring *tx_pgs;
    1.29 +  struct netif_rx_sring *rx_pgs;
    1.30  
    1.31    UINT irq;
    1.32 -  SHORT event_channel;
    1.33 +  evtchn_port_t event_channel;
    1.34  
    1.35    grant_ref_t tx_ring_ref;
    1.36    grant_ref_t rx_ring_ref;
    1.37 @@ -104,8 +107,11 @@ XenNet_Interrupt(
    1.38    PVOID ServiceContext
    1.39    )
    1.40  {
    1.41 -  struct xennet_info *xennet_info = ServiceContext;
    1.42 -  KIRQL KIrql;
    1.43 +  // struct xennet_info *xennet_info = ServiceContext;
    1.44 +  // KIRQL KIrql;
    1.45 +
    1.46 +  UNREFERENCED_PARAMETER(Interrupt);
    1.47 +  UNREFERENCED_PARAMETER(ServiceContext);
    1.48  
    1.49    // KeAcquireSpinLock(&ChildDeviceData->Lock, &KIrql);
    1.50    // KdPrint((__DRIVER_NAME " --> Setting Dpc Event\n"));
    1.51 @@ -123,6 +129,7 @@ XenNet_Halt(
    1.52    IN NDIS_HANDLE MiniportAdapterContext
    1.53    )
    1.54  {
    1.55 +  UNREFERENCED_PARAMETER(MiniportAdapterContext);
    1.56  }
    1.57  
    1.58  static NDIS_STATUS
    1.59 @@ -139,10 +146,11 @@ XenNet_Init(
    1.60    UINT i;
    1.61    BOOLEAN medium_found = FALSE;
    1.62    struct xennet_info *xi = NULL;
    1.63 -  UINT length;
    1.64 +  ULONG length;
    1.65    WDF_OBJECT_ATTRIBUTES wdf_attrs;
    1.66 -  PMDL mdl;
    1.67 -  ULONG pfn;
    1.68 +
    1.69 +  UNREFERENCED_PARAMETER(OpenErrorStatus);
    1.70 +  UNREFERENCED_PARAMETER(WrapperConfigurationContext);
    1.71  
    1.72    /* deal with medium stuff */
    1.73    for (i = 0; i < MediumArraySize; i++)
    1.74 @@ -247,21 +255,23 @@ XenNet_Init(
    1.75  
    1.76    /* TODO: must free pages in MDL as well as MDL using MmFreePagesFromMdl and ExFreePool */
    1.77    // or, allocate mem and then get mdl, then free mdl
    1.78 -  mdl = AllocatePage();
    1.79 -  pfn = *MmGetMdlPfnArray(mdl);
    1.80 -  xi->txs = MmMapLockedPages(mdl, KernelMode);
    1.81 -  SHARED_RING_INIT(xi->txs);
    1.82 -  FRONT_RING_INIT(&xi->tx, xi->txs, PAGE_SIZE);
    1.83 +  xi->tx_mdl = AllocatePage();
    1.84 +  xi->tx_pgs = MmMapLockedPagesSpecifyCache(xi->tx_mdl, KernelMode, MmNonCached,
    1.85 +    NULL, FALSE, NormalPagePriority);
    1.86 +  SHARED_RING_INIT(xi->tx_pgs);
    1.87 +  FRONT_RING_INIT(&xi->tx, xi->tx_pgs, PAGE_SIZE);
    1.88    xi->tx_ring_ref = xi->GntTblInterface.GrantAccess(
    1.89 -    xi->GntTblInterface.InterfaceHeader.Context, 0, pfn, FALSE);
    1.90 -
    1.91 -  mdl = AllocatePage();
    1.92 -  pfn = *MmGetMdlPfnArray(mdl);
    1.93 -  xi->rxs = MmMapLockedPages(mdl, KernelMode);
    1.94 -  SHARED_RING_INIT(xi->rxs);
    1.95 -  FRONT_RING_INIT(&xi->rx, xi->rxs, PAGE_SIZE);
    1.96 +    xi->GntTblInterface.InterfaceHeader.Context, 0,
    1.97 +    *MmGetMdlPfnArray(xi->tx_mdl), FALSE);
    1.98 + 
    1.99 +  xi->rx_mdl = AllocatePage();
   1.100 +  xi->rx_pgs = MmMapLockedPagesSpecifyCache(xi->rx_mdl, KernelMode, MmNonCached,
   1.101 +    NULL, FALSE, NormalPagePriority);
   1.102 +  SHARED_RING_INIT(xi->rx_pgs);
   1.103 +  FRONT_RING_INIT(&xi->rx, xi->rx_pgs, PAGE_SIZE);
   1.104    xi->rx_ring_ref = xi->GntTblInterface.GrantAccess(
   1.105 -    xi->GntTblInterface.InterfaceHeader.Context, 0, pfn, FALSE);
   1.106 +    xi->GntTblInterface.InterfaceHeader.Context, 0,
   1.107 +    *MmGetMdlPfnArray(xi->rx_mdl), FALSE);
   1.108  
   1.109    {
   1.110    char *msg;
   1.111 @@ -455,6 +465,13 @@ XenNet_SetInformation(
   1.112    OUT PULONG BytesNeeded
   1.113    )
   1.114  {
   1.115 +  UNREFERENCED_PARAMETER(MiniportAdapterContext);
   1.116 +  UNREFERENCED_PARAMETER(Oid);
   1.117 +  UNREFERENCED_PARAMETER(InformationBuffer);
   1.118 +  UNREFERENCED_PARAMETER(InformationBufferLength);
   1.119 +  UNREFERENCED_PARAMETER(BytesRead);
   1.120 +  UNREFERENCED_PARAMETER(BytesNeeded);
   1.121 +
   1.122    KdPrint((__FUNCTION__ " called with OID=0x%x\n", Oid));
   1.123    return NDIS_STATUS_SUCCESS;
   1.124  }
   1.125 @@ -465,6 +482,9 @@ XenNet_ReturnPacket(
   1.126    IN PNDIS_PACKET Packet
   1.127    )
   1.128  {
   1.129 +  UNREFERENCED_PARAMETER(MiniportAdapterContext);
   1.130 +  UNREFERENCED_PARAMETER(Packet);
   1.131 +
   1.132    KdPrint((__FUNCTION__ " called\n"));
   1.133  }
   1.134  
   1.135 @@ -513,6 +533,11 @@ XenNet_PnPEventNotify(
   1.136    IN ULONG InformationBufferLength
   1.137    )
   1.138  {
   1.139 +  UNREFERENCED_PARAMETER(MiniportAdapterContext);
   1.140 +  UNREFERENCED_PARAMETER(PnPEvent);
   1.141 +  UNREFERENCED_PARAMETER(InformationBuffer);
   1.142 +  UNREFERENCED_PARAMETER(InformationBufferLength);
   1.143 +
   1.144    KdPrint((__FUNCTION__ " called\n"));
   1.145  }
   1.146  
   1.147 @@ -521,6 +546,8 @@ XenNet_Shutdown(
   1.148    IN NDIS_HANDLE MiniportAdapterContext
   1.149    )
   1.150  {
   1.151 +  UNREFERENCED_PARAMETER(MiniportAdapterContext);
   1.152 +
   1.153    KdPrint((__FUNCTION__ " called\n"));
   1.154  }
   1.155