win-pvdrivers

changeset 447:5a8502167007

Added a configuration option to avoid manually checking the checksum on RX packets.
author James Harper <james.harper@bendigoit.com.au>
date Fri Nov 07 20:07:35 2008 +1100 (2008-11-07)
parents df024d2ff15f
children b90f59eb12f9
files xennet/xennet.c xennet/xennet.h xennet/xennet.inx xennet/xennet_rx.c
line diff
     1.1 --- a/xennet/xennet.c	Fri Nov 07 11:14:16 2008 +1100
     1.2 +++ b/xennet/xennet.c	Fri Nov 07 20:07:35 2008 +1100
     1.3 @@ -367,6 +367,7 @@ XenNet_Init(
     1.4    }
     1.5    xi->event_channel = 0;
     1.6    xi->config_csum = 1;
     1.7 +  xi->config_csum_rx_check = 1;
     1.8    xi->config_sg = 1;
     1.9    xi->config_gso = 61440;
    1.10    xi->config_page = NULL;
    1.11 @@ -526,6 +527,19 @@ XenNet_Init(
    1.12      xi->config_csum = !!config_param->ParameterData.IntegerData;
    1.13    }
    1.14  
    1.15 +  NdisInitUnicodeString(&config_param_name, L"ChecksumOffloadRxCheck");
    1.16 +  NdisReadConfiguration(&status, &config_param, config_handle, &config_param_name, NdisParameterInteger);
    1.17 +  if (!NT_SUCCESS(status))
    1.18 +  {
    1.19 +    KdPrint(("Could not read ChecksumOffloadRxCheck value (%08x)\n", status));
    1.20 +    xi->config_csum_rx_check = 1;
    1.21 +  }
    1.22 +  else
    1.23 +  {
    1.24 +    KdPrint(("ChecksumOffload = %d\n", config_param->ParameterData.IntegerData));
    1.25 +    xi->config_csum_rx_check = !!config_param->ParameterData.IntegerData;
    1.26 +  }
    1.27 +
    1.28    NdisInitUnicodeString(&config_param_name, L"MTU");
    1.29    NdisReadConfiguration(&status, &config_param, config_handle, &config_param_name, NdisParameterInteger);  
    1.30    if (!NT_SUCCESS(status))
     2.1 --- a/xennet/xennet.h	Fri Nov 07 11:14:16 2008 +1100
     2.2 +++ b/xennet/xennet.h	Fri Nov 07 20:07:35 2008 +1100
     2.3 @@ -280,6 +280,7 @@ struct xennet_info
     2.4    /* config vars from registry */
     2.5    ULONG config_sg;
     2.6    ULONG config_csum;
     2.7 +  ULONG config_csum_rx_check;
     2.8    ULONG config_gso;
     2.9    ULONG config_mtu;
    2.10  
     3.1 --- a/xennet/xennet.inx	Fri Nov 07 11:14:16 2008 +1100
     3.2 +++ b/xennet/xennet.inx	Fri Nov 07 20:07:35 2008 +1100
     3.3 @@ -46,6 +46,12 @@ HKR, Ndi\Params\ChecksumOffload, type, ,
     3.4  HKR, Ndi\Params\ChecksumOffload\enum, 0, , "Disabled"
     3.5  HKR, Ndi\Params\ChecksumOffload\enum, 1, , "Enabled"
     3.6  
     3.7 +HKR, Ndi\Params\ChecksumOffloadRxCheck, ParamDesc, , "Check checksum on RX packets"
     3.8 +HKR, Ndi\Params\ChecksumOffloadRxCheck, default, , "1"
     3.9 +HKR, Ndi\Params\ChecksumOffloadRxCheck, type, , "enum"
    3.10 +HKR, Ndi\Params\ChecksumOffloadRxCheck\enum, 0, , "Disabled"
    3.11 +HKR, Ndi\Params\ChecksumOffloadRxCheck\enum, 1, , "Enabled"
    3.12 +
    3.13  HKR, Ndi\Params\LargeSendOffload, ParamDesc, , "Large Send Offload"
    3.14  HKR, Ndi\Params\LargeSendOffload, default, , "61440"
    3.15  HKR, Ndi\Params\LargeSendOffload, type, , "enum"
     4.1 --- a/xennet/xennet_rx.c	Fri Nov 07 11:14:16 2008 +1100
     4.2 +++ b/xennet/xennet_rx.c	Fri Nov 07 20:07:35 2008 +1100
     4.3 @@ -198,29 +198,6 @@ XenNet_MakePacket(struct xennet_info *xi
     4.4      NDIS_SET_PACKET_STATUS(packet, NDIS_STATUS_SUCCESS);
     4.5    }
     4.6  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (%p)\n", packet));
     4.7 -
     4.8 -  if (1)
     4.9 -  {
    4.10 -    PMDL mdl;
    4.11 -    PVOID *addr;
    4.12 -    UINT buffer_length;
    4.13 -    UINT total_length;
    4.14 -    UINT calc_length = 0;
    4.15 -    NdisGetFirstBufferFromPacketSafe(packet, &mdl, &addr, &buffer_length, &total_length, NormalPagePriority);
    4.16 -    //KdPrint((__DRIVER_NAME "     total_length = %d\n", total_length));
    4.17 -    while (mdl)
    4.18 -    {
    4.19 -      NdisQueryBufferSafe(mdl, &addr, &buffer_length, NormalPagePriority);
    4.20 -      ASSERT(mdl != NULL);
    4.21 -      ASSERT(addr != NULL);
    4.22 -      ASSERT(buffer_length != 0);
    4.23 -      calc_length += buffer_length;
    4.24 -      NdisGetNextBuffer(mdl, &mdl);
    4.25 -    }
    4.26 -    ASSERT(calc_length == total_length);
    4.27 -  }
    4.28 -  // verify buffers
    4.29 -  // verify that total length == sum of buffer lengths
    4.30    
    4.31    return packet;
    4.32  }
    4.33 @@ -398,7 +375,7 @@ XenNet_MakePackets(
    4.34          if (xi->setting_csum.V4Receive.UdpChecksum && xi->rxpi.ip_proto == 17)
    4.35            csum_info->Receive.NdisPacketUdpChecksumSucceeded = TRUE;
    4.36        }
    4.37 -      else
    4.38 +      else if (!xi->config_csum_rx_check)
    4.39        {
    4.40          if (xi->setting_csum.V4Receive.TcpChecksum && xi->rxpi.ip_proto == 6)
    4.41          {