win-pvdrivers

changeset 1071:83201dc2ea3f 0.11.0.419

Fix a bug on LSO checksum where the tcp_length needed to be removed from the pseudoheader checksum
author James Harper <james.harper@bendigoit.com.au>
date Fri Nov 15 11:32:15 2013 +1100 (2013-11-15)
parents 05ece536b204
children 48bce097938f
files xennet/xennet_tx.c
line diff
     1.1 --- a/xennet/xennet_tx.c	Wed Nov 13 07:56:13 2013 +1100
     1.2 +++ b/xennet/xennet_tx.c	Fri Nov 15 11:32:15 2013 +1100
     1.3 @@ -215,11 +215,18 @@ XenNet_HWSendPacket(struct xennet_info *
     1.4    }
     1.5  
     1.6    if (ndis_lso) {    
     1.7 +    ULONG csum;
     1.8      flags |= NETTXF_csum_blank | NETTXF_data_validated; /* these may be implied but not specified when lso is used*/
     1.9      if (pi.tcp_length >= mss) {
    1.10        flags |= NETTXF_extra_info;
    1.11        xen_gso = TRUE;
    1.12      }
    1.13 +    /* Adjust pseudoheader checksum to be what Linux expects (remove the tcp_length) */
    1.14 +    csum = ~RtlUshortByteSwap(*(PUSHORT)&pi.header[XN_HDR_SIZE + pi.ip4_header_length + 16]);
    1.15 +    csum -= (pi.ip4_length - pi.ip4_header_length);
    1.16 +    while (csum & 0xFFFF0000)
    1.17 +      csum = (csum & 0xFFFF) + (csum >> 16);
    1.18 +    *(PUSHORT)&pi.header[XN_HDR_SIZE + pi.ip4_header_length + 16] = ~RtlUshortByteSwap((USHORT)csum);
    1.19    }
    1.20  /*
    1.21  * See io/netif.h. Must put (A) 1st request, then (B) optional extra_info, then