Commit 4a94445c9a5cf5461fb41d80040033b9a8e2a85a

Authored by Eric Dumazet
Committed by David S. Miller
1 parent 407eadd996

net: Use ip_route_input_noref() in input path

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 <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 3 changed files with 5 additions and 5 deletions Side-by-side Diff

... ... @@ -854,7 +854,7 @@
854 854 }
855 855  
856 856 if (arp->ar_op == htons(ARPOP_REQUEST) &&
857   - ip_route_input(skb, tip, sip, 0, dev) == 0) {
  857 + ip_route_input_noref(skb, tip, sip, 0, dev) == 0) {
858 858  
859 859 rt = skb_rtable(skb);
860 860 addr_type = rt->rt_type;
... ... @@ -331,8 +331,8 @@
331 331 * how the packet travels inside Linux networking.
332 332 */
333 333 if (skb_dst(skb) == NULL) {
334   - int err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos,
335   - skb->dev);
  334 + int err = ip_route_input_noref(skb, iph->daddr, iph->saddr,
  335 + iph->tos, skb->dev);
336 336 if (unlikely(err)) {
337 337 if (err == -EHOSTUNREACH)
338 338 IP_INC_STATS_BH(dev_net(skb->dev),
net/ipv4/xfrm4_input.c
... ... @@ -27,8 +27,8 @@
27 27 if (skb_dst(skb) == NULL) {
28 28 const struct iphdr *iph = ip_hdr(skb);
29 29  
30   - if (ip_route_input(skb, iph->daddr, iph->saddr, iph->tos,
31   - skb->dev))
  30 + if (ip_route_input_noref(skb, iph->daddr, iph->saddr,
  31 + iph->tos, skb->dev))
32 32 goto drop;
33 33 }
34 34 return dst_input(skb);