win-pvdrivers

changeset 423:718d4567551d

Re-commit after accidental 'rollback' instead of 'revert'. doh.
author James Harper <james.harper@bendigoit.com.au>
date Thu Aug 28 21:26:46 2008 +1000 (2008-08-28)
parents 9b7614f440b1
children 37ed25854efa
files common.inc installer.nsi xennet/xennet.h xennet/xennet_common.c xennet/xennet_oid.c xennet/xennet_rx.c
line diff
     1.1 --- a/common.inc	Tue Aug 26 15:06:03 2008 +1000
     1.2 +++ b/common.inc	Thu Aug 28 21:26:46 2008 +1000
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.10.13
     1.5 +VERSION=0.9.10.14
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  MSC_WARNING_LEVEL=/W4
     1.8  INCLUDES = ..\common\include;..\common\include\public
     2.1 --- a/installer.nsi	Tue Aug 26 15:06:03 2008 +1000
     2.2 +++ b/installer.nsi	Thu Aug 28 21:26:46 2008 +1000
     2.3 @@ -3,7 +3,7 @@
     2.4  
     2.5  !define AppName "Xen PV Drivers"
     2.6  !define StartMenu "$SMPROGRAMS\${AppName}"
     2.7 -!define Version "0.9.11-pre12"
     2.8 +!define Version "0.9.11-pre13"
     2.9  #!define Version "$%VERSION%"
    2.10  Name "${AppName}"
    2.11  InstallDir "$PROGRAMFILES\${AppName}"
     3.1 --- a/xennet/xennet.h	Tue Aug 26 15:06:03 2008 +1000
     3.2 +++ b/xennet/xennet.h	Thu Aug 28 21:26:46 2008 +1000
     3.3 @@ -127,6 +127,7 @@ SET_NET_ULONG(PVOID ptr, ULONG data)
     3.4    NDIS_PACKET_TYPE_DIRECTED | \
     3.5    NDIS_PACKET_TYPE_MULTICAST | \
     3.6    NDIS_PACKET_TYPE_BROADCAST | \
     3.7 +  NDIS_PACKET_TYPE_PROMISCUOUS | \
     3.8    NDIS_PACKET_TYPE_ALL_MULTICAST)
     3.9  
    3.10  /* couldn't get regular xen ring macros to work...*/
    3.11 @@ -350,14 +351,6 @@ XenNet_SetInformation(
    3.12    OUT PULONG BytesNeeded
    3.13    );
    3.14  
    3.15 -PUCHAR
    3.16 -XenNet_GetData(
    3.17 -  packet_info_t *pi,
    3.18 -  USHORT req_length,
    3.19 -  PUSHORT length
    3.20 -);
    3.21 -
    3.22 -
    3.23  /* return values */
    3.24  #define PARSE_OK 0
    3.25  #define PARSE_TOO_SMALL 1 /* first buffer is too small */
    3.26 @@ -374,12 +367,36 @@ XenNet_SumIpHeader(
    3.27    USHORT ip4_header_length
    3.28  );
    3.29  
    3.30 -static __inline grant_ref_t
    3.31 +static __forceinline grant_ref_t
    3.32  get_grant_ref(PMDL mdl)
    3.33  {
    3.34    return *(grant_ref_t *)(((UCHAR *)mdl) + MmSizeOfMdl(0, PAGE_SIZE));
    3.35  }
    3.36  
    3.37 +static __forceinline PUCHAR
    3.38 +XenNet_GetData(
    3.39 +  packet_info_t *pi,
    3.40 +  USHORT req_length,
    3.41 +  PUSHORT length
    3.42 +)
    3.43 +{
    3.44 +  PNDIS_BUFFER mdl = pi->mdls[pi->curr_mdl];
    3.45 +  PUCHAR buffer = (PUCHAR)MmGetMdlVirtualAddress(mdl) + pi->curr_mdl_offset;
    3.46 +
    3.47 +  *length = (USHORT)min(req_length, MmGetMdlByteCount(mdl) - pi->curr_mdl_offset);
    3.48 +
    3.49 +  pi->curr_mdl_offset = pi->curr_mdl_offset + *length;
    3.50 +  if (pi->curr_mdl_offset == MmGetMdlByteCount(mdl))
    3.51 +  {
    3.52 +    pi->curr_mdl++;
    3.53 +    pi->curr_mdl_offset = 0;
    3.54 +  }
    3.55 +
    3.56 +  return buffer;
    3.57 +}
    3.58 +
    3.59 +
    3.60 +
    3.61  VOID
    3.62  XenFreelist_Init(struct xennet_info *xi, freelist_t *fl, PKSPIN_LOCK lock);
    3.63  PMDL
     4.1 --- a/xennet/xennet_common.c	Tue Aug 26 15:06:03 2008 +1000
     4.2 +++ b/xennet/xennet_common.c	Thu Aug 28 21:26:46 2008 +1000
     4.3 @@ -115,34 +115,6 @@ XenNet_SumIpHeader(
     4.4    SET_NET_USHORT(&header[XN_HDR_SIZE + 10], (USHORT)csum);
     4.5  }
     4.6  
     4.7 -PUCHAR
     4.8 -XenNet_GetData(
     4.9 -  packet_info_t *pi,
    4.10 -  USHORT req_length,
    4.11 -  PUSHORT length
    4.12 -)
    4.13 -{
    4.14 -  PNDIS_BUFFER mdl = pi->mdls[pi->curr_mdl];
    4.15 -  PUCHAR buffer = (PUCHAR)MmGetMdlVirtualAddress(mdl) + pi->curr_mdl_offset;
    4.16 -
    4.17 -  //FUNCTION_ENTER();
    4.18 -
    4.19 -  *length = (USHORT)min(req_length, MmGetMdlByteCount(mdl) - pi->curr_mdl_offset);
    4.20 -
    4.21 -  //FUNCTION_MSG(("req_length = %d, length = %d\n", req_length, *length));
    4.22 -
    4.23 -  pi->curr_mdl_offset = pi->curr_mdl_offset + *length;
    4.24 -  if (pi->curr_mdl_offset == MmGetMdlByteCount(mdl))
    4.25 -  {
    4.26 -    pi->curr_mdl++;
    4.27 -    pi->curr_mdl_offset = 0;
    4.28 -  }
    4.29 -
    4.30 -  //FUNCTION_EXIT();
    4.31 -
    4.32 -  return buffer;
    4.33 -}
    4.34 -
    4.35  /* Called at DISPATCH LEVEL */
    4.36  static VOID DDKAPI
    4.37  XenFreelist_Timer(
     5.1 --- a/xennet/xennet_oid.c	Tue Aug 26 15:06:03 2008 +1000
     5.2 +++ b/xennet/xennet_oid.c	Thu Aug 28 21:26:46 2008 +1000
     5.3 @@ -124,9 +124,7 @@ XenNet_QueryInformation(
     5.4        temp_data = PAGE_SIZE; //XN_DATA_SIZE;
     5.5        break;
     5.6      case OID_GEN_MAXIMUM_FRAME_SIZE:
     5.7 -      // According to the specs, OID_GEN_MAXIMUM_FRAME_SIZE does not include the header, so
     5.8 -      // it is XN_DATA_SIZE not XN_MAX_PKT_SIZE
     5.9 -      temp_data = XN_DATA_SIZE;
    5.10 +      temp_data = xi->config_mtu;
    5.11        break;
    5.12      case OID_GEN_LINK_SPEED:
    5.13        temp_data = 10000000; /* 1Gb */
    5.14 @@ -159,7 +157,7 @@ XenNet_QueryInformation(
    5.15        break;
    5.16      case OID_GEN_CURRENT_LOOKAHEAD:
    5.17        // TODO: we should store this...
    5.18 -      temp_data = 54; //XN_MAX_PKT_SIZE;
    5.19 +      temp_data = xi->config_max_pkt_size;
    5.20        break;
    5.21      case OID_GEN_DRIVER_VERSION:
    5.22        temp_data = (NDIS_MINIPORT_MAJOR_VERSION << 8) | NDIS_MINIPORT_MINOR_VERSION;
     6.1 --- a/xennet/xennet_rx.c	Tue Aug 26 15:06:03 2008 +1000
     6.2 +++ b/xennet/xennet_rx.c	Thu Aug 28 21:26:46 2008 +1000
     6.3 @@ -154,6 +154,8 @@ XenNet_MakePacket(struct xennet_info *xi
     6.4      for (i = 0; i < xi->rxpi.mdl_count; i++)
     6.5        NdisChainBufferAtBack(packet, xi->rxpi.mdls[i]);
     6.6  
     6.7 +    NDIS_PER_PACKET_INFO_FROM_PACKET(packet, TcpLargeSendPacketInfo) = UlongToPtr(xi->rxpi.mss);
     6.8 +
     6.9      NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
    6.10    }
    6.11    else
    6.12 @@ -190,7 +192,6 @@ XenNet_MakePacket(struct xennet_info *xi
    6.13      XenNet_SumIpHeader(out_buffer, xi->rxpi.ip4_header_length);
    6.14      NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
    6.15    }
    6.16 -
    6.17  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (%p)\n", packet));
    6.18    return packet;
    6.19  }
    6.20 @@ -265,7 +266,7 @@ XenNet_SumPacketData(
    6.21          KdPrint((__DRIVER_NAME "     Ran out of buffers\n"));
    6.22          return;
    6.23        }
    6.24 -      NdisQueryBufferSafe(mdl, (PVOID) &buffer, &buffer_length, NormalPagePriority);
    6.25 +      NdisQueryBufferSafe(mdl, &buffer, &buffer_length, NormalPagePriority);
    6.26        csum += ((USHORT)buffer[0]);
    6.27        buffer_offset = (USHORT)-1;
    6.28      }
    6.29 @@ -323,6 +324,7 @@ XenNet_MakePackets(
    6.30      packet = XenNet_MakePacket(xi);
    6.31      if (packet == NULL)
    6.32      {
    6.33 +      KdPrint((__DRIVER_NAME "     Ran out of packets\n"));
    6.34        xi->stat_rx_no_buffer++;
    6.35        packet_count = 0;
    6.36        goto done;
    6.37 @@ -343,6 +345,7 @@ XenNet_MakePackets(
    6.38      packet = XenNet_MakePacket(xi);
    6.39      if (packet == NULL)
    6.40      {
    6.41 +      KdPrint((__DRIVER_NAME "     Ran out of packets\n"));
    6.42        xi->stat_rx_no_buffer++;
    6.43        packet_count = 0;
    6.44        goto done;
    6.45 @@ -370,6 +373,7 @@ XenNet_MakePackets(
    6.46      packet = XenNet_MakePacket(xi);
    6.47      if (!packet)
    6.48      {
    6.49 +      KdPrint((__DRIVER_NAME "     Ran out of packets\n"));
    6.50        xi->stat_rx_no_buffer++;
    6.51        break; /* we are out of memory - just drop the packets */
    6.52      }
    6.53 @@ -392,7 +396,6 @@ XenNet_MakePackets(
    6.54      packet_count++;
    6.55    }
    6.56  
    6.57 -  // this won't be true if we had to abort due to a lack of resources... ASSERT(xi->rxpi.curr_mdl == xi->rxpi.mdl_count);
    6.58  done:
    6.59    for (i = 0; i < xi->rxpi.mdl_count; i++)
    6.60    {