Commit f230d1e8 authored by Martin KaFai Lau's avatar Martin KaFai Lau Committed by David S. Miller

ipv6: Rename the dst_cache helper functions in ip6_tunnel

It is a prep work to fix the dst_entry refcnt bugs in
ip6_tunnel.

This patch rename:
1. ip6_tnl_dst_check() to ip6_tnl_dst_get() to better
   reflect that it will take a dst refcnt in the next patch.
2. ip6_tnl_dst_store() to ip6_tnl_dst_set() to have a more
   conventional name matching with ip6_tnl_dst_get().
Signed-off-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a3c119d3
...@@ -60,9 +60,9 @@ struct ipv6_tlv_tnl_enc_lim { ...@@ -60,9 +60,9 @@ struct ipv6_tlv_tnl_enc_lim {
__u8 encap_limit; /* tunnel encapsulation limit */ __u8 encap_limit; /* tunnel encapsulation limit */
} __packed; } __packed;
struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t); struct dst_entry *ip6_tnl_dst_get(struct ip6_tnl *t);
void ip6_tnl_dst_reset(struct ip6_tnl *t); void ip6_tnl_dst_reset(struct ip6_tnl *t);
void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst); void ip6_tnl_dst_set(struct ip6_tnl *t, struct dst_entry *dst);
int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, int ip6_tnl_rcv_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
const struct in6_addr *raddr); const struct in6_addr *raddr);
int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr, int ip6_tnl_xmit_ctl(struct ip6_tnl *t, const struct in6_addr *laddr,
......
...@@ -634,7 +634,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, ...@@ -634,7 +634,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
} }
if (!fl6->flowi6_mark) if (!fl6->flowi6_mark)
dst = ip6_tnl_dst_check(tunnel); dst = ip6_tnl_dst_get(tunnel);
if (!dst) { if (!dst) {
ndst = ip6_route_output(net, NULL, fl6); ndst = ip6_route_output(net, NULL, fl6);
...@@ -763,7 +763,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb, ...@@ -763,7 +763,7 @@ static netdev_tx_t ip6gre_xmit2(struct sk_buff *skb,
ip6tunnel_xmit(NULL, skb, dev); ip6tunnel_xmit(NULL, skb, dev);
if (ndst) if (ndst)
ip6_tnl_dst_store(tunnel, ndst); ip6_tnl_dst_set(tunnel, ndst);
return 0; return 0;
tx_err_link_failure: tx_err_link_failure:
stats->tx_carrier_errors++; stats->tx_carrier_errors++;
......
...@@ -126,7 +126,7 @@ static struct net_device_stats *ip6_get_stats(struct net_device *dev) ...@@ -126,7 +126,7 @@ static struct net_device_stats *ip6_get_stats(struct net_device *dev)
* Locking : hash tables are protected by RCU and RTNL * Locking : hash tables are protected by RCU and RTNL
*/ */
struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t) struct dst_entry *ip6_tnl_dst_get(struct ip6_tnl *t)
{ {
struct dst_entry *dst = t->dst_cache; struct dst_entry *dst = t->dst_cache;
...@@ -139,7 +139,7 @@ struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t) ...@@ -139,7 +139,7 @@ struct dst_entry *ip6_tnl_dst_check(struct ip6_tnl *t)
return dst; return dst;
} }
EXPORT_SYMBOL_GPL(ip6_tnl_dst_check); EXPORT_SYMBOL_GPL(ip6_tnl_dst_get);
void ip6_tnl_dst_reset(struct ip6_tnl *t) void ip6_tnl_dst_reset(struct ip6_tnl *t)
{ {
...@@ -148,14 +148,14 @@ void ip6_tnl_dst_reset(struct ip6_tnl *t) ...@@ -148,14 +148,14 @@ void ip6_tnl_dst_reset(struct ip6_tnl *t)
} }
EXPORT_SYMBOL_GPL(ip6_tnl_dst_reset); EXPORT_SYMBOL_GPL(ip6_tnl_dst_reset);
void ip6_tnl_dst_store(struct ip6_tnl *t, struct dst_entry *dst) void ip6_tnl_dst_set(struct ip6_tnl *t, struct dst_entry *dst)
{ {
struct rt6_info *rt = (struct rt6_info *) dst; struct rt6_info *rt = (struct rt6_info *) dst;
t->dst_cookie = rt6_get_cookie(rt); t->dst_cookie = rt6_get_cookie(rt);
dst_release(t->dst_cache); dst_release(t->dst_cache);
t->dst_cache = dst; t->dst_cache = dst;
} }
EXPORT_SYMBOL_GPL(ip6_tnl_dst_store); EXPORT_SYMBOL_GPL(ip6_tnl_dst_set);
/** /**
* ip6_tnl_lookup - fetch tunnel matching the end-point addresses * ip6_tnl_lookup - fetch tunnel matching the end-point addresses
...@@ -1010,7 +1010,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ...@@ -1010,7 +1010,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr)); memcpy(&fl6->daddr, addr6, sizeof(fl6->daddr));
neigh_release(neigh); neigh_release(neigh);
} else if (!fl6->flowi6_mark) } else if (!fl6->flowi6_mark)
dst = ip6_tnl_dst_check(t); dst = ip6_tnl_dst_get(t);
if (!ip6_tnl_xmit_ctl(t, &fl6->saddr, &fl6->daddr)) if (!ip6_tnl_xmit_ctl(t, &fl6->saddr, &fl6->daddr))
goto tx_err_link_failure; goto tx_err_link_failure;
...@@ -1102,7 +1102,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb, ...@@ -1102,7 +1102,7 @@ static int ip6_tnl_xmit2(struct sk_buff *skb,
ipv6h->daddr = fl6->daddr; ipv6h->daddr = fl6->daddr;
ip6tunnel_xmit(NULL, skb, dev); ip6tunnel_xmit(NULL, skb, dev);
if (ndst) if (ndst)
ip6_tnl_dst_store(t, ndst); ip6_tnl_dst_set(t, ndst);
return 0; return 0;
tx_err_link_failure: tx_err_link_failure:
stats->tx_carrier_errors++; stats->tx_carrier_errors++;
......
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