diff options
author | Paolo Abeni <pabeni@redhat.com> | 2017-06-26 19:01:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-27 15:43:57 -0400 |
commit | 67a51780aebb683c3b217b2867e25102cdb0afbc (patch) | |
tree | 4d593cd01e8f7783935fae566b9e2cb4a29159a6 /net/ipv6 | |
parent | b26bbdae460ba90fb8cda37123a66be15a43a2a9 (diff) | |
download | linux-67a51780aebb683c3b217b2867e25102cdb0afbc.tar.bz2 |
ipv6: udp: leverage scratch area helpers
The commit b65ac44674dd ("udp: try to avoid 2 cache miss on dequeue")
leveraged the scratched area helpers for UDP v4 but I forgot to
update accordingly the IPv6 code path.
This change extends the scratch area usage to the IPv6 code, synching
the two implementations and giving some performance benefit.
IPv6 is again almost on the same level of IPv4, performance-wide.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/udp.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index d1d728805729..450829dd6384 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -362,7 +362,7 @@ try_again: if (!skb) return err; - ulen = skb->len; + ulen = udp_skb_len(skb); copied = len; if (copied > ulen - off) copied = ulen - off; @@ -379,14 +379,18 @@ try_again: if (copied < ulen || peeking || (is_udplite && UDP_SKB_CB(skb)->partial_cov)) { - checksum_valid = !udp_lib_checksum_complete(skb); + checksum_valid = udp_skb_csum_unnecessary(skb) || + !__udp_lib_checksum_complete(skb); if (!checksum_valid) goto csum_copy_err; } - if (checksum_valid || skb_csum_unnecessary(skb)) - err = skb_copy_datagram_msg(skb, off, msg, copied); - else { + if (checksum_valid || udp_skb_csum_unnecessary(skb)) { + if (udp_skb_is_linear(skb)) + err = copy_linear_skb(skb, copied, off, &msg->msg_iter); + else + err = skb_copy_datagram_msg(skb, off, msg, copied); + } else { err = skb_copy_and_csum_datagram_msg(skb, off, msg); if (err == -EINVAL) goto csum_copy_err; |