From patchwork Tue Oct 23 07:42:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 193387 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7EB872C0089 for ; Tue, 23 Oct 2012 18:42:56 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756674Ab2JWHmv (ORCPT ); Tue, 23 Oct 2012 03:42:51 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:39443 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753450Ab2JWHmv (ORCPT ); Tue, 23 Oct 2012 03:42:51 -0400 Received: by mail-bk0-f46.google.com with SMTP id jk13so1377431bkc.19 for ; Tue, 23 Oct 2012 00:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=X7+kVbI7LE0+wlLrPw2O5e43VEXh1Ffr3Oi/g6qgTjU=; b=dSUiDADclP4NIzEaUI6hG3DdXt5AErriP9qzcbQc2haT/hMtkQ2HaZDkg3t5vttCwo 59eFAAYR8XDTfYEkk3OrnL78IGYoQROoEEcFiMhu6oA+vb+LceRRDzuq5IheTWOzCs9m cDoMaruSXo59XDJ55RUNv3KxVYRDIdEQD7c/7h/Q/SaEzXOUonZZc0QV0GTu3Tlp7QZQ XNFsiKswo87Kp+Zf5T97J3hLBWD1xv300swOHuEG7jbuHk2YR0vX8YyfLBLv+XitBka0 zqfyzhYDbbDHmXNsewtbLuzazIAJcLrxyQUrGlT5viO2MyHDEN6ge/f4ePcP75tJT+E9 Aa2w== Received: by 10.204.148.21 with SMTP id n21mr3455364bkv.124.1350978170091; Tue, 23 Oct 2012 00:42:50 -0700 (PDT) Received: from [172.28.91.48] ([172.28.91.48]) by mx.google.com with ESMTPS id v14sm4808616bkv.10.2012.10.23.00.42.48 (version=SSLv3 cipher=OTHER); Tue, 23 Oct 2012 00:42:49 -0700 (PDT) Subject: [PATCH net-next] ipv4: tcp: clean up tcp_v4_early_demux() From: Eric Dumazet To: David Miller Cc: netdev , Neal Cardwell Date: Tue, 23 Oct 2012 09:42:47 +0200 Message-ID: <1350978167.8609.1545.camel@edumazet-glaptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Eric Dumazet 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 Cc: Neal Cardwell Acked-by: Neal Cardwell --- net/ipv4/tcp_ipv4.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);