win-pvdrivers

changeset 457:7190a6747e2e

Performance updates...
author James Harper <james.harper@bendigoit.com.au>
date Wed Nov 19 23:27:31 2008 +1100 (2008-11-19)
parents 07d3ead8c502
children e28aaf63e174
files xennet/xennet.c xennet/xennet_common.c xennet/xennet_oid.c xennet/xennet_rx.c xennet/xennet_tx.c
line diff
     1.1 --- a/xennet/xennet.c	Wed Nov 19 22:56:03 2008 +1100
     1.2 +++ b/xennet/xennet.c	Wed Nov 19 23:27:31 2008 +1100
     1.3 @@ -354,7 +354,11 @@ XenNet_Init(
     1.4    xi->rx_min_target = RX_DFL_MIN_TARGET;
     1.5    xi->rx_max_target = RX_MAX_TARGET;
     1.6    NdisMSetAttributesEx(xi->adapter_handle, (NDIS_HANDLE) xi,
     1.7 -    0, NDIS_ATTRIBUTE_DESERIALIZE|NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK,
     1.8 +    0, NDIS_ATTRIBUTE_DESERIALIZE|NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK
     1.9 +#ifdef NDIS51_MINIPORT
    1.10 +    |NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS
    1.11 +#endif
    1.12 +    ,
    1.13      NdisInterfaceInternal);
    1.14    xi->multicast_list_size = 0;
    1.15    
    1.16 @@ -770,7 +774,7 @@ DriverEntry(
    1.17    mini_chars.ReturnPacketHandler = XenNet_ReturnPacket;
    1.18    mini_chars.SendPacketsHandler = XenNet_SendPackets;
    1.19  
    1.20 -#if defined (NDIS51_MINIPORT)
    1.21 +#ifdef NDIS51_MINIPORT
    1.22    /* added in v.5.1 */
    1.23    mini_chars.PnPEventNotifyHandler = XenNet_PnPEventNotify;
    1.24    mini_chars.AdapterShutdownHandler = XenNet_Shutdown;
     2.1 --- a/xennet/xennet_common.c	Wed Nov 19 22:56:03 2008 +1100
     2.2 +++ b/xennet/xennet_common.c	Wed Nov 19 23:27:31 2008 +1100
     2.3 @@ -155,6 +155,7 @@ XenFreelist_Timer(
     2.4        fl->xi->vectors.GntTbl_EndAccess(fl->xi->vectors.context,
     2.5          *(grant_ref_t *)(((UCHAR *)mdl) + MmSizeOfMdl(0, PAGE_SIZE)), 0);
     2.6        FreePages(mdl);
     2.7 +      fl->page_outstanding--;
     2.8      }
     2.9      //FUNCTION_MSG((__DRIVER_NAME " --- timer - freed %d pages\n", i));
    2.10    }
     3.1 --- a/xennet/xennet_oid.c	Wed Nov 19 22:56:03 2008 +1100
     3.2 +++ b/xennet/xennet_oid.c	Wed Nov 19 23:27:31 2008 +1100
     3.3 @@ -123,7 +123,7 @@ XenNet_QueryInformation(
     3.4        temp_data = NdisMedium802_3;
     3.5        break;
     3.6      case OID_GEN_MAXIMUM_LOOKAHEAD:
     3.7 -      temp_data = PAGE_SIZE;
     3.8 +      temp_data = xi->config_mtu;
     3.9        break;
    3.10      case OID_GEN_MAXIMUM_FRAME_SIZE:
    3.11        temp_data = xi->config_mtu;
    3.12 @@ -136,7 +136,7 @@ XenNet_QueryInformation(
    3.13        temp_data = PAGE_SIZE * NET_TX_RING_SIZE * 4;
    3.14        break;
    3.15      case OID_GEN_RECEIVE_BUFFER_SPACE:
    3.16 -      temp_data = PAGE_SIZE * NET_RX_RING_SIZE;
    3.17 +      temp_data = PAGE_SIZE * NET_RX_RING_SIZE * 2;
    3.18        break;
    3.19      case OID_GEN_TRANSMIT_BLOCK_SIZE:
    3.20        temp_data = PAGE_SIZE; //XN_MAX_PKT_SIZE;
    3.21 @@ -155,7 +155,7 @@ XenNet_QueryInformation(
    3.22        temp_data = xi->packet_filter;
    3.23        break;
    3.24      case OID_GEN_CURRENT_LOOKAHEAD:
    3.25 -      temp_data = xi->config_mtu + XN_HDR_SIZE;
    3.26 +      temp_data = xi->config_mtu;
    3.27        break;
    3.28      case OID_GEN_DRIVER_VERSION:
    3.29        temp_data = (NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION;
     4.1 --- a/xennet/xennet_rx.c	Wed Nov 19 22:56:03 2008 +1100
     4.2 +++ b/xennet/xennet_rx.c	Wed Nov 19 23:27:31 2008 +1100
     4.3 @@ -464,11 +464,6 @@ done:
     4.4    return packet_count;
     4.5  }
     4.6  
     4.7 -#define MAXIMUM_PACKETS_PER_INDICATE 256
     4.8 -#define MAX_PACKETS_PER_INTERRUPT 64
     4.9 -
    4.10 -int log_flag = 0;
    4.11 -
    4.12  typedef struct {
    4.13    struct xennet_info *xi;
    4.14    BOOLEAN is_timer;
    4.15 @@ -492,6 +487,9 @@ XenNet_RxQueueDpcSynchronized(PVOID cont
    4.16    return TRUE;
    4.17  }
    4.18  
    4.19 +#define MAXIMUM_PACKETS_PER_INDICATE 32
    4.20 +#define MAX_PACKETS_PER_INTERRUPT 32
    4.21 +
    4.22  static VOID
    4.23  XenNet_RxTimerDpc(PKDPC dpc, PVOID context, PVOID arg1, PVOID arg2)
    4.24  {
    4.25 @@ -529,18 +527,11 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
    4.26    ULONG event = 1;
    4.27    BOOLEAN is_timer = (BOOLEAN)PtrToUlong(arg1);
    4.28    BOOLEAN set_timer = FALSE;
    4.29 -  LARGE_INTEGER current_time;
    4.30 -  ULONG delta;
    4.31  
    4.32    UNREFERENCED_PARAMETER(dpc);
    4.33    UNREFERENCED_PARAMETER(arg1);
    4.34    UNREFERENCED_PARAMETER(arg2);
    4.35  
    4.36 -  KeQuerySystemTime(&current_time);
    4.37 -  
    4.38 -  delta = (ULONG)((current_time.QuadPart - xi->last_dpc_scheduled.QuadPart) / 10);
    4.39 -  if (delta > 1000000) /* 1 second */
    4.40 -    KdPrint((__DRIVER_NAME "     Excessive Dpc Latency %d from %s\n", delta, xi->last_dpc_isr?"Isr":"Dpc"));
    4.41    if (is_timer) 
    4.42      KdPrint((__DRIVER_NAME "     RX Timer\n"));
    4.43    //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.44 @@ -556,6 +547,7 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
    4.45  
    4.46    do {
    4.47      prod = xi->rx.sring->rsp_prod;
    4.48 +//KdPrint((__DRIVER_NAME "     prod - cons = %d\n", prod - xi->rx.rsp_cons));    
    4.49      KeMemoryBarrier(); /* Ensure we see responses up to 'prod'. */
    4.50  
    4.51      for (cons = xi->rx.rsp_cons; cons != prod && packet_count < MAX_PACKETS_PER_INTERRUPT; cons++)
    4.52 @@ -731,7 +723,7 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
    4.53    if (set_timer)
    4.54    {
    4.55      LARGE_INTEGER due_time;
    4.56 -    due_time.QuadPart = -30 * 1000 * 10; /* 30ms */
    4.57 +    due_time.QuadPart = -50 * 1000 * 10; /* 30ms */
    4.58      KeSetTimer(&xi->rx_timer, due_time, &xi->rx_timer_dpc);
    4.59    }
    4.60    //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    4.61 @@ -747,6 +739,7 @@ XenNet_ReturnPacket(
    4.62  {
    4.63    struct xennet_info *xi = MiniportAdapterContext;
    4.64    PMDL mdl;
    4.65 +
    4.66    KeAcquireSpinLockAtDpcLevel(&xi->rx_lock);
    4.67  
    4.68    NdisUnchainBufferAtBack(Packet, &mdl);
    4.69 @@ -765,7 +758,7 @@ XenNet_ReturnPacket(
    4.70  
    4.71    KeReleaseSpinLockFromDpcLevel(&xi->rx_lock);
    4.72  
    4.73 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    4.74 +  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    4.75  }
    4.76  
    4.77  /*
     5.1 --- a/xennet/xennet_tx.c	Wed Nov 19 22:56:03 2008 +1100
     5.2 +++ b/xennet/xennet_tx.c	Wed Nov 19 23:27:31 2008 +1100
     5.3 @@ -218,7 +218,7 @@ XenNet_HWSendPacket(struct xennet_info *
     5.4      pi.mdls[page_num] = XenFreelist_GetPage(&xi->tx_freelist);
     5.5      if (!pi.mdls[page_num])
     5.6      {
     5.7 -      KdPrint((__DRIVER_NAME "     Out of buffers on send\n"));
     5.8 +      KdPrint((__DRIVER_NAME "     Out of buffers on send (fl->page_outstanding = %d)\n", xi->tx_freelist.page_outstanding));
     5.9        pages_required = page_num;
    5.10        for (page_num = 0; page_num < pages_required; page_num++)
    5.11        {
    5.12 @@ -546,6 +546,7 @@ XenNet_TxInit(xennet_info_t *xi)
    5.13    KeInitializeDpc(&xi->tx_dpc, XenNet_TxBufferGC, xi);
    5.14    /* dpcs are only serialised to a single processor */
    5.15    KeSetTargetProcessorDpc(&xi->tx_dpc, 0);
    5.16 +  //KeSetImportanceDpc(&xi->tx_dpc, HighImportance);
    5.17  
    5.18    xi->tx_id_free = 0;
    5.19    xi->tx_no_id_used = 0;