inet_fragment.c (169310f71fc820fe153ec04c6a111e444a68d6d5) | inet_fragment.c (093ba72914b696521e4885756a68a3332782c8de) |
---|---|
1/* 2 * inet fragments management 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 * --- 205 unchanged lines hidden (view full) --- 214 215void inet_frags_fini(struct inet_frags *f) 216{ 217 cancel_work_sync(&f->frags_work); 218 kmem_cache_destroy(f->frags_cachep); 219} 220EXPORT_SYMBOL(inet_frags_fini); 221 | 1/* 2 * inet fragments management 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 * --- 205 unchanged lines hidden (view full) --- 214 215void inet_frags_fini(struct inet_frags *f) 216{ 217 cancel_work_sync(&f->frags_work); 218 kmem_cache_destroy(f->frags_cachep); 219} 220EXPORT_SYMBOL(inet_frags_fini); 221 |
222void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f) | 222void inet_frags_exit_net(struct netns_frags *nf) |
223{ | 223{ |
224 struct inet_frags *f =nf->f; |
|
224 unsigned int seq; 225 int i; 226 227 nf->low_thresh = 0; 228 229evict_again: 230 local_bh_disable(); 231 seq = read_seqbegin(&f->rnd_seqlock); --- 27 unchanged lines hidden (view full) --- 259 if (read_seqretry(&f->rnd_seqlock, seq)) { 260 spin_unlock(&hb->chain_lock); 261 goto restart; 262 } 263 264 return hb; 265} 266 | 225 unsigned int seq; 226 int i; 227 228 nf->low_thresh = 0; 229 230evict_again: 231 local_bh_disable(); 232 seq = read_seqbegin(&f->rnd_seqlock); --- 27 unchanged lines hidden (view full) --- 260 if (read_seqretry(&f->rnd_seqlock, seq)) { 261 spin_unlock(&hb->chain_lock); 262 goto restart; 263 } 264 265 return hb; 266} 267 |
267static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) | 268static inline void fq_unlink(struct inet_frag_queue *fq) |
268{ 269 struct inet_frag_bucket *hb; 270 | 269{ 270 struct inet_frag_bucket *hb; 271 |
271 hb = get_frag_bucket_locked(fq, f); | 272 hb = get_frag_bucket_locked(fq, fq->net->f); |
272 hlist_del(&fq->list); 273 fq->flags |= INET_FRAG_COMPLETE; 274 spin_unlock(&hb->chain_lock); 275} 276 | 273 hlist_del(&fq->list); 274 fq->flags |= INET_FRAG_COMPLETE; 275 spin_unlock(&hb->chain_lock); 276} 277 |
277void inet_frag_kill(struct inet_frag_queue *fq, struct inet_frags *f) | 278void inet_frag_kill(struct inet_frag_queue *fq) |
278{ 279 if (del_timer(&fq->timer)) 280 refcount_dec(&fq->refcnt); 281 282 if (!(fq->flags & INET_FRAG_COMPLETE)) { | 279{ 280 if (del_timer(&fq->timer)) 281 refcount_dec(&fq->refcnt); 282 283 if (!(fq->flags & INET_FRAG_COMPLETE)) { |
283 fq_unlink(fq, f); | 284 fq_unlink(fq); |
284 refcount_dec(&fq->refcnt); 285 } 286} 287EXPORT_SYMBOL(inet_frag_kill); 288 | 285 refcount_dec(&fq->refcnt); 286 } 287} 288EXPORT_SYMBOL(inet_frag_kill); 289 |
289void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f) | 290void inet_frag_destroy(struct inet_frag_queue *q) |
290{ 291 struct sk_buff *fp; 292 struct netns_frags *nf; 293 unsigned int sum, sum_truesize = 0; | 291{ 292 struct sk_buff *fp; 293 struct netns_frags *nf; 294 unsigned int sum, sum_truesize = 0; |
295 struct inet_frags *f; |
|
294 295 WARN_ON(!(q->flags & INET_FRAG_COMPLETE)); 296 WARN_ON(del_timer(&q->timer) != 0); 297 298 /* Release all fragment data. */ 299 fp = q->fragments; 300 nf = q->net; | 296 297 WARN_ON(!(q->flags & INET_FRAG_COMPLETE)); 298 WARN_ON(del_timer(&q->timer) != 0); 299 300 /* Release all fragment data. */ 301 fp = q->fragments; 302 nf = q->net; |
303 f = nf->f; |
|
301 while (fp) { 302 struct sk_buff *xp = fp->next; 303 304 sum_truesize += fp->truesize; 305 kfree_skb(fp); 306 fp = xp; 307 } 308 sum = sum_truesize + f->qsize; --- 19 unchanged lines hidden (view full) --- 328 * such entry could have been created on other cpu before 329 * we acquired hash bucket lock. 330 */ 331 hlist_for_each_entry(qp, &hb->chain, list) { 332 if (qp->net == nf && f->match(qp, arg)) { 333 refcount_inc(&qp->refcnt); 334 spin_unlock(&hb->chain_lock); 335 qp_in->flags |= INET_FRAG_COMPLETE; | 304 while (fp) { 305 struct sk_buff *xp = fp->next; 306 307 sum_truesize += fp->truesize; 308 kfree_skb(fp); 309 fp = xp; 310 } 311 sum = sum_truesize + f->qsize; --- 19 unchanged lines hidden (view full) --- 331 * such entry could have been created on other cpu before 332 * we acquired hash bucket lock. 333 */ 334 hlist_for_each_entry(qp, &hb->chain, list) { 335 if (qp->net == nf && f->match(qp, arg)) { 336 refcount_inc(&qp->refcnt); 337 spin_unlock(&hb->chain_lock); 338 qp_in->flags |= INET_FRAG_COMPLETE; |
336 inet_frag_put(qp_in, f); | 339 inet_frag_put(qp_in); |
337 return qp; 338 } 339 } 340#endif 341 qp = qp_in; 342 if (!mod_timer(&qp->timer, jiffies + nf->timeout)) 343 refcount_inc(&qp->refcnt); 344 --- 96 unchanged lines hidden --- | 340 return qp; 341 } 342 } 343#endif 344 qp = qp_in; 345 if (!mod_timer(&qp->timer, jiffies + nf->timeout)) 346 refcount_inc(&qp->refcnt); 347 --- 96 unchanged lines hidden --- |