aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-06-03 00:09:10 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-03 23:01:52 -0400
commitfaa9dcf793beba05f7178b63a59eaa3ca5175b6a (patch)
tree0addd3f98e77ab34a8686eaf6855896efe2f9c4f /net/ipv4
parent4736022844fe694c4ee971fa2b6c1cb38dadbc78 (diff)
arp: RCU changes
Avoid two atomic ops in arp_fwd_proxy() Avoid two atomic ops in arp_process() Valid optims since arp_rcv() is run under rcu_read_lock() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/arp.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index f094b75810db..917d2d66162e 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -545,10 +545,10 @@ static inline int arp_fwd_proxy(struct in_device *in_dev,
545 545
546 /* place to check for proxy_arp for routes */ 546 /* place to check for proxy_arp for routes */
547 547
548 if ((out_dev = in_dev_get(rt->u.dst.dev)) != NULL) { 548 out_dev = __in_dev_get_rcu(rt->u.dst.dev);
549 if (out_dev)
549 omi = IN_DEV_MEDIUM_ID(out_dev); 550 omi = IN_DEV_MEDIUM_ID(out_dev);
550 in_dev_put(out_dev); 551
551 }
552 return (omi != imi && omi != -1); 552 return (omi != imi && omi != -1);
553} 553}
554 554
@@ -741,7 +741,7 @@ void arp_send(int type, int ptype, __be32 dest_ip,
741static int arp_process(struct sk_buff *skb) 741static int arp_process(struct sk_buff *skb)
742{ 742{
743 struct net_device *dev = skb->dev; 743 struct net_device *dev = skb->dev;
744 struct in_device *in_dev = in_dev_get(dev); 744 struct in_device *in_dev = __in_dev_get_rcu(dev);
745 struct arphdr *arp; 745 struct arphdr *arp;
746 unsigned char *arp_ptr; 746 unsigned char *arp_ptr;
747 struct rtable *rt; 747 struct rtable *rt;
@@ -890,7 +890,6 @@ static int arp_process(struct sk_buff *skb)
890 arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); 890 arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);
891 } else { 891 } else {
892 pneigh_enqueue(&arp_tbl, in_dev->arp_parms, skb); 892 pneigh_enqueue(&arp_tbl, in_dev->arp_parms, skb);
893 in_dev_put(in_dev);
894 return 0; 893 return 0;
895 } 894 }
896 goto out; 895 goto out;
@@ -936,8 +935,6 @@ static int arp_process(struct sk_buff *skb)
936 } 935 }
937 936
938out: 937out:
939 if (in_dev)
940 in_dev_put(in_dev);
941 consume_skb(skb); 938 consume_skb(skb);
942 return 0; 939 return 0;
943} 940}