win-pvdrivers

changeset 879:16f6219acf13

Print value of rx_outstanding. Use Interlocked functions to manipulate it. Fix some build warnings
author James Harper <james.harper@bendigoit.com.au>
date Tue Mar 15 12:19:03 2011 +1100 (2011-03-15)
parents 8d2238a25dfa
children e315b8490131
files xennet/xennet.h xennet/xennet_rx.c
line diff
     1.1 --- a/xennet/xennet.h	Tue Mar 15 12:08:05 2011 +1100
     1.2 +++ b/xennet/xennet.h	Tue Mar 15 12:19:03 2011 +1100
     1.3 @@ -55,7 +55,6 @@ Foundation, Inc., 51 Franklin Street, Fi
     1.4  #include <stdlib.h>
     1.5  #define XENNET_POOL_TAG (ULONG) 'XenN'
     1.6  
     1.7 -
     1.8  /* Xen macros use these, so they need to be redefined to Win equivs */
     1.9  #define wmb() KeMemoryBarrier()
    1.10  #define mb() KeMemoryBarrier()
    1.11 @@ -316,7 +315,7 @@ struct xennet_info
    1.12    BOOLEAN rx_partial_more_data_flag;
    1.13  
    1.14    /* how many packets are in the net stack atm */
    1.15 -  ULONG rx_outstanding;
    1.16 +  LONG rx_outstanding;
    1.17  
    1.18    /* config vars from registry */
    1.19    ULONG config_sg;
     2.1 --- a/xennet/xennet_rx.c	Tue Mar 15 12:08:05 2011 +1100
     2.2 +++ b/xennet/xennet_rx.c	Tue Mar 15 12:19:03 2011 +1100
     2.3 @@ -179,13 +179,15 @@ put_packet_on_freelist(struct xennet_inf
     2.4  {
     2.5    LARGE_INTEGER current_time;
     2.6  
     2.7 +  UNREFERENCED_PARAMETER(xi);
     2.8 +  
     2.9    InterlockedDecrement(&total_allocated_packets);
    2.10    NdisFreePacket(packet);
    2.11    KeQuerySystemTime(&current_time);
    2.12    if ((int)total_allocated_packets < 0 || (current_time.QuadPart - last_print_time.QuadPart) / 10000 > 1000)
    2.13    {
    2.14      last_print_time.QuadPart = current_time.QuadPart;
    2.15 -    KdPrint(("total_allocated_packets = %d, rx_pb_outstanding = %d, rx_pb_free = %d\n", total_allocated_packets, rx_pb_outstanding, xi->rx_pb_free));
    2.16 +    KdPrint(("total_allocated_packets = %d, rx_outstanding = %d, rx_pb_outstanding = %d, rx_pb_free = %d\n", total_allocated_packets, xi->rx_outstanding, rx_pb_outstanding, xi->rx_pb_free));
    2.17    }
    2.18  }
    2.19  
    2.20 @@ -303,7 +305,6 @@ XenNet_MakePacket(struct xennet_info *xi
    2.21    NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
    2.22    if (header_extra > 0)
    2.23      pi->header_length -= header_extra;
    2.24 -  xi->rx_outstanding++;
    2.25    ASSERT(*(shared_buffer_t **)&packet->MiniportReservedEx[0]);
    2.26    //FUNCTION_EXIT();
    2.27    return packet;
    2.28 @@ -718,8 +719,8 @@ XenNet_RxBufferCheck(PKDPC dpc, PVOID co
    2.29        }
    2.30        else
    2.31        {
    2.32 -        more_data_flag = page_buf->rsp.flags & NETRXF_more_data;
    2.33 -        extra_info_flag = page_buf->rsp.flags & NETRXF_extra_info;
    2.34 +        more_data_flag = (BOOLEAN)(page_buf->rsp.flags & NETRXF_more_data);
    2.35 +        extra_info_flag = (BOOLEAN)(page_buf->rsp.flags & NETRXF_extra_info);
    2.36        }
    2.37        
    2.38        if (!extra_info_flag && !more_data_flag)
    2.39 @@ -829,8 +830,8 @@ do this on a timer or something during p
    2.40          pi->curr_buffer = buffer;
    2.41        }
    2.42        pi->mdl_count++;
    2.43 -      extra_info_flag = page_buf->rsp.flags & NETRXF_extra_info;
    2.44 -      more_data_flag = page_buf->rsp.flags & NETRXF_more_data;
    2.45 +      extra_info_flag = (BOOLEAN)(page_buf->rsp.flags & NETRXF_extra_info);
    2.46 +      more_data_flag = (BOOLEAN)(page_buf->rsp.flags & NETRXF_more_data);
    2.47        pi->total_length = pi->total_length + page_buf->rsp.status;
    2.48      }
    2.49  
    2.50 @@ -857,6 +858,7 @@ do this on a timer or something during p
    2.51      ASSERT(*(shared_buffer_t **)&packet->MiniportReservedEx[0]);
    2.52  
    2.53      packets[packet_count++] = packet;
    2.54 +    InterlockedIncrement(&xi->rx_outstanding);
    2.55      entry = RemoveHeadList(&rx_packet_list);
    2.56      if (packet_count == MAXIMUM_PACKETS_PER_INDICATE || entry == &rx_packet_list)
    2.57      {
    2.58 @@ -911,7 +913,7 @@ XenNet_ReturnPacket(
    2.59    }
    2.60  
    2.61    put_packet_on_freelist(xi, Packet);
    2.62 -  xi->rx_outstanding--;
    2.63 +  InterlockedDecrement(&xi->rx_outstanding);
    2.64    
    2.65    if (!xi->rx_outstanding && xi->rx_shutting_down)
    2.66      KeSetEvent(&xi->packet_returned_event, IO_NO_INCREMENT, FALSE);