win-pvdrivers

changeset 98:7fa1d15f34bf

More changes to get checksum problems resolved
author James Harper <james.harper@bendigoit.com.au>
date Mon Jan 07 23:42:13 2008 +1100 (2008-01-07)
parents 104e88af0858
children ca121c57a360
files xennet/sources xennet/xennet.c
line diff
     1.1 --- a/xennet/sources	Mon Jan 07 12:47:33 2008 +1100
     1.2 +++ b/xennet/sources	Mon Jan 07 23:42:13 2008 +1100
     1.3 @@ -1,7 +1,7 @@
     1.4  TARGETNAME=XENNET
     1.5  TARGETTYPE=DRIVER
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7 -VERSION=0.5.0.47
     1.8 +VERSION=0.5.0.50
     1.9  KMDF_VERSION=1
    1.10  MSC_WARNING_LEVEL=/W4
    1.11  INF_NAME=xennet
     2.1 --- a/xennet/xennet.c	Mon Jan 07 12:47:33 2008 +1100
     2.2 +++ b/xennet/xennet.c	Mon Jan 07 23:42:13 2008 +1100
     2.3 @@ -352,14 +352,19 @@ XenNet_RxBufferCheck(struct xennet_info 
     2.4        ASSERT(rxrsp->status > 0);
     2.5        NdisAdjustBufferLength(buffer, rxrsp->status);
     2.6  
     2.7 -      csum_info = (PNDIS_TCP_IP_CHECKSUM_PACKET_INFO)NDIS_PER_PACKET_INFO_FROM_PACKET(pkt, TcpIpChecksumPacketInfo);
     2.8 -      if (csum_info != NULL)
     2.9 -      {
    2.10 -        KdPrint((__DRIVER_NAME "     Got NDIS_PER_PACKET_INFO_FROM_PACKET(pkt, TcpIpChecksumPacketInfo)\n"));
    2.11 -        csum_info->Receive.NdisPacketTcpChecksumSucceeded = 1;
    2.12 -      }
    2.13 -      else
    2.14 -        KdPrint((__DRIVER_NAME "     Could not get NDIS_PER_PACKET_INFO_FROM_PACKET(pkt, TcpIpChecksumPacketInfo)\n"));
    2.15 +#if 0
    2.16 +      KdPrint((__DRIVER_NAME "     Flags = %sNETRXF_data_validated|%sNETRXF_csum_blank|%sNETRXF_more_data|%sNETRXF_extra_info\n",
    2.17 +        (rxrsp->flags|NETRXF_data_validated)?"":"!",
    2.18 +        (rxrsp->flags|NETRXF_csum_blank)?"":"!",
    2.19 +        (rxrsp->flags|NETRXF_more_data)?"":"!",
    2.20 +        (rxrsp->flags|NETRXF_extra_info)?"":"!"));
    2.21 +#endif
    2.22 +// maybe use NDIS_GET_PACKET_PROTOCOL_TYPE(Packet) here and check for == NDIS_PROTOCOL_ID_TCP_IP etc
    2.23 +
    2.24 +      csum_info = (PNDIS_TCP_IP_CHECKSUM_PACKET_INFO)&NDIS_PER_PACKET_INFO_FROM_PACKET(pkt, TcpIpChecksumPacketInfo);
    2.25 +      csum_info->Receive.NdisPacketTcpChecksumSucceeded = 1;
    2.26 +      csum_info->Receive.NdisPacketUdpChecksumSucceeded = 1;
    2.27 +      csum_info->Receive.NdisPacketIpChecksumSucceeded = 1;
    2.28  
    2.29        xi->stat_rx_ok++;
    2.30        NDIS_SET_PACKET_STATUS(pkt, NDIS_STATUS_SUCCESS);
    2.31 @@ -423,7 +428,7 @@ XenNet_BackEndStateHandler(char *Path, P
    2.32    int retry = 0;
    2.33    char *err;
    2.34    int i;
    2.35 -  int new_backend_state;
    2.36 +  ULONG new_backend_state;
    2.37  
    2.38    struct set_params {
    2.39      char *name;
    2.40 @@ -876,8 +881,12 @@ XenNet_QueryInformation(
    2.41    UCHAR vendor_desc[] = XN_VENDOR_DESC;
    2.42    ULONG64 temp_data;
    2.43    PVOID data = &temp_data;
    2.44 +  ULONG offset = 0;
    2.45    UINT len = 4;
    2.46    NDIS_STATUS status = NDIS_STATUS_SUCCESS;
    2.47 +  PNDIS_TASK_OFFLOAD_HEADER ntoh;
    2.48 +  PNDIS_TASK_OFFLOAD nto;
    2.49 +  PNDIS_TASK_TCP_IP_CHECKSUM nttic;
    2.50  
    2.51  //  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.52  
    2.53 @@ -995,6 +1004,46 @@ XenNet_QueryInformation(
    2.54        break;
    2.55      case OID_TCP_TASK_OFFLOAD:
    2.56        KdPrint(("Get OID_TCP_TASK_OFFLOAD\n"));
    2.57 +      len = sizeof(NDIS_TASK_OFFLOAD_HEADER) + sizeof(NDIS_TASK_OFFLOAD) - 1 + sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
    2.58 +      offset = sizeof(NDIS_TASK_OFFLOAD_HEADER);
    2.59 +      NdisAllocateMemoryWithTag(&data, len - offset, XENNET_POOL_TAG);
    2.60 +
    2.61 +      ntoh = InformationBuffer;
    2.62 +
    2.63 +
    2.64 +      // check that ntoh->Version == NDIS_TASK_OFFLOAD_VERSION
    2.65 +      // check that ntoh->Size == sizeof(NDIS_TASK_OFFLOAD_HEADER) (maybe)
    2.66 +      // check that ntoh->EncapsulationFormat.Encapsulation == IEEE_802_3_Encapsulation
    2.67 +
    2.68 +      ntoh->OffsetFirstTask = offset;
    2.69 +
    2.70 +      nto = data; //((char *)ntoh) + ntoh->OffsetFirstTask;
    2.71 +
    2.72 +      nto->Version = NDIS_TASK_OFFLOAD_VERSION;
    2.73 +      nto->Size = sizeof(NDIS_TASK_OFFLOAD);
    2.74 +      nto->Task = TcpIpChecksumNdisTask;
    2.75 +      nto->OffsetNextTask = 0;
    2.76 +      nto->TaskBufferLength = sizeof(NDIS_TASK_TCP_IP_CHECKSUM);
    2.77 +
    2.78 +      nttic = (PNDIS_TASK_TCP_IP_CHECKSUM)nto->TaskBuffer;
    2.79 +      nttic->V4Transmit.IpOptionsSupported = 0;
    2.80 +      nttic->V4Transmit.TcpOptionsSupported = 0;
    2.81 +      nttic->V4Transmit.TcpChecksum = 0;
    2.82 +      nttic->V4Transmit.UdpChecksum = 0;
    2.83 +      nttic->V4Transmit.IpChecksum = 0;
    2.84 +      nttic->V4Receive.IpOptionsSupported = 1;
    2.85 +      nttic->V4Receive.TcpOptionsSupported = 1;
    2.86 +      nttic->V4Receive.TcpChecksum = 1;
    2.87 +      nttic->V4Receive.UdpChecksum = 1;
    2.88 +      nttic->V4Receive.IpChecksum = 1;
    2.89 +      nttic->V6Transmit.IpOptionsSupported = 0;
    2.90 +      nttic->V6Transmit.TcpOptionsSupported = 0;
    2.91 +      nttic->V6Transmit.TcpChecksum = 0;
    2.92 +      nttic->V6Transmit.UdpChecksum = 0;
    2.93 +      nttic->V6Receive.IpOptionsSupported = 0;
    2.94 +      nttic->V6Receive.TcpOptionsSupported = 0;
    2.95 +      nttic->V6Receive.TcpChecksum = 0;
    2.96 +      nttic->V6Receive.UdpChecksum = 0;
    2.97        break;
    2.98      default:
    2.99        KdPrint(("Get Unknown OID 0x%x\n", Oid));
   2.100 @@ -1010,14 +1059,14 @@ XenNet_QueryInformation(
   2.101    if (len > InformationBufferLength)
   2.102    {
   2.103      *BytesNeeded = len;
   2.104 -  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returned error)\n"));
   2.105 +    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (BUFFER_TOO_SHORT)\n"));
   2.106      return NDIS_STATUS_BUFFER_TOO_SHORT;
   2.107    }
   2.108  
   2.109    *BytesWritten = len;
   2.110    if (len)
   2.111    {
   2.112 -    NdisMoveMemory(InformationBuffer, data, len);
   2.113 +    NdisMoveMemory(((PUCHAR)InformationBuffer) + offset, data, len - offset);
   2.114    }
   2.115  
   2.116    //KdPrint(("Got OID 0x%x\n", Oid));