aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2013-07-15 23:03:19 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-16 15:59:28 -0400
commit21d1196a35f5686c4323e42a62fdb4b23b0ab4a3 (patch)
tree559c3cf32d2da124090fd6d256948d0d59eeb7e0 /net/ipv4
parent9a0f06fee1f453370e87b6568dc1d39d676f53fc (diff)
ipv4: set transport header earlier
commit 45f00f99d6e ("ipv4: tcp: clean up tcp_v4_early_demux()") added a performance regression for non GRO traffic, basically disabling IP early demux. IPv6 stack resets transport header in ip6_rcv() before calling IP early demux in ip6_rcv_finish(), while IPv4 does this only in ip_local_deliver_finish(), _after_ IP early demux. GRO traffic happened to enable IP early demux because transport header is also set in inet_gro_receive() Instead of reverting the faulty commit, we can make IPv4/IPv6 behave the same : transport_header should be set in ip_rcv() instead of ip_local_deliver_finish() ip_local_deliver_finish() can also use skb_network_header_len() which is faster than ip_hdrlen() Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Neal Cardwell <ncardwell@google.com> Cc: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_input.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 3da817b89e9b..15e3e683adec 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -190,10 +190,7 @@ static int ip_local_deliver_finish(struct sk_buff *skb)
190{ 190{
191 struct net *net = dev_net(skb->dev); 191 struct net *net = dev_net(skb->dev);
192 192
193 __skb_pull(skb, ip_hdrlen(skb)); 193 __skb_pull(skb, skb_network_header_len(skb));
194
195 /* Point into the IP datagram, just past the header. */
196 skb_reset_transport_header(skb);
197 194
198 rcu_read_lock(); 195 rcu_read_lock();
199 { 196 {
@@ -437,6 +434,8 @@ int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
437 goto drop; 434 goto drop;
438 } 435 }
439 436
437 skb->transport_header = skb->network_header + iph->ihl*4;
438
440 /* Remove any debris in the socket control block */ 439 /* Remove any debris in the socket control block */
441 memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); 440 memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
442 441