• Home
  • Raw
  • Download

Lines Matching refs:f

56 inet_frag_hashfn(const struct inet_frags *f, const struct inet_frag_queue *q)  in inet_frag_hashfn()  argument
58 return f->hashfn(q) & (INETFRAGS_HASHSZ - 1); in inet_frag_hashfn()
61 static bool inet_frag_may_rebuild(struct inet_frags *f) in inet_frag_may_rebuild() argument
64 f->last_rebuild_jiffies + INETFRAGS_MIN_REBUILD_INTERVAL); in inet_frag_may_rebuild()
67 static void inet_frag_secret_rebuild(struct inet_frags *f) in inet_frag_secret_rebuild() argument
71 write_seqlock_bh(&f->rnd_seqlock); in inet_frag_secret_rebuild()
73 if (!inet_frag_may_rebuild(f)) in inet_frag_secret_rebuild()
76 get_random_bytes(&f->rnd, sizeof(u32)); in inet_frag_secret_rebuild()
83 hb = &f->hash[i]; in inet_frag_secret_rebuild()
87 unsigned int hval = inet_frag_hashfn(f, q); in inet_frag_secret_rebuild()
95 hb_dest = &f->hash[hval]; in inet_frag_secret_rebuild()
114 f->rebuild = false; in inet_frag_secret_rebuild()
115 f->last_rebuild_jiffies = jiffies; in inet_frag_secret_rebuild()
117 write_sequnlock_bh(&f->rnd_seqlock); in inet_frag_secret_rebuild()
130 inet_evict_bucket(struct inet_frags *f, struct inet_frag_bucket *hb) in inet_evict_bucket() argument
153 f->frag_expire((unsigned long) fq); in inet_evict_bucket()
162 struct inet_frags *f; in inet_frag_worker() local
164 f = container_of(work, struct inet_frags, frags_work); in inet_frag_worker()
170 for (i = ACCESS_ONCE(f->next_bucket); budget; --budget) { in inet_frag_worker()
171 evicted += inet_evict_bucket(f, &f->hash[i]); in inet_frag_worker()
177 f->next_bucket = i; in inet_frag_worker()
181 if (f->rebuild && inet_frag_may_rebuild(f)) in inet_frag_worker()
182 inet_frag_secret_rebuild(f); in inet_frag_worker()
185 static void inet_frag_schedule_worker(struct inet_frags *f) in inet_frag_schedule_worker() argument
187 if (unlikely(!work_pending(&f->frags_work))) in inet_frag_schedule_worker()
188 schedule_work(&f->frags_work); in inet_frag_schedule_worker()
191 int inet_frags_init(struct inet_frags *f) in inet_frags_init() argument
195 INIT_WORK(&f->frags_work, inet_frag_worker); in inet_frags_init()
198 struct inet_frag_bucket *hb = &f->hash[i]; in inet_frags_init()
204 seqlock_init(&f->rnd_seqlock); in inet_frags_init()
205 f->last_rebuild_jiffies = 0; in inet_frags_init()
206 f->frags_cachep = kmem_cache_create(f->frags_cache_name, f->qsize, 0, 0, in inet_frags_init()
208 if (!f->frags_cachep) in inet_frags_init()
215 void inet_frags_fini(struct inet_frags *f) in inet_frags_fini() argument
217 cancel_work_sync(&f->frags_work); in inet_frags_fini()
218 kmem_cache_destroy(f->frags_cachep); in inet_frags_fini()
222 void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f) in inet_frags_exit_net() argument
231 seq = read_seqbegin(&f->rnd_seqlock); in inet_frags_exit_net()
234 inet_evict_bucket(f, &f->hash[i]); in inet_frags_exit_net()
239 if (read_seqretry(&f->rnd_seqlock, seq) || in inet_frags_exit_net()
246 get_frag_bucket_locked(struct inet_frag_queue *fq, struct inet_frags *f) in get_frag_bucket_locked() argument
253 seq = read_seqbegin(&f->rnd_seqlock); in get_frag_bucket_locked()
255 hash = inet_frag_hashfn(f, fq); in get_frag_bucket_locked()
256 hb = &f->hash[hash]; in get_frag_bucket_locked()
259 if (read_seqretry(&f->rnd_seqlock, seq)) { in get_frag_bucket_locked()
267 static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) in fq_unlink() argument
271 hb = get_frag_bucket_locked(fq, f); in fq_unlink()
277 void inet_frag_kill(struct inet_frag_queue *fq, struct inet_frags *f) in inet_frag_kill() argument
283 fq_unlink(fq, f); in inet_frag_kill()
289 void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f) in inet_frag_destroy() argument
308 sum = sum_truesize + f->qsize; in inet_frag_destroy()
310 if (f->destructor) in inet_frag_destroy()
311 f->destructor(q); in inet_frag_destroy()
312 kmem_cache_free(f->frags_cachep, q); in inet_frag_destroy()
320 struct inet_frags *f, in inet_frag_intern() argument
323 struct inet_frag_bucket *hb = get_frag_bucket_locked(qp_in, f); in inet_frag_intern()
332 if (qp->net == nf && f->match(qp, arg)) { in inet_frag_intern()
336 inet_frag_put(qp_in, f); in inet_frag_intern()
354 struct inet_frags *f, in inet_frag_alloc() argument
360 inet_frag_schedule_worker(f); in inet_frag_alloc()
364 q = kmem_cache_zalloc(f->frags_cachep, GFP_ATOMIC); in inet_frag_alloc()
369 f->constructor(q, arg); in inet_frag_alloc()
370 add_frag_mem_limit(nf, f->qsize); in inet_frag_alloc()
372 setup_timer(&q->timer, f->frag_expire, (unsigned long)q); in inet_frag_alloc()
380 struct inet_frags *f, in inet_frag_create() argument
385 q = inet_frag_alloc(nf, f, arg); in inet_frag_create()
389 return inet_frag_intern(nf, q, f, arg); in inet_frag_create()
393 struct inet_frags *f, void *key, in inet_frag_find() argument
401 inet_frag_schedule_worker(f); in inet_frag_find()
404 hb = &f->hash[hash]; in inet_frag_find()
408 if (q->net == nf && f->match(q, key)) { in inet_frag_find()
418 return inet_frag_create(nf, f, key); in inet_frag_find()
420 if (inet_frag_may_rebuild(f)) { in inet_frag_find()
421 if (!f->rebuild) in inet_frag_find()
422 f->rebuild = true; in inet_frag_find()
423 inet_frag_schedule_worker(f); in inet_frag_find()