aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/reassembly.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/reassembly.c')
-rw-r--r--net/ipv6/reassembly.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index c7d4961bbcf7..940b7d2383ec 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -152,12 +152,9 @@ static inline void frag_kfree_skb(struct sk_buff *skb, int *work)
152 kfree_skb(skb); 152 kfree_skb(skb);
153} 153}
154 154
155static inline void frag_free_queue(struct frag_queue *fq, int *work) 155static void ip6_frag_free(struct inet_frag_queue *fq)
156{ 156{
157 if (work) 157 kfree(container_of(fq, struct frag_queue, q));
158 *work -= sizeof(struct frag_queue);
159 atomic_sub(sizeof(struct frag_queue), &ip6_frags.mem);
160 kfree(fq);
161} 158}
162 159
163static inline struct frag_queue *frag_alloc_queue(void) 160static inline struct frag_queue *frag_alloc_queue(void)
@@ -172,30 +169,10 @@ static inline struct frag_queue *frag_alloc_queue(void)
172 169
173/* Destruction primitives. */ 170/* Destruction primitives. */
174 171
175/* Complete destruction of fq. */
176static void ip6_frag_destroy(struct frag_queue *fq, int *work)
177{
178 struct sk_buff *fp;
179
180 BUG_TRAP(fq->q.last_in&COMPLETE);
181 BUG_TRAP(del_timer(&fq->q.timer) == 0);
182
183 /* Release all fragment data. */
184 fp = fq->q.fragments;
185 while (fp) {
186 struct sk_buff *xp = fp->next;
187
188 frag_kfree_skb(fp, work);
189 fp = xp;
190 }
191
192 frag_free_queue(fq, work);
193}
194
195static __inline__ void fq_put(struct frag_queue *fq, int *work) 172static __inline__ void fq_put(struct frag_queue *fq, int *work)
196{ 173{
197 if (atomic_dec_and_test(&fq->q.refcnt)) 174 if (atomic_dec_and_test(&fq->q.refcnt))
198 ip6_frag_destroy(fq, work); 175 inet_frag_destroy(&fq->q, &ip6_frags, work);
199} 176}
200 177
201/* Kill fq entry. It is not destroyed immediately, 178/* Kill fq entry. It is not destroyed immediately,
@@ -744,5 +721,8 @@ void __init ipv6_frag_init(void)
744 721
745 ip6_frags.ctl = &ip6_frags_ctl; 722 ip6_frags.ctl = &ip6_frags_ctl;
746 ip6_frags.hashfn = ip6_hashfn; 723 ip6_frags.hashfn = ip6_hashfn;
724 ip6_frags.destructor = ip6_frag_free;
725 ip6_frags.skb_free = NULL;
726 ip6_frags.qsize = sizeof(struct frag_queue);
747 inet_frags_init(&ip6_frags); 727 inet_frags_init(&ip6_frags);
748} 728}