win-pvdrivers
changeset 1068:ebfa9417f1ee
Remove packet stats debug from xennet_rx
author | James Harper <james.harper@bendigoit.com.au> |
---|---|
date | Tue Oct 29 19:55:25 2013 +1100 (2013-10-29) |
parents | 2ef536c2d9fe |
children | 1b80cc14ee6d |
files | xennet/xennet_rx.c |
line diff
1.1 --- a/xennet/xennet_rx.c Tue Oct 29 19:39:52 2013 +1100 1.2 +++ b/xennet/xennet_rx.c Tue Oct 29 19:55:25 2013 +1100 1.3 @@ -20,56 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fi 1.4 1.5 #include "xennet.h" 1.6 1.7 -#define RX_STATS 1.8 - 1.9 -#ifdef RX_STATS 1.10 -static ULONG x_packet_allocated = 0; 1.11 -static ULONG x_packet_freed = 0; 1.12 -static ULONG x_packet_resources = 0; 1.13 - 1.14 -static ULONG x_0_64_packet_indicated = 0; 1.15 -static ULONG x_65_128_packet_indicated = 0; 1.16 -static ULONG x_129_256_packet_indicated = 0; 1.17 -static ULONG x_257_512_packet_indicated = 0; 1.18 -static ULONG x_513_1024_packet_indicated = 0; 1.19 -static ULONG x_1025_1514_packet_indicated = 0; 1.20 -static ULONG x_1515_65535_packet_indicated = 0; 1.21 -static ULONG x_0_64_packet_returned = 0; 1.22 -static ULONG x_65_128_packet_returned = 0; 1.23 -static ULONG x_129_256_packet_returned = 0; 1.24 -static ULONG x_257_512_packet_returned = 0; 1.25 -static ULONG x_513_1024_packet_returned = 0; 1.26 -static ULONG x_1025_1514_packet_returned = 0; 1.27 -static ULONG x_1515_65535_packet_returned = 0; 1.28 - 1.29 -static ULONG x_1_frag_packet_indicated = 0; 1.30 -static ULONG x_2_frag_packet_indicated = 0; 1.31 -static ULONG x_3_frag_packet_indicated = 0; 1.32 -static ULONG x_4_or_more_frag_packet_indicated = 0; 1.33 -static ULONG x_1_frag_packet_returned = 0; 1.34 -static ULONG x_2_frag_packet_returned = 0; 1.35 -static ULONG x_3_frag_packet_returned = 0; 1.36 -static ULONG x_4_or_more_frag_packet_returned = 0; 1.37 - 1.38 -static LARGE_INTEGER x_next_print_time = {0}; 1.39 - 1.40 -static VOID 1.41 -dump_x_stats() { 1.42 - FUNCTION_MSG("x_pkt_allocated (outstanding, resources) = %d (%d, %d)\n", x_packet_allocated, x_packet_allocated - x_packet_freed, x_packet_resources); 1.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); 1.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); 1.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); 1.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); 1.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); 1.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); 1.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); 1.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); 1.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); 1.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); 1.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); 1.54 -} 1.55 -#endif 1.56 - 1.57 static __inline shared_buffer_t * 1.58 get_pb_from_freelist(struct xennet_info *xi) 1.59 { 1.60 @@ -406,7 +356,6 @@ XenNet_MakePacket(struct xennet_info *xi 1.61 return FALSE; 1.62 } 1.63 1.64 - InterlockedIncrement((PLONG)&x_packet_allocated); 1.65 NdisZeroMemory(packet->MiniportReservedEx, sizeof(packet->MiniportReservedEx)); 1.66 NDIS_SET_PACKET_HEADER_SIZE(packet, XN_HDR_SIZE); 1.67 #else 1.68 @@ -451,7 +400,6 @@ XenNet_MakePacket(struct xennet_info *xi 1.69 #if NTDDI_VERSION < NTDDI_VISTA 1.70 NdisUnchainBufferAtFront(packet, &curr_mdl); 1.71 NdisFreePacket(packet); 1.72 - InterlockedIncrement((PLONG)&x_packet_freed); 1.73 #else 1.74 NdisFreeNetBufferList(nbl); 1.75 NdisFreeNetBuffer(packet); 1.76 @@ -661,7 +609,6 @@ XenNet_MakePacket(struct xennet_info *xi 1.77 #if NTDDI_VERSION < NTDDI_VISTA 1.78 if (outstanding > RX_PACKET_HIGH_WATER_MARK || !xi->rx_pb_free) { 1.79 NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_RESOURCES); 1.80 - InterlockedIncrement((PLONG)&x_packet_resources); 1.81 } else { 1.82 NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS); 1.83 } 1.84 @@ -778,39 +725,6 @@ XenNet_ReturnPacket(NDIS_HANDLE adapter_ 1.85 PNDIS_BUFFER buffer; 1.86 shared_buffer_t *page_buf = PACKET_FIRST_PB(packet); 1.87 1.88 - #ifdef RX_STATS 1.89 - { 1.90 - UINT packet_length; 1.91 - UINT buffer_count; 1.92 - 1.93 - NdisQueryPacket(packet, NULL, &buffer_count, NULL, &packet_length); 1.94 - if (packet_length <= 64) { 1.95 - InterlockedIncrement((PLONG)&x_0_64_packet_returned); 1.96 - } else if (packet_length <= 128) { 1.97 - InterlockedIncrement((PLONG)&x_65_128_packet_returned); 1.98 - } else if (packet_length <= 256) { 1.99 - InterlockedIncrement((PLONG)&x_129_256_packet_returned); 1.100 - } else if (packet_length <= 512) { 1.101 - InterlockedIncrement((PLONG)&x_257_512_packet_returned); 1.102 - } else if (packet_length <= 1024) { 1.103 - InterlockedIncrement((PLONG)&x_513_1024_packet_returned); 1.104 - } else if (packet_length <= 1516) { 1.105 - InterlockedIncrement((PLONG)&x_1025_1514_packet_returned); 1.106 - } else { 1.107 - InterlockedIncrement((PLONG)&x_1515_65535_packet_returned); 1.108 - } 1.109 - if (buffer_count == 1) { 1.110 - InterlockedIncrement((PLONG)&x_1_frag_packet_returned); 1.111 - } else if (buffer_count == 2) { 1.112 - InterlockedIncrement((PLONG)&x_2_frag_packet_returned); 1.113 - } else if (buffer_count == 3) { 1.114 - InterlockedIncrement((PLONG)&x_3_frag_packet_returned); 1.115 - } else { 1.116 - InterlockedIncrement((PLONG)&x_4_or_more_frag_packet_returned); 1.117 - } 1.118 - } 1.119 -#endif 1.120 - 1.121 //FUNCTION_ENTER(); 1.122 NdisUnchainBufferAtFront(packet, &buffer); 1.123 1.124 @@ -831,7 +745,6 @@ XenNet_ReturnPacket(NDIS_HANDLE adapter_ 1.125 } 1.126 1.127 NdisFreePacket(packet); 1.128 - InterlockedIncrement((PLONG)&x_packet_freed); 1.129 InterlockedDecrement(&xi->rx_outstanding); 1.130 if (!xi->rx_outstanding && xi->device_state != DEVICE_STATE_ACTIVE) 1.131 KeSetEvent(&xi->rx_idle_event, IO_NO_INCREMENT, FALSE); 1.132 @@ -1153,8 +1066,6 @@ XenNet_RxBufferCheck(struct xennet_info 1.133 while (rc.first_packet) { 1.134 PNDIS_PACKET packet; 1.135 NDIS_STATUS status; 1.136 - UINT packet_length; 1.137 - UINT buffer_count; 1.138 1.139 packet = rc.first_packet; 1.140 XN_ASSERT(PACKET_FIRST_PB(packet)); 1.141 @@ -1169,31 +1080,6 @@ XenNet_RxBufferCheck(struct xennet_info 1.142 last_header_only_packet = packet; 1.143 PACKET_NEXT_PACKET(packet) = NULL; 1.144 } 1.145 - NdisQueryPacket(packet, NULL, &buffer_count, NULL, &packet_length); 1.146 - if (packet_length <= 64) { 1.147 - InterlockedIncrement((PLONG)&x_0_64_packet_indicated); 1.148 - } else if (packet_length <= 128) { 1.149 - InterlockedIncrement((PLONG)&x_65_128_packet_indicated); 1.150 - } else if (packet_length <= 256) { 1.151 - InterlockedIncrement((PLONG)&x_129_256_packet_indicated); 1.152 - } else if (packet_length <= 512) { 1.153 - InterlockedIncrement((PLONG)&x_257_512_packet_indicated); 1.154 - } else if (packet_length <= 1024) { 1.155 - InterlockedIncrement((PLONG)&x_513_1024_packet_indicated); 1.156 - } else if (packet_length <= 1516) { 1.157 - InterlockedIncrement((PLONG)&x_1025_1514_packet_indicated); 1.158 - } else { 1.159 - InterlockedIncrement((PLONG)&x_1515_65535_packet_indicated); 1.160 - } 1.161 - if (buffer_count == 1) { 1.162 - InterlockedIncrement((PLONG)&x_1_frag_packet_indicated); 1.163 - } else if (buffer_count == 2) { 1.164 - InterlockedIncrement((PLONG)&x_2_frag_packet_indicated); 1.165 - } else if (buffer_count == 3) { 1.166 - InterlockedIncrement((PLONG)&x_3_frag_packet_indicated); 1.167 - } else { 1.168 - InterlockedIncrement((PLONG)&x_4_or_more_frag_packet_indicated); 1.169 - } 1.170 packets[packet_count++] = packet; 1.171 /* if we indicate a packet with NDIS_STATUS_RESOURCES then any following packet can't be NDIS_STATUS_SUCCESS */ 1.172 if (packet_count == MAXIMUM_PACKETS_PER_INDICATE || !rc.first_packet 1.173 @@ -1209,16 +1095,6 @@ XenNet_RxBufferCheck(struct xennet_info 1.174 first_header_only_packet = PACKET_NEXT_PACKET(packet); 1.175 XenNet_ReturnPacket(xi, packet); 1.176 } 1.177 -{ 1.178 - LARGE_INTEGER current_time; 1.179 - KeAcquireSpinLockAtDpcLevel(&xi->rx_lock); 1.180 - KeQuerySystemTime(¤t_time); 1.181 - if (current_time.QuadPart >= x_next_print_time.QuadPart) { 1.182 - dump_x_stats(); 1.183 - x_next_print_time.QuadPart = current_time.QuadPart + 10 * 1000 * 1000 * 10; /* 10 seconds */ 1.184 - } 1.185 - KeReleaseSpinLockFromDpcLevel(&xi->rx_lock); 1.186 -} 1.187 #else 1.188 if (rc.first_nbl) { 1.189 NdisMIndicateReceiveNetBufferLists(xi->adapter_handle, rc.first_nbl,