Lines Matching refs:fc

77 	struct flow_cache *fc = (void *) arg;
81 per_cpu_ptr(fc->percpu, i)->hash_rnd_recalc = 1;
83 fc->rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
84 add_timer(&fc->rnd_timer);
130 static void __flow_cache_shrink(struct flow_cache *fc,
139 for (i = 0; i < flow_cache_hash_size(fc); i++) {
158 static void flow_cache_shrink(struct flow_cache *fc,
161 int shrink_to = fc->low_watermark / flow_cache_hash_size(fc);
163 __flow_cache_shrink(fc, fcp, shrink_to);
166 static void flow_new_hash_rnd(struct flow_cache *fc,
171 __flow_cache_shrink(fc, fcp, 0);
174 static u32 flow_hash_code(struct flow_cache *fc,
183 & (flow_cache_hash_size(fc) - 1);
211 struct flow_cache *fc = &flow_cache_global;
219 fcp = this_cpu_ptr(fc->percpu);
234 flow_new_hash_rnd(fc, fcp);
236 hash = flow_hash_code(fc, fcp, key, keysize);
248 if (fcp->hash_count > fc->high_watermark)
249 flow_cache_shrink(fc, fcp);
300 struct flow_cache *fc = info->cache;
307 fcp = this_cpu_ptr(fc->percpu);
308 for (i = 0; i < flow_cache_hash_size(fc); i++) {
332 static int flow_cache_percpu_empty(struct flow_cache *fc, int cpu)
337 fcp = per_cpu_ptr(fc->percpu, cpu);
338 for (i = 0; i < flow_cache_hash_size(fc); i++)
406 static int __cpuinit flow_cache_cpu_prepare(struct flow_cache *fc, int cpu)
408 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu);
409 size_t sz = sizeof(struct hlist_head) * flow_cache_hash_size(fc);
428 struct flow_cache *fc = container_of(nfb, struct flow_cache, hotcpu_notifier);
430 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, cpu);
435 res = flow_cache_cpu_prepare(fc, cpu);
441 __flow_cache_shrink(fc, fcp, 0);
447 static int __init flow_cache_init(struct flow_cache *fc)
451 fc->hash_shift = 10;
452 fc->low_watermark = 2 * flow_cache_hash_size(fc);
453 fc->high_watermark = 4 * flow_cache_hash_size(fc);
455 fc->percpu = alloc_percpu(struct flow_cache_percpu);
456 if (!fc->percpu)
460 if (flow_cache_cpu_prepare(fc, i))
463 fc->hotcpu_notifier = (struct notifier_block){
466 register_hotcpu_notifier(&fc->hotcpu_notifier);
468 setup_timer(&fc->rnd_timer, flow_cache_new_hashrnd,
469 (unsigned long) fc);
470 fc->rnd_timer.expires = jiffies + FLOW_HASH_RND_PERIOD;
471 add_timer(&fc->rnd_timer);
477 struct flow_cache_percpu *fcp = per_cpu_ptr(fc->percpu, i);
482 free_percpu(fc->percpu);
483 fc->percpu = NULL;