Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
padata.h
Go to the documentation of this file.
1 /*
2  * padata.h - header for the padata parallelization interface
3  *
4  * Copyright (C) 2008, 2009 secunet Security Networks AG
5  * Copyright (C) 2008, 2009 Steffen Klassert <[email protected]>
6  *
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.
10  *
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
14  * more details.
15  *
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.
19  */
20 
21 #ifndef PADATA_H
22 #define PADATA_H
23 
24 #include <linux/workqueue.h>
25 #include <linux/spinlock.h>
26 #include <linux/list.h>
27 #include <linux/timer.h>
28 #include <linux/notifier.h>
29 #include <linux/kobject.h>
30 
31 #define PADATA_CPU_SERIAL 0x01
32 #define PADATA_CPU_PARALLEL 0x02
33 
45 struct padata_priv {
46  struct list_head list;
47  struct parallel_data *pd;
48  int cb_cpu;
49  int info;
50  void (*parallel)(struct padata_priv *padata);
51  void (*serial)(struct padata_priv *padata);
52 };
53 
60 struct padata_list {
61  struct list_head list;
63 };
64 
74  struct work_struct work;
75  struct parallel_data *pd;
76 };
77 
94  struct parallel_data *pd;
95  struct work_struct work;
97  int cpu_index;
98 };
99 
109 };
110 
135  unsigned int seq_nr;
136  unsigned int processed;
138 };
139 
157  struct parallel_data *pd;
160  struct kobject kobj;
161  struct mutex lock;
163 #define PADATA_INIT 1
164 #define PADATA_RESET 2
165 #define PADATA_INVALID 4
166 };
167 
169  struct workqueue_struct *wq);
170 extern struct padata_instance *padata_alloc(struct workqueue_struct *wq,
171  const struct cpumask *pcpumask,
172  const struct cpumask *cbcpumask);
173 extern void padata_free(struct padata_instance *pinst);
174 extern int padata_do_parallel(struct padata_instance *pinst,
175  struct padata_priv *padata, int cb_cpu);
176 extern void padata_do_serial(struct padata_priv *padata);
177 extern int padata_set_cpumask(struct padata_instance *pinst, int cpumask_type,
179 extern int padata_set_cpumasks(struct padata_instance *pinst,
180  cpumask_var_t pcpumask,
181  cpumask_var_t cbcpumask);
182 extern int padata_add_cpu(struct padata_instance *pinst, int cpu, int mask);
183 extern int padata_remove_cpu(struct padata_instance *pinst, int cpu, int mask);
184 extern int padata_start(struct padata_instance *pinst);
185 extern void padata_stop(struct padata_instance *pinst);
186 extern int padata_register_cpumask_notifier(struct padata_instance *pinst,
187  struct notifier_block *nblock);
188 extern int padata_unregister_cpumask_notifier(struct padata_instance *pinst,
189  struct notifier_block *nblock);
190 #endif