All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ipv4: tcp: clean up tcp_v4_early_demux()
@ 2012-10-23  7:42 Eric Dumazet
  2012-10-23 12:59 ` Neal Cardwell
  2012-10-23 17:04 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2012-10-23  7:42 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Neal Cardwell

From: Eric Dumazet <edumazet@google.com>

Use same header helpers than tcp_v6_early_demux() because they
are a bit faster, and as they make IPv4/IPv6 versions look
the same.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/tcp_ipv4.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index ef998b0..694ea4c 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1918,7 +1918,6 @@ EXPORT_SYMBOL(tcp_v4_do_rcv);
 
 void tcp_v4_early_demux(struct sk_buff *skb)
 {
-	struct net *net = dev_net(skb->dev);
 	const struct iphdr *iph;
 	const struct tcphdr *th;
 	struct sock *sk;
@@ -1926,16 +1925,16 @@ void tcp_v4_early_demux(struct sk_buff *skb)
 	if (skb->pkt_type != PACKET_HOST)
 		return;
 
-	if (!pskb_may_pull(skb, ip_hdrlen(skb) + sizeof(struct tcphdr)))
+	if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr)))
 		return;
 
 	iph = ip_hdr(skb);
-	th = (struct tcphdr *) ((char *)iph + ip_hdrlen(skb));
+	th = tcp_hdr(skb);
 
 	if (th->doff < sizeof(struct tcphdr) / 4)
 		return;
 
-	sk = __inet_lookup_established(net, &tcp_hashinfo,
+	sk = __inet_lookup_established(dev_net(skb->dev), &tcp_hashinfo,
 				       iph->saddr, th->source,
 				       iph->daddr, ntohs(th->dest),
 				       skb->skb_iif);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ipv4: tcp: clean up tcp_v4_early_demux()
  2012-10-23  7:42 [PATCH net-next] ipv4: tcp: clean up tcp_v4_early_demux() Eric Dumazet
@ 2012-10-23 12:59 ` Neal Cardwell
  2012-10-23 17:04 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2012-10-23 12:59 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev

On Tue, Oct 23, 2012 at 3:42 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Use same header helpers than tcp_v6_early_demux() because they
> are a bit faster, and as they make IPv4/IPv6 versions look
> the same.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Neal Cardwell <ncardwell@google.com>
> ---

Acked-by: Neal Cardwell <ncardwell@google.com>

Thanks, Eric!

neal

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] ipv4: tcp: clean up tcp_v4_early_demux()
  2012-10-23  7:42 [PATCH net-next] ipv4: tcp: clean up tcp_v4_early_demux() Eric Dumazet
  2012-10-23 12:59 ` Neal Cardwell
@ 2012-10-23 17:04 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2012-10-23 17:04 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, ncardwell

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 23 Oct 2012 09:42:47 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> Use same header helpers than tcp_v6_early_demux() because they
> are a bit faster, and as they make IPv4/IPv6 versions look
> the same.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-23 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-23  7:42 [PATCH net-next] ipv4: tcp: clean up tcp_v4_early_demux() Eric Dumazet
2012-10-23 12:59 ` Neal Cardwell
2012-10-23 17:04 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.