win-pvdrivers

changeset 459:ae1c232e7d4a

rx checksum offload tuning
author James Harper <james.harper@bendigoit.com.au>
date Sun Nov 23 14:17:34 2008 +1100 (2008-11-23)
parents e28aaf63e174
children dd42744a458e 7f9bedb7dcf9
files common.inc common/include/xen_windows.h installer.nsi xennet/xennet.c xennet/xennet.h xennet/xennet_common.c xennet/xennet_oid.c xennet/xennet_rx.c xennet/xennet_tx.c
line diff
     1.1 --- a/common.inc	Thu Nov 20 12:26:52 2008 +1100
     1.2 +++ b/common.inc	Sun Nov 23 14:17:34 2008 +1100
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.11
     1.5 +VERSION=0.9.11.4
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  MSC_WARNING_LEVEL=/W4
     1.8  INCLUDES = ..\common\include;..\common\include\public
     2.1 --- a/common/include/xen_windows.h	Thu Nov 20 12:26:52 2008 +1100
     2.2 +++ b/common/include/xen_windows.h	Sun Nov 23 14:17:34 2008 +1100
     2.3 @@ -191,7 +191,7 @@ FreePages(PMDL Mdl)
     2.4    ExFreePoolWithTag(Buf, ALLOCATE_PAGES_POOL_TAG);
     2.5  }
     2.6  
     2.7 -//#define XEN_IOPORT_DEBUG_PORT_BASE 0x10
     2.8 +#define XEN_IOPORT_DEBUG_PORT_BASE 0x10
     2.9  
    2.10  static XenDbgPrint(PCHAR format, ...)
    2.11  {
     3.1 --- a/installer.nsi	Thu Nov 20 12:26:52 2008 +1100
     3.2 +++ b/installer.nsi	Sun Nov 23 14:17:34 2008 +1100
     3.3 @@ -6,7 +6,7 @@ Var ARCH_SPEC
     3.4  
     3.5  !define AppName "Xen PV Drivers"
     3.6  !define StartMenu "$SMPROGRAMS\${AppName}"
     3.7 -!define Version "0.9.11"
     3.8 +!define Version "0.9.12-pre4"
     3.9  #!define Version "$%VERSION%"
    3.10  Name "${AppName}"
    3.11  
    3.12 @@ -33,6 +33,7 @@ Section "Common Files"
    3.13    File .\doc\Installing.txt
    3.14    File .\doc\Readme.txt
    3.15    File .\doc\TODO.txt
    3.16 +  File .\doc\xennet.txt
    3.17    ExecWait 'NET STOP ShutdownMon'
    3.18    StrCmp $ARCH_SPEC "amd64" amd64
    3.19    File .\target\winnet\i386\copyconfig.exe
     4.1 --- a/xennet/xennet.c	Thu Nov 20 12:26:52 2008 +1100
     4.2 +++ b/xennet/xennet.c	Sun Nov 23 14:17:34 2008 +1100
     4.3 @@ -273,8 +273,6 @@ XenNet_InterruptIsr(
     4.4      {
     4.5        KeInsertQueueDpc(&xi->tx_dpc, NULL, NULL);
     4.6        //KdPrint((__DRIVER_NAME "     Queueding Dpc (Isr)\n"));
     4.7 -      xi->last_dpc_isr = TRUE;
     4.8 -      KeQuerySystemTime(&xi->last_dpc_scheduled);
     4.9        KeInsertQueueDpc(&xi->rx_dpc, UlongToPtr(FALSE), NULL);
    4.10        //KdPrint((__DRIVER_NAME "     Dpc Queued (Isr)\n"));
    4.11      }
    4.12 @@ -283,49 +281,6 @@ XenNet_InterruptIsr(
    4.13    //FUNCTION_EXIT();
    4.14  }
    4.15  
    4.16 -#if 0
    4.17 -static DDKAPI VOID
    4.18 -XenNet_InterruptDpc(NDIS_HANDLE MiniportAdapterContext)
    4.19 -{
    4.20 -  struct xennet_info *xi = MiniportAdapterContext;
    4.21 -  PIO_WORKITEM work_item;
    4.22 -
    4.23 -  //FUNCTION_ENTER();
    4.24 -  if (xi->device_state->resume_state != xi->device_state->resume_state_ack)
    4.25 -  {
    4.26 -    FUNCTION_ENTER();
    4.27 -    switch (xi->device_state->resume_state)
    4.28 -    {
    4.29 -    case RESUME_STATE_SUSPENDING:
    4.30 -      KdPrint((__DRIVER_NAME "     New state SUSPENDING\n"));
    4.31 -      // there should be a better way to synchronise with rx and tx...
    4.32 -      KeAcquireSpinLockAtDpcLevel(&xi->rx_lock);
    4.33 -      KeReleaseSpinLockFromDpcLevel(&xi->rx_lock);
    4.34 -      KeAcquireSpinLockAtDpcLevel(&xi->tx_lock);
    4.35 -      KeReleaseSpinLockFromDpcLevel(&xi->tx_lock);
    4.36 -      break;
    4.37 -    case RESUME_STATE_FRONTEND_RESUME:
    4.38 -      KdPrint((__DRIVER_NAME "     New state RESUME_STATE_FRONTEND_RESUME\n"));
    4.39 -      work_item = IoAllocateWorkItem(xi->fdo);
    4.40 -      IoQueueWorkItem(work_item, XenNet_Resume, DelayedWorkQueue, xi);
    4.41 -      break;
    4.42 -    default:
    4.43 -      KdPrint((__DRIVER_NAME "     New state %d\n", xi->device_state->resume_state));
    4.44 -      break;
    4.45 -    }
    4.46 -    xi->device_state->resume_state_ack = xi->device_state->resume_state;
    4.47 -    KeMemoryBarrier();
    4.48 -    FUNCTION_EXIT();
    4.49 -  }
    4.50 -  if (xi->connected && !xi->inactive && xi->device_state->resume_state == RESUME_STATE_RUNNING)
    4.51 -  {
    4.52 -    XenNet_TxBufferGC(xi);
    4.53 -    XenNet_RxBufferCheck(xi, FALSE);
    4.54 -  }
    4.55 -  //FUNCTION_EXIT();
    4.56 -}
    4.57 -#endif
    4.58 -
    4.59  // Called at <= DISPATCH_LEVEL
    4.60  static DDKAPI NDIS_STATUS
    4.61  XenNet_Init(
    4.62 @@ -463,7 +418,6 @@ XenNet_Init(
    4.63      return NDIS_STATUS_RESOURCES;
    4.64    }
    4.65  
    4.66 -  KeInitializeSpinLock(&xi->rx_lock);
    4.67    KeInitializeDpc(&xi->suspend_dpc, XenNet_SuspendResume, xi);
    4.68  
    4.69    InitializeListHead(&xi->tx_waiting_pkt_list);
    4.70 @@ -591,7 +545,7 @@ XenNet_Init(
    4.71    }
    4.72    else
    4.73    {
    4.74 -    KdPrint(("ChecksumOffload = %d\n", config_param->ParameterData.IntegerData));
    4.75 +    KdPrint(("ChecksumOffloadRxCheck = %d\n", config_param->ParameterData.IntegerData));
    4.76      xi->config_csum_rx_check = !!config_param->ParameterData.IntegerData;
    4.77    }
    4.78  
     5.1 --- a/xennet/xennet.h	Thu Nov 20 12:26:52 2008 +1100
     5.2 +++ b/xennet/xennet.h	Sun Nov 23 14:17:34 2008 +1100
     5.3 @@ -191,6 +191,7 @@ typedef struct {
     5.4    USHORT ip4_header_length;
     5.5    USHORT ip4_length;
     5.6    USHORT tcp_header_length;
     5.7 +  BOOLEAN tcp_has_options;
     5.8    USHORT tcp_length;
     5.9    USHORT tcp_remaining;
    5.10    ULONG tcp_seq;
    5.11 @@ -307,8 +308,6 @@ struct xennet_info
    5.12    ULONG64 stat_rx_error;
    5.13    ULONG64 stat_rx_no_buffer;
    5.14    
    5.15 -  BOOLEAN last_dpc_isr;
    5.16 -  LARGE_INTEGER last_dpc_scheduled;
    5.17  } typedef xennet_info_t;
    5.18  
    5.19  
     6.1 --- a/xennet/xennet_common.c	Thu Nov 20 12:26:52 2008 +1100
     6.2 +++ b/xennet/xennet_common.c	Sun Nov 23 14:17:34 2008 +1100
     6.3 @@ -91,6 +91,7 @@ XenNet_ParsePacketHeader(
     6.4    pi->tcp_length = pi->ip4_length - pi->ip4_header_length - pi->tcp_header_length;
     6.5    pi->tcp_remaining = pi->tcp_length;
     6.6    pi->tcp_seq = GET_NET_PULONG(&pi->header[XN_HDR_SIZE + pi->ip4_header_length + 4]);
     6.7 +  pi->tcp_has_options = (BOOLEAN)(pi->tcp_header_length > 20);
     6.8    if (pi->mss > 0 && pi->tcp_length > pi->mss)
     6.9      pi->split_required = TRUE;
    6.10  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
     7.1 --- a/xennet/xennet_oid.c	Thu Nov 20 12:26:52 2008 +1100
     7.2 +++ b/xennet/xennet_oid.c	Sun Nov 23 14:17:34 2008 +1100
     7.3 @@ -689,10 +689,10 @@ XenNet_SetInformation(
     7.4            *BytesRead += sizeof(NDIS_TASK_TCP_LARGE_SEND);
     7.5            KdPrint(("TcpLargeSendNdisTask\n"));
     7.6            nttls = (PNDIS_TASK_TCP_LARGE_SEND)nto->TaskBuffer;
     7.7 -          KdPrint(("     MaxOffLoadSize                 = %d\n", nttls->MaxOffLoadSize));
     7.8 -          KdPrint(("     MinSegmentCount                = %d\n", nttls->MinSegmentCount));
     7.9 -          KdPrint(("     TcpOptions                     = %d\n", nttls->TcpOptions));
    7.10 -          KdPrint(("     IpOptions                      = %d\n", nttls->IpOptions));
    7.11 +          KdPrint(("  MaxOffLoadSize                 = %d\n", nttls->MaxOffLoadSize));
    7.12 +          KdPrint(("  MinSegmentCount                = %d\n", nttls->MinSegmentCount));
    7.13 +          KdPrint(("  TcpOptions                     = %d\n", nttls->TcpOptions));
    7.14 +          KdPrint(("  IpOptions                      = %d\n", nttls->IpOptions));
    7.15            if (nttls->MinSegmentCount != MIN_LARGE_SEND_SEGMENTS)
    7.16            {
    7.17              KdPrint(("     MinSegmentCount should be %d\n", MIN_LARGE_SEND_SEGMENTS));
     8.1 --- a/xennet/xennet_rx.c	Thu Nov 20 12:26:52 2008 +1100
     8.2 +++ b/xennet/xennet_rx.c	Sun Nov 23 14:17:34 2008 +1100
     8.3 @@ -143,7 +143,7 @@ XenNet_MakePacket(struct xennet_info *xi
     8.4    USHORT new_ip4_length;
     8.5    USHORT i;
     8.6  
     8.7 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     8.8 +  //FUNCTION_ENTER();
     8.9  
    8.10    if (!xi->rxpi.split_required)
    8.11    {
    8.12 @@ -151,6 +151,7 @@ XenNet_MakePacket(struct xennet_info *xi
    8.13      if (packet == NULL)
    8.14      {
    8.15        /* buffers will be freed in MakePackets */
    8.16 +      //FUNCTION_EXIT();
    8.17        return NULL;
    8.18      }
    8.19      xi->rx_outstanding++;
    8.20 @@ -163,11 +164,15 @@ XenNet_MakePacket(struct xennet_info *xi
    8.21    {
    8.22      out_mdl = XenFreelist_GetPage(&xi->rx_freelist);
    8.23      if (!out_mdl)
    8.24 +    {
    8.25 +      //FUNCTION_EXIT();
    8.26        return NULL;
    8.27 +    }
    8.28      packet = get_packet_from_freelist(xi);
    8.29      if (packet == NULL)
    8.30      {
    8.31        XenFreelist_PutPage(&xi->rx_freelist, out_mdl);
    8.32 +      //FUNCTION_EXIT();
    8.33        return NULL;
    8.34      }
    8.35      xi->rx_outstanding++;
    8.36 @@ -193,7 +198,8 @@ XenNet_MakePacket(struct xennet_info *xi
    8.37      XenNet_SumIpHeader(out_buffer, xi->rxpi.ip4_header_length);
    8.38      NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
    8.39    }
    8.40 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (%p)\n", packet));
    8.41 +
    8.42 +  //FUNCTION_EXIT();
    8.43    
    8.44    return packet;
    8.45  }
    8.46 @@ -223,7 +229,7 @@ XenNet_SumPacketData(
    8.47    USHORT remaining;
    8.48    USHORT ip4_length;
    8.49    
    8.50 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    8.51 +  //FUNCTION_ENTER();
    8.52  
    8.53    NdisGetFirstBufferFromPacketSafe(packet, &mdl, &buffer, &buffer_length, &total_length, NormalPagePriority);
    8.54    ASSERT(mdl);
    8.55 @@ -245,6 +251,7 @@ XenNet_SumPacketData(
    8.56      break;
    8.57    default:
    8.58      KdPrint((__DRIVER_NAME "     Don't know how to calc sum for IP Proto %d\n", pi->ip_proto));
    8.59 +    //FUNCTION_EXIT();
    8.60      return FALSE; // should never happen
    8.61    }
    8.62  
    8.63 @@ -305,8 +312,11 @@ XenNet_SumPacketData(
    8.64    if (set_csum)
    8.65      *csum_ptr = (USHORT)~GET_NET_USHORT((USHORT)csum);
    8.66    else
    8.67 +  {
    8.68 +    //FUNCTION_EXIT();
    8.69      return (BOOLEAN)(*csum_ptr == (USHORT)~GET_NET_USHORT((USHORT)csum));
    8.70 -
    8.71 +  }
    8.72 +  //FUNCTION_EXIT();
    8.73    return TRUE;
    8.74  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    8.75  }
    8.76 @@ -325,7 +335,7 @@ XenNet_MakePackets(
    8.77    PNDIS_TCP_IP_CHECKSUM_PACKET_INFO csum_info;
    8.78    ULONG parse_result;  
    8.79  
    8.80 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "(packets = %p, packet_count = %d)\n", packets, *packet_count_p));
    8.81 +  //FUNCTION_ENTER();
    8.82  
    8.83    parse_result = XenNet_ParsePacketHeader(&xi->rxpi);
    8.84    
    8.85 @@ -358,40 +368,60 @@ XenNet_MakePackets(
    8.86        packet_count = 0;
    8.87        goto done;
    8.88      }
    8.89 +
    8.90      if (parse_result == PARSE_OK)
    8.91      {
    8.92 -      if (xi->rxpi.csum_blank)
    8.93 -        XenNet_SumPacketData(&xi->rxpi, packet, TRUE);
    8.94        csum_info = (PNDIS_TCP_IP_CHECKSUM_PACKET_INFO)&NDIS_PER_PACKET_INFO_FROM_PACKET(
    8.95          packet, TcpIpChecksumPacketInfo);
    8.96        if (xi->rxpi.csum_blank || xi->rxpi.data_validated)
    8.97        {
    8.98          if (xi->setting_csum.V4Receive.TcpChecksum && xi->rxpi.ip_proto == 6)
    8.99 -          csum_info->Receive.NdisPacketTcpChecksumSucceeded = TRUE;
   8.100 +        {
   8.101 +          if (!xi->rxpi.tcp_has_options || xi->setting_csum.V4Receive.TcpOptionsSupported)
   8.102 +          {
   8.103 +            csum_info->Receive.NdisPacketTcpChecksumSucceeded = TRUE;
   8.104 +          }
   8.105 +        }
   8.106          if (xi->setting_csum.V4Receive.UdpChecksum && xi->rxpi.ip_proto == 17)
   8.107 +        {
   8.108            csum_info->Receive.NdisPacketUdpChecksumSucceeded = TRUE;
   8.109 +        }
   8.110 +        if (xi->rxpi.csum_blank) // && !csum_info->Value)
   8.111 +        {
   8.112 +          XenNet_SumPacketData(&xi->rxpi, packet, TRUE);
   8.113 +        }
   8.114        }
   8.115        else if (!xi->config_csum_rx_check)
   8.116        {
   8.117          if (xi->setting_csum.V4Receive.TcpChecksum && xi->rxpi.ip_proto == 6)
   8.118          {
   8.119            if (XenNet_SumPacketData(&xi->rxpi, packet, FALSE))
   8.120 +          {
   8.121              csum_info->Receive.NdisPacketTcpChecksumSucceeded = TRUE;
   8.122 +          }
   8.123            else
   8.124 +          {
   8.125              csum_info->Receive.NdisPacketTcpChecksumFailed = TRUE;
   8.126 +          }
   8.127          }
   8.128          if (xi->setting_csum.V4Receive.UdpChecksum && xi->rxpi.ip_proto == 17)
   8.129          {
   8.130            if (XenNet_SumPacketData(&xi->rxpi, packet, FALSE))
   8.131 +          {
   8.132              csum_info->Receive.NdisPacketUdpChecksumSucceeded = TRUE;
   8.133 +          }
   8.134            else
   8.135 +          {
   8.136              csum_info->Receive.NdisPacketUdpChecksumFailed = TRUE;
   8.137 +          }
   8.138          }
   8.139        }
   8.140      }
   8.141 +
   8.142      entry = (PLIST_ENTRY)&packet->MiniportReservedEx[sizeof(PVOID)];
   8.143      InsertTailList(rx_packet_list, entry);
   8.144      XenNet_ClearPacketInfo(&xi->rxpi);
   8.145 +    //FUNCTION_EXIT();
   8.146      return 1;
   8.147    default:
   8.148      packet = XenNet_MakePacket(xi);
   8.149 @@ -405,6 +435,7 @@ XenNet_MakePackets(
   8.150      entry = (PLIST_ENTRY)&packet->MiniportReservedEx[sizeof(PVOID)];
   8.151      InsertTailList(rx_packet_list, entry);
   8.152      XenNet_ClearPacketInfo(&xi->rxpi);
   8.153 +    //FUNCTION_EXIT();
   8.154      return 1;
   8.155    }
   8.156  
   8.157 @@ -460,7 +491,7 @@ done:
   8.158      XenFreelist_PutPage(&xi->rx_freelist, xi->rxpi.mdls[i]);
   8.159    }
   8.160    XenNet_ClearPacketInfo(&xi->rxpi);
   8.161 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (split)\n"));
   8.162 +  //FUNCTION_EXIT();
   8.163    return packet_count;
   8.164  }
   8.165  
   8.166 @@ -480,8 +511,6 @@ XenNet_RxQueueDpcSynchronized(PVOID cont
   8.167      /* if an is_timer dpc is queued it will muck things up for us, so make sure we requeue a !is_timer dpc */
   8.168      KeRemoveQueueDpc(&sc->xi->rx_dpc);
   8.169    }
   8.170 -  sc->xi->last_dpc_isr = FALSE;
   8.171 -  KeQuerySystemTime(&sc->xi->last_dpc_scheduled);
   8.172    result = KeInsertQueueDpc(&sc->xi->rx_dpc, UlongToPtr(sc->is_timer), NULL);
   8.173    
   8.174    return TRUE;
   8.175 @@ -532,9 +561,9 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
   8.176    UNREFERENCED_PARAMETER(arg1);
   8.177    UNREFERENCED_PARAMETER(arg2);
   8.178  
   8.179 +  //FUNCTION_ENTER();
   8.180    if (is_timer) 
   8.181      KdPrint((__DRIVER_NAME "     RX Timer\n"));
   8.182 -  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   8.183  
   8.184    ASSERT(xi->connected);
   8.185  
   8.186 @@ -584,10 +613,11 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
   8.187        else
   8.188        {
   8.189          rxrsp = RING_GET_RESPONSE(&xi->rx, cons);
   8.190 +//KdPrint((__DRIVER_NAME "     status = %d, offset = %d\n", rxrsp->status, rxrsp->offset));
   8.191          if (rxrsp->status <= 0
   8.192            || rxrsp->offset + rxrsp->status > PAGE_SIZE)
   8.193          {
   8.194 -          KdPrint((__DRIVER_NAME ": Error: rxrsp offset %d, size %d\n",
   8.195 +          KdPrint((__DRIVER_NAME "     Error: rxrsp offset %d, size %d\n",
   8.196              rxrsp->offset, rxrsp->status));
   8.197            ASSERT(!xi->rxpi.extra_info);
   8.198            XenFreelist_PutPage(&xi->rx_freelist, mdl);
   8.199 @@ -706,10 +736,11 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
   8.200    while (entry != &rx_packet_list)
   8.201    {
   8.202      PNDIS_PACKET packet = CONTAINING_RECORD(entry, NDIS_PACKET, MiniportReservedEx[sizeof(PVOID)]);
   8.203 -    PVOID *addr;
   8.204 +    PVOID addr;
   8.205      UINT buffer_length;
   8.206      UINT total_length;
   8.207      NdisGetFirstBufferFromPacketSafe(packet, &mdl, &addr, &buffer_length, &total_length, NormalPagePriority);
   8.208 +    
   8.209      ASSERT(total_length <= xi->config_mtu + XN_HDR_SIZE);
   8.210      packets[packet_count++] = packet;
   8.211      entry = RemoveHeadList(&rx_packet_list);
   8.212 @@ -726,7 +757,7 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
   8.213      due_time.QuadPart = -10 * 1000 * 10; /* 10ms */
   8.214      KeSetTimer(&xi->rx_timer, due_time, &xi->rx_timer_dpc);
   8.215    }
   8.216 -  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   8.217 +  //FUNCTION_EXIT();
   8.218  }
   8.219  
   8.220  /* called at DISPATCH_LEVEL */
   8.221 @@ -740,11 +771,14 @@ XenNet_ReturnPacket(
   8.222    struct xennet_info *xi = MiniportAdapterContext;
   8.223    PMDL mdl;
   8.224  
   8.225 +  //FUNCTION_ENTER();
   8.226 +
   8.227    KeAcquireSpinLockAtDpcLevel(&xi->rx_lock);
   8.228  
   8.229    NdisUnchainBufferAtBack(Packet, &mdl);
   8.230    while (mdl)
   8.231    {
   8.232 +    //KdPrint((__DRIVER_NAME "     packet = %p, mdl = %p\n", Packet, mdl));
   8.233      NdisAdjustBufferLength(mdl, PAGE_SIZE);
   8.234      XenFreelist_PutPage(&xi->rx_freelist, mdl);
   8.235      NdisUnchainBufferAtBack(Packet, &mdl);
   8.236 @@ -758,7 +792,7 @@ XenNet_ReturnPacket(
   8.237  
   8.238    KeReleaseSpinLockFromDpcLevel(&xi->rx_lock);
   8.239  
   8.240 -  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   8.241 +  //FUNCTION_EXIT();
   8.242  }
   8.243  
   8.244  /*
   8.245 @@ -819,30 +853,6 @@ XenNet_RxResumeEnd(xennet_info_t *xi)
   8.246    KeReleaseSpinLock(&xi->rx_lock, old_irql);
   8.247  }
   8.248  
   8.249 -#if 0
   8.250 -/* Called at DISPATCH LEVEL */
   8.251 -static VOID DDKAPI
   8.252 -XenNet_RxTimer(
   8.253 -  PVOID SystemSpecific1,
   8.254 -  PVOID FunctionContext,
   8.255 -  PVOID SystemSpecific2,
   8.256 -  PVOID SystemSpecific3
   8.257 -)
   8.258 -{
   8.259 -  struct xennet_info *xi = FunctionContext;
   8.260 -
   8.261 -  UNREFERENCED_PARAMETER(SystemSpecific1);
   8.262 -  UNREFERENCED_PARAMETER(SystemSpecific2);
   8.263 -  UNREFERENCED_PARAMETER(SystemSpecific3);
   8.264 -
   8.265 -  if (xi->connected && !xi->inactive && xi->device_state->resume_state == RESUME_STATE_RUNNING)
   8.266 -  {
   8.267 -    KdPrint((__DRIVER_NAME "     RX Timer\n"));
   8.268 -    XenNet_RxBufferCheck(xi, TRUE);
   8.269 -  }
   8.270 -}
   8.271 -#endif
   8.272 -
   8.273  BOOLEAN
   8.274  XenNet_RxInit(xennet_info_t *xi)
   8.275  {
   8.276 @@ -850,13 +860,13 @@ XenNet_RxInit(xennet_info_t *xi)
   8.277  
   8.278    FUNCTION_ENTER();
   8.279  
   8.280 +  KeInitializeSpinLock(&xi->rx_lock);
   8.281    KeInitializeEvent(&xi->packet_returned_event, SynchronizationEvent, FALSE);
   8.282    KeInitializeTimer(&xi->rx_timer);
   8.283    KeInitializeDpc(&xi->rx_dpc, XenNet_RxBufferCheck, xi);
   8.284    KeSetTargetProcessorDpc(&xi->rx_dpc, 0);
   8.285    //KeSetImportanceDpc(&xi->rx_dpc, HighImportance);
   8.286    KeInitializeDpc(&xi->rx_timer_dpc, XenNet_RxTimerDpc, xi);
   8.287 -  //NdisMInitializeTimer(&xi->rx_timer, xi->adapter_handle, XenNet_RxTimer, xi);
   8.288    xi->avg_page_count = 0;
   8.289  
   8.290    xi->rx_shutting_down = FALSE;
     9.1 --- a/xennet/xennet_tx.c	Thu Nov 20 12:26:52 2008 +1100
     9.2 +++ b/xennet/xennet_tx.c	Sun Nov 23 14:17:34 2008 +1100
     9.3 @@ -348,6 +348,8 @@ XenNet_SendQueuedPackets(struct xennet_i
     9.4    int notify;
     9.5    BOOLEAN success;
     9.6  
     9.7 +  //FUNCTION_ENTER();
     9.8 +
     9.9    entry = RemoveHeadList(&xi->tx_waiting_pkt_list);
    9.10    /* if empty, the above returns head*, not NULL */
    9.11    while (entry != &xi->tx_waiting_pkt_list)
    9.12 @@ -370,6 +372,7 @@ XenNet_SendQueuedPackets(struct xennet_i
    9.13    {
    9.14      xi->vectors.EvtChn_Notify(xi->vectors.context, xi->event_channel);
    9.15    }
    9.16 +  //FUNCTION_EXIT();
    9.17  }
    9.18  
    9.19  // Called at <= DISPATCH_LEVEL with tx spinlock _NOT_ held
    9.20 @@ -382,6 +385,8 @@ XenNet_ReturnSentPackets(struct xennet_i
    9.21    int i = 0;
    9.22    KIRQL old_irql;
    9.23    
    9.24 +  //FUNCTION_ENTER();
    9.25 +
    9.26    old_irql = KeRaiseIrqlToDpcLevel();
    9.27    KeAcquireSpinLockAtDpcLevel(&xi->tx_lock);
    9.28    entry = RemoveHeadList(&xi->tx_sent_pkt_list);
    9.29 @@ -404,6 +409,7 @@ XenNet_ReturnSentPackets(struct xennet_i
    9.30    if (!i) /* i will be == 0 if we didn't SendComplete any packets, and thus we will still have the lock */
    9.31      KeReleaseSpinLockFromDpcLevel(&xi->tx_lock);
    9.32    KeLowerIrql(old_irql);
    9.33 +  //FUNCTION_EXIT();
    9.34  }
    9.35  
    9.36  // Called at DISPATCH_LEVEL
    9.37 @@ -420,11 +426,11 @@ XenNet_TxBufferGC(PKDPC dpc, PVOID conte
    9.38    UNREFERENCED_PARAMETER(arg1);
    9.39    UNREFERENCED_PARAMETER(arg2);
    9.40  
    9.41 +  //FUNCTION_ENTER();
    9.42 +
    9.43    ASSERT(xi->connected);
    9.44    ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
    9.45  
    9.46 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    9.47 -
    9.48    KeAcquireSpinLockAtDpcLevel(&xi->tx_lock);
    9.49  
    9.50    do {
    9.51 @@ -464,6 +470,8 @@ XenNet_TxBufferGC(PKDPC dpc, PVOID conte
    9.52    KeReleaseSpinLockFromDpcLevel(&xi->tx_lock);
    9.53  
    9.54    XenNet_ReturnSentPackets(xi);
    9.55 +
    9.56 +  //FUNCTION_EXIT();
    9.57  }
    9.58  
    9.59  // called at <= DISPATCH_LEVEL
    9.60 @@ -480,6 +488,8 @@ XenNet_SendPackets(
    9.61    PLIST_ENTRY entry;
    9.62    KIRQL OldIrql;
    9.63  
    9.64 +  //FUNCTION_ENTER();
    9.65 +
    9.66    KeAcquireSpinLock(&xi->tx_lock, &OldIrql);
    9.67  
    9.68  //  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ " (packets = %d, free_requests = %d)\n", NumberOfPackets, free_requests(xi)));
    9.69 @@ -498,7 +508,8 @@ XenNet_SendPackets(
    9.70    KeReleaseSpinLock(&xi->tx_lock, OldIrql);
    9.71    
    9.72    XenNet_ReturnSentPackets(xi);
    9.73 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    9.74 +
    9.75 +  //FUNCTION_EXIT();
    9.76  }
    9.77  
    9.78  VOID