2 * padata.h - header for the padata parallelization interface
4 * Copyright (C) 2008, 2009 secunet Security Networks AG
5 * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
24 #include <linux/workqueue.h>
25 #include <linux/spinlock.h>
26 #include <linux/list.h>
27 #include <linux/timer.h>
30 struct list_head list;
31 struct parallel_data *pd;
35 void (*parallel)(struct padata_priv *padata);
36 void (*serial)(struct padata_priv *padata);
40 struct list_head list;
45 struct padata_list parallel;
46 struct padata_list reorder;
47 struct padata_list serial;
48 struct work_struct pwork;
49 struct work_struct swork;
50 struct parallel_data *pd;
55 struct parallel_data {
56 struct padata_instance *pinst;
57 struct padata_queue *queue;
59 atomic_t reorder_objects;
61 unsigned int max_seq_nr;
62 cpumask_var_t cpumask;
64 struct timer_list timer;
67 struct padata_instance {
68 struct notifier_block cpu_notifier;
69 struct workqueue_struct *wq;
70 struct parallel_data *pd;
71 cpumask_var_t cpumask;
75 #define PADATA_RESET 2
78 extern struct padata_instance *padata_alloc(const struct cpumask *cpumask,
79 struct workqueue_struct *wq);
80 extern void padata_free(struct padata_instance *pinst);
81 extern int padata_do_parallel(struct padata_instance *pinst,
82 struct padata_priv *padata, int cb_cpu);
83 extern void padata_do_serial(struct padata_priv *padata);
84 extern int padata_set_cpumask(struct padata_instance *pinst,
85 cpumask_var_t cpumask);
86 extern int padata_add_cpu(struct padata_instance *pinst, int cpu);
87 extern int padata_remove_cpu(struct padata_instance *pinst, int cpu);
88 extern void padata_start(struct padata_instance *pinst);
89 extern void padata_stop(struct padata_instance *pinst);