Lines Matching refs:fc

55 	struct flow_cache *fc = (void *) arg;  in flow_cache_new_hashrnd()  local
59 per_cpu_ptr(fc->percpu, i)->hash_rnd_recalc = 1; in flow_cache_new_hashrnd()
61 fc->rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD; in flow_cache_new_hashrnd()
62 add_timer(&fc->rnd_timer); in flow_cache_new_hashrnd()
112 static void __flow_cache_shrink(struct flow_cache *fc, in __flow_cache_shrink() argument
120 struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm, in __flow_cache_shrink()
123 for (i = 0; i < flow_cache_hash_size(fc); i++) { in __flow_cache_shrink()
142 static void flow_cache_shrink(struct flow_cache *fc, in flow_cache_shrink() argument
145 int shrink_to = fc->low_watermark / flow_cache_hash_size(fc); in flow_cache_shrink()
147 __flow_cache_shrink(fc, fcp, shrink_to); in flow_cache_shrink()
150 static void flow_new_hash_rnd(struct flow_cache *fc, in flow_new_hash_rnd() argument
155 __flow_cache_shrink(fc, fcp, 0); in flow_new_hash_rnd()
158 static u32 flow_hash_code(struct flow_cache *fc, in flow_hash_code() argument
167 & (flow_cache_hash_size(fc) - 1); in flow_hash_code()
195 struct flow_cache *fc = &net->xfrm.flow_cache_global; in flow_cache_lookup() local
203 fcp = this_cpu_ptr(fc->percpu); in flow_cache_lookup()
218 flow_new_hash_rnd(fc, fcp); in flow_cache_lookup()
220 hash = flow_hash_code(fc, fcp, key, keysize); in flow_cache_lookup()
232 if (fcp->hash_count > fc->high_watermark) in flow_cache_lookup()
233 flow_cache_shrink(fc, fcp); in flow_cache_lookup()
284 struct flow_cache *fc = info->cache; in flow_cache_flush_tasklet() local
290 struct netns_xfrm *xfrm = container_of(fc, struct netns_xfrm, in flow_cache_flush_tasklet()
293 fcp = this_cpu_ptr(fc->percpu); in flow_cache_flush_tasklet()
294 for (i = 0; i < flow_cache_hash_size(fc); i++) { in flow_cache_flush_tasklet()
318 static int flow_cache_percpu_empty(struct flow_cache *fc, int cpu) in flow_cache_percpu_empty() argument
323 fcp = per_cpu_ptr(fc->percpu, cpu); in flow_cache_percpu_empty()
324 for (i = 0; i < flow_cache_hash_size(fc); i++) in flow_cache_percpu_empty()
393 static int flow_cache_cpu_prepare(struct flow_cache *fc, int cpu) in flow_cache_cpu_prepare() argument
395 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu); in flow_cache_cpu_prepare()
396 size_t sz = sizeof(struct hlist_head) * flow_cache_hash_size(fc); in flow_cache_cpu_prepare()
415 struct flow_cache *fc = container_of(nfb, struct flow_cache, in flow_cache_cpu() local
418 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu); in flow_cache_cpu()
423 res = flow_cache_cpu_prepare(fc, cpu); in flow_cache_cpu()
429 __flow_cache_shrink(fc, fcp, 0); in flow_cache_cpu()
438 struct flow_cache *fc = &net->xfrm.flow_cache_global; in flow_cache_init() local
450 fc->hash_shift = 10; in flow_cache_init()
451 fc->low_watermark = 2 * flow_cache_hash_size(fc); in flow_cache_init()
452 fc->high_watermark = 4 * flow_cache_hash_size(fc); in flow_cache_init()
454 fc->percpu = alloc_percpu(struct flow_cache_percpu); in flow_cache_init()
455 if (!fc->percpu) in flow_cache_init()
461 if (flow_cache_cpu_prepare(fc, i)) in flow_cache_init()
464 fc->hotcpu_notifier = (struct notifier_block){ in flow_cache_init()
467 __register_hotcpu_notifier(&fc->hotcpu_notifier); in flow_cache_init()
471 setup_timer(&fc->rnd_timer, flow_cache_new_hashrnd, in flow_cache_init()
472 (unsigned long) fc); in flow_cache_init()
473 fc->rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD; in flow_cache_init()
474 add_timer(&fc->rnd_timer); in flow_cache_init()
480 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, i); in flow_cache_init()
487 free_percpu(fc->percpu); in flow_cache_init()
488 fc->percpu = NULL; in flow_cache_init()
497 struct flow_cache *fc = &net->xfrm.flow_cache_global; in flow_cache_fini() local
499 del_timer_sync(&fc->rnd_timer); in flow_cache_fini()
500 unregister_hotcpu_notifier(&fc->hotcpu_notifier); in flow_cache_fini()
503 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, i); in flow_cache_fini()
508 free_percpu(fc->percpu); in flow_cache_fini()
509 fc->percpu = NULL; in flow_cache_fini()