datapath-windows/ovsext/Offload.c
/*
 *----------------------------------------------------------------------------
 *  IPPseudoChecksum --
 *
 *   Give src and dst IP address, protocol value and total
 *   upper layer length(not include IP header, but include
 *   upller layer protocol header, for example it include
 *   TCP header for TCP checksum), calculate the pseudo
 *   checksum, please note this checksum is just 1's complement
 *   addition.
 *
 *  Input Parameter:
 *    src: please note it is in network byte order
 *    dst: same as src
 *    protocol: protocol value in IP header
 *    totalLength: total length of upper layer data including
 *          header.
 *
 *  Result:
 *
 *   This value should be put in TCP checksum field before
 *   calculating TCP checksum using CalculateChecksum with
 *   initial value of 0.
 *----------------------------------------------------------------------------
 */
IPPseudoChecksum
Give src and dst IP address, protocol value and total
upper layer length(not include IP header, but include
upller layer protocol header, for example it include
TCP header for TCP checksum), calculate the pseudo
checksum, please note this checksum is just 1's complement
addition.





This value should be put in TCP checksum field before
calculating TCP checksum using CalculateChecksum with
initial value of 0.
IPPseudoChecksum Give src and dst IP address protocol value and total upper layer length ( not include IP header but include upller layer protocol header for example it include TCP header for TCP checksum ) calculate the pseudo checksum please note this checksum is just 1 ' s complement addition . This value should be put in TCP checksum field before calculating TCP checksum using CalculateChecksum with initial value of 0 .
UINT16
IPPseudoChecksum(UINT32 *src,
                 UINT32 *dst,
                 UINT8 protocol,
                 UINT16 totalLength)
{
    UINT32 sum = (UINT32)htons(totalLength) + htons(protocol);
    sum += (*src >> 16) + (*src & 0xffff);
    sum += (*dst >> 16) + (*dst & 0xffff);
    fold32(sum);
    return (UINT16)sum;
}
UINT16 IPPseudoChecksum ( UINT32 * src , UINT32 * dst , UINT8 protocol , UINT16 totalLength ) { UINT32 sum = ( UINT32 ) htons ( totalLength ) + htons ( protocol ) ; sum += ( * src >> 16 ) + ( * src & 0xffff ) ; sum += ( * dst >> 16 ) + ( * dst & 0xffff ) ; fold32 ( sum ) ; return ( UINT16 ) sum ; }
IPPseudoChecksum
   Give src and dst IP address, protocol value and total
   upper layer length(not include IP header, but include
   upller layer protocol header, for example it include
   TCP header for TCP checksum), calculate the pseudo
   checksum, please note this checksum is just 1's complement
   addition.
IPPseudoChecksum Give src and dst IP address protocol value and total upper layer length ( not include IP header but include upller layer protocol header for example it include TCP header for TCP checksum ) calculate the pseudo checksum please note this checksum is just 1 ' s complement addition .