win-pvdrivers

changeset 1067:2ef536c2d9fe

Fix packet exhaustion issue in 2003 where windows doesn't return packets
author James Harper <james.harper@bendigoit.com.au>
date Tue Oct 29 19:39:52 2013 +1100 (2013-10-29)
parents 24fae56a87bf
children ebfa9417f1ee
files xennet/xennet.c xennet/xennet.h xennet/xennet_rx.c
line diff
     1.1 --- a/xennet/xennet.c	Tue Oct 29 19:38:31 2013 +1100
     1.2 +++ b/xennet/xennet.c	Tue Oct 29 19:39:52 2013 +1100
     1.3 @@ -119,9 +119,9 @@ XenNet_Initialize(NDIS_HANDLE adapter_ha
     1.4  
     1.5    #if NTDDI_VERSION < NTDDI_VISTA
     1.6    #endif
     1.7 -  xi->rx_target     = RX_DFL_MIN_TARGET;
     1.8 -  xi->rx_min_target = RX_DFL_MIN_TARGET;
     1.9 -  xi->rx_max_target = RX_MAX_TARGET;
    1.10 +  xi->rx_target     = RX_DEFAULT_TARGET;
    1.11 +  //xi->rx_min_target = RX_DFL_MIN_TARGET;
    1.12 +  //xi->rx_max_target = RX_MAX_TARGET;
    1.13    
    1.14    xi->multicast_list_size = 0;
    1.15    xi->current_lookahead = MIN_LOOKAHEAD_LENGTH;
     2.1 --- a/xennet/xennet.h	Tue Oct 29 19:38:31 2013 +1100
     2.2 +++ b/xennet/xennet.h	Tue Oct 29 19:39:52 2013 +1100
     2.3 @@ -168,10 +168,12 @@ SET_NET_ULONG(PVOID ptr, ULONG data) {
     2.4  #define XN_VENDOR_DESC "Xensource"
     2.5  #define MAX_XENBUS_STR_LEN 128
     2.6  
     2.7 -#define RX_MIN_TARGET 8
     2.8 -#define RX_DFL_MIN_TARGET 256
     2.9 -#define RX_MAX_TARGET min(NET_RX_RING_SIZE, 256)
    2.10 -#define RX_MAX_PB_FREELIST (RX_MAX_TARGET * 4)
    2.11 +//#define RX_MIN_TARGET 8
    2.12 +#define RX_DEFAULT_TARGET 256
    2.13 +//#define RX_MAX_TARGET min(NET_RX_RING_SIZE, 256)
    2.14 +#define RX_MAX_PB_FREELIST (NET_RX_RING_SIZE * 4)
    2.15 +#define RX_PACKET_MAX (NET_RX_RING_SIZE * 4)
    2.16 +#define RX_PACKET_HIGH_WATER_MARK (RX_PACKET_MAX * 3 / 4)
    2.17  
    2.18  //#define MAX_BUFFERS_PER_PACKET NET_RX_RING_SIZE
    2.19  
     3.1 --- a/xennet/xennet_rx.c	Tue Oct 29 19:38:31 2013 +1100
     3.2 +++ b/xennet/xennet_rx.c	Tue Oct 29 19:39:52 2013 +1100
     3.3 @@ -20,6 +20,56 @@ Foundation, Inc., 51 Franklin Street, Fi
     3.4  
     3.5  #include "xennet.h"
     3.6  
     3.7 +#define RX_STATS
     3.8 +
     3.9 +#ifdef RX_STATS
    3.10 +static ULONG x_packet_allocated = 0;
    3.11 +static ULONG x_packet_freed = 0;
    3.12 +static ULONG x_packet_resources = 0;
    3.13 +
    3.14 +static ULONG x_0_64_packet_indicated = 0;
    3.15 +static ULONG x_65_128_packet_indicated = 0;
    3.16 +static ULONG x_129_256_packet_indicated = 0;
    3.17 +static ULONG x_257_512_packet_indicated = 0;
    3.18 +static ULONG x_513_1024_packet_indicated = 0;
    3.19 +static ULONG x_1025_1514_packet_indicated = 0;
    3.20 +static ULONG x_1515_65535_packet_indicated = 0;
    3.21 +static ULONG x_0_64_packet_returned = 0;
    3.22 +static ULONG x_65_128_packet_returned = 0;
    3.23 +static ULONG x_129_256_packet_returned = 0;
    3.24 +static ULONG x_257_512_packet_returned = 0;
    3.25 +static ULONG x_513_1024_packet_returned = 0;
    3.26 +static ULONG x_1025_1514_packet_returned = 0;
    3.27 +static ULONG x_1515_65535_packet_returned = 0;
    3.28 +
    3.29 +static ULONG x_1_frag_packet_indicated = 0;
    3.30 +static ULONG x_2_frag_packet_indicated = 0;
    3.31 +static ULONG x_3_frag_packet_indicated = 0;
    3.32 +static ULONG x_4_or_more_frag_packet_indicated = 0;
    3.33 +static ULONG x_1_frag_packet_returned = 0;
    3.34 +static ULONG x_2_frag_packet_returned = 0;
    3.35 +static ULONG x_3_frag_packet_returned = 0;
    3.36 +static ULONG x_4_or_more_frag_packet_returned = 0;
    3.37 +
    3.38 +static LARGE_INTEGER x_next_print_time = {0};
    3.39 +
    3.40 +static VOID
    3.41 +dump_x_stats() {
    3.42 +  FUNCTION_MSG("x_pkt_allocated (outstanding, resources) = %d (%d, %d)\n", x_packet_allocated, x_packet_allocated - x_packet_freed, x_packet_resources);
    3.43 +  FUNCTION_MSG("x_0_64_pkt_indicated (outstanding)       = %d (%d)\n", x_0_64_packet_indicated, x_0_64_packet_indicated - x_0_64_packet_returned);
    3.44 +  FUNCTION_MSG("x_65_128_pkt_indicated (outstanding)     = %d (%d)\n", x_65_128_packet_indicated, x_65_128_packet_indicated - x_65_128_packet_returned);
    3.45 +  FUNCTION_MSG("x_129_256_pkt_indicated (outstanding)    = %d (%d)\n", x_129_256_packet_indicated, x_129_256_packet_indicated - x_129_256_packet_returned);
    3.46 +  FUNCTION_MSG("x_257_512_pkt_indicated (outstanding)    = %d (%d)\n", x_257_512_packet_indicated, x_257_512_packet_indicated - x_257_512_packet_returned);
    3.47 +  FUNCTION_MSG("x_513_1024_pkt_indicated (outstanding)   = %d (%d)\n", x_513_1024_packet_indicated, x_513_1024_packet_indicated - x_513_1024_packet_returned);
    3.48 +  FUNCTION_MSG("x_1025_1514_pkt_indicated (outstanding)  = %d (%d)\n", x_1025_1514_packet_indicated, x_1025_1514_packet_indicated - x_1025_1514_packet_returned);
    3.49 +  FUNCTION_MSG("x_1515_65535_pkt_indicated (outstanding) = %d (%d)\n", x_1515_65535_packet_indicated, x_1515_65535_packet_indicated - x_1515_65535_packet_returned);
    3.50 +  FUNCTION_MSG("x_1_frag_pkt_indicated (outstanding)     = %d (%d)\n", x_1_frag_packet_indicated, x_1_frag_packet_indicated - x_1_frag_packet_returned);
    3.51 +  FUNCTION_MSG("x_2_frag_pkt_indicated (outstanding)     = %d (%d)\n", x_2_frag_packet_indicated, x_2_frag_packet_indicated - x_2_frag_packet_returned);
    3.52 +  FUNCTION_MSG("x_3_frag_pkt_indicated (outstanding)     = %d (%d)\n", x_3_frag_packet_indicated, x_3_frag_packet_indicated - x_3_frag_packet_returned);
    3.53 +  FUNCTION_MSG("x_4+_frag_pkt_indicated (outstanding)    = %d (%d)\n", x_4_or_more_frag_packet_indicated, x_4_or_more_frag_packet_indicated - x_4_or_more_frag_packet_returned);
    3.54 +}
    3.55 +#endif
    3.56 +
    3.57  static __inline shared_buffer_t *
    3.58  get_pb_from_freelist(struct xennet_info *xi)
    3.59  {
    3.60 @@ -165,7 +215,7 @@ XenNet_FillRing(struct xennet_info *xi)
    3.61    for (i = 0; i < batch_target; i++) {
    3.62      page_buf = get_pb_from_freelist(xi);
    3.63      if (!page_buf) {
    3.64 -      KdPrint((__DRIVER_NAME "     Added %d out of %d buffers to rx ring (no free pages)\n", i, batch_target));
    3.65 +      FUNCTION_MSG("Added %d out of %d buffers to rx ring (no free pages)\n", i, batch_target);
    3.66        break;
    3.67      }
    3.68      xi->rx_id_free--;
    3.69 @@ -305,7 +355,7 @@ XenNet_SumPacketData(
    3.70      if (buffer_offset == buffer_length && i < total_length) {
    3.71        NdisGetNextBuffer(mdl, &mdl);
    3.72        if (mdl == NULL) {
    3.73 -        KdPrint((__DRIVER_NAME "     Ran out of buffers\n"));
    3.74 +        FUNCTION_MSG(__DRIVER_NAME "     Ran out of buffers\n");
    3.75          return FALSE; // should never happen
    3.76        }
    3.77        NdisQueryBufferSafe(mdl, &buffer, &buffer_length, NormalPagePriority);
    3.78 @@ -340,9 +390,10 @@ XenNet_MakePacket(struct xennet_info *xi
    3.79    ULONG out_remaining;
    3.80    ULONG header_extra;
    3.81    shared_buffer_t *header_buf;
    3.82 +  ULONG outstanding;
    3.83    #if NTDDI_VERSION < NTDDI_VISTA
    3.84    PNDIS_TCP_IP_CHECKSUM_PACKET_INFO csum_info;
    3.85 -  UINT packet_length;
    3.86 +  //UINT packet_length;
    3.87    #else
    3.88    NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO csum_info;
    3.89    #endif
    3.90 @@ -354,20 +405,22 @@ XenNet_MakePacket(struct xennet_info *xi
    3.91      FUNCTION_MSG("No free packets\n");
    3.92      return FALSE;
    3.93    }
    3.94 +  
    3.95 +  InterlockedIncrement((PLONG)&x_packet_allocated);
    3.96    NdisZeroMemory(packet->MiniportReservedEx, sizeof(packet->MiniportReservedEx));
    3.97    NDIS_SET_PACKET_HEADER_SIZE(packet, XN_HDR_SIZE);
    3.98    #else  
    3.99    nbl = NdisAllocateNetBufferList(xi->rx_nbl_pool, 0, 0);
   3.100    if (!nbl) {
   3.101      /* buffers will be freed in MakePackets */
   3.102 -    KdPrint((__DRIVER_NAME "     No free nbls\n"));
   3.103 +    FUNCTION_MSG("No free nbls\n");
   3.104      //FUNCTION_EXIT();
   3.105      return FALSE;
   3.106    }
   3.107  
   3.108    packet = NdisAllocateNetBuffer(xi->rx_packet_pool, NULL, 0, 0);
   3.109    if (!packet) {
   3.110 -    KdPrint((__DRIVER_NAME "     No free packets\n"));
   3.111 +    FUNCTION_MSG("No free packets\n");
   3.112      NdisFreeNetBufferList(nbl);
   3.113      //FUNCTION_EXIT();
   3.114      return FALSE;
   3.115 @@ -398,6 +451,7 @@ XenNet_MakePacket(struct xennet_info *xi
   3.116        #if NTDDI_VERSION < NTDDI_VISTA
   3.117        NdisUnchainBufferAtFront(packet, &curr_mdl);
   3.118        NdisFreePacket(packet);
   3.119 +      InterlockedIncrement((PLONG)&x_packet_freed);
   3.120        #else
   3.121        NdisFreeNetBufferList(nbl);
   3.122        NdisFreeNetBuffer(packet);
   3.123 @@ -458,7 +512,7 @@ XenNet_MakePacket(struct xennet_info *xi
   3.124        //  FUNCTION_MSG("in loop - out_remaining = %d, curr_buffer = %p, curr_pb = %p\n", out_remaining, pi->curr_mdl, pi->curr_pb);
   3.125        //}
   3.126        if (!pi->curr_mdl || !pi->curr_pb) {
   3.127 -        KdPrint((__DRIVER_NAME "     out of buffers for packet\n"));
   3.128 +        FUNCTION_MSG("out of buffers for packet\n");
   3.129          //KdPrint((__DRIVER_NAME "     out_remaining = %d, curr_buffer = %p, curr_pb = %p\n", out_remaining, pi->curr_mdl, pi->curr_pb));
   3.130          // TODO: free some stuff or we'll leak
   3.131          /* unchain buffers then free packet */
   3.132 @@ -603,7 +657,15 @@ XenNet_MakePacket(struct xennet_info *xi
   3.133    }
   3.134    #endif
   3.135  
   3.136 +  outstanding = InterlockedIncrement(&xi->rx_outstanding);
   3.137    #if NTDDI_VERSION < NTDDI_VISTA
   3.138 +  if (outstanding > RX_PACKET_HIGH_WATER_MARK || !xi->rx_pb_free) {
   3.139 +    NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_RESOURCES);
   3.140 +    InterlockedIncrement((PLONG)&x_packet_resources);
   3.141 +  } else {
   3.142 +    NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
   3.143 +  }
   3.144 +  #if 0
   3.145    /* windows gets lazy about ack packets and holds on to them forever under high load situations. we don't like this */
   3.146    NdisQueryPacketLength(packet, &packet_length);
   3.147    if (pi->parse_result != PARSE_OK || (pi->ip_proto == 6 && packet_length <= NDIS_STATUS_RESOURCES_MAX_LENGTH))
   3.148 @@ -611,9 +673,8 @@ XenNet_MakePacket(struct xennet_info *xi
   3.149    else
   3.150      NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
   3.151    #endif
   3.152 -  //FUNCTION_EXIT();
   3.153 +  #endif
   3.154  
   3.155 -  InterlockedIncrement(&xi->rx_outstanding);
   3.156    //FUNCTION_EXIT();
   3.157    return TRUE;
   3.158  }
   3.159 @@ -717,6 +778,39 @@ XenNet_ReturnPacket(NDIS_HANDLE adapter_
   3.160    PNDIS_BUFFER buffer;
   3.161    shared_buffer_t *page_buf = PACKET_FIRST_PB(packet);
   3.162  
   3.163 +  #ifdef RX_STATS
   3.164 +  {
   3.165 +  UINT packet_length;
   3.166 +  UINT buffer_count;
   3.167 +
   3.168 +  NdisQueryPacket(packet, NULL, &buffer_count, NULL, &packet_length);
   3.169 +  if (packet_length <= 64) {
   3.170 +    InterlockedIncrement((PLONG)&x_0_64_packet_returned);
   3.171 +  } else if (packet_length <= 128) {
   3.172 +    InterlockedIncrement((PLONG)&x_65_128_packet_returned);
   3.173 +  } else if (packet_length <= 256) {
   3.174 +    InterlockedIncrement((PLONG)&x_129_256_packet_returned);
   3.175 +  } else if (packet_length <= 512) {
   3.176 +    InterlockedIncrement((PLONG)&x_257_512_packet_returned);
   3.177 +  } else if (packet_length <= 1024) {
   3.178 +    InterlockedIncrement((PLONG)&x_513_1024_packet_returned);
   3.179 +  } else if (packet_length <= 1516) {
   3.180 +    InterlockedIncrement((PLONG)&x_1025_1514_packet_returned);
   3.181 +  } else {
   3.182 +    InterlockedIncrement((PLONG)&x_1515_65535_packet_returned);
   3.183 +  }
   3.184 +  if (buffer_count == 1) {
   3.185 +    InterlockedIncrement((PLONG)&x_1_frag_packet_returned);
   3.186 +  } else if (buffer_count == 2) {
   3.187 +    InterlockedIncrement((PLONG)&x_2_frag_packet_returned);
   3.188 +  } else if (buffer_count == 3) {
   3.189 +    InterlockedIncrement((PLONG)&x_3_frag_packet_returned);
   3.190 +  } else {
   3.191 +    InterlockedIncrement((PLONG)&x_4_or_more_frag_packet_returned);
   3.192 +  }
   3.193 +  }
   3.194 +#endif
   3.195 +
   3.196    //FUNCTION_ENTER();
   3.197    NdisUnchainBufferAtFront(packet, &buffer);
   3.198    
   3.199 @@ -737,6 +831,7 @@ XenNet_ReturnPacket(NDIS_HANDLE adapter_
   3.200    }
   3.201  
   3.202    NdisFreePacket(packet);
   3.203 +  InterlockedIncrement((PLONG)&x_packet_freed);
   3.204    InterlockedDecrement(&xi->rx_outstanding);
   3.205    if (!xi->rx_outstanding && xi->device_state != DEVICE_STATE_ACTIVE)
   3.206      KeSetEvent(&xi->rx_idle_event, IO_NO_INCREMENT, FALSE);
   3.207 @@ -896,8 +991,8 @@ XenNet_RxBufferCheck(struct xennet_info 
   3.208        memcpy(&page_buf->rsp, RING_GET_RESPONSE(&xi->rx_ring, cons), max(sizeof(struct netif_rx_response), sizeof(struct netif_extra_info)));
   3.209        if (!extra_info_flag) {
   3.210          if (page_buf->rsp.status <= 0 || page_buf->rsp.offset + page_buf->rsp.status > PAGE_SIZE) {
   3.211 -          KdPrint((__DRIVER_NAME "     Error: rsp offset %d, size %d\n",
   3.212 -            page_buf->rsp.offset, page_buf->rsp.status));
   3.213 +          FUNCTION_MSG("Error: rsp offset %d, size %d\n",
   3.214 +            page_buf->rsp.offset, page_buf->rsp.status);
   3.215            XN_ASSERT(!extra_info_flag);
   3.216            put_pb_on_freelist(xi, page_buf);
   3.217            continue;
   3.218 @@ -949,7 +1044,7 @@ XenNet_RxBufferCheck(struct xennet_info 
   3.219    /* anything past last_buf belongs to an incomplete packet... */
   3.220    if (last_buf && last_buf->next)
   3.221    {
   3.222 -    KdPrint((__DRIVER_NAME "     Partial receive\n"));
   3.223 +    FUNCTION_MSG("Partial receive\n");
   3.224      xi->rx_partial_buf = last_buf->next;
   3.225      xi->rx_partial_more_data_flag = more_data_flag;
   3.226      xi->rx_partial_extra_info_flag = extra_info_flag;
   3.227 @@ -961,7 +1056,7 @@ XenNet_RxBufferCheck(struct xennet_info 
   3.228    if (packet_count >= MAXIMUM_PACKETS_PER_INTERRUPT || packet_data >= MAXIMUM_DATA_PER_INTERRUPT)
   3.229    {
   3.230      /* fire again immediately */
   3.231 -    KdPrint((__DRIVER_NAME "     Dpc Duration Exceeded\n"));
   3.232 +    FUNCTION_MSG("Dpc Duration Exceeded\n");
   3.233      /* we want the Dpc on the end of the queue. By definition we are already on the right CPU so we know the Dpc queue will be run immediately */
   3.234  //    KeSetImportanceDpc(&xi->rxtx_dpc, MediumImportance);
   3.235      KeInsertQueueDpc(&xi->rxtx_dpc, NULL, NULL);
   3.236 @@ -999,12 +1094,12 @@ XenNet_RxBufferCheck(struct xennet_info 
   3.237            // TODO - put this assertion somewhere XN_ASSERT(header_len + pi->mss <= PAGE_SIZE); // this limits MTU to PAGE_SIZE - XN_HEADER_LEN
   3.238            break;
   3.239          default:
   3.240 -          KdPrint((__DRIVER_NAME "     Unknown GSO type (%d) detected\n", ei->u.gso.type));
   3.241 +          FUNCTION_MSG("Unknown GSO type (%d) detected\n", ei->u.gso.type);
   3.242            break;
   3.243          }
   3.244          break;
   3.245        default:
   3.246 -        KdPrint((__DRIVER_NAME "     Unknown extra info type (%d) detected\n", ei->type));
   3.247 +        FUNCTION_MSG("Unknown extra info type (%d) detected\n", ei->type);
   3.248          break;
   3.249        }
   3.250        put_pb_on_freelist(xi, page_buf);
   3.251 @@ -1058,6 +1153,8 @@ XenNet_RxBufferCheck(struct xennet_info 
   3.252    while (rc.first_packet) {
   3.253      PNDIS_PACKET packet;
   3.254      NDIS_STATUS status;
   3.255 +    UINT packet_length;
   3.256 +    UINT buffer_count;
   3.257  
   3.258      packet = rc.first_packet;
   3.259      XN_ASSERT(PACKET_FIRST_PB(packet));
   3.260 @@ -1072,6 +1169,31 @@ XenNet_RxBufferCheck(struct xennet_info 
   3.261        last_header_only_packet = packet;
   3.262        PACKET_NEXT_PACKET(packet) = NULL;
   3.263      }
   3.264 +    NdisQueryPacket(packet, NULL, &buffer_count, NULL, &packet_length);
   3.265 +    if (packet_length <= 64) {
   3.266 +      InterlockedIncrement((PLONG)&x_0_64_packet_indicated);
   3.267 +    } else if (packet_length <= 128) {
   3.268 +      InterlockedIncrement((PLONG)&x_65_128_packet_indicated);
   3.269 +    } else if (packet_length <= 256) {
   3.270 +      InterlockedIncrement((PLONG)&x_129_256_packet_indicated);
   3.271 +    } else if (packet_length <= 512) {
   3.272 +      InterlockedIncrement((PLONG)&x_257_512_packet_indicated);
   3.273 +    } else if (packet_length <= 1024) {
   3.274 +      InterlockedIncrement((PLONG)&x_513_1024_packet_indicated);
   3.275 +    } else if (packet_length <= 1516) {
   3.276 +      InterlockedIncrement((PLONG)&x_1025_1514_packet_indicated);
   3.277 +    } else {
   3.278 +      InterlockedIncrement((PLONG)&x_1515_65535_packet_indicated);
   3.279 +    }
   3.280 +    if (buffer_count == 1) {
   3.281 +      InterlockedIncrement((PLONG)&x_1_frag_packet_indicated);
   3.282 +    } else if (buffer_count == 2) {
   3.283 +      InterlockedIncrement((PLONG)&x_2_frag_packet_indicated);
   3.284 +    } else if (buffer_count == 3) {
   3.285 +      InterlockedIncrement((PLONG)&x_3_frag_packet_indicated);
   3.286 +    } else {
   3.287 +      InterlockedIncrement((PLONG)&x_4_or_more_frag_packet_indicated);
   3.288 +    }
   3.289      packets[packet_count++] = packet;
   3.290      /* if we indicate a packet with NDIS_STATUS_RESOURCES then any following packet can't be NDIS_STATUS_SUCCESS */
   3.291      if (packet_count == MAXIMUM_PACKETS_PER_INDICATE || !rc.first_packet
   3.292 @@ -1087,6 +1209,16 @@ XenNet_RxBufferCheck(struct xennet_info 
   3.293      first_header_only_packet = PACKET_NEXT_PACKET(packet);
   3.294      XenNet_ReturnPacket(xi, packet);
   3.295    }
   3.296 +{
   3.297 +  LARGE_INTEGER current_time;
   3.298 +  KeAcquireSpinLockAtDpcLevel(&xi->rx_lock);
   3.299 +  KeQuerySystemTime(&current_time);
   3.300 +  if (current_time.QuadPart >= x_next_print_time.QuadPart) {
   3.301 +    dump_x_stats();
   3.302 +    x_next_print_time.QuadPart = current_time.QuadPart + 10 * 1000 * 1000 * 10; /* 10 seconds */
   3.303 +  }
   3.304 +  KeReleaseSpinLockFromDpcLevel(&xi->rx_lock);
   3.305 +}
   3.306    #else
   3.307    if (rc.first_nbl) {
   3.308      NdisMIndicateReceiveNetBufferLists(xi->adapter_handle, rc.first_nbl,
   3.309 @@ -1145,7 +1277,7 @@ XenNet_RxInit(xennet_info_t *xi) {
   3.310    KeInitializeEvent(&xi->rx_idle_event, SynchronizationEvent, FALSE);
   3.311    xi->rxpi = ExAllocatePoolWithTagPriority(NonPagedPool, sizeof(packet_info_t) * NdisSystemProcessorCount(), XENNET_POOL_TAG, NormalPoolPriority);
   3.312    if (!xi->rxpi) {
   3.313 -    KdPrint(("ExAllocatePoolWithTagPriority failed\n"));
   3.314 +    FUNCTION_MSG("ExAllocatePoolWithTagPriority failed\n");
   3.315      return FALSE;
   3.316    }
   3.317    NdisZeroMemory(xi->rxpi, sizeof(packet_info_t) * NdisSystemProcessorCount());
   3.318 @@ -1174,7 +1306,7 @@ XenNet_RxInit(xennet_info_t *xi) {
   3.319    #if NTDDI_VERSION < NTDDI_VISTA
   3.320    NdisAllocatePacketPool(&status, &xi->rx_packet_pool, NET_RX_RING_SIZE * 4, PROTOCOL_RESERVED_SIZE_IN_PACKET);
   3.321    if (status != NDIS_STATUS_SUCCESS) {
   3.322 -    KdPrint(("NdisAllocatePacketPool failed with 0x%x\n", status));
   3.323 +    FUNCTION_MSG("NdisAllocatePacketPool failed with 0x%x\n", status);
   3.324      return FALSE;
   3.325    }
   3.326    #else
   3.327 @@ -1189,7 +1321,7 @@ XenNet_RxInit(xennet_info_t *xi) {
   3.328    
   3.329    xi->rx_nbl_pool = NdisAllocateNetBufferListPool(xi->adapter_handle, &nbl_pool_parameters);
   3.330    if (!xi->rx_nbl_pool) {
   3.331 -    KdPrint(("NdisAllocateNetBufferListPool failed\n"));
   3.332 +    FUNCTION_MSG("NdisAllocateNetBufferListPool failed\n");
   3.333      return FALSE;
   3.334    }
   3.335  
   3.336 @@ -1200,7 +1332,7 @@ XenNet_RxInit(xennet_info_t *xi) {
   3.337    nb_pool_parameters.DataSize = 0; /* the buffers come from the ring */
   3.338    xi->rx_packet_pool = NdisAllocateNetBufferPool(xi->adapter_handle, &nb_pool_parameters);
   3.339    if (!xi->rx_packet_pool) {
   3.340 -    KdPrint(("NdisAllocateNetBufferPool (rx_packet_pool) failed\n"));
   3.341 +    FUNCTION_MSG("NdisAllocateNetBufferPool (rx_packet_pool) failed\n");
   3.342      return FALSE;
   3.343    }
   3.344    #endif