Commit faa9dcf7 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 47360228
...@@ -545,10 +545,10 @@ static inline int arp_fwd_proxy(struct in_device *in_dev, ...@@ -545,10 +545,10 @@ static inline int arp_fwd_proxy(struct in_device *in_dev,
/* place to check for proxy_arp for routes */ /* place to check for proxy_arp for routes */
if ((out_dev = in_dev_get(rt->u.dst.dev)) != NULL) { out_dev = __in_dev_get_rcu(rt->u.dst.dev);
if (out_dev)
omi = IN_DEV_MEDIUM_ID(out_dev); omi = IN_DEV_MEDIUM_ID(out_dev);
in_dev_put(out_dev);
}
return (omi != imi && omi != -1); return (omi != imi && omi != -1);
} }
...@@ -741,7 +741,7 @@ void arp_send(int type, int ptype, __be32 dest_ip, ...@@ -741,7 +741,7 @@ void arp_send(int type, int ptype, __be32 dest_ip,
static int arp_process(struct sk_buff *skb) static int arp_process(struct sk_buff *skb)
{ {
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct in_device *in_dev = in_dev_get(dev); struct in_device *in_dev = __in_dev_get_rcu(dev);
struct arphdr *arp; struct arphdr *arp;
unsigned char *arp_ptr; unsigned char *arp_ptr;
struct rtable *rt; struct rtable *rt;
...@@ -890,7 +890,6 @@ static int arp_process(struct sk_buff *skb) ...@@ -890,7 +890,6 @@ static int arp_process(struct sk_buff *skb)
arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha);
} else { } else {
pneigh_enqueue(&arp_tbl, in_dev->arp_parms, skb); pneigh_enqueue(&arp_tbl, in_dev->arp_parms, skb);
in_dev_put(in_dev);
return 0; return 0;
} }
goto out; goto out;
...@@ -936,8 +935,6 @@ static int arp_process(struct sk_buff *skb) ...@@ -936,8 +935,6 @@ static int arp_process(struct sk_buff *skb)
} }
out: out:
if (in_dev)
in_dev_put(in_dev);
consume_skb(skb); consume_skb(skb);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment