Lines Matching refs:dst_cache
28 static void dst_cache_per_cpu_dst_set(struct dst_cache_pcpu *dst_cache, in dst_cache_per_cpu_dst_set() argument
32 dst_release(dst_cache->dst); in dst_cache_per_cpu_dst_set()
36 dst_cache->cookie = cookie; in dst_cache_per_cpu_dst_set()
37 dst_cache->dst = dst; in dst_cache_per_cpu_dst_set()
40 static struct dst_entry *dst_cache_per_cpu_get(struct dst_cache *dst_cache, in dst_cache_per_cpu_get() argument
54 READ_ONCE(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
71 if (!dst_cache->cache) in dst_cache_get()
74 local_lock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get()
75 dst = dst_cache_per_cpu_get(dst_cache, this_cpu_ptr(dst_cache->cache)); in dst_cache_get()
76 local_unlock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get()
81 struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr) in dst_cache_get_ip4() argument
86 if (!dst_cache->cache) in dst_cache_get_ip4()
89 local_lock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get_ip4()
90 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_get_ip4()
91 dst = dst_cache_per_cpu_get(dst_cache, idst); in dst_cache_get_ip4()
93 local_unlock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get_ip4()
98 local_unlock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get_ip4()
103 void dst_cache_set_ip4(struct dst_cache *dst_cache, struct dst_entry *dst, in dst_cache_set_ip4() argument
108 if (!dst_cache->cache) in dst_cache_set_ip4()
111 local_lock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_set_ip4()
112 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_set_ip4()
115 local_unlock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_set_ip4()
120 void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst, in dst_cache_set_ip6() argument
125 if (!dst_cache->cache) in dst_cache_set_ip6()
128 local_lock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_set_ip6()
130 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_set_ip6()
134 local_unlock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_set_ip6()
138 struct dst_entry *dst_cache_get_ip6(struct dst_cache *dst_cache, in dst_cache_get_ip6() argument
144 if (!dst_cache->cache) in dst_cache_get_ip6()
147 local_lock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get_ip6()
149 idst = this_cpu_ptr(dst_cache->cache); in dst_cache_get_ip6()
150 dst = dst_cache_per_cpu_get(dst_cache, idst); in dst_cache_get_ip6()
152 local_unlock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get_ip6()
157 local_unlock_nested_bh(&dst_cache->cache->bh_lock); in dst_cache_get_ip6()
163 int dst_cache_init(struct dst_cache *dst_cache, gfp_t gfp) in dst_cache_init() argument
167 dst_cache->cache = alloc_percpu_gfp(struct dst_cache_pcpu, in dst_cache_init()
169 if (!dst_cache->cache) in dst_cache_init()
172 local_lock_init(&per_cpu_ptr(dst_cache->cache, i)->bh_lock); in dst_cache_init()
174 dst_cache_reset(dst_cache); in dst_cache_init()
179 void dst_cache_destroy(struct dst_cache *dst_cache) in dst_cache_destroy() argument
183 if (!dst_cache->cache) in dst_cache_destroy()
187 dst_release(per_cpu_ptr(dst_cache->cache, i)->dst); in dst_cache_destroy()
189 free_percpu(dst_cache->cache); in dst_cache_destroy()
193 void dst_cache_reset_now(struct dst_cache *dst_cache) in dst_cache_reset_now() argument
197 if (!dst_cache->cache) in dst_cache_reset_now()
200 dst_cache_reset(dst_cache); in dst_cache_reset_now()
202 struct dst_cache_pcpu *idst = per_cpu_ptr(dst_cache->cache, i); in dst_cache_reset_now()