diff options
author | David S. Miller <davem@davemloft.net> | 2011-07-14 10:53:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-14 10:53:20 -0400 |
commit | f6b72b6217f8c24f2a54988e58af858b4e66024d (patch) | |
tree | c59d5adcf9bb226db6f602c5078106052524cfea /net/ipv6/ip6_output.c | |
parent | 390fd0b388e4f85549e5d60bdeb21364b344d9b9 (diff) |
net: Embed hh_cache inside of struct neighbour.
Now that there is a one-to-one correspondance between neighbour
and hh_cache entries, we no longer need:
1) dynamic allocation
2) attachment to dst->hh
3) refcounting
Initialization of the hh_cache entry is indicated by hh_len
being non-zero, and such initialization is always done with
the neighbour's lock held as a writer.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ip6_output.c')
-rw-r--r-- | net/ipv6/ip6_output.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index 9d4b165837d6..f0f144cac0bd 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -100,6 +100,7 @@ static int ip6_finish_output2(struct sk_buff *skb) | |||
100 | { | 100 | { |
101 | struct dst_entry *dst = skb_dst(skb); | 101 | struct dst_entry *dst = skb_dst(skb); |
102 | struct net_device *dev = dst->dev; | 102 | struct net_device *dev = dst->dev; |
103 | struct neighbour *neigh; | ||
103 | 104 | ||
104 | skb->protocol = htons(ETH_P_IPV6); | 105 | skb->protocol = htons(ETH_P_IPV6); |
105 | skb->dev = dev; | 106 | skb->dev = dev; |
@@ -134,11 +135,14 @@ static int ip6_finish_output2(struct sk_buff *skb) | |||
134 | skb->len); | 135 | skb->len); |
135 | } | 136 | } |
136 | 137 | ||
137 | if (dst->hh) | 138 | neigh = dst->neighbour; |
138 | return neigh_hh_output(dst->hh, skb); | 139 | if (neigh) { |
139 | else if (dst->neighbour) | 140 | struct hh_cache *hh = &neigh->hh; |
140 | return dst->neighbour->output(skb); | 141 | if (hh->hh_len) |
141 | 142 | return neigh_hh_output(hh, skb); | |
143 | else | ||
144 | return dst->neighbour->output(skb); | ||
145 | } | ||
142 | IP6_INC_STATS_BH(dev_net(dst->dev), | 146 | IP6_INC_STATS_BH(dev_net(dst->dev), |
143 | ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); | 147 | ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES); |
144 | kfree_skb(skb); | 148 | kfree_skb(skb); |