• Tom Herbert's avatar
    net: Support for multiple checksums with gso · 7e2b10c1
    Tom Herbert authored
    When creating a GSO packet segment we may need to set more than
    one checksum in the packet (for instance a TCP checksum and
    UDP checksum for VXLAN encapsulation). To be efficient, we want
    to do checksum calculation for any part of the packet at most once.
    
    This patch adds csum_start offset to skb_gso_cb. This tracks the
    starting offset for skb->csum which is initially set in skb_segment.
    When a protocol needs to compute a transport checksum it calls
    gso_make_checksum which computes the checksum value from the start
    of transport header to csum_start and then adds in skb->csum to get
    the full checksum. skb->csum and csum_start are then updated to reflect
    the checksum of the resultant packet starting from the transport header.
    
    This patch also adds a flag to skbuff, encap_hdr_csum, which is set
    in *gso_segment fucntions to indicate that a tunnel protocol needs
    checksum calculation
    Signed-off-by: default avatarTom Herbert <therbert@google.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    7e2b10c1
ip_tunnel_core.c 5.28 KB