• Eric Dumazet's avatar
    udp: avoid csum_partial() for validated skb · 595d0b29
    Eric Dumazet authored
    In commit e6afc8ac ("udp: remove headers from UDP packets before
    queueing"), udp_csum_pull_header() helper was added but missed fact
    that CHECKSUM_UNNECESSARY packets were now converted to CHECKSUM_NONE
    and skb->csum_valid was set to 1 for them.
    Since csum_partial() is quite expensive, even for 8-byte area, it is
    worth adding a test.
    We also can use skb->data instead of udp_hdr() as we are pulling
    UDP headers, as it is sightly faster.
    Signed-off-by: 's avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
udp.h 10.4 KB