[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200910192134.02125.schmto@hrz.tu-chemnitz.de>
Date: Mon, 19 Oct 2009 21:34:02 +0200
From: Torsten Schmidt <torsten.schmidt@...06.tu-chemnitz.de>
To: "David S. Miller" <davem@...emloft.net>
Cc: Linux Netdev List <netdev@...r.kernel.org>
Subject: [PATCH] IPv4: skip loopback checksums in ip_rcv()
Skip loopback checksum in ip_rcv() for speed optimisation.
Signed-off-by: Torsten Schmidt <schmto@....tu-chemnitz.de>
---
net/ipv4/ip_input.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 6c98b43..dc72286 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -406,7 +406,7 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
*
* 1. Length at least the size of an ip header
* 2. Version of 4
- * 3. Checksums correctly. [Speed optimisation for later, skip loopback checksums]
+ * 3. Checksums correctly. [Speed optimisation: skip loopback checksums]
* 4. Doesn't have a bogus length
*/
@@ -418,8 +418,9 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
iph = ip_hdr(skb);
- if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
- goto inhdr_error;
+ if (!ipv4_is_loopback(iph->daddr))
+ if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
+ goto inhdr_error;
len = ntohs(iph->tot_len);
if (skb->len < len) {
--
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists