From patchwork Mon May 10 21:33:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 52237 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 56956B7D70 for ; Tue, 11 May 2010 07:33:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756197Ab0EJVdO (ORCPT ); Mon, 10 May 2010 17:33:14 -0400 Received: from mail-ww0-f46.google.com ([74.125.82.46]:35213 "EHLO mail-ww0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756016Ab0EJVdJ (ORCPT ); Mon, 10 May 2010 17:33:09 -0400 Received: by wwa36 with SMTP id 36so1964635wwa.19 for ; Mon, 10 May 2010 14:33:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=TJe55wJe0k37bLCHkyenQ/tUUI5azNDLnropGxYFxSA=; b=M44LXf45Tst5udW2n4LRU2zCOwuIIXXttHojwqZfKuZB7GMoxk5iI5z5ycdzCrxIL0 ZTZxP45TCbMdapFMltZARa1K4wik0j+SeUZLdV3ffxrT0uf//iMV3Zj+DGsgaryb3VxW Itsjcotu21dOjHus57faOtxCXv/mBYvKFkEp0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=J5wgnppY2EEBuz8PxEpaLPkvM2lmeYAMusqrGDVFp0BhKR7nQPUIqFnMZkiI+MKWzt BUJOUMNI/r2LIJxeCUCOkyBIcAm5WI2gfytBcz6C0dBq9j2ikzPosNNMV43YHytREZj0 MwNOj0ZiTYvTVMqki7h2lh6n+XofykQfFl8/U= Received: by 10.216.87.135 with SMTP id y7mr2898015wee.10.1273527188023; Mon, 10 May 2010 14:33:08 -0700 (PDT) Received: from [127.0.0.1] (gw1.cosmosbay.com [212.99.114.194]) by mx.google.com with ESMTPS id d75sm1888117wek.20.2010.05.10.14.33.07 (version=SSLv3 cipher=RC4-MD5); Mon, 10 May 2010 14:33:07 -0700 (PDT) Subject: [PATCH V4 3/4] net: Use ip_route_input_noref() in input path From: Eric Dumazet To: David Miller Cc: netdev Date: Mon, 10 May 2010 23:33:06 +0200 Message-ID: <1273527186.10889.12.camel@edumazet-laptop> 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 Use ip_route_input_noref() in ip fast path, to avoid two atomic ops per incoming packet. Note: loopback is excluded from this optimization in ip_rcv_finish() Signed-off-by: Eric Dumazet --- net/ipv4/arp.c | 2 +- net/ipv4/ip_input.c | 4 ++-- net/ipv4/xfrm4_input.c | 4 ++-- 3 files changed, 5 insertions(+), 5 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/arp.c b/net/ipv4/arp.c index 6e74706..f4ae3d4 100644 --- a/net/ipv4/arp.c +++ b/net/ipv4/arp.c @@ -854,7 +854,7 @@ static int arp_process(struct sk_buff *skb) } if (arp->ar_op == htons(ARPOP_REQUEST) && - ip_route_input(skb, tip, sip, 0, dev) == 0) { + ip_route_input_noref(skb, tip, sip, 0, dev) == 0) { rt = skb_rtable(skb); addr_type = rt->rt_type; diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index f8ab7a3..6d5b65a 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -331,8 +331,8 @@ static int ip_rcv_finish(struct sk_buff *skb) * how the packet travels inside Linux networking. */ if (skb_dst(skb) == NULL) { - int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, - skb->dev); + int err = ip_route_input_noref(skb, iph->daddr, iph->saddr, + iph->tos, skb->dev); if (unlikely(err)) { if (err == -EHOSTUNREACH) IP_INC_STATS_BH(dev_net(skb->dev), diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c index c791bb6..e7972d8 100644 --- a/net/ipv4/xfrm4_input.c +++ b/net/ipv4/xfrm4_input.c @@ -27,8 +27,8 @@ static inline int xfrm4_rcv_encap_finish(struct sk_buff *skb) if (skb_dst(skb) == NULL) { const struct iphdr *iph = ip_hdr(skb); - if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, - skb->dev)) + if (ip_route_input_noref(skb, iph->daddr, iph->saddr, + iph->tos, skb->dev)) goto drop; } return dst_input(skb);