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>
This commit is contained in:
David S. Miller
2011-07-14 07:53:20 -07:00
parent 390fd0b388
commit f6b72b6217
9 changed files with 59 additions and 105 deletions

View File

@ -100,6 +100,7 @@ static int ip6_finish_output2(struct sk_buff *skb)
{
struct dst_entry *dst = skb_dst(skb);
struct net_device *dev = dst->dev;
struct neighbour *neigh;
skb->protocol = htons(ETH_P_IPV6);
skb->dev = dev;
@ -134,11 +135,14 @@ static int ip6_finish_output2(struct sk_buff *skb)
skb->len);
}
if (dst->hh)
return neigh_hh_output(dst->hh, skb);
else if (dst->neighbour)
return dst->neighbour->output(skb);
neigh = dst->neighbour;
if (neigh) {
struct hh_cache *hh = &neigh->hh;
if (hh->hh_len)
return neigh_hh_output(hh, skb);
else
return dst->neighbour->output(skb);
}
IP6_INC_STATS_BH(dev_net(dst->dev),
ip6_dst_idev(dst), IPSTATS_MIB_OUTNOROUTES);
kfree_skb(skb);