ipcomp.c (12df7556705aae97f24a397377e17898700d7192) ipcomp.c (6f912042256c12b0927438122594f5379b364f5d)
1/*
2 * IP Payload Compression Protocol (IPComp) - RFC3173.
3 *
4 * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)

--- 276 unchanged lines hidden (view full) ---

285
286 if (--ipcomp_scratch_users)
287 return;
288
289 scratches = ipcomp_scratches;
290 if (!scratches)
291 return;
292
1/*
2 * IP Payload Compression Protocol (IPComp) - RFC3173.
3 *
4 * Copyright (c) 2003 James Morris <jmorris@intercode.com.au>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)

--- 276 unchanged lines hidden (view full) ---

285
286 if (--ipcomp_scratch_users)
287 return;
288
289 scratches = ipcomp_scratches;
290 if (!scratches)
291 return;
292
293 for_each_cpu(i) {
293 for_each_possible_cpu(i) {
294 void *scratch = *per_cpu_ptr(scratches, i);
295 if (scratch)
296 vfree(scratch);
297 }
298
299 free_percpu(scratches);
300}
301

--- 6 unchanged lines hidden (view full) ---

308 return ipcomp_scratches;
309
310 scratches = alloc_percpu(void *);
311 if (!scratches)
312 return NULL;
313
314 ipcomp_scratches = scratches;
315
294 void *scratch = *per_cpu_ptr(scratches, i);
295 if (scratch)
296 vfree(scratch);
297 }
298
299 free_percpu(scratches);
300}
301

--- 6 unchanged lines hidden (view full) ---

308 return ipcomp_scratches;
309
310 scratches = alloc_percpu(void *);
311 if (!scratches)
312 return NULL;
313
314 ipcomp_scratches = scratches;
315
316 for_each_cpu(i) {
316 for_each_possible_cpu(i) {
317 void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE);
318 if (!scratch)
319 return NULL;
320 *per_cpu_ptr(scratches, i) = scratch;
321 }
322
323 return scratches;
324}

--- 14 unchanged lines hidden (view full) ---

339 return;
340
341 list_del(&pos->list);
342 kfree(pos);
343
344 if (!tfms)
345 return;
346
317 void *scratch = vmalloc(IPCOMP_SCRATCH_SIZE);
318 if (!scratch)
319 return NULL;
320 *per_cpu_ptr(scratches, i) = scratch;
321 }
322
323 return scratches;
324}

--- 14 unchanged lines hidden (view full) ---

339 return;
340
341 list_del(&pos->list);
342 kfree(pos);
343
344 if (!tfms)
345 return;
346
347 for_each_cpu(cpu) {
347 for_each_possible_cpu(cpu) {
348 struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu);
349 crypto_free_tfm(tfm);
350 }
351 free_percpu(tfms);
352}
353
354static struct crypto_tfm **ipcomp_alloc_tfms(const char *alg_name)
355{

--- 23 unchanged lines hidden (view full) ---

379 pos->users = 1;
380 INIT_LIST_HEAD(&pos->list);
381 list_add(&pos->list, &ipcomp_tfms_list);
382
383 pos->tfms = tfms = alloc_percpu(struct crypto_tfm *);
384 if (!tfms)
385 goto error;
386
348 struct crypto_tfm *tfm = *per_cpu_ptr(tfms, cpu);
349 crypto_free_tfm(tfm);
350 }
351 free_percpu(tfms);
352}
353
354static struct crypto_tfm **ipcomp_alloc_tfms(const char *alg_name)
355{

--- 23 unchanged lines hidden (view full) ---

379 pos->users = 1;
380 INIT_LIST_HEAD(&pos->list);
381 list_add(&pos->list, &ipcomp_tfms_list);
382
383 pos->tfms = tfms = alloc_percpu(struct crypto_tfm *);
384 if (!tfms)
385 goto error;
386
387 for_each_cpu(cpu) {
387 for_each_possible_cpu(cpu) {
388 struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0);
389 if (!tfm)
390 goto error;
391 *per_cpu_ptr(tfms, cpu) = tfm;
392 }
393
394 return tfms;
395

--- 124 unchanged lines hidden ---
388 struct crypto_tfm *tfm = crypto_alloc_tfm(alg_name, 0);
389 if (!tfm)
390 goto error;
391 *per_cpu_ptr(tfms, cpu) = tfm;
392 }
393
394 return tfms;
395

--- 124 unchanged lines hidden ---