win-pvdrivers

changeset 221:03fcf506d609

Debugging... getting closer though.
author James Harper <james.harper@bendigoit.com.au>
date Mon Mar 24 13:06:06 2008 +1100 (2008-03-24)
parents d076e1ed8071
children d37e4b226919
files common.inc xennet/xennet.c xennet/xennet.h xennet/xennet_rx.c
line diff
     1.1 --- a/common.inc	Sat Mar 22 22:35:17 2008 +1100
     1.2 +++ b/common.inc	Mon Mar 24 13:06:06 2008 +1100
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.8.5.47
     1.5 +VERSION=0.8.5.59
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  KMDF_VERSION=1
     1.8  !IF $(_NT_TOOLS_VERSION) > 0x700
     2.1 --- a/xennet/xennet.c	Sat Mar 22 22:35:17 2008 +1100
     2.2 +++ b/xennet/xennet.c	Mon Mar 24 13:06:06 2008 +1100
     2.3 @@ -186,6 +186,7 @@ XenNet_Init(
     2.4    )
     2.5  {
     2.6    NDIS_STATUS status;
     2.7 +  LARGE_INTEGER timeout;
     2.8    UINT i;
     2.9    BOOLEAN medium_found = FALSE;
    2.10    struct xennet_info *xi = NULL;
    2.11 @@ -478,9 +479,13 @@ XenNet_Init(
    2.12  
    2.13    // wait here for signal that we are all set up
    2.14    while (xi->backend_state != XenbusStateConnected)
    2.15 -    KeWaitForSingleObject(&xi->backend_state_change_event, Executive, KernelMode, FALSE, NULL);
    2.16 +  {
    2.17 +    timeout.QuadPart = -5 * 1000 * 1000 * 100; // 5 seconds
    2.18 +    if (KeWaitForSingleObject(&xi->backend_state_change_event, Executive, KernelMode, FALSE, &timeout) != STATUS_SUCCESS)
    2.19 +      KdPrint((__DRIVER_NAME "     Still Waiting for Connected...\n"));
    2.20 +  }
    2.21  
    2.22 -  KdPrint((__DRIVER_NAME "     Connected\n"));
    2.23 +  KdPrint((__DRIVER_NAME "     Backend Connected\n"));
    2.24  
    2.25    /* get mac address */
    2.26    RtlStringCbPrintfA(TmpPath, ARRAY_SIZE(TmpPath), "%s/mac", xi->backend_path);
    2.27 @@ -562,6 +567,7 @@ XenNet_Halt(
    2.28    struct xennet_info *xi = MiniportAdapterContext;
    2.29    CHAR TmpPath[MAX_XENBUS_STR_LEN];
    2.30    PVOID if_cxt = xi->XenInterface.InterfaceHeader.Context;
    2.31 +  LARGE_INTEGER timeout;
    2.32  
    2.33    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.34    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
    2.35 @@ -574,8 +580,11 @@ XenNet_Halt(
    2.36    // wait for backend to set 'Closing' state
    2.37  
    2.38    while (xi->backend_state != XenbusStateClosing)
    2.39 -    KeWaitForSingleObject(&xi->backend_state_change_event, Executive,
    2.40 -      KernelMode, FALSE, NULL);
    2.41 +  {
    2.42 +    timeout.QuadPart = -5 * 1000 * 1000 * 100; // 5 seconds
    2.43 +    if (KeWaitForSingleObject(&xi->backend_state_change_event, Executive, KernelMode, FALSE, &timeout) != STATUS_SUCCESS)
    2.44 +      KdPrint((__DRIVER_NAME "     Still Waiting for Closing...\n"));
    2.45 +  }
    2.46  
    2.47    // set frontend state to 'closed'
    2.48    xi->state = XenbusStateClosed;
    2.49 @@ -584,8 +593,11 @@ XenNet_Halt(
    2.50  
    2.51    // wait for backend to set 'Closed' state
    2.52    while (xi->backend_state != XenbusStateClosed)
    2.53 -    KeWaitForSingleObject(&xi->backend_state_change_event, Executive,
    2.54 -      KernelMode, FALSE, NULL);
    2.55 +  {
    2.56 +    timeout.QuadPart = -5 * 1000 * 1000 * 100; // 5 seconds
    2.57 +    if (KeWaitForSingleObject(&xi->backend_state_change_event, Executive, KernelMode, FALSE, &timeout) != STATUS_SUCCESS)
    2.58 +      KdPrint((__DRIVER_NAME "     Still Waiting for Closed...\n"));
    2.59 +  }
    2.60  
    2.61    // set frontend state to 'Initialising'
    2.62    xi->state = XenbusStateInitialising;
    2.63 @@ -594,8 +606,11 @@ XenNet_Halt(
    2.64  
    2.65    // wait for backend to set 'InitWait' state
    2.66    while (xi->backend_state != XenbusStateInitWait)
    2.67 -    KeWaitForSingleObject(&xi->backend_state_change_event, Executive,
    2.68 -      KernelMode, FALSE, NULL);
    2.69 +  {
    2.70 +    timeout.QuadPart = -5 * 1000 * 1000 * 100; // 5 seconds
    2.71 +    if (KeWaitForSingleObject(&xi->backend_state_change_event, Executive, KernelMode, FALSE, &timeout) != STATUS_SUCCESS)
    2.72 +      KdPrint((__DRIVER_NAME "     Still Waiting for InitWait...\n"));
    2.73 +  }
    2.74  
    2.75    // Disables the interrupt
    2.76    XenNet_Shutdown(xi);
     3.1 --- a/xennet/xennet.h	Sat Mar 22 22:35:17 2008 +1100
     3.2 +++ b/xennet/xennet.h	Mon Mar 24 13:06:06 2008 +1100
     3.3 @@ -111,12 +111,15 @@ typedef struct {
     3.4    BOOLEAN csum_calc_required;
     3.5    BOOLEAN split_required;
     3.6    UCHAR ip_version;
     3.7 +  PUCHAR header;
     3.8    UCHAR ip_proto;
     3.9    USHORT total_length;
    3.10    USHORT ip4_header_length;
    3.11    USHORT ip4_length;
    3.12    USHORT tcp_header_length;
    3.13    USHORT tcp_length;
    3.14 +  USHORT tcp_remaining;
    3.15 +  ULONG tcp_seq;
    3.16    BOOLEAN extra_info;
    3.17    BOOLEAN more_frags;
    3.18  } rx_packet_info_t;
     4.1 --- a/xennet/xennet_rx.c	Sat Mar 22 22:35:17 2008 +1100
     4.2 +++ b/xennet/xennet_rx.c	Mon Mar 24 13:06:06 2008 +1100
     4.3 @@ -148,6 +148,7 @@ XenNet_RxBufferAlloc(struct xennet_info 
     4.4  #define __NET_USHORT_BYTE_0(x) ((USHORT)(x & 0xFF))
     4.5  #define __NET_USHORT_BYTE_1(x) ((USHORT)((PUCHAR)&x)[1] & 0xFF)
     4.6  #define NET_USHORT(x) ((__NET_USHORT_BYTE_0(x) << 8) | __NET_USHORT_BYTE_1(x))
     4.7 +#define NET_ULONG(x) ((NET_USHORT(x) << 16) | NET_USHORT(((PUCHAR)&x)[2]))
     4.8  
     4.9  static VOID
    4.10  XenNet_ParseHeader(
    4.11 @@ -155,43 +156,42 @@ XenNet_ParseHeader(
    4.12  )
    4.13  {
    4.14    USHORT i;
    4.15 -  PUCHAR buffer;
    4.16    PMDL mdl;
    4.17 -  UINT total_length;
    4.18 -  UINT buffer_length;
    4.19 +  UINT header_length;
    4.20  
    4.21 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.22 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.23  
    4.24    ASSERT(xi->rxpi.mdls[0]);
    4.25    
    4.26 -  NdisQueryBufferSafe(xi->rxpi.mdls[0], &buffer, &buffer_length, NormalPagePriority);
    4.27 +  NdisQueryBufferSafe(xi->rxpi.mdls[0], &xi->rxpi.header, &header_length, NormalPagePriority);
    4.28  
    4.29 -  if (buffer_length < XN_HDR_SIZE + 20 + 20) // minimum size of first buffer is ETH + IP + TCP header
    4.30 +  if (header_length < XN_HDR_SIZE + 20 + 20) // minimum size of first buffer is ETH + IP + TCP header
    4.31    {
    4.32      return;
    4.33    }
    4.34    
    4.35 -  switch (NET_USHORT(buffer[12])) // L2 protocol field
    4.36 +  switch (NET_USHORT(xi->rxpi.header[12])) // L2 protocol field
    4.37    {
    4.38    case 0x0800:
    4.39 -    xi->rxpi.ip_version = (buffer[XN_HDR_SIZE + 0] & 0xF0) >> 4;
    4.40 +    xi->rxpi.ip_version = (xi->rxpi.header[XN_HDR_SIZE + 0] & 0xF0) >> 4;
    4.41      if (xi->rxpi.ip_version != 4)
    4.42      {
    4.43        KdPrint((__DRIVER_NAME "     ip_version = %d\n", xi->rxpi.ip_version));
    4.44        return;
    4.45      }
    4.46 -    xi->rxpi.ip4_header_length = (buffer[XN_HDR_SIZE + 0] & 0x0F) << 2;
    4.47 -    if (buffer_length < (ULONG)(xi->rxpi.ip4_header_length + 20))
    4.48 +    xi->rxpi.ip4_header_length = (xi->rxpi.header[XN_HDR_SIZE + 0] & 0x0F) << 2;
    4.49 +    if (header_length < (ULONG)(xi->rxpi.ip4_header_length + 20))
    4.50      {
    4.51 -      KdPrint((__DRIVER_NAME "     first packet is only %d long, must be >= %d\n", XN_HDR_SIZE + buffer_length, (ULONG)(XN_HDR_SIZE + xi->rxpi.ip4_header_length + 20)));
    4.52 +      KdPrint((__DRIVER_NAME "     first packet is only %d long, must be >= %d\n", XN_HDR_SIZE + header_length, (ULONG)(XN_HDR_SIZE + xi->rxpi.ip4_header_length + 20)));
    4.53 +      // we need to do something conclusive here...
    4.54        return;
    4.55      }
    4.56      break;
    4.57    default:
    4.58 -    KdPrint((__DRIVER_NAME "     Not IP\n"));
    4.59 +//    KdPrint((__DRIVER_NAME "     Not IP\n"));
    4.60      return;
    4.61    }
    4.62 -  xi->rxpi.ip_proto = buffer[XN_HDR_SIZE + 9];
    4.63 +  xi->rxpi.ip_proto = xi->rxpi.header[XN_HDR_SIZE + 9];
    4.64    switch (xi->rxpi.ip_proto)
    4.65    {
    4.66    case 6:  // TCP
    4.67 @@ -200,9 +200,14 @@ XenNet_ParseHeader(
    4.68    default:
    4.69      return;
    4.70    }
    4.71 -  xi->rxpi.ip4_length = NET_USHORT(buffer[XN_HDR_SIZE + 2]);
    4.72 -  xi->rxpi.tcp_header_length = (buffer[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 12] & 0xf0) >> 2;
    4.73 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    4.74 +  xi->rxpi.ip4_length = NET_USHORT(xi->rxpi.header[XN_HDR_SIZE + 2]);
    4.75 +  xi->rxpi.tcp_header_length = (xi->rxpi.header[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 12] & 0xf0) >> 2;
    4.76 +  xi->rxpi.tcp_length = xi->rxpi.ip4_length - xi->rxpi.tcp_header_length;
    4.77 +  xi->rxpi.tcp_remaining = xi->rxpi.tcp_length;
    4.78 +  xi->rxpi.tcp_seq = NET_ULONG(xi->rxpi.header[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 4]);
    4.79 +  if (xi->rxpi.mss > 0 && xi->rxpi.tcp_length > xi->rxpi.mss)
    4.80 +    xi->rxpi.split_required = TRUE;
    4.81 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    4.82  }
    4.83  
    4.84  /*
    4.85 @@ -230,6 +235,10 @@ XenNet_SumPacket(
    4.86  
    4.87    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.88  
    4.89 +  #if defined(XEN_PROFILE)
    4.90 +  ProfCount_RxPacketsCsumOffload++;
    4.91 +  #endif
    4.92 +
    4.93    NdisGetFirstBufferFromPacketSafe(packet, &mdl, &buffer, &buffer_length, &total_length, NormalPagePriority);
    4.94    ASSERT(mdl);
    4.95  
    4.96 @@ -246,10 +255,10 @@ XenNet_SumPacket(
    4.97    pre_csum += ((USHORT)buffer[XN_HDR_SIZE + 9]);
    4.98  
    4.99    remaining = xi->rxpi.ip4_length - xi->rxpi.ip4_header_length;
   4.100 -  tcp_length = remaining;
   4.101  
   4.102 -  csum = pre_csum + xi->rxpi.tcp_length;
   4.103 -  for (buffer_offset = i = XN_HDR_SIZE + xi->rxpi.ip4_header_length; i < tcp_length - 1; i += 2, buffer_offset += 2)
   4.104 +  csum = pre_csum + remaining;
   4.105 +
   4.106 +  for (buffer_offset = i = XN_HDR_SIZE + xi->rxpi.ip4_header_length; i < total_length - 1; i += 2, buffer_offset += 2)
   4.107    {
   4.108      if (buffer_offset == buffer_length - 1) // deal with a buffer ending on an odd byte boundary
   4.109      {
   4.110 @@ -283,7 +292,7 @@ XenNet_SumPacket(
   4.111  //KdPrint((__DRIVER_NAME "     %04X\n", NET_USHORT(buffer[buffer_offset])));
   4.112      }
   4.113    }
   4.114 -  if (i != xi->rxpi.ip4_length) // last odd byte
   4.115 +  if (i != total_length) // last odd byte
   4.116    {
   4.117  //KdPrint((__DRIVER_NAME "    *%04X\n", (USHORT)buffer[buffer_offset] << 8));
   4.118      csum += ((USHORT)buffer[buffer_offset] << 8);
   4.119 @@ -297,31 +306,35 @@ XenNet_SumPacket(
   4.120    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.121  }
   4.122  
   4.123 -#if 0
   4.124  static PUCHAR
   4.125 -XenNet_GetMoreData(
   4.126 -  struct xennet_info xi,
   4.127 -  PUSHORT remaining
   4.128 +XenNet_GetData(
   4.129 +  struct xennet_info *xi,
   4.130 +  USHORT req_length,
   4.131 +  PUSHORT length
   4.132  )
   4.133  {
   4.134 -  PNDIS_BUFFER mdl = xi->rxpi.mdls[mdl_number];
   4.135 -  PUCHAR buffer = MmGetMdlVirtualAddress(mdl) + xi->rxpi.curr_mdl_offset;
   4.136 -  USHORT length = min(*remaining, MmGetMdlByteCount(mdl) - xi->rxpi.curr_mdl_offset);
   4.137 +  PNDIS_BUFFER mdl = xi->rxpi.mdls[xi->rxpi.curr_mdl];
   4.138 +  PUCHAR buffer = (PUCHAR)MmGetMdlVirtualAddress(mdl) + xi->rxpi.curr_mdl_offset;
   4.139  
   4.140    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   4.141  
   4.142 -  *remaining -= length;
   4.143 -  xi->rxpi.curr_mdl_offset += length;
   4.144 +  *length = min(req_length, MmGetMdlByteCount(mdl) - xi->rxpi.curr_mdl_offset);
   4.145 +
   4.146 +  xi->rxpi.curr_mdl_offset += *length;
   4.147    if (xi->rxpi.curr_mdl_offset == MmGetMdlByteCount(mdl))
   4.148 -    xi->rxpi.mdl_number++;
   4.149 +  {
   4.150 +    xi->rxpi.curr_mdl++;
   4.151 +    xi->rxpi.curr_mdl_offset = 0;
   4.152 +  }
   4.153 +
   4.154 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.155 +
   4.156    return buffer;
   4.157  }
   4.158 -#endif
   4.159  
   4.160  static PNDIS_PACKET
   4.161  XenNet_MakePacket(
   4.162 -  struct xennet_info *xi,
   4.163 -  PUCHAR header
   4.164 +  struct xennet_info *xi
   4.165  )
   4.166  {
   4.167    PNDIS_PACKET packet;
   4.168 @@ -329,6 +342,8 @@ XenNet_MakePacket(
   4.169    PNDIS_BUFFER out_mdl;
   4.170    PUCHAR out_buffer;
   4.171    USHORT out_offset;
   4.172 +  USHORT out_remaining;
   4.173 +  USHORT length;
   4.174    NDIS_STATUS status;
   4.175    int i;
   4.176  
   4.177 @@ -337,33 +352,37 @@ XenNet_MakePacket(
   4.178    NdisAllocatePacket(&status, &packet, xi->packet_pool);
   4.179    ASSERT(status == NDIS_STATUS_SUCCESS);
   4.180    NDIS_SET_PACKET_HEADER_SIZE(packet, XN_HDR_SIZE);
   4.181 -#if 0
   4.182 -  if (header == NULL)
   4.183 +
   4.184 +  if (!xi->rxpi.split_required)
   4.185    {
   4.186 -#endif
   4.187      for (i = 0; i < xi->rxpi.mdl_count; i++)
   4.188        NdisChainBufferAtBack(packet, xi->rxpi.mdls[i]);
   4.189      NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
   4.190 -#if 0
   4.191    }
   4.192    else
   4.193    {
   4.194 +    KdPrint((__DRIVER_NAME "     splitting packet\n"));
   4.195      out_mdl = get_page_from_freelist(xi);
   4.196 -    out_buffer = out_ptr = MmGetMdlVirtualAddress(out_mdl);
   4.197 +    out_buffer = MmGetMdlVirtualAddress(out_mdl);
   4.198      out_offset = XN_HDR_SIZE + xi->rxpi.ip4_header_length + xi->rxpi.tcp_header_length;
   4.199 -    out_remaining = xi->rxpi.mss;
   4.200 -    memcpy(out_buffer, header, out_offset);
   4.201 +    out_remaining = min(xi->rxpi.mss, xi->rxpi.tcp_remaining);
   4.202 +    NdisAdjustBufferLength(out_mdl, out_offset + out_remaining);
   4.203 +    memcpy(out_buffer, xi->rxpi.header, out_offset);
   4.204 +    out_buffer[XN_HDR_SIZE + 2] = NET_USHORT(out_remaining);
   4.205 +    *((PULONG)&out_buffer[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 4]) = NET_ULONG(xi->rxpi.tcp_seq);
   4.206 +    xi->rxpi.tcp_seq += out_remaining;
   4.207 +    xi->rxpi.tcp_remaining -= out_remaining;
   4.208      do 
   4.209      {
   4.210 -      in_buffer = XenNet_GetMoreData(xi, &out_remaining, &length);
   4.211 +      in_buffer = XenNet_GetData(xi, out_remaining, &length);
   4.212        memcpy(&out_buffer[out_offset], in_buffer, length);
   4.213 -    } while (out_remaining != 0 && in_buffer != NULL)
   4.214 -    length = xi->rxpi.mss - out_remaining;
   4.215 -    in_buffer[___ip4_length_offset___] = NET_USHORT(...); // recalc this
   4.216 -    in_buffer[___mss_offset___] = NET_USHORT(length);
   4.217 -    in_buffer[___seq_offset___] = NET_ULONG(in_buffer[___seq_offset___]) + ???
   4.218 +      out_remaining -= length;
   4.219 +      out_offset += length;
   4.220 +    } while (out_remaining != 0 && in_buffer != NULL);
   4.221 +    //length = xi->rxpi.mss - out_remaining;
   4.222 +    NdisChainBufferAtBack(packet, out_mdl);
   4.223 +    NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
   4.224    }
   4.225 -#endif
   4.226    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.227    return packet;
   4.228  }
   4.229 @@ -372,7 +391,7 @@ static VOID
   4.230  XenNet_MakePackets(
   4.231    struct xennet_info *xi,
   4.232    PNDIS_PACKET *packets,
   4.233 -  PULONG packet_count
   4.234 +  PULONG packet_count_p
   4.235  )
   4.236  {
   4.237    PNDIS_PACKET first_packet;
   4.238 @@ -383,9 +402,9 @@ XenNet_MakePackets(
   4.239    PNDIS_BUFFER curr_out_mdl;
   4.240    ULONG curr_in_offset;
   4.241    ULONG curr_out_offset;
   4.242 -  PUCHAR header;
   4.243    PUCHAR curr_in_buffer;
   4.244    PUCHAR curr_out_buffer;
   4.245 +  USHORT i;
   4.246  
   4.247    ULONG total_in_remaining;
   4.248    ULONG buffer_in_remaining;
   4.249 @@ -396,38 +415,41 @@ XenNet_MakePackets(
   4.250    switch (xi->rxpi.ip_proto)
   4.251    {
   4.252    case 6:  // TCP
   4.253 -#if 0
   4.254      if (xi->rxpi.split_required)
   4.255        break;
   4.256 -#endif
   4.257 -  // fallthrough
   4.258 +    // fallthrough
   4.259    case 17:  // UDP
   4.260 -    packets[*packet_count] = XenNet_MakePacket(xi, NULL);
   4.261 -//    if (xi->rxpi.csum_calc_required)
   4.262 -//      XenNet_SumPacket(xi, packets[*packet_count]);
   4.263 -    *packet_count++;
   4.264 +    packets[*packet_count_p] = XenNet_MakePacket(xi);
   4.265 +    if (xi->rxpi.csum_calc_required)
   4.266 +      XenNet_SumPacket(xi, packets[*packet_count_p]);
   4.267 +    (*packet_count_p)++;
   4.268 +    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (TCP/UDP)\n"));
   4.269      return;
   4.270    default:
   4.271 -    packets[*packet_count] = XenNet_MakePacket(xi, NULL);
   4.272 -    *packet_count++;
   4.273 +    packets[*packet_count_p] = XenNet_MakePacket(xi);
   4.274 +    (*packet_count_p)++;
   4.275 +    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (Other)\n"));
   4.276      return;
   4.277    }
   4.278 -#if 0
   4.279 -  header = 0; //TODO: fix this
   4.280 -  current
   4.281 -  while (data left in buffer)
   4.282 +  xi->rxpi.tcp_remaining = xi->rxpi.tcp_length;
   4.283 +  if (MmGetMdlByteCount(xi->rxpi.mdls[0]) > XN_HDR_SIZE + xi->rxpi.ip4_header_length + xi->rxpi.tcp_header_length)
   4.284 +    xi->rxpi.curr_mdl_offset = XN_HDR_SIZE + xi->rxpi.ip4_header_length + xi->rxpi.tcp_header_length;
   4.285 +  else
   4.286 +    xi->rxpi.curr_mdl = 1;
   4.287 +
   4.288 +  while (xi->rxpi.tcp_remaining)
   4.289    {
   4.290 -    packets[*packet_count] = XenNet_MakePacket(xi, header);
   4.291 -    XenNet_SumPacket(xi, packets[*packet_count];
   4.292 -    *packet_count++;
   4.293 +    packets[*packet_count_p] = XenNet_MakePacket(xi);
   4.294 +    XenNet_SumPacket(xi, packets[*packet_count_p]);
   4.295 +    (*packet_count_p)++;
   4.296    }
   4.297    // TODO: restore psh status to last packet
   4.298    for (i = 0; i < mdl_count; i++)
   4.299    {
   4.300 -    put_page_on_freelist(xi, mdls[i];
   4.301 +    NdisAdjustBufferLength(mdl, PAGE_SIZE);
   4.302 +    put_page_on_freelist(xi, mdls[i]);
   4.303    }
   4.304 -#endif
   4.305 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.306 +  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (split)\n"));
   4.307  }
   4.308  
   4.309  // Called at DISPATCH_LEVEL
   4.310 @@ -510,14 +532,11 @@ XenNet_RxBufferCheck(struct xennet_info 
   4.311          if (!xi->rxpi.more_frags) // handling the packet's 1st buffer
   4.312          {
   4.313            
   4.314 -          if (rxrsp->flags & (NETRXF_csum_blank|NETRXF_data_validated) && xi->config_csum) // and we are enabled for offload...
   4.315 +          if (rxrsp->flags & (NETRXF_csum_blank|NETRXF_data_validated) && xi->config_csum)
   4.316            {
   4.317              //KdPrint((__DRIVER_NAME "     RX csum blank = %d, validated = %d\n", !!(rxrsp->flags & NETRXF_csum_blank), !!(rxrsp->flags & NETRXF_data_validated)));
   4.318              if (rxrsp->flags & NETRXF_csum_blank)
   4.319                xi->rxpi.csum_calc_required = TRUE;
   4.320 -            #if defined(XEN_PROFILE)
   4.321 -            ProfCount_RxPacketsCsumOffload++;
   4.322 -            #endif
   4.323            }
   4.324          }
   4.325          NdisAdjustBufferLength(mdl, rxrsp->status);