]> git.baikalelectronics.ru Git - kernel.git/commit
udp: avoid csum_partial() for validated skb
authorEric Dumazet <edumazet@google.com>
Tue, 31 May 2016 22:22:41 +0000 (15:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Jun 2016 00:41:36 +0000 (17:41 -0700)
commitb4d16e21ca7772fb3f30ed653da552220b35e9be
tree5b9776e46e62588b659a61e9bbdd20614705a0fb
parent837195fe7f4c1c2bdd8160209d71796539e890a6
udp: avoid csum_partial() for validated skb

In commit f1b0743d94dc0 ("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: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/udp.h