Lines Matching refs:dst_cache
31 static void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache, in dst_cache_per_cpu_dst_set() argument
34 dst_release(dst_cache->dst); in dst_cache_per_cpu_dst_set()
38 dst_cache->cookie = cookie; in dst_cache_per_cpu_dst_set()
39 dst_cache->dst = dst; in dst_cache_per_cpu_dst_set()
42 static struct dst_entry *dst_cache_per_cpu_get(struct dst_cache *dst_cache, in dst_cache_per_cpu_get() argument
54 if (unlikely(!time_after(idst->refresh_ts, dst_cache->reset_ts) || in dst_cache_per_cpu_get()
67 struct dst_entry *dst_cache_get(struct dst_cache *dst_cache) in dst_cache_get() argument
69 if (!dst_cache->cache) in dst_cache_get()
72 return dst_cache_per_cpu_get(dst_cache, this_cpu_ptr(dst_cache->cache)); in dst_cache_get()
76 struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr) in dst_cache_get_ip4() argument
81 if (!dst_cache->cache) in dst_cache_get_ip4()
84 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_get_ip4()
85 dst = dst_cache_per_cpu_get(dst_cache, idst); in dst_cache_get_ip4()
94 void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst, in dst_cache_set_ip4() argument
99 if (!dst_cache->cache) in dst_cache_set_ip4()
102 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_set_ip4()
109 void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst, in dst_cache_set_ip6() argument
114 if (!dst_cache->cache) in dst_cache_set_ip6()
117 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_set_ip6()
118 dst_cache_per_cpu_dst_set(this_cpu_ptr(dst_cache->cache), dst, in dst_cache_set_ip6()
124 struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache, in dst_cache_get_ip6() argument
130 if (!dst_cache->cache) in dst_cache_get_ip6()
133 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_get_ip6()
134 dst = dst_cache_per_cpu_get(dst_cache, idst); in dst_cache_get_ip6()
144 int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp) in dst_cache_init() argument
146 dst_cache->cache = alloc_percpu_gfp(struct dst_cache_pcpu, in dst_cache_init()
148 if (!dst_cache->cache) in dst_cache_init()
151 dst_cache_reset(dst_cache); in dst_cache_init()
156 void dst_cache_destroy(struct dst_cache *dst_cache) in dst_cache_destroy() argument
160 if (!dst_cache->cache) in dst_cache_destroy()
164 dst_release(per_cpu_ptr(dst_cache->cache, i)->dst); in dst_cache_destroy()
166 free_percpu(dst_cache->cache); in dst_cache_destroy()