• Subash Abhinov Kasiviswanathan's avatar
    net: qualcomm: rmnet: Add support for RX checksum offload · bbd21b24
    Subash Abhinov Kasiviswanathan authored
    When using the MAPv4 packet format, receive checksum offload can be
    enabled in hardware. The checksum computation over pseudo header is
    not offloaded but the rest of the checksum computation over
    the payload is offloaded. This applies only for TCP / UDP packets
    which are not fragmented.
    
    rmnet validates the TCP/UDP checksum for the packet using the checksum
    from the checksum trailer added to the packet by hardware. The
    validation performed is as following -
    
    1. Perform 1's complement over the checksum value from the trailer
    2. Compute 1's complement checksum over IPv4 / IPv6 header and
       subtracts it from the value from step 1
    3. Computes 1's complement checksum over IPv4 / IPv6 pseudo header and
       adds it to the value from step 2
    4. Subtracts the checksum value from the TCP / UDP header from the
       value from step 3.
    5. Compares the value from step 4 to the checksum value from the
       TCP / UDP header.
    6. If the comparison in step 5 succeeds, CHECKSUM_UNNECESSARY is set
       and the packet is passed on to network stack. If there is a
       failure, then the packet is passed on as such without modifying
       the ip_summed field.
    
    The checksum field is also checked for UDP checksum 0 as per RFC 768
    and for unexpected TCP checksum of 0.
    
    If checksum offload is disabled when using MAPv4 packet format in
    receive path, the packet is queued as is to network stack without
    the validations above.
    Signed-off-by: default avatarSubash Abhinov Kasiviswanathan <subashab@codeaurora.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    bbd21b24
rmnet_handlers.c 5.08 KB